blob: 6afb072dae8e74171abf00d5d84d5e13525886da [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
Rich Lanecb18dbd2014-12-18 10:02:29 -080072 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070073 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800144 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700145 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800230 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700231 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800326 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700327 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800428 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700429 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800534 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800535 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800602 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800603 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800673 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700674 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800737 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700738 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800801 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700802 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800872 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700873 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
Rich Lanecb18dbd2014-12-18 10:02:29 -0800950 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700951 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001028 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001029 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001106 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001107 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001184 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001185 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001250 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001251 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001304 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001305 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001380 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001381 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001460 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001461 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001533 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001534 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001611 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001612 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001678 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001679 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001745 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001746 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001812 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001813 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001884 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001885 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08001961 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001962 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002033 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002034 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002100 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002101 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002183 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002184 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002274 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002275 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002357 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002358 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002453 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002454 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002544 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002545 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002622 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002623 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002705 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002706 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002788 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002789 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002871 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002872 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08002959 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002960 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003055 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003056 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003143 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003144 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003210 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003211 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003282 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003283 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003359 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003360 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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003392class bsn_generic_stats_reply(bsn_stats_reply):
3393 version = 5
3394 type = 19
3395 stats_type = 65535
3396 experimenter = 6035143
3397 subtype = 16
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_generic_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, 4)
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 == 16)
3449 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_generic_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_generic_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[16] = bsn_generic_stats_reply
3479
3480class bsn_generic_stats_request(bsn_stats_request):
3481 version = 5
3482 type = 18
3483 stats_type = 65535
3484 experimenter = 6035143
3485 subtype = 16
3486
3487 def __init__(self, xid=None, flags=None, name=None, tlvs=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 name != None:
3497 self.name = name
3498 else:
3499 self.name = ""
3500 if tlvs != None:
3501 self.tlvs = tlvs
3502 else:
3503 self.tlvs = []
3504 return
3505
3506 def pack(self):
3507 packed = []
3508 packed.append(struct.pack("!B", self.version))
3509 packed.append(struct.pack("!B", self.type))
3510 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3511 packed.append(struct.pack("!L", self.xid))
3512 packed.append(struct.pack("!H", self.stats_type))
3513 packed.append(struct.pack("!H", self.flags))
3514 packed.append('\x00' * 4)
3515 packed.append(struct.pack("!L", self.experimenter))
3516 packed.append(struct.pack("!L", self.subtype))
3517 packed.append(struct.pack("!64s", self.name))
3518 packed.append(loxi.generic_util.pack_list(self.tlvs))
3519 length = sum([len(x) for x in packed])
3520 packed[2] = struct.pack("!H", length)
3521 return ''.join(packed)
3522
3523 @staticmethod
3524 def unpack(reader):
3525 obj = bsn_generic_stats_request()
3526 _version = reader.read("!B")[0]
3527 assert(_version == 5)
3528 _type = reader.read("!B")[0]
3529 assert(_type == 18)
3530 _length = reader.read("!H")[0]
3531 orig_reader = reader
3532 reader = orig_reader.slice(_length, 4)
3533 obj.xid = reader.read("!L")[0]
3534 _stats_type = reader.read("!H")[0]
3535 assert(_stats_type == 65535)
3536 obj.flags = reader.read("!H")[0]
3537 reader.skip(4)
3538 _experimenter = reader.read("!L")[0]
3539 assert(_experimenter == 6035143)
3540 _subtype = reader.read("!L")[0]
3541 assert(_subtype == 16)
3542 obj.name = reader.read("!64s")[0].rstrip("\x00")
3543 obj.tlvs = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3544 return obj
3545
3546 def __eq__(self, other):
3547 if type(self) != type(other): return False
3548 if self.xid != other.xid: return False
3549 if self.flags != other.flags: return False
3550 if self.name != other.name: return False
3551 if self.tlvs != other.tlvs: return False
3552 return True
3553
3554 def pretty_print(self, q):
3555 q.text("bsn_generic_stats_request {")
3556 with q.group():
3557 with q.indent(2):
3558 q.breakable()
3559 q.text("xid = ");
3560 if self.xid != None:
3561 q.text("%#x" % self.xid)
3562 else:
3563 q.text('None')
3564 q.text(","); q.breakable()
3565 q.text("flags = ");
3566 q.text("%#x" % self.flags)
3567 q.text(","); q.breakable()
3568 q.text("name = ");
3569 q.pp(self.name)
3570 q.text(","); q.breakable()
3571 q.text("tlvs = ");
3572 q.pp(self.tlvs)
3573 q.breakable()
3574 q.text('}')
3575
3576bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3577
Rich Laneccd32ed2014-11-10 17:48:24 -08003578class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3579 version = 5
3580 type = 19
3581 stats_type = 65535
3582 experimenter = 6035143
3583 subtype = 5
3584
3585 def __init__(self, xid=None, flags=None, entries=None):
3586 if xid != None:
3587 self.xid = xid
3588 else:
3589 self.xid = None
3590 if flags != None:
3591 self.flags = flags
3592 else:
3593 self.flags = 0
3594 if entries != None:
3595 self.entries = entries
3596 else:
3597 self.entries = []
3598 return
3599
3600 def pack(self):
3601 packed = []
3602 packed.append(struct.pack("!B", self.version))
3603 packed.append(struct.pack("!B", self.type))
3604 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3605 packed.append(struct.pack("!L", self.xid))
3606 packed.append(struct.pack("!H", self.stats_type))
3607 packed.append(struct.pack("!H", self.flags))
3608 packed.append('\x00' * 4)
3609 packed.append(struct.pack("!L", self.experimenter))
3610 packed.append(struct.pack("!L", self.subtype))
3611 packed.append(loxi.generic_util.pack_list(self.entries))
3612 length = sum([len(x) for x in packed])
3613 packed[2] = struct.pack("!H", length)
3614 return ''.join(packed)
3615
3616 @staticmethod
3617 def unpack(reader):
3618 obj = bsn_gentable_bucket_stats_reply()
3619 _version = reader.read("!B")[0]
3620 assert(_version == 5)
3621 _type = reader.read("!B")[0]
3622 assert(_type == 19)
3623 _length = reader.read("!H")[0]
3624 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003625 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003626 obj.xid = reader.read("!L")[0]
3627 _stats_type = reader.read("!H")[0]
3628 assert(_stats_type == 65535)
3629 obj.flags = reader.read("!H")[0]
3630 reader.skip(4)
3631 _experimenter = reader.read("!L")[0]
3632 assert(_experimenter == 6035143)
3633 _subtype = reader.read("!L")[0]
3634 assert(_subtype == 5)
3635 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
3636 return obj
3637
3638 def __eq__(self, other):
3639 if type(self) != type(other): return False
3640 if self.xid != other.xid: return False
3641 if self.flags != other.flags: return False
3642 if self.entries != other.entries: return False
3643 return True
3644
3645 def pretty_print(self, q):
3646 q.text("bsn_gentable_bucket_stats_reply {")
3647 with q.group():
3648 with q.indent(2):
3649 q.breakable()
3650 q.text("xid = ");
3651 if self.xid != None:
3652 q.text("%#x" % self.xid)
3653 else:
3654 q.text('None')
3655 q.text(","); q.breakable()
3656 q.text("flags = ");
3657 q.text("%#x" % self.flags)
3658 q.text(","); q.breakable()
3659 q.text("entries = ");
3660 q.pp(self.entries)
3661 q.breakable()
3662 q.text('}')
3663
3664bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3665
3666class bsn_gentable_bucket_stats_request(bsn_stats_request):
3667 version = 5
3668 type = 18
3669 stats_type = 65535
3670 experimenter = 6035143
3671 subtype = 5
3672
3673 def __init__(self, xid=None, flags=None, table_id=None):
3674 if xid != None:
3675 self.xid = xid
3676 else:
3677 self.xid = None
3678 if flags != None:
3679 self.flags = flags
3680 else:
3681 self.flags = 0
3682 if table_id != None:
3683 self.table_id = table_id
3684 else:
3685 self.table_id = 0
3686 return
3687
3688 def pack(self):
3689 packed = []
3690 packed.append(struct.pack("!B", self.version))
3691 packed.append(struct.pack("!B", self.type))
3692 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3693 packed.append(struct.pack("!L", self.xid))
3694 packed.append(struct.pack("!H", self.stats_type))
3695 packed.append(struct.pack("!H", self.flags))
3696 packed.append('\x00' * 4)
3697 packed.append(struct.pack("!L", self.experimenter))
3698 packed.append(struct.pack("!L", self.subtype))
3699 packed.append(struct.pack("!H", self.table_id))
3700 length = sum([len(x) for x in packed])
3701 packed[2] = struct.pack("!H", length)
3702 return ''.join(packed)
3703
3704 @staticmethod
3705 def unpack(reader):
3706 obj = bsn_gentable_bucket_stats_request()
3707 _version = reader.read("!B")[0]
3708 assert(_version == 5)
3709 _type = reader.read("!B")[0]
3710 assert(_type == 18)
3711 _length = reader.read("!H")[0]
3712 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003713 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003714 obj.xid = reader.read("!L")[0]
3715 _stats_type = reader.read("!H")[0]
3716 assert(_stats_type == 65535)
3717 obj.flags = reader.read("!H")[0]
3718 reader.skip(4)
3719 _experimenter = reader.read("!L")[0]
3720 assert(_experimenter == 6035143)
3721 _subtype = reader.read("!L")[0]
3722 assert(_subtype == 5)
3723 obj.table_id = reader.read("!H")[0]
3724 return obj
3725
3726 def __eq__(self, other):
3727 if type(self) != type(other): return False
3728 if self.xid != other.xid: return False
3729 if self.flags != other.flags: return False
3730 if self.table_id != other.table_id: return False
3731 return True
3732
3733 def pretty_print(self, q):
3734 q.text("bsn_gentable_bucket_stats_request {")
3735 with q.group():
3736 with q.indent(2):
3737 q.breakable()
3738 q.text("xid = ");
3739 if self.xid != None:
3740 q.text("%#x" % self.xid)
3741 else:
3742 q.text('None')
3743 q.text(","); q.breakable()
3744 q.text("flags = ");
3745 q.text("%#x" % self.flags)
3746 q.text(","); q.breakable()
3747 q.text("table_id = ");
3748 q.text("%#x" % self.table_id)
3749 q.breakable()
3750 q.text('}')
3751
3752bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3753
3754class bsn_gentable_clear_reply(bsn_header):
3755 version = 5
3756 type = 4
3757 experimenter = 6035143
3758 subtype = 49
3759
3760 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3761 if xid != None:
3762 self.xid = xid
3763 else:
3764 self.xid = None
3765 if table_id != None:
3766 self.table_id = table_id
3767 else:
3768 self.table_id = 0
3769 if deleted_count != None:
3770 self.deleted_count = deleted_count
3771 else:
3772 self.deleted_count = 0
3773 if error_count != None:
3774 self.error_count = error_count
3775 else:
3776 self.error_count = 0
3777 return
3778
3779 def pack(self):
3780 packed = []
3781 packed.append(struct.pack("!B", self.version))
3782 packed.append(struct.pack("!B", self.type))
3783 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3784 packed.append(struct.pack("!L", self.xid))
3785 packed.append(struct.pack("!L", self.experimenter))
3786 packed.append(struct.pack("!L", self.subtype))
3787 packed.append(struct.pack("!H", self.table_id))
3788 packed.append('\x00' * 2)
3789 packed.append(struct.pack("!L", self.deleted_count))
3790 packed.append(struct.pack("!L", self.error_count))
3791 length = sum([len(x) for x in packed])
3792 packed[2] = struct.pack("!H", length)
3793 return ''.join(packed)
3794
3795 @staticmethod
3796 def unpack(reader):
3797 obj = bsn_gentable_clear_reply()
3798 _version = reader.read("!B")[0]
3799 assert(_version == 5)
3800 _type = reader.read("!B")[0]
3801 assert(_type == 4)
3802 _length = reader.read("!H")[0]
3803 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003804 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003805 obj.xid = reader.read("!L")[0]
3806 _experimenter = reader.read("!L")[0]
3807 assert(_experimenter == 6035143)
3808 _subtype = reader.read("!L")[0]
3809 assert(_subtype == 49)
3810 obj.table_id = reader.read("!H")[0]
3811 reader.skip(2)
3812 obj.deleted_count = reader.read("!L")[0]
3813 obj.error_count = reader.read("!L")[0]
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.table_id != other.table_id: return False
3820 if self.deleted_count != other.deleted_count: return False
3821 if self.error_count != other.error_count: return False
3822 return True
3823
3824 def pretty_print(self, q):
3825 q.text("bsn_gentable_clear_reply {")
3826 with q.group():
3827 with q.indent(2):
3828 q.breakable()
3829 q.text("xid = ");
3830 if self.xid != None:
3831 q.text("%#x" % self.xid)
3832 else:
3833 q.text('None')
3834 q.text(","); q.breakable()
3835 q.text("table_id = ");
3836 q.text("%#x" % self.table_id)
3837 q.text(","); q.breakable()
3838 q.text("deleted_count = ");
3839 q.text("%#x" % self.deleted_count)
3840 q.text(","); q.breakable()
3841 q.text("error_count = ");
3842 q.text("%#x" % self.error_count)
3843 q.breakable()
3844 q.text('}')
3845
3846bsn_header.subtypes[49] = bsn_gentable_clear_reply
3847
3848class bsn_gentable_clear_request(bsn_header):
3849 version = 5
3850 type = 4
3851 experimenter = 6035143
3852 subtype = 48
3853
3854 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3855 if xid != None:
3856 self.xid = xid
3857 else:
3858 self.xid = None
3859 if table_id != None:
3860 self.table_id = table_id
3861 else:
3862 self.table_id = 0
3863 if checksum != None:
3864 self.checksum = checksum
3865 else:
3866 self.checksum = 0
3867 if checksum_mask != None:
3868 self.checksum_mask = checksum_mask
3869 else:
3870 self.checksum_mask = 0
3871 return
3872
3873 def pack(self):
3874 packed = []
3875 packed.append(struct.pack("!B", self.version))
3876 packed.append(struct.pack("!B", self.type))
3877 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3878 packed.append(struct.pack("!L", self.xid))
3879 packed.append(struct.pack("!L", self.experimenter))
3880 packed.append(struct.pack("!L", self.subtype))
3881 packed.append(struct.pack("!H", self.table_id))
3882 packed.append('\x00' * 2)
3883 packed.append(util.pack_checksum_128(self.checksum))
3884 packed.append(util.pack_checksum_128(self.checksum_mask))
3885 length = sum([len(x) for x in packed])
3886 packed[2] = struct.pack("!H", length)
3887 return ''.join(packed)
3888
3889 @staticmethod
3890 def unpack(reader):
3891 obj = bsn_gentable_clear_request()
3892 _version = reader.read("!B")[0]
3893 assert(_version == 5)
3894 _type = reader.read("!B")[0]
3895 assert(_type == 4)
3896 _length = reader.read("!H")[0]
3897 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003898 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003899 obj.xid = reader.read("!L")[0]
3900 _experimenter = reader.read("!L")[0]
3901 assert(_experimenter == 6035143)
3902 _subtype = reader.read("!L")[0]
3903 assert(_subtype == 48)
3904 obj.table_id = reader.read("!H")[0]
3905 reader.skip(2)
3906 obj.checksum = util.unpack_checksum_128(reader)
3907 obj.checksum_mask = util.unpack_checksum_128(reader)
3908 return obj
3909
3910 def __eq__(self, other):
3911 if type(self) != type(other): return False
3912 if self.xid != other.xid: return False
3913 if self.table_id != other.table_id: return False
3914 if self.checksum != other.checksum: return False
3915 if self.checksum_mask != other.checksum_mask: return False
3916 return True
3917
3918 def pretty_print(self, q):
3919 q.text("bsn_gentable_clear_request {")
3920 with q.group():
3921 with q.indent(2):
3922 q.breakable()
3923 q.text("xid = ");
3924 if self.xid != None:
3925 q.text("%#x" % self.xid)
3926 else:
3927 q.text('None')
3928 q.text(","); q.breakable()
3929 q.text("table_id = ");
3930 q.text("%#x" % self.table_id)
3931 q.text(","); q.breakable()
3932 q.text("checksum = ");
3933 q.pp(self.checksum)
3934 q.text(","); q.breakable()
3935 q.text("checksum_mask = ");
3936 q.pp(self.checksum_mask)
3937 q.breakable()
3938 q.text('}')
3939
3940bsn_header.subtypes[48] = bsn_gentable_clear_request
3941
3942class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3943 version = 5
3944 type = 19
3945 stats_type = 65535
3946 experimenter = 6035143
3947 subtype = 4
3948
3949 def __init__(self, xid=None, flags=None, entries=None):
3950 if xid != None:
3951 self.xid = xid
3952 else:
3953 self.xid = None
3954 if flags != None:
3955 self.flags = flags
3956 else:
3957 self.flags = 0
3958 if entries != None:
3959 self.entries = entries
3960 else:
3961 self.entries = []
3962 return
3963
3964 def pack(self):
3965 packed = []
3966 packed.append(struct.pack("!B", self.version))
3967 packed.append(struct.pack("!B", self.type))
3968 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3969 packed.append(struct.pack("!L", self.xid))
3970 packed.append(struct.pack("!H", self.stats_type))
3971 packed.append(struct.pack("!H", self.flags))
3972 packed.append('\x00' * 4)
3973 packed.append(struct.pack("!L", self.experimenter))
3974 packed.append(struct.pack("!L", self.subtype))
3975 packed.append(loxi.generic_util.pack_list(self.entries))
3976 length = sum([len(x) for x in packed])
3977 packed[2] = struct.pack("!H", length)
3978 return ''.join(packed)
3979
3980 @staticmethod
3981 def unpack(reader):
3982 obj = bsn_gentable_desc_stats_reply()
3983 _version = reader.read("!B")[0]
3984 assert(_version == 5)
3985 _type = reader.read("!B")[0]
3986 assert(_type == 19)
3987 _length = reader.read("!H")[0]
3988 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003989 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003990 obj.xid = reader.read("!L")[0]
3991 _stats_type = reader.read("!H")[0]
3992 assert(_stats_type == 65535)
3993 obj.flags = reader.read("!H")[0]
3994 reader.skip(4)
3995 _experimenter = reader.read("!L")[0]
3996 assert(_experimenter == 6035143)
3997 _subtype = reader.read("!L")[0]
3998 assert(_subtype == 4)
3999 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
4000 return obj
4001
4002 def __eq__(self, other):
4003 if type(self) != type(other): return False
4004 if self.xid != other.xid: return False
4005 if self.flags != other.flags: return False
4006 if self.entries != other.entries: return False
4007 return True
4008
4009 def pretty_print(self, q):
4010 q.text("bsn_gentable_desc_stats_reply {")
4011 with q.group():
4012 with q.indent(2):
4013 q.breakable()
4014 q.text("xid = ");
4015 if self.xid != None:
4016 q.text("%#x" % self.xid)
4017 else:
4018 q.text('None')
4019 q.text(","); q.breakable()
4020 q.text("flags = ");
4021 q.text("%#x" % self.flags)
4022 q.text(","); q.breakable()
4023 q.text("entries = ");
4024 q.pp(self.entries)
4025 q.breakable()
4026 q.text('}')
4027
4028bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4029
4030class bsn_gentable_desc_stats_request(bsn_stats_request):
4031 version = 5
4032 type = 18
4033 stats_type = 65535
4034 experimenter = 6035143
4035 subtype = 4
4036
4037 def __init__(self, xid=None, flags=None):
4038 if xid != None:
4039 self.xid = xid
4040 else:
4041 self.xid = None
4042 if flags != None:
4043 self.flags = flags
4044 else:
4045 self.flags = 0
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("!H", self.stats_type))
4055 packed.append(struct.pack("!H", self.flags))
4056 packed.append('\x00' * 4)
4057 packed.append(struct.pack("!L", self.experimenter))
4058 packed.append(struct.pack("!L", self.subtype))
4059 length = sum([len(x) for x in packed])
4060 packed[2] = struct.pack("!H", length)
4061 return ''.join(packed)
4062
4063 @staticmethod
4064 def unpack(reader):
4065 obj = bsn_gentable_desc_stats_request()
4066 _version = reader.read("!B")[0]
4067 assert(_version == 5)
4068 _type = reader.read("!B")[0]
4069 assert(_type == 18)
4070 _length = reader.read("!H")[0]
4071 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004072 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004073 obj.xid = reader.read("!L")[0]
4074 _stats_type = reader.read("!H")[0]
4075 assert(_stats_type == 65535)
4076 obj.flags = reader.read("!H")[0]
4077 reader.skip(4)
4078 _experimenter = reader.read("!L")[0]
4079 assert(_experimenter == 6035143)
4080 _subtype = reader.read("!L")[0]
4081 assert(_subtype == 4)
4082 return obj
4083
4084 def __eq__(self, other):
4085 if type(self) != type(other): return False
4086 if self.xid != other.xid: return False
4087 if self.flags != other.flags: return False
4088 return True
4089
4090 def pretty_print(self, q):
4091 q.text("bsn_gentable_desc_stats_request {")
4092 with q.group():
4093 with q.indent(2):
4094 q.breakable()
4095 q.text("xid = ");
4096 if self.xid != None:
4097 q.text("%#x" % self.xid)
4098 else:
4099 q.text('None')
4100 q.text(","); q.breakable()
4101 q.text("flags = ");
4102 q.text("%#x" % self.flags)
4103 q.breakable()
4104 q.text('}')
4105
4106bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4107
4108class bsn_gentable_entry_add(bsn_header):
4109 version = 5
4110 type = 4
4111 experimenter = 6035143
4112 subtype = 46
4113
4114 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4115 if xid != None:
4116 self.xid = xid
4117 else:
4118 self.xid = None
4119 if table_id != None:
4120 self.table_id = table_id
4121 else:
4122 self.table_id = 0
4123 if checksum != None:
4124 self.checksum = checksum
4125 else:
4126 self.checksum = 0
4127 if key != None:
4128 self.key = key
4129 else:
4130 self.key = []
4131 if value != None:
4132 self.value = value
4133 else:
4134 self.value = []
4135 return
4136
4137 def pack(self):
4138 packed = []
4139 packed.append(struct.pack("!B", self.version))
4140 packed.append(struct.pack("!B", self.type))
4141 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4142 packed.append(struct.pack("!L", self.xid))
4143 packed.append(struct.pack("!L", self.experimenter))
4144 packed.append(struct.pack("!L", self.subtype))
4145 packed.append(struct.pack("!H", self.table_id))
4146 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4147 packed.append(util.pack_checksum_128(self.checksum))
4148 packed.append(loxi.generic_util.pack_list(self.key))
4149 packed[7] = struct.pack("!H", len(packed[-1]))
4150 packed.append(loxi.generic_util.pack_list(self.value))
4151 length = sum([len(x) for x in packed])
4152 packed[2] = struct.pack("!H", length)
4153 return ''.join(packed)
4154
4155 @staticmethod
4156 def unpack(reader):
4157 obj = bsn_gentable_entry_add()
4158 _version = reader.read("!B")[0]
4159 assert(_version == 5)
4160 _type = reader.read("!B")[0]
4161 assert(_type == 4)
4162 _length = reader.read("!H")[0]
4163 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004164 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004165 obj.xid = reader.read("!L")[0]
4166 _experimenter = reader.read("!L")[0]
4167 assert(_experimenter == 6035143)
4168 _subtype = reader.read("!L")[0]
4169 assert(_subtype == 46)
4170 obj.table_id = reader.read("!H")[0]
4171 _key_length = reader.read("!H")[0]
4172 obj.checksum = util.unpack_checksum_128(reader)
4173 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
4174 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4175 return obj
4176
4177 def __eq__(self, other):
4178 if type(self) != type(other): return False
4179 if self.xid != other.xid: return False
4180 if self.table_id != other.table_id: return False
4181 if self.checksum != other.checksum: return False
4182 if self.key != other.key: return False
4183 if self.value != other.value: return False
4184 return True
4185
4186 def pretty_print(self, q):
4187 q.text("bsn_gentable_entry_add {")
4188 with q.group():
4189 with q.indent(2):
4190 q.breakable()
4191 q.text("xid = ");
4192 if self.xid != None:
4193 q.text("%#x" % self.xid)
4194 else:
4195 q.text('None')
4196 q.text(","); q.breakable()
4197 q.text("table_id = ");
4198 q.text("%#x" % self.table_id)
4199 q.text(","); q.breakable()
4200 q.text("checksum = ");
4201 q.pp(self.checksum)
4202 q.text(","); q.breakable()
4203 q.text("key = ");
4204 q.pp(self.key)
4205 q.text(","); q.breakable()
4206 q.text("value = ");
4207 q.pp(self.value)
4208 q.breakable()
4209 q.text('}')
4210
4211bsn_header.subtypes[46] = bsn_gentable_entry_add
4212
4213class bsn_gentable_entry_delete(bsn_header):
4214 version = 5
4215 type = 4
4216 experimenter = 6035143
4217 subtype = 47
4218
4219 def __init__(self, xid=None, table_id=None, key=None):
4220 if xid != None:
4221 self.xid = xid
4222 else:
4223 self.xid = None
4224 if table_id != None:
4225 self.table_id = table_id
4226 else:
4227 self.table_id = 0
4228 if key != None:
4229 self.key = key
4230 else:
4231 self.key = []
4232 return
4233
4234 def pack(self):
4235 packed = []
4236 packed.append(struct.pack("!B", self.version))
4237 packed.append(struct.pack("!B", self.type))
4238 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4239 packed.append(struct.pack("!L", self.xid))
4240 packed.append(struct.pack("!L", self.experimenter))
4241 packed.append(struct.pack("!L", self.subtype))
4242 packed.append(struct.pack("!H", self.table_id))
4243 packed.append(loxi.generic_util.pack_list(self.key))
4244 length = sum([len(x) for x in packed])
4245 packed[2] = struct.pack("!H", length)
4246 return ''.join(packed)
4247
4248 @staticmethod
4249 def unpack(reader):
4250 obj = bsn_gentable_entry_delete()
4251 _version = reader.read("!B")[0]
4252 assert(_version == 5)
4253 _type = reader.read("!B")[0]
4254 assert(_type == 4)
4255 _length = reader.read("!H")[0]
4256 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004257 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004258 obj.xid = reader.read("!L")[0]
4259 _experimenter = reader.read("!L")[0]
4260 assert(_experimenter == 6035143)
4261 _subtype = reader.read("!L")[0]
4262 assert(_subtype == 47)
4263 obj.table_id = reader.read("!H")[0]
4264 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4265 return obj
4266
4267 def __eq__(self, other):
4268 if type(self) != type(other): return False
4269 if self.xid != other.xid: return False
4270 if self.table_id != other.table_id: return False
4271 if self.key != other.key: return False
4272 return True
4273
4274 def pretty_print(self, q):
4275 q.text("bsn_gentable_entry_delete {")
4276 with q.group():
4277 with q.indent(2):
4278 q.breakable()
4279 q.text("xid = ");
4280 if self.xid != None:
4281 q.text("%#x" % self.xid)
4282 else:
4283 q.text('None')
4284 q.text(","); q.breakable()
4285 q.text("table_id = ");
4286 q.text("%#x" % self.table_id)
4287 q.text(","); q.breakable()
4288 q.text("key = ");
4289 q.pp(self.key)
4290 q.breakable()
4291 q.text('}')
4292
4293bsn_header.subtypes[47] = bsn_gentable_entry_delete
4294
4295class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4296 version = 5
4297 type = 19
4298 stats_type = 65535
4299 experimenter = 6035143
4300 subtype = 2
4301
4302 def __init__(self, xid=None, flags=None, entries=None):
4303 if xid != None:
4304 self.xid = xid
4305 else:
4306 self.xid = None
4307 if flags != None:
4308 self.flags = flags
4309 else:
4310 self.flags = 0
4311 if entries != None:
4312 self.entries = entries
4313 else:
4314 self.entries = []
4315 return
4316
4317 def pack(self):
4318 packed = []
4319 packed.append(struct.pack("!B", self.version))
4320 packed.append(struct.pack("!B", self.type))
4321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4322 packed.append(struct.pack("!L", self.xid))
4323 packed.append(struct.pack("!H", self.stats_type))
4324 packed.append(struct.pack("!H", self.flags))
4325 packed.append('\x00' * 4)
4326 packed.append(struct.pack("!L", self.experimenter))
4327 packed.append(struct.pack("!L", self.subtype))
4328 packed.append(loxi.generic_util.pack_list(self.entries))
4329 length = sum([len(x) for x in packed])
4330 packed[2] = struct.pack("!H", length)
4331 return ''.join(packed)
4332
4333 @staticmethod
4334 def unpack(reader):
4335 obj = bsn_gentable_entry_desc_stats_reply()
4336 _version = reader.read("!B")[0]
4337 assert(_version == 5)
4338 _type = reader.read("!B")[0]
4339 assert(_type == 19)
4340 _length = reader.read("!H")[0]
4341 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004342 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004343 obj.xid = reader.read("!L")[0]
4344 _stats_type = reader.read("!H")[0]
4345 assert(_stats_type == 65535)
4346 obj.flags = reader.read("!H")[0]
4347 reader.skip(4)
4348 _experimenter = reader.read("!L")[0]
4349 assert(_experimenter == 6035143)
4350 _subtype = reader.read("!L")[0]
4351 assert(_subtype == 2)
4352 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
4353 return obj
4354
4355 def __eq__(self, other):
4356 if type(self) != type(other): return False
4357 if self.xid != other.xid: return False
4358 if self.flags != other.flags: return False
4359 if self.entries != other.entries: return False
4360 return True
4361
4362 def pretty_print(self, q):
4363 q.text("bsn_gentable_entry_desc_stats_reply {")
4364 with q.group():
4365 with q.indent(2):
4366 q.breakable()
4367 q.text("xid = ");
4368 if self.xid != None:
4369 q.text("%#x" % self.xid)
4370 else:
4371 q.text('None')
4372 q.text(","); q.breakable()
4373 q.text("flags = ");
4374 q.text("%#x" % self.flags)
4375 q.text(","); q.breakable()
4376 q.text("entries = ");
4377 q.pp(self.entries)
4378 q.breakable()
4379 q.text('}')
4380
4381bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4382
4383class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4384 version = 5
4385 type = 18
4386 stats_type = 65535
4387 experimenter = 6035143
4388 subtype = 2
4389
4390 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4391 if xid != None:
4392 self.xid = xid
4393 else:
4394 self.xid = None
4395 if flags != None:
4396 self.flags = flags
4397 else:
4398 self.flags = 0
4399 if table_id != None:
4400 self.table_id = table_id
4401 else:
4402 self.table_id = 0
4403 if checksum != None:
4404 self.checksum = checksum
4405 else:
4406 self.checksum = 0
4407 if checksum_mask != None:
4408 self.checksum_mask = checksum_mask
4409 else:
4410 self.checksum_mask = 0
4411 return
4412
4413 def pack(self):
4414 packed = []
4415 packed.append(struct.pack("!B", self.version))
4416 packed.append(struct.pack("!B", self.type))
4417 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4418 packed.append(struct.pack("!L", self.xid))
4419 packed.append(struct.pack("!H", self.stats_type))
4420 packed.append(struct.pack("!H", self.flags))
4421 packed.append('\x00' * 4)
4422 packed.append(struct.pack("!L", self.experimenter))
4423 packed.append(struct.pack("!L", self.subtype))
4424 packed.append(struct.pack("!H", self.table_id))
4425 packed.append('\x00' * 2)
4426 packed.append(util.pack_checksum_128(self.checksum))
4427 packed.append(util.pack_checksum_128(self.checksum_mask))
4428 length = sum([len(x) for x in packed])
4429 packed[2] = struct.pack("!H", length)
4430 return ''.join(packed)
4431
4432 @staticmethod
4433 def unpack(reader):
4434 obj = bsn_gentable_entry_desc_stats_request()
4435 _version = reader.read("!B")[0]
4436 assert(_version == 5)
4437 _type = reader.read("!B")[0]
4438 assert(_type == 18)
4439 _length = reader.read("!H")[0]
4440 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004441 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004442 obj.xid = reader.read("!L")[0]
4443 _stats_type = reader.read("!H")[0]
4444 assert(_stats_type == 65535)
4445 obj.flags = reader.read("!H")[0]
4446 reader.skip(4)
4447 _experimenter = reader.read("!L")[0]
4448 assert(_experimenter == 6035143)
4449 _subtype = reader.read("!L")[0]
4450 assert(_subtype == 2)
4451 obj.table_id = reader.read("!H")[0]
4452 reader.skip(2)
4453 obj.checksum = util.unpack_checksum_128(reader)
4454 obj.checksum_mask = util.unpack_checksum_128(reader)
4455 return obj
4456
4457 def __eq__(self, other):
4458 if type(self) != type(other): return False
4459 if self.xid != other.xid: return False
4460 if self.flags != other.flags: return False
4461 if self.table_id != other.table_id: return False
4462 if self.checksum != other.checksum: return False
4463 if self.checksum_mask != other.checksum_mask: return False
4464 return True
4465
4466 def pretty_print(self, q):
4467 q.text("bsn_gentable_entry_desc_stats_request {")
4468 with q.group():
4469 with q.indent(2):
4470 q.breakable()
4471 q.text("xid = ");
4472 if self.xid != None:
4473 q.text("%#x" % self.xid)
4474 else:
4475 q.text('None')
4476 q.text(","); q.breakable()
4477 q.text("flags = ");
4478 q.text("%#x" % self.flags)
4479 q.text(","); q.breakable()
4480 q.text("table_id = ");
4481 q.text("%#x" % self.table_id)
4482 q.text(","); q.breakable()
4483 q.text("checksum = ");
4484 q.pp(self.checksum)
4485 q.text(","); q.breakable()
4486 q.text("checksum_mask = ");
4487 q.pp(self.checksum_mask)
4488 q.breakable()
4489 q.text('}')
4490
4491bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4492
4493class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4494 version = 5
4495 type = 19
4496 stats_type = 65535
4497 experimenter = 6035143
4498 subtype = 3
4499
4500 def __init__(self, xid=None, flags=None, entries=None):
4501 if xid != None:
4502 self.xid = xid
4503 else:
4504 self.xid = None
4505 if flags != None:
4506 self.flags = flags
4507 else:
4508 self.flags = 0
4509 if entries != None:
4510 self.entries = entries
4511 else:
4512 self.entries = []
4513 return
4514
4515 def pack(self):
4516 packed = []
4517 packed.append(struct.pack("!B", self.version))
4518 packed.append(struct.pack("!B", self.type))
4519 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4520 packed.append(struct.pack("!L", self.xid))
4521 packed.append(struct.pack("!H", self.stats_type))
4522 packed.append(struct.pack("!H", self.flags))
4523 packed.append('\x00' * 4)
4524 packed.append(struct.pack("!L", self.experimenter))
4525 packed.append(struct.pack("!L", self.subtype))
4526 packed.append(loxi.generic_util.pack_list(self.entries))
4527 length = sum([len(x) for x in packed])
4528 packed[2] = struct.pack("!H", length)
4529 return ''.join(packed)
4530
4531 @staticmethod
4532 def unpack(reader):
4533 obj = bsn_gentable_entry_stats_reply()
4534 _version = reader.read("!B")[0]
4535 assert(_version == 5)
4536 _type = reader.read("!B")[0]
4537 assert(_type == 19)
4538 _length = reader.read("!H")[0]
4539 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004540 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004541 obj.xid = reader.read("!L")[0]
4542 _stats_type = reader.read("!H")[0]
4543 assert(_stats_type == 65535)
4544 obj.flags = reader.read("!H")[0]
4545 reader.skip(4)
4546 _experimenter = reader.read("!L")[0]
4547 assert(_experimenter == 6035143)
4548 _subtype = reader.read("!L")[0]
4549 assert(_subtype == 3)
4550 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
4551 return obj
4552
4553 def __eq__(self, other):
4554 if type(self) != type(other): return False
4555 if self.xid != other.xid: return False
4556 if self.flags != other.flags: return False
4557 if self.entries != other.entries: return False
4558 return True
4559
4560 def pretty_print(self, q):
4561 q.text("bsn_gentable_entry_stats_reply {")
4562 with q.group():
4563 with q.indent(2):
4564 q.breakable()
4565 q.text("xid = ");
4566 if self.xid != None:
4567 q.text("%#x" % self.xid)
4568 else:
4569 q.text('None')
4570 q.text(","); q.breakable()
4571 q.text("flags = ");
4572 q.text("%#x" % self.flags)
4573 q.text(","); q.breakable()
4574 q.text("entries = ");
4575 q.pp(self.entries)
4576 q.breakable()
4577 q.text('}')
4578
4579bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4580
4581class bsn_gentable_entry_stats_request(bsn_stats_request):
4582 version = 5
4583 type = 18
4584 stats_type = 65535
4585 experimenter = 6035143
4586 subtype = 3
4587
4588 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4589 if xid != None:
4590 self.xid = xid
4591 else:
4592 self.xid = None
4593 if flags != None:
4594 self.flags = flags
4595 else:
4596 self.flags = 0
4597 if table_id != None:
4598 self.table_id = table_id
4599 else:
4600 self.table_id = 0
4601 if checksum != None:
4602 self.checksum = checksum
4603 else:
4604 self.checksum = 0
4605 if checksum_mask != None:
4606 self.checksum_mask = checksum_mask
4607 else:
4608 self.checksum_mask = 0
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(struct.pack("!H", self.table_id))
4623 packed.append('\x00' * 2)
4624 packed.append(util.pack_checksum_128(self.checksum))
4625 packed.append(util.pack_checksum_128(self.checksum_mask))
4626 length = sum([len(x) for x in packed])
4627 packed[2] = struct.pack("!H", length)
4628 return ''.join(packed)
4629
4630 @staticmethod
4631 def unpack(reader):
4632 obj = bsn_gentable_entry_stats_request()
4633 _version = reader.read("!B")[0]
4634 assert(_version == 5)
4635 _type = reader.read("!B")[0]
4636 assert(_type == 18)
4637 _length = reader.read("!H")[0]
4638 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004639 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004640 obj.xid = reader.read("!L")[0]
4641 _stats_type = reader.read("!H")[0]
4642 assert(_stats_type == 65535)
4643 obj.flags = reader.read("!H")[0]
4644 reader.skip(4)
4645 _experimenter = reader.read("!L")[0]
4646 assert(_experimenter == 6035143)
4647 _subtype = reader.read("!L")[0]
4648 assert(_subtype == 3)
4649 obj.table_id = reader.read("!H")[0]
4650 reader.skip(2)
4651 obj.checksum = util.unpack_checksum_128(reader)
4652 obj.checksum_mask = util.unpack_checksum_128(reader)
4653 return obj
4654
4655 def __eq__(self, other):
4656 if type(self) != type(other): return False
4657 if self.xid != other.xid: return False
4658 if self.flags != other.flags: return False
4659 if self.table_id != other.table_id: return False
4660 if self.checksum != other.checksum: return False
4661 if self.checksum_mask != other.checksum_mask: return False
4662 return True
4663
4664 def pretty_print(self, q):
4665 q.text("bsn_gentable_entry_stats_request {")
4666 with q.group():
4667 with q.indent(2):
4668 q.breakable()
4669 q.text("xid = ");
4670 if self.xid != None:
4671 q.text("%#x" % self.xid)
4672 else:
4673 q.text('None')
4674 q.text(","); q.breakable()
4675 q.text("flags = ");
4676 q.text("%#x" % self.flags)
4677 q.text(","); q.breakable()
4678 q.text("table_id = ");
4679 q.text("%#x" % self.table_id)
4680 q.text(","); q.breakable()
4681 q.text("checksum = ");
4682 q.pp(self.checksum)
4683 q.text(","); q.breakable()
4684 q.text("checksum_mask = ");
4685 q.pp(self.checksum_mask)
4686 q.breakable()
4687 q.text('}')
4688
4689bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4690
4691class bsn_gentable_set_buckets_size(bsn_header):
4692 version = 5
4693 type = 4
4694 experimenter = 6035143
4695 subtype = 50
4696
4697 def __init__(self, xid=None, table_id=None, buckets_size=None):
4698 if xid != None:
4699 self.xid = xid
4700 else:
4701 self.xid = None
4702 if table_id != None:
4703 self.table_id = table_id
4704 else:
4705 self.table_id = 0
4706 if buckets_size != None:
4707 self.buckets_size = buckets_size
4708 else:
4709 self.buckets_size = 0
4710 return
4711
4712 def pack(self):
4713 packed = []
4714 packed.append(struct.pack("!B", self.version))
4715 packed.append(struct.pack("!B", self.type))
4716 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4717 packed.append(struct.pack("!L", self.xid))
4718 packed.append(struct.pack("!L", self.experimenter))
4719 packed.append(struct.pack("!L", self.subtype))
4720 packed.append(struct.pack("!H", self.table_id))
4721 packed.append('\x00' * 2)
4722 packed.append(struct.pack("!L", self.buckets_size))
4723 length = sum([len(x) for x in packed])
4724 packed[2] = struct.pack("!H", length)
4725 return ''.join(packed)
4726
4727 @staticmethod
4728 def unpack(reader):
4729 obj = bsn_gentable_set_buckets_size()
4730 _version = reader.read("!B")[0]
4731 assert(_version == 5)
4732 _type = reader.read("!B")[0]
4733 assert(_type == 4)
4734 _length = reader.read("!H")[0]
4735 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004736 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004737 obj.xid = reader.read("!L")[0]
4738 _experimenter = reader.read("!L")[0]
4739 assert(_experimenter == 6035143)
4740 _subtype = reader.read("!L")[0]
4741 assert(_subtype == 50)
4742 obj.table_id = reader.read("!H")[0]
4743 reader.skip(2)
4744 obj.buckets_size = reader.read("!L")[0]
4745 return obj
4746
4747 def __eq__(self, other):
4748 if type(self) != type(other): return False
4749 if self.xid != other.xid: return False
4750 if self.table_id != other.table_id: return False
4751 if self.buckets_size != other.buckets_size: return False
4752 return True
4753
4754 def pretty_print(self, q):
4755 q.text("bsn_gentable_set_buckets_size {")
4756 with q.group():
4757 with q.indent(2):
4758 q.breakable()
4759 q.text("xid = ");
4760 if self.xid != None:
4761 q.text("%#x" % self.xid)
4762 else:
4763 q.text('None')
4764 q.text(","); q.breakable()
4765 q.text("table_id = ");
4766 q.text("%#x" % self.table_id)
4767 q.text(","); q.breakable()
4768 q.text("buckets_size = ");
4769 q.text("%#x" % self.buckets_size)
4770 q.breakable()
4771 q.text('}')
4772
4773bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4774
4775class bsn_gentable_stats_reply(bsn_stats_reply):
4776 version = 5
4777 type = 19
4778 stats_type = 65535
4779 experimenter = 6035143
4780 subtype = 7
4781
4782 def __init__(self, xid=None, flags=None, entries=None):
4783 if xid != None:
4784 self.xid = xid
4785 else:
4786 self.xid = None
4787 if flags != None:
4788 self.flags = flags
4789 else:
4790 self.flags = 0
4791 if entries != None:
4792 self.entries = entries
4793 else:
4794 self.entries = []
4795 return
4796
4797 def pack(self):
4798 packed = []
4799 packed.append(struct.pack("!B", self.version))
4800 packed.append(struct.pack("!B", self.type))
4801 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4802 packed.append(struct.pack("!L", self.xid))
4803 packed.append(struct.pack("!H", self.stats_type))
4804 packed.append(struct.pack("!H", self.flags))
4805 packed.append('\x00' * 4)
4806 packed.append(struct.pack("!L", self.experimenter))
4807 packed.append(struct.pack("!L", self.subtype))
4808 packed.append(loxi.generic_util.pack_list(self.entries))
4809 length = sum([len(x) for x in packed])
4810 packed[2] = struct.pack("!H", length)
4811 return ''.join(packed)
4812
4813 @staticmethod
4814 def unpack(reader):
4815 obj = bsn_gentable_stats_reply()
4816 _version = reader.read("!B")[0]
4817 assert(_version == 5)
4818 _type = reader.read("!B")[0]
4819 assert(_type == 19)
4820 _length = reader.read("!H")[0]
4821 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004822 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004823 obj.xid = reader.read("!L")[0]
4824 _stats_type = reader.read("!H")[0]
4825 assert(_stats_type == 65535)
4826 obj.flags = reader.read("!H")[0]
4827 reader.skip(4)
4828 _experimenter = reader.read("!L")[0]
4829 assert(_experimenter == 6035143)
4830 _subtype = reader.read("!L")[0]
4831 assert(_subtype == 7)
4832 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4833 return obj
4834
4835 def __eq__(self, other):
4836 if type(self) != type(other): return False
4837 if self.xid != other.xid: return False
4838 if self.flags != other.flags: return False
4839 if self.entries != other.entries: return False
4840 return True
4841
4842 def pretty_print(self, q):
4843 q.text("bsn_gentable_stats_reply {")
4844 with q.group():
4845 with q.indent(2):
4846 q.breakable()
4847 q.text("xid = ");
4848 if self.xid != None:
4849 q.text("%#x" % self.xid)
4850 else:
4851 q.text('None')
4852 q.text(","); q.breakable()
4853 q.text("flags = ");
4854 q.text("%#x" % self.flags)
4855 q.text(","); q.breakable()
4856 q.text("entries = ");
4857 q.pp(self.entries)
4858 q.breakable()
4859 q.text('}')
4860
4861bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4862
4863class bsn_gentable_stats_request(bsn_stats_request):
4864 version = 5
4865 type = 18
4866 stats_type = 65535
4867 experimenter = 6035143
4868 subtype = 7
4869
4870 def __init__(self, xid=None, flags=None):
4871 if xid != None:
4872 self.xid = xid
4873 else:
4874 self.xid = None
4875 if flags != None:
4876 self.flags = flags
4877 else:
4878 self.flags = 0
4879 return
4880
4881 def pack(self):
4882 packed = []
4883 packed.append(struct.pack("!B", self.version))
4884 packed.append(struct.pack("!B", self.type))
4885 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4886 packed.append(struct.pack("!L", self.xid))
4887 packed.append(struct.pack("!H", self.stats_type))
4888 packed.append(struct.pack("!H", self.flags))
4889 packed.append('\x00' * 4)
4890 packed.append(struct.pack("!L", self.experimenter))
4891 packed.append(struct.pack("!L", self.subtype))
4892 length = sum([len(x) for x in packed])
4893 packed[2] = struct.pack("!H", length)
4894 return ''.join(packed)
4895
4896 @staticmethod
4897 def unpack(reader):
4898 obj = bsn_gentable_stats_request()
4899 _version = reader.read("!B")[0]
4900 assert(_version == 5)
4901 _type = reader.read("!B")[0]
4902 assert(_type == 18)
4903 _length = reader.read("!H")[0]
4904 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004905 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004906 obj.xid = reader.read("!L")[0]
4907 _stats_type = reader.read("!H")[0]
4908 assert(_stats_type == 65535)
4909 obj.flags = reader.read("!H")[0]
4910 reader.skip(4)
4911 _experimenter = reader.read("!L")[0]
4912 assert(_experimenter == 6035143)
4913 _subtype = reader.read("!L")[0]
4914 assert(_subtype == 7)
4915 return obj
4916
4917 def __eq__(self, other):
4918 if type(self) != type(other): return False
4919 if self.xid != other.xid: return False
4920 if self.flags != other.flags: return False
4921 return True
4922
4923 def pretty_print(self, q):
4924 q.text("bsn_gentable_stats_request {")
4925 with q.group():
4926 with q.indent(2):
4927 q.breakable()
4928 q.text("xid = ");
4929 if self.xid != None:
4930 q.text("%#x" % self.xid)
4931 else:
4932 q.text('None')
4933 q.text(","); q.breakable()
4934 q.text("flags = ");
4935 q.text("%#x" % self.flags)
4936 q.breakable()
4937 q.text('}')
4938
4939bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4940
Rich Lane2e079da2014-10-29 15:30:24 -07004941class bsn_get_interfaces_reply(bsn_header):
4942 version = 5
4943 type = 4
4944 experimenter = 6035143
4945 subtype = 10
4946
4947 def __init__(self, xid=None, interfaces=None):
4948 if xid != None:
4949 self.xid = xid
4950 else:
4951 self.xid = None
4952 if interfaces != None:
4953 self.interfaces = interfaces
4954 else:
4955 self.interfaces = []
4956 return
4957
4958 def pack(self):
4959 packed = []
4960 packed.append(struct.pack("!B", self.version))
4961 packed.append(struct.pack("!B", self.type))
4962 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4963 packed.append(struct.pack("!L", self.xid))
4964 packed.append(struct.pack("!L", self.experimenter))
4965 packed.append(struct.pack("!L", self.subtype))
4966 packed.append(loxi.generic_util.pack_list(self.interfaces))
4967 length = sum([len(x) for x in packed])
4968 packed[2] = struct.pack("!H", length)
4969 return ''.join(packed)
4970
4971 @staticmethod
4972 def unpack(reader):
4973 obj = bsn_get_interfaces_reply()
4974 _version = reader.read("!B")[0]
4975 assert(_version == 5)
4976 _type = reader.read("!B")[0]
4977 assert(_type == 4)
4978 _length = reader.read("!H")[0]
4979 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004980 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07004981 obj.xid = reader.read("!L")[0]
4982 _experimenter = reader.read("!L")[0]
4983 assert(_experimenter == 6035143)
4984 _subtype = reader.read("!L")[0]
4985 assert(_subtype == 10)
4986 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4987 return obj
4988
4989 def __eq__(self, other):
4990 if type(self) != type(other): return False
4991 if self.xid != other.xid: return False
4992 if self.interfaces != other.interfaces: return False
4993 return True
4994
4995 def pretty_print(self, q):
4996 q.text("bsn_get_interfaces_reply {")
4997 with q.group():
4998 with q.indent(2):
4999 q.breakable()
5000 q.text("xid = ");
5001 if self.xid != None:
5002 q.text("%#x" % self.xid)
5003 else:
5004 q.text('None')
5005 q.text(","); q.breakable()
5006 q.text("interfaces = ");
5007 q.pp(self.interfaces)
5008 q.breakable()
5009 q.text('}')
5010
5011bsn_header.subtypes[10] = bsn_get_interfaces_reply
5012
5013class bsn_get_interfaces_request(bsn_header):
5014 version = 5
5015 type = 4
5016 experimenter = 6035143
5017 subtype = 9
5018
5019 def __init__(self, xid=None):
5020 if xid != None:
5021 self.xid = xid
5022 else:
5023 self.xid = None
5024 return
5025
5026 def pack(self):
5027 packed = []
5028 packed.append(struct.pack("!B", self.version))
5029 packed.append(struct.pack("!B", self.type))
5030 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5031 packed.append(struct.pack("!L", self.xid))
5032 packed.append(struct.pack("!L", self.experimenter))
5033 packed.append(struct.pack("!L", self.subtype))
5034 length = sum([len(x) for x in packed])
5035 packed[2] = struct.pack("!H", length)
5036 return ''.join(packed)
5037
5038 @staticmethod
5039 def unpack(reader):
5040 obj = bsn_get_interfaces_request()
5041 _version = reader.read("!B")[0]
5042 assert(_version == 5)
5043 _type = reader.read("!B")[0]
5044 assert(_type == 4)
5045 _length = reader.read("!H")[0]
5046 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005047 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005048 obj.xid = reader.read("!L")[0]
5049 _experimenter = reader.read("!L")[0]
5050 assert(_experimenter == 6035143)
5051 _subtype = reader.read("!L")[0]
5052 assert(_subtype == 9)
5053 return obj
5054
5055 def __eq__(self, other):
5056 if type(self) != type(other): return False
5057 if self.xid != other.xid: return False
5058 return True
5059
5060 def pretty_print(self, q):
5061 q.text("bsn_get_interfaces_request {")
5062 with q.group():
5063 with q.indent(2):
5064 q.breakable()
5065 q.text("xid = ");
5066 if self.xid != None:
5067 q.text("%#x" % self.xid)
5068 else:
5069 q.text('None')
5070 q.breakable()
5071 q.text('}')
5072
5073bsn_header.subtypes[9] = bsn_get_interfaces_request
5074
5075class bsn_get_mirroring_reply(bsn_header):
5076 version = 5
5077 type = 4
5078 experimenter = 6035143
5079 subtype = 5
5080
5081 def __init__(self, xid=None, report_mirror_ports=None):
5082 if xid != None:
5083 self.xid = xid
5084 else:
5085 self.xid = None
5086 if report_mirror_ports != None:
5087 self.report_mirror_ports = report_mirror_ports
5088 else:
5089 self.report_mirror_ports = 0
5090 return
5091
5092 def pack(self):
5093 packed = []
5094 packed.append(struct.pack("!B", self.version))
5095 packed.append(struct.pack("!B", self.type))
5096 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5097 packed.append(struct.pack("!L", self.xid))
5098 packed.append(struct.pack("!L", self.experimenter))
5099 packed.append(struct.pack("!L", self.subtype))
5100 packed.append(struct.pack("!B", self.report_mirror_ports))
5101 packed.append('\x00' * 3)
5102 length = sum([len(x) for x in packed])
5103 packed[2] = struct.pack("!H", length)
5104 return ''.join(packed)
5105
5106 @staticmethod
5107 def unpack(reader):
5108 obj = bsn_get_mirroring_reply()
5109 _version = reader.read("!B")[0]
5110 assert(_version == 5)
5111 _type = reader.read("!B")[0]
5112 assert(_type == 4)
5113 _length = reader.read("!H")[0]
5114 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005115 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005116 obj.xid = reader.read("!L")[0]
5117 _experimenter = reader.read("!L")[0]
5118 assert(_experimenter == 6035143)
5119 _subtype = reader.read("!L")[0]
5120 assert(_subtype == 5)
5121 obj.report_mirror_ports = reader.read("!B")[0]
5122 reader.skip(3)
5123 return obj
5124
5125 def __eq__(self, other):
5126 if type(self) != type(other): return False
5127 if self.xid != other.xid: return False
5128 if self.report_mirror_ports != other.report_mirror_ports: return False
5129 return True
5130
5131 def pretty_print(self, q):
5132 q.text("bsn_get_mirroring_reply {")
5133 with q.group():
5134 with q.indent(2):
5135 q.breakable()
5136 q.text("xid = ");
5137 if self.xid != None:
5138 q.text("%#x" % self.xid)
5139 else:
5140 q.text('None')
5141 q.text(","); q.breakable()
5142 q.text("report_mirror_ports = ");
5143 q.text("%#x" % self.report_mirror_ports)
5144 q.breakable()
5145 q.text('}')
5146
5147bsn_header.subtypes[5] = bsn_get_mirroring_reply
5148
5149class bsn_get_mirroring_request(bsn_header):
5150 version = 5
5151 type = 4
5152 experimenter = 6035143
5153 subtype = 4
5154
5155 def __init__(self, xid=None, report_mirror_ports=None):
5156 if xid != None:
5157 self.xid = xid
5158 else:
5159 self.xid = None
5160 if report_mirror_ports != None:
5161 self.report_mirror_ports = report_mirror_ports
5162 else:
5163 self.report_mirror_ports = 0
5164 return
5165
5166 def pack(self):
5167 packed = []
5168 packed.append(struct.pack("!B", self.version))
5169 packed.append(struct.pack("!B", self.type))
5170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5171 packed.append(struct.pack("!L", self.xid))
5172 packed.append(struct.pack("!L", self.experimenter))
5173 packed.append(struct.pack("!L", self.subtype))
5174 packed.append(struct.pack("!B", self.report_mirror_ports))
5175 packed.append('\x00' * 3)
5176 length = sum([len(x) for x in packed])
5177 packed[2] = struct.pack("!H", length)
5178 return ''.join(packed)
5179
5180 @staticmethod
5181 def unpack(reader):
5182 obj = bsn_get_mirroring_request()
5183 _version = reader.read("!B")[0]
5184 assert(_version == 5)
5185 _type = reader.read("!B")[0]
5186 assert(_type == 4)
5187 _length = reader.read("!H")[0]
5188 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005189 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005190 obj.xid = reader.read("!L")[0]
5191 _experimenter = reader.read("!L")[0]
5192 assert(_experimenter == 6035143)
5193 _subtype = reader.read("!L")[0]
5194 assert(_subtype == 4)
5195 obj.report_mirror_ports = reader.read("!B")[0]
5196 reader.skip(3)
5197 return obj
5198
5199 def __eq__(self, other):
5200 if type(self) != type(other): return False
5201 if self.xid != other.xid: return False
5202 if self.report_mirror_ports != other.report_mirror_ports: return False
5203 return True
5204
5205 def pretty_print(self, q):
5206 q.text("bsn_get_mirroring_request {")
5207 with q.group():
5208 with q.indent(2):
5209 q.breakable()
5210 q.text("xid = ");
5211 if self.xid != None:
5212 q.text("%#x" % self.xid)
5213 else:
5214 q.text('None')
5215 q.text(","); q.breakable()
5216 q.text("report_mirror_ports = ");
5217 q.text("%#x" % self.report_mirror_ports)
5218 q.breakable()
5219 q.text('}')
5220
5221bsn_header.subtypes[4] = bsn_get_mirroring_request
5222
Rich Laneccd32ed2014-11-10 17:48:24 -08005223class bsn_get_switch_pipeline_reply(bsn_header):
5224 version = 5
5225 type = 4
5226 experimenter = 6035143
5227 subtype = 52
5228
5229 def __init__(self, xid=None, pipeline=None):
5230 if xid != None:
5231 self.xid = xid
5232 else:
5233 self.xid = None
5234 if pipeline != None:
5235 self.pipeline = pipeline
5236 else:
5237 self.pipeline = ""
5238 return
5239
5240 def pack(self):
5241 packed = []
5242 packed.append(struct.pack("!B", self.version))
5243 packed.append(struct.pack("!B", self.type))
5244 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5245 packed.append(struct.pack("!L", self.xid))
5246 packed.append(struct.pack("!L", self.experimenter))
5247 packed.append(struct.pack("!L", self.subtype))
5248 packed.append(struct.pack("!256s", self.pipeline))
5249 length = sum([len(x) for x in packed])
5250 packed[2] = struct.pack("!H", length)
5251 return ''.join(packed)
5252
5253 @staticmethod
5254 def unpack(reader):
5255 obj = bsn_get_switch_pipeline_reply()
5256 _version = reader.read("!B")[0]
5257 assert(_version == 5)
5258 _type = reader.read("!B")[0]
5259 assert(_type == 4)
5260 _length = reader.read("!H")[0]
5261 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005262 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005263 obj.xid = reader.read("!L")[0]
5264 _experimenter = reader.read("!L")[0]
5265 assert(_experimenter == 6035143)
5266 _subtype = reader.read("!L")[0]
5267 assert(_subtype == 52)
5268 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5269 return obj
5270
5271 def __eq__(self, other):
5272 if type(self) != type(other): return False
5273 if self.xid != other.xid: return False
5274 if self.pipeline != other.pipeline: return False
5275 return True
5276
5277 def pretty_print(self, q):
5278 q.text("bsn_get_switch_pipeline_reply {")
5279 with q.group():
5280 with q.indent(2):
5281 q.breakable()
5282 q.text("xid = ");
5283 if self.xid != None:
5284 q.text("%#x" % self.xid)
5285 else:
5286 q.text('None')
5287 q.text(","); q.breakable()
5288 q.text("pipeline = ");
5289 q.pp(self.pipeline)
5290 q.breakable()
5291 q.text('}')
5292
5293bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5294
5295class bsn_get_switch_pipeline_request(bsn_header):
5296 version = 5
5297 type = 4
5298 experimenter = 6035143
5299 subtype = 51
5300
5301 def __init__(self, xid=None):
5302 if xid != None:
5303 self.xid = xid
5304 else:
5305 self.xid = None
5306 return
5307
5308 def pack(self):
5309 packed = []
5310 packed.append(struct.pack("!B", self.version))
5311 packed.append(struct.pack("!B", self.type))
5312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5313 packed.append(struct.pack("!L", self.xid))
5314 packed.append(struct.pack("!L", self.experimenter))
5315 packed.append(struct.pack("!L", self.subtype))
5316 length = sum([len(x) for x in packed])
5317 packed[2] = struct.pack("!H", length)
5318 return ''.join(packed)
5319
5320 @staticmethod
5321 def unpack(reader):
5322 obj = bsn_get_switch_pipeline_request()
5323 _version = reader.read("!B")[0]
5324 assert(_version == 5)
5325 _type = reader.read("!B")[0]
5326 assert(_type == 4)
5327 _length = reader.read("!H")[0]
5328 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005329 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005330 obj.xid = reader.read("!L")[0]
5331 _experimenter = reader.read("!L")[0]
5332 assert(_experimenter == 6035143)
5333 _subtype = reader.read("!L")[0]
5334 assert(_subtype == 51)
5335 return obj
5336
5337 def __eq__(self, other):
5338 if type(self) != type(other): return False
5339 if self.xid != other.xid: return False
5340 return True
5341
5342 def pretty_print(self, q):
5343 q.text("bsn_get_switch_pipeline_request {")
5344 with q.group():
5345 with q.indent(2):
5346 q.breakable()
5347 q.text("xid = ");
5348 if self.xid != None:
5349 q.text("%#x" % self.xid)
5350 else:
5351 q.text('None')
5352 q.breakable()
5353 q.text('}')
5354
5355bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5356
5357class bsn_image_desc_stats_reply(bsn_stats_reply):
5358 version = 5
5359 type = 19
5360 stats_type = 65535
5361 experimenter = 6035143
5362 subtype = 14
5363
5364 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5365 if xid != None:
5366 self.xid = xid
5367 else:
5368 self.xid = None
5369 if flags != None:
5370 self.flags = flags
5371 else:
5372 self.flags = 0
5373 if image_checksum != None:
5374 self.image_checksum = image_checksum
5375 else:
5376 self.image_checksum = ""
5377 if startup_config_checksum != None:
5378 self.startup_config_checksum = startup_config_checksum
5379 else:
5380 self.startup_config_checksum = ""
5381 return
5382
5383 def pack(self):
5384 packed = []
5385 packed.append(struct.pack("!B", self.version))
5386 packed.append(struct.pack("!B", self.type))
5387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5388 packed.append(struct.pack("!L", self.xid))
5389 packed.append(struct.pack("!H", self.stats_type))
5390 packed.append(struct.pack("!H", self.flags))
5391 packed.append('\x00' * 4)
5392 packed.append(struct.pack("!L", self.experimenter))
5393 packed.append(struct.pack("!L", self.subtype))
5394 packed.append(struct.pack("!256s", self.image_checksum))
5395 packed.append(struct.pack("!256s", self.startup_config_checksum))
5396 length = sum([len(x) for x in packed])
5397 packed[2] = struct.pack("!H", length)
5398 return ''.join(packed)
5399
5400 @staticmethod
5401 def unpack(reader):
5402 obj = bsn_image_desc_stats_reply()
5403 _version = reader.read("!B")[0]
5404 assert(_version == 5)
5405 _type = reader.read("!B")[0]
5406 assert(_type == 19)
5407 _length = reader.read("!H")[0]
5408 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005409 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005410 obj.xid = reader.read("!L")[0]
5411 _stats_type = reader.read("!H")[0]
5412 assert(_stats_type == 65535)
5413 obj.flags = reader.read("!H")[0]
5414 reader.skip(4)
5415 _experimenter = reader.read("!L")[0]
5416 assert(_experimenter == 6035143)
5417 _subtype = reader.read("!L")[0]
5418 assert(_subtype == 14)
5419 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5420 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5421 return obj
5422
5423 def __eq__(self, other):
5424 if type(self) != type(other): return False
5425 if self.xid != other.xid: return False
5426 if self.flags != other.flags: return False
5427 if self.image_checksum != other.image_checksum: return False
5428 if self.startup_config_checksum != other.startup_config_checksum: return False
5429 return True
5430
5431 def pretty_print(self, q):
5432 q.text("bsn_image_desc_stats_reply {")
5433 with q.group():
5434 with q.indent(2):
5435 q.breakable()
5436 q.text("xid = ");
5437 if self.xid != None:
5438 q.text("%#x" % self.xid)
5439 else:
5440 q.text('None')
5441 q.text(","); q.breakable()
5442 q.text("flags = ");
5443 q.text("%#x" % self.flags)
5444 q.text(","); q.breakable()
5445 q.text("image_checksum = ");
5446 q.pp(self.image_checksum)
5447 q.text(","); q.breakable()
5448 q.text("startup_config_checksum = ");
5449 q.pp(self.startup_config_checksum)
5450 q.breakable()
5451 q.text('}')
5452
5453bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5454
5455class bsn_image_desc_stats_request(bsn_stats_request):
5456 version = 5
5457 type = 18
5458 stats_type = 65535
5459 experimenter = 6035143
5460 subtype = 14
5461
5462 def __init__(self, xid=None, flags=None):
5463 if xid != None:
5464 self.xid = xid
5465 else:
5466 self.xid = None
5467 if flags != None:
5468 self.flags = flags
5469 else:
5470 self.flags = 0
5471 return
5472
5473 def pack(self):
5474 packed = []
5475 packed.append(struct.pack("!B", self.version))
5476 packed.append(struct.pack("!B", self.type))
5477 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5478 packed.append(struct.pack("!L", self.xid))
5479 packed.append(struct.pack("!H", self.stats_type))
5480 packed.append(struct.pack("!H", self.flags))
5481 packed.append('\x00' * 4)
5482 packed.append(struct.pack("!L", self.experimenter))
5483 packed.append(struct.pack("!L", self.subtype))
5484 length = sum([len(x) for x in packed])
5485 packed[2] = struct.pack("!H", length)
5486 return ''.join(packed)
5487
5488 @staticmethod
5489 def unpack(reader):
5490 obj = bsn_image_desc_stats_request()
5491 _version = reader.read("!B")[0]
5492 assert(_version == 5)
5493 _type = reader.read("!B")[0]
5494 assert(_type == 18)
5495 _length = reader.read("!H")[0]
5496 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005497 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005498 obj.xid = reader.read("!L")[0]
5499 _stats_type = reader.read("!H")[0]
5500 assert(_stats_type == 65535)
5501 obj.flags = reader.read("!H")[0]
5502 reader.skip(4)
5503 _experimenter = reader.read("!L")[0]
5504 assert(_experimenter == 6035143)
5505 _subtype = reader.read("!L")[0]
5506 assert(_subtype == 14)
5507 return obj
5508
5509 def __eq__(self, other):
5510 if type(self) != type(other): return False
5511 if self.xid != other.xid: return False
5512 if self.flags != other.flags: return False
5513 return True
5514
5515 def pretty_print(self, q):
5516 q.text("bsn_image_desc_stats_request {")
5517 with q.group():
5518 with q.indent(2):
5519 q.breakable()
5520 q.text("xid = ");
5521 if self.xid != None:
5522 q.text("%#x" % self.xid)
5523 else:
5524 q.text('None')
5525 q.text(","); q.breakable()
5526 q.text("flags = ");
5527 q.text("%#x" % self.flags)
5528 q.breakable()
5529 q.text('}')
5530
5531bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5532
5533class bsn_lacp_convergence_notif(bsn_header):
5534 version = 5
5535 type = 4
5536 experimenter = 6035143
5537 subtype = 43
5538
5539 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):
5540 if xid != None:
5541 self.xid = xid
5542 else:
5543 self.xid = None
5544 if convergence_status != None:
5545 self.convergence_status = convergence_status
5546 else:
5547 self.convergence_status = 0
5548 if port_no != None:
5549 self.port_no = port_no
5550 else:
5551 self.port_no = 0
5552 if actor_sys_priority != None:
5553 self.actor_sys_priority = actor_sys_priority
5554 else:
5555 self.actor_sys_priority = 0
5556 if actor_sys_mac != None:
5557 self.actor_sys_mac = actor_sys_mac
5558 else:
5559 self.actor_sys_mac = [0,0,0,0,0,0]
5560 if actor_port_priority != None:
5561 self.actor_port_priority = actor_port_priority
5562 else:
5563 self.actor_port_priority = 0
5564 if actor_port_num != None:
5565 self.actor_port_num = actor_port_num
5566 else:
5567 self.actor_port_num = 0
5568 if actor_key != None:
5569 self.actor_key = actor_key
5570 else:
5571 self.actor_key = 0
5572 if partner_sys_priority != None:
5573 self.partner_sys_priority = partner_sys_priority
5574 else:
5575 self.partner_sys_priority = 0
5576 if partner_sys_mac != None:
5577 self.partner_sys_mac = partner_sys_mac
5578 else:
5579 self.partner_sys_mac = [0,0,0,0,0,0]
5580 if partner_port_priority != None:
5581 self.partner_port_priority = partner_port_priority
5582 else:
5583 self.partner_port_priority = 0
5584 if partner_port_num != None:
5585 self.partner_port_num = partner_port_num
5586 else:
5587 self.partner_port_num = 0
5588 if partner_key != None:
5589 self.partner_key = partner_key
5590 else:
5591 self.partner_key = 0
5592 return
5593
5594 def pack(self):
5595 packed = []
5596 packed.append(struct.pack("!B", self.version))
5597 packed.append(struct.pack("!B", self.type))
5598 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5599 packed.append(struct.pack("!L", self.xid))
5600 packed.append(struct.pack("!L", self.experimenter))
5601 packed.append(struct.pack("!L", self.subtype))
5602 packed.append(struct.pack("!B", self.convergence_status))
5603 packed.append('\x00' * 3)
5604 packed.append(util.pack_port_no(self.port_no))
5605 packed.append(struct.pack("!H", self.actor_sys_priority))
5606 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5607 packed.append(struct.pack("!H", self.actor_port_priority))
5608 packed.append(struct.pack("!H", self.actor_port_num))
5609 packed.append(struct.pack("!H", self.actor_key))
5610 packed.append(struct.pack("!H", self.partner_sys_priority))
5611 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5612 packed.append(struct.pack("!H", self.partner_port_priority))
5613 packed.append(struct.pack("!H", self.partner_port_num))
5614 packed.append(struct.pack("!H", self.partner_key))
5615 length = sum([len(x) for x in packed])
5616 packed[2] = struct.pack("!H", length)
5617 return ''.join(packed)
5618
5619 @staticmethod
5620 def unpack(reader):
5621 obj = bsn_lacp_convergence_notif()
5622 _version = reader.read("!B")[0]
5623 assert(_version == 5)
5624 _type = reader.read("!B")[0]
5625 assert(_type == 4)
5626 _length = reader.read("!H")[0]
5627 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005628 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005629 obj.xid = reader.read("!L")[0]
5630 _experimenter = reader.read("!L")[0]
5631 assert(_experimenter == 6035143)
5632 _subtype = reader.read("!L")[0]
5633 assert(_subtype == 43)
5634 obj.convergence_status = reader.read("!B")[0]
5635 reader.skip(3)
5636 obj.port_no = util.unpack_port_no(reader)
5637 obj.actor_sys_priority = reader.read("!H")[0]
5638 obj.actor_sys_mac = list(reader.read('!6B'))
5639 obj.actor_port_priority = reader.read("!H")[0]
5640 obj.actor_port_num = reader.read("!H")[0]
5641 obj.actor_key = reader.read("!H")[0]
5642 obj.partner_sys_priority = reader.read("!H")[0]
5643 obj.partner_sys_mac = list(reader.read('!6B'))
5644 obj.partner_port_priority = reader.read("!H")[0]
5645 obj.partner_port_num = reader.read("!H")[0]
5646 obj.partner_key = reader.read("!H")[0]
5647 return obj
5648
5649 def __eq__(self, other):
5650 if type(self) != type(other): return False
5651 if self.xid != other.xid: return False
5652 if self.convergence_status != other.convergence_status: return False
5653 if self.port_no != other.port_no: return False
5654 if self.actor_sys_priority != other.actor_sys_priority: return False
5655 if self.actor_sys_mac != other.actor_sys_mac: return False
5656 if self.actor_port_priority != other.actor_port_priority: return False
5657 if self.actor_port_num != other.actor_port_num: return False
5658 if self.actor_key != other.actor_key: return False
5659 if self.partner_sys_priority != other.partner_sys_priority: return False
5660 if self.partner_sys_mac != other.partner_sys_mac: return False
5661 if self.partner_port_priority != other.partner_port_priority: return False
5662 if self.partner_port_num != other.partner_port_num: return False
5663 if self.partner_key != other.partner_key: return False
5664 return True
5665
5666 def pretty_print(self, q):
5667 q.text("bsn_lacp_convergence_notif {")
5668 with q.group():
5669 with q.indent(2):
5670 q.breakable()
5671 q.text("xid = ");
5672 if self.xid != None:
5673 q.text("%#x" % self.xid)
5674 else:
5675 q.text('None')
5676 q.text(","); q.breakable()
5677 q.text("convergence_status = ");
5678 q.text("%#x" % self.convergence_status)
5679 q.text(","); q.breakable()
5680 q.text("port_no = ");
5681 q.text(util.pretty_port(self.port_no))
5682 q.text(","); q.breakable()
5683 q.text("actor_sys_priority = ");
5684 q.text("%#x" % self.actor_sys_priority)
5685 q.text(","); q.breakable()
5686 q.text("actor_sys_mac = ");
5687 q.text(util.pretty_mac(self.actor_sys_mac))
5688 q.text(","); q.breakable()
5689 q.text("actor_port_priority = ");
5690 q.text("%#x" % self.actor_port_priority)
5691 q.text(","); q.breakable()
5692 q.text("actor_port_num = ");
5693 q.text("%#x" % self.actor_port_num)
5694 q.text(","); q.breakable()
5695 q.text("actor_key = ");
5696 q.text("%#x" % self.actor_key)
5697 q.text(","); q.breakable()
5698 q.text("partner_sys_priority = ");
5699 q.text("%#x" % self.partner_sys_priority)
5700 q.text(","); q.breakable()
5701 q.text("partner_sys_mac = ");
5702 q.text(util.pretty_mac(self.partner_sys_mac))
5703 q.text(","); q.breakable()
5704 q.text("partner_port_priority = ");
5705 q.text("%#x" % self.partner_port_priority)
5706 q.text(","); q.breakable()
5707 q.text("partner_port_num = ");
5708 q.text("%#x" % self.partner_port_num)
5709 q.text(","); q.breakable()
5710 q.text("partner_key = ");
5711 q.text("%#x" % self.partner_key)
5712 q.breakable()
5713 q.text('}')
5714
5715bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5716
5717class bsn_lacp_stats_reply(bsn_stats_reply):
5718 version = 5
5719 type = 19
5720 stats_type = 65535
5721 experimenter = 6035143
5722 subtype = 1
5723
5724 def __init__(self, xid=None, flags=None, entries=None):
5725 if xid != None:
5726 self.xid = xid
5727 else:
5728 self.xid = None
5729 if flags != None:
5730 self.flags = flags
5731 else:
5732 self.flags = 0
5733 if entries != None:
5734 self.entries = entries
5735 else:
5736 self.entries = []
5737 return
5738
5739 def pack(self):
5740 packed = []
5741 packed.append(struct.pack("!B", self.version))
5742 packed.append(struct.pack("!B", self.type))
5743 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5744 packed.append(struct.pack("!L", self.xid))
5745 packed.append(struct.pack("!H", self.stats_type))
5746 packed.append(struct.pack("!H", self.flags))
5747 packed.append('\x00' * 4)
5748 packed.append(struct.pack("!L", self.experimenter))
5749 packed.append(struct.pack("!L", self.subtype))
5750 packed.append(loxi.generic_util.pack_list(self.entries))
5751 length = sum([len(x) for x in packed])
5752 packed[2] = struct.pack("!H", length)
5753 return ''.join(packed)
5754
5755 @staticmethod
5756 def unpack(reader):
5757 obj = bsn_lacp_stats_reply()
5758 _version = reader.read("!B")[0]
5759 assert(_version == 5)
5760 _type = reader.read("!B")[0]
5761 assert(_type == 19)
5762 _length = reader.read("!H")[0]
5763 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005764 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005765 obj.xid = reader.read("!L")[0]
5766 _stats_type = reader.read("!H")[0]
5767 assert(_stats_type == 65535)
5768 obj.flags = reader.read("!H")[0]
5769 reader.skip(4)
5770 _experimenter = reader.read("!L")[0]
5771 assert(_experimenter == 6035143)
5772 _subtype = reader.read("!L")[0]
5773 assert(_subtype == 1)
5774 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
5775 return obj
5776
5777 def __eq__(self, other):
5778 if type(self) != type(other): return False
5779 if self.xid != other.xid: return False
5780 if self.flags != other.flags: return False
5781 if self.entries != other.entries: return False
5782 return True
5783
5784 def pretty_print(self, q):
5785 q.text("bsn_lacp_stats_reply {")
5786 with q.group():
5787 with q.indent(2):
5788 q.breakable()
5789 q.text("xid = ");
5790 if self.xid != None:
5791 q.text("%#x" % self.xid)
5792 else:
5793 q.text('None')
5794 q.text(","); q.breakable()
5795 q.text("flags = ");
5796 q.text("%#x" % self.flags)
5797 q.text(","); q.breakable()
5798 q.text("entries = ");
5799 q.pp(self.entries)
5800 q.breakable()
5801 q.text('}')
5802
5803bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5804
5805class bsn_lacp_stats_request(bsn_stats_request):
5806 version = 5
5807 type = 18
5808 stats_type = 65535
5809 experimenter = 6035143
5810 subtype = 1
5811
5812 def __init__(self, xid=None, flags=None):
5813 if xid != None:
5814 self.xid = xid
5815 else:
5816 self.xid = None
5817 if flags != None:
5818 self.flags = flags
5819 else:
5820 self.flags = 0
5821 return
5822
5823 def pack(self):
5824 packed = []
5825 packed.append(struct.pack("!B", self.version))
5826 packed.append(struct.pack("!B", self.type))
5827 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5828 packed.append(struct.pack("!L", self.xid))
5829 packed.append(struct.pack("!H", self.stats_type))
5830 packed.append(struct.pack("!H", self.flags))
5831 packed.append('\x00' * 4)
5832 packed.append(struct.pack("!L", self.experimenter))
5833 packed.append(struct.pack("!L", self.subtype))
5834 length = sum([len(x) for x in packed])
5835 packed[2] = struct.pack("!H", length)
5836 return ''.join(packed)
5837
5838 @staticmethod
5839 def unpack(reader):
5840 obj = bsn_lacp_stats_request()
5841 _version = reader.read("!B")[0]
5842 assert(_version == 5)
5843 _type = reader.read("!B")[0]
5844 assert(_type == 18)
5845 _length = reader.read("!H")[0]
5846 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005847 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005848 obj.xid = reader.read("!L")[0]
5849 _stats_type = reader.read("!H")[0]
5850 assert(_stats_type == 65535)
5851 obj.flags = reader.read("!H")[0]
5852 reader.skip(4)
5853 _experimenter = reader.read("!L")[0]
5854 assert(_experimenter == 6035143)
5855 _subtype = reader.read("!L")[0]
5856 assert(_subtype == 1)
5857 return obj
5858
5859 def __eq__(self, other):
5860 if type(self) != type(other): return False
5861 if self.xid != other.xid: return False
5862 if self.flags != other.flags: return False
5863 return True
5864
5865 def pretty_print(self, q):
5866 q.text("bsn_lacp_stats_request {")
5867 with q.group():
5868 with q.indent(2):
5869 q.breakable()
5870 q.text("xid = ");
5871 if self.xid != None:
5872 q.text("%#x" % self.xid)
5873 else:
5874 q.text('None')
5875 q.text(","); q.breakable()
5876 q.text("flags = ");
5877 q.text("%#x" % self.flags)
5878 q.breakable()
5879 q.text('}')
5880
5881bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5882
5883class bsn_log(bsn_header):
5884 version = 5
5885 type = 4
5886 experimenter = 6035143
5887 subtype = 63
5888
5889 def __init__(self, xid=None, loglevel=None, data=None):
5890 if xid != None:
5891 self.xid = xid
5892 else:
5893 self.xid = None
5894 if loglevel != None:
5895 self.loglevel = loglevel
5896 else:
5897 self.loglevel = 0
5898 if data != None:
5899 self.data = data
5900 else:
5901 self.data = ''
5902 return
5903
5904 def pack(self):
5905 packed = []
5906 packed.append(struct.pack("!B", self.version))
5907 packed.append(struct.pack("!B", self.type))
5908 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5909 packed.append(struct.pack("!L", self.xid))
5910 packed.append(struct.pack("!L", self.experimenter))
5911 packed.append(struct.pack("!L", self.subtype))
5912 packed.append(struct.pack("!B", self.loglevel))
5913 packed.append(self.data)
5914 length = sum([len(x) for x in packed])
5915 packed[2] = struct.pack("!H", length)
5916 return ''.join(packed)
5917
5918 @staticmethod
5919 def unpack(reader):
5920 obj = bsn_log()
5921 _version = reader.read("!B")[0]
5922 assert(_version == 5)
5923 _type = reader.read("!B")[0]
5924 assert(_type == 4)
5925 _length = reader.read("!H")[0]
5926 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005927 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005928 obj.xid = reader.read("!L")[0]
5929 _experimenter = reader.read("!L")[0]
5930 assert(_experimenter == 6035143)
5931 _subtype = reader.read("!L")[0]
5932 assert(_subtype == 63)
5933 obj.loglevel = reader.read("!B")[0]
5934 obj.data = str(reader.read_all())
5935 return obj
5936
5937 def __eq__(self, other):
5938 if type(self) != type(other): return False
5939 if self.xid != other.xid: return False
5940 if self.loglevel != other.loglevel: return False
5941 if self.data != other.data: return False
5942 return True
5943
5944 def pretty_print(self, q):
5945 q.text("bsn_log {")
5946 with q.group():
5947 with q.indent(2):
5948 q.breakable()
5949 q.text("xid = ");
5950 if self.xid != None:
5951 q.text("%#x" % self.xid)
5952 else:
5953 q.text('None')
5954 q.text(","); q.breakable()
5955 q.text("loglevel = ");
5956 q.text("%#x" % self.loglevel)
5957 q.text(","); q.breakable()
5958 q.text("data = ");
5959 q.pp(self.data)
5960 q.breakable()
5961 q.text('}')
5962
5963bsn_header.subtypes[63] = bsn_log
5964
Rich Lane474324f2015-01-14 15:22:56 -08005965class bsn_lua_command_reply(bsn_header):
5966 version = 5
5967 type = 4
5968 experimenter = 6035143
5969 subtype = 66
5970
5971 def __init__(self, xid=None, data=None):
5972 if xid != None:
5973 self.xid = xid
5974 else:
5975 self.xid = None
5976 if data != None:
5977 self.data = data
5978 else:
5979 self.data = ''
5980 return
5981
5982 def pack(self):
5983 packed = []
5984 packed.append(struct.pack("!B", self.version))
5985 packed.append(struct.pack("!B", self.type))
5986 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5987 packed.append(struct.pack("!L", self.xid))
5988 packed.append(struct.pack("!L", self.experimenter))
5989 packed.append(struct.pack("!L", self.subtype))
5990 packed.append(self.data)
5991 length = sum([len(x) for x in packed])
5992 packed[2] = struct.pack("!H", length)
5993 return ''.join(packed)
5994
5995 @staticmethod
5996 def unpack(reader):
5997 obj = bsn_lua_command_reply()
5998 _version = reader.read("!B")[0]
5999 assert(_version == 5)
6000 _type = reader.read("!B")[0]
6001 assert(_type == 4)
6002 _length = reader.read("!H")[0]
6003 orig_reader = reader
6004 reader = orig_reader.slice(_length, 4)
6005 obj.xid = reader.read("!L")[0]
6006 _experimenter = reader.read("!L")[0]
6007 assert(_experimenter == 6035143)
6008 _subtype = reader.read("!L")[0]
6009 assert(_subtype == 66)
6010 obj.data = str(reader.read_all())
6011 return obj
6012
6013 def __eq__(self, other):
6014 if type(self) != type(other): return False
6015 if self.xid != other.xid: return False
6016 if self.data != other.data: return False
6017 return True
6018
6019 def pretty_print(self, q):
6020 q.text("bsn_lua_command_reply {")
6021 with q.group():
6022 with q.indent(2):
6023 q.breakable()
6024 q.text("xid = ");
6025 if self.xid != None:
6026 q.text("%#x" % self.xid)
6027 else:
6028 q.text('None')
6029 q.text(","); q.breakable()
6030 q.text("data = ");
6031 q.pp(self.data)
6032 q.breakable()
6033 q.text('}')
6034
6035bsn_header.subtypes[66] = bsn_lua_command_reply
6036
6037class bsn_lua_command_request(bsn_header):
6038 version = 5
6039 type = 4
6040 experimenter = 6035143
6041 subtype = 65
6042
6043 def __init__(self, xid=None, data=None):
6044 if xid != None:
6045 self.xid = xid
6046 else:
6047 self.xid = None
6048 if data != None:
6049 self.data = data
6050 else:
6051 self.data = ''
6052 return
6053
6054 def pack(self):
6055 packed = []
6056 packed.append(struct.pack("!B", self.version))
6057 packed.append(struct.pack("!B", self.type))
6058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6059 packed.append(struct.pack("!L", self.xid))
6060 packed.append(struct.pack("!L", self.experimenter))
6061 packed.append(struct.pack("!L", self.subtype))
6062 packed.append(self.data)
6063 length = sum([len(x) for x in packed])
6064 packed[2] = struct.pack("!H", length)
6065 return ''.join(packed)
6066
6067 @staticmethod
6068 def unpack(reader):
6069 obj = bsn_lua_command_request()
6070 _version = reader.read("!B")[0]
6071 assert(_version == 5)
6072 _type = reader.read("!B")[0]
6073 assert(_type == 4)
6074 _length = reader.read("!H")[0]
6075 orig_reader = reader
6076 reader = orig_reader.slice(_length, 4)
6077 obj.xid = reader.read("!L")[0]
6078 _experimenter = reader.read("!L")[0]
6079 assert(_experimenter == 6035143)
6080 _subtype = reader.read("!L")[0]
6081 assert(_subtype == 65)
6082 obj.data = str(reader.read_all())
6083 return obj
6084
6085 def __eq__(self, other):
6086 if type(self) != type(other): return False
6087 if self.xid != other.xid: return False
6088 if self.data != other.data: return False
6089 return True
6090
6091 def pretty_print(self, q):
6092 q.text("bsn_lua_command_request {")
6093 with q.group():
6094 with q.indent(2):
6095 q.breakable()
6096 q.text("xid = ");
6097 if self.xid != None:
6098 q.text("%#x" % self.xid)
6099 else:
6100 q.text('None')
6101 q.text(","); q.breakable()
6102 q.text("data = ");
6103 q.pp(self.data)
6104 q.breakable()
6105 q.text('}')
6106
6107bsn_header.subtypes[65] = bsn_lua_command_request
6108
6109class bsn_lua_notification(bsn_header):
6110 version = 5
6111 type = 4
6112 experimenter = 6035143
6113 subtype = 67
6114
6115 def __init__(self, xid=None, data=None):
6116 if xid != None:
6117 self.xid = xid
6118 else:
6119 self.xid = None
6120 if data != None:
6121 self.data = data
6122 else:
6123 self.data = ''
6124 return
6125
6126 def pack(self):
6127 packed = []
6128 packed.append(struct.pack("!B", self.version))
6129 packed.append(struct.pack("!B", self.type))
6130 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6131 packed.append(struct.pack("!L", self.xid))
6132 packed.append(struct.pack("!L", self.experimenter))
6133 packed.append(struct.pack("!L", self.subtype))
6134 packed.append(self.data)
6135 length = sum([len(x) for x in packed])
6136 packed[2] = struct.pack("!H", length)
6137 return ''.join(packed)
6138
6139 @staticmethod
6140 def unpack(reader):
6141 obj = bsn_lua_notification()
6142 _version = reader.read("!B")[0]
6143 assert(_version == 5)
6144 _type = reader.read("!B")[0]
6145 assert(_type == 4)
6146 _length = reader.read("!H")[0]
6147 orig_reader = reader
6148 reader = orig_reader.slice(_length, 4)
6149 obj.xid = reader.read("!L")[0]
6150 _experimenter = reader.read("!L")[0]
6151 assert(_experimenter == 6035143)
6152 _subtype = reader.read("!L")[0]
6153 assert(_subtype == 67)
6154 obj.data = str(reader.read_all())
6155 return obj
6156
6157 def __eq__(self, other):
6158 if type(self) != type(other): return False
6159 if self.xid != other.xid: return False
6160 if self.data != other.data: return False
6161 return True
6162
6163 def pretty_print(self, q):
6164 q.text("bsn_lua_notification {")
6165 with q.group():
6166 with q.indent(2):
6167 q.breakable()
6168 q.text("xid = ");
6169 if self.xid != None:
6170 q.text("%#x" % self.xid)
6171 else:
6172 q.text('None')
6173 q.text(","); q.breakable()
6174 q.text("data = ");
6175 q.pp(self.data)
6176 q.breakable()
6177 q.text('}')
6178
6179bsn_header.subtypes[67] = bsn_lua_notification
6180
6181class bsn_lua_upload(bsn_header):
6182 version = 5
6183 type = 4
6184 experimenter = 6035143
6185 subtype = 64
6186
6187 def __init__(self, xid=None, flags=None, filename=None, data=None):
6188 if xid != None:
6189 self.xid = xid
6190 else:
6191 self.xid = None
6192 if flags != None:
6193 self.flags = flags
6194 else:
6195 self.flags = 0
6196 if filename != None:
6197 self.filename = filename
6198 else:
6199 self.filename = ""
6200 if data != None:
6201 self.data = data
6202 else:
6203 self.data = ''
6204 return
6205
6206 def pack(self):
6207 packed = []
6208 packed.append(struct.pack("!B", self.version))
6209 packed.append(struct.pack("!B", self.type))
6210 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6211 packed.append(struct.pack("!L", self.xid))
6212 packed.append(struct.pack("!L", self.experimenter))
6213 packed.append(struct.pack("!L", self.subtype))
6214 packed.append(struct.pack("!H", self.flags))
6215 packed.append(struct.pack("!64s", self.filename))
6216 packed.append(self.data)
6217 length = sum([len(x) for x in packed])
6218 packed[2] = struct.pack("!H", length)
6219 return ''.join(packed)
6220
6221 @staticmethod
6222 def unpack(reader):
6223 obj = bsn_lua_upload()
6224 _version = reader.read("!B")[0]
6225 assert(_version == 5)
6226 _type = reader.read("!B")[0]
6227 assert(_type == 4)
6228 _length = reader.read("!H")[0]
6229 orig_reader = reader
6230 reader = orig_reader.slice(_length, 4)
6231 obj.xid = reader.read("!L")[0]
6232 _experimenter = reader.read("!L")[0]
6233 assert(_experimenter == 6035143)
6234 _subtype = reader.read("!L")[0]
6235 assert(_subtype == 64)
6236 obj.flags = reader.read("!H")[0]
6237 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6238 obj.data = str(reader.read_all())
6239 return obj
6240
6241 def __eq__(self, other):
6242 if type(self) != type(other): return False
6243 if self.xid != other.xid: return False
6244 if self.flags != other.flags: return False
6245 if self.filename != other.filename: return False
6246 if self.data != other.data: return False
6247 return True
6248
6249 def pretty_print(self, q):
6250 q.text("bsn_lua_upload {")
6251 with q.group():
6252 with q.indent(2):
6253 q.breakable()
6254 q.text("xid = ");
6255 if self.xid != None:
6256 q.text("%#x" % self.xid)
6257 else:
6258 q.text('None')
6259 q.text(","); q.breakable()
6260 q.text("flags = ");
6261 q.text("%#x" % self.flags)
6262 q.text(","); q.breakable()
6263 q.text("filename = ");
6264 q.pp(self.filename)
6265 q.text(","); q.breakable()
6266 q.text("data = ");
6267 q.pp(self.data)
6268 q.breakable()
6269 q.text('}')
6270
6271bsn_header.subtypes[64] = bsn_lua_upload
6272
Rich Lane2e079da2014-10-29 15:30:24 -07006273class bsn_pdu_rx_reply(bsn_header):
6274 version = 5
6275 type = 4
6276 experimenter = 6035143
6277 subtype = 34
6278
6279 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6280 if xid != None:
6281 self.xid = xid
6282 else:
6283 self.xid = None
6284 if status != None:
6285 self.status = status
6286 else:
6287 self.status = 0
6288 if port_no != None:
6289 self.port_no = port_no
6290 else:
6291 self.port_no = 0
6292 if slot_num != None:
6293 self.slot_num = slot_num
6294 else:
6295 self.slot_num = 0
6296 return
6297
6298 def pack(self):
6299 packed = []
6300 packed.append(struct.pack("!B", self.version))
6301 packed.append(struct.pack("!B", self.type))
6302 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6303 packed.append(struct.pack("!L", self.xid))
6304 packed.append(struct.pack("!L", self.experimenter))
6305 packed.append(struct.pack("!L", self.subtype))
6306 packed.append(struct.pack("!L", self.status))
6307 packed.append(util.pack_port_no(self.port_no))
6308 packed.append(struct.pack("!B", self.slot_num))
6309 length = sum([len(x) for x in packed])
6310 packed[2] = struct.pack("!H", length)
6311 return ''.join(packed)
6312
6313 @staticmethod
6314 def unpack(reader):
6315 obj = bsn_pdu_rx_reply()
6316 _version = reader.read("!B")[0]
6317 assert(_version == 5)
6318 _type = reader.read("!B")[0]
6319 assert(_type == 4)
6320 _length = reader.read("!H")[0]
6321 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006322 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006323 obj.xid = reader.read("!L")[0]
6324 _experimenter = reader.read("!L")[0]
6325 assert(_experimenter == 6035143)
6326 _subtype = reader.read("!L")[0]
6327 assert(_subtype == 34)
6328 obj.status = reader.read("!L")[0]
6329 obj.port_no = util.unpack_port_no(reader)
6330 obj.slot_num = reader.read("!B")[0]
6331 return obj
6332
6333 def __eq__(self, other):
6334 if type(self) != type(other): return False
6335 if self.xid != other.xid: return False
6336 if self.status != other.status: return False
6337 if self.port_no != other.port_no: return False
6338 if self.slot_num != other.slot_num: return False
6339 return True
6340
6341 def pretty_print(self, q):
6342 q.text("bsn_pdu_rx_reply {")
6343 with q.group():
6344 with q.indent(2):
6345 q.breakable()
6346 q.text("xid = ");
6347 if self.xid != None:
6348 q.text("%#x" % self.xid)
6349 else:
6350 q.text('None')
6351 q.text(","); q.breakable()
6352 q.text("status = ");
6353 q.text("%#x" % self.status)
6354 q.text(","); q.breakable()
6355 q.text("port_no = ");
6356 q.text(util.pretty_port(self.port_no))
6357 q.text(","); q.breakable()
6358 q.text("slot_num = ");
6359 q.text("%#x" % self.slot_num)
6360 q.breakable()
6361 q.text('}')
6362
6363bsn_header.subtypes[34] = bsn_pdu_rx_reply
6364
6365class bsn_pdu_rx_request(bsn_header):
6366 version = 5
6367 type = 4
6368 experimenter = 6035143
6369 subtype = 33
6370
6371 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6372 if xid != None:
6373 self.xid = xid
6374 else:
6375 self.xid = None
6376 if timeout_ms != None:
6377 self.timeout_ms = timeout_ms
6378 else:
6379 self.timeout_ms = 0
6380 if port_no != None:
6381 self.port_no = port_no
6382 else:
6383 self.port_no = 0
6384 if slot_num != None:
6385 self.slot_num = slot_num
6386 else:
6387 self.slot_num = 0
6388 if data != None:
6389 self.data = data
6390 else:
6391 self.data = ''
6392 return
6393
6394 def pack(self):
6395 packed = []
6396 packed.append(struct.pack("!B", self.version))
6397 packed.append(struct.pack("!B", self.type))
6398 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6399 packed.append(struct.pack("!L", self.xid))
6400 packed.append(struct.pack("!L", self.experimenter))
6401 packed.append(struct.pack("!L", self.subtype))
6402 packed.append(struct.pack("!L", self.timeout_ms))
6403 packed.append(util.pack_port_no(self.port_no))
6404 packed.append(struct.pack("!B", self.slot_num))
6405 packed.append('\x00' * 3)
6406 packed.append(self.data)
6407 length = sum([len(x) for x in packed])
6408 packed[2] = struct.pack("!H", length)
6409 return ''.join(packed)
6410
6411 @staticmethod
6412 def unpack(reader):
6413 obj = bsn_pdu_rx_request()
6414 _version = reader.read("!B")[0]
6415 assert(_version == 5)
6416 _type = reader.read("!B")[0]
6417 assert(_type == 4)
6418 _length = reader.read("!H")[0]
6419 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006420 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006421 obj.xid = reader.read("!L")[0]
6422 _experimenter = reader.read("!L")[0]
6423 assert(_experimenter == 6035143)
6424 _subtype = reader.read("!L")[0]
6425 assert(_subtype == 33)
6426 obj.timeout_ms = reader.read("!L")[0]
6427 obj.port_no = util.unpack_port_no(reader)
6428 obj.slot_num = reader.read("!B")[0]
6429 reader.skip(3)
6430 obj.data = str(reader.read_all())
6431 return obj
6432
6433 def __eq__(self, other):
6434 if type(self) != type(other): return False
6435 if self.xid != other.xid: return False
6436 if self.timeout_ms != other.timeout_ms: return False
6437 if self.port_no != other.port_no: return False
6438 if self.slot_num != other.slot_num: return False
6439 if self.data != other.data: return False
6440 return True
6441
6442 def pretty_print(self, q):
6443 q.text("bsn_pdu_rx_request {")
6444 with q.group():
6445 with q.indent(2):
6446 q.breakable()
6447 q.text("xid = ");
6448 if self.xid != None:
6449 q.text("%#x" % self.xid)
6450 else:
6451 q.text('None')
6452 q.text(","); q.breakable()
6453 q.text("timeout_ms = ");
6454 q.text("%#x" % self.timeout_ms)
6455 q.text(","); q.breakable()
6456 q.text("port_no = ");
6457 q.text(util.pretty_port(self.port_no))
6458 q.text(","); q.breakable()
6459 q.text("slot_num = ");
6460 q.text("%#x" % self.slot_num)
6461 q.text(","); q.breakable()
6462 q.text("data = ");
6463 q.pp(self.data)
6464 q.breakable()
6465 q.text('}')
6466
6467bsn_header.subtypes[33] = bsn_pdu_rx_request
6468
6469class bsn_pdu_rx_timeout(bsn_header):
6470 version = 5
6471 type = 4
6472 experimenter = 6035143
6473 subtype = 35
6474
6475 def __init__(self, xid=None, port_no=None, slot_num=None):
6476 if xid != None:
6477 self.xid = xid
6478 else:
6479 self.xid = None
6480 if port_no != None:
6481 self.port_no = port_no
6482 else:
6483 self.port_no = 0
6484 if slot_num != None:
6485 self.slot_num = slot_num
6486 else:
6487 self.slot_num = 0
6488 return
6489
6490 def pack(self):
6491 packed = []
6492 packed.append(struct.pack("!B", self.version))
6493 packed.append(struct.pack("!B", self.type))
6494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6495 packed.append(struct.pack("!L", self.xid))
6496 packed.append(struct.pack("!L", self.experimenter))
6497 packed.append(struct.pack("!L", self.subtype))
6498 packed.append(util.pack_port_no(self.port_no))
6499 packed.append(struct.pack("!B", self.slot_num))
6500 length = sum([len(x) for x in packed])
6501 packed[2] = struct.pack("!H", length)
6502 return ''.join(packed)
6503
6504 @staticmethod
6505 def unpack(reader):
6506 obj = bsn_pdu_rx_timeout()
6507 _version = reader.read("!B")[0]
6508 assert(_version == 5)
6509 _type = reader.read("!B")[0]
6510 assert(_type == 4)
6511 _length = reader.read("!H")[0]
6512 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006513 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006514 obj.xid = reader.read("!L")[0]
6515 _experimenter = reader.read("!L")[0]
6516 assert(_experimenter == 6035143)
6517 _subtype = reader.read("!L")[0]
6518 assert(_subtype == 35)
6519 obj.port_no = util.unpack_port_no(reader)
6520 obj.slot_num = reader.read("!B")[0]
6521 return obj
6522
6523 def __eq__(self, other):
6524 if type(self) != type(other): return False
6525 if self.xid != other.xid: return False
6526 if self.port_no != other.port_no: return False
6527 if self.slot_num != other.slot_num: return False
6528 return True
6529
6530 def pretty_print(self, q):
6531 q.text("bsn_pdu_rx_timeout {")
6532 with q.group():
6533 with q.indent(2):
6534 q.breakable()
6535 q.text("xid = ");
6536 if self.xid != None:
6537 q.text("%#x" % self.xid)
6538 else:
6539 q.text('None')
6540 q.text(","); q.breakable()
6541 q.text("port_no = ");
6542 q.text(util.pretty_port(self.port_no))
6543 q.text(","); q.breakable()
6544 q.text("slot_num = ");
6545 q.text("%#x" % self.slot_num)
6546 q.breakable()
6547 q.text('}')
6548
6549bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6550
6551class bsn_pdu_tx_reply(bsn_header):
6552 version = 5
6553 type = 4
6554 experimenter = 6035143
6555 subtype = 32
6556
6557 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6558 if xid != None:
6559 self.xid = xid
6560 else:
6561 self.xid = None
6562 if status != None:
6563 self.status = status
6564 else:
6565 self.status = 0
6566 if port_no != None:
6567 self.port_no = port_no
6568 else:
6569 self.port_no = 0
6570 if slot_num != None:
6571 self.slot_num = slot_num
6572 else:
6573 self.slot_num = 0
6574 return
6575
6576 def pack(self):
6577 packed = []
6578 packed.append(struct.pack("!B", self.version))
6579 packed.append(struct.pack("!B", self.type))
6580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6581 packed.append(struct.pack("!L", self.xid))
6582 packed.append(struct.pack("!L", self.experimenter))
6583 packed.append(struct.pack("!L", self.subtype))
6584 packed.append(struct.pack("!L", self.status))
6585 packed.append(util.pack_port_no(self.port_no))
6586 packed.append(struct.pack("!B", self.slot_num))
6587 length = sum([len(x) for x in packed])
6588 packed[2] = struct.pack("!H", length)
6589 return ''.join(packed)
6590
6591 @staticmethod
6592 def unpack(reader):
6593 obj = bsn_pdu_tx_reply()
6594 _version = reader.read("!B")[0]
6595 assert(_version == 5)
6596 _type = reader.read("!B")[0]
6597 assert(_type == 4)
6598 _length = reader.read("!H")[0]
6599 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006600 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006601 obj.xid = reader.read("!L")[0]
6602 _experimenter = reader.read("!L")[0]
6603 assert(_experimenter == 6035143)
6604 _subtype = reader.read("!L")[0]
6605 assert(_subtype == 32)
6606 obj.status = reader.read("!L")[0]
6607 obj.port_no = util.unpack_port_no(reader)
6608 obj.slot_num = reader.read("!B")[0]
6609 return obj
6610
6611 def __eq__(self, other):
6612 if type(self) != type(other): return False
6613 if self.xid != other.xid: return False
6614 if self.status != other.status: return False
6615 if self.port_no != other.port_no: return False
6616 if self.slot_num != other.slot_num: return False
6617 return True
6618
6619 def pretty_print(self, q):
6620 q.text("bsn_pdu_tx_reply {")
6621 with q.group():
6622 with q.indent(2):
6623 q.breakable()
6624 q.text("xid = ");
6625 if self.xid != None:
6626 q.text("%#x" % self.xid)
6627 else:
6628 q.text('None')
6629 q.text(","); q.breakable()
6630 q.text("status = ");
6631 q.text("%#x" % self.status)
6632 q.text(","); q.breakable()
6633 q.text("port_no = ");
6634 q.text(util.pretty_port(self.port_no))
6635 q.text(","); q.breakable()
6636 q.text("slot_num = ");
6637 q.text("%#x" % self.slot_num)
6638 q.breakable()
6639 q.text('}')
6640
6641bsn_header.subtypes[32] = bsn_pdu_tx_reply
6642
6643class bsn_pdu_tx_request(bsn_header):
6644 version = 5
6645 type = 4
6646 experimenter = 6035143
6647 subtype = 31
6648
6649 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
6650 if xid != None:
6651 self.xid = xid
6652 else:
6653 self.xid = None
6654 if tx_interval_ms != None:
6655 self.tx_interval_ms = tx_interval_ms
6656 else:
6657 self.tx_interval_ms = 0
6658 if port_no != None:
6659 self.port_no = port_no
6660 else:
6661 self.port_no = 0
6662 if slot_num != None:
6663 self.slot_num = slot_num
6664 else:
6665 self.slot_num = 0
6666 if data != None:
6667 self.data = data
6668 else:
6669 self.data = ''
6670 return
6671
6672 def pack(self):
6673 packed = []
6674 packed.append(struct.pack("!B", self.version))
6675 packed.append(struct.pack("!B", self.type))
6676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6677 packed.append(struct.pack("!L", self.xid))
6678 packed.append(struct.pack("!L", self.experimenter))
6679 packed.append(struct.pack("!L", self.subtype))
6680 packed.append(struct.pack("!L", self.tx_interval_ms))
6681 packed.append(util.pack_port_no(self.port_no))
6682 packed.append(struct.pack("!B", self.slot_num))
6683 packed.append('\x00' * 3)
6684 packed.append(self.data)
6685 length = sum([len(x) for x in packed])
6686 packed[2] = struct.pack("!H", length)
6687 return ''.join(packed)
6688
6689 @staticmethod
6690 def unpack(reader):
6691 obj = bsn_pdu_tx_request()
6692 _version = reader.read("!B")[0]
6693 assert(_version == 5)
6694 _type = reader.read("!B")[0]
6695 assert(_type == 4)
6696 _length = reader.read("!H")[0]
6697 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006698 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006699 obj.xid = reader.read("!L")[0]
6700 _experimenter = reader.read("!L")[0]
6701 assert(_experimenter == 6035143)
6702 _subtype = reader.read("!L")[0]
6703 assert(_subtype == 31)
6704 obj.tx_interval_ms = reader.read("!L")[0]
6705 obj.port_no = util.unpack_port_no(reader)
6706 obj.slot_num = reader.read("!B")[0]
6707 reader.skip(3)
6708 obj.data = str(reader.read_all())
6709 return obj
6710
6711 def __eq__(self, other):
6712 if type(self) != type(other): return False
6713 if self.xid != other.xid: return False
6714 if self.tx_interval_ms != other.tx_interval_ms: return False
6715 if self.port_no != other.port_no: return False
6716 if self.slot_num != other.slot_num: return False
6717 if self.data != other.data: return False
6718 return True
6719
6720 def pretty_print(self, q):
6721 q.text("bsn_pdu_tx_request {")
6722 with q.group():
6723 with q.indent(2):
6724 q.breakable()
6725 q.text("xid = ");
6726 if self.xid != None:
6727 q.text("%#x" % self.xid)
6728 else:
6729 q.text('None')
6730 q.text(","); q.breakable()
6731 q.text("tx_interval_ms = ");
6732 q.text("%#x" % self.tx_interval_ms)
6733 q.text(","); q.breakable()
6734 q.text("port_no = ");
6735 q.text(util.pretty_port(self.port_no))
6736 q.text(","); q.breakable()
6737 q.text("slot_num = ");
6738 q.text("%#x" % self.slot_num)
6739 q.text(","); q.breakable()
6740 q.text("data = ");
6741 q.pp(self.data)
6742 q.breakable()
6743 q.text('}')
6744
6745bsn_header.subtypes[31] = bsn_pdu_tx_request
6746
Rich Laneccd32ed2014-11-10 17:48:24 -08006747class bsn_port_counter_stats_reply(bsn_stats_reply):
6748 version = 5
6749 type = 19
6750 stats_type = 65535
6751 experimenter = 6035143
6752 subtype = 8
6753
6754 def __init__(self, xid=None, flags=None, entries=None):
6755 if xid != None:
6756 self.xid = xid
6757 else:
6758 self.xid = None
6759 if flags != None:
6760 self.flags = flags
6761 else:
6762 self.flags = 0
6763 if entries != None:
6764 self.entries = entries
6765 else:
6766 self.entries = []
6767 return
6768
6769 def pack(self):
6770 packed = []
6771 packed.append(struct.pack("!B", self.version))
6772 packed.append(struct.pack("!B", self.type))
6773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6774 packed.append(struct.pack("!L", self.xid))
6775 packed.append(struct.pack("!H", self.stats_type))
6776 packed.append(struct.pack("!H", self.flags))
6777 packed.append('\x00' * 4)
6778 packed.append(struct.pack("!L", self.experimenter))
6779 packed.append(struct.pack("!L", self.subtype))
6780 packed.append(loxi.generic_util.pack_list(self.entries))
6781 length = sum([len(x) for x in packed])
6782 packed[2] = struct.pack("!H", length)
6783 return ''.join(packed)
6784
6785 @staticmethod
6786 def unpack(reader):
6787 obj = bsn_port_counter_stats_reply()
6788 _version = reader.read("!B")[0]
6789 assert(_version == 5)
6790 _type = reader.read("!B")[0]
6791 assert(_type == 19)
6792 _length = reader.read("!H")[0]
6793 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006794 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006795 obj.xid = reader.read("!L")[0]
6796 _stats_type = reader.read("!H")[0]
6797 assert(_stats_type == 65535)
6798 obj.flags = reader.read("!H")[0]
6799 reader.skip(4)
6800 _experimenter = reader.read("!L")[0]
6801 assert(_experimenter == 6035143)
6802 _subtype = reader.read("!L")[0]
6803 assert(_subtype == 8)
6804 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6805 return obj
6806
6807 def __eq__(self, other):
6808 if type(self) != type(other): return False
6809 if self.xid != other.xid: return False
6810 if self.flags != other.flags: return False
6811 if self.entries != other.entries: return False
6812 return True
6813
6814 def pretty_print(self, q):
6815 q.text("bsn_port_counter_stats_reply {")
6816 with q.group():
6817 with q.indent(2):
6818 q.breakable()
6819 q.text("xid = ");
6820 if self.xid != None:
6821 q.text("%#x" % self.xid)
6822 else:
6823 q.text('None')
6824 q.text(","); q.breakable()
6825 q.text("flags = ");
6826 q.text("%#x" % self.flags)
6827 q.text(","); q.breakable()
6828 q.text("entries = ");
6829 q.pp(self.entries)
6830 q.breakable()
6831 q.text('}')
6832
6833bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6834
6835class bsn_port_counter_stats_request(bsn_stats_request):
6836 version = 5
6837 type = 18
6838 stats_type = 65535
6839 experimenter = 6035143
6840 subtype = 8
6841
6842 def __init__(self, xid=None, flags=None, port_no=None):
6843 if xid != None:
6844 self.xid = xid
6845 else:
6846 self.xid = None
6847 if flags != None:
6848 self.flags = flags
6849 else:
6850 self.flags = 0
6851 if port_no != None:
6852 self.port_no = port_no
6853 else:
6854 self.port_no = 0
6855 return
6856
6857 def pack(self):
6858 packed = []
6859 packed.append(struct.pack("!B", self.version))
6860 packed.append(struct.pack("!B", self.type))
6861 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6862 packed.append(struct.pack("!L", self.xid))
6863 packed.append(struct.pack("!H", self.stats_type))
6864 packed.append(struct.pack("!H", self.flags))
6865 packed.append('\x00' * 4)
6866 packed.append(struct.pack("!L", self.experimenter))
6867 packed.append(struct.pack("!L", self.subtype))
6868 packed.append(util.pack_port_no(self.port_no))
6869 length = sum([len(x) for x in packed])
6870 packed[2] = struct.pack("!H", length)
6871 return ''.join(packed)
6872
6873 @staticmethod
6874 def unpack(reader):
6875 obj = bsn_port_counter_stats_request()
6876 _version = reader.read("!B")[0]
6877 assert(_version == 5)
6878 _type = reader.read("!B")[0]
6879 assert(_type == 18)
6880 _length = reader.read("!H")[0]
6881 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006882 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006883 obj.xid = reader.read("!L")[0]
6884 _stats_type = reader.read("!H")[0]
6885 assert(_stats_type == 65535)
6886 obj.flags = reader.read("!H")[0]
6887 reader.skip(4)
6888 _experimenter = reader.read("!L")[0]
6889 assert(_experimenter == 6035143)
6890 _subtype = reader.read("!L")[0]
6891 assert(_subtype == 8)
6892 obj.port_no = util.unpack_port_no(reader)
6893 return obj
6894
6895 def __eq__(self, other):
6896 if type(self) != type(other): return False
6897 if self.xid != other.xid: return False
6898 if self.flags != other.flags: return False
6899 if self.port_no != other.port_no: return False
6900 return True
6901
6902 def pretty_print(self, q):
6903 q.text("bsn_port_counter_stats_request {")
6904 with q.group():
6905 with q.indent(2):
6906 q.breakable()
6907 q.text("xid = ");
6908 if self.xid != None:
6909 q.text("%#x" % self.xid)
6910 else:
6911 q.text('None')
6912 q.text(","); q.breakable()
6913 q.text("flags = ");
6914 q.text("%#x" % self.flags)
6915 q.text(","); q.breakable()
6916 q.text("port_no = ");
6917 q.text(util.pretty_port(self.port_no))
6918 q.breakable()
6919 q.text('}')
6920
6921bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6922
6923class bsn_set_aux_cxns_reply(bsn_header):
6924 version = 5
6925 type = 4
6926 experimenter = 6035143
6927 subtype = 59
6928
6929 def __init__(self, xid=None, num_aux=None, status=None):
6930 if xid != None:
6931 self.xid = xid
6932 else:
6933 self.xid = None
6934 if num_aux != None:
6935 self.num_aux = num_aux
6936 else:
6937 self.num_aux = 0
6938 if status != None:
6939 self.status = status
6940 else:
6941 self.status = 0
6942 return
6943
6944 def pack(self):
6945 packed = []
6946 packed.append(struct.pack("!B", self.version))
6947 packed.append(struct.pack("!B", self.type))
6948 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6949 packed.append(struct.pack("!L", self.xid))
6950 packed.append(struct.pack("!L", self.experimenter))
6951 packed.append(struct.pack("!L", self.subtype))
6952 packed.append(struct.pack("!L", self.num_aux))
6953 packed.append(struct.pack("!L", self.status))
6954 length = sum([len(x) for x in packed])
6955 packed[2] = struct.pack("!H", length)
6956 return ''.join(packed)
6957
6958 @staticmethod
6959 def unpack(reader):
6960 obj = bsn_set_aux_cxns_reply()
6961 _version = reader.read("!B")[0]
6962 assert(_version == 5)
6963 _type = reader.read("!B")[0]
6964 assert(_type == 4)
6965 _length = reader.read("!H")[0]
6966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006967 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006968 obj.xid = reader.read("!L")[0]
6969 _experimenter = reader.read("!L")[0]
6970 assert(_experimenter == 6035143)
6971 _subtype = reader.read("!L")[0]
6972 assert(_subtype == 59)
6973 obj.num_aux = reader.read("!L")[0]
6974 obj.status = reader.read("!L")[0]
6975 return obj
6976
6977 def __eq__(self, other):
6978 if type(self) != type(other): return False
6979 if self.xid != other.xid: return False
6980 if self.num_aux != other.num_aux: return False
6981 if self.status != other.status: return False
6982 return True
6983
6984 def pretty_print(self, q):
6985 q.text("bsn_set_aux_cxns_reply {")
6986 with q.group():
6987 with q.indent(2):
6988 q.breakable()
6989 q.text("xid = ");
6990 if self.xid != None:
6991 q.text("%#x" % self.xid)
6992 else:
6993 q.text('None')
6994 q.text(","); q.breakable()
6995 q.text("num_aux = ");
6996 q.text("%#x" % self.num_aux)
6997 q.text(","); q.breakable()
6998 q.text("status = ");
6999 q.text("%#x" % self.status)
7000 q.breakable()
7001 q.text('}')
7002
7003bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7004
7005class bsn_set_aux_cxns_request(bsn_header):
7006 version = 5
7007 type = 4
7008 experimenter = 6035143
7009 subtype = 58
7010
7011 def __init__(self, xid=None, num_aux=None):
7012 if xid != None:
7013 self.xid = xid
7014 else:
7015 self.xid = None
7016 if num_aux != None:
7017 self.num_aux = num_aux
7018 else:
7019 self.num_aux = 0
7020 return
7021
7022 def pack(self):
7023 packed = []
7024 packed.append(struct.pack("!B", self.version))
7025 packed.append(struct.pack("!B", self.type))
7026 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7027 packed.append(struct.pack("!L", self.xid))
7028 packed.append(struct.pack("!L", self.experimenter))
7029 packed.append(struct.pack("!L", self.subtype))
7030 packed.append(struct.pack("!L", self.num_aux))
7031 length = sum([len(x) for x in packed])
7032 packed[2] = struct.pack("!H", length)
7033 return ''.join(packed)
7034
7035 @staticmethod
7036 def unpack(reader):
7037 obj = bsn_set_aux_cxns_request()
7038 _version = reader.read("!B")[0]
7039 assert(_version == 5)
7040 _type = reader.read("!B")[0]
7041 assert(_type == 4)
7042 _length = reader.read("!H")[0]
7043 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007044 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007045 obj.xid = reader.read("!L")[0]
7046 _experimenter = reader.read("!L")[0]
7047 assert(_experimenter == 6035143)
7048 _subtype = reader.read("!L")[0]
7049 assert(_subtype == 58)
7050 obj.num_aux = reader.read("!L")[0]
7051 return obj
7052
7053 def __eq__(self, other):
7054 if type(self) != type(other): return False
7055 if self.xid != other.xid: return False
7056 if self.num_aux != other.num_aux: return False
7057 return True
7058
7059 def pretty_print(self, q):
7060 q.text("bsn_set_aux_cxns_request {")
7061 with q.group():
7062 with q.indent(2):
7063 q.breakable()
7064 q.text("xid = ");
7065 if self.xid != None:
7066 q.text("%#x" % self.xid)
7067 else:
7068 q.text('None')
7069 q.text(","); q.breakable()
7070 q.text("num_aux = ");
7071 q.text("%#x" % self.num_aux)
7072 q.breakable()
7073 q.text('}')
7074
7075bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7076
7077class bsn_set_lacp_reply(bsn_header):
7078 version = 5
7079 type = 4
7080 experimenter = 6035143
7081 subtype = 42
7082
7083 def __init__(self, xid=None, status=None, port_no=None):
7084 if xid != None:
7085 self.xid = xid
7086 else:
7087 self.xid = None
7088 if status != None:
7089 self.status = status
7090 else:
7091 self.status = 0
7092 if port_no != None:
7093 self.port_no = port_no
7094 else:
7095 self.port_no = 0
7096 return
7097
7098 def pack(self):
7099 packed = []
7100 packed.append(struct.pack("!B", self.version))
7101 packed.append(struct.pack("!B", self.type))
7102 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7103 packed.append(struct.pack("!L", self.xid))
7104 packed.append(struct.pack("!L", self.experimenter))
7105 packed.append(struct.pack("!L", self.subtype))
7106 packed.append(struct.pack("!L", self.status))
7107 packed.append(util.pack_port_no(self.port_no))
7108 length = sum([len(x) for x in packed])
7109 packed[2] = struct.pack("!H", length)
7110 return ''.join(packed)
7111
7112 @staticmethod
7113 def unpack(reader):
7114 obj = bsn_set_lacp_reply()
7115 _version = reader.read("!B")[0]
7116 assert(_version == 5)
7117 _type = reader.read("!B")[0]
7118 assert(_type == 4)
7119 _length = reader.read("!H")[0]
7120 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007121 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007122 obj.xid = reader.read("!L")[0]
7123 _experimenter = reader.read("!L")[0]
7124 assert(_experimenter == 6035143)
7125 _subtype = reader.read("!L")[0]
7126 assert(_subtype == 42)
7127 obj.status = reader.read("!L")[0]
7128 obj.port_no = util.unpack_port_no(reader)
7129 return obj
7130
7131 def __eq__(self, other):
7132 if type(self) != type(other): return False
7133 if self.xid != other.xid: return False
7134 if self.status != other.status: return False
7135 if self.port_no != other.port_no: return False
7136 return True
7137
7138 def pretty_print(self, q):
7139 q.text("bsn_set_lacp_reply {")
7140 with q.group():
7141 with q.indent(2):
7142 q.breakable()
7143 q.text("xid = ");
7144 if self.xid != None:
7145 q.text("%#x" % self.xid)
7146 else:
7147 q.text('None')
7148 q.text(","); q.breakable()
7149 q.text("status = ");
7150 q.text("%#x" % self.status)
7151 q.text(","); q.breakable()
7152 q.text("port_no = ");
7153 q.text(util.pretty_port(self.port_no))
7154 q.breakable()
7155 q.text('}')
7156
7157bsn_header.subtypes[42] = bsn_set_lacp_reply
7158
7159class bsn_set_lacp_request(bsn_header):
7160 version = 5
7161 type = 4
7162 experimenter = 6035143
7163 subtype = 41
7164
7165 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):
7166 if xid != None:
7167 self.xid = xid
7168 else:
7169 self.xid = None
7170 if enabled != None:
7171 self.enabled = enabled
7172 else:
7173 self.enabled = 0
7174 if port_no != None:
7175 self.port_no = port_no
7176 else:
7177 self.port_no = 0
7178 if actor_sys_priority != None:
7179 self.actor_sys_priority = actor_sys_priority
7180 else:
7181 self.actor_sys_priority = 0
7182 if actor_sys_mac != None:
7183 self.actor_sys_mac = actor_sys_mac
7184 else:
7185 self.actor_sys_mac = [0,0,0,0,0,0]
7186 if actor_port_priority != None:
7187 self.actor_port_priority = actor_port_priority
7188 else:
7189 self.actor_port_priority = 0
7190 if actor_port_num != None:
7191 self.actor_port_num = actor_port_num
7192 else:
7193 self.actor_port_num = 0
7194 if actor_key != None:
7195 self.actor_key = actor_key
7196 else:
7197 self.actor_key = 0
7198 return
7199
7200 def pack(self):
7201 packed = []
7202 packed.append(struct.pack("!B", self.version))
7203 packed.append(struct.pack("!B", self.type))
7204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7205 packed.append(struct.pack("!L", self.xid))
7206 packed.append(struct.pack("!L", self.experimenter))
7207 packed.append(struct.pack("!L", self.subtype))
7208 packed.append(struct.pack("!B", self.enabled))
7209 packed.append('\x00' * 3)
7210 packed.append(util.pack_port_no(self.port_no))
7211 packed.append(struct.pack("!H", self.actor_sys_priority))
7212 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7213 packed.append(struct.pack("!H", self.actor_port_priority))
7214 packed.append(struct.pack("!H", self.actor_port_num))
7215 packed.append(struct.pack("!H", self.actor_key))
7216 length = sum([len(x) for x in packed])
7217 packed[2] = struct.pack("!H", length)
7218 return ''.join(packed)
7219
7220 @staticmethod
7221 def unpack(reader):
7222 obj = bsn_set_lacp_request()
7223 _version = reader.read("!B")[0]
7224 assert(_version == 5)
7225 _type = reader.read("!B")[0]
7226 assert(_type == 4)
7227 _length = reader.read("!H")[0]
7228 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007229 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007230 obj.xid = reader.read("!L")[0]
7231 _experimenter = reader.read("!L")[0]
7232 assert(_experimenter == 6035143)
7233 _subtype = reader.read("!L")[0]
7234 assert(_subtype == 41)
7235 obj.enabled = reader.read("!B")[0]
7236 reader.skip(3)
7237 obj.port_no = util.unpack_port_no(reader)
7238 obj.actor_sys_priority = reader.read("!H")[0]
7239 obj.actor_sys_mac = list(reader.read('!6B'))
7240 obj.actor_port_priority = reader.read("!H")[0]
7241 obj.actor_port_num = reader.read("!H")[0]
7242 obj.actor_key = reader.read("!H")[0]
7243 return obj
7244
7245 def __eq__(self, other):
7246 if type(self) != type(other): return False
7247 if self.xid != other.xid: return False
7248 if self.enabled != other.enabled: return False
7249 if self.port_no != other.port_no: return False
7250 if self.actor_sys_priority != other.actor_sys_priority: return False
7251 if self.actor_sys_mac != other.actor_sys_mac: return False
7252 if self.actor_port_priority != other.actor_port_priority: return False
7253 if self.actor_port_num != other.actor_port_num: return False
7254 if self.actor_key != other.actor_key: return False
7255 return True
7256
7257 def pretty_print(self, q):
7258 q.text("bsn_set_lacp_request {")
7259 with q.group():
7260 with q.indent(2):
7261 q.breakable()
7262 q.text("xid = ");
7263 if self.xid != None:
7264 q.text("%#x" % self.xid)
7265 else:
7266 q.text('None')
7267 q.text(","); q.breakable()
7268 q.text("enabled = ");
7269 q.text("%#x" % self.enabled)
7270 q.text(","); q.breakable()
7271 q.text("port_no = ");
7272 q.text(util.pretty_port(self.port_no))
7273 q.text(","); q.breakable()
7274 q.text("actor_sys_priority = ");
7275 q.text("%#x" % self.actor_sys_priority)
7276 q.text(","); q.breakable()
7277 q.text("actor_sys_mac = ");
7278 q.text(util.pretty_mac(self.actor_sys_mac))
7279 q.text(","); q.breakable()
7280 q.text("actor_port_priority = ");
7281 q.text("%#x" % self.actor_port_priority)
7282 q.text(","); q.breakable()
7283 q.text("actor_port_num = ");
7284 q.text("%#x" % self.actor_port_num)
7285 q.text(","); q.breakable()
7286 q.text("actor_key = ");
7287 q.text("%#x" % self.actor_key)
7288 q.breakable()
7289 q.text('}')
7290
7291bsn_header.subtypes[41] = bsn_set_lacp_request
7292
Rich Lane2e079da2014-10-29 15:30:24 -07007293class bsn_set_mirroring(bsn_header):
7294 version = 5
7295 type = 4
7296 experimenter = 6035143
7297 subtype = 3
7298
7299 def __init__(self, xid=None, report_mirror_ports=None):
7300 if xid != None:
7301 self.xid = xid
7302 else:
7303 self.xid = None
7304 if report_mirror_ports != None:
7305 self.report_mirror_ports = report_mirror_ports
7306 else:
7307 self.report_mirror_ports = 0
7308 return
7309
7310 def pack(self):
7311 packed = []
7312 packed.append(struct.pack("!B", self.version))
7313 packed.append(struct.pack("!B", self.type))
7314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7315 packed.append(struct.pack("!L", self.xid))
7316 packed.append(struct.pack("!L", self.experimenter))
7317 packed.append(struct.pack("!L", self.subtype))
7318 packed.append(struct.pack("!B", self.report_mirror_ports))
7319 packed.append('\x00' * 3)
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):
7326 obj = bsn_set_mirroring()
7327 _version = reader.read("!B")[0]
7328 assert(_version == 5)
7329 _type = reader.read("!B")[0]
7330 assert(_type == 4)
7331 _length = reader.read("!H")[0]
7332 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007333 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007334 obj.xid = reader.read("!L")[0]
7335 _experimenter = reader.read("!L")[0]
7336 assert(_experimenter == 6035143)
7337 _subtype = reader.read("!L")[0]
7338 assert(_subtype == 3)
7339 obj.report_mirror_ports = reader.read("!B")[0]
7340 reader.skip(3)
7341 return obj
7342
7343 def __eq__(self, other):
7344 if type(self) != type(other): return False
7345 if self.xid != other.xid: return False
7346 if self.report_mirror_ports != other.report_mirror_ports: return False
7347 return True
7348
7349 def pretty_print(self, q):
7350 q.text("bsn_set_mirroring {")
7351 with q.group():
7352 with q.indent(2):
7353 q.breakable()
7354 q.text("xid = ");
7355 if self.xid != None:
7356 q.text("%#x" % self.xid)
7357 else:
7358 q.text('None')
7359 q.text(","); q.breakable()
7360 q.text("report_mirror_ports = ");
7361 q.text("%#x" % self.report_mirror_ports)
7362 q.breakable()
7363 q.text('}')
7364
7365bsn_header.subtypes[3] = bsn_set_mirroring
7366
7367class bsn_set_pktin_suppression_reply(bsn_header):
7368 version = 5
7369 type = 4
7370 experimenter = 6035143
7371 subtype = 25
7372
7373 def __init__(self, xid=None, status=None):
7374 if xid != None:
7375 self.xid = xid
7376 else:
7377 self.xid = None
7378 if status != None:
7379 self.status = status
7380 else:
7381 self.status = 0
7382 return
7383
7384 def pack(self):
7385 packed = []
7386 packed.append(struct.pack("!B", self.version))
7387 packed.append(struct.pack("!B", self.type))
7388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7389 packed.append(struct.pack("!L", self.xid))
7390 packed.append(struct.pack("!L", self.experimenter))
7391 packed.append(struct.pack("!L", self.subtype))
7392 packed.append(struct.pack("!L", self.status))
7393 length = sum([len(x) for x in packed])
7394 packed[2] = struct.pack("!H", length)
7395 return ''.join(packed)
7396
7397 @staticmethod
7398 def unpack(reader):
7399 obj = bsn_set_pktin_suppression_reply()
7400 _version = reader.read("!B")[0]
7401 assert(_version == 5)
7402 _type = reader.read("!B")[0]
7403 assert(_type == 4)
7404 _length = reader.read("!H")[0]
7405 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007406 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007407 obj.xid = reader.read("!L")[0]
7408 _experimenter = reader.read("!L")[0]
7409 assert(_experimenter == 6035143)
7410 _subtype = reader.read("!L")[0]
7411 assert(_subtype == 25)
7412 obj.status = reader.read("!L")[0]
7413 return obj
7414
7415 def __eq__(self, other):
7416 if type(self) != type(other): return False
7417 if self.xid != other.xid: return False
7418 if self.status != other.status: return False
7419 return True
7420
7421 def pretty_print(self, q):
7422 q.text("bsn_set_pktin_suppression_reply {")
7423 with q.group():
7424 with q.indent(2):
7425 q.breakable()
7426 q.text("xid = ");
7427 if self.xid != None:
7428 q.text("%#x" % self.xid)
7429 else:
7430 q.text('None')
7431 q.text(","); q.breakable()
7432 q.text("status = ");
7433 q.text("%#x" % self.status)
7434 q.breakable()
7435 q.text('}')
7436
7437bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7438
7439class bsn_set_pktin_suppression_request(bsn_header):
7440 version = 5
7441 type = 4
7442 experimenter = 6035143
7443 subtype = 11
7444
7445 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7446 if xid != None:
7447 self.xid = xid
7448 else:
7449 self.xid = None
7450 if enabled != None:
7451 self.enabled = enabled
7452 else:
7453 self.enabled = 0
7454 if idle_timeout != None:
7455 self.idle_timeout = idle_timeout
7456 else:
7457 self.idle_timeout = 0
7458 if hard_timeout != None:
7459 self.hard_timeout = hard_timeout
7460 else:
7461 self.hard_timeout = 0
7462 if priority != None:
7463 self.priority = priority
7464 else:
7465 self.priority = 0
7466 if cookie != None:
7467 self.cookie = cookie
7468 else:
7469 self.cookie = 0
7470 return
7471
7472 def pack(self):
7473 packed = []
7474 packed.append(struct.pack("!B", self.version))
7475 packed.append(struct.pack("!B", self.type))
7476 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7477 packed.append(struct.pack("!L", self.xid))
7478 packed.append(struct.pack("!L", self.experimenter))
7479 packed.append(struct.pack("!L", self.subtype))
7480 packed.append(struct.pack("!B", self.enabled))
7481 packed.append('\x00' * 1)
7482 packed.append(struct.pack("!H", self.idle_timeout))
7483 packed.append(struct.pack("!H", self.hard_timeout))
7484 packed.append(struct.pack("!H", self.priority))
7485 packed.append(struct.pack("!Q", self.cookie))
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_set_pktin_suppression_request()
7493 _version = reader.read("!B")[0]
7494 assert(_version == 5)
7495 _type = reader.read("!B")[0]
7496 assert(_type == 4)
7497 _length = reader.read("!H")[0]
7498 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007499 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007500 obj.xid = reader.read("!L")[0]
7501 _experimenter = reader.read("!L")[0]
7502 assert(_experimenter == 6035143)
7503 _subtype = reader.read("!L")[0]
7504 assert(_subtype == 11)
7505 obj.enabled = reader.read("!B")[0]
7506 reader.skip(1)
7507 obj.idle_timeout = reader.read("!H")[0]
7508 obj.hard_timeout = reader.read("!H")[0]
7509 obj.priority = reader.read("!H")[0]
7510 obj.cookie = reader.read("!Q")[0]
7511 return obj
7512
7513 def __eq__(self, other):
7514 if type(self) != type(other): return False
7515 if self.xid != other.xid: return False
7516 if self.enabled != other.enabled: return False
7517 if self.idle_timeout != other.idle_timeout: return False
7518 if self.hard_timeout != other.hard_timeout: return False
7519 if self.priority != other.priority: return False
7520 if self.cookie != other.cookie: return False
7521 return True
7522
7523 def pretty_print(self, q):
7524 q.text("bsn_set_pktin_suppression_request {")
7525 with q.group():
7526 with q.indent(2):
7527 q.breakable()
7528 q.text("xid = ");
7529 if self.xid != None:
7530 q.text("%#x" % self.xid)
7531 else:
7532 q.text('None')
7533 q.text(","); q.breakable()
7534 q.text("enabled = ");
7535 q.text("%#x" % self.enabled)
7536 q.text(","); q.breakable()
7537 q.text("idle_timeout = ");
7538 q.text("%#x" % self.idle_timeout)
7539 q.text(","); q.breakable()
7540 q.text("hard_timeout = ");
7541 q.text("%#x" % self.hard_timeout)
7542 q.text(","); q.breakable()
7543 q.text("priority = ");
7544 q.text("%#x" % self.priority)
7545 q.text(","); q.breakable()
7546 q.text("cookie = ");
7547 q.text("%#x" % self.cookie)
7548 q.breakable()
7549 q.text('}')
7550
7551bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7552
Rich Laneccd32ed2014-11-10 17:48:24 -08007553class bsn_set_switch_pipeline_reply(bsn_header):
Rich Lane2e079da2014-10-29 15:30:24 -07007554 version = 5
Rich Laneccd32ed2014-11-10 17:48:24 -08007555 type = 4
7556 experimenter = 6035143
7557 subtype = 54
Rich Lane2e079da2014-10-29 15:30:24 -07007558
Rich Laneccd32ed2014-11-10 17:48:24 -08007559 def __init__(self, xid=None, status=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007560 if xid != None:
7561 self.xid = xid
7562 else:
7563 self.xid = None
Rich Laneccd32ed2014-11-10 17:48:24 -08007564 if status != None:
7565 self.status = status
Rich Lane2e079da2014-10-29 15:30:24 -07007566 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007567 self.status = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007568 return
7569
7570 def pack(self):
7571 packed = []
7572 packed.append(struct.pack("!B", self.version))
7573 packed.append(struct.pack("!B", self.type))
7574 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7575 packed.append(struct.pack("!L", self.xid))
Rich Lane2e079da2014-10-29 15:30:24 -07007576 packed.append(struct.pack("!L", self.experimenter))
7577 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007578 packed.append(struct.pack("!L", self.status))
Rich Lane2e079da2014-10-29 15:30:24 -07007579 length = sum([len(x) for x in packed])
7580 packed[2] = struct.pack("!H", length)
7581 return ''.join(packed)
7582
7583 @staticmethod
7584 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007585 obj = bsn_set_switch_pipeline_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007586 _version = reader.read("!B")[0]
7587 assert(_version == 5)
7588 _type = reader.read("!B")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007589 assert(_type == 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007590 _length = reader.read("!H")[0]
7591 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007592 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007593 obj.xid = reader.read("!L")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007594 _experimenter = reader.read("!L")[0]
7595 assert(_experimenter == 6035143)
7596 _subtype = reader.read("!L")[0]
7597 assert(_subtype == 54)
7598 obj.status = reader.read("!L")[0]
Rich Lane2e079da2014-10-29 15:30:24 -07007599 return obj
7600
7601 def __eq__(self, other):
7602 if type(self) != type(other): return False
7603 if self.xid != other.xid: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007604 if self.status != other.status: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007605 return True
7606
7607 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007608 q.text("bsn_set_switch_pipeline_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007609 with q.group():
7610 with q.indent(2):
7611 q.breakable()
7612 q.text("xid = ");
7613 if self.xid != None:
7614 q.text("%#x" % self.xid)
7615 else:
7616 q.text('None')
7617 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007618 q.text("status = ");
7619 q.text("%#x" % self.status)
Rich Lane2e079da2014-10-29 15:30:24 -07007620 q.breakable()
7621 q.text('}')
7622
Rich Laneccd32ed2014-11-10 17:48:24 -08007623bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007624
Rich Laneccd32ed2014-11-10 17:48:24 -08007625class bsn_set_switch_pipeline_request(bsn_header):
7626 version = 5
7627 type = 4
7628 experimenter = 6035143
7629 subtype = 53
Rich Lane2e079da2014-10-29 15:30:24 -07007630
Rich Laneccd32ed2014-11-10 17:48:24 -08007631 def __init__(self, xid=None, pipeline=None):
7632 if xid != None:
7633 self.xid = xid
7634 else:
7635 self.xid = None
7636 if pipeline != None:
7637 self.pipeline = pipeline
7638 else:
7639 self.pipeline = ""
7640 return
7641
7642 def pack(self):
7643 packed = []
7644 packed.append(struct.pack("!B", self.version))
7645 packed.append(struct.pack("!B", self.type))
7646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7647 packed.append(struct.pack("!L", self.xid))
7648 packed.append(struct.pack("!L", self.experimenter))
7649 packed.append(struct.pack("!L", self.subtype))
7650 packed.append(struct.pack("!256s", self.pipeline))
7651 length = sum([len(x) for x in packed])
7652 packed[2] = struct.pack("!H", length)
7653 return ''.join(packed)
7654
7655 @staticmethod
7656 def unpack(reader):
7657 obj = bsn_set_switch_pipeline_request()
7658 _version = reader.read("!B")[0]
7659 assert(_version == 5)
7660 _type = reader.read("!B")[0]
7661 assert(_type == 4)
7662 _length = reader.read("!H")[0]
7663 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007664 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007665 obj.xid = reader.read("!L")[0]
7666 _experimenter = reader.read("!L")[0]
7667 assert(_experimenter == 6035143)
7668 _subtype = reader.read("!L")[0]
7669 assert(_subtype == 53)
7670 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7671 return obj
7672
7673 def __eq__(self, other):
7674 if type(self) != type(other): return False
7675 if self.xid != other.xid: return False
7676 if self.pipeline != other.pipeline: return False
7677 return True
7678
7679 def pretty_print(self, q):
7680 q.text("bsn_set_switch_pipeline_request {")
7681 with q.group():
7682 with q.indent(2):
7683 q.breakable()
7684 q.text("xid = ");
7685 if self.xid != None:
7686 q.text("%#x" % self.xid)
7687 else:
7688 q.text('None')
7689 q.text(","); q.breakable()
7690 q.text("pipeline = ");
7691 q.pp(self.pipeline)
7692 q.breakable()
7693 q.text('}')
7694
7695bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7696
7697class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
Rich Lane2e079da2014-10-29 15:30:24 -07007698 version = 5
7699 type = 19
7700 stats_type = 65535
7701 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007702 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007703
Rich Laneccd32ed2014-11-10 17:48:24 -08007704 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007705 if xid != None:
7706 self.xid = xid
7707 else:
7708 self.xid = None
7709 if flags != None:
7710 self.flags = flags
7711 else:
7712 self.flags = 0
Rich Laneccd32ed2014-11-10 17:48:24 -08007713 if entries != None:
7714 self.entries = entries
Rich Lane2e079da2014-10-29 15:30:24 -07007715 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007716 self.entries = []
Rich Lane2e079da2014-10-29 15:30:24 -07007717 return
7718
7719 def pack(self):
7720 packed = []
7721 packed.append(struct.pack("!B", self.version))
7722 packed.append(struct.pack("!B", self.type))
7723 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7724 packed.append(struct.pack("!L", self.xid))
7725 packed.append(struct.pack("!H", self.stats_type))
7726 packed.append(struct.pack("!H", self.flags))
7727 packed.append('\x00' * 4)
7728 packed.append(struct.pack("!L", self.experimenter))
7729 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007730 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane2e079da2014-10-29 15:30:24 -07007731 length = sum([len(x) for x in packed])
7732 packed[2] = struct.pack("!H", length)
7733 return ''.join(packed)
7734
7735 @staticmethod
7736 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007737 obj = bsn_switch_pipeline_stats_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007738 _version = reader.read("!B")[0]
7739 assert(_version == 5)
7740 _type = reader.read("!B")[0]
7741 assert(_type == 19)
7742 _length = reader.read("!H")[0]
7743 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007744 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007745 obj.xid = reader.read("!L")[0]
7746 _stats_type = reader.read("!H")[0]
7747 assert(_stats_type == 65535)
7748 obj.flags = reader.read("!H")[0]
7749 reader.skip(4)
7750 _experimenter = reader.read("!L")[0]
7751 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007752 _subtype = reader.read("!L")[0]
7753 assert(_subtype == 6)
7754 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07007755 return obj
7756
7757 def __eq__(self, other):
7758 if type(self) != type(other): return False
7759 if self.xid != other.xid: return False
7760 if self.flags != other.flags: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007761 if self.entries != other.entries: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007762 return True
7763
7764 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007765 q.text("bsn_switch_pipeline_stats_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007766 with q.group():
7767 with q.indent(2):
7768 q.breakable()
7769 q.text("xid = ");
7770 if self.xid != None:
7771 q.text("%#x" % self.xid)
7772 else:
7773 q.text('None')
7774 q.text(","); q.breakable()
7775 q.text("flags = ");
7776 q.text("%#x" % self.flags)
7777 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007778 q.text("entries = ");
7779 q.pp(self.entries)
Rich Lane2e079da2014-10-29 15:30:24 -07007780 q.breakable()
7781 q.text('}')
7782
Rich Laneccd32ed2014-11-10 17:48:24 -08007783bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007784
Rich Laneccd32ed2014-11-10 17:48:24 -08007785class bsn_switch_pipeline_stats_request(bsn_stats_request):
Rich Lane2e079da2014-10-29 15:30:24 -07007786 version = 5
7787 type = 18
7788 stats_type = 65535
7789 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007790 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007791
Rich Laneccd32ed2014-11-10 17:48:24 -08007792 def __init__(self, xid=None, flags=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007793 if xid != None:
7794 self.xid = xid
7795 else:
7796 self.xid = None
7797 if flags != None:
7798 self.flags = flags
7799 else:
7800 self.flags = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007801 return
7802
7803 def pack(self):
7804 packed = []
7805 packed.append(struct.pack("!B", self.version))
7806 packed.append(struct.pack("!B", self.type))
7807 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7808 packed.append(struct.pack("!L", self.xid))
7809 packed.append(struct.pack("!H", self.stats_type))
7810 packed.append(struct.pack("!H", self.flags))
7811 packed.append('\x00' * 4)
7812 packed.append(struct.pack("!L", self.experimenter))
7813 packed.append(struct.pack("!L", self.subtype))
7814 length = sum([len(x) for x in packed])
7815 packed[2] = struct.pack("!H", length)
7816 return ''.join(packed)
7817
7818 @staticmethod
7819 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007820 obj = bsn_switch_pipeline_stats_request()
Rich Lane2e079da2014-10-29 15:30:24 -07007821 _version = reader.read("!B")[0]
7822 assert(_version == 5)
7823 _type = reader.read("!B")[0]
7824 assert(_type == 18)
7825 _length = reader.read("!H")[0]
7826 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007827 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007828 obj.xid = reader.read("!L")[0]
7829 _stats_type = reader.read("!H")[0]
7830 assert(_stats_type == 65535)
7831 obj.flags = reader.read("!H")[0]
7832 reader.skip(4)
7833 _experimenter = reader.read("!L")[0]
7834 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007835 _subtype = reader.read("!L")[0]
7836 assert(_subtype == 6)
Rich Lane2e079da2014-10-29 15:30:24 -07007837 return obj
7838
7839 def __eq__(self, other):
7840 if type(self) != type(other): return False
7841 if self.xid != other.xid: return False
7842 if self.flags != other.flags: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007843 return True
7844
7845 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007846 q.text("bsn_switch_pipeline_stats_request {")
Rich Lane2e079da2014-10-29 15:30:24 -07007847 with q.group():
7848 with q.indent(2):
7849 q.breakable()
7850 q.text("xid = ");
7851 if self.xid != None:
7852 q.text("%#x" % self.xid)
7853 else:
7854 q.text('None')
7855 q.text(","); q.breakable()
7856 q.text("flags = ");
7857 q.text("%#x" % self.flags)
7858 q.breakable()
7859 q.text('}')
7860
Rich Laneccd32ed2014-11-10 17:48:24 -08007861bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7862
7863class bsn_table_checksum_stats_reply(bsn_stats_reply):
7864 version = 5
7865 type = 19
7866 stats_type = 65535
7867 experimenter = 6035143
7868 subtype = 11
7869
7870 def __init__(self, xid=None, flags=None, entries=None):
7871 if xid != None:
7872 self.xid = xid
7873 else:
7874 self.xid = None
7875 if flags != None:
7876 self.flags = flags
7877 else:
7878 self.flags = 0
7879 if entries != None:
7880 self.entries = entries
7881 else:
7882 self.entries = []
7883 return
7884
7885 def pack(self):
7886 packed = []
7887 packed.append(struct.pack("!B", self.version))
7888 packed.append(struct.pack("!B", self.type))
7889 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7890 packed.append(struct.pack("!L", self.xid))
7891 packed.append(struct.pack("!H", self.stats_type))
7892 packed.append(struct.pack("!H", self.flags))
7893 packed.append('\x00' * 4)
7894 packed.append(struct.pack("!L", self.experimenter))
7895 packed.append(struct.pack("!L", self.subtype))
7896 packed.append(loxi.generic_util.pack_list(self.entries))
7897 length = sum([len(x) for x in packed])
7898 packed[2] = struct.pack("!H", length)
7899 return ''.join(packed)
7900
7901 @staticmethod
7902 def unpack(reader):
7903 obj = bsn_table_checksum_stats_reply()
7904 _version = reader.read("!B")[0]
7905 assert(_version == 5)
7906 _type = reader.read("!B")[0]
7907 assert(_type == 19)
7908 _length = reader.read("!H")[0]
7909 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007910 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007911 obj.xid = reader.read("!L")[0]
7912 _stats_type = reader.read("!H")[0]
7913 assert(_stats_type == 65535)
7914 obj.flags = reader.read("!H")[0]
7915 reader.skip(4)
7916 _experimenter = reader.read("!L")[0]
7917 assert(_experimenter == 6035143)
7918 _subtype = reader.read("!L")[0]
7919 assert(_subtype == 11)
7920 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
7921 return obj
7922
7923 def __eq__(self, other):
7924 if type(self) != type(other): return False
7925 if self.xid != other.xid: return False
7926 if self.flags != other.flags: return False
7927 if self.entries != other.entries: return False
7928 return True
7929
7930 def pretty_print(self, q):
7931 q.text("bsn_table_checksum_stats_reply {")
7932 with q.group():
7933 with q.indent(2):
7934 q.breakable()
7935 q.text("xid = ");
7936 if self.xid != None:
7937 q.text("%#x" % self.xid)
7938 else:
7939 q.text('None')
7940 q.text(","); q.breakable()
7941 q.text("flags = ");
7942 q.text("%#x" % self.flags)
7943 q.text(","); q.breakable()
7944 q.text("entries = ");
7945 q.pp(self.entries)
7946 q.breakable()
7947 q.text('}')
7948
7949bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7950
7951class bsn_table_checksum_stats_request(bsn_stats_request):
7952 version = 5
7953 type = 18
7954 stats_type = 65535
7955 experimenter = 6035143
7956 subtype = 11
7957
7958 def __init__(self, xid=None, flags=None):
7959 if xid != None:
7960 self.xid = xid
7961 else:
7962 self.xid = None
7963 if flags != None:
7964 self.flags = flags
7965 else:
7966 self.flags = 0
7967 return
7968
7969 def pack(self):
7970 packed = []
7971 packed.append(struct.pack("!B", self.version))
7972 packed.append(struct.pack("!B", self.type))
7973 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7974 packed.append(struct.pack("!L", self.xid))
7975 packed.append(struct.pack("!H", self.stats_type))
7976 packed.append(struct.pack("!H", self.flags))
7977 packed.append('\x00' * 4)
7978 packed.append(struct.pack("!L", self.experimenter))
7979 packed.append(struct.pack("!L", self.subtype))
7980 length = sum([len(x) for x in packed])
7981 packed[2] = struct.pack("!H", length)
7982 return ''.join(packed)
7983
7984 @staticmethod
7985 def unpack(reader):
7986 obj = bsn_table_checksum_stats_request()
7987 _version = reader.read("!B")[0]
7988 assert(_version == 5)
7989 _type = reader.read("!B")[0]
7990 assert(_type == 18)
7991 _length = reader.read("!H")[0]
7992 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007993 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007994 obj.xid = reader.read("!L")[0]
7995 _stats_type = reader.read("!H")[0]
7996 assert(_stats_type == 65535)
7997 obj.flags = reader.read("!H")[0]
7998 reader.skip(4)
7999 _experimenter = reader.read("!L")[0]
8000 assert(_experimenter == 6035143)
8001 _subtype = reader.read("!L")[0]
8002 assert(_subtype == 11)
8003 return obj
8004
8005 def __eq__(self, other):
8006 if type(self) != type(other): return False
8007 if self.xid != other.xid: return False
8008 if self.flags != other.flags: return False
8009 return True
8010
8011 def pretty_print(self, q):
8012 q.text("bsn_table_checksum_stats_request {")
8013 with q.group():
8014 with q.indent(2):
8015 q.breakable()
8016 q.text("xid = ");
8017 if self.xid != None:
8018 q.text("%#x" % self.xid)
8019 else:
8020 q.text('None')
8021 q.text(","); q.breakable()
8022 q.text("flags = ");
8023 q.text("%#x" % self.flags)
8024 q.breakable()
8025 q.text('}')
8026
8027bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8028
8029class bsn_table_set_buckets_size(bsn_header):
8030 version = 5
8031 type = 4
8032 experimenter = 6035143
8033 subtype = 61
8034
8035 def __init__(self, xid=None, table_id=None, buckets_size=None):
8036 if xid != None:
8037 self.xid = xid
8038 else:
8039 self.xid = None
8040 if table_id != None:
8041 self.table_id = table_id
8042 else:
8043 self.table_id = 0
8044 if buckets_size != None:
8045 self.buckets_size = buckets_size
8046 else:
8047 self.buckets_size = 0
8048 return
8049
8050 def pack(self):
8051 packed = []
8052 packed.append(struct.pack("!B", self.version))
8053 packed.append(struct.pack("!B", self.type))
8054 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8055 packed.append(struct.pack("!L", self.xid))
8056 packed.append(struct.pack("!L", self.experimenter))
8057 packed.append(struct.pack("!L", self.subtype))
8058 packed.append('\x00' * 1)
8059 packed.append(struct.pack("!B", self.table_id))
8060 packed.append('\x00' * 2)
8061 packed.append(struct.pack("!L", self.buckets_size))
8062 length = sum([len(x) for x in packed])
8063 packed[2] = struct.pack("!H", length)
8064 return ''.join(packed)
8065
8066 @staticmethod
8067 def unpack(reader):
8068 obj = bsn_table_set_buckets_size()
8069 _version = reader.read("!B")[0]
8070 assert(_version == 5)
8071 _type = reader.read("!B")[0]
8072 assert(_type == 4)
8073 _length = reader.read("!H")[0]
8074 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008075 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008076 obj.xid = reader.read("!L")[0]
8077 _experimenter = reader.read("!L")[0]
8078 assert(_experimenter == 6035143)
8079 _subtype = reader.read("!L")[0]
8080 assert(_subtype == 61)
8081 reader.skip(1)
8082 obj.table_id = reader.read("!B")[0]
8083 reader.skip(2)
8084 obj.buckets_size = reader.read("!L")[0]
8085 return obj
8086
8087 def __eq__(self, other):
8088 if type(self) != type(other): return False
8089 if self.xid != other.xid: return False
8090 if self.table_id != other.table_id: return False
8091 if self.buckets_size != other.buckets_size: return False
8092 return True
8093
8094 def pretty_print(self, q):
8095 q.text("bsn_table_set_buckets_size {")
8096 with q.group():
8097 with q.indent(2):
8098 q.breakable()
8099 q.text("xid = ");
8100 if self.xid != None:
8101 q.text("%#x" % self.xid)
8102 else:
8103 q.text('None')
8104 q.text(","); q.breakable()
8105 q.text("table_id = ");
8106 q.text("%#x" % self.table_id)
8107 q.text(","); q.breakable()
8108 q.text("buckets_size = ");
8109 q.text("%#x" % self.buckets_size)
8110 q.breakable()
8111 q.text('}')
8112
8113bsn_header.subtypes[61] = bsn_table_set_buckets_size
8114
8115class bsn_time_reply(bsn_header):
8116 version = 5
8117 type = 4
8118 experimenter = 6035143
8119 subtype = 45
8120
8121 def __init__(self, xid=None, time_ms=None):
8122 if xid != None:
8123 self.xid = xid
8124 else:
8125 self.xid = None
8126 if time_ms != None:
8127 self.time_ms = time_ms
8128 else:
8129 self.time_ms = 0
8130 return
8131
8132 def pack(self):
8133 packed = []
8134 packed.append(struct.pack("!B", self.version))
8135 packed.append(struct.pack("!B", self.type))
8136 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8137 packed.append(struct.pack("!L", self.xid))
8138 packed.append(struct.pack("!L", self.experimenter))
8139 packed.append(struct.pack("!L", self.subtype))
8140 packed.append(struct.pack("!Q", self.time_ms))
8141 length = sum([len(x) for x in packed])
8142 packed[2] = struct.pack("!H", length)
8143 return ''.join(packed)
8144
8145 @staticmethod
8146 def unpack(reader):
8147 obj = bsn_time_reply()
8148 _version = reader.read("!B")[0]
8149 assert(_version == 5)
8150 _type = reader.read("!B")[0]
8151 assert(_type == 4)
8152 _length = reader.read("!H")[0]
8153 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008154 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008155 obj.xid = reader.read("!L")[0]
8156 _experimenter = reader.read("!L")[0]
8157 assert(_experimenter == 6035143)
8158 _subtype = reader.read("!L")[0]
8159 assert(_subtype == 45)
8160 obj.time_ms = reader.read("!Q")[0]
8161 return obj
8162
8163 def __eq__(self, other):
8164 if type(self) != type(other): return False
8165 if self.xid != other.xid: return False
8166 if self.time_ms != other.time_ms: return False
8167 return True
8168
8169 def pretty_print(self, q):
8170 q.text("bsn_time_reply {")
8171 with q.group():
8172 with q.indent(2):
8173 q.breakable()
8174 q.text("xid = ");
8175 if self.xid != None:
8176 q.text("%#x" % self.xid)
8177 else:
8178 q.text('None')
8179 q.text(","); q.breakable()
8180 q.text("time_ms = ");
8181 q.text("%#x" % self.time_ms)
8182 q.breakable()
8183 q.text('}')
8184
8185bsn_header.subtypes[45] = bsn_time_reply
8186
8187class bsn_time_request(bsn_header):
8188 version = 5
8189 type = 4
8190 experimenter = 6035143
8191 subtype = 44
8192
8193 def __init__(self, xid=None):
8194 if xid != None:
8195 self.xid = xid
8196 else:
8197 self.xid = None
8198 return
8199
8200 def pack(self):
8201 packed = []
8202 packed.append(struct.pack("!B", self.version))
8203 packed.append(struct.pack("!B", self.type))
8204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8205 packed.append(struct.pack("!L", self.xid))
8206 packed.append(struct.pack("!L", self.experimenter))
8207 packed.append(struct.pack("!L", self.subtype))
8208 length = sum([len(x) for x in packed])
8209 packed[2] = struct.pack("!H", length)
8210 return ''.join(packed)
8211
8212 @staticmethod
8213 def unpack(reader):
8214 obj = bsn_time_request()
8215 _version = reader.read("!B")[0]
8216 assert(_version == 5)
8217 _type = reader.read("!B")[0]
8218 assert(_type == 4)
8219 _length = reader.read("!H")[0]
8220 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008221 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008222 obj.xid = reader.read("!L")[0]
8223 _experimenter = reader.read("!L")[0]
8224 assert(_experimenter == 6035143)
8225 _subtype = reader.read("!L")[0]
8226 assert(_subtype == 44)
8227 return obj
8228
8229 def __eq__(self, other):
8230 if type(self) != type(other): return False
8231 if self.xid != other.xid: return False
8232 return True
8233
8234 def pretty_print(self, q):
8235 q.text("bsn_time_request {")
8236 with q.group():
8237 with q.indent(2):
8238 q.breakable()
8239 q.text("xid = ");
8240 if self.xid != None:
8241 q.text("%#x" % self.xid)
8242 else:
8243 q.text('None')
8244 q.breakable()
8245 q.text('}')
8246
8247bsn_header.subtypes[44] = bsn_time_request
Rich Lane2e079da2014-10-29 15:30:24 -07008248
8249class bsn_virtual_port_create_reply(bsn_header):
8250 version = 5
8251 type = 4
8252 experimenter = 6035143
8253 subtype = 16
8254
8255 def __init__(self, xid=None, status=None, vport_no=None):
8256 if xid != None:
8257 self.xid = xid
8258 else:
8259 self.xid = None
8260 if status != None:
8261 self.status = status
8262 else:
8263 self.status = 0
8264 if vport_no != None:
8265 self.vport_no = vport_no
8266 else:
8267 self.vport_no = 0
8268 return
8269
8270 def pack(self):
8271 packed = []
8272 packed.append(struct.pack("!B", self.version))
8273 packed.append(struct.pack("!B", self.type))
8274 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8275 packed.append(struct.pack("!L", self.xid))
8276 packed.append(struct.pack("!L", self.experimenter))
8277 packed.append(struct.pack("!L", self.subtype))
8278 packed.append(struct.pack("!L", self.status))
8279 packed.append(struct.pack("!L", self.vport_no))
8280 length = sum([len(x) for x in packed])
8281 packed[2] = struct.pack("!H", length)
8282 return ''.join(packed)
8283
8284 @staticmethod
8285 def unpack(reader):
8286 obj = bsn_virtual_port_create_reply()
8287 _version = reader.read("!B")[0]
8288 assert(_version == 5)
8289 _type = reader.read("!B")[0]
8290 assert(_type == 4)
8291 _length = reader.read("!H")[0]
8292 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008293 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008294 obj.xid = reader.read("!L")[0]
8295 _experimenter = reader.read("!L")[0]
8296 assert(_experimenter == 6035143)
8297 _subtype = reader.read("!L")[0]
8298 assert(_subtype == 16)
8299 obj.status = reader.read("!L")[0]
8300 obj.vport_no = reader.read("!L")[0]
8301 return obj
8302
8303 def __eq__(self, other):
8304 if type(self) != type(other): return False
8305 if self.xid != other.xid: return False
8306 if self.status != other.status: return False
8307 if self.vport_no != other.vport_no: return False
8308 return True
8309
8310 def pretty_print(self, q):
8311 q.text("bsn_virtual_port_create_reply {")
8312 with q.group():
8313 with q.indent(2):
8314 q.breakable()
8315 q.text("xid = ");
8316 if self.xid != None:
8317 q.text("%#x" % self.xid)
8318 else:
8319 q.text('None')
8320 q.text(","); q.breakable()
8321 q.text("status = ");
8322 q.text("%#x" % self.status)
8323 q.text(","); q.breakable()
8324 q.text("vport_no = ");
8325 q.text("%#x" % self.vport_no)
8326 q.breakable()
8327 q.text('}')
8328
8329bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8330
8331class bsn_virtual_port_create_request(bsn_header):
8332 version = 5
8333 type = 4
8334 experimenter = 6035143
8335 subtype = 15
8336
8337 def __init__(self, xid=None, vport=None):
8338 if xid != None:
8339 self.xid = xid
8340 else:
8341 self.xid = None
8342 if vport != None:
8343 self.vport = vport
8344 else:
8345 self.vport = common.bsn_vport()
8346 return
8347
8348 def pack(self):
8349 packed = []
8350 packed.append(struct.pack("!B", self.version))
8351 packed.append(struct.pack("!B", self.type))
8352 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8353 packed.append(struct.pack("!L", self.xid))
8354 packed.append(struct.pack("!L", self.experimenter))
8355 packed.append(struct.pack("!L", self.subtype))
8356 packed.append(self.vport.pack())
8357 length = sum([len(x) for x in packed])
8358 packed[2] = struct.pack("!H", length)
8359 return ''.join(packed)
8360
8361 @staticmethod
8362 def unpack(reader):
8363 obj = bsn_virtual_port_create_request()
8364 _version = reader.read("!B")[0]
8365 assert(_version == 5)
8366 _type = reader.read("!B")[0]
8367 assert(_type == 4)
8368 _length = reader.read("!H")[0]
8369 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008370 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008371 obj.xid = reader.read("!L")[0]
8372 _experimenter = reader.read("!L")[0]
8373 assert(_experimenter == 6035143)
8374 _subtype = reader.read("!L")[0]
8375 assert(_subtype == 15)
8376 obj.vport = common.bsn_vport.unpack(reader)
8377 return obj
8378
8379 def __eq__(self, other):
8380 if type(self) != type(other): return False
8381 if self.xid != other.xid: return False
8382 if self.vport != other.vport: return False
8383 return True
8384
8385 def pretty_print(self, q):
8386 q.text("bsn_virtual_port_create_request {")
8387 with q.group():
8388 with q.indent(2):
8389 q.breakable()
8390 q.text("xid = ");
8391 if self.xid != None:
8392 q.text("%#x" % self.xid)
8393 else:
8394 q.text('None')
8395 q.text(","); q.breakable()
8396 q.text("vport = ");
8397 q.pp(self.vport)
8398 q.breakable()
8399 q.text('}')
8400
8401bsn_header.subtypes[15] = bsn_virtual_port_create_request
8402
8403class bsn_virtual_port_remove_reply(bsn_header):
8404 version = 5
8405 type = 4
8406 experimenter = 6035143
8407 subtype = 26
8408
8409 def __init__(self, xid=None, status=None):
8410 if xid != None:
8411 self.xid = xid
8412 else:
8413 self.xid = None
8414 if status != None:
8415 self.status = status
8416 else:
8417 self.status = 0
8418 return
8419
8420 def pack(self):
8421 packed = []
8422 packed.append(struct.pack("!B", self.version))
8423 packed.append(struct.pack("!B", self.type))
8424 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8425 packed.append(struct.pack("!L", self.xid))
8426 packed.append(struct.pack("!L", self.experimenter))
8427 packed.append(struct.pack("!L", self.subtype))
8428 packed.append(struct.pack("!L", self.status))
8429 length = sum([len(x) for x in packed])
8430 packed[2] = struct.pack("!H", length)
8431 return ''.join(packed)
8432
8433 @staticmethod
8434 def unpack(reader):
8435 obj = bsn_virtual_port_remove_reply()
8436 _version = reader.read("!B")[0]
8437 assert(_version == 5)
8438 _type = reader.read("!B")[0]
8439 assert(_type == 4)
8440 _length = reader.read("!H")[0]
8441 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008442 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008443 obj.xid = reader.read("!L")[0]
8444 _experimenter = reader.read("!L")[0]
8445 assert(_experimenter == 6035143)
8446 _subtype = reader.read("!L")[0]
8447 assert(_subtype == 26)
8448 obj.status = reader.read("!L")[0]
8449 return obj
8450
8451 def __eq__(self, other):
8452 if type(self) != type(other): return False
8453 if self.xid != other.xid: return False
8454 if self.status != other.status: return False
8455 return True
8456
8457 def pretty_print(self, q):
8458 q.text("bsn_virtual_port_remove_reply {")
8459 with q.group():
8460 with q.indent(2):
8461 q.breakable()
8462 q.text("xid = ");
8463 if self.xid != None:
8464 q.text("%#x" % self.xid)
8465 else:
8466 q.text('None')
8467 q.text(","); q.breakable()
8468 q.text("status = ");
8469 q.text("%#x" % self.status)
8470 q.breakable()
8471 q.text('}')
8472
8473bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8474
8475class bsn_virtual_port_remove_request(bsn_header):
8476 version = 5
8477 type = 4
8478 experimenter = 6035143
8479 subtype = 17
8480
8481 def __init__(self, xid=None, vport_no=None):
8482 if xid != None:
8483 self.xid = xid
8484 else:
8485 self.xid = None
8486 if vport_no != None:
8487 self.vport_no = vport_no
8488 else:
8489 self.vport_no = 0
8490 return
8491
8492 def pack(self):
8493 packed = []
8494 packed.append(struct.pack("!B", self.version))
8495 packed.append(struct.pack("!B", self.type))
8496 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8497 packed.append(struct.pack("!L", self.xid))
8498 packed.append(struct.pack("!L", self.experimenter))
8499 packed.append(struct.pack("!L", self.subtype))
8500 packed.append(struct.pack("!L", self.vport_no))
8501 length = sum([len(x) for x in packed])
8502 packed[2] = struct.pack("!H", length)
8503 return ''.join(packed)
8504
8505 @staticmethod
8506 def unpack(reader):
8507 obj = bsn_virtual_port_remove_request()
8508 _version = reader.read("!B")[0]
8509 assert(_version == 5)
8510 _type = reader.read("!B")[0]
8511 assert(_type == 4)
8512 _length = reader.read("!H")[0]
8513 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008514 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008515 obj.xid = reader.read("!L")[0]
8516 _experimenter = reader.read("!L")[0]
8517 assert(_experimenter == 6035143)
8518 _subtype = reader.read("!L")[0]
8519 assert(_subtype == 17)
8520 obj.vport_no = reader.read("!L")[0]
8521 return obj
8522
8523 def __eq__(self, other):
8524 if type(self) != type(other): return False
8525 if self.xid != other.xid: return False
8526 if self.vport_no != other.vport_no: return False
8527 return True
8528
8529 def pretty_print(self, q):
8530 q.text("bsn_virtual_port_remove_request {")
8531 with q.group():
8532 with q.indent(2):
8533 q.breakable()
8534 q.text("xid = ");
8535 if self.xid != None:
8536 q.text("%#x" % self.xid)
8537 else:
8538 q.text('None')
8539 q.text(","); q.breakable()
8540 q.text("vport_no = ");
8541 q.text("%#x" % self.vport_no)
8542 q.breakable()
8543 q.text('}')
8544
8545bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8546
Rich Laneccd32ed2014-11-10 17:48:24 -08008547class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8548 version = 5
8549 type = 19
8550 stats_type = 65535
8551 experimenter = 6035143
8552 subtype = 9
8553
8554 def __init__(self, xid=None, flags=None, entries=None):
8555 if xid != None:
8556 self.xid = xid
8557 else:
8558 self.xid = None
8559 if flags != None:
8560 self.flags = flags
8561 else:
8562 self.flags = 0
8563 if entries != None:
8564 self.entries = entries
8565 else:
8566 self.entries = []
8567 return
8568
8569 def pack(self):
8570 packed = []
8571 packed.append(struct.pack("!B", self.version))
8572 packed.append(struct.pack("!B", self.type))
8573 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8574 packed.append(struct.pack("!L", self.xid))
8575 packed.append(struct.pack("!H", self.stats_type))
8576 packed.append(struct.pack("!H", self.flags))
8577 packed.append('\x00' * 4)
8578 packed.append(struct.pack("!L", self.experimenter))
8579 packed.append(struct.pack("!L", self.subtype))
8580 packed.append(loxi.generic_util.pack_list(self.entries))
8581 length = sum([len(x) for x in packed])
8582 packed[2] = struct.pack("!H", length)
8583 return ''.join(packed)
8584
8585 @staticmethod
8586 def unpack(reader):
8587 obj = bsn_vlan_counter_stats_reply()
8588 _version = reader.read("!B")[0]
8589 assert(_version == 5)
8590 _type = reader.read("!B")[0]
8591 assert(_type == 19)
8592 _length = reader.read("!H")[0]
8593 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008594 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008595 obj.xid = reader.read("!L")[0]
8596 _stats_type = reader.read("!H")[0]
8597 assert(_stats_type == 65535)
8598 obj.flags = reader.read("!H")[0]
8599 reader.skip(4)
8600 _experimenter = reader.read("!L")[0]
8601 assert(_experimenter == 6035143)
8602 _subtype = reader.read("!L")[0]
8603 assert(_subtype == 9)
8604 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8605 return obj
8606
8607 def __eq__(self, other):
8608 if type(self) != type(other): return False
8609 if self.xid != other.xid: return False
8610 if self.flags != other.flags: return False
8611 if self.entries != other.entries: return False
8612 return True
8613
8614 def pretty_print(self, q):
8615 q.text("bsn_vlan_counter_stats_reply {")
8616 with q.group():
8617 with q.indent(2):
8618 q.breakable()
8619 q.text("xid = ");
8620 if self.xid != None:
8621 q.text("%#x" % self.xid)
8622 else:
8623 q.text('None')
8624 q.text(","); q.breakable()
8625 q.text("flags = ");
8626 q.text("%#x" % self.flags)
8627 q.text(","); q.breakable()
8628 q.text("entries = ");
8629 q.pp(self.entries)
8630 q.breakable()
8631 q.text('}')
8632
8633bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8634
8635class bsn_vlan_counter_stats_request(bsn_stats_request):
8636 version = 5
8637 type = 18
8638 stats_type = 65535
8639 experimenter = 6035143
8640 subtype = 9
8641
8642 def __init__(self, xid=None, flags=None, vlan_vid=None):
8643 if xid != None:
8644 self.xid = xid
8645 else:
8646 self.xid = None
8647 if flags != None:
8648 self.flags = flags
8649 else:
8650 self.flags = 0
8651 if vlan_vid != None:
8652 self.vlan_vid = vlan_vid
8653 else:
8654 self.vlan_vid = 0
8655 return
8656
8657 def pack(self):
8658 packed = []
8659 packed.append(struct.pack("!B", self.version))
8660 packed.append(struct.pack("!B", self.type))
8661 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8662 packed.append(struct.pack("!L", self.xid))
8663 packed.append(struct.pack("!H", self.stats_type))
8664 packed.append(struct.pack("!H", self.flags))
8665 packed.append('\x00' * 4)
8666 packed.append(struct.pack("!L", self.experimenter))
8667 packed.append(struct.pack("!L", self.subtype))
8668 packed.append(struct.pack("!H", self.vlan_vid))
8669 length = sum([len(x) for x in packed])
8670 packed[2] = struct.pack("!H", length)
8671 return ''.join(packed)
8672
8673 @staticmethod
8674 def unpack(reader):
8675 obj = bsn_vlan_counter_stats_request()
8676 _version = reader.read("!B")[0]
8677 assert(_version == 5)
8678 _type = reader.read("!B")[0]
8679 assert(_type == 18)
8680 _length = reader.read("!H")[0]
8681 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008682 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008683 obj.xid = reader.read("!L")[0]
8684 _stats_type = reader.read("!H")[0]
8685 assert(_stats_type == 65535)
8686 obj.flags = reader.read("!H")[0]
8687 reader.skip(4)
8688 _experimenter = reader.read("!L")[0]
8689 assert(_experimenter == 6035143)
8690 _subtype = reader.read("!L")[0]
8691 assert(_subtype == 9)
8692 obj.vlan_vid = reader.read("!H")[0]
8693 return obj
8694
8695 def __eq__(self, other):
8696 if type(self) != type(other): return False
8697 if self.xid != other.xid: return False
8698 if self.flags != other.flags: return False
8699 if self.vlan_vid != other.vlan_vid: return False
8700 return True
8701
8702 def pretty_print(self, q):
8703 q.text("bsn_vlan_counter_stats_request {")
8704 with q.group():
8705 with q.indent(2):
8706 q.breakable()
8707 q.text("xid = ");
8708 if self.xid != None:
8709 q.text("%#x" % self.xid)
8710 else:
8711 q.text('None')
8712 q.text(","); q.breakable()
8713 q.text("flags = ");
8714 q.text("%#x" % self.flags)
8715 q.text(","); q.breakable()
8716 q.text("vlan_vid = ");
8717 q.text("%#x" % self.vlan_vid)
8718 q.breakable()
8719 q.text('}')
8720
8721bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8722
8723class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8724 version = 5
8725 type = 19
8726 stats_type = 65535
8727 experimenter = 6035143
8728 subtype = 15
8729
8730 def __init__(self, xid=None, flags=None, entries=None):
8731 if xid != None:
8732 self.xid = xid
8733 else:
8734 self.xid = None
8735 if flags != None:
8736 self.flags = flags
8737 else:
8738 self.flags = 0
8739 if entries != None:
8740 self.entries = entries
8741 else:
8742 self.entries = []
8743 return
8744
8745 def pack(self):
8746 packed = []
8747 packed.append(struct.pack("!B", self.version))
8748 packed.append(struct.pack("!B", self.type))
8749 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8750 packed.append(struct.pack("!L", self.xid))
8751 packed.append(struct.pack("!H", self.stats_type))
8752 packed.append(struct.pack("!H", self.flags))
8753 packed.append('\x00' * 4)
8754 packed.append(struct.pack("!L", self.experimenter))
8755 packed.append(struct.pack("!L", self.subtype))
8756 packed.append(loxi.generic_util.pack_list(self.entries))
8757 length = sum([len(x) for x in packed])
8758 packed[2] = struct.pack("!H", length)
8759 return ''.join(packed)
8760
8761 @staticmethod
8762 def unpack(reader):
8763 obj = bsn_vrf_counter_stats_reply()
8764 _version = reader.read("!B")[0]
8765 assert(_version == 5)
8766 _type = reader.read("!B")[0]
8767 assert(_type == 19)
8768 _length = reader.read("!H")[0]
8769 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008770 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008771 obj.xid = reader.read("!L")[0]
8772 _stats_type = reader.read("!H")[0]
8773 assert(_stats_type == 65535)
8774 obj.flags = reader.read("!H")[0]
8775 reader.skip(4)
8776 _experimenter = reader.read("!L")[0]
8777 assert(_experimenter == 6035143)
8778 _subtype = reader.read("!L")[0]
8779 assert(_subtype == 15)
8780 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8781 return obj
8782
8783 def __eq__(self, other):
8784 if type(self) != type(other): return False
8785 if self.xid != other.xid: return False
8786 if self.flags != other.flags: return False
8787 if self.entries != other.entries: return False
8788 return True
8789
8790 def pretty_print(self, q):
8791 q.text("bsn_vrf_counter_stats_reply {")
8792 with q.group():
8793 with q.indent(2):
8794 q.breakable()
8795 q.text("xid = ");
8796 if self.xid != None:
8797 q.text("%#x" % self.xid)
8798 else:
8799 q.text('None')
8800 q.text(","); q.breakable()
8801 q.text("flags = ");
8802 q.text("%#x" % self.flags)
8803 q.text(","); q.breakable()
8804 q.text("entries = ");
8805 q.pp(self.entries)
8806 q.breakable()
8807 q.text('}')
8808
8809bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8810
8811class bsn_vrf_counter_stats_request(bsn_stats_request):
8812 version = 5
8813 type = 18
8814 stats_type = 65535
8815 experimenter = 6035143
8816 subtype = 15
8817
8818 def __init__(self, xid=None, flags=None, vrf=None):
8819 if xid != None:
8820 self.xid = xid
8821 else:
8822 self.xid = None
8823 if flags != None:
8824 self.flags = flags
8825 else:
8826 self.flags = 0
8827 if vrf != None:
8828 self.vrf = vrf
8829 else:
8830 self.vrf = 0
8831 return
8832
8833 def pack(self):
8834 packed = []
8835 packed.append(struct.pack("!B", self.version))
8836 packed.append(struct.pack("!B", self.type))
8837 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8838 packed.append(struct.pack("!L", self.xid))
8839 packed.append(struct.pack("!H", self.stats_type))
8840 packed.append(struct.pack("!H", self.flags))
8841 packed.append('\x00' * 4)
8842 packed.append(struct.pack("!L", self.experimenter))
8843 packed.append(struct.pack("!L", self.subtype))
8844 packed.append(struct.pack("!L", self.vrf))
8845 length = sum([len(x) for x in packed])
8846 packed[2] = struct.pack("!H", length)
8847 return ''.join(packed)
8848
8849 @staticmethod
8850 def unpack(reader):
8851 obj = bsn_vrf_counter_stats_request()
8852 _version = reader.read("!B")[0]
8853 assert(_version == 5)
8854 _type = reader.read("!B")[0]
8855 assert(_type == 18)
8856 _length = reader.read("!H")[0]
8857 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008858 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008859 obj.xid = reader.read("!L")[0]
8860 _stats_type = reader.read("!H")[0]
8861 assert(_stats_type == 65535)
8862 obj.flags = reader.read("!H")[0]
8863 reader.skip(4)
8864 _experimenter = reader.read("!L")[0]
8865 assert(_experimenter == 6035143)
8866 _subtype = reader.read("!L")[0]
8867 assert(_subtype == 15)
8868 obj.vrf = reader.read("!L")[0]
8869 return obj
8870
8871 def __eq__(self, other):
8872 if type(self) != type(other): return False
8873 if self.xid != other.xid: return False
8874 if self.flags != other.flags: return False
8875 if self.vrf != other.vrf: return False
8876 return True
8877
8878 def pretty_print(self, q):
8879 q.text("bsn_vrf_counter_stats_request {")
8880 with q.group():
8881 with q.indent(2):
8882 q.breakable()
8883 q.text("xid = ");
8884 if self.xid != None:
8885 q.text("%#x" % self.xid)
8886 else:
8887 q.text('None')
8888 q.text(","); q.breakable()
8889 q.text("flags = ");
8890 q.text("%#x" % self.flags)
8891 q.text(","); q.breakable()
8892 q.text("vrf = ");
8893 q.text("%#x" % self.vrf)
8894 q.breakable()
8895 q.text('}')
8896
8897bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8898
Rich Lane2e079da2014-10-29 15:30:24 -07008899class bundle_add_msg(message):
8900 version = 5
8901 type = 34
8902
8903 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
8904 if xid != None:
8905 self.xid = xid
8906 else:
8907 self.xid = None
8908 if bundle_id != None:
8909 self.bundle_id = bundle_id
8910 else:
8911 self.bundle_id = 0
8912 if flags != None:
8913 self.flags = flags
8914 else:
8915 self.flags = 0
8916 if data != None:
8917 self.data = data
8918 else:
8919 self.data = ''
8920 return
8921
8922 def pack(self):
8923 packed = []
8924 packed.append(struct.pack("!B", self.version))
8925 packed.append(struct.pack("!B", self.type))
8926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8927 packed.append(struct.pack("!L", self.xid))
8928 packed.append(struct.pack("!L", self.bundle_id))
8929 packed.append('\x00' * 2)
8930 packed.append(struct.pack("!H", self.flags))
8931 packed.append(self.data)
8932 length = sum([len(x) for x in packed])
8933 packed[2] = struct.pack("!H", length)
8934 return ''.join(packed)
8935
8936 @staticmethod
8937 def unpack(reader):
8938 obj = bundle_add_msg()
8939 _version = reader.read("!B")[0]
8940 assert(_version == 5)
8941 _type = reader.read("!B")[0]
8942 assert(_type == 34)
8943 _length = reader.read("!H")[0]
8944 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008945 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008946 obj.xid = reader.read("!L")[0]
8947 obj.bundle_id = reader.read("!L")[0]
8948 reader.skip(2)
8949 obj.flags = reader.read("!H")[0]
8950 obj.data = str(reader.read_all())
8951 return obj
8952
8953 def __eq__(self, other):
8954 if type(self) != type(other): return False
8955 if self.xid != other.xid: return False
8956 if self.bundle_id != other.bundle_id: return False
8957 if self.flags != other.flags: return False
8958 if self.data != other.data: return False
8959 return True
8960
8961 def pretty_print(self, q):
8962 q.text("bundle_add_msg {")
8963 with q.group():
8964 with q.indent(2):
8965 q.breakable()
8966 q.text("xid = ");
8967 if self.xid != None:
8968 q.text("%#x" % self.xid)
8969 else:
8970 q.text('None')
8971 q.text(","); q.breakable()
8972 q.text("bundle_id = ");
8973 q.text("%#x" % self.bundle_id)
8974 q.text(","); q.breakable()
8975 q.text("flags = ");
8976 q.text("%#x" % self.flags)
8977 q.text(","); q.breakable()
8978 q.text("data = ");
8979 q.pp(self.data)
8980 q.breakable()
8981 q.text('}')
8982
8983message.subtypes[34] = bundle_add_msg
8984
8985class bundle_ctrl_msg(message):
8986 version = 5
8987 type = 33
8988
8989 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
8990 if xid != None:
8991 self.xid = xid
8992 else:
8993 self.xid = None
8994 if bundle_id != None:
8995 self.bundle_id = bundle_id
8996 else:
8997 self.bundle_id = 0
8998 if bundle_ctrl_type != None:
8999 self.bundle_ctrl_type = bundle_ctrl_type
9000 else:
9001 self.bundle_ctrl_type = 0
9002 if flags != None:
9003 self.flags = flags
9004 else:
9005 self.flags = 0
9006 if properties != None:
9007 self.properties = properties
9008 else:
9009 self.properties = []
9010 return
9011
9012 def pack(self):
9013 packed = []
9014 packed.append(struct.pack("!B", self.version))
9015 packed.append(struct.pack("!B", self.type))
9016 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9017 packed.append(struct.pack("!L", self.xid))
9018 packed.append(struct.pack("!L", self.bundle_id))
9019 packed.append(struct.pack("!H", self.bundle_ctrl_type))
9020 packed.append(struct.pack("!H", self.flags))
9021 packed.append(loxi.generic_util.pack_list(self.properties))
9022 length = sum([len(x) for x in packed])
9023 packed[2] = struct.pack("!H", length)
9024 return ''.join(packed)
9025
9026 @staticmethod
9027 def unpack(reader):
9028 obj = bundle_ctrl_msg()
9029 _version = reader.read("!B")[0]
9030 assert(_version == 5)
9031 _type = reader.read("!B")[0]
9032 assert(_type == 33)
9033 _length = reader.read("!H")[0]
9034 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009035 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009036 obj.xid = reader.read("!L")[0]
9037 obj.bundle_id = reader.read("!L")[0]
9038 obj.bundle_ctrl_type = reader.read("!H")[0]
9039 obj.flags = reader.read("!H")[0]
9040 obj.properties = loxi.generic_util.unpack_list(reader, bundle_prop.bundle_prop.unpack)
9041 return obj
9042
9043 def __eq__(self, other):
9044 if type(self) != type(other): return False
9045 if self.xid != other.xid: return False
9046 if self.bundle_id != other.bundle_id: return False
9047 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
9048 if self.flags != other.flags: return False
9049 if self.properties != other.properties: return False
9050 return True
9051
9052 def pretty_print(self, q):
9053 q.text("bundle_ctrl_msg {")
9054 with q.group():
9055 with q.indent(2):
9056 q.breakable()
9057 q.text("xid = ");
9058 if self.xid != None:
9059 q.text("%#x" % self.xid)
9060 else:
9061 q.text('None')
9062 q.text(","); q.breakable()
9063 q.text("bundle_id = ");
9064 q.text("%#x" % self.bundle_id)
9065 q.text(","); q.breakable()
9066 q.text("bundle_ctrl_type = ");
9067 q.text("%#x" % self.bundle_ctrl_type)
9068 q.text(","); q.breakable()
9069 q.text("flags = ");
9070 q.text("%#x" % self.flags)
9071 q.text(","); q.breakable()
9072 q.text("properties = ");
9073 q.pp(self.properties)
9074 q.breakable()
9075 q.text('}')
9076
9077message.subtypes[33] = bundle_ctrl_msg
9078
Rich Laneccd32ed2014-11-10 17:48:24 -08009079class bundle_failed_error_msg(error_msg):
9080 version = 5
9081 type = 1
9082 err_type = 17
9083
9084 def __init__(self, xid=None, code=None, data=None):
9085 if xid != None:
9086 self.xid = xid
9087 else:
9088 self.xid = None
9089 if code != None:
9090 self.code = code
9091 else:
9092 self.code = 0
9093 if data != None:
9094 self.data = data
9095 else:
9096 self.data = ''
9097 return
9098
9099 def pack(self):
9100 packed = []
9101 packed.append(struct.pack("!B", self.version))
9102 packed.append(struct.pack("!B", self.type))
9103 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9104 packed.append(struct.pack("!L", self.xid))
9105 packed.append(struct.pack("!H", self.err_type))
9106 packed.append(struct.pack("!H", self.code))
9107 packed.append(self.data)
9108 length = sum([len(x) for x in packed])
9109 packed[2] = struct.pack("!H", length)
9110 return ''.join(packed)
9111
9112 @staticmethod
9113 def unpack(reader):
9114 obj = bundle_failed_error_msg()
9115 _version = reader.read("!B")[0]
9116 assert(_version == 5)
9117 _type = reader.read("!B")[0]
9118 assert(_type == 1)
9119 _length = reader.read("!H")[0]
9120 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009121 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08009122 obj.xid = reader.read("!L")[0]
9123 _err_type = reader.read("!H")[0]
9124 assert(_err_type == 17)
9125 obj.code = reader.read("!H")[0]
9126 obj.data = str(reader.read_all())
9127 return obj
9128
9129 def __eq__(self, other):
9130 if type(self) != type(other): return False
9131 if self.xid != other.xid: return False
9132 if self.code != other.code: return False
9133 if self.data != other.data: return False
9134 return True
9135
9136 def pretty_print(self, q):
9137 q.text("bundle_failed_error_msg {")
9138 with q.group():
9139 with q.indent(2):
9140 q.breakable()
9141 q.text("xid = ");
9142 if self.xid != None:
9143 q.text("%#x" % self.xid)
9144 else:
9145 q.text('None')
9146 q.text(","); q.breakable()
9147 q.text("code = ");
9148 q.text("%#x" % self.code)
9149 q.text(","); q.breakable()
9150 q.text("data = ");
9151 q.pp(self.data)
9152 q.breakable()
9153 q.text('}')
9154
9155error_msg.subtypes[17] = bundle_failed_error_msg
9156
Rich Lane2e079da2014-10-29 15:30:24 -07009157class desc_stats_reply(stats_reply):
9158 version = 5
9159 type = 19
9160 stats_type = 0
9161
9162 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
9163 if xid != None:
9164 self.xid = xid
9165 else:
9166 self.xid = None
9167 if flags != None:
9168 self.flags = flags
9169 else:
9170 self.flags = 0
9171 if mfr_desc != None:
9172 self.mfr_desc = mfr_desc
9173 else:
9174 self.mfr_desc = ""
9175 if hw_desc != None:
9176 self.hw_desc = hw_desc
9177 else:
9178 self.hw_desc = ""
9179 if sw_desc != None:
9180 self.sw_desc = sw_desc
9181 else:
9182 self.sw_desc = ""
9183 if serial_num != None:
9184 self.serial_num = serial_num
9185 else:
9186 self.serial_num = ""
9187 if dp_desc != None:
9188 self.dp_desc = dp_desc
9189 else:
9190 self.dp_desc = ""
9191 return
9192
9193 def pack(self):
9194 packed = []
9195 packed.append(struct.pack("!B", self.version))
9196 packed.append(struct.pack("!B", self.type))
9197 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9198 packed.append(struct.pack("!L", self.xid))
9199 packed.append(struct.pack("!H", self.stats_type))
9200 packed.append(struct.pack("!H", self.flags))
9201 packed.append('\x00' * 4)
9202 packed.append(struct.pack("!256s", self.mfr_desc))
9203 packed.append(struct.pack("!256s", self.hw_desc))
9204 packed.append(struct.pack("!256s", self.sw_desc))
9205 packed.append(struct.pack("!32s", self.serial_num))
9206 packed.append(struct.pack("!256s", self.dp_desc))
9207 length = sum([len(x) for x in packed])
9208 packed[2] = struct.pack("!H", length)
9209 return ''.join(packed)
9210
9211 @staticmethod
9212 def unpack(reader):
9213 obj = desc_stats_reply()
9214 _version = reader.read("!B")[0]
9215 assert(_version == 5)
9216 _type = reader.read("!B")[0]
9217 assert(_type == 19)
9218 _length = reader.read("!H")[0]
9219 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009220 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009221 obj.xid = reader.read("!L")[0]
9222 _stats_type = reader.read("!H")[0]
9223 assert(_stats_type == 0)
9224 obj.flags = reader.read("!H")[0]
9225 reader.skip(4)
9226 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9227 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9228 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9229 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9230 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9231 return obj
9232
9233 def __eq__(self, other):
9234 if type(self) != type(other): return False
9235 if self.xid != other.xid: return False
9236 if self.flags != other.flags: return False
9237 if self.mfr_desc != other.mfr_desc: return False
9238 if self.hw_desc != other.hw_desc: return False
9239 if self.sw_desc != other.sw_desc: return False
9240 if self.serial_num != other.serial_num: return False
9241 if self.dp_desc != other.dp_desc: return False
9242 return True
9243
9244 def pretty_print(self, q):
9245 q.text("desc_stats_reply {")
9246 with q.group():
9247 with q.indent(2):
9248 q.breakable()
9249 q.text("xid = ");
9250 if self.xid != None:
9251 q.text("%#x" % self.xid)
9252 else:
9253 q.text('None')
9254 q.text(","); q.breakable()
9255 q.text("flags = ");
9256 q.text("%#x" % self.flags)
9257 q.text(","); q.breakable()
9258 q.text("mfr_desc = ");
9259 q.pp(self.mfr_desc)
9260 q.text(","); q.breakable()
9261 q.text("hw_desc = ");
9262 q.pp(self.hw_desc)
9263 q.text(","); q.breakable()
9264 q.text("sw_desc = ");
9265 q.pp(self.sw_desc)
9266 q.text(","); q.breakable()
9267 q.text("serial_num = ");
9268 q.pp(self.serial_num)
9269 q.text(","); q.breakable()
9270 q.text("dp_desc = ");
9271 q.pp(self.dp_desc)
9272 q.breakable()
9273 q.text('}')
9274
9275stats_reply.subtypes[0] = desc_stats_reply
9276
9277class desc_stats_request(stats_request):
9278 version = 5
9279 type = 18
9280 stats_type = 0
9281
9282 def __init__(self, xid=None, flags=None):
9283 if xid != None:
9284 self.xid = xid
9285 else:
9286 self.xid = None
9287 if flags != None:
9288 self.flags = flags
9289 else:
9290 self.flags = 0
9291 return
9292
9293 def pack(self):
9294 packed = []
9295 packed.append(struct.pack("!B", self.version))
9296 packed.append(struct.pack("!B", self.type))
9297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9298 packed.append(struct.pack("!L", self.xid))
9299 packed.append(struct.pack("!H", self.stats_type))
9300 packed.append(struct.pack("!H", self.flags))
9301 packed.append('\x00' * 4)
9302 length = sum([len(x) for x in packed])
9303 packed[2] = struct.pack("!H", length)
9304 return ''.join(packed)
9305
9306 @staticmethod
9307 def unpack(reader):
9308 obj = desc_stats_request()
9309 _version = reader.read("!B")[0]
9310 assert(_version == 5)
9311 _type = reader.read("!B")[0]
9312 assert(_type == 18)
9313 _length = reader.read("!H")[0]
9314 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009315 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009316 obj.xid = reader.read("!L")[0]
9317 _stats_type = reader.read("!H")[0]
9318 assert(_stats_type == 0)
9319 obj.flags = reader.read("!H")[0]
9320 reader.skip(4)
9321 return obj
9322
9323 def __eq__(self, other):
9324 if type(self) != type(other): return False
9325 if self.xid != other.xid: return False
9326 if self.flags != other.flags: return False
9327 return True
9328
9329 def pretty_print(self, q):
9330 q.text("desc_stats_request {")
9331 with q.group():
9332 with q.indent(2):
9333 q.breakable()
9334 q.text("xid = ");
9335 if self.xid != None:
9336 q.text("%#x" % self.xid)
9337 else:
9338 q.text('None')
9339 q.text(","); q.breakable()
9340 q.text("flags = ");
9341 q.text("%#x" % self.flags)
9342 q.breakable()
9343 q.text('}')
9344
9345stats_request.subtypes[0] = desc_stats_request
9346
9347class echo_reply(message):
9348 version = 5
9349 type = 3
9350
9351 def __init__(self, xid=None, data=None):
9352 if xid != None:
9353 self.xid = xid
9354 else:
9355 self.xid = None
9356 if data != None:
9357 self.data = data
9358 else:
9359 self.data = ''
9360 return
9361
9362 def pack(self):
9363 packed = []
9364 packed.append(struct.pack("!B", self.version))
9365 packed.append(struct.pack("!B", self.type))
9366 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9367 packed.append(struct.pack("!L", self.xid))
9368 packed.append(self.data)
9369 length = sum([len(x) for x in packed])
9370 packed[2] = struct.pack("!H", length)
9371 return ''.join(packed)
9372
9373 @staticmethod
9374 def unpack(reader):
9375 obj = echo_reply()
9376 _version = reader.read("!B")[0]
9377 assert(_version == 5)
9378 _type = reader.read("!B")[0]
9379 assert(_type == 3)
9380 _length = reader.read("!H")[0]
9381 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009382 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009383 obj.xid = reader.read("!L")[0]
9384 obj.data = str(reader.read_all())
9385 return obj
9386
9387 def __eq__(self, other):
9388 if type(self) != type(other): return False
9389 if self.xid != other.xid: return False
9390 if self.data != other.data: return False
9391 return True
9392
9393 def pretty_print(self, q):
9394 q.text("echo_reply {")
9395 with q.group():
9396 with q.indent(2):
9397 q.breakable()
9398 q.text("xid = ");
9399 if self.xid != None:
9400 q.text("%#x" % self.xid)
9401 else:
9402 q.text('None')
9403 q.text(","); q.breakable()
9404 q.text("data = ");
9405 q.pp(self.data)
9406 q.breakable()
9407 q.text('}')
9408
9409message.subtypes[3] = echo_reply
9410
9411class echo_request(message):
9412 version = 5
9413 type = 2
9414
9415 def __init__(self, xid=None, data=None):
9416 if xid != None:
9417 self.xid = xid
9418 else:
9419 self.xid = None
9420 if data != None:
9421 self.data = data
9422 else:
9423 self.data = ''
9424 return
9425
9426 def pack(self):
9427 packed = []
9428 packed.append(struct.pack("!B", self.version))
9429 packed.append(struct.pack("!B", self.type))
9430 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9431 packed.append(struct.pack("!L", self.xid))
9432 packed.append(self.data)
9433 length = sum([len(x) for x in packed])
9434 packed[2] = struct.pack("!H", length)
9435 return ''.join(packed)
9436
9437 @staticmethod
9438 def unpack(reader):
9439 obj = echo_request()
9440 _version = reader.read("!B")[0]
9441 assert(_version == 5)
9442 _type = reader.read("!B")[0]
9443 assert(_type == 2)
9444 _length = reader.read("!H")[0]
9445 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009446 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009447 obj.xid = reader.read("!L")[0]
9448 obj.data = str(reader.read_all())
9449 return obj
9450
9451 def __eq__(self, other):
9452 if type(self) != type(other): return False
9453 if self.xid != other.xid: return False
9454 if self.data != other.data: return False
9455 return True
9456
9457 def pretty_print(self, q):
9458 q.text("echo_request {")
9459 with q.group():
9460 with q.indent(2):
9461 q.breakable()
9462 q.text("xid = ");
9463 if self.xid != None:
9464 q.text("%#x" % self.xid)
9465 else:
9466 q.text('None')
9467 q.text(","); q.breakable()
9468 q.text("data = ");
9469 q.pp(self.data)
9470 q.breakable()
9471 q.text('}')
9472
9473message.subtypes[2] = echo_request
9474
9475class experimenter_error_msg(error_msg):
9476 version = 5
9477 type = 1
9478 err_type = 65535
9479
9480 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
9481 if xid != None:
9482 self.xid = xid
9483 else:
9484 self.xid = None
9485 if subtype != None:
9486 self.subtype = subtype
9487 else:
9488 self.subtype = 0
9489 if experimenter != None:
9490 self.experimenter = experimenter
9491 else:
9492 self.experimenter = 0
9493 if data != None:
9494 self.data = data
9495 else:
9496 self.data = ''
9497 return
9498
9499 def pack(self):
9500 packed = []
9501 packed.append(struct.pack("!B", self.version))
9502 packed.append(struct.pack("!B", self.type))
9503 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9504 packed.append(struct.pack("!L", self.xid))
9505 packed.append(struct.pack("!H", self.err_type))
9506 packed.append(struct.pack("!H", self.subtype))
9507 packed.append(struct.pack("!L", self.experimenter))
9508 packed.append(self.data)
9509 length = sum([len(x) for x in packed])
9510 packed[2] = struct.pack("!H", length)
9511 return ''.join(packed)
9512
9513 @staticmethod
9514 def unpack(reader):
9515 obj = experimenter_error_msg()
9516 _version = reader.read("!B")[0]
9517 assert(_version == 5)
9518 _type = reader.read("!B")[0]
9519 assert(_type == 1)
9520 _length = reader.read("!H")[0]
9521 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009522 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009523 obj.xid = reader.read("!L")[0]
9524 _err_type = reader.read("!H")[0]
9525 assert(_err_type == 65535)
9526 obj.subtype = reader.read("!H")[0]
9527 obj.experimenter = reader.read("!L")[0]
9528 obj.data = str(reader.read_all())
9529 return obj
9530
9531 def __eq__(self, other):
9532 if type(self) != type(other): return False
9533 if self.xid != other.xid: return False
9534 if self.subtype != other.subtype: return False
9535 if self.experimenter != other.experimenter: return False
9536 if self.data != other.data: return False
9537 return True
9538
9539 def pretty_print(self, q):
9540 q.text("experimenter_error_msg {")
9541 with q.group():
9542 with q.indent(2):
9543 q.breakable()
9544 q.text("xid = ");
9545 if self.xid != None:
9546 q.text("%#x" % self.xid)
9547 else:
9548 q.text('None')
9549 q.text(","); q.breakable()
9550 q.text("subtype = ");
9551 q.text("%#x" % self.subtype)
9552 q.text(","); q.breakable()
9553 q.text("experimenter = ");
9554 q.text("%#x" % self.experimenter)
9555 q.text(","); q.breakable()
9556 q.text("data = ");
9557 q.pp(self.data)
9558 q.breakable()
9559 q.text('}')
9560
9561error_msg.subtypes[65535] = experimenter_error_msg
9562
9563class features_reply(message):
9564 version = 5
9565 type = 6
9566
9567 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
9568 if xid != None:
9569 self.xid = xid
9570 else:
9571 self.xid = None
9572 if datapath_id != None:
9573 self.datapath_id = datapath_id
9574 else:
9575 self.datapath_id = 0
9576 if n_buffers != None:
9577 self.n_buffers = n_buffers
9578 else:
9579 self.n_buffers = 0
9580 if n_tables != None:
9581 self.n_tables = n_tables
9582 else:
9583 self.n_tables = 0
9584 if auxiliary_id != None:
9585 self.auxiliary_id = auxiliary_id
9586 else:
9587 self.auxiliary_id = 0
9588 if capabilities != None:
9589 self.capabilities = capabilities
9590 else:
9591 self.capabilities = 0
9592 if reserved != None:
9593 self.reserved = reserved
9594 else:
9595 self.reserved = 0
9596 return
9597
9598 def pack(self):
9599 packed = []
9600 packed.append(struct.pack("!B", self.version))
9601 packed.append(struct.pack("!B", self.type))
9602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9603 packed.append(struct.pack("!L", self.xid))
9604 packed.append(struct.pack("!Q", self.datapath_id))
9605 packed.append(struct.pack("!L", self.n_buffers))
9606 packed.append(struct.pack("!B", self.n_tables))
9607 packed.append(struct.pack("!B", self.auxiliary_id))
9608 packed.append('\x00' * 2)
9609 packed.append(struct.pack("!L", self.capabilities))
9610 packed.append(struct.pack("!L", self.reserved))
9611 length = sum([len(x) for x in packed])
9612 packed[2] = struct.pack("!H", length)
9613 return ''.join(packed)
9614
9615 @staticmethod
9616 def unpack(reader):
9617 obj = features_reply()
9618 _version = reader.read("!B")[0]
9619 assert(_version == 5)
9620 _type = reader.read("!B")[0]
9621 assert(_type == 6)
9622 _length = reader.read("!H")[0]
9623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009624 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009625 obj.xid = reader.read("!L")[0]
9626 obj.datapath_id = reader.read("!Q")[0]
9627 obj.n_buffers = reader.read("!L")[0]
9628 obj.n_tables = reader.read("!B")[0]
9629 obj.auxiliary_id = reader.read("!B")[0]
9630 reader.skip(2)
9631 obj.capabilities = reader.read("!L")[0]
9632 obj.reserved = reader.read("!L")[0]
9633 return obj
9634
9635 def __eq__(self, other):
9636 if type(self) != type(other): return False
9637 if self.xid != other.xid: return False
9638 if self.datapath_id != other.datapath_id: return False
9639 if self.n_buffers != other.n_buffers: return False
9640 if self.n_tables != other.n_tables: return False
9641 if self.auxiliary_id != other.auxiliary_id: return False
9642 if self.capabilities != other.capabilities: return False
9643 if self.reserved != other.reserved: return False
9644 return True
9645
9646 def pretty_print(self, q):
9647 q.text("features_reply {")
9648 with q.group():
9649 with q.indent(2):
9650 q.breakable()
9651 q.text("xid = ");
9652 if self.xid != None:
9653 q.text("%#x" % self.xid)
9654 else:
9655 q.text('None')
9656 q.text(","); q.breakable()
9657 q.text("datapath_id = ");
9658 q.text("%#x" % self.datapath_id)
9659 q.text(","); q.breakable()
9660 q.text("n_buffers = ");
9661 q.text("%#x" % self.n_buffers)
9662 q.text(","); q.breakable()
9663 q.text("n_tables = ");
9664 q.text("%#x" % self.n_tables)
9665 q.text(","); q.breakable()
9666 q.text("auxiliary_id = ");
9667 q.text("%#x" % self.auxiliary_id)
9668 q.text(","); q.breakable()
9669 q.text("capabilities = ");
9670 q.text("%#x" % self.capabilities)
9671 q.text(","); q.breakable()
9672 q.text("reserved = ");
9673 q.text("%#x" % self.reserved)
9674 q.breakable()
9675 q.text('}')
9676
9677message.subtypes[6] = features_reply
9678
9679class features_request(message):
9680 version = 5
9681 type = 5
9682
9683 def __init__(self, xid=None):
9684 if xid != None:
9685 self.xid = xid
9686 else:
9687 self.xid = None
9688 return
9689
9690 def pack(self):
9691 packed = []
9692 packed.append(struct.pack("!B", self.version))
9693 packed.append(struct.pack("!B", self.type))
9694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9695 packed.append(struct.pack("!L", self.xid))
9696 length = sum([len(x) for x in packed])
9697 packed[2] = struct.pack("!H", length)
9698 return ''.join(packed)
9699
9700 @staticmethod
9701 def unpack(reader):
9702 obj = features_request()
9703 _version = reader.read("!B")[0]
9704 assert(_version == 5)
9705 _type = reader.read("!B")[0]
9706 assert(_type == 5)
9707 _length = reader.read("!H")[0]
9708 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009709 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009710 obj.xid = reader.read("!L")[0]
9711 return obj
9712
9713 def __eq__(self, other):
9714 if type(self) != type(other): return False
9715 if self.xid != other.xid: return False
9716 return True
9717
9718 def pretty_print(self, q):
9719 q.text("features_request {")
9720 with q.group():
9721 with q.indent(2):
9722 q.breakable()
9723 q.text("xid = ");
9724 if self.xid != None:
9725 q.text("%#x" % self.xid)
9726 else:
9727 q.text('None')
9728 q.breakable()
9729 q.text('}')
9730
9731message.subtypes[5] = features_request
9732
9733class flow_mod(message):
9734 subtypes = {}
9735
9736 version = 5
9737 type = 14
9738
9739 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):
9740 if xid != None:
9741 self.xid = xid
9742 else:
9743 self.xid = None
9744 if cookie != None:
9745 self.cookie = cookie
9746 else:
9747 self.cookie = 0
9748 if cookie_mask != None:
9749 self.cookie_mask = cookie_mask
9750 else:
9751 self.cookie_mask = 0
9752 if table_id != None:
9753 self.table_id = table_id
9754 else:
9755 self.table_id = 0
9756 if _command != None:
9757 self._command = _command
9758 else:
9759 self._command = 0
9760 if idle_timeout != None:
9761 self.idle_timeout = idle_timeout
9762 else:
9763 self.idle_timeout = 0
9764 if hard_timeout != None:
9765 self.hard_timeout = hard_timeout
9766 else:
9767 self.hard_timeout = 0
9768 if priority != None:
9769 self.priority = priority
9770 else:
9771 self.priority = 0
9772 if buffer_id != None:
9773 self.buffer_id = buffer_id
9774 else:
9775 self.buffer_id = 0
9776 if out_port != None:
9777 self.out_port = out_port
9778 else:
9779 self.out_port = 0
9780 if out_group != None:
9781 self.out_group = out_group
9782 else:
9783 self.out_group = 0
9784 if flags != None:
9785 self.flags = flags
9786 else:
9787 self.flags = 0
9788 if match != None:
9789 self.match = match
9790 else:
9791 self.match = common.match()
9792 if instructions != None:
9793 self.instructions = instructions
9794 else:
9795 self.instructions = []
9796 return
9797
9798 def pack(self):
9799 packed = []
9800 packed.append(struct.pack("!B", self.version))
9801 packed.append(struct.pack("!B", self.type))
9802 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9803 packed.append(struct.pack("!L", self.xid))
9804 packed.append(struct.pack("!Q", self.cookie))
9805 packed.append(struct.pack("!Q", self.cookie_mask))
9806 packed.append(struct.pack("!B", self.table_id))
9807 packed.append(util.pack_fm_cmd(self._command))
9808 packed.append(struct.pack("!H", self.idle_timeout))
9809 packed.append(struct.pack("!H", self.hard_timeout))
9810 packed.append(struct.pack("!H", self.priority))
9811 packed.append(struct.pack("!L", self.buffer_id))
9812 packed.append(util.pack_port_no(self.out_port))
9813 packed.append(struct.pack("!L", self.out_group))
9814 packed.append(struct.pack("!H", self.flags))
9815 packed.append('\x00' * 2)
9816 packed.append(self.match.pack())
9817 packed.append(loxi.generic_util.pack_list(self.instructions))
9818 length = sum([len(x) for x in packed])
9819 packed[2] = struct.pack("!H", length)
9820 return ''.join(packed)
9821
9822 @staticmethod
9823 def unpack(reader):
9824 subtype, = reader.peek('B', 25)
9825 subclass = flow_mod.subtypes.get(subtype)
9826 if subclass:
9827 return subclass.unpack(reader)
9828
9829 obj = flow_mod()
9830 _version = reader.read("!B")[0]
9831 assert(_version == 5)
9832 _type = reader.read("!B")[0]
9833 assert(_type == 14)
9834 _length = reader.read("!H")[0]
9835 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009836 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009837 obj.xid = reader.read("!L")[0]
9838 obj.cookie = reader.read("!Q")[0]
9839 obj.cookie_mask = reader.read("!Q")[0]
9840 obj.table_id = reader.read("!B")[0]
9841 obj._command = util.unpack_fm_cmd(reader)
9842 obj.idle_timeout = reader.read("!H")[0]
9843 obj.hard_timeout = reader.read("!H")[0]
9844 obj.priority = reader.read("!H")[0]
9845 obj.buffer_id = reader.read("!L")[0]
9846 obj.out_port = util.unpack_port_no(reader)
9847 obj.out_group = reader.read("!L")[0]
9848 obj.flags = reader.read("!H")[0]
9849 reader.skip(2)
9850 obj.match = common.match.unpack(reader)
9851 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9852 return obj
9853
9854 def __eq__(self, other):
9855 if type(self) != type(other): return False
9856 if self.xid != other.xid: return False
9857 if self.cookie != other.cookie: return False
9858 if self.cookie_mask != other.cookie_mask: return False
9859 if self.table_id != other.table_id: return False
9860 if self._command != other._command: return False
9861 if self.idle_timeout != other.idle_timeout: return False
9862 if self.hard_timeout != other.hard_timeout: return False
9863 if self.priority != other.priority: return False
9864 if self.buffer_id != other.buffer_id: return False
9865 if self.out_port != other.out_port: return False
9866 if self.out_group != other.out_group: return False
9867 if self.flags != other.flags: return False
9868 if self.match != other.match: return False
9869 if self.instructions != other.instructions: return False
9870 return True
9871
9872 def pretty_print(self, q):
9873 q.text("flow_mod {")
9874 with q.group():
9875 with q.indent(2):
9876 q.breakable()
9877 q.text("xid = ");
9878 if self.xid != None:
9879 q.text("%#x" % self.xid)
9880 else:
9881 q.text('None')
9882 q.text(","); q.breakable()
9883 q.text("cookie = ");
9884 q.text("%#x" % self.cookie)
9885 q.text(","); q.breakable()
9886 q.text("cookie_mask = ");
9887 q.text("%#x" % self.cookie_mask)
9888 q.text(","); q.breakable()
9889 q.text("table_id = ");
9890 q.text("%#x" % self.table_id)
9891 q.text(","); q.breakable()
9892 q.text("idle_timeout = ");
9893 q.text("%#x" % self.idle_timeout)
9894 q.text(","); q.breakable()
9895 q.text("hard_timeout = ");
9896 q.text("%#x" % self.hard_timeout)
9897 q.text(","); q.breakable()
9898 q.text("priority = ");
9899 q.text("%#x" % self.priority)
9900 q.text(","); q.breakable()
9901 q.text("buffer_id = ");
9902 q.text("%#x" % self.buffer_id)
9903 q.text(","); q.breakable()
9904 q.text("out_port = ");
9905 q.text(util.pretty_port(self.out_port))
9906 q.text(","); q.breakable()
9907 q.text("out_group = ");
9908 q.text("%#x" % self.out_group)
9909 q.text(","); q.breakable()
9910 q.text("flags = ");
9911 q.text("%#x" % self.flags)
9912 q.text(","); q.breakable()
9913 q.text("match = ");
9914 q.pp(self.match)
9915 q.text(","); q.breakable()
9916 q.text("instructions = ");
9917 q.pp(self.instructions)
9918 q.breakable()
9919 q.text('}')
9920
9921message.subtypes[14] = flow_mod
9922
9923class flow_add(flow_mod):
9924 version = 5
9925 type = 14
9926 _command = 0
9927
9928 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):
9929 if xid != None:
9930 self.xid = xid
9931 else:
9932 self.xid = None
9933 if cookie != None:
9934 self.cookie = cookie
9935 else:
9936 self.cookie = 0
9937 if cookie_mask != None:
9938 self.cookie_mask = cookie_mask
9939 else:
9940 self.cookie_mask = 0
9941 if table_id != None:
9942 self.table_id = table_id
9943 else:
9944 self.table_id = 0
9945 if idle_timeout != None:
9946 self.idle_timeout = idle_timeout
9947 else:
9948 self.idle_timeout = 0
9949 if hard_timeout != None:
9950 self.hard_timeout = hard_timeout
9951 else:
9952 self.hard_timeout = 0
9953 if priority != None:
9954 self.priority = priority
9955 else:
9956 self.priority = 0
9957 if buffer_id != None:
9958 self.buffer_id = buffer_id
9959 else:
9960 self.buffer_id = 0
9961 if out_port != None:
9962 self.out_port = out_port
9963 else:
9964 self.out_port = 0
9965 if out_group != None:
9966 self.out_group = out_group
9967 else:
9968 self.out_group = 0
9969 if flags != None:
9970 self.flags = flags
9971 else:
9972 self.flags = 0
9973 if importance != None:
9974 self.importance = importance
9975 else:
9976 self.importance = 0
9977 if match != None:
9978 self.match = match
9979 else:
9980 self.match = common.match()
9981 if instructions != None:
9982 self.instructions = instructions
9983 else:
9984 self.instructions = []
9985 return
9986
9987 def pack(self):
9988 packed = []
9989 packed.append(struct.pack("!B", self.version))
9990 packed.append(struct.pack("!B", self.type))
9991 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9992 packed.append(struct.pack("!L", self.xid))
9993 packed.append(struct.pack("!Q", self.cookie))
9994 packed.append(struct.pack("!Q", self.cookie_mask))
9995 packed.append(struct.pack("!B", self.table_id))
9996 packed.append(util.pack_fm_cmd(self._command))
9997 packed.append(struct.pack("!H", self.idle_timeout))
9998 packed.append(struct.pack("!H", self.hard_timeout))
9999 packed.append(struct.pack("!H", self.priority))
10000 packed.append(struct.pack("!L", self.buffer_id))
10001 packed.append(util.pack_port_no(self.out_port))
10002 packed.append(struct.pack("!L", self.out_group))
10003 packed.append(struct.pack("!H", self.flags))
10004 packed.append(struct.pack("!H", self.importance))
10005 packed.append(self.match.pack())
10006 packed.append(loxi.generic_util.pack_list(self.instructions))
10007 length = sum([len(x) for x in packed])
10008 packed[2] = struct.pack("!H", length)
10009 return ''.join(packed)
10010
10011 @staticmethod
10012 def unpack(reader):
10013 obj = flow_add()
10014 _version = reader.read("!B")[0]
10015 assert(_version == 5)
10016 _type = reader.read("!B")[0]
10017 assert(_type == 14)
10018 _length = reader.read("!H")[0]
10019 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010020 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010021 obj.xid = reader.read("!L")[0]
10022 obj.cookie = reader.read("!Q")[0]
10023 obj.cookie_mask = reader.read("!Q")[0]
10024 obj.table_id = reader.read("!B")[0]
10025 __command = util.unpack_fm_cmd(reader)
10026 assert(__command == 0)
10027 obj.idle_timeout = reader.read("!H")[0]
10028 obj.hard_timeout = reader.read("!H")[0]
10029 obj.priority = reader.read("!H")[0]
10030 obj.buffer_id = reader.read("!L")[0]
10031 obj.out_port = util.unpack_port_no(reader)
10032 obj.out_group = reader.read("!L")[0]
10033 obj.flags = reader.read("!H")[0]
10034 obj.importance = reader.read("!H")[0]
10035 obj.match = common.match.unpack(reader)
10036 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10037 return obj
10038
10039 def __eq__(self, other):
10040 if type(self) != type(other): return False
10041 if self.xid != other.xid: return False
10042 if self.cookie != other.cookie: return False
10043 if self.cookie_mask != other.cookie_mask: return False
10044 if self.table_id != other.table_id: return False
10045 if self.idle_timeout != other.idle_timeout: return False
10046 if self.hard_timeout != other.hard_timeout: return False
10047 if self.priority != other.priority: return False
10048 if self.buffer_id != other.buffer_id: return False
10049 if self.out_port != other.out_port: return False
10050 if self.out_group != other.out_group: return False
10051 if self.flags != other.flags: return False
10052 if self.importance != other.importance: return False
10053 if self.match != other.match: return False
10054 if self.instructions != other.instructions: return False
10055 return True
10056
10057 def pretty_print(self, q):
10058 q.text("flow_add {")
10059 with q.group():
10060 with q.indent(2):
10061 q.breakable()
10062 q.text("xid = ");
10063 if self.xid != None:
10064 q.text("%#x" % self.xid)
10065 else:
10066 q.text('None')
10067 q.text(","); q.breakable()
10068 q.text("cookie = ");
10069 q.text("%#x" % self.cookie)
10070 q.text(","); q.breakable()
10071 q.text("cookie_mask = ");
10072 q.text("%#x" % self.cookie_mask)
10073 q.text(","); q.breakable()
10074 q.text("table_id = ");
10075 q.text("%#x" % self.table_id)
10076 q.text(","); q.breakable()
10077 q.text("idle_timeout = ");
10078 q.text("%#x" % self.idle_timeout)
10079 q.text(","); q.breakable()
10080 q.text("hard_timeout = ");
10081 q.text("%#x" % self.hard_timeout)
10082 q.text(","); q.breakable()
10083 q.text("priority = ");
10084 q.text("%#x" % self.priority)
10085 q.text(","); q.breakable()
10086 q.text("buffer_id = ");
10087 q.text("%#x" % self.buffer_id)
10088 q.text(","); q.breakable()
10089 q.text("out_port = ");
10090 q.text(util.pretty_port(self.out_port))
10091 q.text(","); q.breakable()
10092 q.text("out_group = ");
10093 q.text("%#x" % self.out_group)
10094 q.text(","); q.breakable()
10095 q.text("flags = ");
10096 q.text("%#x" % self.flags)
10097 q.text(","); q.breakable()
10098 q.text("importance = ");
10099 q.text("%#x" % self.importance)
10100 q.text(","); q.breakable()
10101 q.text("match = ");
10102 q.pp(self.match)
10103 q.text(","); q.breakable()
10104 q.text("instructions = ");
10105 q.pp(self.instructions)
10106 q.breakable()
10107 q.text('}')
10108
10109flow_mod.subtypes[0] = flow_add
10110
10111class flow_delete(flow_mod):
10112 version = 5
10113 type = 14
10114 _command = 3
10115
10116 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):
10117 if xid != None:
10118 self.xid = xid
10119 else:
10120 self.xid = None
10121 if cookie != None:
10122 self.cookie = cookie
10123 else:
10124 self.cookie = 0
10125 if cookie_mask != None:
10126 self.cookie_mask = cookie_mask
10127 else:
10128 self.cookie_mask = 0
10129 if table_id != None:
10130 self.table_id = table_id
10131 else:
10132 self.table_id = 0
10133 if idle_timeout != None:
10134 self.idle_timeout = idle_timeout
10135 else:
10136 self.idle_timeout = 0
10137 if hard_timeout != None:
10138 self.hard_timeout = hard_timeout
10139 else:
10140 self.hard_timeout = 0
10141 if priority != None:
10142 self.priority = priority
10143 else:
10144 self.priority = 0
10145 if buffer_id != None:
10146 self.buffer_id = buffer_id
10147 else:
10148 self.buffer_id = 0
10149 if out_port != None:
10150 self.out_port = out_port
10151 else:
10152 self.out_port = 0
10153 if out_group != None:
10154 self.out_group = out_group
10155 else:
10156 self.out_group = 0
10157 if flags != None:
10158 self.flags = flags
10159 else:
10160 self.flags = 0
10161 if importance != None:
10162 self.importance = importance
10163 else:
10164 self.importance = 0
10165 if match != None:
10166 self.match = match
10167 else:
10168 self.match = common.match()
10169 if instructions != None:
10170 self.instructions = instructions
10171 else:
10172 self.instructions = []
10173 return
10174
10175 def pack(self):
10176 packed = []
10177 packed.append(struct.pack("!B", self.version))
10178 packed.append(struct.pack("!B", self.type))
10179 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10180 packed.append(struct.pack("!L", self.xid))
10181 packed.append(struct.pack("!Q", self.cookie))
10182 packed.append(struct.pack("!Q", self.cookie_mask))
10183 packed.append(struct.pack("!B", self.table_id))
10184 packed.append(util.pack_fm_cmd(self._command))
10185 packed.append(struct.pack("!H", self.idle_timeout))
10186 packed.append(struct.pack("!H", self.hard_timeout))
10187 packed.append(struct.pack("!H", self.priority))
10188 packed.append(struct.pack("!L", self.buffer_id))
10189 packed.append(util.pack_port_no(self.out_port))
10190 packed.append(struct.pack("!L", self.out_group))
10191 packed.append(struct.pack("!H", self.flags))
10192 packed.append(struct.pack("!H", self.importance))
10193 packed.append(self.match.pack())
10194 packed.append(loxi.generic_util.pack_list(self.instructions))
10195 length = sum([len(x) for x in packed])
10196 packed[2] = struct.pack("!H", length)
10197 return ''.join(packed)
10198
10199 @staticmethod
10200 def unpack(reader):
10201 obj = flow_delete()
10202 _version = reader.read("!B")[0]
10203 assert(_version == 5)
10204 _type = reader.read("!B")[0]
10205 assert(_type == 14)
10206 _length = reader.read("!H")[0]
10207 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010208 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010209 obj.xid = reader.read("!L")[0]
10210 obj.cookie = reader.read("!Q")[0]
10211 obj.cookie_mask = reader.read("!Q")[0]
10212 obj.table_id = reader.read("!B")[0]
10213 __command = util.unpack_fm_cmd(reader)
10214 assert(__command == 3)
10215 obj.idle_timeout = reader.read("!H")[0]
10216 obj.hard_timeout = reader.read("!H")[0]
10217 obj.priority = reader.read("!H")[0]
10218 obj.buffer_id = reader.read("!L")[0]
10219 obj.out_port = util.unpack_port_no(reader)
10220 obj.out_group = reader.read("!L")[0]
10221 obj.flags = reader.read("!H")[0]
10222 obj.importance = reader.read("!H")[0]
10223 obj.match = common.match.unpack(reader)
10224 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10225 return obj
10226
10227 def __eq__(self, other):
10228 if type(self) != type(other): return False
10229 if self.xid != other.xid: return False
10230 if self.cookie != other.cookie: return False
10231 if self.cookie_mask != other.cookie_mask: return False
10232 if self.table_id != other.table_id: return False
10233 if self.idle_timeout != other.idle_timeout: return False
10234 if self.hard_timeout != other.hard_timeout: return False
10235 if self.priority != other.priority: return False
10236 if self.buffer_id != other.buffer_id: return False
10237 if self.out_port != other.out_port: return False
10238 if self.out_group != other.out_group: return False
10239 if self.flags != other.flags: return False
10240 if self.importance != other.importance: return False
10241 if self.match != other.match: return False
10242 if self.instructions != other.instructions: return False
10243 return True
10244
10245 def pretty_print(self, q):
10246 q.text("flow_delete {")
10247 with q.group():
10248 with q.indent(2):
10249 q.breakable()
10250 q.text("xid = ");
10251 if self.xid != None:
10252 q.text("%#x" % self.xid)
10253 else:
10254 q.text('None')
10255 q.text(","); q.breakable()
10256 q.text("cookie = ");
10257 q.text("%#x" % self.cookie)
10258 q.text(","); q.breakable()
10259 q.text("cookie_mask = ");
10260 q.text("%#x" % self.cookie_mask)
10261 q.text(","); q.breakable()
10262 q.text("table_id = ");
10263 q.text("%#x" % self.table_id)
10264 q.text(","); q.breakable()
10265 q.text("idle_timeout = ");
10266 q.text("%#x" % self.idle_timeout)
10267 q.text(","); q.breakable()
10268 q.text("hard_timeout = ");
10269 q.text("%#x" % self.hard_timeout)
10270 q.text(","); q.breakable()
10271 q.text("priority = ");
10272 q.text("%#x" % self.priority)
10273 q.text(","); q.breakable()
10274 q.text("buffer_id = ");
10275 q.text("%#x" % self.buffer_id)
10276 q.text(","); q.breakable()
10277 q.text("out_port = ");
10278 q.text(util.pretty_port(self.out_port))
10279 q.text(","); q.breakable()
10280 q.text("out_group = ");
10281 q.text("%#x" % self.out_group)
10282 q.text(","); q.breakable()
10283 q.text("flags = ");
10284 q.text("%#x" % self.flags)
10285 q.text(","); q.breakable()
10286 q.text("importance = ");
10287 q.text("%#x" % self.importance)
10288 q.text(","); q.breakable()
10289 q.text("match = ");
10290 q.pp(self.match)
10291 q.text(","); q.breakable()
10292 q.text("instructions = ");
10293 q.pp(self.instructions)
10294 q.breakable()
10295 q.text('}')
10296
10297flow_mod.subtypes[3] = flow_delete
10298
10299class flow_delete_strict(flow_mod):
10300 version = 5
10301 type = 14
10302 _command = 4
10303
10304 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):
10305 if xid != None:
10306 self.xid = xid
10307 else:
10308 self.xid = None
10309 if cookie != None:
10310 self.cookie = cookie
10311 else:
10312 self.cookie = 0
10313 if cookie_mask != None:
10314 self.cookie_mask = cookie_mask
10315 else:
10316 self.cookie_mask = 0
10317 if table_id != None:
10318 self.table_id = table_id
10319 else:
10320 self.table_id = 0
10321 if idle_timeout != None:
10322 self.idle_timeout = idle_timeout
10323 else:
10324 self.idle_timeout = 0
10325 if hard_timeout != None:
10326 self.hard_timeout = hard_timeout
10327 else:
10328 self.hard_timeout = 0
10329 if priority != None:
10330 self.priority = priority
10331 else:
10332 self.priority = 0
10333 if buffer_id != None:
10334 self.buffer_id = buffer_id
10335 else:
10336 self.buffer_id = 0
10337 if out_port != None:
10338 self.out_port = out_port
10339 else:
10340 self.out_port = 0
10341 if out_group != None:
10342 self.out_group = out_group
10343 else:
10344 self.out_group = 0
10345 if flags != None:
10346 self.flags = flags
10347 else:
10348 self.flags = 0
10349 if importance != None:
10350 self.importance = importance
10351 else:
10352 self.importance = 0
10353 if match != None:
10354 self.match = match
10355 else:
10356 self.match = common.match()
10357 if instructions != None:
10358 self.instructions = instructions
10359 else:
10360 self.instructions = []
10361 return
10362
10363 def pack(self):
10364 packed = []
10365 packed.append(struct.pack("!B", self.version))
10366 packed.append(struct.pack("!B", self.type))
10367 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10368 packed.append(struct.pack("!L", self.xid))
10369 packed.append(struct.pack("!Q", self.cookie))
10370 packed.append(struct.pack("!Q", self.cookie_mask))
10371 packed.append(struct.pack("!B", self.table_id))
10372 packed.append(util.pack_fm_cmd(self._command))
10373 packed.append(struct.pack("!H", self.idle_timeout))
10374 packed.append(struct.pack("!H", self.hard_timeout))
10375 packed.append(struct.pack("!H", self.priority))
10376 packed.append(struct.pack("!L", self.buffer_id))
10377 packed.append(util.pack_port_no(self.out_port))
10378 packed.append(struct.pack("!L", self.out_group))
10379 packed.append(struct.pack("!H", self.flags))
10380 packed.append(struct.pack("!H", self.importance))
10381 packed.append(self.match.pack())
10382 packed.append(loxi.generic_util.pack_list(self.instructions))
10383 length = sum([len(x) for x in packed])
10384 packed[2] = struct.pack("!H", length)
10385 return ''.join(packed)
10386
10387 @staticmethod
10388 def unpack(reader):
10389 obj = flow_delete_strict()
10390 _version = reader.read("!B")[0]
10391 assert(_version == 5)
10392 _type = reader.read("!B")[0]
10393 assert(_type == 14)
10394 _length = reader.read("!H")[0]
10395 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010396 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010397 obj.xid = reader.read("!L")[0]
10398 obj.cookie = reader.read("!Q")[0]
10399 obj.cookie_mask = reader.read("!Q")[0]
10400 obj.table_id = reader.read("!B")[0]
10401 __command = util.unpack_fm_cmd(reader)
10402 assert(__command == 4)
10403 obj.idle_timeout = reader.read("!H")[0]
10404 obj.hard_timeout = reader.read("!H")[0]
10405 obj.priority = reader.read("!H")[0]
10406 obj.buffer_id = reader.read("!L")[0]
10407 obj.out_port = util.unpack_port_no(reader)
10408 obj.out_group = reader.read("!L")[0]
10409 obj.flags = reader.read("!H")[0]
10410 obj.importance = reader.read("!H")[0]
10411 obj.match = common.match.unpack(reader)
10412 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10413 return obj
10414
10415 def __eq__(self, other):
10416 if type(self) != type(other): return False
10417 if self.xid != other.xid: return False
10418 if self.cookie != other.cookie: return False
10419 if self.cookie_mask != other.cookie_mask: return False
10420 if self.table_id != other.table_id: return False
10421 if self.idle_timeout != other.idle_timeout: return False
10422 if self.hard_timeout != other.hard_timeout: return False
10423 if self.priority != other.priority: return False
10424 if self.buffer_id != other.buffer_id: return False
10425 if self.out_port != other.out_port: return False
10426 if self.out_group != other.out_group: return False
10427 if self.flags != other.flags: return False
10428 if self.importance != other.importance: return False
10429 if self.match != other.match: return False
10430 if self.instructions != other.instructions: return False
10431 return True
10432
10433 def pretty_print(self, q):
10434 q.text("flow_delete_strict {")
10435 with q.group():
10436 with q.indent(2):
10437 q.breakable()
10438 q.text("xid = ");
10439 if self.xid != None:
10440 q.text("%#x" % self.xid)
10441 else:
10442 q.text('None')
10443 q.text(","); q.breakable()
10444 q.text("cookie = ");
10445 q.text("%#x" % self.cookie)
10446 q.text(","); q.breakable()
10447 q.text("cookie_mask = ");
10448 q.text("%#x" % self.cookie_mask)
10449 q.text(","); q.breakable()
10450 q.text("table_id = ");
10451 q.text("%#x" % self.table_id)
10452 q.text(","); q.breakable()
10453 q.text("idle_timeout = ");
10454 q.text("%#x" % self.idle_timeout)
10455 q.text(","); q.breakable()
10456 q.text("hard_timeout = ");
10457 q.text("%#x" % self.hard_timeout)
10458 q.text(","); q.breakable()
10459 q.text("priority = ");
10460 q.text("%#x" % self.priority)
10461 q.text(","); q.breakable()
10462 q.text("buffer_id = ");
10463 q.text("%#x" % self.buffer_id)
10464 q.text(","); q.breakable()
10465 q.text("out_port = ");
10466 q.text(util.pretty_port(self.out_port))
10467 q.text(","); q.breakable()
10468 q.text("out_group = ");
10469 q.text("%#x" % self.out_group)
10470 q.text(","); q.breakable()
10471 q.text("flags = ");
10472 q.text("%#x" % self.flags)
10473 q.text(","); q.breakable()
10474 q.text("importance = ");
10475 q.text("%#x" % self.importance)
10476 q.text(","); q.breakable()
10477 q.text("match = ");
10478 q.pp(self.match)
10479 q.text(","); q.breakable()
10480 q.text("instructions = ");
10481 q.pp(self.instructions)
10482 q.breakable()
10483 q.text('}')
10484
10485flow_mod.subtypes[4] = flow_delete_strict
10486
10487class flow_mod_failed_error_msg(error_msg):
10488 version = 5
10489 type = 1
10490 err_type = 5
10491
10492 def __init__(self, xid=None, code=None, data=None):
10493 if xid != None:
10494 self.xid = xid
10495 else:
10496 self.xid = None
10497 if code != None:
10498 self.code = code
10499 else:
10500 self.code = 0
10501 if data != None:
10502 self.data = data
10503 else:
10504 self.data = ''
10505 return
10506
10507 def pack(self):
10508 packed = []
10509 packed.append(struct.pack("!B", self.version))
10510 packed.append(struct.pack("!B", self.type))
10511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10512 packed.append(struct.pack("!L", self.xid))
10513 packed.append(struct.pack("!H", self.err_type))
10514 packed.append(struct.pack("!H", self.code))
10515 packed.append(self.data)
10516 length = sum([len(x) for x in packed])
10517 packed[2] = struct.pack("!H", length)
10518 return ''.join(packed)
10519
10520 @staticmethod
10521 def unpack(reader):
10522 obj = flow_mod_failed_error_msg()
10523 _version = reader.read("!B")[0]
10524 assert(_version == 5)
10525 _type = reader.read("!B")[0]
10526 assert(_type == 1)
10527 _length = reader.read("!H")[0]
10528 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010529 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010530 obj.xid = reader.read("!L")[0]
10531 _err_type = reader.read("!H")[0]
10532 assert(_err_type == 5)
10533 obj.code = reader.read("!H")[0]
10534 obj.data = str(reader.read_all())
10535 return obj
10536
10537 def __eq__(self, other):
10538 if type(self) != type(other): return False
10539 if self.xid != other.xid: return False
10540 if self.code != other.code: return False
10541 if self.data != other.data: return False
10542 return True
10543
10544 def pretty_print(self, q):
10545 q.text("flow_mod_failed_error_msg {")
10546 with q.group():
10547 with q.indent(2):
10548 q.breakable()
10549 q.text("xid = ");
10550 if self.xid != None:
10551 q.text("%#x" % self.xid)
10552 else:
10553 q.text('None')
10554 q.text(","); q.breakable()
10555 q.text("code = ");
10556 q.text("%#x" % self.code)
10557 q.text(","); q.breakable()
10558 q.text("data = ");
10559 q.pp(self.data)
10560 q.breakable()
10561 q.text('}')
10562
10563error_msg.subtypes[5] = flow_mod_failed_error_msg
10564
10565class flow_modify(flow_mod):
10566 version = 5
10567 type = 14
10568 _command = 1
10569
10570 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):
10571 if xid != None:
10572 self.xid = xid
10573 else:
10574 self.xid = None
10575 if cookie != None:
10576 self.cookie = cookie
10577 else:
10578 self.cookie = 0
10579 if cookie_mask != None:
10580 self.cookie_mask = cookie_mask
10581 else:
10582 self.cookie_mask = 0
10583 if table_id != None:
10584 self.table_id = table_id
10585 else:
10586 self.table_id = 0
10587 if idle_timeout != None:
10588 self.idle_timeout = idle_timeout
10589 else:
10590 self.idle_timeout = 0
10591 if hard_timeout != None:
10592 self.hard_timeout = hard_timeout
10593 else:
10594 self.hard_timeout = 0
10595 if priority != None:
10596 self.priority = priority
10597 else:
10598 self.priority = 0
10599 if buffer_id != None:
10600 self.buffer_id = buffer_id
10601 else:
10602 self.buffer_id = 0
10603 if out_port != None:
10604 self.out_port = out_port
10605 else:
10606 self.out_port = 0
10607 if out_group != None:
10608 self.out_group = out_group
10609 else:
10610 self.out_group = 0
10611 if flags != None:
10612 self.flags = flags
10613 else:
10614 self.flags = 0
10615 if importance != None:
10616 self.importance = importance
10617 else:
10618 self.importance = 0
10619 if match != None:
10620 self.match = match
10621 else:
10622 self.match = common.match()
10623 if instructions != None:
10624 self.instructions = instructions
10625 else:
10626 self.instructions = []
10627 return
10628
10629 def pack(self):
10630 packed = []
10631 packed.append(struct.pack("!B", self.version))
10632 packed.append(struct.pack("!B", self.type))
10633 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10634 packed.append(struct.pack("!L", self.xid))
10635 packed.append(struct.pack("!Q", self.cookie))
10636 packed.append(struct.pack("!Q", self.cookie_mask))
10637 packed.append(struct.pack("!B", self.table_id))
10638 packed.append(util.pack_fm_cmd(self._command))
10639 packed.append(struct.pack("!H", self.idle_timeout))
10640 packed.append(struct.pack("!H", self.hard_timeout))
10641 packed.append(struct.pack("!H", self.priority))
10642 packed.append(struct.pack("!L", self.buffer_id))
10643 packed.append(util.pack_port_no(self.out_port))
10644 packed.append(struct.pack("!L", self.out_group))
10645 packed.append(struct.pack("!H", self.flags))
10646 packed.append(struct.pack("!H", self.importance))
10647 packed.append(self.match.pack())
10648 packed.append(loxi.generic_util.pack_list(self.instructions))
10649 length = sum([len(x) for x in packed])
10650 packed[2] = struct.pack("!H", length)
10651 return ''.join(packed)
10652
10653 @staticmethod
10654 def unpack(reader):
10655 obj = flow_modify()
10656 _version = reader.read("!B")[0]
10657 assert(_version == 5)
10658 _type = reader.read("!B")[0]
10659 assert(_type == 14)
10660 _length = reader.read("!H")[0]
10661 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010662 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010663 obj.xid = reader.read("!L")[0]
10664 obj.cookie = reader.read("!Q")[0]
10665 obj.cookie_mask = reader.read("!Q")[0]
10666 obj.table_id = reader.read("!B")[0]
10667 __command = util.unpack_fm_cmd(reader)
10668 assert(__command == 1)
10669 obj.idle_timeout = reader.read("!H")[0]
10670 obj.hard_timeout = reader.read("!H")[0]
10671 obj.priority = reader.read("!H")[0]
10672 obj.buffer_id = reader.read("!L")[0]
10673 obj.out_port = util.unpack_port_no(reader)
10674 obj.out_group = reader.read("!L")[0]
10675 obj.flags = reader.read("!H")[0]
10676 obj.importance = reader.read("!H")[0]
10677 obj.match = common.match.unpack(reader)
10678 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10679 return obj
10680
10681 def __eq__(self, other):
10682 if type(self) != type(other): return False
10683 if self.xid != other.xid: return False
10684 if self.cookie != other.cookie: return False
10685 if self.cookie_mask != other.cookie_mask: return False
10686 if self.table_id != other.table_id: return False
10687 if self.idle_timeout != other.idle_timeout: return False
10688 if self.hard_timeout != other.hard_timeout: return False
10689 if self.priority != other.priority: return False
10690 if self.buffer_id != other.buffer_id: return False
10691 if self.out_port != other.out_port: return False
10692 if self.out_group != other.out_group: return False
10693 if self.flags != other.flags: return False
10694 if self.importance != other.importance: return False
10695 if self.match != other.match: return False
10696 if self.instructions != other.instructions: return False
10697 return True
10698
10699 def pretty_print(self, q):
10700 q.text("flow_modify {")
10701 with q.group():
10702 with q.indent(2):
10703 q.breakable()
10704 q.text("xid = ");
10705 if self.xid != None:
10706 q.text("%#x" % self.xid)
10707 else:
10708 q.text('None')
10709 q.text(","); q.breakable()
10710 q.text("cookie = ");
10711 q.text("%#x" % self.cookie)
10712 q.text(","); q.breakable()
10713 q.text("cookie_mask = ");
10714 q.text("%#x" % self.cookie_mask)
10715 q.text(","); q.breakable()
10716 q.text("table_id = ");
10717 q.text("%#x" % self.table_id)
10718 q.text(","); q.breakable()
10719 q.text("idle_timeout = ");
10720 q.text("%#x" % self.idle_timeout)
10721 q.text(","); q.breakable()
10722 q.text("hard_timeout = ");
10723 q.text("%#x" % self.hard_timeout)
10724 q.text(","); q.breakable()
10725 q.text("priority = ");
10726 q.text("%#x" % self.priority)
10727 q.text(","); q.breakable()
10728 q.text("buffer_id = ");
10729 q.text("%#x" % self.buffer_id)
10730 q.text(","); q.breakable()
10731 q.text("out_port = ");
10732 q.text(util.pretty_port(self.out_port))
10733 q.text(","); q.breakable()
10734 q.text("out_group = ");
10735 q.text("%#x" % self.out_group)
10736 q.text(","); q.breakable()
10737 q.text("flags = ");
10738 q.text("%#x" % self.flags)
10739 q.text(","); q.breakable()
10740 q.text("importance = ");
10741 q.text("%#x" % self.importance)
10742 q.text(","); q.breakable()
10743 q.text("match = ");
10744 q.pp(self.match)
10745 q.text(","); q.breakable()
10746 q.text("instructions = ");
10747 q.pp(self.instructions)
10748 q.breakable()
10749 q.text('}')
10750
10751flow_mod.subtypes[1] = flow_modify
10752
10753class flow_modify_strict(flow_mod):
10754 version = 5
10755 type = 14
10756 _command = 2
10757
10758 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):
10759 if xid != None:
10760 self.xid = xid
10761 else:
10762 self.xid = None
10763 if cookie != None:
10764 self.cookie = cookie
10765 else:
10766 self.cookie = 0
10767 if cookie_mask != None:
10768 self.cookie_mask = cookie_mask
10769 else:
10770 self.cookie_mask = 0
10771 if table_id != None:
10772 self.table_id = table_id
10773 else:
10774 self.table_id = 0
10775 if idle_timeout != None:
10776 self.idle_timeout = idle_timeout
10777 else:
10778 self.idle_timeout = 0
10779 if hard_timeout != None:
10780 self.hard_timeout = hard_timeout
10781 else:
10782 self.hard_timeout = 0
10783 if priority != None:
10784 self.priority = priority
10785 else:
10786 self.priority = 0
10787 if buffer_id != None:
10788 self.buffer_id = buffer_id
10789 else:
10790 self.buffer_id = 0
10791 if out_port != None:
10792 self.out_port = out_port
10793 else:
10794 self.out_port = 0
10795 if out_group != None:
10796 self.out_group = out_group
10797 else:
10798 self.out_group = 0
10799 if flags != None:
10800 self.flags = flags
10801 else:
10802 self.flags = 0
10803 if importance != None:
10804 self.importance = importance
10805 else:
10806 self.importance = 0
10807 if match != None:
10808 self.match = match
10809 else:
10810 self.match = common.match()
10811 if instructions != None:
10812 self.instructions = instructions
10813 else:
10814 self.instructions = []
10815 return
10816
10817 def pack(self):
10818 packed = []
10819 packed.append(struct.pack("!B", self.version))
10820 packed.append(struct.pack("!B", self.type))
10821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10822 packed.append(struct.pack("!L", self.xid))
10823 packed.append(struct.pack("!Q", self.cookie))
10824 packed.append(struct.pack("!Q", self.cookie_mask))
10825 packed.append(struct.pack("!B", self.table_id))
10826 packed.append(util.pack_fm_cmd(self._command))
10827 packed.append(struct.pack("!H", self.idle_timeout))
10828 packed.append(struct.pack("!H", self.hard_timeout))
10829 packed.append(struct.pack("!H", self.priority))
10830 packed.append(struct.pack("!L", self.buffer_id))
10831 packed.append(util.pack_port_no(self.out_port))
10832 packed.append(struct.pack("!L", self.out_group))
10833 packed.append(struct.pack("!H", self.flags))
10834 packed.append(struct.pack("!H", self.importance))
10835 packed.append(self.match.pack())
10836 packed.append(loxi.generic_util.pack_list(self.instructions))
10837 length = sum([len(x) for x in packed])
10838 packed[2] = struct.pack("!H", length)
10839 return ''.join(packed)
10840
10841 @staticmethod
10842 def unpack(reader):
10843 obj = flow_modify_strict()
10844 _version = reader.read("!B")[0]
10845 assert(_version == 5)
10846 _type = reader.read("!B")[0]
10847 assert(_type == 14)
10848 _length = reader.read("!H")[0]
10849 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010850 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010851 obj.xid = reader.read("!L")[0]
10852 obj.cookie = reader.read("!Q")[0]
10853 obj.cookie_mask = reader.read("!Q")[0]
10854 obj.table_id = reader.read("!B")[0]
10855 __command = util.unpack_fm_cmd(reader)
10856 assert(__command == 2)
10857 obj.idle_timeout = reader.read("!H")[0]
10858 obj.hard_timeout = reader.read("!H")[0]
10859 obj.priority = reader.read("!H")[0]
10860 obj.buffer_id = reader.read("!L")[0]
10861 obj.out_port = util.unpack_port_no(reader)
10862 obj.out_group = reader.read("!L")[0]
10863 obj.flags = reader.read("!H")[0]
10864 obj.importance = reader.read("!H")[0]
10865 obj.match = common.match.unpack(reader)
10866 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10867 return obj
10868
10869 def __eq__(self, other):
10870 if type(self) != type(other): return False
10871 if self.xid != other.xid: return False
10872 if self.cookie != other.cookie: return False
10873 if self.cookie_mask != other.cookie_mask: return False
10874 if self.table_id != other.table_id: return False
10875 if self.idle_timeout != other.idle_timeout: return False
10876 if self.hard_timeout != other.hard_timeout: return False
10877 if self.priority != other.priority: return False
10878 if self.buffer_id != other.buffer_id: return False
10879 if self.out_port != other.out_port: return False
10880 if self.out_group != other.out_group: return False
10881 if self.flags != other.flags: return False
10882 if self.importance != other.importance: return False
10883 if self.match != other.match: return False
10884 if self.instructions != other.instructions: return False
10885 return True
10886
10887 def pretty_print(self, q):
10888 q.text("flow_modify_strict {")
10889 with q.group():
10890 with q.indent(2):
10891 q.breakable()
10892 q.text("xid = ");
10893 if self.xid != None:
10894 q.text("%#x" % self.xid)
10895 else:
10896 q.text('None')
10897 q.text(","); q.breakable()
10898 q.text("cookie = ");
10899 q.text("%#x" % self.cookie)
10900 q.text(","); q.breakable()
10901 q.text("cookie_mask = ");
10902 q.text("%#x" % self.cookie_mask)
10903 q.text(","); q.breakable()
10904 q.text("table_id = ");
10905 q.text("%#x" % self.table_id)
10906 q.text(","); q.breakable()
10907 q.text("idle_timeout = ");
10908 q.text("%#x" % self.idle_timeout)
10909 q.text(","); q.breakable()
10910 q.text("hard_timeout = ");
10911 q.text("%#x" % self.hard_timeout)
10912 q.text(","); q.breakable()
10913 q.text("priority = ");
10914 q.text("%#x" % self.priority)
10915 q.text(","); q.breakable()
10916 q.text("buffer_id = ");
10917 q.text("%#x" % self.buffer_id)
10918 q.text(","); q.breakable()
10919 q.text("out_port = ");
10920 q.text(util.pretty_port(self.out_port))
10921 q.text(","); q.breakable()
10922 q.text("out_group = ");
10923 q.text("%#x" % self.out_group)
10924 q.text(","); q.breakable()
10925 q.text("flags = ");
10926 q.text("%#x" % self.flags)
10927 q.text(","); q.breakable()
10928 q.text("importance = ");
10929 q.text("%#x" % self.importance)
10930 q.text(","); q.breakable()
10931 q.text("match = ");
10932 q.pp(self.match)
10933 q.text(","); q.breakable()
10934 q.text("instructions = ");
10935 q.pp(self.instructions)
10936 q.breakable()
10937 q.text('}')
10938
10939flow_mod.subtypes[2] = flow_modify_strict
10940
Rich Laneccd32ed2014-11-10 17:48:24 -080010941class flow_monitor_failed_error_msg(error_msg):
10942 version = 5
10943 type = 1
10944 err_type = 16
10945
10946 def __init__(self, xid=None, code=None, data=None):
10947 if xid != None:
10948 self.xid = xid
10949 else:
10950 self.xid = None
10951 if code != None:
10952 self.code = code
10953 else:
10954 self.code = 0
10955 if data != None:
10956 self.data = data
10957 else:
10958 self.data = ''
10959 return
10960
10961 def pack(self):
10962 packed = []
10963 packed.append(struct.pack("!B", self.version))
10964 packed.append(struct.pack("!B", self.type))
10965 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10966 packed.append(struct.pack("!L", self.xid))
10967 packed.append(struct.pack("!H", self.err_type))
10968 packed.append(struct.pack("!H", self.code))
10969 packed.append(self.data)
10970 length = sum([len(x) for x in packed])
10971 packed[2] = struct.pack("!H", length)
10972 return ''.join(packed)
10973
10974 @staticmethod
10975 def unpack(reader):
10976 obj = flow_monitor_failed_error_msg()
10977 _version = reader.read("!B")[0]
10978 assert(_version == 5)
10979 _type = reader.read("!B")[0]
10980 assert(_type == 1)
10981 _length = reader.read("!H")[0]
10982 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010983 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -080010984 obj.xid = reader.read("!L")[0]
10985 _err_type = reader.read("!H")[0]
10986 assert(_err_type == 16)
10987 obj.code = reader.read("!H")[0]
10988 obj.data = str(reader.read_all())
10989 return obj
10990
10991 def __eq__(self, other):
10992 if type(self) != type(other): return False
10993 if self.xid != other.xid: return False
10994 if self.code != other.code: return False
10995 if self.data != other.data: return False
10996 return True
10997
10998 def pretty_print(self, q):
10999 q.text("flow_monitor_failed_error_msg {")
11000 with q.group():
11001 with q.indent(2):
11002 q.breakable()
11003 q.text("xid = ");
11004 if self.xid != None:
11005 q.text("%#x" % self.xid)
11006 else:
11007 q.text('None')
11008 q.text(","); q.breakable()
11009 q.text("code = ");
11010 q.text("%#x" % self.code)
11011 q.text(","); q.breakable()
11012 q.text("data = ");
11013 q.pp(self.data)
11014 q.breakable()
11015 q.text('}')
11016
11017error_msg.subtypes[16] = flow_monitor_failed_error_msg
11018
Rich Lane2e079da2014-10-29 15:30:24 -070011019class flow_removed(message):
11020 version = 5
11021 type = 11
11022
11023 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):
11024 if xid != None:
11025 self.xid = xid
11026 else:
11027 self.xid = None
11028 if cookie != None:
11029 self.cookie = cookie
11030 else:
11031 self.cookie = 0
11032 if priority != None:
11033 self.priority = priority
11034 else:
11035 self.priority = 0
11036 if reason != None:
11037 self.reason = reason
11038 else:
11039 self.reason = 0
11040 if table_id != None:
11041 self.table_id = table_id
11042 else:
11043 self.table_id = 0
11044 if duration_sec != None:
11045 self.duration_sec = duration_sec
11046 else:
11047 self.duration_sec = 0
11048 if duration_nsec != None:
11049 self.duration_nsec = duration_nsec
11050 else:
11051 self.duration_nsec = 0
11052 if idle_timeout != None:
11053 self.idle_timeout = idle_timeout
11054 else:
11055 self.idle_timeout = 0
11056 if hard_timeout != None:
11057 self.hard_timeout = hard_timeout
11058 else:
11059 self.hard_timeout = 0
11060 if packet_count != None:
11061 self.packet_count = packet_count
11062 else:
11063 self.packet_count = 0
11064 if byte_count != None:
11065 self.byte_count = byte_count
11066 else:
11067 self.byte_count = 0
11068 if match != None:
11069 self.match = match
11070 else:
11071 self.match = common.match()
11072 return
11073
11074 def pack(self):
11075 packed = []
11076 packed.append(struct.pack("!B", self.version))
11077 packed.append(struct.pack("!B", self.type))
11078 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11079 packed.append(struct.pack("!L", self.xid))
11080 packed.append(struct.pack("!Q", self.cookie))
11081 packed.append(struct.pack("!H", self.priority))
11082 packed.append(struct.pack("!B", self.reason))
11083 packed.append(struct.pack("!B", self.table_id))
11084 packed.append(struct.pack("!L", self.duration_sec))
11085 packed.append(struct.pack("!L", self.duration_nsec))
11086 packed.append(struct.pack("!H", self.idle_timeout))
11087 packed.append(struct.pack("!H", self.hard_timeout))
11088 packed.append(struct.pack("!Q", self.packet_count))
11089 packed.append(struct.pack("!Q", self.byte_count))
11090 packed.append(self.match.pack())
11091 length = sum([len(x) for x in packed])
11092 packed[2] = struct.pack("!H", length)
11093 return ''.join(packed)
11094
11095 @staticmethod
11096 def unpack(reader):
11097 obj = flow_removed()
11098 _version = reader.read("!B")[0]
11099 assert(_version == 5)
11100 _type = reader.read("!B")[0]
11101 assert(_type == 11)
11102 _length = reader.read("!H")[0]
11103 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011104 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011105 obj.xid = reader.read("!L")[0]
11106 obj.cookie = reader.read("!Q")[0]
11107 obj.priority = reader.read("!H")[0]
11108 obj.reason = reader.read("!B")[0]
11109 obj.table_id = reader.read("!B")[0]
11110 obj.duration_sec = reader.read("!L")[0]
11111 obj.duration_nsec = reader.read("!L")[0]
11112 obj.idle_timeout = reader.read("!H")[0]
11113 obj.hard_timeout = reader.read("!H")[0]
11114 obj.packet_count = reader.read("!Q")[0]
11115 obj.byte_count = reader.read("!Q")[0]
11116 obj.match = common.match.unpack(reader)
11117 return obj
11118
11119 def __eq__(self, other):
11120 if type(self) != type(other): return False
11121 if self.xid != other.xid: return False
11122 if self.cookie != other.cookie: return False
11123 if self.priority != other.priority: return False
11124 if self.reason != other.reason: return False
11125 if self.table_id != other.table_id: return False
11126 if self.duration_sec != other.duration_sec: return False
11127 if self.duration_nsec != other.duration_nsec: return False
11128 if self.idle_timeout != other.idle_timeout: return False
11129 if self.hard_timeout != other.hard_timeout: return False
11130 if self.packet_count != other.packet_count: return False
11131 if self.byte_count != other.byte_count: return False
11132 if self.match != other.match: return False
11133 return True
11134
11135 def pretty_print(self, q):
11136 q.text("flow_removed {")
11137 with q.group():
11138 with q.indent(2):
11139 q.breakable()
11140 q.text("xid = ");
11141 if self.xid != None:
11142 q.text("%#x" % self.xid)
11143 else:
11144 q.text('None')
11145 q.text(","); q.breakable()
11146 q.text("cookie = ");
11147 q.text("%#x" % self.cookie)
11148 q.text(","); q.breakable()
11149 q.text("priority = ");
11150 q.text("%#x" % self.priority)
11151 q.text(","); q.breakable()
11152 q.text("reason = ");
11153 q.text("%#x" % self.reason)
11154 q.text(","); q.breakable()
11155 q.text("table_id = ");
11156 q.text("%#x" % self.table_id)
11157 q.text(","); q.breakable()
11158 q.text("duration_sec = ");
11159 q.text("%#x" % self.duration_sec)
11160 q.text(","); q.breakable()
11161 q.text("duration_nsec = ");
11162 q.text("%#x" % self.duration_nsec)
11163 q.text(","); q.breakable()
11164 q.text("idle_timeout = ");
11165 q.text("%#x" % self.idle_timeout)
11166 q.text(","); q.breakable()
11167 q.text("hard_timeout = ");
11168 q.text("%#x" % self.hard_timeout)
11169 q.text(","); q.breakable()
11170 q.text("packet_count = ");
11171 q.text("%#x" % self.packet_count)
11172 q.text(","); q.breakable()
11173 q.text("byte_count = ");
11174 q.text("%#x" % self.byte_count)
11175 q.text(","); q.breakable()
11176 q.text("match = ");
11177 q.pp(self.match)
11178 q.breakable()
11179 q.text('}')
11180
11181message.subtypes[11] = flow_removed
11182
11183class flow_stats_reply(stats_reply):
11184 version = 5
11185 type = 19
11186 stats_type = 1
11187
11188 def __init__(self, xid=None, flags=None, entries=None):
11189 if xid != None:
11190 self.xid = xid
11191 else:
11192 self.xid = None
11193 if flags != None:
11194 self.flags = flags
11195 else:
11196 self.flags = 0
11197 if entries != None:
11198 self.entries = entries
11199 else:
11200 self.entries = []
11201 return
11202
11203 def pack(self):
11204 packed = []
11205 packed.append(struct.pack("!B", self.version))
11206 packed.append(struct.pack("!B", self.type))
11207 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11208 packed.append(struct.pack("!L", self.xid))
11209 packed.append(struct.pack("!H", self.stats_type))
11210 packed.append(struct.pack("!H", self.flags))
11211 packed.append('\x00' * 4)
11212 packed.append(loxi.generic_util.pack_list(self.entries))
11213 length = sum([len(x) for x in packed])
11214 packed[2] = struct.pack("!H", length)
11215 return ''.join(packed)
11216
11217 @staticmethod
11218 def unpack(reader):
11219 obj = flow_stats_reply()
11220 _version = reader.read("!B")[0]
11221 assert(_version == 5)
11222 _type = reader.read("!B")[0]
11223 assert(_type == 19)
11224 _length = reader.read("!H")[0]
11225 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011226 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011227 obj.xid = reader.read("!L")[0]
11228 _stats_type = reader.read("!H")[0]
11229 assert(_stats_type == 1)
11230 obj.flags = reader.read("!H")[0]
11231 reader.skip(4)
11232 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
11233 return obj
11234
11235 def __eq__(self, other):
11236 if type(self) != type(other): return False
11237 if self.xid != other.xid: return False
11238 if self.flags != other.flags: return False
11239 if self.entries != other.entries: return False
11240 return True
11241
11242 def pretty_print(self, q):
11243 q.text("flow_stats_reply {")
11244 with q.group():
11245 with q.indent(2):
11246 q.breakable()
11247 q.text("xid = ");
11248 if self.xid != None:
11249 q.text("%#x" % self.xid)
11250 else:
11251 q.text('None')
11252 q.text(","); q.breakable()
11253 q.text("flags = ");
11254 q.text("%#x" % self.flags)
11255 q.text(","); q.breakable()
11256 q.text("entries = ");
11257 q.pp(self.entries)
11258 q.breakable()
11259 q.text('}')
11260
11261stats_reply.subtypes[1] = flow_stats_reply
11262
11263class flow_stats_request(stats_request):
11264 version = 5
11265 type = 18
11266 stats_type = 1
11267
11268 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
11269 if xid != None:
11270 self.xid = xid
11271 else:
11272 self.xid = None
11273 if flags != None:
11274 self.flags = flags
11275 else:
11276 self.flags = 0
11277 if table_id != None:
11278 self.table_id = table_id
11279 else:
11280 self.table_id = 0
11281 if out_port != None:
11282 self.out_port = out_port
11283 else:
11284 self.out_port = 0
11285 if out_group != None:
11286 self.out_group = out_group
11287 else:
11288 self.out_group = 0
11289 if cookie != None:
11290 self.cookie = cookie
11291 else:
11292 self.cookie = 0
11293 if cookie_mask != None:
11294 self.cookie_mask = cookie_mask
11295 else:
11296 self.cookie_mask = 0
11297 if match != None:
11298 self.match = match
11299 else:
11300 self.match = common.match()
11301 return
11302
11303 def pack(self):
11304 packed = []
11305 packed.append(struct.pack("!B", self.version))
11306 packed.append(struct.pack("!B", self.type))
11307 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11308 packed.append(struct.pack("!L", self.xid))
11309 packed.append(struct.pack("!H", self.stats_type))
11310 packed.append(struct.pack("!H", self.flags))
11311 packed.append('\x00' * 4)
11312 packed.append(struct.pack("!B", self.table_id))
11313 packed.append('\x00' * 3)
11314 packed.append(util.pack_port_no(self.out_port))
11315 packed.append(struct.pack("!L", self.out_group))
11316 packed.append('\x00' * 4)
11317 packed.append(struct.pack("!Q", self.cookie))
11318 packed.append(struct.pack("!Q", self.cookie_mask))
11319 packed.append(self.match.pack())
11320 length = sum([len(x) for x in packed])
11321 packed[2] = struct.pack("!H", length)
11322 return ''.join(packed)
11323
11324 @staticmethod
11325 def unpack(reader):
11326 obj = flow_stats_request()
11327 _version = reader.read("!B")[0]
11328 assert(_version == 5)
11329 _type = reader.read("!B")[0]
11330 assert(_type == 18)
11331 _length = reader.read("!H")[0]
11332 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011333 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011334 obj.xid = reader.read("!L")[0]
11335 _stats_type = reader.read("!H")[0]
11336 assert(_stats_type == 1)
11337 obj.flags = reader.read("!H")[0]
11338 reader.skip(4)
11339 obj.table_id = reader.read("!B")[0]
11340 reader.skip(3)
11341 obj.out_port = util.unpack_port_no(reader)
11342 obj.out_group = reader.read("!L")[0]
11343 reader.skip(4)
11344 obj.cookie = reader.read("!Q")[0]
11345 obj.cookie_mask = reader.read("!Q")[0]
11346 obj.match = common.match.unpack(reader)
11347 return obj
11348
11349 def __eq__(self, other):
11350 if type(self) != type(other): return False
11351 if self.xid != other.xid: return False
11352 if self.flags != other.flags: return False
11353 if self.table_id != other.table_id: return False
11354 if self.out_port != other.out_port: return False
11355 if self.out_group != other.out_group: return False
11356 if self.cookie != other.cookie: return False
11357 if self.cookie_mask != other.cookie_mask: return False
11358 if self.match != other.match: return False
11359 return True
11360
11361 def pretty_print(self, q):
11362 q.text("flow_stats_request {")
11363 with q.group():
11364 with q.indent(2):
11365 q.breakable()
11366 q.text("xid = ");
11367 if self.xid != None:
11368 q.text("%#x" % self.xid)
11369 else:
11370 q.text('None')
11371 q.text(","); q.breakable()
11372 q.text("flags = ");
11373 q.text("%#x" % self.flags)
11374 q.text(","); q.breakable()
11375 q.text("table_id = ");
11376 q.text("%#x" % self.table_id)
11377 q.text(","); q.breakable()
11378 q.text("out_port = ");
11379 q.text(util.pretty_port(self.out_port))
11380 q.text(","); q.breakable()
11381 q.text("out_group = ");
11382 q.text("%#x" % self.out_group)
11383 q.text(","); q.breakable()
11384 q.text("cookie = ");
11385 q.text("%#x" % self.cookie)
11386 q.text(","); q.breakable()
11387 q.text("cookie_mask = ");
11388 q.text("%#x" % self.cookie_mask)
11389 q.text(","); q.breakable()
11390 q.text("match = ");
11391 q.pp(self.match)
11392 q.breakable()
11393 q.text('}')
11394
11395stats_request.subtypes[1] = flow_stats_request
11396
11397class get_config_reply(message):
11398 version = 5
11399 type = 8
11400
11401 def __init__(self, xid=None, flags=None, miss_send_len=None):
11402 if xid != None:
11403 self.xid = xid
11404 else:
11405 self.xid = None
11406 if flags != None:
11407 self.flags = flags
11408 else:
11409 self.flags = 0
11410 if miss_send_len != None:
11411 self.miss_send_len = miss_send_len
11412 else:
11413 self.miss_send_len = 0
11414 return
11415
11416 def pack(self):
11417 packed = []
11418 packed.append(struct.pack("!B", self.version))
11419 packed.append(struct.pack("!B", self.type))
11420 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11421 packed.append(struct.pack("!L", self.xid))
11422 packed.append(struct.pack("!H", self.flags))
11423 packed.append(struct.pack("!H", self.miss_send_len))
11424 length = sum([len(x) for x in packed])
11425 packed[2] = struct.pack("!H", length)
11426 return ''.join(packed)
11427
11428 @staticmethod
11429 def unpack(reader):
11430 obj = get_config_reply()
11431 _version = reader.read("!B")[0]
11432 assert(_version == 5)
11433 _type = reader.read("!B")[0]
11434 assert(_type == 8)
11435 _length = reader.read("!H")[0]
11436 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011437 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011438 obj.xid = reader.read("!L")[0]
11439 obj.flags = reader.read("!H")[0]
11440 obj.miss_send_len = reader.read("!H")[0]
11441 return obj
11442
11443 def __eq__(self, other):
11444 if type(self) != type(other): return False
11445 if self.xid != other.xid: return False
11446 if self.flags != other.flags: return False
11447 if self.miss_send_len != other.miss_send_len: return False
11448 return True
11449
11450 def pretty_print(self, q):
11451 q.text("get_config_reply {")
11452 with q.group():
11453 with q.indent(2):
11454 q.breakable()
11455 q.text("xid = ");
11456 if self.xid != None:
11457 q.text("%#x" % self.xid)
11458 else:
11459 q.text('None')
11460 q.text(","); q.breakable()
11461 q.text("flags = ");
11462 q.text("%#x" % self.flags)
11463 q.text(","); q.breakable()
11464 q.text("miss_send_len = ");
11465 q.text("%#x" % self.miss_send_len)
11466 q.breakable()
11467 q.text('}')
11468
11469message.subtypes[8] = get_config_reply
11470
11471class get_config_request(message):
11472 version = 5
11473 type = 7
11474
11475 def __init__(self, xid=None):
11476 if xid != None:
11477 self.xid = xid
11478 else:
11479 self.xid = None
11480 return
11481
11482 def pack(self):
11483 packed = []
11484 packed.append(struct.pack("!B", self.version))
11485 packed.append(struct.pack("!B", self.type))
11486 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11487 packed.append(struct.pack("!L", self.xid))
11488 length = sum([len(x) for x in packed])
11489 packed[2] = struct.pack("!H", length)
11490 return ''.join(packed)
11491
11492 @staticmethod
11493 def unpack(reader):
11494 obj = get_config_request()
11495 _version = reader.read("!B")[0]
11496 assert(_version == 5)
11497 _type = reader.read("!B")[0]
11498 assert(_type == 7)
11499 _length = reader.read("!H")[0]
11500 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011501 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011502 obj.xid = reader.read("!L")[0]
11503 return obj
11504
11505 def __eq__(self, other):
11506 if type(self) != type(other): return False
11507 if self.xid != other.xid: return False
11508 return True
11509
11510 def pretty_print(self, q):
11511 q.text("get_config_request {")
11512 with q.group():
11513 with q.indent(2):
11514 q.breakable()
11515 q.text("xid = ");
11516 if self.xid != None:
11517 q.text("%#x" % self.xid)
11518 else:
11519 q.text('None')
11520 q.breakable()
11521 q.text('}')
11522
11523message.subtypes[7] = get_config_request
11524
11525class group_mod(message):
11526 subtypes = {}
11527
11528 version = 5
11529 type = 15
11530
11531 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11532 if xid != None:
11533 self.xid = xid
11534 else:
11535 self.xid = None
11536 if command != None:
11537 self.command = command
11538 else:
11539 self.command = 0
11540 if group_type != None:
11541 self.group_type = group_type
11542 else:
11543 self.group_type = 0
11544 if group_id != None:
11545 self.group_id = group_id
11546 else:
11547 self.group_id = 0
11548 if buckets != None:
11549 self.buckets = buckets
11550 else:
11551 self.buckets = []
11552 return
11553
11554 def pack(self):
11555 packed = []
11556 packed.append(struct.pack("!B", self.version))
11557 packed.append(struct.pack("!B", self.type))
11558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11559 packed.append(struct.pack("!L", self.xid))
11560 packed.append(struct.pack("!H", self.command))
11561 packed.append(struct.pack("!B", self.group_type))
11562 packed.append('\x00' * 1)
11563 packed.append(struct.pack("!L", self.group_id))
11564 packed.append(loxi.generic_util.pack_list(self.buckets))
11565 length = sum([len(x) for x in packed])
11566 packed[2] = struct.pack("!H", length)
11567 return ''.join(packed)
11568
11569 @staticmethod
11570 def unpack(reader):
11571 subtype, = reader.peek('!H', 8)
11572 subclass = group_mod.subtypes.get(subtype)
11573 if subclass:
11574 return subclass.unpack(reader)
11575
11576 obj = group_mod()
11577 _version = reader.read("!B")[0]
11578 assert(_version == 5)
11579 _type = reader.read("!B")[0]
11580 assert(_type == 15)
11581 _length = reader.read("!H")[0]
11582 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011583 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011584 obj.xid = reader.read("!L")[0]
11585 obj.command = reader.read("!H")[0]
11586 obj.group_type = reader.read("!B")[0]
11587 reader.skip(1)
11588 obj.group_id = reader.read("!L")[0]
11589 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11590 return obj
11591
11592 def __eq__(self, other):
11593 if type(self) != type(other): return False
11594 if self.xid != other.xid: return False
11595 if self.command != other.command: return False
11596 if self.group_type != other.group_type: return False
11597 if self.group_id != other.group_id: return False
11598 if self.buckets != other.buckets: return False
11599 return True
11600
11601 def pretty_print(self, q):
11602 q.text("group_mod {")
11603 with q.group():
11604 with q.indent(2):
11605 q.breakable()
11606 q.text("xid = ");
11607 if self.xid != None:
11608 q.text("%#x" % self.xid)
11609 else:
11610 q.text('None')
11611 q.text(","); q.breakable()
11612 q.text("group_type = ");
11613 q.text("%#x" % self.group_type)
11614 q.text(","); q.breakable()
11615 q.text("group_id = ");
11616 q.text("%#x" % self.group_id)
11617 q.text(","); q.breakable()
11618 q.text("buckets = ");
11619 q.pp(self.buckets)
11620 q.breakable()
11621 q.text('}')
11622
11623message.subtypes[15] = group_mod
11624
11625class group_add(group_mod):
11626 version = 5
11627 type = 15
11628 command = 0
11629
11630 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11631 if xid != None:
11632 self.xid = xid
11633 else:
11634 self.xid = None
11635 if group_type != None:
11636 self.group_type = group_type
11637 else:
11638 self.group_type = 0
11639 if group_id != None:
11640 self.group_id = group_id
11641 else:
11642 self.group_id = 0
11643 if buckets != None:
11644 self.buckets = buckets
11645 else:
11646 self.buckets = []
11647 return
11648
11649 def pack(self):
11650 packed = []
11651 packed.append(struct.pack("!B", self.version))
11652 packed.append(struct.pack("!B", self.type))
11653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11654 packed.append(struct.pack("!L", self.xid))
11655 packed.append(struct.pack("!H", self.command))
11656 packed.append(struct.pack("!B", self.group_type))
11657 packed.append('\x00' * 1)
11658 packed.append(struct.pack("!L", self.group_id))
11659 packed.append(loxi.generic_util.pack_list(self.buckets))
11660 length = sum([len(x) for x in packed])
11661 packed[2] = struct.pack("!H", length)
11662 return ''.join(packed)
11663
11664 @staticmethod
11665 def unpack(reader):
11666 obj = group_add()
11667 _version = reader.read("!B")[0]
11668 assert(_version == 5)
11669 _type = reader.read("!B")[0]
11670 assert(_type == 15)
11671 _length = reader.read("!H")[0]
11672 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011673 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011674 obj.xid = reader.read("!L")[0]
11675 _command = reader.read("!H")[0]
11676 assert(_command == 0)
11677 obj.group_type = reader.read("!B")[0]
11678 reader.skip(1)
11679 obj.group_id = reader.read("!L")[0]
11680 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11681 return obj
11682
11683 def __eq__(self, other):
11684 if type(self) != type(other): return False
11685 if self.xid != other.xid: return False
11686 if self.group_type != other.group_type: return False
11687 if self.group_id != other.group_id: return False
11688 if self.buckets != other.buckets: return False
11689 return True
11690
11691 def pretty_print(self, q):
11692 q.text("group_add {")
11693 with q.group():
11694 with q.indent(2):
11695 q.breakable()
11696 q.text("xid = ");
11697 if self.xid != None:
11698 q.text("%#x" % self.xid)
11699 else:
11700 q.text('None')
11701 q.text(","); q.breakable()
11702 q.text("group_type = ");
11703 q.text("%#x" % self.group_type)
11704 q.text(","); q.breakable()
11705 q.text("group_id = ");
11706 q.text("%#x" % self.group_id)
11707 q.text(","); q.breakable()
11708 q.text("buckets = ");
11709 q.pp(self.buckets)
11710 q.breakable()
11711 q.text('}')
11712
11713group_mod.subtypes[0] = group_add
11714
11715class group_delete(group_mod):
11716 version = 5
11717 type = 15
11718 command = 2
11719
11720 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11721 if xid != None:
11722 self.xid = xid
11723 else:
11724 self.xid = None
11725 if group_type != None:
11726 self.group_type = group_type
11727 else:
11728 self.group_type = 0
11729 if group_id != None:
11730 self.group_id = group_id
11731 else:
11732 self.group_id = 0
11733 if buckets != None:
11734 self.buckets = buckets
11735 else:
11736 self.buckets = []
11737 return
11738
11739 def pack(self):
11740 packed = []
11741 packed.append(struct.pack("!B", self.version))
11742 packed.append(struct.pack("!B", self.type))
11743 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11744 packed.append(struct.pack("!L", self.xid))
11745 packed.append(struct.pack("!H", self.command))
11746 packed.append(struct.pack("!B", self.group_type))
11747 packed.append('\x00' * 1)
11748 packed.append(struct.pack("!L", self.group_id))
11749 packed.append(loxi.generic_util.pack_list(self.buckets))
11750 length = sum([len(x) for x in packed])
11751 packed[2] = struct.pack("!H", length)
11752 return ''.join(packed)
11753
11754 @staticmethod
11755 def unpack(reader):
11756 obj = group_delete()
11757 _version = reader.read("!B")[0]
11758 assert(_version == 5)
11759 _type = reader.read("!B")[0]
11760 assert(_type == 15)
11761 _length = reader.read("!H")[0]
11762 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011763 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011764 obj.xid = reader.read("!L")[0]
11765 _command = reader.read("!H")[0]
11766 assert(_command == 2)
11767 obj.group_type = reader.read("!B")[0]
11768 reader.skip(1)
11769 obj.group_id = reader.read("!L")[0]
11770 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11771 return obj
11772
11773 def __eq__(self, other):
11774 if type(self) != type(other): return False
11775 if self.xid != other.xid: return False
11776 if self.group_type != other.group_type: return False
11777 if self.group_id != other.group_id: return False
11778 if self.buckets != other.buckets: return False
11779 return True
11780
11781 def pretty_print(self, q):
11782 q.text("group_delete {")
11783 with q.group():
11784 with q.indent(2):
11785 q.breakable()
11786 q.text("xid = ");
11787 if self.xid != None:
11788 q.text("%#x" % self.xid)
11789 else:
11790 q.text('None')
11791 q.text(","); q.breakable()
11792 q.text("group_type = ");
11793 q.text("%#x" % self.group_type)
11794 q.text(","); q.breakable()
11795 q.text("group_id = ");
11796 q.text("%#x" % self.group_id)
11797 q.text(","); q.breakable()
11798 q.text("buckets = ");
11799 q.pp(self.buckets)
11800 q.breakable()
11801 q.text('}')
11802
11803group_mod.subtypes[2] = group_delete
11804
11805class group_desc_stats_reply(stats_reply):
11806 version = 5
11807 type = 19
11808 stats_type = 7
11809
11810 def __init__(self, xid=None, flags=None, entries=None):
11811 if xid != None:
11812 self.xid = xid
11813 else:
11814 self.xid = None
11815 if flags != None:
11816 self.flags = flags
11817 else:
11818 self.flags = 0
11819 if entries != None:
11820 self.entries = entries
11821 else:
11822 self.entries = []
11823 return
11824
11825 def pack(self):
11826 packed = []
11827 packed.append(struct.pack("!B", self.version))
11828 packed.append(struct.pack("!B", self.type))
11829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11830 packed.append(struct.pack("!L", self.xid))
11831 packed.append(struct.pack("!H", self.stats_type))
11832 packed.append(struct.pack("!H", self.flags))
11833 packed.append('\x00' * 4)
11834 packed.append(loxi.generic_util.pack_list(self.entries))
11835 length = sum([len(x) for x in packed])
11836 packed[2] = struct.pack("!H", length)
11837 return ''.join(packed)
11838
11839 @staticmethod
11840 def unpack(reader):
11841 obj = group_desc_stats_reply()
11842 _version = reader.read("!B")[0]
11843 assert(_version == 5)
11844 _type = reader.read("!B")[0]
11845 assert(_type == 19)
11846 _length = reader.read("!H")[0]
11847 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011848 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011849 obj.xid = reader.read("!L")[0]
11850 _stats_type = reader.read("!H")[0]
11851 assert(_stats_type == 7)
11852 obj.flags = reader.read("!H")[0]
11853 reader.skip(4)
11854 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
11855 return obj
11856
11857 def __eq__(self, other):
11858 if type(self) != type(other): return False
11859 if self.xid != other.xid: return False
11860 if self.flags != other.flags: return False
11861 if self.entries != other.entries: return False
11862 return True
11863
11864 def pretty_print(self, q):
11865 q.text("group_desc_stats_reply {")
11866 with q.group():
11867 with q.indent(2):
11868 q.breakable()
11869 q.text("xid = ");
11870 if self.xid != None:
11871 q.text("%#x" % self.xid)
11872 else:
11873 q.text('None')
11874 q.text(","); q.breakable()
11875 q.text("flags = ");
11876 q.text("%#x" % self.flags)
11877 q.text(","); q.breakable()
11878 q.text("entries = ");
11879 q.pp(self.entries)
11880 q.breakable()
11881 q.text('}')
11882
11883stats_reply.subtypes[7] = group_desc_stats_reply
11884
11885class group_desc_stats_request(stats_request):
11886 version = 5
11887 type = 18
11888 stats_type = 7
11889
11890 def __init__(self, xid=None, flags=None):
11891 if xid != None:
11892 self.xid = xid
11893 else:
11894 self.xid = None
11895 if flags != None:
11896 self.flags = flags
11897 else:
11898 self.flags = 0
11899 return
11900
11901 def pack(self):
11902 packed = []
11903 packed.append(struct.pack("!B", self.version))
11904 packed.append(struct.pack("!B", self.type))
11905 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11906 packed.append(struct.pack("!L", self.xid))
11907 packed.append(struct.pack("!H", self.stats_type))
11908 packed.append(struct.pack("!H", self.flags))
11909 packed.append('\x00' * 4)
11910 length = sum([len(x) for x in packed])
11911 packed[2] = struct.pack("!H", length)
11912 return ''.join(packed)
11913
11914 @staticmethod
11915 def unpack(reader):
11916 obj = group_desc_stats_request()
11917 _version = reader.read("!B")[0]
11918 assert(_version == 5)
11919 _type = reader.read("!B")[0]
11920 assert(_type == 18)
11921 _length = reader.read("!H")[0]
11922 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011923 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011924 obj.xid = reader.read("!L")[0]
11925 _stats_type = reader.read("!H")[0]
11926 assert(_stats_type == 7)
11927 obj.flags = reader.read("!H")[0]
11928 reader.skip(4)
11929 return obj
11930
11931 def __eq__(self, other):
11932 if type(self) != type(other): return False
11933 if self.xid != other.xid: return False
11934 if self.flags != other.flags: return False
11935 return True
11936
11937 def pretty_print(self, q):
11938 q.text("group_desc_stats_request {")
11939 with q.group():
11940 with q.indent(2):
11941 q.breakable()
11942 q.text("xid = ");
11943 if self.xid != None:
11944 q.text("%#x" % self.xid)
11945 else:
11946 q.text('None')
11947 q.text(","); q.breakable()
11948 q.text("flags = ");
11949 q.text("%#x" % self.flags)
11950 q.breakable()
11951 q.text('}')
11952
11953stats_request.subtypes[7] = group_desc_stats_request
11954
11955class group_features_stats_reply(stats_reply):
11956 version = 5
11957 type = 19
11958 stats_type = 8
11959
11960 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):
11961 if xid != None:
11962 self.xid = xid
11963 else:
11964 self.xid = None
11965 if flags != None:
11966 self.flags = flags
11967 else:
11968 self.flags = 0
11969 if types != None:
11970 self.types = types
11971 else:
11972 self.types = 0
11973 if capabilities != None:
11974 self.capabilities = capabilities
11975 else:
11976 self.capabilities = 0
11977 if max_groups_all != None:
11978 self.max_groups_all = max_groups_all
11979 else:
11980 self.max_groups_all = 0
11981 if max_groups_select != None:
11982 self.max_groups_select = max_groups_select
11983 else:
11984 self.max_groups_select = 0
11985 if max_groups_indirect != None:
11986 self.max_groups_indirect = max_groups_indirect
11987 else:
11988 self.max_groups_indirect = 0
11989 if max_groups_ff != None:
11990 self.max_groups_ff = max_groups_ff
11991 else:
11992 self.max_groups_ff = 0
11993 if actions_all != None:
11994 self.actions_all = actions_all
11995 else:
11996 self.actions_all = 0
11997 if actions_select != None:
11998 self.actions_select = actions_select
11999 else:
12000 self.actions_select = 0
12001 if actions_indirect != None:
12002 self.actions_indirect = actions_indirect
12003 else:
12004 self.actions_indirect = 0
12005 if actions_ff != None:
12006 self.actions_ff = actions_ff
12007 else:
12008 self.actions_ff = 0
12009 return
12010
12011 def pack(self):
12012 packed = []
12013 packed.append(struct.pack("!B", self.version))
12014 packed.append(struct.pack("!B", self.type))
12015 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12016 packed.append(struct.pack("!L", self.xid))
12017 packed.append(struct.pack("!H", self.stats_type))
12018 packed.append(struct.pack("!H", self.flags))
12019 packed.append('\x00' * 4)
12020 packed.append(struct.pack("!L", self.types))
12021 packed.append(struct.pack("!L", self.capabilities))
12022 packed.append(struct.pack("!L", self.max_groups_all))
12023 packed.append(struct.pack("!L", self.max_groups_select))
12024 packed.append(struct.pack("!L", self.max_groups_indirect))
12025 packed.append(struct.pack("!L", self.max_groups_ff))
12026 packed.append(struct.pack("!L", self.actions_all))
12027 packed.append(struct.pack("!L", self.actions_select))
12028 packed.append(struct.pack("!L", self.actions_indirect))
12029 packed.append(struct.pack("!L", self.actions_ff))
12030 length = sum([len(x) for x in packed])
12031 packed[2] = struct.pack("!H", length)
12032 return ''.join(packed)
12033
12034 @staticmethod
12035 def unpack(reader):
12036 obj = group_features_stats_reply()
12037 _version = reader.read("!B")[0]
12038 assert(_version == 5)
12039 _type = reader.read("!B")[0]
12040 assert(_type == 19)
12041 _length = reader.read("!H")[0]
12042 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012043 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012044 obj.xid = reader.read("!L")[0]
12045 _stats_type = reader.read("!H")[0]
12046 assert(_stats_type == 8)
12047 obj.flags = reader.read("!H")[0]
12048 reader.skip(4)
12049 obj.types = reader.read("!L")[0]
12050 obj.capabilities = reader.read("!L")[0]
12051 obj.max_groups_all = reader.read("!L")[0]
12052 obj.max_groups_select = reader.read("!L")[0]
12053 obj.max_groups_indirect = reader.read("!L")[0]
12054 obj.max_groups_ff = reader.read("!L")[0]
12055 obj.actions_all = reader.read("!L")[0]
12056 obj.actions_select = reader.read("!L")[0]
12057 obj.actions_indirect = reader.read("!L")[0]
12058 obj.actions_ff = reader.read("!L")[0]
12059 return obj
12060
12061 def __eq__(self, other):
12062 if type(self) != type(other): return False
12063 if self.xid != other.xid: return False
12064 if self.flags != other.flags: return False
12065 if self.types != other.types: return False
12066 if self.capabilities != other.capabilities: return False
12067 if self.max_groups_all != other.max_groups_all: return False
12068 if self.max_groups_select != other.max_groups_select: return False
12069 if self.max_groups_indirect != other.max_groups_indirect: return False
12070 if self.max_groups_ff != other.max_groups_ff: return False
12071 if self.actions_all != other.actions_all: return False
12072 if self.actions_select != other.actions_select: return False
12073 if self.actions_indirect != other.actions_indirect: return False
12074 if self.actions_ff != other.actions_ff: return False
12075 return True
12076
12077 def pretty_print(self, q):
12078 q.text("group_features_stats_reply {")
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("flags = ");
12089 q.text("%#x" % self.flags)
12090 q.text(","); q.breakable()
12091 q.text("types = ");
12092 q.text("%#x" % self.types)
12093 q.text(","); q.breakable()
12094 q.text("capabilities = ");
12095 q.text("%#x" % self.capabilities)
12096 q.text(","); q.breakable()
12097 q.text("max_groups_all = ");
12098 q.text("%#x" % self.max_groups_all)
12099 q.text(","); q.breakable()
12100 q.text("max_groups_select = ");
12101 q.text("%#x" % self.max_groups_select)
12102 q.text(","); q.breakable()
12103 q.text("max_groups_indirect = ");
12104 q.text("%#x" % self.max_groups_indirect)
12105 q.text(","); q.breakable()
12106 q.text("max_groups_ff = ");
12107 q.text("%#x" % self.max_groups_ff)
12108 q.text(","); q.breakable()
12109 q.text("actions_all = ");
12110 q.text("%#x" % self.actions_all)
12111 q.text(","); q.breakable()
12112 q.text("actions_select = ");
12113 q.text("%#x" % self.actions_select)
12114 q.text(","); q.breakable()
12115 q.text("actions_indirect = ");
12116 q.text("%#x" % self.actions_indirect)
12117 q.text(","); q.breakable()
12118 q.text("actions_ff = ");
12119 q.text("%#x" % self.actions_ff)
12120 q.breakable()
12121 q.text('}')
12122
12123stats_reply.subtypes[8] = group_features_stats_reply
12124
12125class group_features_stats_request(stats_request):
12126 version = 5
12127 type = 18
12128 stats_type = 8
12129
12130 def __init__(self, xid=None, flags=None):
12131 if xid != None:
12132 self.xid = xid
12133 else:
12134 self.xid = None
12135 if flags != None:
12136 self.flags = flags
12137 else:
12138 self.flags = 0
12139 return
12140
12141 def pack(self):
12142 packed = []
12143 packed.append(struct.pack("!B", self.version))
12144 packed.append(struct.pack("!B", self.type))
12145 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12146 packed.append(struct.pack("!L", self.xid))
12147 packed.append(struct.pack("!H", self.stats_type))
12148 packed.append(struct.pack("!H", self.flags))
12149 packed.append('\x00' * 4)
12150 length = sum([len(x) for x in packed])
12151 packed[2] = struct.pack("!H", length)
12152 return ''.join(packed)
12153
12154 @staticmethod
12155 def unpack(reader):
12156 obj = group_features_stats_request()
12157 _version = reader.read("!B")[0]
12158 assert(_version == 5)
12159 _type = reader.read("!B")[0]
12160 assert(_type == 18)
12161 _length = reader.read("!H")[0]
12162 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012163 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012164 obj.xid = reader.read("!L")[0]
12165 _stats_type = reader.read("!H")[0]
12166 assert(_stats_type == 8)
12167 obj.flags = reader.read("!H")[0]
12168 reader.skip(4)
12169 return obj
12170
12171 def __eq__(self, other):
12172 if type(self) != type(other): return False
12173 if self.xid != other.xid: return False
12174 if self.flags != other.flags: return False
12175 return True
12176
12177 def pretty_print(self, q):
12178 q.text("group_features_stats_request {")
12179 with q.group():
12180 with q.indent(2):
12181 q.breakable()
12182 q.text("xid = ");
12183 if self.xid != None:
12184 q.text("%#x" % self.xid)
12185 else:
12186 q.text('None')
12187 q.text(","); q.breakable()
12188 q.text("flags = ");
12189 q.text("%#x" % self.flags)
12190 q.breakable()
12191 q.text('}')
12192
12193stats_request.subtypes[8] = group_features_stats_request
12194
12195class group_mod_failed_error_msg(error_msg):
12196 version = 5
12197 type = 1
12198 err_type = 6
12199
12200 def __init__(self, xid=None, code=None, data=None):
12201 if xid != None:
12202 self.xid = xid
12203 else:
12204 self.xid = None
12205 if code != None:
12206 self.code = code
12207 else:
12208 self.code = 0
12209 if data != None:
12210 self.data = data
12211 else:
12212 self.data = ''
12213 return
12214
12215 def pack(self):
12216 packed = []
12217 packed.append(struct.pack("!B", self.version))
12218 packed.append(struct.pack("!B", self.type))
12219 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12220 packed.append(struct.pack("!L", self.xid))
12221 packed.append(struct.pack("!H", self.err_type))
12222 packed.append(struct.pack("!H", self.code))
12223 packed.append(self.data)
12224 length = sum([len(x) for x in packed])
12225 packed[2] = struct.pack("!H", length)
12226 return ''.join(packed)
12227
12228 @staticmethod
12229 def unpack(reader):
12230 obj = group_mod_failed_error_msg()
12231 _version = reader.read("!B")[0]
12232 assert(_version == 5)
12233 _type = reader.read("!B")[0]
12234 assert(_type == 1)
12235 _length = reader.read("!H")[0]
12236 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012237 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012238 obj.xid = reader.read("!L")[0]
12239 _err_type = reader.read("!H")[0]
12240 assert(_err_type == 6)
12241 obj.code = reader.read("!H")[0]
12242 obj.data = str(reader.read_all())
12243 return obj
12244
12245 def __eq__(self, other):
12246 if type(self) != type(other): return False
12247 if self.xid != other.xid: return False
12248 if self.code != other.code: return False
12249 if self.data != other.data: return False
12250 return True
12251
12252 def pretty_print(self, q):
12253 q.text("group_mod_failed_error_msg {")
12254 with q.group():
12255 with q.indent(2):
12256 q.breakable()
12257 q.text("xid = ");
12258 if self.xid != None:
12259 q.text("%#x" % self.xid)
12260 else:
12261 q.text('None')
12262 q.text(","); q.breakable()
12263 q.text("code = ");
12264 q.text("%#x" % self.code)
12265 q.text(","); q.breakable()
12266 q.text("data = ");
12267 q.pp(self.data)
12268 q.breakable()
12269 q.text('}')
12270
12271error_msg.subtypes[6] = group_mod_failed_error_msg
12272
12273class group_modify(group_mod):
12274 version = 5
12275 type = 15
12276 command = 1
12277
12278 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12279 if xid != None:
12280 self.xid = xid
12281 else:
12282 self.xid = None
12283 if group_type != None:
12284 self.group_type = group_type
12285 else:
12286 self.group_type = 0
12287 if group_id != None:
12288 self.group_id = group_id
12289 else:
12290 self.group_id = 0
12291 if buckets != None:
12292 self.buckets = buckets
12293 else:
12294 self.buckets = []
12295 return
12296
12297 def pack(self):
12298 packed = []
12299 packed.append(struct.pack("!B", self.version))
12300 packed.append(struct.pack("!B", self.type))
12301 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12302 packed.append(struct.pack("!L", self.xid))
12303 packed.append(struct.pack("!H", self.command))
12304 packed.append(struct.pack("!B", self.group_type))
12305 packed.append('\x00' * 1)
12306 packed.append(struct.pack("!L", self.group_id))
12307 packed.append(loxi.generic_util.pack_list(self.buckets))
12308 length = sum([len(x) for x in packed])
12309 packed[2] = struct.pack("!H", length)
12310 return ''.join(packed)
12311
12312 @staticmethod
12313 def unpack(reader):
12314 obj = group_modify()
12315 _version = reader.read("!B")[0]
12316 assert(_version == 5)
12317 _type = reader.read("!B")[0]
12318 assert(_type == 15)
12319 _length = reader.read("!H")[0]
12320 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012321 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012322 obj.xid = reader.read("!L")[0]
12323 _command = reader.read("!H")[0]
12324 assert(_command == 1)
12325 obj.group_type = reader.read("!B")[0]
12326 reader.skip(1)
12327 obj.group_id = reader.read("!L")[0]
12328 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
12329 return obj
12330
12331 def __eq__(self, other):
12332 if type(self) != type(other): return False
12333 if self.xid != other.xid: return False
12334 if self.group_type != other.group_type: return False
12335 if self.group_id != other.group_id: return False
12336 if self.buckets != other.buckets: return False
12337 return True
12338
12339 def pretty_print(self, q):
12340 q.text("group_modify {")
12341 with q.group():
12342 with q.indent(2):
12343 q.breakable()
12344 q.text("xid = ");
12345 if self.xid != None:
12346 q.text("%#x" % self.xid)
12347 else:
12348 q.text('None')
12349 q.text(","); q.breakable()
12350 q.text("group_type = ");
12351 q.text("%#x" % self.group_type)
12352 q.text(","); q.breakable()
12353 q.text("group_id = ");
12354 q.text("%#x" % self.group_id)
12355 q.text(","); q.breakable()
12356 q.text("buckets = ");
12357 q.pp(self.buckets)
12358 q.breakable()
12359 q.text('}')
12360
12361group_mod.subtypes[1] = group_modify
12362
12363class group_stats_reply(stats_reply):
12364 version = 5
12365 type = 19
12366 stats_type = 6
12367
12368 def __init__(self, xid=None, flags=None, entries=None):
12369 if xid != None:
12370 self.xid = xid
12371 else:
12372 self.xid = None
12373 if flags != None:
12374 self.flags = flags
12375 else:
12376 self.flags = 0
12377 if entries != None:
12378 self.entries = entries
12379 else:
12380 self.entries = []
12381 return
12382
12383 def pack(self):
12384 packed = []
12385 packed.append(struct.pack("!B", self.version))
12386 packed.append(struct.pack("!B", self.type))
12387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12388 packed.append(struct.pack("!L", self.xid))
12389 packed.append(struct.pack("!H", self.stats_type))
12390 packed.append(struct.pack("!H", self.flags))
12391 packed.append('\x00' * 4)
12392 packed.append(loxi.generic_util.pack_list(self.entries))
12393 length = sum([len(x) for x in packed])
12394 packed[2] = struct.pack("!H", length)
12395 return ''.join(packed)
12396
12397 @staticmethod
12398 def unpack(reader):
12399 obj = group_stats_reply()
12400 _version = reader.read("!B")[0]
12401 assert(_version == 5)
12402 _type = reader.read("!B")[0]
12403 assert(_type == 19)
12404 _length = reader.read("!H")[0]
12405 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012406 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012407 obj.xid = reader.read("!L")[0]
12408 _stats_type = reader.read("!H")[0]
12409 assert(_stats_type == 6)
12410 obj.flags = reader.read("!H")[0]
12411 reader.skip(4)
12412 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
12413 return obj
12414
12415 def __eq__(self, other):
12416 if type(self) != type(other): return False
12417 if self.xid != other.xid: return False
12418 if self.flags != other.flags: return False
12419 if self.entries != other.entries: return False
12420 return True
12421
12422 def pretty_print(self, q):
12423 q.text("group_stats_reply {")
12424 with q.group():
12425 with q.indent(2):
12426 q.breakable()
12427 q.text("xid = ");
12428 if self.xid != None:
12429 q.text("%#x" % self.xid)
12430 else:
12431 q.text('None')
12432 q.text(","); q.breakable()
12433 q.text("flags = ");
12434 q.text("%#x" % self.flags)
12435 q.text(","); q.breakable()
12436 q.text("entries = ");
12437 q.pp(self.entries)
12438 q.breakable()
12439 q.text('}')
12440
12441stats_reply.subtypes[6] = group_stats_reply
12442
12443class group_stats_request(stats_request):
12444 version = 5
12445 type = 18
12446 stats_type = 6
12447
12448 def __init__(self, xid=None, flags=None, group_id=None):
12449 if xid != None:
12450 self.xid = xid
12451 else:
12452 self.xid = None
12453 if flags != None:
12454 self.flags = flags
12455 else:
12456 self.flags = 0
12457 if group_id != None:
12458 self.group_id = group_id
12459 else:
12460 self.group_id = 0
12461 return
12462
12463 def pack(self):
12464 packed = []
12465 packed.append(struct.pack("!B", self.version))
12466 packed.append(struct.pack("!B", self.type))
12467 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12468 packed.append(struct.pack("!L", self.xid))
12469 packed.append(struct.pack("!H", self.stats_type))
12470 packed.append(struct.pack("!H", self.flags))
12471 packed.append('\x00' * 4)
12472 packed.append(struct.pack("!L", self.group_id))
12473 packed.append('\x00' * 4)
12474 length = sum([len(x) for x in packed])
12475 packed[2] = struct.pack("!H", length)
12476 return ''.join(packed)
12477
12478 @staticmethod
12479 def unpack(reader):
12480 obj = group_stats_request()
12481 _version = reader.read("!B")[0]
12482 assert(_version == 5)
12483 _type = reader.read("!B")[0]
12484 assert(_type == 18)
12485 _length = reader.read("!H")[0]
12486 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012487 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012488 obj.xid = reader.read("!L")[0]
12489 _stats_type = reader.read("!H")[0]
12490 assert(_stats_type == 6)
12491 obj.flags = reader.read("!H")[0]
12492 reader.skip(4)
12493 obj.group_id = reader.read("!L")[0]
12494 reader.skip(4)
12495 return obj
12496
12497 def __eq__(self, other):
12498 if type(self) != type(other): return False
12499 if self.xid != other.xid: return False
12500 if self.flags != other.flags: return False
12501 if self.group_id != other.group_id: return False
12502 return True
12503
12504 def pretty_print(self, q):
12505 q.text("group_stats_request {")
12506 with q.group():
12507 with q.indent(2):
12508 q.breakable()
12509 q.text("xid = ");
12510 if self.xid != None:
12511 q.text("%#x" % self.xid)
12512 else:
12513 q.text('None')
12514 q.text(","); q.breakable()
12515 q.text("flags = ");
12516 q.text("%#x" % self.flags)
12517 q.text(","); q.breakable()
12518 q.text("group_id = ");
12519 q.text("%#x" % self.group_id)
12520 q.breakable()
12521 q.text('}')
12522
12523stats_request.subtypes[6] = group_stats_request
12524
12525class hello(message):
12526 version = 5
12527 type = 0
12528
12529 def __init__(self, xid=None, elements=None):
12530 if xid != None:
12531 self.xid = xid
12532 else:
12533 self.xid = None
12534 if elements != None:
12535 self.elements = elements
12536 else:
12537 self.elements = []
12538 return
12539
12540 def pack(self):
12541 packed = []
12542 packed.append(struct.pack("!B", self.version))
12543 packed.append(struct.pack("!B", self.type))
12544 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12545 packed.append(struct.pack("!L", self.xid))
12546 packed.append(loxi.generic_util.pack_list(self.elements))
12547 length = sum([len(x) for x in packed])
12548 packed[2] = struct.pack("!H", length)
12549 return ''.join(packed)
12550
12551 @staticmethod
12552 def unpack(reader):
12553 obj = hello()
12554 _version = reader.read("!B")[0]
12555 assert(_version == 5)
12556 _type = reader.read("!B")[0]
12557 assert(_type == 0)
12558 _length = reader.read("!H")[0]
12559 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012560 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012561 obj.xid = reader.read("!L")[0]
12562 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
12563 return obj
12564
12565 def __eq__(self, other):
12566 if type(self) != type(other): return False
12567 if self.xid != other.xid: return False
12568 if self.elements != other.elements: return False
12569 return True
12570
12571 def pretty_print(self, q):
12572 q.text("hello {")
12573 with q.group():
12574 with q.indent(2):
12575 q.breakable()
12576 q.text("xid = ");
12577 if self.xid != None:
12578 q.text("%#x" % self.xid)
12579 else:
12580 q.text('None')
12581 q.text(","); q.breakable()
12582 q.text("elements = ");
12583 q.pp(self.elements)
12584 q.breakable()
12585 q.text('}')
12586
12587message.subtypes[0] = hello
12588
12589class hello_failed_error_msg(error_msg):
12590 version = 5
12591 type = 1
12592 err_type = 0
12593
12594 def __init__(self, xid=None, code=None, data=None):
12595 if xid != None:
12596 self.xid = xid
12597 else:
12598 self.xid = None
12599 if code != None:
12600 self.code = code
12601 else:
12602 self.code = 0
12603 if data != None:
12604 self.data = data
12605 else:
12606 self.data = ''
12607 return
12608
12609 def pack(self):
12610 packed = []
12611 packed.append(struct.pack("!B", self.version))
12612 packed.append(struct.pack("!B", self.type))
12613 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12614 packed.append(struct.pack("!L", self.xid))
12615 packed.append(struct.pack("!H", self.err_type))
12616 packed.append(struct.pack("!H", self.code))
12617 packed.append(self.data)
12618 length = sum([len(x) for x in packed])
12619 packed[2] = struct.pack("!H", length)
12620 return ''.join(packed)
12621
12622 @staticmethod
12623 def unpack(reader):
12624 obj = hello_failed_error_msg()
12625 _version = reader.read("!B")[0]
12626 assert(_version == 5)
12627 _type = reader.read("!B")[0]
12628 assert(_type == 1)
12629 _length = reader.read("!H")[0]
12630 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012631 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012632 obj.xid = reader.read("!L")[0]
12633 _err_type = reader.read("!H")[0]
12634 assert(_err_type == 0)
12635 obj.code = reader.read("!H")[0]
12636 obj.data = str(reader.read_all())
12637 return obj
12638
12639 def __eq__(self, other):
12640 if type(self) != type(other): return False
12641 if self.xid != other.xid: return False
12642 if self.code != other.code: return False
12643 if self.data != other.data: return False
12644 return True
12645
12646 def pretty_print(self, q):
12647 q.text("hello_failed_error_msg {")
12648 with q.group():
12649 with q.indent(2):
12650 q.breakable()
12651 q.text("xid = ");
12652 if self.xid != None:
12653 q.text("%#x" % self.xid)
12654 else:
12655 q.text('None')
12656 q.text(","); q.breakable()
12657 q.text("code = ");
12658 q.text("%#x" % self.code)
12659 q.text(","); q.breakable()
12660 q.text("data = ");
12661 q.pp(self.data)
12662 q.breakable()
12663 q.text('}')
12664
12665error_msg.subtypes[0] = hello_failed_error_msg
12666
12667class meter_config_stats_reply(stats_reply):
12668 version = 5
12669 type = 19
12670 stats_type = 10
12671
12672 def __init__(self, xid=None, flags=None, entries=None):
12673 if xid != None:
12674 self.xid = xid
12675 else:
12676 self.xid = None
12677 if flags != None:
12678 self.flags = flags
12679 else:
12680 self.flags = 0
12681 if entries != None:
12682 self.entries = entries
12683 else:
12684 self.entries = []
12685 return
12686
12687 def pack(self):
12688 packed = []
12689 packed.append(struct.pack("!B", self.version))
12690 packed.append(struct.pack("!B", self.type))
12691 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12692 packed.append(struct.pack("!L", self.xid))
12693 packed.append(struct.pack("!H", self.stats_type))
12694 packed.append(struct.pack("!H", self.flags))
12695 packed.append('\x00' * 4)
12696 packed.append(loxi.generic_util.pack_list(self.entries))
12697 length = sum([len(x) for x in packed])
12698 packed[2] = struct.pack("!H", length)
12699 return ''.join(packed)
12700
12701 @staticmethod
12702 def unpack(reader):
12703 obj = meter_config_stats_reply()
12704 _version = reader.read("!B")[0]
12705 assert(_version == 5)
12706 _type = reader.read("!B")[0]
12707 assert(_type == 19)
12708 _length = reader.read("!H")[0]
12709 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012710 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012711 obj.xid = reader.read("!L")[0]
12712 _stats_type = reader.read("!H")[0]
12713 assert(_stats_type == 10)
12714 obj.flags = reader.read("!H")[0]
12715 reader.skip(4)
12716 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
12717 return obj
12718
12719 def __eq__(self, other):
12720 if type(self) != type(other): return False
12721 if self.xid != other.xid: return False
12722 if self.flags != other.flags: return False
12723 if self.entries != other.entries: return False
12724 return True
12725
12726 def pretty_print(self, q):
12727 q.text("meter_config_stats_reply {")
12728 with q.group():
12729 with q.indent(2):
12730 q.breakable()
12731 q.text("xid = ");
12732 if self.xid != None:
12733 q.text("%#x" % self.xid)
12734 else:
12735 q.text('None')
12736 q.text(","); q.breakable()
12737 q.text("flags = ");
12738 q.text("%#x" % self.flags)
12739 q.text(","); q.breakable()
12740 q.text("entries = ");
12741 q.pp(self.entries)
12742 q.breakable()
12743 q.text('}')
12744
12745stats_reply.subtypes[10] = meter_config_stats_reply
12746
12747class meter_config_stats_request(stats_request):
12748 version = 5
12749 type = 18
12750 stats_type = 10
12751
12752 def __init__(self, xid=None, flags=None, meter_id=None):
12753 if xid != None:
12754 self.xid = xid
12755 else:
12756 self.xid = None
12757 if flags != None:
12758 self.flags = flags
12759 else:
12760 self.flags = 0
12761 if meter_id != None:
12762 self.meter_id = meter_id
12763 else:
12764 self.meter_id = 0
12765 return
12766
12767 def pack(self):
12768 packed = []
12769 packed.append(struct.pack("!B", self.version))
12770 packed.append(struct.pack("!B", self.type))
12771 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12772 packed.append(struct.pack("!L", self.xid))
12773 packed.append(struct.pack("!H", self.stats_type))
12774 packed.append(struct.pack("!H", self.flags))
12775 packed.append('\x00' * 4)
12776 packed.append(struct.pack("!L", self.meter_id))
12777 packed.append('\x00' * 4)
12778 length = sum([len(x) for x in packed])
12779 packed[2] = struct.pack("!H", length)
12780 return ''.join(packed)
12781
12782 @staticmethod
12783 def unpack(reader):
12784 obj = meter_config_stats_request()
12785 _version = reader.read("!B")[0]
12786 assert(_version == 5)
12787 _type = reader.read("!B")[0]
12788 assert(_type == 18)
12789 _length = reader.read("!H")[0]
12790 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012791 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012792 obj.xid = reader.read("!L")[0]
12793 _stats_type = reader.read("!H")[0]
12794 assert(_stats_type == 10)
12795 obj.flags = reader.read("!H")[0]
12796 reader.skip(4)
12797 obj.meter_id = reader.read("!L")[0]
12798 reader.skip(4)
12799 return obj
12800
12801 def __eq__(self, other):
12802 if type(self) != type(other): return False
12803 if self.xid != other.xid: return False
12804 if self.flags != other.flags: return False
12805 if self.meter_id != other.meter_id: return False
12806 return True
12807
12808 def pretty_print(self, q):
12809 q.text("meter_config_stats_request {")
12810 with q.group():
12811 with q.indent(2):
12812 q.breakable()
12813 q.text("xid = ");
12814 if self.xid != None:
12815 q.text("%#x" % self.xid)
12816 else:
12817 q.text('None')
12818 q.text(","); q.breakable()
12819 q.text("flags = ");
12820 q.text("%#x" % self.flags)
12821 q.text(","); q.breakable()
12822 q.text("meter_id = ");
12823 q.text("%#x" % self.meter_id)
12824 q.breakable()
12825 q.text('}')
12826
12827stats_request.subtypes[10] = meter_config_stats_request
12828
12829class meter_features_stats_reply(stats_reply):
12830 version = 5
12831 type = 19
12832 stats_type = 11
12833
12834 def __init__(self, xid=None, flags=None, features=None):
12835 if xid != None:
12836 self.xid = xid
12837 else:
12838 self.xid = None
12839 if flags != None:
12840 self.flags = flags
12841 else:
12842 self.flags = 0
12843 if features != None:
12844 self.features = features
12845 else:
12846 self.features = common.meter_features()
12847 return
12848
12849 def pack(self):
12850 packed = []
12851 packed.append(struct.pack("!B", self.version))
12852 packed.append(struct.pack("!B", self.type))
12853 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12854 packed.append(struct.pack("!L", self.xid))
12855 packed.append(struct.pack("!H", self.stats_type))
12856 packed.append(struct.pack("!H", self.flags))
12857 packed.append('\x00' * 4)
12858 packed.append(self.features.pack())
12859 length = sum([len(x) for x in packed])
12860 packed[2] = struct.pack("!H", length)
12861 return ''.join(packed)
12862
12863 @staticmethod
12864 def unpack(reader):
12865 obj = meter_features_stats_reply()
12866 _version = reader.read("!B")[0]
12867 assert(_version == 5)
12868 _type = reader.read("!B")[0]
12869 assert(_type == 19)
12870 _length = reader.read("!H")[0]
12871 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012872 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012873 obj.xid = reader.read("!L")[0]
12874 _stats_type = reader.read("!H")[0]
12875 assert(_stats_type == 11)
12876 obj.flags = reader.read("!H")[0]
12877 reader.skip(4)
12878 obj.features = common.meter_features.unpack(reader)
12879 return obj
12880
12881 def __eq__(self, other):
12882 if type(self) != type(other): return False
12883 if self.xid != other.xid: return False
12884 if self.flags != other.flags: return False
12885 if self.features != other.features: return False
12886 return True
12887
12888 def pretty_print(self, q):
12889 q.text("meter_features_stats_reply {")
12890 with q.group():
12891 with q.indent(2):
12892 q.breakable()
12893 q.text("xid = ");
12894 if self.xid != None:
12895 q.text("%#x" % self.xid)
12896 else:
12897 q.text('None')
12898 q.text(","); q.breakable()
12899 q.text("flags = ");
12900 q.text("%#x" % self.flags)
12901 q.text(","); q.breakable()
12902 q.text("features = ");
12903 q.pp(self.features)
12904 q.breakable()
12905 q.text('}')
12906
12907stats_reply.subtypes[11] = meter_features_stats_reply
12908
12909class meter_features_stats_request(stats_request):
12910 version = 5
12911 type = 18
12912 stats_type = 11
12913
12914 def __init__(self, xid=None, flags=None):
12915 if xid != None:
12916 self.xid = xid
12917 else:
12918 self.xid = None
12919 if flags != None:
12920 self.flags = flags
12921 else:
12922 self.flags = 0
12923 return
12924
12925 def pack(self):
12926 packed = []
12927 packed.append(struct.pack("!B", self.version))
12928 packed.append(struct.pack("!B", self.type))
12929 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12930 packed.append(struct.pack("!L", self.xid))
12931 packed.append(struct.pack("!H", self.stats_type))
12932 packed.append(struct.pack("!H", self.flags))
12933 packed.append('\x00' * 4)
12934 length = sum([len(x) for x in packed])
12935 packed[2] = struct.pack("!H", length)
12936 return ''.join(packed)
12937
12938 @staticmethod
12939 def unpack(reader):
12940 obj = meter_features_stats_request()
12941 _version = reader.read("!B")[0]
12942 assert(_version == 5)
12943 _type = reader.read("!B")[0]
12944 assert(_type == 18)
12945 _length = reader.read("!H")[0]
12946 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012947 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012948 obj.xid = reader.read("!L")[0]
12949 _stats_type = reader.read("!H")[0]
12950 assert(_stats_type == 11)
12951 obj.flags = reader.read("!H")[0]
12952 reader.skip(4)
12953 return obj
12954
12955 def __eq__(self, other):
12956 if type(self) != type(other): return False
12957 if self.xid != other.xid: return False
12958 if self.flags != other.flags: return False
12959 return True
12960
12961 def pretty_print(self, q):
12962 q.text("meter_features_stats_request {")
12963 with q.group():
12964 with q.indent(2):
12965 q.breakable()
12966 q.text("xid = ");
12967 if self.xid != None:
12968 q.text("%#x" % self.xid)
12969 else:
12970 q.text('None')
12971 q.text(","); q.breakable()
12972 q.text("flags = ");
12973 q.text("%#x" % self.flags)
12974 q.breakable()
12975 q.text('}')
12976
12977stats_request.subtypes[11] = meter_features_stats_request
12978
12979class meter_mod(message):
12980 version = 5
12981 type = 29
12982
12983 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
12984 if xid != None:
12985 self.xid = xid
12986 else:
12987 self.xid = None
12988 if command != None:
12989 self.command = command
12990 else:
12991 self.command = 0
12992 if flags != None:
12993 self.flags = flags
12994 else:
12995 self.flags = 0
12996 if meter_id != None:
12997 self.meter_id = meter_id
12998 else:
12999 self.meter_id = 0
13000 if bands != None:
13001 self.bands = bands
13002 else:
13003 self.bands = []
13004 return
13005
13006 def pack(self):
13007 packed = []
13008 packed.append(struct.pack("!B", self.version))
13009 packed.append(struct.pack("!B", self.type))
13010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13011 packed.append(struct.pack("!L", self.xid))
13012 packed.append(struct.pack("!H", self.command))
13013 packed.append(struct.pack("!H", self.flags))
13014 packed.append(struct.pack("!L", self.meter_id))
13015 packed.append(loxi.generic_util.pack_list(self.bands))
13016 length = sum([len(x) for x in packed])
13017 packed[2] = struct.pack("!H", length)
13018 return ''.join(packed)
13019
13020 @staticmethod
13021 def unpack(reader):
13022 obj = meter_mod()
13023 _version = reader.read("!B")[0]
13024 assert(_version == 5)
13025 _type = reader.read("!B")[0]
13026 assert(_type == 29)
13027 _length = reader.read("!H")[0]
13028 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013029 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013030 obj.xid = reader.read("!L")[0]
13031 obj.command = reader.read("!H")[0]
13032 obj.flags = reader.read("!H")[0]
13033 obj.meter_id = reader.read("!L")[0]
13034 obj.bands = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
13035 return obj
13036
13037 def __eq__(self, other):
13038 if type(self) != type(other): return False
13039 if self.xid != other.xid: return False
13040 if self.command != other.command: return False
13041 if self.flags != other.flags: return False
13042 if self.meter_id != other.meter_id: return False
13043 if self.bands != other.bands: return False
13044 return True
13045
13046 def pretty_print(self, q):
13047 q.text("meter_mod {")
13048 with q.group():
13049 with q.indent(2):
13050 q.breakable()
13051 q.text("xid = ");
13052 if self.xid != None:
13053 q.text("%#x" % self.xid)
13054 else:
13055 q.text('None')
13056 q.text(","); q.breakable()
13057 q.text("command = ");
13058 q.text("%#x" % self.command)
13059 q.text(","); q.breakable()
13060 q.text("flags = ");
13061 q.text("%#x" % self.flags)
13062 q.text(","); q.breakable()
13063 q.text("meter_id = ");
13064 q.text("%#x" % self.meter_id)
13065 q.text(","); q.breakable()
13066 q.text("bands = ");
13067 q.pp(self.bands)
13068 q.breakable()
13069 q.text('}')
13070
13071message.subtypes[29] = meter_mod
13072
13073class meter_mod_failed_error_msg(error_msg):
13074 version = 5
13075 type = 1
13076 err_type = 12
13077
13078 def __init__(self, xid=None, code=None, data=None):
13079 if xid != None:
13080 self.xid = xid
13081 else:
13082 self.xid = None
13083 if code != None:
13084 self.code = code
13085 else:
13086 self.code = 0
13087 if data != None:
13088 self.data = data
13089 else:
13090 self.data = ''
13091 return
13092
13093 def pack(self):
13094 packed = []
13095 packed.append(struct.pack("!B", self.version))
13096 packed.append(struct.pack("!B", self.type))
13097 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13098 packed.append(struct.pack("!L", self.xid))
13099 packed.append(struct.pack("!H", self.err_type))
13100 packed.append(struct.pack("!H", self.code))
13101 packed.append(self.data)
13102 length = sum([len(x) for x in packed])
13103 packed[2] = struct.pack("!H", length)
13104 return ''.join(packed)
13105
13106 @staticmethod
13107 def unpack(reader):
13108 obj = meter_mod_failed_error_msg()
13109 _version = reader.read("!B")[0]
13110 assert(_version == 5)
13111 _type = reader.read("!B")[0]
13112 assert(_type == 1)
13113 _length = reader.read("!H")[0]
13114 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013115 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013116 obj.xid = reader.read("!L")[0]
13117 _err_type = reader.read("!H")[0]
13118 assert(_err_type == 12)
13119 obj.code = reader.read("!H")[0]
13120 obj.data = str(reader.read_all())
13121 return obj
13122
13123 def __eq__(self, other):
13124 if type(self) != type(other): return False
13125 if self.xid != other.xid: return False
13126 if self.code != other.code: return False
13127 if self.data != other.data: return False
13128 return True
13129
13130 def pretty_print(self, q):
13131 q.text("meter_mod_failed_error_msg {")
13132 with q.group():
13133 with q.indent(2):
13134 q.breakable()
13135 q.text("xid = ");
13136 if self.xid != None:
13137 q.text("%#x" % self.xid)
13138 else:
13139 q.text('None')
13140 q.text(","); q.breakable()
13141 q.text("code = ");
13142 q.text("%#x" % self.code)
13143 q.text(","); q.breakable()
13144 q.text("data = ");
13145 q.pp(self.data)
13146 q.breakable()
13147 q.text('}')
13148
13149error_msg.subtypes[12] = meter_mod_failed_error_msg
13150
13151class meter_stats_reply(stats_reply):
13152 version = 5
13153 type = 19
13154 stats_type = 9
13155
13156 def __init__(self, xid=None, flags=None, entries=None):
13157 if xid != None:
13158 self.xid = xid
13159 else:
13160 self.xid = None
13161 if flags != None:
13162 self.flags = flags
13163 else:
13164 self.flags = 0
13165 if entries != None:
13166 self.entries = entries
13167 else:
13168 self.entries = []
13169 return
13170
13171 def pack(self):
13172 packed = []
13173 packed.append(struct.pack("!B", self.version))
13174 packed.append(struct.pack("!B", self.type))
13175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13176 packed.append(struct.pack("!L", self.xid))
13177 packed.append(struct.pack("!H", self.stats_type))
13178 packed.append(struct.pack("!H", self.flags))
13179 packed.append('\x00' * 4)
13180 packed.append(loxi.generic_util.pack_list(self.entries))
13181 length = sum([len(x) for x in packed])
13182 packed[2] = struct.pack("!H", length)
13183 return ''.join(packed)
13184
13185 @staticmethod
13186 def unpack(reader):
13187 obj = meter_stats_reply()
13188 _version = reader.read("!B")[0]
13189 assert(_version == 5)
13190 _type = reader.read("!B")[0]
13191 assert(_type == 19)
13192 _length = reader.read("!H")[0]
13193 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013194 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013195 obj.xid = reader.read("!L")[0]
13196 _stats_type = reader.read("!H")[0]
13197 assert(_stats_type == 9)
13198 obj.flags = reader.read("!H")[0]
13199 reader.skip(4)
13200 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
13201 return obj
13202
13203 def __eq__(self, other):
13204 if type(self) != type(other): return False
13205 if self.xid != other.xid: return False
13206 if self.flags != other.flags: return False
13207 if self.entries != other.entries: return False
13208 return True
13209
13210 def pretty_print(self, q):
13211 q.text("meter_stats_reply {")
13212 with q.group():
13213 with q.indent(2):
13214 q.breakable()
13215 q.text("xid = ");
13216 if self.xid != None:
13217 q.text("%#x" % self.xid)
13218 else:
13219 q.text('None')
13220 q.text(","); q.breakable()
13221 q.text("flags = ");
13222 q.text("%#x" % self.flags)
13223 q.text(","); q.breakable()
13224 q.text("entries = ");
13225 q.pp(self.entries)
13226 q.breakable()
13227 q.text('}')
13228
13229stats_reply.subtypes[9] = meter_stats_reply
13230
13231class meter_stats_request(stats_request):
13232 version = 5
13233 type = 18
13234 stats_type = 9
13235
13236 def __init__(self, xid=None, flags=None, meter_id=None):
13237 if xid != None:
13238 self.xid = xid
13239 else:
13240 self.xid = None
13241 if flags != None:
13242 self.flags = flags
13243 else:
13244 self.flags = 0
13245 if meter_id != None:
13246 self.meter_id = meter_id
13247 else:
13248 self.meter_id = 0
13249 return
13250
13251 def pack(self):
13252 packed = []
13253 packed.append(struct.pack("!B", self.version))
13254 packed.append(struct.pack("!B", self.type))
13255 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13256 packed.append(struct.pack("!L", self.xid))
13257 packed.append(struct.pack("!H", self.stats_type))
13258 packed.append(struct.pack("!H", self.flags))
13259 packed.append('\x00' * 4)
13260 packed.append(struct.pack("!L", self.meter_id))
13261 packed.append('\x00' * 4)
13262 length = sum([len(x) for x in packed])
13263 packed[2] = struct.pack("!H", length)
13264 return ''.join(packed)
13265
13266 @staticmethod
13267 def unpack(reader):
13268 obj = meter_stats_request()
13269 _version = reader.read("!B")[0]
13270 assert(_version == 5)
13271 _type = reader.read("!B")[0]
13272 assert(_type == 18)
13273 _length = reader.read("!H")[0]
13274 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013275 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013276 obj.xid = reader.read("!L")[0]
13277 _stats_type = reader.read("!H")[0]
13278 assert(_stats_type == 9)
13279 obj.flags = reader.read("!H")[0]
13280 reader.skip(4)
13281 obj.meter_id = reader.read("!L")[0]
13282 reader.skip(4)
13283 return obj
13284
13285 def __eq__(self, other):
13286 if type(self) != type(other): return False
13287 if self.xid != other.xid: return False
13288 if self.flags != other.flags: return False
13289 if self.meter_id != other.meter_id: return False
13290 return True
13291
13292 def pretty_print(self, q):
13293 q.text("meter_stats_request {")
13294 with q.group():
13295 with q.indent(2):
13296 q.breakable()
13297 q.text("xid = ");
13298 if self.xid != None:
13299 q.text("%#x" % self.xid)
13300 else:
13301 q.text('None')
13302 q.text(","); q.breakable()
13303 q.text("flags = ");
13304 q.text("%#x" % self.flags)
13305 q.text(","); q.breakable()
13306 q.text("meter_id = ");
13307 q.text("%#x" % self.meter_id)
13308 q.breakable()
13309 q.text('}')
13310
13311stats_request.subtypes[9] = meter_stats_request
13312
13313class nicira_header(experimenter):
13314 subtypes = {}
13315
13316 version = 5
13317 type = 4
13318 experimenter = 8992
13319
13320 def __init__(self, xid=None, subtype=None):
13321 if xid != None:
13322 self.xid = xid
13323 else:
13324 self.xid = None
13325 if subtype != None:
13326 self.subtype = subtype
13327 else:
13328 self.subtype = 0
13329 return
13330
13331 def pack(self):
13332 packed = []
13333 packed.append(struct.pack("!B", self.version))
13334 packed.append(struct.pack("!B", self.type))
13335 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13336 packed.append(struct.pack("!L", self.xid))
13337 packed.append(struct.pack("!L", self.experimenter))
13338 packed.append(struct.pack("!L", self.subtype))
13339 length = sum([len(x) for x in packed])
13340 packed[2] = struct.pack("!H", length)
13341 return ''.join(packed)
13342
13343 @staticmethod
13344 def unpack(reader):
13345 subtype, = reader.peek('!L', 12)
13346 subclass = nicira_header.subtypes.get(subtype)
13347 if subclass:
13348 return subclass.unpack(reader)
13349
13350 obj = nicira_header()
13351 _version = reader.read("!B")[0]
13352 assert(_version == 5)
13353 _type = reader.read("!B")[0]
13354 assert(_type == 4)
13355 _length = reader.read("!H")[0]
13356 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013357 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013358 obj.xid = reader.read("!L")[0]
13359 _experimenter = reader.read("!L")[0]
13360 assert(_experimenter == 8992)
13361 obj.subtype = reader.read("!L")[0]
13362 return obj
13363
13364 def __eq__(self, other):
13365 if type(self) != type(other): return False
13366 if self.xid != other.xid: return False
13367 if self.subtype != other.subtype: return False
13368 return True
13369
13370 def pretty_print(self, q):
13371 q.text("nicira_header {")
13372 with q.group():
13373 with q.indent(2):
13374 q.breakable()
13375 q.text("xid = ");
13376 if self.xid != None:
13377 q.text("%#x" % self.xid)
13378 else:
13379 q.text('None')
13380 q.breakable()
13381 q.text('}')
13382
13383experimenter.subtypes[8992] = nicira_header
13384
13385class packet_in(message):
13386 version = 5
13387 type = 10
13388
13389 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13390 if xid != None:
13391 self.xid = xid
13392 else:
13393 self.xid = None
13394 if buffer_id != None:
13395 self.buffer_id = buffer_id
13396 else:
13397 self.buffer_id = 0
13398 if total_len != None:
13399 self.total_len = total_len
13400 else:
13401 self.total_len = 0
13402 if reason != None:
13403 self.reason = reason
13404 else:
13405 self.reason = 0
13406 if table_id != None:
13407 self.table_id = table_id
13408 else:
13409 self.table_id = 0
13410 if cookie != None:
13411 self.cookie = cookie
13412 else:
13413 self.cookie = 0
13414 if match != None:
13415 self.match = match
13416 else:
13417 self.match = common.match()
13418 if data != None:
13419 self.data = data
13420 else:
13421 self.data = ''
13422 return
13423
13424 def pack(self):
13425 packed = []
13426 packed.append(struct.pack("!B", self.version))
13427 packed.append(struct.pack("!B", self.type))
13428 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13429 packed.append(struct.pack("!L", self.xid))
13430 packed.append(struct.pack("!L", self.buffer_id))
13431 packed.append(struct.pack("!H", self.total_len))
13432 packed.append(struct.pack("!B", self.reason))
13433 packed.append(struct.pack("!B", self.table_id))
13434 packed.append(struct.pack("!Q", self.cookie))
13435 packed.append(self.match.pack())
13436 packed.append('\x00' * 2)
13437 packed.append(self.data)
13438 length = sum([len(x) for x in packed])
13439 packed[2] = struct.pack("!H", length)
13440 return ''.join(packed)
13441
13442 @staticmethod
13443 def unpack(reader):
13444 obj = packet_in()
13445 _version = reader.read("!B")[0]
13446 assert(_version == 5)
13447 _type = reader.read("!B")[0]
13448 assert(_type == 10)
13449 _length = reader.read("!H")[0]
13450 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013451 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013452 obj.xid = reader.read("!L")[0]
13453 obj.buffer_id = reader.read("!L")[0]
13454 obj.total_len = reader.read("!H")[0]
13455 obj.reason = reader.read("!B")[0]
13456 obj.table_id = reader.read("!B")[0]
13457 obj.cookie = reader.read("!Q")[0]
13458 obj.match = common.match.unpack(reader)
13459 reader.skip(2)
13460 obj.data = str(reader.read_all())
13461 return obj
13462
13463 def __eq__(self, other):
13464 if type(self) != type(other): return False
13465 if self.xid != other.xid: return False
13466 if self.buffer_id != other.buffer_id: return False
13467 if self.total_len != other.total_len: return False
13468 if self.reason != other.reason: return False
13469 if self.table_id != other.table_id: return False
13470 if self.cookie != other.cookie: return False
13471 if self.match != other.match: return False
13472 if self.data != other.data: return False
13473 return True
13474
13475 def pretty_print(self, q):
13476 q.text("packet_in {")
13477 with q.group():
13478 with q.indent(2):
13479 q.breakable()
13480 q.text("xid = ");
13481 if self.xid != None:
13482 q.text("%#x" % self.xid)
13483 else:
13484 q.text('None')
13485 q.text(","); q.breakable()
13486 q.text("buffer_id = ");
13487 q.text("%#x" % self.buffer_id)
13488 q.text(","); q.breakable()
13489 q.text("total_len = ");
13490 q.text("%#x" % self.total_len)
13491 q.text(","); q.breakable()
13492 q.text("reason = ");
13493 q.text("%#x" % self.reason)
13494 q.text(","); q.breakable()
13495 q.text("table_id = ");
13496 q.text("%#x" % self.table_id)
13497 q.text(","); q.breakable()
13498 q.text("cookie = ");
13499 q.text("%#x" % self.cookie)
13500 q.text(","); q.breakable()
13501 q.text("match = ");
13502 q.pp(self.match)
13503 q.text(","); q.breakable()
13504 q.text("data = ");
13505 q.pp(self.data)
13506 q.breakable()
13507 q.text('}')
13508
13509message.subtypes[10] = packet_in
13510
13511class packet_out(message):
13512 version = 5
13513 type = 13
13514
13515 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13516 if xid != None:
13517 self.xid = xid
13518 else:
13519 self.xid = None
13520 if buffer_id != None:
13521 self.buffer_id = buffer_id
13522 else:
13523 self.buffer_id = 0
13524 if in_port != None:
13525 self.in_port = in_port
13526 else:
13527 self.in_port = 0
13528 if actions != None:
13529 self.actions = actions
13530 else:
13531 self.actions = []
13532 if data != None:
13533 self.data = data
13534 else:
13535 self.data = ''
13536 return
13537
13538 def pack(self):
13539 packed = []
13540 packed.append(struct.pack("!B", self.version))
13541 packed.append(struct.pack("!B", self.type))
13542 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13543 packed.append(struct.pack("!L", self.xid))
13544 packed.append(struct.pack("!L", self.buffer_id))
13545 packed.append(util.pack_port_no(self.in_port))
13546 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13547 packed.append('\x00' * 6)
13548 packed.append(loxi.generic_util.pack_list(self.actions))
13549 packed[6] = struct.pack("!H", len(packed[-1]))
13550 packed.append(self.data)
13551 length = sum([len(x) for x in packed])
13552 packed[2] = struct.pack("!H", length)
13553 return ''.join(packed)
13554
13555 @staticmethod
13556 def unpack(reader):
13557 obj = packet_out()
13558 _version = reader.read("!B")[0]
13559 assert(_version == 5)
13560 _type = reader.read("!B")[0]
13561 assert(_type == 13)
13562 _length = reader.read("!H")[0]
13563 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013564 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013565 obj.xid = reader.read("!L")[0]
13566 obj.buffer_id = reader.read("!L")[0]
13567 obj.in_port = util.unpack_port_no(reader)
13568 _actions_len = reader.read("!H")[0]
13569 reader.skip(6)
13570 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
13571 obj.data = str(reader.read_all())
13572 return obj
13573
13574 def __eq__(self, other):
13575 if type(self) != type(other): return False
13576 if self.xid != other.xid: return False
13577 if self.buffer_id != other.buffer_id: return False
13578 if self.in_port != other.in_port: return False
13579 if self.actions != other.actions: return False
13580 if self.data != other.data: return False
13581 return True
13582
13583 def pretty_print(self, q):
13584 q.text("packet_out {")
13585 with q.group():
13586 with q.indent(2):
13587 q.breakable()
13588 q.text("xid = ");
13589 if self.xid != None:
13590 q.text("%#x" % self.xid)
13591 else:
13592 q.text('None')
13593 q.text(","); q.breakable()
13594 q.text("buffer_id = ");
13595 q.text("%#x" % self.buffer_id)
13596 q.text(","); q.breakable()
13597 q.text("in_port = ");
13598 q.text(util.pretty_port(self.in_port))
13599 q.text(","); q.breakable()
13600 q.text("actions = ");
13601 q.pp(self.actions)
13602 q.text(","); q.breakable()
13603 q.text("data = ");
13604 q.pp(self.data)
13605 q.breakable()
13606 q.text('}')
13607
13608message.subtypes[13] = packet_out
13609
13610class port_desc_stats_reply(stats_reply):
13611 version = 5
13612 type = 19
13613 stats_type = 13
13614
13615 def __init__(self, xid=None, flags=None, entries=None):
13616 if xid != None:
13617 self.xid = xid
13618 else:
13619 self.xid = None
13620 if flags != None:
13621 self.flags = flags
13622 else:
13623 self.flags = 0
13624 if entries != None:
13625 self.entries = entries
13626 else:
13627 self.entries = []
13628 return
13629
13630 def pack(self):
13631 packed = []
13632 packed.append(struct.pack("!B", self.version))
13633 packed.append(struct.pack("!B", self.type))
13634 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13635 packed.append(struct.pack("!L", self.xid))
13636 packed.append(struct.pack("!H", self.stats_type))
13637 packed.append(struct.pack("!H", self.flags))
13638 packed.append('\x00' * 4)
13639 packed.append(loxi.generic_util.pack_list(self.entries))
13640 length = sum([len(x) for x in packed])
13641 packed[2] = struct.pack("!H", length)
13642 return ''.join(packed)
13643
13644 @staticmethod
13645 def unpack(reader):
13646 obj = port_desc_stats_reply()
13647 _version = reader.read("!B")[0]
13648 assert(_version == 5)
13649 _type = reader.read("!B")[0]
13650 assert(_type == 19)
13651 _length = reader.read("!H")[0]
13652 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013653 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013654 obj.xid = reader.read("!L")[0]
13655 _stats_type = reader.read("!H")[0]
13656 assert(_stats_type == 13)
13657 obj.flags = reader.read("!H")[0]
13658 reader.skip(4)
13659 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
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.flags != other.flags: return False
13666 if self.entries != other.entries: return False
13667 return True
13668
13669 def pretty_print(self, q):
13670 q.text("port_desc_stats_reply {")
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("flags = ");
13681 q.text("%#x" % self.flags)
13682 q.text(","); q.breakable()
13683 q.text("entries = ");
13684 q.pp(self.entries)
13685 q.breakable()
13686 q.text('}')
13687
13688stats_reply.subtypes[13] = port_desc_stats_reply
13689
13690class port_desc_stats_request(stats_request):
13691 version = 5
13692 type = 18
13693 stats_type = 13
13694
13695 def __init__(self, xid=None, flags=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 return
13705
13706 def pack(self):
13707 packed = []
13708 packed.append(struct.pack("!B", self.version))
13709 packed.append(struct.pack("!B", self.type))
13710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13711 packed.append(struct.pack("!L", self.xid))
13712 packed.append(struct.pack("!H", self.stats_type))
13713 packed.append(struct.pack("!H", self.flags))
13714 packed.append('\x00' * 4)
13715 length = sum([len(x) for x in packed])
13716 packed[2] = struct.pack("!H", length)
13717 return ''.join(packed)
13718
13719 @staticmethod
13720 def unpack(reader):
13721 obj = port_desc_stats_request()
13722 _version = reader.read("!B")[0]
13723 assert(_version == 5)
13724 _type = reader.read("!B")[0]
13725 assert(_type == 18)
13726 _length = reader.read("!H")[0]
13727 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013728 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013729 obj.xid = reader.read("!L")[0]
13730 _stats_type = reader.read("!H")[0]
13731 assert(_stats_type == 13)
13732 obj.flags = reader.read("!H")[0]
13733 reader.skip(4)
13734 return obj
13735
13736 def __eq__(self, other):
13737 if type(self) != type(other): return False
13738 if self.xid != other.xid: return False
13739 if self.flags != other.flags: return False
13740 return True
13741
13742 def pretty_print(self, q):
13743 q.text("port_desc_stats_request {")
13744 with q.group():
13745 with q.indent(2):
13746 q.breakable()
13747 q.text("xid = ");
13748 if self.xid != None:
13749 q.text("%#x" % self.xid)
13750 else:
13751 q.text('None')
13752 q.text(","); q.breakable()
13753 q.text("flags = ");
13754 q.text("%#x" % self.flags)
13755 q.breakable()
13756 q.text('}')
13757
13758stats_request.subtypes[13] = port_desc_stats_request
13759
13760class port_mod(message):
13761 version = 5
13762 type = 16
13763
13764 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
13765 if xid != None:
13766 self.xid = xid
13767 else:
13768 self.xid = None
13769 if port_no != None:
13770 self.port_no = port_no
13771 else:
13772 self.port_no = 0
13773 if hw_addr != None:
13774 self.hw_addr = hw_addr
13775 else:
13776 self.hw_addr = [0,0,0,0,0,0]
13777 if config != None:
13778 self.config = config
13779 else:
13780 self.config = 0
13781 if mask != None:
13782 self.mask = mask
13783 else:
13784 self.mask = 0
13785 if properties != None:
13786 self.properties = properties
13787 else:
13788 self.properties = []
13789 return
13790
13791 def pack(self):
13792 packed = []
13793 packed.append(struct.pack("!B", self.version))
13794 packed.append(struct.pack("!B", self.type))
13795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13796 packed.append(struct.pack("!L", self.xid))
13797 packed.append(util.pack_port_no(self.port_no))
13798 packed.append('\x00' * 4)
13799 packed.append(struct.pack("!6B", *self.hw_addr))
13800 packed.append('\x00' * 2)
13801 packed.append(struct.pack("!L", self.config))
13802 packed.append(struct.pack("!L", self.mask))
13803 packed.append(loxi.generic_util.pack_list(self.properties))
13804 length = sum([len(x) for x in packed])
13805 packed[2] = struct.pack("!H", length)
13806 return ''.join(packed)
13807
13808 @staticmethod
13809 def unpack(reader):
13810 obj = port_mod()
13811 _version = reader.read("!B")[0]
13812 assert(_version == 5)
13813 _type = reader.read("!B")[0]
13814 assert(_type == 16)
13815 _length = reader.read("!H")[0]
13816 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013817 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013818 obj.xid = reader.read("!L")[0]
13819 obj.port_no = util.unpack_port_no(reader)
13820 reader.skip(4)
13821 obj.hw_addr = list(reader.read('!6B'))
13822 reader.skip(2)
13823 obj.config = reader.read("!L")[0]
13824 obj.mask = reader.read("!L")[0]
13825 obj.properties = loxi.generic_util.unpack_list(reader, port_mod_prop.port_mod_prop.unpack)
13826 return obj
13827
13828 def __eq__(self, other):
13829 if type(self) != type(other): return False
13830 if self.xid != other.xid: return False
13831 if self.port_no != other.port_no: return False
13832 if self.hw_addr != other.hw_addr: return False
13833 if self.config != other.config: return False
13834 if self.mask != other.mask: return False
13835 if self.properties != other.properties: return False
13836 return True
13837
13838 def pretty_print(self, q):
13839 q.text("port_mod {")
13840 with q.group():
13841 with q.indent(2):
13842 q.breakable()
13843 q.text("xid = ");
13844 if self.xid != None:
13845 q.text("%#x" % self.xid)
13846 else:
13847 q.text('None')
13848 q.text(","); q.breakable()
13849 q.text("port_no = ");
13850 q.text(util.pretty_port(self.port_no))
13851 q.text(","); q.breakable()
13852 q.text("hw_addr = ");
13853 q.text(util.pretty_mac(self.hw_addr))
13854 q.text(","); q.breakable()
13855 q.text("config = ");
13856 q.text("%#x" % self.config)
13857 q.text(","); q.breakable()
13858 q.text("mask = ");
13859 q.text("%#x" % self.mask)
13860 q.text(","); q.breakable()
13861 q.text("properties = ");
13862 q.pp(self.properties)
13863 q.breakable()
13864 q.text('}')
13865
13866message.subtypes[16] = port_mod
13867
13868class port_mod_failed_error_msg(error_msg):
13869 version = 5
13870 type = 1
13871 err_type = 7
13872
13873 def __init__(self, xid=None, code=None, data=None):
13874 if xid != None:
13875 self.xid = xid
13876 else:
13877 self.xid = None
13878 if code != None:
13879 self.code = code
13880 else:
13881 self.code = 0
13882 if data != None:
13883 self.data = data
13884 else:
13885 self.data = ''
13886 return
13887
13888 def pack(self):
13889 packed = []
13890 packed.append(struct.pack("!B", self.version))
13891 packed.append(struct.pack("!B", self.type))
13892 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13893 packed.append(struct.pack("!L", self.xid))
13894 packed.append(struct.pack("!H", self.err_type))
13895 packed.append(struct.pack("!H", self.code))
13896 packed.append(self.data)
13897 length = sum([len(x) for x in packed])
13898 packed[2] = struct.pack("!H", length)
13899 return ''.join(packed)
13900
13901 @staticmethod
13902 def unpack(reader):
13903 obj = port_mod_failed_error_msg()
13904 _version = reader.read("!B")[0]
13905 assert(_version == 5)
13906 _type = reader.read("!B")[0]
13907 assert(_type == 1)
13908 _length = reader.read("!H")[0]
13909 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013910 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013911 obj.xid = reader.read("!L")[0]
13912 _err_type = reader.read("!H")[0]
13913 assert(_err_type == 7)
13914 obj.code = reader.read("!H")[0]
13915 obj.data = str(reader.read_all())
13916 return obj
13917
13918 def __eq__(self, other):
13919 if type(self) != type(other): return False
13920 if self.xid != other.xid: return False
13921 if self.code != other.code: return False
13922 if self.data != other.data: return False
13923 return True
13924
13925 def pretty_print(self, q):
13926 q.text("port_mod_failed_error_msg {")
13927 with q.group():
13928 with q.indent(2):
13929 q.breakable()
13930 q.text("xid = ");
13931 if self.xid != None:
13932 q.text("%#x" % self.xid)
13933 else:
13934 q.text('None')
13935 q.text(","); q.breakable()
13936 q.text("code = ");
13937 q.text("%#x" % self.code)
13938 q.text(","); q.breakable()
13939 q.text("data = ");
13940 q.pp(self.data)
13941 q.breakable()
13942 q.text('}')
13943
13944error_msg.subtypes[7] = port_mod_failed_error_msg
13945
13946class port_stats_reply(stats_reply):
13947 version = 5
13948 type = 19
13949 stats_type = 4
13950
13951 def __init__(self, xid=None, flags=None, entries=None):
13952 if xid != None:
13953 self.xid = xid
13954 else:
13955 self.xid = None
13956 if flags != None:
13957 self.flags = flags
13958 else:
13959 self.flags = 0
13960 if entries != None:
13961 self.entries = entries
13962 else:
13963 self.entries = []
13964 return
13965
13966 def pack(self):
13967 packed = []
13968 packed.append(struct.pack("!B", self.version))
13969 packed.append(struct.pack("!B", self.type))
13970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13971 packed.append(struct.pack("!L", self.xid))
13972 packed.append(struct.pack("!H", self.stats_type))
13973 packed.append(struct.pack("!H", self.flags))
13974 packed.append('\x00' * 4)
13975 packed.append(loxi.generic_util.pack_list(self.entries))
13976 length = sum([len(x) for x in packed])
13977 packed[2] = struct.pack("!H", length)
13978 return ''.join(packed)
13979
13980 @staticmethod
13981 def unpack(reader):
13982 obj = port_stats_reply()
13983 _version = reader.read("!B")[0]
13984 assert(_version == 5)
13985 _type = reader.read("!B")[0]
13986 assert(_type == 19)
13987 _length = reader.read("!H")[0]
13988 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013989 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013990 obj.xid = reader.read("!L")[0]
13991 _stats_type = reader.read("!H")[0]
13992 assert(_stats_type == 4)
13993 obj.flags = reader.read("!H")[0]
13994 reader.skip(4)
13995 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13996 return obj
13997
13998 def __eq__(self, other):
13999 if type(self) != type(other): return False
14000 if self.xid != other.xid: return False
14001 if self.flags != other.flags: return False
14002 if self.entries != other.entries: return False
14003 return True
14004
14005 def pretty_print(self, q):
14006 q.text("port_stats_reply {")
14007 with q.group():
14008 with q.indent(2):
14009 q.breakable()
14010 q.text("xid = ");
14011 if self.xid != None:
14012 q.text("%#x" % self.xid)
14013 else:
14014 q.text('None')
14015 q.text(","); q.breakable()
14016 q.text("flags = ");
14017 q.text("%#x" % self.flags)
14018 q.text(","); q.breakable()
14019 q.text("entries = ");
14020 q.pp(self.entries)
14021 q.breakable()
14022 q.text('}')
14023
14024stats_reply.subtypes[4] = port_stats_reply
14025
14026class port_stats_request(stats_request):
14027 version = 5
14028 type = 18
14029 stats_type = 4
14030
14031 def __init__(self, xid=None, flags=None, port_no=None):
14032 if xid != None:
14033 self.xid = xid
14034 else:
14035 self.xid = None
14036 if flags != None:
14037 self.flags = flags
14038 else:
14039 self.flags = 0
14040 if port_no != None:
14041 self.port_no = port_no
14042 else:
14043 self.port_no = 0
14044 return
14045
14046 def pack(self):
14047 packed = []
14048 packed.append(struct.pack("!B", self.version))
14049 packed.append(struct.pack("!B", self.type))
14050 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14051 packed.append(struct.pack("!L", self.xid))
14052 packed.append(struct.pack("!H", self.stats_type))
14053 packed.append(struct.pack("!H", self.flags))
14054 packed.append('\x00' * 4)
14055 packed.append(util.pack_port_no(self.port_no))
14056 packed.append('\x00' * 4)
14057 length = sum([len(x) for x in packed])
14058 packed[2] = struct.pack("!H", length)
14059 return ''.join(packed)
14060
14061 @staticmethod
14062 def unpack(reader):
14063 obj = port_stats_request()
14064 _version = reader.read("!B")[0]
14065 assert(_version == 5)
14066 _type = reader.read("!B")[0]
14067 assert(_type == 18)
14068 _length = reader.read("!H")[0]
14069 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014070 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014071 obj.xid = reader.read("!L")[0]
14072 _stats_type = reader.read("!H")[0]
14073 assert(_stats_type == 4)
14074 obj.flags = reader.read("!H")[0]
14075 reader.skip(4)
14076 obj.port_no = util.unpack_port_no(reader)
14077 reader.skip(4)
14078 return obj
14079
14080 def __eq__(self, other):
14081 if type(self) != type(other): return False
14082 if self.xid != other.xid: return False
14083 if self.flags != other.flags: return False
14084 if self.port_no != other.port_no: return False
14085 return True
14086
14087 def pretty_print(self, q):
14088 q.text("port_stats_request {")
14089 with q.group():
14090 with q.indent(2):
14091 q.breakable()
14092 q.text("xid = ");
14093 if self.xid != None:
14094 q.text("%#x" % self.xid)
14095 else:
14096 q.text('None')
14097 q.text(","); q.breakable()
14098 q.text("flags = ");
14099 q.text("%#x" % self.flags)
14100 q.text(","); q.breakable()
14101 q.text("port_no = ");
14102 q.text(util.pretty_port(self.port_no))
14103 q.breakable()
14104 q.text('}')
14105
14106stats_request.subtypes[4] = port_stats_request
14107
14108class port_status(message):
14109 version = 5
14110 type = 12
14111
14112 def __init__(self, xid=None, reason=None, desc=None):
14113 if xid != None:
14114 self.xid = xid
14115 else:
14116 self.xid = None
14117 if reason != None:
14118 self.reason = reason
14119 else:
14120 self.reason = 0
14121 if desc != None:
14122 self.desc = desc
14123 else:
14124 self.desc = common.port_desc()
14125 return
14126
14127 def pack(self):
14128 packed = []
14129 packed.append(struct.pack("!B", self.version))
14130 packed.append(struct.pack("!B", self.type))
14131 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14132 packed.append(struct.pack("!L", self.xid))
14133 packed.append(struct.pack("!B", self.reason))
14134 packed.append('\x00' * 7)
14135 packed.append(self.desc.pack())
14136 length = sum([len(x) for x in packed])
14137 packed[2] = struct.pack("!H", length)
14138 return ''.join(packed)
14139
14140 @staticmethod
14141 def unpack(reader):
14142 obj = port_status()
14143 _version = reader.read("!B")[0]
14144 assert(_version == 5)
14145 _type = reader.read("!B")[0]
14146 assert(_type == 12)
14147 _length = reader.read("!H")[0]
14148 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014149 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014150 obj.xid = reader.read("!L")[0]
14151 obj.reason = reader.read("!B")[0]
14152 reader.skip(7)
14153 obj.desc = common.port_desc.unpack(reader)
14154 return obj
14155
14156 def __eq__(self, other):
14157 if type(self) != type(other): return False
14158 if self.xid != other.xid: return False
14159 if self.reason != other.reason: return False
14160 if self.desc != other.desc: return False
14161 return True
14162
14163 def pretty_print(self, q):
14164 q.text("port_status {")
14165 with q.group():
14166 with q.indent(2):
14167 q.breakable()
14168 q.text("xid = ");
14169 if self.xid != None:
14170 q.text("%#x" % self.xid)
14171 else:
14172 q.text('None')
14173 q.text(","); q.breakable()
14174 q.text("reason = ");
14175 q.text("%#x" % self.reason)
14176 q.text(","); q.breakable()
14177 q.text("desc = ");
14178 q.pp(self.desc)
14179 q.breakable()
14180 q.text('}')
14181
14182message.subtypes[12] = port_status
14183
14184class queue_desc_stats_reply(stats_reply):
14185 version = 5
14186 type = 19
14187 stats_type = 15
14188
14189 def __init__(self, xid=None, flags=None, entries=None):
14190 if xid != None:
14191 self.xid = xid
14192 else:
14193 self.xid = None
14194 if flags != None:
14195 self.flags = flags
14196 else:
14197 self.flags = 0
14198 if entries != None:
14199 self.entries = entries
14200 else:
14201 self.entries = []
14202 return
14203
14204 def pack(self):
14205 packed = []
14206 packed.append(struct.pack("!B", self.version))
14207 packed.append(struct.pack("!B", self.type))
14208 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14209 packed.append(struct.pack("!L", self.xid))
14210 packed.append(struct.pack("!H", self.stats_type))
14211 packed.append(struct.pack("!H", self.flags))
14212 packed.append('\x00' * 4)
14213 packed.append(loxi.generic_util.pack_list(self.entries))
14214 length = sum([len(x) for x in packed])
14215 packed[2] = struct.pack("!H", length)
14216 return ''.join(packed)
14217
14218 @staticmethod
14219 def unpack(reader):
14220 obj = queue_desc_stats_reply()
14221 _version = reader.read("!B")[0]
14222 assert(_version == 5)
14223 _type = reader.read("!B")[0]
14224 assert(_type == 19)
14225 _length = reader.read("!H")[0]
14226 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014227 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014228 obj.xid = reader.read("!L")[0]
14229 _stats_type = reader.read("!H")[0]
14230 assert(_stats_type == 15)
14231 obj.flags = reader.read("!H")[0]
14232 reader.skip(4)
14233 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_desc.unpack)
14234 return obj
14235
14236 def __eq__(self, other):
14237 if type(self) != type(other): return False
14238 if self.xid != other.xid: return False
14239 if self.flags != other.flags: return False
14240 if self.entries != other.entries: return False
14241 return True
14242
14243 def pretty_print(self, q):
14244 q.text("queue_desc_stats_reply {")
14245 with q.group():
14246 with q.indent(2):
14247 q.breakable()
14248 q.text("xid = ");
14249 if self.xid != None:
14250 q.text("%#x" % self.xid)
14251 else:
14252 q.text('None')
14253 q.text(","); q.breakable()
14254 q.text("flags = ");
14255 q.text("%#x" % self.flags)
14256 q.text(","); q.breakable()
14257 q.text("entries = ");
14258 q.pp(self.entries)
14259 q.breakable()
14260 q.text('}')
14261
14262stats_reply.subtypes[15] = queue_desc_stats_reply
14263
14264class queue_desc_stats_request(stats_request):
14265 version = 5
14266 type = 18
14267 stats_type = 15
14268
14269 def __init__(self, xid=None, flags=None):
14270 if xid != None:
14271 self.xid = xid
14272 else:
14273 self.xid = None
14274 if flags != None:
14275 self.flags = flags
14276 else:
14277 self.flags = 0
14278 return
14279
14280 def pack(self):
14281 packed = []
14282 packed.append(struct.pack("!B", self.version))
14283 packed.append(struct.pack("!B", self.type))
14284 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14285 packed.append(struct.pack("!L", self.xid))
14286 packed.append(struct.pack("!H", self.stats_type))
14287 packed.append(struct.pack("!H", self.flags))
14288 packed.append('\x00' * 4)
14289 length = sum([len(x) for x in packed])
14290 packed[2] = struct.pack("!H", length)
14291 return ''.join(packed)
14292
14293 @staticmethod
14294 def unpack(reader):
14295 obj = queue_desc_stats_request()
14296 _version = reader.read("!B")[0]
14297 assert(_version == 5)
14298 _type = reader.read("!B")[0]
14299 assert(_type == 18)
14300 _length = reader.read("!H")[0]
14301 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014302 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014303 obj.xid = reader.read("!L")[0]
14304 _stats_type = reader.read("!H")[0]
14305 assert(_stats_type == 15)
14306 obj.flags = reader.read("!H")[0]
14307 reader.skip(4)
14308 return obj
14309
14310 def __eq__(self, other):
14311 if type(self) != type(other): return False
14312 if self.xid != other.xid: return False
14313 if self.flags != other.flags: return False
14314 return True
14315
14316 def pretty_print(self, q):
14317 q.text("queue_desc_stats_request {")
14318 with q.group():
14319 with q.indent(2):
14320 q.breakable()
14321 q.text("xid = ");
14322 if self.xid != None:
14323 q.text("%#x" % self.xid)
14324 else:
14325 q.text('None')
14326 q.text(","); q.breakable()
14327 q.text("flags = ");
14328 q.text("%#x" % self.flags)
14329 q.breakable()
14330 q.text('}')
14331
14332stats_request.subtypes[15] = queue_desc_stats_request
14333
14334class queue_op_failed_error_msg(error_msg):
14335 version = 5
14336 type = 1
14337 err_type = 9
14338
14339 def __init__(self, xid=None, code=None, data=None):
14340 if xid != None:
14341 self.xid = xid
14342 else:
14343 self.xid = None
14344 if code != None:
14345 self.code = code
14346 else:
14347 self.code = 0
14348 if data != None:
14349 self.data = data
14350 else:
14351 self.data = ''
14352 return
14353
14354 def pack(self):
14355 packed = []
14356 packed.append(struct.pack("!B", self.version))
14357 packed.append(struct.pack("!B", self.type))
14358 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14359 packed.append(struct.pack("!L", self.xid))
14360 packed.append(struct.pack("!H", self.err_type))
14361 packed.append(struct.pack("!H", self.code))
14362 packed.append(self.data)
14363 length = sum([len(x) for x in packed])
14364 packed[2] = struct.pack("!H", length)
14365 return ''.join(packed)
14366
14367 @staticmethod
14368 def unpack(reader):
14369 obj = queue_op_failed_error_msg()
14370 _version = reader.read("!B")[0]
14371 assert(_version == 5)
14372 _type = reader.read("!B")[0]
14373 assert(_type == 1)
14374 _length = reader.read("!H")[0]
14375 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014376 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014377 obj.xid = reader.read("!L")[0]
14378 _err_type = reader.read("!H")[0]
14379 assert(_err_type == 9)
14380 obj.code = reader.read("!H")[0]
14381 obj.data = str(reader.read_all())
14382 return obj
14383
14384 def __eq__(self, other):
14385 if type(self) != type(other): return False
14386 if self.xid != other.xid: return False
14387 if self.code != other.code: return False
14388 if self.data != other.data: return False
14389 return True
14390
14391 def pretty_print(self, q):
14392 q.text("queue_op_failed_error_msg {")
14393 with q.group():
14394 with q.indent(2):
14395 q.breakable()
14396 q.text("xid = ");
14397 if self.xid != None:
14398 q.text("%#x" % self.xid)
14399 else:
14400 q.text('None')
14401 q.text(","); q.breakable()
14402 q.text("code = ");
14403 q.text("%#x" % self.code)
14404 q.text(","); q.breakable()
14405 q.text("data = ");
14406 q.pp(self.data)
14407 q.breakable()
14408 q.text('}')
14409
14410error_msg.subtypes[9] = queue_op_failed_error_msg
14411
14412class queue_stats_reply(stats_reply):
14413 version = 5
14414 type = 19
14415 stats_type = 5
14416
14417 def __init__(self, xid=None, flags=None, entries=None):
14418 if xid != None:
14419 self.xid = xid
14420 else:
14421 self.xid = None
14422 if flags != None:
14423 self.flags = flags
14424 else:
14425 self.flags = 0
14426 if entries != None:
14427 self.entries = entries
14428 else:
14429 self.entries = []
14430 return
14431
14432 def pack(self):
14433 packed = []
14434 packed.append(struct.pack("!B", self.version))
14435 packed.append(struct.pack("!B", self.type))
14436 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14437 packed.append(struct.pack("!L", self.xid))
14438 packed.append(struct.pack("!H", self.stats_type))
14439 packed.append(struct.pack("!H", self.flags))
14440 packed.append('\x00' * 4)
14441 packed.append(loxi.generic_util.pack_list(self.entries))
14442 length = sum([len(x) for x in packed])
14443 packed[2] = struct.pack("!H", length)
14444 return ''.join(packed)
14445
14446 @staticmethod
14447 def unpack(reader):
14448 obj = queue_stats_reply()
14449 _version = reader.read("!B")[0]
14450 assert(_version == 5)
14451 _type = reader.read("!B")[0]
14452 assert(_type == 19)
14453 _length = reader.read("!H")[0]
14454 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014455 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014456 obj.xid = reader.read("!L")[0]
14457 _stats_type = reader.read("!H")[0]
14458 assert(_stats_type == 5)
14459 obj.flags = reader.read("!H")[0]
14460 reader.skip(4)
14461 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
14462 return obj
14463
14464 def __eq__(self, other):
14465 if type(self) != type(other): return False
14466 if self.xid != other.xid: return False
14467 if self.flags != other.flags: return False
14468 if self.entries != other.entries: return False
14469 return True
14470
14471 def pretty_print(self, q):
14472 q.text("queue_stats_reply {")
14473 with q.group():
14474 with q.indent(2):
14475 q.breakable()
14476 q.text("xid = ");
14477 if self.xid != None:
14478 q.text("%#x" % self.xid)
14479 else:
14480 q.text('None')
14481 q.text(","); q.breakable()
14482 q.text("flags = ");
14483 q.text("%#x" % self.flags)
14484 q.text(","); q.breakable()
14485 q.text("entries = ");
14486 q.pp(self.entries)
14487 q.breakable()
14488 q.text('}')
14489
14490stats_reply.subtypes[5] = queue_stats_reply
14491
14492class queue_stats_request(stats_request):
14493 version = 5
14494 type = 18
14495 stats_type = 5
14496
14497 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14498 if xid != None:
14499 self.xid = xid
14500 else:
14501 self.xid = None
14502 if flags != None:
14503 self.flags = flags
14504 else:
14505 self.flags = 0
14506 if port_no != None:
14507 self.port_no = port_no
14508 else:
14509 self.port_no = 0
14510 if queue_id != None:
14511 self.queue_id = queue_id
14512 else:
14513 self.queue_id = 0
14514 return
14515
14516 def pack(self):
14517 packed = []
14518 packed.append(struct.pack("!B", self.version))
14519 packed.append(struct.pack("!B", self.type))
14520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14521 packed.append(struct.pack("!L", self.xid))
14522 packed.append(struct.pack("!H", self.stats_type))
14523 packed.append(struct.pack("!H", self.flags))
14524 packed.append('\x00' * 4)
14525 packed.append(util.pack_port_no(self.port_no))
14526 packed.append(struct.pack("!L", self.queue_id))
14527 length = sum([len(x) for x in packed])
14528 packed[2] = struct.pack("!H", length)
14529 return ''.join(packed)
14530
14531 @staticmethod
14532 def unpack(reader):
14533 obj = queue_stats_request()
14534 _version = reader.read("!B")[0]
14535 assert(_version == 5)
14536 _type = reader.read("!B")[0]
14537 assert(_type == 18)
14538 _length = reader.read("!H")[0]
14539 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014540 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014541 obj.xid = reader.read("!L")[0]
14542 _stats_type = reader.read("!H")[0]
14543 assert(_stats_type == 5)
14544 obj.flags = reader.read("!H")[0]
14545 reader.skip(4)
14546 obj.port_no = util.unpack_port_no(reader)
14547 obj.queue_id = reader.read("!L")[0]
14548 return obj
14549
14550 def __eq__(self, other):
14551 if type(self) != type(other): return False
14552 if self.xid != other.xid: return False
14553 if self.flags != other.flags: return False
14554 if self.port_no != other.port_no: return False
14555 if self.queue_id != other.queue_id: return False
14556 return True
14557
14558 def pretty_print(self, q):
14559 q.text("queue_stats_request {")
14560 with q.group():
14561 with q.indent(2):
14562 q.breakable()
14563 q.text("xid = ");
14564 if self.xid != None:
14565 q.text("%#x" % self.xid)
14566 else:
14567 q.text('None')
14568 q.text(","); q.breakable()
14569 q.text("flags = ");
14570 q.text("%#x" % self.flags)
14571 q.text(","); q.breakable()
14572 q.text("port_no = ");
14573 q.text(util.pretty_port(self.port_no))
14574 q.text(","); q.breakable()
14575 q.text("queue_id = ");
14576 q.text("%#x" % self.queue_id)
14577 q.breakable()
14578 q.text('}')
14579
14580stats_request.subtypes[5] = queue_stats_request
14581
14582class requestforward(message):
14583 version = 5
14584 type = 32
14585
14586 def __init__(self, xid=None, role=None, data=None):
14587 if xid != None:
14588 self.xid = xid
14589 else:
14590 self.xid = None
14591 if role != None:
14592 self.role = role
14593 else:
14594 self.role = 0
14595 if data != None:
14596 self.data = data
14597 else:
14598 self.data = ''
14599 return
14600
14601 def pack(self):
14602 packed = []
14603 packed.append(struct.pack("!B", self.version))
14604 packed.append(struct.pack("!B", self.type))
14605 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14606 packed.append(struct.pack("!L", self.xid))
14607 packed.append(struct.pack("!L", self.role))
14608 packed.append(self.data)
14609 length = sum([len(x) for x in packed])
14610 packed[2] = struct.pack("!H", length)
14611 return ''.join(packed)
14612
14613 @staticmethod
14614 def unpack(reader):
14615 obj = requestforward()
14616 _version = reader.read("!B")[0]
14617 assert(_version == 5)
14618 _type = reader.read("!B")[0]
14619 assert(_type == 32)
14620 _length = reader.read("!H")[0]
14621 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014622 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014623 obj.xid = reader.read("!L")[0]
14624 obj.role = reader.read("!L")[0]
14625 obj.data = str(reader.read_all())
14626 return obj
14627
14628 def __eq__(self, other):
14629 if type(self) != type(other): return False
14630 if self.xid != other.xid: return False
14631 if self.role != other.role: return False
14632 if self.data != other.data: return False
14633 return True
14634
14635 def pretty_print(self, q):
14636 q.text("requestforward {")
14637 with q.group():
14638 with q.indent(2):
14639 q.breakable()
14640 q.text("xid = ");
14641 if self.xid != None:
14642 q.text("%#x" % self.xid)
14643 else:
14644 q.text('None')
14645 q.text(","); q.breakable()
14646 q.text("role = ");
14647 q.text("%#x" % self.role)
14648 q.text(","); q.breakable()
14649 q.text("data = ");
14650 q.pp(self.data)
14651 q.breakable()
14652 q.text('}')
14653
14654message.subtypes[32] = requestforward
14655
14656class role_reply(message):
14657 version = 5
14658 type = 25
14659
14660 def __init__(self, xid=None, role=None, generation_id=None):
14661 if xid != None:
14662 self.xid = xid
14663 else:
14664 self.xid = None
14665 if role != None:
14666 self.role = role
14667 else:
14668 self.role = 0
14669 if generation_id != None:
14670 self.generation_id = generation_id
14671 else:
14672 self.generation_id = 0
14673 return
14674
14675 def pack(self):
14676 packed = []
14677 packed.append(struct.pack("!B", self.version))
14678 packed.append(struct.pack("!B", self.type))
14679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14680 packed.append(struct.pack("!L", self.xid))
14681 packed.append(struct.pack("!L", self.role))
14682 packed.append('\x00' * 4)
14683 packed.append(struct.pack("!Q", self.generation_id))
14684 length = sum([len(x) for x in packed])
14685 packed[2] = struct.pack("!H", length)
14686 return ''.join(packed)
14687
14688 @staticmethod
14689 def unpack(reader):
14690 obj = role_reply()
14691 _version = reader.read("!B")[0]
14692 assert(_version == 5)
14693 _type = reader.read("!B")[0]
14694 assert(_type == 25)
14695 _length = reader.read("!H")[0]
14696 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014697 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014698 obj.xid = reader.read("!L")[0]
14699 obj.role = reader.read("!L")[0]
14700 reader.skip(4)
14701 obj.generation_id = reader.read("!Q")[0]
14702 return obj
14703
14704 def __eq__(self, other):
14705 if type(self) != type(other): return False
14706 if self.xid != other.xid: return False
14707 if self.role != other.role: return False
14708 if self.generation_id != other.generation_id: return False
14709 return True
14710
14711 def pretty_print(self, q):
14712 q.text("role_reply {")
14713 with q.group():
14714 with q.indent(2):
14715 q.breakable()
14716 q.text("xid = ");
14717 if self.xid != None:
14718 q.text("%#x" % self.xid)
14719 else:
14720 q.text('None')
14721 q.text(","); q.breakable()
14722 q.text("role = ");
14723 q.text("%#x" % self.role)
14724 q.text(","); q.breakable()
14725 q.text("generation_id = ");
14726 q.text("%#x" % self.generation_id)
14727 q.breakable()
14728 q.text('}')
14729
14730message.subtypes[25] = role_reply
14731
14732class role_request(message):
14733 version = 5
14734 type = 24
14735
14736 def __init__(self, xid=None, role=None, generation_id=None):
14737 if xid != None:
14738 self.xid = xid
14739 else:
14740 self.xid = None
14741 if role != None:
14742 self.role = role
14743 else:
14744 self.role = 0
14745 if generation_id != None:
14746 self.generation_id = generation_id
14747 else:
14748 self.generation_id = 0
14749 return
14750
14751 def pack(self):
14752 packed = []
14753 packed.append(struct.pack("!B", self.version))
14754 packed.append(struct.pack("!B", self.type))
14755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14756 packed.append(struct.pack("!L", self.xid))
14757 packed.append(struct.pack("!L", self.role))
14758 packed.append('\x00' * 4)
14759 packed.append(struct.pack("!Q", self.generation_id))
14760 length = sum([len(x) for x in packed])
14761 packed[2] = struct.pack("!H", length)
14762 return ''.join(packed)
14763
14764 @staticmethod
14765 def unpack(reader):
14766 obj = role_request()
14767 _version = reader.read("!B")[0]
14768 assert(_version == 5)
14769 _type = reader.read("!B")[0]
14770 assert(_type == 24)
14771 _length = reader.read("!H")[0]
14772 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014773 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014774 obj.xid = reader.read("!L")[0]
14775 obj.role = reader.read("!L")[0]
14776 reader.skip(4)
14777 obj.generation_id = reader.read("!Q")[0]
14778 return obj
14779
14780 def __eq__(self, other):
14781 if type(self) != type(other): return False
14782 if self.xid != other.xid: return False
14783 if self.role != other.role: return False
14784 if self.generation_id != other.generation_id: return False
14785 return True
14786
14787 def pretty_print(self, q):
14788 q.text("role_request {")
14789 with q.group():
14790 with q.indent(2):
14791 q.breakable()
14792 q.text("xid = ");
14793 if self.xid != None:
14794 q.text("%#x" % self.xid)
14795 else:
14796 q.text('None')
14797 q.text(","); q.breakable()
14798 q.text("role = ");
14799 q.text("%#x" % self.role)
14800 q.text(","); q.breakable()
14801 q.text("generation_id = ");
14802 q.text("%#x" % self.generation_id)
14803 q.breakable()
14804 q.text('}')
14805
14806message.subtypes[24] = role_request
14807
14808class role_request_failed_error_msg(error_msg):
14809 version = 5
14810 type = 1
14811 err_type = 11
14812
14813 def __init__(self, xid=None, code=None, data=None):
14814 if xid != None:
14815 self.xid = xid
14816 else:
14817 self.xid = None
14818 if code != None:
14819 self.code = code
14820 else:
14821 self.code = 0
14822 if data != None:
14823 self.data = data
14824 else:
14825 self.data = ''
14826 return
14827
14828 def pack(self):
14829 packed = []
14830 packed.append(struct.pack("!B", self.version))
14831 packed.append(struct.pack("!B", self.type))
14832 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14833 packed.append(struct.pack("!L", self.xid))
14834 packed.append(struct.pack("!H", self.err_type))
14835 packed.append(struct.pack("!H", self.code))
14836 packed.append(self.data)
14837 length = sum([len(x) for x in packed])
14838 packed[2] = struct.pack("!H", length)
14839 return ''.join(packed)
14840
14841 @staticmethod
14842 def unpack(reader):
14843 obj = role_request_failed_error_msg()
14844 _version = reader.read("!B")[0]
14845 assert(_version == 5)
14846 _type = reader.read("!B")[0]
14847 assert(_type == 1)
14848 _length = reader.read("!H")[0]
14849 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014850 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014851 obj.xid = reader.read("!L")[0]
14852 _err_type = reader.read("!H")[0]
14853 assert(_err_type == 11)
14854 obj.code = reader.read("!H")[0]
14855 obj.data = str(reader.read_all())
14856 return obj
14857
14858 def __eq__(self, other):
14859 if type(self) != type(other): return False
14860 if self.xid != other.xid: return False
14861 if self.code != other.code: return False
14862 if self.data != other.data: return False
14863 return True
14864
14865 def pretty_print(self, q):
14866 q.text("role_request_failed_error_msg {")
14867 with q.group():
14868 with q.indent(2):
14869 q.breakable()
14870 q.text("xid = ");
14871 if self.xid != None:
14872 q.text("%#x" % self.xid)
14873 else:
14874 q.text('None')
14875 q.text(","); q.breakable()
14876 q.text("code = ");
14877 q.text("%#x" % self.code)
14878 q.text(","); q.breakable()
14879 q.text("data = ");
14880 q.pp(self.data)
14881 q.breakable()
14882 q.text('}')
14883
14884error_msg.subtypes[11] = role_request_failed_error_msg
14885
14886class role_status(message):
14887 version = 5
14888 type = 30
14889
14890 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
14891 if xid != None:
14892 self.xid = xid
14893 else:
14894 self.xid = None
14895 if role != None:
14896 self.role = role
14897 else:
14898 self.role = 0
14899 if reason != None:
14900 self.reason = reason
14901 else:
14902 self.reason = 0
14903 if generation_id != None:
14904 self.generation_id = generation_id
14905 else:
14906 self.generation_id = 0
14907 if properties != None:
14908 self.properties = properties
14909 else:
14910 self.properties = []
14911 return
14912
14913 def pack(self):
14914 packed = []
14915 packed.append(struct.pack("!B", self.version))
14916 packed.append(struct.pack("!B", self.type))
14917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14918 packed.append(struct.pack("!L", self.xid))
14919 packed.append(struct.pack("!L", self.role))
14920 packed.append(struct.pack("!B", self.reason))
14921 packed.append('\x00' * 3)
14922 packed.append(struct.pack("!Q", self.generation_id))
14923 packed.append(loxi.generic_util.pack_list(self.properties))
14924 length = sum([len(x) for x in packed])
14925 packed[2] = struct.pack("!H", length)
14926 return ''.join(packed)
14927
14928 @staticmethod
14929 def unpack(reader):
14930 obj = role_status()
14931 _version = reader.read("!B")[0]
14932 assert(_version == 5)
14933 _type = reader.read("!B")[0]
14934 assert(_type == 30)
14935 _length = reader.read("!H")[0]
14936 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014937 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014938 obj.xid = reader.read("!L")[0]
14939 obj.role = reader.read("!L")[0]
14940 obj.reason = reader.read("!B")[0]
14941 reader.skip(3)
14942 obj.generation_id = reader.read("!Q")[0]
14943 obj.properties = loxi.generic_util.unpack_list(reader, role_prop.role_prop.unpack)
14944 return obj
14945
14946 def __eq__(self, other):
14947 if type(self) != type(other): return False
14948 if self.xid != other.xid: return False
14949 if self.role != other.role: return False
14950 if self.reason != other.reason: return False
14951 if self.generation_id != other.generation_id: return False
14952 if self.properties != other.properties: return False
14953 return True
14954
14955 def pretty_print(self, q):
14956 q.text("role_status {")
14957 with q.group():
14958 with q.indent(2):
14959 q.breakable()
14960 q.text("xid = ");
14961 if self.xid != None:
14962 q.text("%#x" % self.xid)
14963 else:
14964 q.text('None')
14965 q.text(","); q.breakable()
14966 q.text("role = ");
14967 q.text("%#x" % self.role)
14968 q.text(","); q.breakable()
14969 q.text("reason = ");
14970 q.text("%#x" % self.reason)
14971 q.text(","); q.breakable()
14972 q.text("generation_id = ");
14973 q.text("%#x" % self.generation_id)
14974 q.text(","); q.breakable()
14975 q.text("properties = ");
14976 q.pp(self.properties)
14977 q.breakable()
14978 q.text('}')
14979
14980message.subtypes[30] = role_status
14981
14982class set_config(message):
14983 version = 5
14984 type = 9
14985
14986 def __init__(self, xid=None, flags=None, miss_send_len=None):
14987 if xid != None:
14988 self.xid = xid
14989 else:
14990 self.xid = None
14991 if flags != None:
14992 self.flags = flags
14993 else:
14994 self.flags = 0
14995 if miss_send_len != None:
14996 self.miss_send_len = miss_send_len
14997 else:
14998 self.miss_send_len = 0
14999 return
15000
15001 def pack(self):
15002 packed = []
15003 packed.append(struct.pack("!B", self.version))
15004 packed.append(struct.pack("!B", self.type))
15005 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15006 packed.append(struct.pack("!L", self.xid))
15007 packed.append(struct.pack("!H", self.flags))
15008 packed.append(struct.pack("!H", self.miss_send_len))
15009 length = sum([len(x) for x in packed])
15010 packed[2] = struct.pack("!H", length)
15011 return ''.join(packed)
15012
15013 @staticmethod
15014 def unpack(reader):
15015 obj = set_config()
15016 _version = reader.read("!B")[0]
15017 assert(_version == 5)
15018 _type = reader.read("!B")[0]
15019 assert(_type == 9)
15020 _length = reader.read("!H")[0]
15021 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015022 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015023 obj.xid = reader.read("!L")[0]
15024 obj.flags = reader.read("!H")[0]
15025 obj.miss_send_len = reader.read("!H")[0]
15026 return obj
15027
15028 def __eq__(self, other):
15029 if type(self) != type(other): return False
15030 if self.xid != other.xid: return False
15031 if self.flags != other.flags: return False
15032 if self.miss_send_len != other.miss_send_len: return False
15033 return True
15034
15035 def pretty_print(self, q):
15036 q.text("set_config {")
15037 with q.group():
15038 with q.indent(2):
15039 q.breakable()
15040 q.text("xid = ");
15041 if self.xid != None:
15042 q.text("%#x" % self.xid)
15043 else:
15044 q.text('None')
15045 q.text(","); q.breakable()
15046 q.text("flags = ");
15047 q.text("%#x" % self.flags)
15048 q.text(","); q.breakable()
15049 q.text("miss_send_len = ");
15050 q.text("%#x" % self.miss_send_len)
15051 q.breakable()
15052 q.text('}')
15053
15054message.subtypes[9] = set_config
15055
15056class switch_config_failed_error_msg(error_msg):
15057 version = 5
15058 type = 1
15059 err_type = 10
15060
15061 def __init__(self, xid=None, code=None, data=None):
15062 if xid != None:
15063 self.xid = xid
15064 else:
15065 self.xid = None
15066 if code != None:
15067 self.code = code
15068 else:
15069 self.code = 0
15070 if data != None:
15071 self.data = data
15072 else:
15073 self.data = ''
15074 return
15075
15076 def pack(self):
15077 packed = []
15078 packed.append(struct.pack("!B", self.version))
15079 packed.append(struct.pack("!B", self.type))
15080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15081 packed.append(struct.pack("!L", self.xid))
15082 packed.append(struct.pack("!H", self.err_type))
15083 packed.append(struct.pack("!H", self.code))
15084 packed.append(self.data)
15085 length = sum([len(x) for x in packed])
15086 packed[2] = struct.pack("!H", length)
15087 return ''.join(packed)
15088
15089 @staticmethod
15090 def unpack(reader):
15091 obj = switch_config_failed_error_msg()
15092 _version = reader.read("!B")[0]
15093 assert(_version == 5)
15094 _type = reader.read("!B")[0]
15095 assert(_type == 1)
15096 _length = reader.read("!H")[0]
15097 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015098 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015099 obj.xid = reader.read("!L")[0]
15100 _err_type = reader.read("!H")[0]
15101 assert(_err_type == 10)
15102 obj.code = reader.read("!H")[0]
15103 obj.data = str(reader.read_all())
15104 return obj
15105
15106 def __eq__(self, other):
15107 if type(self) != type(other): return False
15108 if self.xid != other.xid: return False
15109 if self.code != other.code: return False
15110 if self.data != other.data: return False
15111 return True
15112
15113 def pretty_print(self, q):
15114 q.text("switch_config_failed_error_msg {")
15115 with q.group():
15116 with q.indent(2):
15117 q.breakable()
15118 q.text("xid = ");
15119 if self.xid != None:
15120 q.text("%#x" % self.xid)
15121 else:
15122 q.text('None')
15123 q.text(","); q.breakable()
15124 q.text("code = ");
15125 q.text("%#x" % self.code)
15126 q.text(","); q.breakable()
15127 q.text("data = ");
15128 q.pp(self.data)
15129 q.breakable()
15130 q.text('}')
15131
15132error_msg.subtypes[10] = switch_config_failed_error_msg
15133
15134class table_desc_stats_reply(stats_reply):
15135 version = 5
15136 type = 19
15137 stats_type = 14
15138
15139 def __init__(self, xid=None, flags=None, entries=None):
15140 if xid != None:
15141 self.xid = xid
15142 else:
15143 self.xid = None
15144 if flags != None:
15145 self.flags = flags
15146 else:
15147 self.flags = 0
15148 if entries != None:
15149 self.entries = entries
15150 else:
15151 self.entries = []
15152 return
15153
15154 def pack(self):
15155 packed = []
15156 packed.append(struct.pack("!B", self.version))
15157 packed.append(struct.pack("!B", self.type))
15158 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15159 packed.append(struct.pack("!L", self.xid))
15160 packed.append(struct.pack("!H", self.stats_type))
15161 packed.append(struct.pack("!H", self.flags))
15162 packed.append('\x00' * 4)
15163 packed.append(loxi.generic_util.pack_list(self.entries))
15164 length = sum([len(x) for x in packed])
15165 packed[2] = struct.pack("!H", length)
15166 return ''.join(packed)
15167
15168 @staticmethod
15169 def unpack(reader):
15170 obj = table_desc_stats_reply()
15171 _version = reader.read("!B")[0]
15172 assert(_version == 5)
15173 _type = reader.read("!B")[0]
15174 assert(_type == 19)
15175 _length = reader.read("!H")[0]
15176 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015177 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015178 obj.xid = reader.read("!L")[0]
15179 _stats_type = reader.read("!H")[0]
15180 assert(_stats_type == 14)
15181 obj.flags = reader.read("!H")[0]
15182 reader.skip(4)
15183 obj.entries = loxi.generic_util.unpack_list(reader, common.table_desc.unpack)
15184 return obj
15185
15186 def __eq__(self, other):
15187 if type(self) != type(other): return False
15188 if self.xid != other.xid: return False
15189 if self.flags != other.flags: return False
15190 if self.entries != other.entries: return False
15191 return True
15192
15193 def pretty_print(self, q):
15194 q.text("table_desc_stats_reply {")
15195 with q.group():
15196 with q.indent(2):
15197 q.breakable()
15198 q.text("xid = ");
15199 if self.xid != None:
15200 q.text("%#x" % self.xid)
15201 else:
15202 q.text('None')
15203 q.text(","); q.breakable()
15204 q.text("flags = ");
15205 q.text("%#x" % self.flags)
15206 q.text(","); q.breakable()
15207 q.text("entries = ");
15208 q.pp(self.entries)
15209 q.breakable()
15210 q.text('}')
15211
15212stats_reply.subtypes[14] = table_desc_stats_reply
15213
15214class table_desc_stats_request(stats_request):
15215 version = 5
15216 type = 18
15217 stats_type = 14
15218
15219 def __init__(self, xid=None, flags=None):
15220 if xid != None:
15221 self.xid = xid
15222 else:
15223 self.xid = None
15224 if flags != None:
15225 self.flags = flags
15226 else:
15227 self.flags = 0
15228 return
15229
15230 def pack(self):
15231 packed = []
15232 packed.append(struct.pack("!B", self.version))
15233 packed.append(struct.pack("!B", self.type))
15234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15235 packed.append(struct.pack("!L", self.xid))
15236 packed.append(struct.pack("!H", self.stats_type))
15237 packed.append(struct.pack("!H", self.flags))
15238 packed.append('\x00' * 4)
15239 length = sum([len(x) for x in packed])
15240 packed[2] = struct.pack("!H", length)
15241 return ''.join(packed)
15242
15243 @staticmethod
15244 def unpack(reader):
15245 obj = table_desc_stats_request()
15246 _version = reader.read("!B")[0]
15247 assert(_version == 5)
15248 _type = reader.read("!B")[0]
15249 assert(_type == 18)
15250 _length = reader.read("!H")[0]
15251 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015252 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015253 obj.xid = reader.read("!L")[0]
15254 _stats_type = reader.read("!H")[0]
15255 assert(_stats_type == 14)
15256 obj.flags = reader.read("!H")[0]
15257 reader.skip(4)
15258 return obj
15259
15260 def __eq__(self, other):
15261 if type(self) != type(other): return False
15262 if self.xid != other.xid: return False
15263 if self.flags != other.flags: return False
15264 return True
15265
15266 def pretty_print(self, q):
15267 q.text("table_desc_stats_request {")
15268 with q.group():
15269 with q.indent(2):
15270 q.breakable()
15271 q.text("xid = ");
15272 if self.xid != None:
15273 q.text("%#x" % self.xid)
15274 else:
15275 q.text('None')
15276 q.text(","); q.breakable()
15277 q.text("flags = ");
15278 q.text("%#x" % self.flags)
15279 q.breakable()
15280 q.text('}')
15281
15282stats_request.subtypes[14] = table_desc_stats_request
15283
15284class table_features_failed_error_msg(error_msg):
15285 version = 5
15286 type = 1
15287 err_type = 13
15288
15289 def __init__(self, xid=None, code=None, data=None):
15290 if xid != None:
15291 self.xid = xid
15292 else:
15293 self.xid = None
15294 if code != None:
15295 self.code = code
15296 else:
15297 self.code = 0
15298 if data != None:
15299 self.data = data
15300 else:
15301 self.data = ''
15302 return
15303
15304 def pack(self):
15305 packed = []
15306 packed.append(struct.pack("!B", self.version))
15307 packed.append(struct.pack("!B", self.type))
15308 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15309 packed.append(struct.pack("!L", self.xid))
15310 packed.append(struct.pack("!H", self.err_type))
15311 packed.append(struct.pack("!H", self.code))
15312 packed.append(self.data)
15313 length = sum([len(x) for x in packed])
15314 packed[2] = struct.pack("!H", length)
15315 return ''.join(packed)
15316
15317 @staticmethod
15318 def unpack(reader):
15319 obj = table_features_failed_error_msg()
15320 _version = reader.read("!B")[0]
15321 assert(_version == 5)
15322 _type = reader.read("!B")[0]
15323 assert(_type == 1)
15324 _length = reader.read("!H")[0]
15325 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015326 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015327 obj.xid = reader.read("!L")[0]
15328 _err_type = reader.read("!H")[0]
15329 assert(_err_type == 13)
15330 obj.code = reader.read("!H")[0]
15331 obj.data = str(reader.read_all())
15332 return obj
15333
15334 def __eq__(self, other):
15335 if type(self) != type(other): return False
15336 if self.xid != other.xid: return False
15337 if self.code != other.code: return False
15338 if self.data != other.data: return False
15339 return True
15340
15341 def pretty_print(self, q):
15342 q.text("table_features_failed_error_msg {")
15343 with q.group():
15344 with q.indent(2):
15345 q.breakable()
15346 q.text("xid = ");
15347 if self.xid != None:
15348 q.text("%#x" % self.xid)
15349 else:
15350 q.text('None')
15351 q.text(","); q.breakable()
15352 q.text("code = ");
15353 q.text("%#x" % self.code)
15354 q.text(","); q.breakable()
15355 q.text("data = ");
15356 q.pp(self.data)
15357 q.breakable()
15358 q.text('}')
15359
15360error_msg.subtypes[13] = table_features_failed_error_msg
15361
15362class table_features_stats_reply(stats_reply):
15363 version = 5
15364 type = 19
15365 stats_type = 12
15366
15367 def __init__(self, xid=None, flags=None, entries=None):
15368 if xid != None:
15369 self.xid = xid
15370 else:
15371 self.xid = None
15372 if flags != None:
15373 self.flags = flags
15374 else:
15375 self.flags = 0
15376 if entries != None:
15377 self.entries = entries
15378 else:
15379 self.entries = []
15380 return
15381
15382 def pack(self):
15383 packed = []
15384 packed.append(struct.pack("!B", self.version))
15385 packed.append(struct.pack("!B", self.type))
15386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15387 packed.append(struct.pack("!L", self.xid))
15388 packed.append(struct.pack("!H", self.stats_type))
15389 packed.append(struct.pack("!H", self.flags))
15390 packed.append('\x00' * 4)
15391 packed.append(loxi.generic_util.pack_list(self.entries))
15392 length = sum([len(x) for x in packed])
15393 packed[2] = struct.pack("!H", length)
15394 return ''.join(packed)
15395
15396 @staticmethod
15397 def unpack(reader):
15398 obj = table_features_stats_reply()
15399 _version = reader.read("!B")[0]
15400 assert(_version == 5)
15401 _type = reader.read("!B")[0]
15402 assert(_type == 19)
15403 _length = reader.read("!H")[0]
15404 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015405 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015406 obj.xid = reader.read("!L")[0]
15407 _stats_type = reader.read("!H")[0]
15408 assert(_stats_type == 12)
15409 obj.flags = reader.read("!H")[0]
15410 reader.skip(4)
15411 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
15412 return obj
15413
15414 def __eq__(self, other):
15415 if type(self) != type(other): return False
15416 if self.xid != other.xid: return False
15417 if self.flags != other.flags: return False
15418 if self.entries != other.entries: return False
15419 return True
15420
15421 def pretty_print(self, q):
15422 q.text("table_features_stats_reply {")
15423 with q.group():
15424 with q.indent(2):
15425 q.breakable()
15426 q.text("xid = ");
15427 if self.xid != None:
15428 q.text("%#x" % self.xid)
15429 else:
15430 q.text('None')
15431 q.text(","); q.breakable()
15432 q.text("flags = ");
15433 q.text("%#x" % self.flags)
15434 q.text(","); q.breakable()
15435 q.text("entries = ");
15436 q.pp(self.entries)
15437 q.breakable()
15438 q.text('}')
15439
15440stats_reply.subtypes[12] = table_features_stats_reply
15441
15442class table_features_stats_request(stats_request):
15443 version = 5
15444 type = 18
15445 stats_type = 12
15446
15447 def __init__(self, xid=None, flags=None, entries=None):
15448 if xid != None:
15449 self.xid = xid
15450 else:
15451 self.xid = None
15452 if flags != None:
15453 self.flags = flags
15454 else:
15455 self.flags = 0
15456 if entries != None:
15457 self.entries = entries
15458 else:
15459 self.entries = []
15460 return
15461
15462 def pack(self):
15463 packed = []
15464 packed.append(struct.pack("!B", self.version))
15465 packed.append(struct.pack("!B", self.type))
15466 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15467 packed.append(struct.pack("!L", self.xid))
15468 packed.append(struct.pack("!H", self.stats_type))
15469 packed.append(struct.pack("!H", self.flags))
15470 packed.append('\x00' * 4)
15471 packed.append(loxi.generic_util.pack_list(self.entries))
15472 length = sum([len(x) for x in packed])
15473 packed[2] = struct.pack("!H", length)
15474 return ''.join(packed)
15475
15476 @staticmethod
15477 def unpack(reader):
15478 obj = table_features_stats_request()
15479 _version = reader.read("!B")[0]
15480 assert(_version == 5)
15481 _type = reader.read("!B")[0]
15482 assert(_type == 18)
15483 _length = reader.read("!H")[0]
15484 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015485 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015486 obj.xid = reader.read("!L")[0]
15487 _stats_type = reader.read("!H")[0]
15488 assert(_stats_type == 12)
15489 obj.flags = reader.read("!H")[0]
15490 reader.skip(4)
15491 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
15492 return obj
15493
15494 def __eq__(self, other):
15495 if type(self) != type(other): return False
15496 if self.xid != other.xid: return False
15497 if self.flags != other.flags: return False
15498 if self.entries != other.entries: return False
15499 return True
15500
15501 def pretty_print(self, q):
15502 q.text("table_features_stats_request {")
15503 with q.group():
15504 with q.indent(2):
15505 q.breakable()
15506 q.text("xid = ");
15507 if self.xid != None:
15508 q.text("%#x" % self.xid)
15509 else:
15510 q.text('None')
15511 q.text(","); q.breakable()
15512 q.text("flags = ");
15513 q.text("%#x" % self.flags)
15514 q.text(","); q.breakable()
15515 q.text("entries = ");
15516 q.pp(self.entries)
15517 q.breakable()
15518 q.text('}')
15519
15520stats_request.subtypes[12] = table_features_stats_request
15521
15522class table_mod(message):
15523 version = 5
15524 type = 17
15525
15526 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15527 if xid != None:
15528 self.xid = xid
15529 else:
15530 self.xid = None
15531 if table_id != None:
15532 self.table_id = table_id
15533 else:
15534 self.table_id = 0
15535 if config != None:
15536 self.config = config
15537 else:
15538 self.config = 0
15539 if properties != None:
15540 self.properties = properties
15541 else:
15542 self.properties = []
15543 return
15544
15545 def pack(self):
15546 packed = []
15547 packed.append(struct.pack("!B", self.version))
15548 packed.append(struct.pack("!B", self.type))
15549 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15550 packed.append(struct.pack("!L", self.xid))
15551 packed.append(struct.pack("!B", self.table_id))
15552 packed.append('\x00' * 3)
15553 packed.append(struct.pack("!L", self.config))
15554 packed.append(loxi.generic_util.pack_list(self.properties))
15555 length = sum([len(x) for x in packed])
15556 packed[2] = struct.pack("!H", length)
15557 return ''.join(packed)
15558
15559 @staticmethod
15560 def unpack(reader):
15561 obj = table_mod()
15562 _version = reader.read("!B")[0]
15563 assert(_version == 5)
15564 _type = reader.read("!B")[0]
15565 assert(_type == 17)
15566 _length = reader.read("!H")[0]
15567 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015568 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015569 obj.xid = reader.read("!L")[0]
15570 obj.table_id = reader.read("!B")[0]
15571 reader.skip(3)
15572 obj.config = reader.read("!L")[0]
15573 obj.properties = loxi.generic_util.unpack_list(reader, table_mod_prop.table_mod_prop.unpack)
15574 return obj
15575
15576 def __eq__(self, other):
15577 if type(self) != type(other): return False
15578 if self.xid != other.xid: return False
15579 if self.table_id != other.table_id: return False
15580 if self.config != other.config: return False
15581 if self.properties != other.properties: return False
15582 return True
15583
15584 def pretty_print(self, q):
15585 q.text("table_mod {")
15586 with q.group():
15587 with q.indent(2):
15588 q.breakable()
15589 q.text("xid = ");
15590 if self.xid != None:
15591 q.text("%#x" % self.xid)
15592 else:
15593 q.text('None')
15594 q.text(","); q.breakable()
15595 q.text("table_id = ");
15596 q.text("%#x" % self.table_id)
15597 q.text(","); q.breakable()
15598 q.text("config = ");
15599 q.text("%#x" % self.config)
15600 q.text(","); q.breakable()
15601 q.text("properties = ");
15602 q.pp(self.properties)
15603 q.breakable()
15604 q.text('}')
15605
15606message.subtypes[17] = table_mod
15607
15608class table_mod_failed_error_msg(error_msg):
15609 version = 5
15610 type = 1
15611 err_type = 8
15612
15613 def __init__(self, xid=None, code=None, data=None):
15614 if xid != None:
15615 self.xid = xid
15616 else:
15617 self.xid = None
15618 if code != None:
15619 self.code = code
15620 else:
15621 self.code = 0
15622 if data != None:
15623 self.data = data
15624 else:
15625 self.data = ''
15626 return
15627
15628 def pack(self):
15629 packed = []
15630 packed.append(struct.pack("!B", self.version))
15631 packed.append(struct.pack("!B", self.type))
15632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15633 packed.append(struct.pack("!L", self.xid))
15634 packed.append(struct.pack("!H", self.err_type))
15635 packed.append(struct.pack("!H", self.code))
15636 packed.append(self.data)
15637 length = sum([len(x) for x in packed])
15638 packed[2] = struct.pack("!H", length)
15639 return ''.join(packed)
15640
15641 @staticmethod
15642 def unpack(reader):
15643 obj = table_mod_failed_error_msg()
15644 _version = reader.read("!B")[0]
15645 assert(_version == 5)
15646 _type = reader.read("!B")[0]
15647 assert(_type == 1)
15648 _length = reader.read("!H")[0]
15649 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015650 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015651 obj.xid = reader.read("!L")[0]
15652 _err_type = reader.read("!H")[0]
15653 assert(_err_type == 8)
15654 obj.code = reader.read("!H")[0]
15655 obj.data = str(reader.read_all())
15656 return obj
15657
15658 def __eq__(self, other):
15659 if type(self) != type(other): return False
15660 if self.xid != other.xid: return False
15661 if self.code != other.code: return False
15662 if self.data != other.data: return False
15663 return True
15664
15665 def pretty_print(self, q):
15666 q.text("table_mod_failed_error_msg {")
15667 with q.group():
15668 with q.indent(2):
15669 q.breakable()
15670 q.text("xid = ");
15671 if self.xid != None:
15672 q.text("%#x" % self.xid)
15673 else:
15674 q.text('None')
15675 q.text(","); q.breakable()
15676 q.text("code = ");
15677 q.text("%#x" % self.code)
15678 q.text(","); q.breakable()
15679 q.text("data = ");
15680 q.pp(self.data)
15681 q.breakable()
15682 q.text('}')
15683
15684error_msg.subtypes[8] = table_mod_failed_error_msg
15685
15686class table_stats_reply(stats_reply):
15687 version = 5
15688 type = 19
15689 stats_type = 3
15690
15691 def __init__(self, xid=None, flags=None, entries=None):
15692 if xid != None:
15693 self.xid = xid
15694 else:
15695 self.xid = None
15696 if flags != None:
15697 self.flags = flags
15698 else:
15699 self.flags = 0
15700 if entries != None:
15701 self.entries = entries
15702 else:
15703 self.entries = []
15704 return
15705
15706 def pack(self):
15707 packed = []
15708 packed.append(struct.pack("!B", self.version))
15709 packed.append(struct.pack("!B", self.type))
15710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15711 packed.append(struct.pack("!L", self.xid))
15712 packed.append(struct.pack("!H", self.stats_type))
15713 packed.append(struct.pack("!H", self.flags))
15714 packed.append('\x00' * 4)
15715 packed.append(loxi.generic_util.pack_list(self.entries))
15716 length = sum([len(x) for x in packed])
15717 packed[2] = struct.pack("!H", length)
15718 return ''.join(packed)
15719
15720 @staticmethod
15721 def unpack(reader):
15722 obj = table_stats_reply()
15723 _version = reader.read("!B")[0]
15724 assert(_version == 5)
15725 _type = reader.read("!B")[0]
15726 assert(_type == 19)
15727 _length = reader.read("!H")[0]
15728 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015729 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015730 obj.xid = reader.read("!L")[0]
15731 _stats_type = reader.read("!H")[0]
15732 assert(_stats_type == 3)
15733 obj.flags = reader.read("!H")[0]
15734 reader.skip(4)
15735 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
15736 return obj
15737
15738 def __eq__(self, other):
15739 if type(self) != type(other): return False
15740 if self.xid != other.xid: return False
15741 if self.flags != other.flags: return False
15742 if self.entries != other.entries: return False
15743 return True
15744
15745 def pretty_print(self, q):
15746 q.text("table_stats_reply {")
15747 with q.group():
15748 with q.indent(2):
15749 q.breakable()
15750 q.text("xid = ");
15751 if self.xid != None:
15752 q.text("%#x" % self.xid)
15753 else:
15754 q.text('None')
15755 q.text(","); q.breakable()
15756 q.text("flags = ");
15757 q.text("%#x" % self.flags)
15758 q.text(","); q.breakable()
15759 q.text("entries = ");
15760 q.pp(self.entries)
15761 q.breakable()
15762 q.text('}')
15763
15764stats_reply.subtypes[3] = table_stats_reply
15765
15766class table_stats_request(stats_request):
15767 version = 5
15768 type = 18
15769 stats_type = 3
15770
15771 def __init__(self, xid=None, flags=None):
15772 if xid != None:
15773 self.xid = xid
15774 else:
15775 self.xid = None
15776 if flags != None:
15777 self.flags = flags
15778 else:
15779 self.flags = 0
15780 return
15781
15782 def pack(self):
15783 packed = []
15784 packed.append(struct.pack("!B", self.version))
15785 packed.append(struct.pack("!B", self.type))
15786 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15787 packed.append(struct.pack("!L", self.xid))
15788 packed.append(struct.pack("!H", self.stats_type))
15789 packed.append(struct.pack("!H", self.flags))
15790 packed.append('\x00' * 4)
15791 length = sum([len(x) for x in packed])
15792 packed[2] = struct.pack("!H", length)
15793 return ''.join(packed)
15794
15795 @staticmethod
15796 def unpack(reader):
15797 obj = table_stats_request()
15798 _version = reader.read("!B")[0]
15799 assert(_version == 5)
15800 _type = reader.read("!B")[0]
15801 assert(_type == 18)
15802 _length = reader.read("!H")[0]
15803 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015804 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015805 obj.xid = reader.read("!L")[0]
15806 _stats_type = reader.read("!H")[0]
15807 assert(_stats_type == 3)
15808 obj.flags = reader.read("!H")[0]
15809 reader.skip(4)
15810 return obj
15811
15812 def __eq__(self, other):
15813 if type(self) != type(other): return False
15814 if self.xid != other.xid: return False
15815 if self.flags != other.flags: return False
15816 return True
15817
15818 def pretty_print(self, q):
15819 q.text("table_stats_request {")
15820 with q.group():
15821 with q.indent(2):
15822 q.breakable()
15823 q.text("xid = ");
15824 if self.xid != None:
15825 q.text("%#x" % self.xid)
15826 else:
15827 q.text('None')
15828 q.text(","); q.breakable()
15829 q.text("flags = ");
15830 q.text("%#x" % self.flags)
15831 q.breakable()
15832 q.text('}')
15833
15834stats_request.subtypes[3] = table_stats_request
15835
15836class table_status(message):
15837 version = 5
15838 type = 31
15839
15840 def __init__(self, xid=None, role=None, reason=None, table=None):
15841 if xid != None:
15842 self.xid = xid
15843 else:
15844 self.xid = None
15845 if role != None:
15846 self.role = role
15847 else:
15848 self.role = 0
15849 if reason != None:
15850 self.reason = reason
15851 else:
15852 self.reason = 0
15853 if table != None:
15854 self.table = table
15855 else:
15856 self.table = common.table_desc()
15857 return
15858
15859 def pack(self):
15860 packed = []
15861 packed.append(struct.pack("!B", self.version))
15862 packed.append(struct.pack("!B", self.type))
15863 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15864 packed.append(struct.pack("!L", self.xid))
15865 packed.append(struct.pack("!L", self.role))
15866 packed.append(struct.pack("!B", self.reason))
15867 packed.append('\x00' * 7)
15868 packed.append(self.table.pack())
15869 length = sum([len(x) for x in packed])
15870 packed[2] = struct.pack("!H", length)
15871 return ''.join(packed)
15872
15873 @staticmethod
15874 def unpack(reader):
15875 obj = table_status()
15876 _version = reader.read("!B")[0]
15877 assert(_version == 5)
15878 _type = reader.read("!B")[0]
15879 assert(_type == 31)
15880 _length = reader.read("!H")[0]
15881 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015882 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015883 obj.xid = reader.read("!L")[0]
15884 obj.role = reader.read("!L")[0]
15885 obj.reason = reader.read("!B")[0]
15886 reader.skip(7)
15887 obj.table = common.table_desc.unpack(reader)
15888 return obj
15889
15890 def __eq__(self, other):
15891 if type(self) != type(other): return False
15892 if self.xid != other.xid: return False
15893 if self.role != other.role: return False
15894 if self.reason != other.reason: return False
15895 if self.table != other.table: return False
15896 return True
15897
15898 def pretty_print(self, q):
15899 q.text("table_status {")
15900 with q.group():
15901 with q.indent(2):
15902 q.breakable()
15903 q.text("xid = ");
15904 if self.xid != None:
15905 q.text("%#x" % self.xid)
15906 else:
15907 q.text('None')
15908 q.text(","); q.breakable()
15909 q.text("role = ");
15910 q.text("%#x" % self.role)
15911 q.text(","); q.breakable()
15912 q.text("reason = ");
15913 q.text("%#x" % self.reason)
15914 q.text(","); q.breakable()
15915 q.text("table = ");
15916 q.pp(self.table)
15917 q.breakable()
15918 q.text('}')
15919
15920message.subtypes[31] = table_status
15921
15922
15923def parse_header(buf):
15924 if len(buf) < 8:
15925 raise loxi.ProtocolError("too short to be an OpenFlow message")
15926 return struct.unpack_from("!BBHL", buf)
15927
15928def parse_message(buf):
15929 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
15930 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
15931 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
15932 if len(buf) != msg_len:
15933 raise loxi.ProtocolError("incorrect message size")
15934 return message.unpack(loxi.generic_util.OFReader(buf))