blob: 24c0b445ce8246529d3761e5b020eeb9cdf883a5 [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 Lane2e079da2014-10-29 15:30:24 -07005965class bsn_pdu_rx_reply(bsn_header):
5966 version = 5
5967 type = 4
5968 experimenter = 6035143
5969 subtype = 34
5970
5971 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
5972 if xid != None:
5973 self.xid = xid
5974 else:
5975 self.xid = None
5976 if status != None:
5977 self.status = status
5978 else:
5979 self.status = 0
5980 if port_no != None:
5981 self.port_no = port_no
5982 else:
5983 self.port_no = 0
5984 if slot_num != None:
5985 self.slot_num = slot_num
5986 else:
5987 self.slot_num = 0
5988 return
5989
5990 def pack(self):
5991 packed = []
5992 packed.append(struct.pack("!B", self.version))
5993 packed.append(struct.pack("!B", self.type))
5994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5995 packed.append(struct.pack("!L", self.xid))
5996 packed.append(struct.pack("!L", self.experimenter))
5997 packed.append(struct.pack("!L", self.subtype))
5998 packed.append(struct.pack("!L", self.status))
5999 packed.append(util.pack_port_no(self.port_no))
6000 packed.append(struct.pack("!B", self.slot_num))
6001 length = sum([len(x) for x in packed])
6002 packed[2] = struct.pack("!H", length)
6003 return ''.join(packed)
6004
6005 @staticmethod
6006 def unpack(reader):
6007 obj = bsn_pdu_rx_reply()
6008 _version = reader.read("!B")[0]
6009 assert(_version == 5)
6010 _type = reader.read("!B")[0]
6011 assert(_type == 4)
6012 _length = reader.read("!H")[0]
6013 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006014 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006015 obj.xid = reader.read("!L")[0]
6016 _experimenter = reader.read("!L")[0]
6017 assert(_experimenter == 6035143)
6018 _subtype = reader.read("!L")[0]
6019 assert(_subtype == 34)
6020 obj.status = reader.read("!L")[0]
6021 obj.port_no = util.unpack_port_no(reader)
6022 obj.slot_num = reader.read("!B")[0]
6023 return obj
6024
6025 def __eq__(self, other):
6026 if type(self) != type(other): return False
6027 if self.xid != other.xid: return False
6028 if self.status != other.status: return False
6029 if self.port_no != other.port_no: return False
6030 if self.slot_num != other.slot_num: return False
6031 return True
6032
6033 def pretty_print(self, q):
6034 q.text("bsn_pdu_rx_reply {")
6035 with q.group():
6036 with q.indent(2):
6037 q.breakable()
6038 q.text("xid = ");
6039 if self.xid != None:
6040 q.text("%#x" % self.xid)
6041 else:
6042 q.text('None')
6043 q.text(","); q.breakable()
6044 q.text("status = ");
6045 q.text("%#x" % self.status)
6046 q.text(","); q.breakable()
6047 q.text("port_no = ");
6048 q.text(util.pretty_port(self.port_no))
6049 q.text(","); q.breakable()
6050 q.text("slot_num = ");
6051 q.text("%#x" % self.slot_num)
6052 q.breakable()
6053 q.text('}')
6054
6055bsn_header.subtypes[34] = bsn_pdu_rx_reply
6056
6057class bsn_pdu_rx_request(bsn_header):
6058 version = 5
6059 type = 4
6060 experimenter = 6035143
6061 subtype = 33
6062
6063 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6064 if xid != None:
6065 self.xid = xid
6066 else:
6067 self.xid = None
6068 if timeout_ms != None:
6069 self.timeout_ms = timeout_ms
6070 else:
6071 self.timeout_ms = 0
6072 if port_no != None:
6073 self.port_no = port_no
6074 else:
6075 self.port_no = 0
6076 if slot_num != None:
6077 self.slot_num = slot_num
6078 else:
6079 self.slot_num = 0
6080 if data != None:
6081 self.data = data
6082 else:
6083 self.data = ''
6084 return
6085
6086 def pack(self):
6087 packed = []
6088 packed.append(struct.pack("!B", self.version))
6089 packed.append(struct.pack("!B", self.type))
6090 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6091 packed.append(struct.pack("!L", self.xid))
6092 packed.append(struct.pack("!L", self.experimenter))
6093 packed.append(struct.pack("!L", self.subtype))
6094 packed.append(struct.pack("!L", self.timeout_ms))
6095 packed.append(util.pack_port_no(self.port_no))
6096 packed.append(struct.pack("!B", self.slot_num))
6097 packed.append('\x00' * 3)
6098 packed.append(self.data)
6099 length = sum([len(x) for x in packed])
6100 packed[2] = struct.pack("!H", length)
6101 return ''.join(packed)
6102
6103 @staticmethod
6104 def unpack(reader):
6105 obj = bsn_pdu_rx_request()
6106 _version = reader.read("!B")[0]
6107 assert(_version == 5)
6108 _type = reader.read("!B")[0]
6109 assert(_type == 4)
6110 _length = reader.read("!H")[0]
6111 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006112 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006113 obj.xid = reader.read("!L")[0]
6114 _experimenter = reader.read("!L")[0]
6115 assert(_experimenter == 6035143)
6116 _subtype = reader.read("!L")[0]
6117 assert(_subtype == 33)
6118 obj.timeout_ms = reader.read("!L")[0]
6119 obj.port_no = util.unpack_port_no(reader)
6120 obj.slot_num = reader.read("!B")[0]
6121 reader.skip(3)
6122 obj.data = str(reader.read_all())
6123 return obj
6124
6125 def __eq__(self, other):
6126 if type(self) != type(other): return False
6127 if self.xid != other.xid: return False
6128 if self.timeout_ms != other.timeout_ms: return False
6129 if self.port_no != other.port_no: return False
6130 if self.slot_num != other.slot_num: return False
6131 if self.data != other.data: return False
6132 return True
6133
6134 def pretty_print(self, q):
6135 q.text("bsn_pdu_rx_request {")
6136 with q.group():
6137 with q.indent(2):
6138 q.breakable()
6139 q.text("xid = ");
6140 if self.xid != None:
6141 q.text("%#x" % self.xid)
6142 else:
6143 q.text('None')
6144 q.text(","); q.breakable()
6145 q.text("timeout_ms = ");
6146 q.text("%#x" % self.timeout_ms)
6147 q.text(","); q.breakable()
6148 q.text("port_no = ");
6149 q.text(util.pretty_port(self.port_no))
6150 q.text(","); q.breakable()
6151 q.text("slot_num = ");
6152 q.text("%#x" % self.slot_num)
6153 q.text(","); q.breakable()
6154 q.text("data = ");
6155 q.pp(self.data)
6156 q.breakable()
6157 q.text('}')
6158
6159bsn_header.subtypes[33] = bsn_pdu_rx_request
6160
6161class bsn_pdu_rx_timeout(bsn_header):
6162 version = 5
6163 type = 4
6164 experimenter = 6035143
6165 subtype = 35
6166
6167 def __init__(self, xid=None, port_no=None, slot_num=None):
6168 if xid != None:
6169 self.xid = xid
6170 else:
6171 self.xid = None
6172 if port_no != None:
6173 self.port_no = port_no
6174 else:
6175 self.port_no = 0
6176 if slot_num != None:
6177 self.slot_num = slot_num
6178 else:
6179 self.slot_num = 0
6180 return
6181
6182 def pack(self):
6183 packed = []
6184 packed.append(struct.pack("!B", self.version))
6185 packed.append(struct.pack("!B", self.type))
6186 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6187 packed.append(struct.pack("!L", self.xid))
6188 packed.append(struct.pack("!L", self.experimenter))
6189 packed.append(struct.pack("!L", self.subtype))
6190 packed.append(util.pack_port_no(self.port_no))
6191 packed.append(struct.pack("!B", self.slot_num))
6192 length = sum([len(x) for x in packed])
6193 packed[2] = struct.pack("!H", length)
6194 return ''.join(packed)
6195
6196 @staticmethod
6197 def unpack(reader):
6198 obj = bsn_pdu_rx_timeout()
6199 _version = reader.read("!B")[0]
6200 assert(_version == 5)
6201 _type = reader.read("!B")[0]
6202 assert(_type == 4)
6203 _length = reader.read("!H")[0]
6204 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006205 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006206 obj.xid = reader.read("!L")[0]
6207 _experimenter = reader.read("!L")[0]
6208 assert(_experimenter == 6035143)
6209 _subtype = reader.read("!L")[0]
6210 assert(_subtype == 35)
6211 obj.port_no = util.unpack_port_no(reader)
6212 obj.slot_num = reader.read("!B")[0]
6213 return obj
6214
6215 def __eq__(self, other):
6216 if type(self) != type(other): return False
6217 if self.xid != other.xid: return False
6218 if self.port_no != other.port_no: return False
6219 if self.slot_num != other.slot_num: return False
6220 return True
6221
6222 def pretty_print(self, q):
6223 q.text("bsn_pdu_rx_timeout {")
6224 with q.group():
6225 with q.indent(2):
6226 q.breakable()
6227 q.text("xid = ");
6228 if self.xid != None:
6229 q.text("%#x" % self.xid)
6230 else:
6231 q.text('None')
6232 q.text(","); q.breakable()
6233 q.text("port_no = ");
6234 q.text(util.pretty_port(self.port_no))
6235 q.text(","); q.breakable()
6236 q.text("slot_num = ");
6237 q.text("%#x" % self.slot_num)
6238 q.breakable()
6239 q.text('}')
6240
6241bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6242
6243class bsn_pdu_tx_reply(bsn_header):
6244 version = 5
6245 type = 4
6246 experimenter = 6035143
6247 subtype = 32
6248
6249 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6250 if xid != None:
6251 self.xid = xid
6252 else:
6253 self.xid = None
6254 if status != None:
6255 self.status = status
6256 else:
6257 self.status = 0
6258 if port_no != None:
6259 self.port_no = port_no
6260 else:
6261 self.port_no = 0
6262 if slot_num != None:
6263 self.slot_num = slot_num
6264 else:
6265 self.slot_num = 0
6266 return
6267
6268 def pack(self):
6269 packed = []
6270 packed.append(struct.pack("!B", self.version))
6271 packed.append(struct.pack("!B", self.type))
6272 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6273 packed.append(struct.pack("!L", self.xid))
6274 packed.append(struct.pack("!L", self.experimenter))
6275 packed.append(struct.pack("!L", self.subtype))
6276 packed.append(struct.pack("!L", self.status))
6277 packed.append(util.pack_port_no(self.port_no))
6278 packed.append(struct.pack("!B", self.slot_num))
6279 length = sum([len(x) for x in packed])
6280 packed[2] = struct.pack("!H", length)
6281 return ''.join(packed)
6282
6283 @staticmethod
6284 def unpack(reader):
6285 obj = bsn_pdu_tx_reply()
6286 _version = reader.read("!B")[0]
6287 assert(_version == 5)
6288 _type = reader.read("!B")[0]
6289 assert(_type == 4)
6290 _length = reader.read("!H")[0]
6291 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006292 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006293 obj.xid = reader.read("!L")[0]
6294 _experimenter = reader.read("!L")[0]
6295 assert(_experimenter == 6035143)
6296 _subtype = reader.read("!L")[0]
6297 assert(_subtype == 32)
6298 obj.status = reader.read("!L")[0]
6299 obj.port_no = util.unpack_port_no(reader)
6300 obj.slot_num = reader.read("!B")[0]
6301 return obj
6302
6303 def __eq__(self, other):
6304 if type(self) != type(other): return False
6305 if self.xid != other.xid: return False
6306 if self.status != other.status: return False
6307 if self.port_no != other.port_no: return False
6308 if self.slot_num != other.slot_num: return False
6309 return True
6310
6311 def pretty_print(self, q):
6312 q.text("bsn_pdu_tx_reply {")
6313 with q.group():
6314 with q.indent(2):
6315 q.breakable()
6316 q.text("xid = ");
6317 if self.xid != None:
6318 q.text("%#x" % self.xid)
6319 else:
6320 q.text('None')
6321 q.text(","); q.breakable()
6322 q.text("status = ");
6323 q.text("%#x" % self.status)
6324 q.text(","); q.breakable()
6325 q.text("port_no = ");
6326 q.text(util.pretty_port(self.port_no))
6327 q.text(","); q.breakable()
6328 q.text("slot_num = ");
6329 q.text("%#x" % self.slot_num)
6330 q.breakable()
6331 q.text('}')
6332
6333bsn_header.subtypes[32] = bsn_pdu_tx_reply
6334
6335class bsn_pdu_tx_request(bsn_header):
6336 version = 5
6337 type = 4
6338 experimenter = 6035143
6339 subtype = 31
6340
6341 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
6342 if xid != None:
6343 self.xid = xid
6344 else:
6345 self.xid = None
6346 if tx_interval_ms != None:
6347 self.tx_interval_ms = tx_interval_ms
6348 else:
6349 self.tx_interval_ms = 0
6350 if port_no != None:
6351 self.port_no = port_no
6352 else:
6353 self.port_no = 0
6354 if slot_num != None:
6355 self.slot_num = slot_num
6356 else:
6357 self.slot_num = 0
6358 if data != None:
6359 self.data = data
6360 else:
6361 self.data = ''
6362 return
6363
6364 def pack(self):
6365 packed = []
6366 packed.append(struct.pack("!B", self.version))
6367 packed.append(struct.pack("!B", self.type))
6368 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6369 packed.append(struct.pack("!L", self.xid))
6370 packed.append(struct.pack("!L", self.experimenter))
6371 packed.append(struct.pack("!L", self.subtype))
6372 packed.append(struct.pack("!L", self.tx_interval_ms))
6373 packed.append(util.pack_port_no(self.port_no))
6374 packed.append(struct.pack("!B", self.slot_num))
6375 packed.append('\x00' * 3)
6376 packed.append(self.data)
6377 length = sum([len(x) for x in packed])
6378 packed[2] = struct.pack("!H", length)
6379 return ''.join(packed)
6380
6381 @staticmethod
6382 def unpack(reader):
6383 obj = bsn_pdu_tx_request()
6384 _version = reader.read("!B")[0]
6385 assert(_version == 5)
6386 _type = reader.read("!B")[0]
6387 assert(_type == 4)
6388 _length = reader.read("!H")[0]
6389 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006390 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006391 obj.xid = reader.read("!L")[0]
6392 _experimenter = reader.read("!L")[0]
6393 assert(_experimenter == 6035143)
6394 _subtype = reader.read("!L")[0]
6395 assert(_subtype == 31)
6396 obj.tx_interval_ms = reader.read("!L")[0]
6397 obj.port_no = util.unpack_port_no(reader)
6398 obj.slot_num = reader.read("!B")[0]
6399 reader.skip(3)
6400 obj.data = str(reader.read_all())
6401 return obj
6402
6403 def __eq__(self, other):
6404 if type(self) != type(other): return False
6405 if self.xid != other.xid: return False
6406 if self.tx_interval_ms != other.tx_interval_ms: return False
6407 if self.port_no != other.port_no: return False
6408 if self.slot_num != other.slot_num: return False
6409 if self.data != other.data: return False
6410 return True
6411
6412 def pretty_print(self, q):
6413 q.text("bsn_pdu_tx_request {")
6414 with q.group():
6415 with q.indent(2):
6416 q.breakable()
6417 q.text("xid = ");
6418 if self.xid != None:
6419 q.text("%#x" % self.xid)
6420 else:
6421 q.text('None')
6422 q.text(","); q.breakable()
6423 q.text("tx_interval_ms = ");
6424 q.text("%#x" % self.tx_interval_ms)
6425 q.text(","); q.breakable()
6426 q.text("port_no = ");
6427 q.text(util.pretty_port(self.port_no))
6428 q.text(","); q.breakable()
6429 q.text("slot_num = ");
6430 q.text("%#x" % self.slot_num)
6431 q.text(","); q.breakable()
6432 q.text("data = ");
6433 q.pp(self.data)
6434 q.breakable()
6435 q.text('}')
6436
6437bsn_header.subtypes[31] = bsn_pdu_tx_request
6438
Rich Laneccd32ed2014-11-10 17:48:24 -08006439class bsn_port_counter_stats_reply(bsn_stats_reply):
6440 version = 5
6441 type = 19
6442 stats_type = 65535
6443 experimenter = 6035143
6444 subtype = 8
6445
6446 def __init__(self, xid=None, flags=None, entries=None):
6447 if xid != None:
6448 self.xid = xid
6449 else:
6450 self.xid = None
6451 if flags != None:
6452 self.flags = flags
6453 else:
6454 self.flags = 0
6455 if entries != None:
6456 self.entries = entries
6457 else:
6458 self.entries = []
6459 return
6460
6461 def pack(self):
6462 packed = []
6463 packed.append(struct.pack("!B", self.version))
6464 packed.append(struct.pack("!B", self.type))
6465 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6466 packed.append(struct.pack("!L", self.xid))
6467 packed.append(struct.pack("!H", self.stats_type))
6468 packed.append(struct.pack("!H", self.flags))
6469 packed.append('\x00' * 4)
6470 packed.append(struct.pack("!L", self.experimenter))
6471 packed.append(struct.pack("!L", self.subtype))
6472 packed.append(loxi.generic_util.pack_list(self.entries))
6473 length = sum([len(x) for x in packed])
6474 packed[2] = struct.pack("!H", length)
6475 return ''.join(packed)
6476
6477 @staticmethod
6478 def unpack(reader):
6479 obj = bsn_port_counter_stats_reply()
6480 _version = reader.read("!B")[0]
6481 assert(_version == 5)
6482 _type = reader.read("!B")[0]
6483 assert(_type == 19)
6484 _length = reader.read("!H")[0]
6485 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006486 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006487 obj.xid = reader.read("!L")[0]
6488 _stats_type = reader.read("!H")[0]
6489 assert(_stats_type == 65535)
6490 obj.flags = reader.read("!H")[0]
6491 reader.skip(4)
6492 _experimenter = reader.read("!L")[0]
6493 assert(_experimenter == 6035143)
6494 _subtype = reader.read("!L")[0]
6495 assert(_subtype == 8)
6496 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6497 return obj
6498
6499 def __eq__(self, other):
6500 if type(self) != type(other): return False
6501 if self.xid != other.xid: return False
6502 if self.flags != other.flags: return False
6503 if self.entries != other.entries: return False
6504 return True
6505
6506 def pretty_print(self, q):
6507 q.text("bsn_port_counter_stats_reply {")
6508 with q.group():
6509 with q.indent(2):
6510 q.breakable()
6511 q.text("xid = ");
6512 if self.xid != None:
6513 q.text("%#x" % self.xid)
6514 else:
6515 q.text('None')
6516 q.text(","); q.breakable()
6517 q.text("flags = ");
6518 q.text("%#x" % self.flags)
6519 q.text(","); q.breakable()
6520 q.text("entries = ");
6521 q.pp(self.entries)
6522 q.breakable()
6523 q.text('}')
6524
6525bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6526
6527class bsn_port_counter_stats_request(bsn_stats_request):
6528 version = 5
6529 type = 18
6530 stats_type = 65535
6531 experimenter = 6035143
6532 subtype = 8
6533
6534 def __init__(self, xid=None, flags=None, port_no=None):
6535 if xid != None:
6536 self.xid = xid
6537 else:
6538 self.xid = None
6539 if flags != None:
6540 self.flags = flags
6541 else:
6542 self.flags = 0
6543 if port_no != None:
6544 self.port_no = port_no
6545 else:
6546 self.port_no = 0
6547 return
6548
6549 def pack(self):
6550 packed = []
6551 packed.append(struct.pack("!B", self.version))
6552 packed.append(struct.pack("!B", self.type))
6553 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6554 packed.append(struct.pack("!L", self.xid))
6555 packed.append(struct.pack("!H", self.stats_type))
6556 packed.append(struct.pack("!H", self.flags))
6557 packed.append('\x00' * 4)
6558 packed.append(struct.pack("!L", self.experimenter))
6559 packed.append(struct.pack("!L", self.subtype))
6560 packed.append(util.pack_port_no(self.port_no))
6561 length = sum([len(x) for x in packed])
6562 packed[2] = struct.pack("!H", length)
6563 return ''.join(packed)
6564
6565 @staticmethod
6566 def unpack(reader):
6567 obj = bsn_port_counter_stats_request()
6568 _version = reader.read("!B")[0]
6569 assert(_version == 5)
6570 _type = reader.read("!B")[0]
6571 assert(_type == 18)
6572 _length = reader.read("!H")[0]
6573 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006574 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006575 obj.xid = reader.read("!L")[0]
6576 _stats_type = reader.read("!H")[0]
6577 assert(_stats_type == 65535)
6578 obj.flags = reader.read("!H")[0]
6579 reader.skip(4)
6580 _experimenter = reader.read("!L")[0]
6581 assert(_experimenter == 6035143)
6582 _subtype = reader.read("!L")[0]
6583 assert(_subtype == 8)
6584 obj.port_no = util.unpack_port_no(reader)
6585 return obj
6586
6587 def __eq__(self, other):
6588 if type(self) != type(other): return False
6589 if self.xid != other.xid: return False
6590 if self.flags != other.flags: return False
6591 if self.port_no != other.port_no: return False
6592 return True
6593
6594 def pretty_print(self, q):
6595 q.text("bsn_port_counter_stats_request {")
6596 with q.group():
6597 with q.indent(2):
6598 q.breakable()
6599 q.text("xid = ");
6600 if self.xid != None:
6601 q.text("%#x" % self.xid)
6602 else:
6603 q.text('None')
6604 q.text(","); q.breakable()
6605 q.text("flags = ");
6606 q.text("%#x" % self.flags)
6607 q.text(","); q.breakable()
6608 q.text("port_no = ");
6609 q.text(util.pretty_port(self.port_no))
6610 q.breakable()
6611 q.text('}')
6612
6613bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6614
6615class bsn_set_aux_cxns_reply(bsn_header):
6616 version = 5
6617 type = 4
6618 experimenter = 6035143
6619 subtype = 59
6620
6621 def __init__(self, xid=None, num_aux=None, status=None):
6622 if xid != None:
6623 self.xid = xid
6624 else:
6625 self.xid = None
6626 if num_aux != None:
6627 self.num_aux = num_aux
6628 else:
6629 self.num_aux = 0
6630 if status != None:
6631 self.status = status
6632 else:
6633 self.status = 0
6634 return
6635
6636 def pack(self):
6637 packed = []
6638 packed.append(struct.pack("!B", self.version))
6639 packed.append(struct.pack("!B", self.type))
6640 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6641 packed.append(struct.pack("!L", self.xid))
6642 packed.append(struct.pack("!L", self.experimenter))
6643 packed.append(struct.pack("!L", self.subtype))
6644 packed.append(struct.pack("!L", self.num_aux))
6645 packed.append(struct.pack("!L", self.status))
6646 length = sum([len(x) for x in packed])
6647 packed[2] = struct.pack("!H", length)
6648 return ''.join(packed)
6649
6650 @staticmethod
6651 def unpack(reader):
6652 obj = bsn_set_aux_cxns_reply()
6653 _version = reader.read("!B")[0]
6654 assert(_version == 5)
6655 _type = reader.read("!B")[0]
6656 assert(_type == 4)
6657 _length = reader.read("!H")[0]
6658 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006659 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006660 obj.xid = reader.read("!L")[0]
6661 _experimenter = reader.read("!L")[0]
6662 assert(_experimenter == 6035143)
6663 _subtype = reader.read("!L")[0]
6664 assert(_subtype == 59)
6665 obj.num_aux = reader.read("!L")[0]
6666 obj.status = reader.read("!L")[0]
6667 return obj
6668
6669 def __eq__(self, other):
6670 if type(self) != type(other): return False
6671 if self.xid != other.xid: return False
6672 if self.num_aux != other.num_aux: return False
6673 if self.status != other.status: return False
6674 return True
6675
6676 def pretty_print(self, q):
6677 q.text("bsn_set_aux_cxns_reply {")
6678 with q.group():
6679 with q.indent(2):
6680 q.breakable()
6681 q.text("xid = ");
6682 if self.xid != None:
6683 q.text("%#x" % self.xid)
6684 else:
6685 q.text('None')
6686 q.text(","); q.breakable()
6687 q.text("num_aux = ");
6688 q.text("%#x" % self.num_aux)
6689 q.text(","); q.breakable()
6690 q.text("status = ");
6691 q.text("%#x" % self.status)
6692 q.breakable()
6693 q.text('}')
6694
6695bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
6696
6697class bsn_set_aux_cxns_request(bsn_header):
6698 version = 5
6699 type = 4
6700 experimenter = 6035143
6701 subtype = 58
6702
6703 def __init__(self, xid=None, num_aux=None):
6704 if xid != None:
6705 self.xid = xid
6706 else:
6707 self.xid = None
6708 if num_aux != None:
6709 self.num_aux = num_aux
6710 else:
6711 self.num_aux = 0
6712 return
6713
6714 def pack(self):
6715 packed = []
6716 packed.append(struct.pack("!B", self.version))
6717 packed.append(struct.pack("!B", self.type))
6718 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6719 packed.append(struct.pack("!L", self.xid))
6720 packed.append(struct.pack("!L", self.experimenter))
6721 packed.append(struct.pack("!L", self.subtype))
6722 packed.append(struct.pack("!L", self.num_aux))
6723 length = sum([len(x) for x in packed])
6724 packed[2] = struct.pack("!H", length)
6725 return ''.join(packed)
6726
6727 @staticmethod
6728 def unpack(reader):
6729 obj = bsn_set_aux_cxns_request()
6730 _version = reader.read("!B")[0]
6731 assert(_version == 5)
6732 _type = reader.read("!B")[0]
6733 assert(_type == 4)
6734 _length = reader.read("!H")[0]
6735 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006736 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006737 obj.xid = reader.read("!L")[0]
6738 _experimenter = reader.read("!L")[0]
6739 assert(_experimenter == 6035143)
6740 _subtype = reader.read("!L")[0]
6741 assert(_subtype == 58)
6742 obj.num_aux = reader.read("!L")[0]
6743 return obj
6744
6745 def __eq__(self, other):
6746 if type(self) != type(other): return False
6747 if self.xid != other.xid: return False
6748 if self.num_aux != other.num_aux: return False
6749 return True
6750
6751 def pretty_print(self, q):
6752 q.text("bsn_set_aux_cxns_request {")
6753 with q.group():
6754 with q.indent(2):
6755 q.breakable()
6756 q.text("xid = ");
6757 if self.xid != None:
6758 q.text("%#x" % self.xid)
6759 else:
6760 q.text('None')
6761 q.text(","); q.breakable()
6762 q.text("num_aux = ");
6763 q.text("%#x" % self.num_aux)
6764 q.breakable()
6765 q.text('}')
6766
6767bsn_header.subtypes[58] = bsn_set_aux_cxns_request
6768
6769class bsn_set_lacp_reply(bsn_header):
6770 version = 5
6771 type = 4
6772 experimenter = 6035143
6773 subtype = 42
6774
6775 def __init__(self, xid=None, status=None, port_no=None):
6776 if xid != None:
6777 self.xid = xid
6778 else:
6779 self.xid = None
6780 if status != None:
6781 self.status = status
6782 else:
6783 self.status = 0
6784 if port_no != None:
6785 self.port_no = port_no
6786 else:
6787 self.port_no = 0
6788 return
6789
6790 def pack(self):
6791 packed = []
6792 packed.append(struct.pack("!B", self.version))
6793 packed.append(struct.pack("!B", self.type))
6794 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6795 packed.append(struct.pack("!L", self.xid))
6796 packed.append(struct.pack("!L", self.experimenter))
6797 packed.append(struct.pack("!L", self.subtype))
6798 packed.append(struct.pack("!L", self.status))
6799 packed.append(util.pack_port_no(self.port_no))
6800 length = sum([len(x) for x in packed])
6801 packed[2] = struct.pack("!H", length)
6802 return ''.join(packed)
6803
6804 @staticmethod
6805 def unpack(reader):
6806 obj = bsn_set_lacp_reply()
6807 _version = reader.read("!B")[0]
6808 assert(_version == 5)
6809 _type = reader.read("!B")[0]
6810 assert(_type == 4)
6811 _length = reader.read("!H")[0]
6812 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006813 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006814 obj.xid = reader.read("!L")[0]
6815 _experimenter = reader.read("!L")[0]
6816 assert(_experimenter == 6035143)
6817 _subtype = reader.read("!L")[0]
6818 assert(_subtype == 42)
6819 obj.status = reader.read("!L")[0]
6820 obj.port_no = util.unpack_port_no(reader)
6821 return obj
6822
6823 def __eq__(self, other):
6824 if type(self) != type(other): return False
6825 if self.xid != other.xid: return False
6826 if self.status != other.status: return False
6827 if self.port_no != other.port_no: return False
6828 return True
6829
6830 def pretty_print(self, q):
6831 q.text("bsn_set_lacp_reply {")
6832 with q.group():
6833 with q.indent(2):
6834 q.breakable()
6835 q.text("xid = ");
6836 if self.xid != None:
6837 q.text("%#x" % self.xid)
6838 else:
6839 q.text('None')
6840 q.text(","); q.breakable()
6841 q.text("status = ");
6842 q.text("%#x" % self.status)
6843 q.text(","); q.breakable()
6844 q.text("port_no = ");
6845 q.text(util.pretty_port(self.port_no))
6846 q.breakable()
6847 q.text('}')
6848
6849bsn_header.subtypes[42] = bsn_set_lacp_reply
6850
6851class bsn_set_lacp_request(bsn_header):
6852 version = 5
6853 type = 4
6854 experimenter = 6035143
6855 subtype = 41
6856
6857 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):
6858 if xid != None:
6859 self.xid = xid
6860 else:
6861 self.xid = None
6862 if enabled != None:
6863 self.enabled = enabled
6864 else:
6865 self.enabled = 0
6866 if port_no != None:
6867 self.port_no = port_no
6868 else:
6869 self.port_no = 0
6870 if actor_sys_priority != None:
6871 self.actor_sys_priority = actor_sys_priority
6872 else:
6873 self.actor_sys_priority = 0
6874 if actor_sys_mac != None:
6875 self.actor_sys_mac = actor_sys_mac
6876 else:
6877 self.actor_sys_mac = [0,0,0,0,0,0]
6878 if actor_port_priority != None:
6879 self.actor_port_priority = actor_port_priority
6880 else:
6881 self.actor_port_priority = 0
6882 if actor_port_num != None:
6883 self.actor_port_num = actor_port_num
6884 else:
6885 self.actor_port_num = 0
6886 if actor_key != None:
6887 self.actor_key = actor_key
6888 else:
6889 self.actor_key = 0
6890 return
6891
6892 def pack(self):
6893 packed = []
6894 packed.append(struct.pack("!B", self.version))
6895 packed.append(struct.pack("!B", self.type))
6896 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6897 packed.append(struct.pack("!L", self.xid))
6898 packed.append(struct.pack("!L", self.experimenter))
6899 packed.append(struct.pack("!L", self.subtype))
6900 packed.append(struct.pack("!B", self.enabled))
6901 packed.append('\x00' * 3)
6902 packed.append(util.pack_port_no(self.port_no))
6903 packed.append(struct.pack("!H", self.actor_sys_priority))
6904 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6905 packed.append(struct.pack("!H", self.actor_port_priority))
6906 packed.append(struct.pack("!H", self.actor_port_num))
6907 packed.append(struct.pack("!H", self.actor_key))
6908 length = sum([len(x) for x in packed])
6909 packed[2] = struct.pack("!H", length)
6910 return ''.join(packed)
6911
6912 @staticmethod
6913 def unpack(reader):
6914 obj = bsn_set_lacp_request()
6915 _version = reader.read("!B")[0]
6916 assert(_version == 5)
6917 _type = reader.read("!B")[0]
6918 assert(_type == 4)
6919 _length = reader.read("!H")[0]
6920 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006921 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006922 obj.xid = reader.read("!L")[0]
6923 _experimenter = reader.read("!L")[0]
6924 assert(_experimenter == 6035143)
6925 _subtype = reader.read("!L")[0]
6926 assert(_subtype == 41)
6927 obj.enabled = reader.read("!B")[0]
6928 reader.skip(3)
6929 obj.port_no = util.unpack_port_no(reader)
6930 obj.actor_sys_priority = reader.read("!H")[0]
6931 obj.actor_sys_mac = list(reader.read('!6B'))
6932 obj.actor_port_priority = reader.read("!H")[0]
6933 obj.actor_port_num = reader.read("!H")[0]
6934 obj.actor_key = reader.read("!H")[0]
6935 return obj
6936
6937 def __eq__(self, other):
6938 if type(self) != type(other): return False
6939 if self.xid != other.xid: return False
6940 if self.enabled != other.enabled: return False
6941 if self.port_no != other.port_no: return False
6942 if self.actor_sys_priority != other.actor_sys_priority: return False
6943 if self.actor_sys_mac != other.actor_sys_mac: return False
6944 if self.actor_port_priority != other.actor_port_priority: return False
6945 if self.actor_port_num != other.actor_port_num: return False
6946 if self.actor_key != other.actor_key: return False
6947 return True
6948
6949 def pretty_print(self, q):
6950 q.text("bsn_set_lacp_request {")
6951 with q.group():
6952 with q.indent(2):
6953 q.breakable()
6954 q.text("xid = ");
6955 if self.xid != None:
6956 q.text("%#x" % self.xid)
6957 else:
6958 q.text('None')
6959 q.text(","); q.breakable()
6960 q.text("enabled = ");
6961 q.text("%#x" % self.enabled)
6962 q.text(","); q.breakable()
6963 q.text("port_no = ");
6964 q.text(util.pretty_port(self.port_no))
6965 q.text(","); q.breakable()
6966 q.text("actor_sys_priority = ");
6967 q.text("%#x" % self.actor_sys_priority)
6968 q.text(","); q.breakable()
6969 q.text("actor_sys_mac = ");
6970 q.text(util.pretty_mac(self.actor_sys_mac))
6971 q.text(","); q.breakable()
6972 q.text("actor_port_priority = ");
6973 q.text("%#x" % self.actor_port_priority)
6974 q.text(","); q.breakable()
6975 q.text("actor_port_num = ");
6976 q.text("%#x" % self.actor_port_num)
6977 q.text(","); q.breakable()
6978 q.text("actor_key = ");
6979 q.text("%#x" % self.actor_key)
6980 q.breakable()
6981 q.text('}')
6982
6983bsn_header.subtypes[41] = bsn_set_lacp_request
6984
Rich Lane2e079da2014-10-29 15:30:24 -07006985class bsn_set_mirroring(bsn_header):
6986 version = 5
6987 type = 4
6988 experimenter = 6035143
6989 subtype = 3
6990
6991 def __init__(self, xid=None, report_mirror_ports=None):
6992 if xid != None:
6993 self.xid = xid
6994 else:
6995 self.xid = None
6996 if report_mirror_ports != None:
6997 self.report_mirror_ports = report_mirror_ports
6998 else:
6999 self.report_mirror_ports = 0
7000 return
7001
7002 def pack(self):
7003 packed = []
7004 packed.append(struct.pack("!B", self.version))
7005 packed.append(struct.pack("!B", self.type))
7006 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7007 packed.append(struct.pack("!L", self.xid))
7008 packed.append(struct.pack("!L", self.experimenter))
7009 packed.append(struct.pack("!L", self.subtype))
7010 packed.append(struct.pack("!B", self.report_mirror_ports))
7011 packed.append('\x00' * 3)
7012 length = sum([len(x) for x in packed])
7013 packed[2] = struct.pack("!H", length)
7014 return ''.join(packed)
7015
7016 @staticmethod
7017 def unpack(reader):
7018 obj = bsn_set_mirroring()
7019 _version = reader.read("!B")[0]
7020 assert(_version == 5)
7021 _type = reader.read("!B")[0]
7022 assert(_type == 4)
7023 _length = reader.read("!H")[0]
7024 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007025 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007026 obj.xid = reader.read("!L")[0]
7027 _experimenter = reader.read("!L")[0]
7028 assert(_experimenter == 6035143)
7029 _subtype = reader.read("!L")[0]
7030 assert(_subtype == 3)
7031 obj.report_mirror_ports = reader.read("!B")[0]
7032 reader.skip(3)
7033 return obj
7034
7035 def __eq__(self, other):
7036 if type(self) != type(other): return False
7037 if self.xid != other.xid: return False
7038 if self.report_mirror_ports != other.report_mirror_ports: return False
7039 return True
7040
7041 def pretty_print(self, q):
7042 q.text("bsn_set_mirroring {")
7043 with q.group():
7044 with q.indent(2):
7045 q.breakable()
7046 q.text("xid = ");
7047 if self.xid != None:
7048 q.text("%#x" % self.xid)
7049 else:
7050 q.text('None')
7051 q.text(","); q.breakable()
7052 q.text("report_mirror_ports = ");
7053 q.text("%#x" % self.report_mirror_ports)
7054 q.breakable()
7055 q.text('}')
7056
7057bsn_header.subtypes[3] = bsn_set_mirroring
7058
7059class bsn_set_pktin_suppression_reply(bsn_header):
7060 version = 5
7061 type = 4
7062 experimenter = 6035143
7063 subtype = 25
7064
7065 def __init__(self, xid=None, status=None):
7066 if xid != None:
7067 self.xid = xid
7068 else:
7069 self.xid = None
7070 if status != None:
7071 self.status = status
7072 else:
7073 self.status = 0
7074 return
7075
7076 def pack(self):
7077 packed = []
7078 packed.append(struct.pack("!B", self.version))
7079 packed.append(struct.pack("!B", self.type))
7080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7081 packed.append(struct.pack("!L", self.xid))
7082 packed.append(struct.pack("!L", self.experimenter))
7083 packed.append(struct.pack("!L", self.subtype))
7084 packed.append(struct.pack("!L", self.status))
7085 length = sum([len(x) for x in packed])
7086 packed[2] = struct.pack("!H", length)
7087 return ''.join(packed)
7088
7089 @staticmethod
7090 def unpack(reader):
7091 obj = bsn_set_pktin_suppression_reply()
7092 _version = reader.read("!B")[0]
7093 assert(_version == 5)
7094 _type = reader.read("!B")[0]
7095 assert(_type == 4)
7096 _length = reader.read("!H")[0]
7097 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007098 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007099 obj.xid = reader.read("!L")[0]
7100 _experimenter = reader.read("!L")[0]
7101 assert(_experimenter == 6035143)
7102 _subtype = reader.read("!L")[0]
7103 assert(_subtype == 25)
7104 obj.status = reader.read("!L")[0]
7105 return obj
7106
7107 def __eq__(self, other):
7108 if type(self) != type(other): return False
7109 if self.xid != other.xid: return False
7110 if self.status != other.status: return False
7111 return True
7112
7113 def pretty_print(self, q):
7114 q.text("bsn_set_pktin_suppression_reply {")
7115 with q.group():
7116 with q.indent(2):
7117 q.breakable()
7118 q.text("xid = ");
7119 if self.xid != None:
7120 q.text("%#x" % self.xid)
7121 else:
7122 q.text('None')
7123 q.text(","); q.breakable()
7124 q.text("status = ");
7125 q.text("%#x" % self.status)
7126 q.breakable()
7127 q.text('}')
7128
7129bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7130
7131class bsn_set_pktin_suppression_request(bsn_header):
7132 version = 5
7133 type = 4
7134 experimenter = 6035143
7135 subtype = 11
7136
7137 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7138 if xid != None:
7139 self.xid = xid
7140 else:
7141 self.xid = None
7142 if enabled != None:
7143 self.enabled = enabled
7144 else:
7145 self.enabled = 0
7146 if idle_timeout != None:
7147 self.idle_timeout = idle_timeout
7148 else:
7149 self.idle_timeout = 0
7150 if hard_timeout != None:
7151 self.hard_timeout = hard_timeout
7152 else:
7153 self.hard_timeout = 0
7154 if priority != None:
7155 self.priority = priority
7156 else:
7157 self.priority = 0
7158 if cookie != None:
7159 self.cookie = cookie
7160 else:
7161 self.cookie = 0
7162 return
7163
7164 def pack(self):
7165 packed = []
7166 packed.append(struct.pack("!B", self.version))
7167 packed.append(struct.pack("!B", self.type))
7168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7169 packed.append(struct.pack("!L", self.xid))
7170 packed.append(struct.pack("!L", self.experimenter))
7171 packed.append(struct.pack("!L", self.subtype))
7172 packed.append(struct.pack("!B", self.enabled))
7173 packed.append('\x00' * 1)
7174 packed.append(struct.pack("!H", self.idle_timeout))
7175 packed.append(struct.pack("!H", self.hard_timeout))
7176 packed.append(struct.pack("!H", self.priority))
7177 packed.append(struct.pack("!Q", self.cookie))
7178 length = sum([len(x) for x in packed])
7179 packed[2] = struct.pack("!H", length)
7180 return ''.join(packed)
7181
7182 @staticmethod
7183 def unpack(reader):
7184 obj = bsn_set_pktin_suppression_request()
7185 _version = reader.read("!B")[0]
7186 assert(_version == 5)
7187 _type = reader.read("!B")[0]
7188 assert(_type == 4)
7189 _length = reader.read("!H")[0]
7190 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007191 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007192 obj.xid = reader.read("!L")[0]
7193 _experimenter = reader.read("!L")[0]
7194 assert(_experimenter == 6035143)
7195 _subtype = reader.read("!L")[0]
7196 assert(_subtype == 11)
7197 obj.enabled = reader.read("!B")[0]
7198 reader.skip(1)
7199 obj.idle_timeout = reader.read("!H")[0]
7200 obj.hard_timeout = reader.read("!H")[0]
7201 obj.priority = reader.read("!H")[0]
7202 obj.cookie = reader.read("!Q")[0]
7203 return obj
7204
7205 def __eq__(self, other):
7206 if type(self) != type(other): return False
7207 if self.xid != other.xid: return False
7208 if self.enabled != other.enabled: return False
7209 if self.idle_timeout != other.idle_timeout: return False
7210 if self.hard_timeout != other.hard_timeout: return False
7211 if self.priority != other.priority: return False
7212 if self.cookie != other.cookie: return False
7213 return True
7214
7215 def pretty_print(self, q):
7216 q.text("bsn_set_pktin_suppression_request {")
7217 with q.group():
7218 with q.indent(2):
7219 q.breakable()
7220 q.text("xid = ");
7221 if self.xid != None:
7222 q.text("%#x" % self.xid)
7223 else:
7224 q.text('None')
7225 q.text(","); q.breakable()
7226 q.text("enabled = ");
7227 q.text("%#x" % self.enabled)
7228 q.text(","); q.breakable()
7229 q.text("idle_timeout = ");
7230 q.text("%#x" % self.idle_timeout)
7231 q.text(","); q.breakable()
7232 q.text("hard_timeout = ");
7233 q.text("%#x" % self.hard_timeout)
7234 q.text(","); q.breakable()
7235 q.text("priority = ");
7236 q.text("%#x" % self.priority)
7237 q.text(","); q.breakable()
7238 q.text("cookie = ");
7239 q.text("%#x" % self.cookie)
7240 q.breakable()
7241 q.text('}')
7242
7243bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7244
Rich Laneccd32ed2014-11-10 17:48:24 -08007245class bsn_set_switch_pipeline_reply(bsn_header):
Rich Lane2e079da2014-10-29 15:30:24 -07007246 version = 5
Rich Laneccd32ed2014-11-10 17:48:24 -08007247 type = 4
7248 experimenter = 6035143
7249 subtype = 54
Rich Lane2e079da2014-10-29 15:30:24 -07007250
Rich Laneccd32ed2014-11-10 17:48:24 -08007251 def __init__(self, xid=None, status=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007252 if xid != None:
7253 self.xid = xid
7254 else:
7255 self.xid = None
Rich Laneccd32ed2014-11-10 17:48:24 -08007256 if status != None:
7257 self.status = status
Rich Lane2e079da2014-10-29 15:30:24 -07007258 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007259 self.status = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007260 return
7261
7262 def pack(self):
7263 packed = []
7264 packed.append(struct.pack("!B", self.version))
7265 packed.append(struct.pack("!B", self.type))
7266 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7267 packed.append(struct.pack("!L", self.xid))
Rich Lane2e079da2014-10-29 15:30:24 -07007268 packed.append(struct.pack("!L", self.experimenter))
7269 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007270 packed.append(struct.pack("!L", self.status))
Rich Lane2e079da2014-10-29 15:30:24 -07007271 length = sum([len(x) for x in packed])
7272 packed[2] = struct.pack("!H", length)
7273 return ''.join(packed)
7274
7275 @staticmethod
7276 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007277 obj = bsn_set_switch_pipeline_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007278 _version = reader.read("!B")[0]
7279 assert(_version == 5)
7280 _type = reader.read("!B")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007281 assert(_type == 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007282 _length = reader.read("!H")[0]
7283 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007284 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007285 obj.xid = reader.read("!L")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007286 _experimenter = reader.read("!L")[0]
7287 assert(_experimenter == 6035143)
7288 _subtype = reader.read("!L")[0]
7289 assert(_subtype == 54)
7290 obj.status = reader.read("!L")[0]
Rich Lane2e079da2014-10-29 15:30:24 -07007291 return obj
7292
7293 def __eq__(self, other):
7294 if type(self) != type(other): return False
7295 if self.xid != other.xid: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007296 if self.status != other.status: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007297 return True
7298
7299 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007300 q.text("bsn_set_switch_pipeline_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007301 with q.group():
7302 with q.indent(2):
7303 q.breakable()
7304 q.text("xid = ");
7305 if self.xid != None:
7306 q.text("%#x" % self.xid)
7307 else:
7308 q.text('None')
7309 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007310 q.text("status = ");
7311 q.text("%#x" % self.status)
Rich Lane2e079da2014-10-29 15:30:24 -07007312 q.breakable()
7313 q.text('}')
7314
Rich Laneccd32ed2014-11-10 17:48:24 -08007315bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007316
Rich Laneccd32ed2014-11-10 17:48:24 -08007317class bsn_set_switch_pipeline_request(bsn_header):
7318 version = 5
7319 type = 4
7320 experimenter = 6035143
7321 subtype = 53
Rich Lane2e079da2014-10-29 15:30:24 -07007322
Rich Laneccd32ed2014-11-10 17:48:24 -08007323 def __init__(self, xid=None, pipeline=None):
7324 if xid != None:
7325 self.xid = xid
7326 else:
7327 self.xid = None
7328 if pipeline != None:
7329 self.pipeline = pipeline
7330 else:
7331 self.pipeline = ""
7332 return
7333
7334 def pack(self):
7335 packed = []
7336 packed.append(struct.pack("!B", self.version))
7337 packed.append(struct.pack("!B", self.type))
7338 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7339 packed.append(struct.pack("!L", self.xid))
7340 packed.append(struct.pack("!L", self.experimenter))
7341 packed.append(struct.pack("!L", self.subtype))
7342 packed.append(struct.pack("!256s", self.pipeline))
7343 length = sum([len(x) for x in packed])
7344 packed[2] = struct.pack("!H", length)
7345 return ''.join(packed)
7346
7347 @staticmethod
7348 def unpack(reader):
7349 obj = bsn_set_switch_pipeline_request()
7350 _version = reader.read("!B")[0]
7351 assert(_version == 5)
7352 _type = reader.read("!B")[0]
7353 assert(_type == 4)
7354 _length = reader.read("!H")[0]
7355 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007356 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007357 obj.xid = reader.read("!L")[0]
7358 _experimenter = reader.read("!L")[0]
7359 assert(_experimenter == 6035143)
7360 _subtype = reader.read("!L")[0]
7361 assert(_subtype == 53)
7362 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7363 return obj
7364
7365 def __eq__(self, other):
7366 if type(self) != type(other): return False
7367 if self.xid != other.xid: return False
7368 if self.pipeline != other.pipeline: return False
7369 return True
7370
7371 def pretty_print(self, q):
7372 q.text("bsn_set_switch_pipeline_request {")
7373 with q.group():
7374 with q.indent(2):
7375 q.breakable()
7376 q.text("xid = ");
7377 if self.xid != None:
7378 q.text("%#x" % self.xid)
7379 else:
7380 q.text('None')
7381 q.text(","); q.breakable()
7382 q.text("pipeline = ");
7383 q.pp(self.pipeline)
7384 q.breakable()
7385 q.text('}')
7386
7387bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7388
7389class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
Rich Lane2e079da2014-10-29 15:30:24 -07007390 version = 5
7391 type = 19
7392 stats_type = 65535
7393 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007394 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007395
Rich Laneccd32ed2014-11-10 17:48:24 -08007396 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007397 if xid != None:
7398 self.xid = xid
7399 else:
7400 self.xid = None
7401 if flags != None:
7402 self.flags = flags
7403 else:
7404 self.flags = 0
Rich Laneccd32ed2014-11-10 17:48:24 -08007405 if entries != None:
7406 self.entries = entries
Rich Lane2e079da2014-10-29 15:30:24 -07007407 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007408 self.entries = []
Rich Lane2e079da2014-10-29 15:30:24 -07007409 return
7410
7411 def pack(self):
7412 packed = []
7413 packed.append(struct.pack("!B", self.version))
7414 packed.append(struct.pack("!B", self.type))
7415 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7416 packed.append(struct.pack("!L", self.xid))
7417 packed.append(struct.pack("!H", self.stats_type))
7418 packed.append(struct.pack("!H", self.flags))
7419 packed.append('\x00' * 4)
7420 packed.append(struct.pack("!L", self.experimenter))
7421 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007422 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane2e079da2014-10-29 15:30:24 -07007423 length = sum([len(x) for x in packed])
7424 packed[2] = struct.pack("!H", length)
7425 return ''.join(packed)
7426
7427 @staticmethod
7428 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007429 obj = bsn_switch_pipeline_stats_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007430 _version = reader.read("!B")[0]
7431 assert(_version == 5)
7432 _type = reader.read("!B")[0]
7433 assert(_type == 19)
7434 _length = reader.read("!H")[0]
7435 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007436 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007437 obj.xid = reader.read("!L")[0]
7438 _stats_type = reader.read("!H")[0]
7439 assert(_stats_type == 65535)
7440 obj.flags = reader.read("!H")[0]
7441 reader.skip(4)
7442 _experimenter = reader.read("!L")[0]
7443 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007444 _subtype = reader.read("!L")[0]
7445 assert(_subtype == 6)
7446 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07007447 return obj
7448
7449 def __eq__(self, other):
7450 if type(self) != type(other): return False
7451 if self.xid != other.xid: return False
7452 if self.flags != other.flags: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007453 if self.entries != other.entries: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007454 return True
7455
7456 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007457 q.text("bsn_switch_pipeline_stats_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007458 with q.group():
7459 with q.indent(2):
7460 q.breakable()
7461 q.text("xid = ");
7462 if self.xid != None:
7463 q.text("%#x" % self.xid)
7464 else:
7465 q.text('None')
7466 q.text(","); q.breakable()
7467 q.text("flags = ");
7468 q.text("%#x" % self.flags)
7469 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007470 q.text("entries = ");
7471 q.pp(self.entries)
Rich Lane2e079da2014-10-29 15:30:24 -07007472 q.breakable()
7473 q.text('}')
7474
Rich Laneccd32ed2014-11-10 17:48:24 -08007475bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007476
Rich Laneccd32ed2014-11-10 17:48:24 -08007477class bsn_switch_pipeline_stats_request(bsn_stats_request):
Rich Lane2e079da2014-10-29 15:30:24 -07007478 version = 5
7479 type = 18
7480 stats_type = 65535
7481 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007482 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007483
Rich Laneccd32ed2014-11-10 17:48:24 -08007484 def __init__(self, xid=None, flags=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007485 if xid != None:
7486 self.xid = xid
7487 else:
7488 self.xid = None
7489 if flags != None:
7490 self.flags = flags
7491 else:
7492 self.flags = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007493 return
7494
7495 def pack(self):
7496 packed = []
7497 packed.append(struct.pack("!B", self.version))
7498 packed.append(struct.pack("!B", self.type))
7499 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7500 packed.append(struct.pack("!L", self.xid))
7501 packed.append(struct.pack("!H", self.stats_type))
7502 packed.append(struct.pack("!H", self.flags))
7503 packed.append('\x00' * 4)
7504 packed.append(struct.pack("!L", self.experimenter))
7505 packed.append(struct.pack("!L", self.subtype))
7506 length = sum([len(x) for x in packed])
7507 packed[2] = struct.pack("!H", length)
7508 return ''.join(packed)
7509
7510 @staticmethod
7511 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007512 obj = bsn_switch_pipeline_stats_request()
Rich Lane2e079da2014-10-29 15:30:24 -07007513 _version = reader.read("!B")[0]
7514 assert(_version == 5)
7515 _type = reader.read("!B")[0]
7516 assert(_type == 18)
7517 _length = reader.read("!H")[0]
7518 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007519 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007520 obj.xid = reader.read("!L")[0]
7521 _stats_type = reader.read("!H")[0]
7522 assert(_stats_type == 65535)
7523 obj.flags = reader.read("!H")[0]
7524 reader.skip(4)
7525 _experimenter = reader.read("!L")[0]
7526 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007527 _subtype = reader.read("!L")[0]
7528 assert(_subtype == 6)
Rich Lane2e079da2014-10-29 15:30:24 -07007529 return obj
7530
7531 def __eq__(self, other):
7532 if type(self) != type(other): return False
7533 if self.xid != other.xid: return False
7534 if self.flags != other.flags: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007535 return True
7536
7537 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007538 q.text("bsn_switch_pipeline_stats_request {")
Rich Lane2e079da2014-10-29 15:30:24 -07007539 with q.group():
7540 with q.indent(2):
7541 q.breakable()
7542 q.text("xid = ");
7543 if self.xid != None:
7544 q.text("%#x" % self.xid)
7545 else:
7546 q.text('None')
7547 q.text(","); q.breakable()
7548 q.text("flags = ");
7549 q.text("%#x" % self.flags)
7550 q.breakable()
7551 q.text('}')
7552
Rich Laneccd32ed2014-11-10 17:48:24 -08007553bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7554
7555class bsn_table_checksum_stats_reply(bsn_stats_reply):
7556 version = 5
7557 type = 19
7558 stats_type = 65535
7559 experimenter = 6035143
7560 subtype = 11
7561
7562 def __init__(self, xid=None, flags=None, entries=None):
7563 if xid != None:
7564 self.xid = xid
7565 else:
7566 self.xid = None
7567 if flags != None:
7568 self.flags = flags
7569 else:
7570 self.flags = 0
7571 if entries != None:
7572 self.entries = entries
7573 else:
7574 self.entries = []
7575 return
7576
7577 def pack(self):
7578 packed = []
7579 packed.append(struct.pack("!B", self.version))
7580 packed.append(struct.pack("!B", self.type))
7581 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7582 packed.append(struct.pack("!L", self.xid))
7583 packed.append(struct.pack("!H", self.stats_type))
7584 packed.append(struct.pack("!H", self.flags))
7585 packed.append('\x00' * 4)
7586 packed.append(struct.pack("!L", self.experimenter))
7587 packed.append(struct.pack("!L", self.subtype))
7588 packed.append(loxi.generic_util.pack_list(self.entries))
7589 length = sum([len(x) for x in packed])
7590 packed[2] = struct.pack("!H", length)
7591 return ''.join(packed)
7592
7593 @staticmethod
7594 def unpack(reader):
7595 obj = bsn_table_checksum_stats_reply()
7596 _version = reader.read("!B")[0]
7597 assert(_version == 5)
7598 _type = reader.read("!B")[0]
7599 assert(_type == 19)
7600 _length = reader.read("!H")[0]
7601 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007602 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007603 obj.xid = reader.read("!L")[0]
7604 _stats_type = reader.read("!H")[0]
7605 assert(_stats_type == 65535)
7606 obj.flags = reader.read("!H")[0]
7607 reader.skip(4)
7608 _experimenter = reader.read("!L")[0]
7609 assert(_experimenter == 6035143)
7610 _subtype = reader.read("!L")[0]
7611 assert(_subtype == 11)
7612 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
7613 return obj
7614
7615 def __eq__(self, other):
7616 if type(self) != type(other): return False
7617 if self.xid != other.xid: return False
7618 if self.flags != other.flags: return False
7619 if self.entries != other.entries: return False
7620 return True
7621
7622 def pretty_print(self, q):
7623 q.text("bsn_table_checksum_stats_reply {")
7624 with q.group():
7625 with q.indent(2):
7626 q.breakable()
7627 q.text("xid = ");
7628 if self.xid != None:
7629 q.text("%#x" % self.xid)
7630 else:
7631 q.text('None')
7632 q.text(","); q.breakable()
7633 q.text("flags = ");
7634 q.text("%#x" % self.flags)
7635 q.text(","); q.breakable()
7636 q.text("entries = ");
7637 q.pp(self.entries)
7638 q.breakable()
7639 q.text('}')
7640
7641bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7642
7643class bsn_table_checksum_stats_request(bsn_stats_request):
7644 version = 5
7645 type = 18
7646 stats_type = 65535
7647 experimenter = 6035143
7648 subtype = 11
7649
7650 def __init__(self, xid=None, flags=None):
7651 if xid != None:
7652 self.xid = xid
7653 else:
7654 self.xid = None
7655 if flags != None:
7656 self.flags = flags
7657 else:
7658 self.flags = 0
7659 return
7660
7661 def pack(self):
7662 packed = []
7663 packed.append(struct.pack("!B", self.version))
7664 packed.append(struct.pack("!B", self.type))
7665 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7666 packed.append(struct.pack("!L", self.xid))
7667 packed.append(struct.pack("!H", self.stats_type))
7668 packed.append(struct.pack("!H", self.flags))
7669 packed.append('\x00' * 4)
7670 packed.append(struct.pack("!L", self.experimenter))
7671 packed.append(struct.pack("!L", self.subtype))
7672 length = sum([len(x) for x in packed])
7673 packed[2] = struct.pack("!H", length)
7674 return ''.join(packed)
7675
7676 @staticmethod
7677 def unpack(reader):
7678 obj = bsn_table_checksum_stats_request()
7679 _version = reader.read("!B")[0]
7680 assert(_version == 5)
7681 _type = reader.read("!B")[0]
7682 assert(_type == 18)
7683 _length = reader.read("!H")[0]
7684 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007685 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007686 obj.xid = reader.read("!L")[0]
7687 _stats_type = reader.read("!H")[0]
7688 assert(_stats_type == 65535)
7689 obj.flags = reader.read("!H")[0]
7690 reader.skip(4)
7691 _experimenter = reader.read("!L")[0]
7692 assert(_experimenter == 6035143)
7693 _subtype = reader.read("!L")[0]
7694 assert(_subtype == 11)
7695 return obj
7696
7697 def __eq__(self, other):
7698 if type(self) != type(other): return False
7699 if self.xid != other.xid: return False
7700 if self.flags != other.flags: return False
7701 return True
7702
7703 def pretty_print(self, q):
7704 q.text("bsn_table_checksum_stats_request {")
7705 with q.group():
7706 with q.indent(2):
7707 q.breakable()
7708 q.text("xid = ");
7709 if self.xid != None:
7710 q.text("%#x" % self.xid)
7711 else:
7712 q.text('None')
7713 q.text(","); q.breakable()
7714 q.text("flags = ");
7715 q.text("%#x" % self.flags)
7716 q.breakable()
7717 q.text('}')
7718
7719bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
7720
7721class bsn_table_set_buckets_size(bsn_header):
7722 version = 5
7723 type = 4
7724 experimenter = 6035143
7725 subtype = 61
7726
7727 def __init__(self, xid=None, table_id=None, buckets_size=None):
7728 if xid != None:
7729 self.xid = xid
7730 else:
7731 self.xid = None
7732 if table_id != None:
7733 self.table_id = table_id
7734 else:
7735 self.table_id = 0
7736 if buckets_size != None:
7737 self.buckets_size = buckets_size
7738 else:
7739 self.buckets_size = 0
7740 return
7741
7742 def pack(self):
7743 packed = []
7744 packed.append(struct.pack("!B", self.version))
7745 packed.append(struct.pack("!B", self.type))
7746 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7747 packed.append(struct.pack("!L", self.xid))
7748 packed.append(struct.pack("!L", self.experimenter))
7749 packed.append(struct.pack("!L", self.subtype))
7750 packed.append('\x00' * 1)
7751 packed.append(struct.pack("!B", self.table_id))
7752 packed.append('\x00' * 2)
7753 packed.append(struct.pack("!L", self.buckets_size))
7754 length = sum([len(x) for x in packed])
7755 packed[2] = struct.pack("!H", length)
7756 return ''.join(packed)
7757
7758 @staticmethod
7759 def unpack(reader):
7760 obj = bsn_table_set_buckets_size()
7761 _version = reader.read("!B")[0]
7762 assert(_version == 5)
7763 _type = reader.read("!B")[0]
7764 assert(_type == 4)
7765 _length = reader.read("!H")[0]
7766 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007767 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007768 obj.xid = reader.read("!L")[0]
7769 _experimenter = reader.read("!L")[0]
7770 assert(_experimenter == 6035143)
7771 _subtype = reader.read("!L")[0]
7772 assert(_subtype == 61)
7773 reader.skip(1)
7774 obj.table_id = reader.read("!B")[0]
7775 reader.skip(2)
7776 obj.buckets_size = reader.read("!L")[0]
7777 return obj
7778
7779 def __eq__(self, other):
7780 if type(self) != type(other): return False
7781 if self.xid != other.xid: return False
7782 if self.table_id != other.table_id: return False
7783 if self.buckets_size != other.buckets_size: return False
7784 return True
7785
7786 def pretty_print(self, q):
7787 q.text("bsn_table_set_buckets_size {")
7788 with q.group():
7789 with q.indent(2):
7790 q.breakable()
7791 q.text("xid = ");
7792 if self.xid != None:
7793 q.text("%#x" % self.xid)
7794 else:
7795 q.text('None')
7796 q.text(","); q.breakable()
7797 q.text("table_id = ");
7798 q.text("%#x" % self.table_id)
7799 q.text(","); q.breakable()
7800 q.text("buckets_size = ");
7801 q.text("%#x" % self.buckets_size)
7802 q.breakable()
7803 q.text('}')
7804
7805bsn_header.subtypes[61] = bsn_table_set_buckets_size
7806
7807class bsn_time_reply(bsn_header):
7808 version = 5
7809 type = 4
7810 experimenter = 6035143
7811 subtype = 45
7812
7813 def __init__(self, xid=None, time_ms=None):
7814 if xid != None:
7815 self.xid = xid
7816 else:
7817 self.xid = None
7818 if time_ms != None:
7819 self.time_ms = time_ms
7820 else:
7821 self.time_ms = 0
7822 return
7823
7824 def pack(self):
7825 packed = []
7826 packed.append(struct.pack("!B", self.version))
7827 packed.append(struct.pack("!B", self.type))
7828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7829 packed.append(struct.pack("!L", self.xid))
7830 packed.append(struct.pack("!L", self.experimenter))
7831 packed.append(struct.pack("!L", self.subtype))
7832 packed.append(struct.pack("!Q", self.time_ms))
7833 length = sum([len(x) for x in packed])
7834 packed[2] = struct.pack("!H", length)
7835 return ''.join(packed)
7836
7837 @staticmethod
7838 def unpack(reader):
7839 obj = bsn_time_reply()
7840 _version = reader.read("!B")[0]
7841 assert(_version == 5)
7842 _type = reader.read("!B")[0]
7843 assert(_type == 4)
7844 _length = reader.read("!H")[0]
7845 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007846 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007847 obj.xid = reader.read("!L")[0]
7848 _experimenter = reader.read("!L")[0]
7849 assert(_experimenter == 6035143)
7850 _subtype = reader.read("!L")[0]
7851 assert(_subtype == 45)
7852 obj.time_ms = reader.read("!Q")[0]
7853 return obj
7854
7855 def __eq__(self, other):
7856 if type(self) != type(other): return False
7857 if self.xid != other.xid: return False
7858 if self.time_ms != other.time_ms: return False
7859 return True
7860
7861 def pretty_print(self, q):
7862 q.text("bsn_time_reply {")
7863 with q.group():
7864 with q.indent(2):
7865 q.breakable()
7866 q.text("xid = ");
7867 if self.xid != None:
7868 q.text("%#x" % self.xid)
7869 else:
7870 q.text('None')
7871 q.text(","); q.breakable()
7872 q.text("time_ms = ");
7873 q.text("%#x" % self.time_ms)
7874 q.breakable()
7875 q.text('}')
7876
7877bsn_header.subtypes[45] = bsn_time_reply
7878
7879class bsn_time_request(bsn_header):
7880 version = 5
7881 type = 4
7882 experimenter = 6035143
7883 subtype = 44
7884
7885 def __init__(self, xid=None):
7886 if xid != None:
7887 self.xid = xid
7888 else:
7889 self.xid = None
7890 return
7891
7892 def pack(self):
7893 packed = []
7894 packed.append(struct.pack("!B", self.version))
7895 packed.append(struct.pack("!B", self.type))
7896 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7897 packed.append(struct.pack("!L", self.xid))
7898 packed.append(struct.pack("!L", self.experimenter))
7899 packed.append(struct.pack("!L", self.subtype))
7900 length = sum([len(x) for x in packed])
7901 packed[2] = struct.pack("!H", length)
7902 return ''.join(packed)
7903
7904 @staticmethod
7905 def unpack(reader):
7906 obj = bsn_time_request()
7907 _version = reader.read("!B")[0]
7908 assert(_version == 5)
7909 _type = reader.read("!B")[0]
7910 assert(_type == 4)
7911 _length = reader.read("!H")[0]
7912 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007913 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007914 obj.xid = reader.read("!L")[0]
7915 _experimenter = reader.read("!L")[0]
7916 assert(_experimenter == 6035143)
7917 _subtype = reader.read("!L")[0]
7918 assert(_subtype == 44)
7919 return obj
7920
7921 def __eq__(self, other):
7922 if type(self) != type(other): return False
7923 if self.xid != other.xid: return False
7924 return True
7925
7926 def pretty_print(self, q):
7927 q.text("bsn_time_request {")
7928 with q.group():
7929 with q.indent(2):
7930 q.breakable()
7931 q.text("xid = ");
7932 if self.xid != None:
7933 q.text("%#x" % self.xid)
7934 else:
7935 q.text('None')
7936 q.breakable()
7937 q.text('}')
7938
7939bsn_header.subtypes[44] = bsn_time_request
Rich Lane2e079da2014-10-29 15:30:24 -07007940
7941class bsn_virtual_port_create_reply(bsn_header):
7942 version = 5
7943 type = 4
7944 experimenter = 6035143
7945 subtype = 16
7946
7947 def __init__(self, xid=None, status=None, vport_no=None):
7948 if xid != None:
7949 self.xid = xid
7950 else:
7951 self.xid = None
7952 if status != None:
7953 self.status = status
7954 else:
7955 self.status = 0
7956 if vport_no != None:
7957 self.vport_no = vport_no
7958 else:
7959 self.vport_no = 0
7960 return
7961
7962 def pack(self):
7963 packed = []
7964 packed.append(struct.pack("!B", self.version))
7965 packed.append(struct.pack("!B", self.type))
7966 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7967 packed.append(struct.pack("!L", self.xid))
7968 packed.append(struct.pack("!L", self.experimenter))
7969 packed.append(struct.pack("!L", self.subtype))
7970 packed.append(struct.pack("!L", self.status))
7971 packed.append(struct.pack("!L", self.vport_no))
7972 length = sum([len(x) for x in packed])
7973 packed[2] = struct.pack("!H", length)
7974 return ''.join(packed)
7975
7976 @staticmethod
7977 def unpack(reader):
7978 obj = bsn_virtual_port_create_reply()
7979 _version = reader.read("!B")[0]
7980 assert(_version == 5)
7981 _type = reader.read("!B")[0]
7982 assert(_type == 4)
7983 _length = reader.read("!H")[0]
7984 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007985 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007986 obj.xid = reader.read("!L")[0]
7987 _experimenter = reader.read("!L")[0]
7988 assert(_experimenter == 6035143)
7989 _subtype = reader.read("!L")[0]
7990 assert(_subtype == 16)
7991 obj.status = reader.read("!L")[0]
7992 obj.vport_no = reader.read("!L")[0]
7993 return obj
7994
7995 def __eq__(self, other):
7996 if type(self) != type(other): return False
7997 if self.xid != other.xid: return False
7998 if self.status != other.status: return False
7999 if self.vport_no != other.vport_no: return False
8000 return True
8001
8002 def pretty_print(self, q):
8003 q.text("bsn_virtual_port_create_reply {")
8004 with q.group():
8005 with q.indent(2):
8006 q.breakable()
8007 q.text("xid = ");
8008 if self.xid != None:
8009 q.text("%#x" % self.xid)
8010 else:
8011 q.text('None')
8012 q.text(","); q.breakable()
8013 q.text("status = ");
8014 q.text("%#x" % self.status)
8015 q.text(","); q.breakable()
8016 q.text("vport_no = ");
8017 q.text("%#x" % self.vport_no)
8018 q.breakable()
8019 q.text('}')
8020
8021bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8022
8023class bsn_virtual_port_create_request(bsn_header):
8024 version = 5
8025 type = 4
8026 experimenter = 6035143
8027 subtype = 15
8028
8029 def __init__(self, xid=None, vport=None):
8030 if xid != None:
8031 self.xid = xid
8032 else:
8033 self.xid = None
8034 if vport != None:
8035 self.vport = vport
8036 else:
8037 self.vport = common.bsn_vport()
8038 return
8039
8040 def pack(self):
8041 packed = []
8042 packed.append(struct.pack("!B", self.version))
8043 packed.append(struct.pack("!B", self.type))
8044 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8045 packed.append(struct.pack("!L", self.xid))
8046 packed.append(struct.pack("!L", self.experimenter))
8047 packed.append(struct.pack("!L", self.subtype))
8048 packed.append(self.vport.pack())
8049 length = sum([len(x) for x in packed])
8050 packed[2] = struct.pack("!H", length)
8051 return ''.join(packed)
8052
8053 @staticmethod
8054 def unpack(reader):
8055 obj = bsn_virtual_port_create_request()
8056 _version = reader.read("!B")[0]
8057 assert(_version == 5)
8058 _type = reader.read("!B")[0]
8059 assert(_type == 4)
8060 _length = reader.read("!H")[0]
8061 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008062 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008063 obj.xid = reader.read("!L")[0]
8064 _experimenter = reader.read("!L")[0]
8065 assert(_experimenter == 6035143)
8066 _subtype = reader.read("!L")[0]
8067 assert(_subtype == 15)
8068 obj.vport = common.bsn_vport.unpack(reader)
8069 return obj
8070
8071 def __eq__(self, other):
8072 if type(self) != type(other): return False
8073 if self.xid != other.xid: return False
8074 if self.vport != other.vport: return False
8075 return True
8076
8077 def pretty_print(self, q):
8078 q.text("bsn_virtual_port_create_request {")
8079 with q.group():
8080 with q.indent(2):
8081 q.breakable()
8082 q.text("xid = ");
8083 if self.xid != None:
8084 q.text("%#x" % self.xid)
8085 else:
8086 q.text('None')
8087 q.text(","); q.breakable()
8088 q.text("vport = ");
8089 q.pp(self.vport)
8090 q.breakable()
8091 q.text('}')
8092
8093bsn_header.subtypes[15] = bsn_virtual_port_create_request
8094
8095class bsn_virtual_port_remove_reply(bsn_header):
8096 version = 5
8097 type = 4
8098 experimenter = 6035143
8099 subtype = 26
8100
8101 def __init__(self, xid=None, status=None):
8102 if xid != None:
8103 self.xid = xid
8104 else:
8105 self.xid = None
8106 if status != None:
8107 self.status = status
8108 else:
8109 self.status = 0
8110 return
8111
8112 def pack(self):
8113 packed = []
8114 packed.append(struct.pack("!B", self.version))
8115 packed.append(struct.pack("!B", self.type))
8116 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8117 packed.append(struct.pack("!L", self.xid))
8118 packed.append(struct.pack("!L", self.experimenter))
8119 packed.append(struct.pack("!L", self.subtype))
8120 packed.append(struct.pack("!L", self.status))
8121 length = sum([len(x) for x in packed])
8122 packed[2] = struct.pack("!H", length)
8123 return ''.join(packed)
8124
8125 @staticmethod
8126 def unpack(reader):
8127 obj = bsn_virtual_port_remove_reply()
8128 _version = reader.read("!B")[0]
8129 assert(_version == 5)
8130 _type = reader.read("!B")[0]
8131 assert(_type == 4)
8132 _length = reader.read("!H")[0]
8133 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008134 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008135 obj.xid = reader.read("!L")[0]
8136 _experimenter = reader.read("!L")[0]
8137 assert(_experimenter == 6035143)
8138 _subtype = reader.read("!L")[0]
8139 assert(_subtype == 26)
8140 obj.status = reader.read("!L")[0]
8141 return obj
8142
8143 def __eq__(self, other):
8144 if type(self) != type(other): return False
8145 if self.xid != other.xid: return False
8146 if self.status != other.status: return False
8147 return True
8148
8149 def pretty_print(self, q):
8150 q.text("bsn_virtual_port_remove_reply {")
8151 with q.group():
8152 with q.indent(2):
8153 q.breakable()
8154 q.text("xid = ");
8155 if self.xid != None:
8156 q.text("%#x" % self.xid)
8157 else:
8158 q.text('None')
8159 q.text(","); q.breakable()
8160 q.text("status = ");
8161 q.text("%#x" % self.status)
8162 q.breakable()
8163 q.text('}')
8164
8165bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8166
8167class bsn_virtual_port_remove_request(bsn_header):
8168 version = 5
8169 type = 4
8170 experimenter = 6035143
8171 subtype = 17
8172
8173 def __init__(self, xid=None, vport_no=None):
8174 if xid != None:
8175 self.xid = xid
8176 else:
8177 self.xid = None
8178 if vport_no != None:
8179 self.vport_no = vport_no
8180 else:
8181 self.vport_no = 0
8182 return
8183
8184 def pack(self):
8185 packed = []
8186 packed.append(struct.pack("!B", self.version))
8187 packed.append(struct.pack("!B", self.type))
8188 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8189 packed.append(struct.pack("!L", self.xid))
8190 packed.append(struct.pack("!L", self.experimenter))
8191 packed.append(struct.pack("!L", self.subtype))
8192 packed.append(struct.pack("!L", self.vport_no))
8193 length = sum([len(x) for x in packed])
8194 packed[2] = struct.pack("!H", length)
8195 return ''.join(packed)
8196
8197 @staticmethod
8198 def unpack(reader):
8199 obj = bsn_virtual_port_remove_request()
8200 _version = reader.read("!B")[0]
8201 assert(_version == 5)
8202 _type = reader.read("!B")[0]
8203 assert(_type == 4)
8204 _length = reader.read("!H")[0]
8205 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008206 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008207 obj.xid = reader.read("!L")[0]
8208 _experimenter = reader.read("!L")[0]
8209 assert(_experimenter == 6035143)
8210 _subtype = reader.read("!L")[0]
8211 assert(_subtype == 17)
8212 obj.vport_no = reader.read("!L")[0]
8213 return obj
8214
8215 def __eq__(self, other):
8216 if type(self) != type(other): return False
8217 if self.xid != other.xid: return False
8218 if self.vport_no != other.vport_no: return False
8219 return True
8220
8221 def pretty_print(self, q):
8222 q.text("bsn_virtual_port_remove_request {")
8223 with q.group():
8224 with q.indent(2):
8225 q.breakable()
8226 q.text("xid = ");
8227 if self.xid != None:
8228 q.text("%#x" % self.xid)
8229 else:
8230 q.text('None')
8231 q.text(","); q.breakable()
8232 q.text("vport_no = ");
8233 q.text("%#x" % self.vport_no)
8234 q.breakable()
8235 q.text('}')
8236
8237bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8238
Rich Laneccd32ed2014-11-10 17:48:24 -08008239class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8240 version = 5
8241 type = 19
8242 stats_type = 65535
8243 experimenter = 6035143
8244 subtype = 9
8245
8246 def __init__(self, xid=None, flags=None, entries=None):
8247 if xid != None:
8248 self.xid = xid
8249 else:
8250 self.xid = None
8251 if flags != None:
8252 self.flags = flags
8253 else:
8254 self.flags = 0
8255 if entries != None:
8256 self.entries = entries
8257 else:
8258 self.entries = []
8259 return
8260
8261 def pack(self):
8262 packed = []
8263 packed.append(struct.pack("!B", self.version))
8264 packed.append(struct.pack("!B", self.type))
8265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8266 packed.append(struct.pack("!L", self.xid))
8267 packed.append(struct.pack("!H", self.stats_type))
8268 packed.append(struct.pack("!H", self.flags))
8269 packed.append('\x00' * 4)
8270 packed.append(struct.pack("!L", self.experimenter))
8271 packed.append(struct.pack("!L", self.subtype))
8272 packed.append(loxi.generic_util.pack_list(self.entries))
8273 length = sum([len(x) for x in packed])
8274 packed[2] = struct.pack("!H", length)
8275 return ''.join(packed)
8276
8277 @staticmethod
8278 def unpack(reader):
8279 obj = bsn_vlan_counter_stats_reply()
8280 _version = reader.read("!B")[0]
8281 assert(_version == 5)
8282 _type = reader.read("!B")[0]
8283 assert(_type == 19)
8284 _length = reader.read("!H")[0]
8285 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008286 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008287 obj.xid = reader.read("!L")[0]
8288 _stats_type = reader.read("!H")[0]
8289 assert(_stats_type == 65535)
8290 obj.flags = reader.read("!H")[0]
8291 reader.skip(4)
8292 _experimenter = reader.read("!L")[0]
8293 assert(_experimenter == 6035143)
8294 _subtype = reader.read("!L")[0]
8295 assert(_subtype == 9)
8296 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8297 return obj
8298
8299 def __eq__(self, other):
8300 if type(self) != type(other): return False
8301 if self.xid != other.xid: return False
8302 if self.flags != other.flags: return False
8303 if self.entries != other.entries: return False
8304 return True
8305
8306 def pretty_print(self, q):
8307 q.text("bsn_vlan_counter_stats_reply {")
8308 with q.group():
8309 with q.indent(2):
8310 q.breakable()
8311 q.text("xid = ");
8312 if self.xid != None:
8313 q.text("%#x" % self.xid)
8314 else:
8315 q.text('None')
8316 q.text(","); q.breakable()
8317 q.text("flags = ");
8318 q.text("%#x" % self.flags)
8319 q.text(","); q.breakable()
8320 q.text("entries = ");
8321 q.pp(self.entries)
8322 q.breakable()
8323 q.text('}')
8324
8325bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8326
8327class bsn_vlan_counter_stats_request(bsn_stats_request):
8328 version = 5
8329 type = 18
8330 stats_type = 65535
8331 experimenter = 6035143
8332 subtype = 9
8333
8334 def __init__(self, xid=None, flags=None, vlan_vid=None):
8335 if xid != None:
8336 self.xid = xid
8337 else:
8338 self.xid = None
8339 if flags != None:
8340 self.flags = flags
8341 else:
8342 self.flags = 0
8343 if vlan_vid != None:
8344 self.vlan_vid = vlan_vid
8345 else:
8346 self.vlan_vid = 0
8347 return
8348
8349 def pack(self):
8350 packed = []
8351 packed.append(struct.pack("!B", self.version))
8352 packed.append(struct.pack("!B", self.type))
8353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8354 packed.append(struct.pack("!L", self.xid))
8355 packed.append(struct.pack("!H", self.stats_type))
8356 packed.append(struct.pack("!H", self.flags))
8357 packed.append('\x00' * 4)
8358 packed.append(struct.pack("!L", self.experimenter))
8359 packed.append(struct.pack("!L", self.subtype))
8360 packed.append(struct.pack("!H", self.vlan_vid))
8361 length = sum([len(x) for x in packed])
8362 packed[2] = struct.pack("!H", length)
8363 return ''.join(packed)
8364
8365 @staticmethod
8366 def unpack(reader):
8367 obj = bsn_vlan_counter_stats_request()
8368 _version = reader.read("!B")[0]
8369 assert(_version == 5)
8370 _type = reader.read("!B")[0]
8371 assert(_type == 18)
8372 _length = reader.read("!H")[0]
8373 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008374 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008375 obj.xid = reader.read("!L")[0]
8376 _stats_type = reader.read("!H")[0]
8377 assert(_stats_type == 65535)
8378 obj.flags = reader.read("!H")[0]
8379 reader.skip(4)
8380 _experimenter = reader.read("!L")[0]
8381 assert(_experimenter == 6035143)
8382 _subtype = reader.read("!L")[0]
8383 assert(_subtype == 9)
8384 obj.vlan_vid = reader.read("!H")[0]
8385 return obj
8386
8387 def __eq__(self, other):
8388 if type(self) != type(other): return False
8389 if self.xid != other.xid: return False
8390 if self.flags != other.flags: return False
8391 if self.vlan_vid != other.vlan_vid: return False
8392 return True
8393
8394 def pretty_print(self, q):
8395 q.text("bsn_vlan_counter_stats_request {")
8396 with q.group():
8397 with q.indent(2):
8398 q.breakable()
8399 q.text("xid = ");
8400 if self.xid != None:
8401 q.text("%#x" % self.xid)
8402 else:
8403 q.text('None')
8404 q.text(","); q.breakable()
8405 q.text("flags = ");
8406 q.text("%#x" % self.flags)
8407 q.text(","); q.breakable()
8408 q.text("vlan_vid = ");
8409 q.text("%#x" % self.vlan_vid)
8410 q.breakable()
8411 q.text('}')
8412
8413bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8414
8415class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8416 version = 5
8417 type = 19
8418 stats_type = 65535
8419 experimenter = 6035143
8420 subtype = 15
8421
8422 def __init__(self, xid=None, flags=None, entries=None):
8423 if xid != None:
8424 self.xid = xid
8425 else:
8426 self.xid = None
8427 if flags != None:
8428 self.flags = flags
8429 else:
8430 self.flags = 0
8431 if entries != None:
8432 self.entries = entries
8433 else:
8434 self.entries = []
8435 return
8436
8437 def pack(self):
8438 packed = []
8439 packed.append(struct.pack("!B", self.version))
8440 packed.append(struct.pack("!B", self.type))
8441 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8442 packed.append(struct.pack("!L", self.xid))
8443 packed.append(struct.pack("!H", self.stats_type))
8444 packed.append(struct.pack("!H", self.flags))
8445 packed.append('\x00' * 4)
8446 packed.append(struct.pack("!L", self.experimenter))
8447 packed.append(struct.pack("!L", self.subtype))
8448 packed.append(loxi.generic_util.pack_list(self.entries))
8449 length = sum([len(x) for x in packed])
8450 packed[2] = struct.pack("!H", length)
8451 return ''.join(packed)
8452
8453 @staticmethod
8454 def unpack(reader):
8455 obj = bsn_vrf_counter_stats_reply()
8456 _version = reader.read("!B")[0]
8457 assert(_version == 5)
8458 _type = reader.read("!B")[0]
8459 assert(_type == 19)
8460 _length = reader.read("!H")[0]
8461 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008462 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008463 obj.xid = reader.read("!L")[0]
8464 _stats_type = reader.read("!H")[0]
8465 assert(_stats_type == 65535)
8466 obj.flags = reader.read("!H")[0]
8467 reader.skip(4)
8468 _experimenter = reader.read("!L")[0]
8469 assert(_experimenter == 6035143)
8470 _subtype = reader.read("!L")[0]
8471 assert(_subtype == 15)
8472 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8473 return obj
8474
8475 def __eq__(self, other):
8476 if type(self) != type(other): return False
8477 if self.xid != other.xid: return False
8478 if self.flags != other.flags: return False
8479 if self.entries != other.entries: return False
8480 return True
8481
8482 def pretty_print(self, q):
8483 q.text("bsn_vrf_counter_stats_reply {")
8484 with q.group():
8485 with q.indent(2):
8486 q.breakable()
8487 q.text("xid = ");
8488 if self.xid != None:
8489 q.text("%#x" % self.xid)
8490 else:
8491 q.text('None')
8492 q.text(","); q.breakable()
8493 q.text("flags = ");
8494 q.text("%#x" % self.flags)
8495 q.text(","); q.breakable()
8496 q.text("entries = ");
8497 q.pp(self.entries)
8498 q.breakable()
8499 q.text('}')
8500
8501bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8502
8503class bsn_vrf_counter_stats_request(bsn_stats_request):
8504 version = 5
8505 type = 18
8506 stats_type = 65535
8507 experimenter = 6035143
8508 subtype = 15
8509
8510 def __init__(self, xid=None, flags=None, vrf=None):
8511 if xid != None:
8512 self.xid = xid
8513 else:
8514 self.xid = None
8515 if flags != None:
8516 self.flags = flags
8517 else:
8518 self.flags = 0
8519 if vrf != None:
8520 self.vrf = vrf
8521 else:
8522 self.vrf = 0
8523 return
8524
8525 def pack(self):
8526 packed = []
8527 packed.append(struct.pack("!B", self.version))
8528 packed.append(struct.pack("!B", self.type))
8529 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8530 packed.append(struct.pack("!L", self.xid))
8531 packed.append(struct.pack("!H", self.stats_type))
8532 packed.append(struct.pack("!H", self.flags))
8533 packed.append('\x00' * 4)
8534 packed.append(struct.pack("!L", self.experimenter))
8535 packed.append(struct.pack("!L", self.subtype))
8536 packed.append(struct.pack("!L", self.vrf))
8537 length = sum([len(x) for x in packed])
8538 packed[2] = struct.pack("!H", length)
8539 return ''.join(packed)
8540
8541 @staticmethod
8542 def unpack(reader):
8543 obj = bsn_vrf_counter_stats_request()
8544 _version = reader.read("!B")[0]
8545 assert(_version == 5)
8546 _type = reader.read("!B")[0]
8547 assert(_type == 18)
8548 _length = reader.read("!H")[0]
8549 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008550 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008551 obj.xid = reader.read("!L")[0]
8552 _stats_type = reader.read("!H")[0]
8553 assert(_stats_type == 65535)
8554 obj.flags = reader.read("!H")[0]
8555 reader.skip(4)
8556 _experimenter = reader.read("!L")[0]
8557 assert(_experimenter == 6035143)
8558 _subtype = reader.read("!L")[0]
8559 assert(_subtype == 15)
8560 obj.vrf = reader.read("!L")[0]
8561 return obj
8562
8563 def __eq__(self, other):
8564 if type(self) != type(other): return False
8565 if self.xid != other.xid: return False
8566 if self.flags != other.flags: return False
8567 if self.vrf != other.vrf: return False
8568 return True
8569
8570 def pretty_print(self, q):
8571 q.text("bsn_vrf_counter_stats_request {")
8572 with q.group():
8573 with q.indent(2):
8574 q.breakable()
8575 q.text("xid = ");
8576 if self.xid != None:
8577 q.text("%#x" % self.xid)
8578 else:
8579 q.text('None')
8580 q.text(","); q.breakable()
8581 q.text("flags = ");
8582 q.text("%#x" % self.flags)
8583 q.text(","); q.breakable()
8584 q.text("vrf = ");
8585 q.text("%#x" % self.vrf)
8586 q.breakable()
8587 q.text('}')
8588
8589bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8590
Rich Lane2e079da2014-10-29 15:30:24 -07008591class bundle_add_msg(message):
8592 version = 5
8593 type = 34
8594
8595 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
8596 if xid != None:
8597 self.xid = xid
8598 else:
8599 self.xid = None
8600 if bundle_id != None:
8601 self.bundle_id = bundle_id
8602 else:
8603 self.bundle_id = 0
8604 if flags != None:
8605 self.flags = flags
8606 else:
8607 self.flags = 0
8608 if data != None:
8609 self.data = data
8610 else:
8611 self.data = ''
8612 return
8613
8614 def pack(self):
8615 packed = []
8616 packed.append(struct.pack("!B", self.version))
8617 packed.append(struct.pack("!B", self.type))
8618 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8619 packed.append(struct.pack("!L", self.xid))
8620 packed.append(struct.pack("!L", self.bundle_id))
8621 packed.append('\x00' * 2)
8622 packed.append(struct.pack("!H", self.flags))
8623 packed.append(self.data)
8624 length = sum([len(x) for x in packed])
8625 packed[2] = struct.pack("!H", length)
8626 return ''.join(packed)
8627
8628 @staticmethod
8629 def unpack(reader):
8630 obj = bundle_add_msg()
8631 _version = reader.read("!B")[0]
8632 assert(_version == 5)
8633 _type = reader.read("!B")[0]
8634 assert(_type == 34)
8635 _length = reader.read("!H")[0]
8636 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008637 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008638 obj.xid = reader.read("!L")[0]
8639 obj.bundle_id = reader.read("!L")[0]
8640 reader.skip(2)
8641 obj.flags = reader.read("!H")[0]
8642 obj.data = str(reader.read_all())
8643 return obj
8644
8645 def __eq__(self, other):
8646 if type(self) != type(other): return False
8647 if self.xid != other.xid: return False
8648 if self.bundle_id != other.bundle_id: return False
8649 if self.flags != other.flags: return False
8650 if self.data != other.data: return False
8651 return True
8652
8653 def pretty_print(self, q):
8654 q.text("bundle_add_msg {")
8655 with q.group():
8656 with q.indent(2):
8657 q.breakable()
8658 q.text("xid = ");
8659 if self.xid != None:
8660 q.text("%#x" % self.xid)
8661 else:
8662 q.text('None')
8663 q.text(","); q.breakable()
8664 q.text("bundle_id = ");
8665 q.text("%#x" % self.bundle_id)
8666 q.text(","); q.breakable()
8667 q.text("flags = ");
8668 q.text("%#x" % self.flags)
8669 q.text(","); q.breakable()
8670 q.text("data = ");
8671 q.pp(self.data)
8672 q.breakable()
8673 q.text('}')
8674
8675message.subtypes[34] = bundle_add_msg
8676
8677class bundle_ctrl_msg(message):
8678 version = 5
8679 type = 33
8680
8681 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
8682 if xid != None:
8683 self.xid = xid
8684 else:
8685 self.xid = None
8686 if bundle_id != None:
8687 self.bundle_id = bundle_id
8688 else:
8689 self.bundle_id = 0
8690 if bundle_ctrl_type != None:
8691 self.bundle_ctrl_type = bundle_ctrl_type
8692 else:
8693 self.bundle_ctrl_type = 0
8694 if flags != None:
8695 self.flags = flags
8696 else:
8697 self.flags = 0
8698 if properties != None:
8699 self.properties = properties
8700 else:
8701 self.properties = []
8702 return
8703
8704 def pack(self):
8705 packed = []
8706 packed.append(struct.pack("!B", self.version))
8707 packed.append(struct.pack("!B", self.type))
8708 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8709 packed.append(struct.pack("!L", self.xid))
8710 packed.append(struct.pack("!L", self.bundle_id))
8711 packed.append(struct.pack("!H", self.bundle_ctrl_type))
8712 packed.append(struct.pack("!H", self.flags))
8713 packed.append(loxi.generic_util.pack_list(self.properties))
8714 length = sum([len(x) for x in packed])
8715 packed[2] = struct.pack("!H", length)
8716 return ''.join(packed)
8717
8718 @staticmethod
8719 def unpack(reader):
8720 obj = bundle_ctrl_msg()
8721 _version = reader.read("!B")[0]
8722 assert(_version == 5)
8723 _type = reader.read("!B")[0]
8724 assert(_type == 33)
8725 _length = reader.read("!H")[0]
8726 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008727 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008728 obj.xid = reader.read("!L")[0]
8729 obj.bundle_id = reader.read("!L")[0]
8730 obj.bundle_ctrl_type = reader.read("!H")[0]
8731 obj.flags = reader.read("!H")[0]
8732 obj.properties = loxi.generic_util.unpack_list(reader, bundle_prop.bundle_prop.unpack)
8733 return obj
8734
8735 def __eq__(self, other):
8736 if type(self) != type(other): return False
8737 if self.xid != other.xid: return False
8738 if self.bundle_id != other.bundle_id: return False
8739 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
8740 if self.flags != other.flags: return False
8741 if self.properties != other.properties: return False
8742 return True
8743
8744 def pretty_print(self, q):
8745 q.text("bundle_ctrl_msg {")
8746 with q.group():
8747 with q.indent(2):
8748 q.breakable()
8749 q.text("xid = ");
8750 if self.xid != None:
8751 q.text("%#x" % self.xid)
8752 else:
8753 q.text('None')
8754 q.text(","); q.breakable()
8755 q.text("bundle_id = ");
8756 q.text("%#x" % self.bundle_id)
8757 q.text(","); q.breakable()
8758 q.text("bundle_ctrl_type = ");
8759 q.text("%#x" % self.bundle_ctrl_type)
8760 q.text(","); q.breakable()
8761 q.text("flags = ");
8762 q.text("%#x" % self.flags)
8763 q.text(","); q.breakable()
8764 q.text("properties = ");
8765 q.pp(self.properties)
8766 q.breakable()
8767 q.text('}')
8768
8769message.subtypes[33] = bundle_ctrl_msg
8770
Rich Laneccd32ed2014-11-10 17:48:24 -08008771class bundle_failed_error_msg(error_msg):
8772 version = 5
8773 type = 1
8774 err_type = 17
8775
8776 def __init__(self, xid=None, code=None, data=None):
8777 if xid != None:
8778 self.xid = xid
8779 else:
8780 self.xid = None
8781 if code != None:
8782 self.code = code
8783 else:
8784 self.code = 0
8785 if data != None:
8786 self.data = data
8787 else:
8788 self.data = ''
8789 return
8790
8791 def pack(self):
8792 packed = []
8793 packed.append(struct.pack("!B", self.version))
8794 packed.append(struct.pack("!B", self.type))
8795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8796 packed.append(struct.pack("!L", self.xid))
8797 packed.append(struct.pack("!H", self.err_type))
8798 packed.append(struct.pack("!H", self.code))
8799 packed.append(self.data)
8800 length = sum([len(x) for x in packed])
8801 packed[2] = struct.pack("!H", length)
8802 return ''.join(packed)
8803
8804 @staticmethod
8805 def unpack(reader):
8806 obj = bundle_failed_error_msg()
8807 _version = reader.read("!B")[0]
8808 assert(_version == 5)
8809 _type = reader.read("!B")[0]
8810 assert(_type == 1)
8811 _length = reader.read("!H")[0]
8812 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008813 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008814 obj.xid = reader.read("!L")[0]
8815 _err_type = reader.read("!H")[0]
8816 assert(_err_type == 17)
8817 obj.code = reader.read("!H")[0]
8818 obj.data = str(reader.read_all())
8819 return obj
8820
8821 def __eq__(self, other):
8822 if type(self) != type(other): return False
8823 if self.xid != other.xid: return False
8824 if self.code != other.code: return False
8825 if self.data != other.data: return False
8826 return True
8827
8828 def pretty_print(self, q):
8829 q.text("bundle_failed_error_msg {")
8830 with q.group():
8831 with q.indent(2):
8832 q.breakable()
8833 q.text("xid = ");
8834 if self.xid != None:
8835 q.text("%#x" % self.xid)
8836 else:
8837 q.text('None')
8838 q.text(","); q.breakable()
8839 q.text("code = ");
8840 q.text("%#x" % self.code)
8841 q.text(","); q.breakable()
8842 q.text("data = ");
8843 q.pp(self.data)
8844 q.breakable()
8845 q.text('}')
8846
8847error_msg.subtypes[17] = bundle_failed_error_msg
8848
Rich Lane2e079da2014-10-29 15:30:24 -07008849class desc_stats_reply(stats_reply):
8850 version = 5
8851 type = 19
8852 stats_type = 0
8853
8854 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
8855 if xid != None:
8856 self.xid = xid
8857 else:
8858 self.xid = None
8859 if flags != None:
8860 self.flags = flags
8861 else:
8862 self.flags = 0
8863 if mfr_desc != None:
8864 self.mfr_desc = mfr_desc
8865 else:
8866 self.mfr_desc = ""
8867 if hw_desc != None:
8868 self.hw_desc = hw_desc
8869 else:
8870 self.hw_desc = ""
8871 if sw_desc != None:
8872 self.sw_desc = sw_desc
8873 else:
8874 self.sw_desc = ""
8875 if serial_num != None:
8876 self.serial_num = serial_num
8877 else:
8878 self.serial_num = ""
8879 if dp_desc != None:
8880 self.dp_desc = dp_desc
8881 else:
8882 self.dp_desc = ""
8883 return
8884
8885 def pack(self):
8886 packed = []
8887 packed.append(struct.pack("!B", self.version))
8888 packed.append(struct.pack("!B", self.type))
8889 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8890 packed.append(struct.pack("!L", self.xid))
8891 packed.append(struct.pack("!H", self.stats_type))
8892 packed.append(struct.pack("!H", self.flags))
8893 packed.append('\x00' * 4)
8894 packed.append(struct.pack("!256s", self.mfr_desc))
8895 packed.append(struct.pack("!256s", self.hw_desc))
8896 packed.append(struct.pack("!256s", self.sw_desc))
8897 packed.append(struct.pack("!32s", self.serial_num))
8898 packed.append(struct.pack("!256s", self.dp_desc))
8899 length = sum([len(x) for x in packed])
8900 packed[2] = struct.pack("!H", length)
8901 return ''.join(packed)
8902
8903 @staticmethod
8904 def unpack(reader):
8905 obj = desc_stats_reply()
8906 _version = reader.read("!B")[0]
8907 assert(_version == 5)
8908 _type = reader.read("!B")[0]
8909 assert(_type == 19)
8910 _length = reader.read("!H")[0]
8911 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008912 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008913 obj.xid = reader.read("!L")[0]
8914 _stats_type = reader.read("!H")[0]
8915 assert(_stats_type == 0)
8916 obj.flags = reader.read("!H")[0]
8917 reader.skip(4)
8918 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
8919 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
8920 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
8921 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
8922 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
8923 return obj
8924
8925 def __eq__(self, other):
8926 if type(self) != type(other): return False
8927 if self.xid != other.xid: return False
8928 if self.flags != other.flags: return False
8929 if self.mfr_desc != other.mfr_desc: return False
8930 if self.hw_desc != other.hw_desc: return False
8931 if self.sw_desc != other.sw_desc: return False
8932 if self.serial_num != other.serial_num: return False
8933 if self.dp_desc != other.dp_desc: return False
8934 return True
8935
8936 def pretty_print(self, q):
8937 q.text("desc_stats_reply {")
8938 with q.group():
8939 with q.indent(2):
8940 q.breakable()
8941 q.text("xid = ");
8942 if self.xid != None:
8943 q.text("%#x" % self.xid)
8944 else:
8945 q.text('None')
8946 q.text(","); q.breakable()
8947 q.text("flags = ");
8948 q.text("%#x" % self.flags)
8949 q.text(","); q.breakable()
8950 q.text("mfr_desc = ");
8951 q.pp(self.mfr_desc)
8952 q.text(","); q.breakable()
8953 q.text("hw_desc = ");
8954 q.pp(self.hw_desc)
8955 q.text(","); q.breakable()
8956 q.text("sw_desc = ");
8957 q.pp(self.sw_desc)
8958 q.text(","); q.breakable()
8959 q.text("serial_num = ");
8960 q.pp(self.serial_num)
8961 q.text(","); q.breakable()
8962 q.text("dp_desc = ");
8963 q.pp(self.dp_desc)
8964 q.breakable()
8965 q.text('}')
8966
8967stats_reply.subtypes[0] = desc_stats_reply
8968
8969class desc_stats_request(stats_request):
8970 version = 5
8971 type = 18
8972 stats_type = 0
8973
8974 def __init__(self, xid=None, flags=None):
8975 if xid != None:
8976 self.xid = xid
8977 else:
8978 self.xid = None
8979 if flags != None:
8980 self.flags = flags
8981 else:
8982 self.flags = 0
8983 return
8984
8985 def pack(self):
8986 packed = []
8987 packed.append(struct.pack("!B", self.version))
8988 packed.append(struct.pack("!B", self.type))
8989 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8990 packed.append(struct.pack("!L", self.xid))
8991 packed.append(struct.pack("!H", self.stats_type))
8992 packed.append(struct.pack("!H", self.flags))
8993 packed.append('\x00' * 4)
8994 length = sum([len(x) for x in packed])
8995 packed[2] = struct.pack("!H", length)
8996 return ''.join(packed)
8997
8998 @staticmethod
8999 def unpack(reader):
9000 obj = desc_stats_request()
9001 _version = reader.read("!B")[0]
9002 assert(_version == 5)
9003 _type = reader.read("!B")[0]
9004 assert(_type == 18)
9005 _length = reader.read("!H")[0]
9006 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009007 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009008 obj.xid = reader.read("!L")[0]
9009 _stats_type = reader.read("!H")[0]
9010 assert(_stats_type == 0)
9011 obj.flags = reader.read("!H")[0]
9012 reader.skip(4)
9013 return obj
9014
9015 def __eq__(self, other):
9016 if type(self) != type(other): return False
9017 if self.xid != other.xid: return False
9018 if self.flags != other.flags: return False
9019 return True
9020
9021 def pretty_print(self, q):
9022 q.text("desc_stats_request {")
9023 with q.group():
9024 with q.indent(2):
9025 q.breakable()
9026 q.text("xid = ");
9027 if self.xid != None:
9028 q.text("%#x" % self.xid)
9029 else:
9030 q.text('None')
9031 q.text(","); q.breakable()
9032 q.text("flags = ");
9033 q.text("%#x" % self.flags)
9034 q.breakable()
9035 q.text('}')
9036
9037stats_request.subtypes[0] = desc_stats_request
9038
9039class echo_reply(message):
9040 version = 5
9041 type = 3
9042
9043 def __init__(self, xid=None, data=None):
9044 if xid != None:
9045 self.xid = xid
9046 else:
9047 self.xid = None
9048 if data != None:
9049 self.data = data
9050 else:
9051 self.data = ''
9052 return
9053
9054 def pack(self):
9055 packed = []
9056 packed.append(struct.pack("!B", self.version))
9057 packed.append(struct.pack("!B", self.type))
9058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9059 packed.append(struct.pack("!L", self.xid))
9060 packed.append(self.data)
9061 length = sum([len(x) for x in packed])
9062 packed[2] = struct.pack("!H", length)
9063 return ''.join(packed)
9064
9065 @staticmethod
9066 def unpack(reader):
9067 obj = echo_reply()
9068 _version = reader.read("!B")[0]
9069 assert(_version == 5)
9070 _type = reader.read("!B")[0]
9071 assert(_type == 3)
9072 _length = reader.read("!H")[0]
9073 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009074 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009075 obj.xid = reader.read("!L")[0]
9076 obj.data = str(reader.read_all())
9077 return obj
9078
9079 def __eq__(self, other):
9080 if type(self) != type(other): return False
9081 if self.xid != other.xid: return False
9082 if self.data != other.data: return False
9083 return True
9084
9085 def pretty_print(self, q):
9086 q.text("echo_reply {")
9087 with q.group():
9088 with q.indent(2):
9089 q.breakable()
9090 q.text("xid = ");
9091 if self.xid != None:
9092 q.text("%#x" % self.xid)
9093 else:
9094 q.text('None')
9095 q.text(","); q.breakable()
9096 q.text("data = ");
9097 q.pp(self.data)
9098 q.breakable()
9099 q.text('}')
9100
9101message.subtypes[3] = echo_reply
9102
9103class echo_request(message):
9104 version = 5
9105 type = 2
9106
9107 def __init__(self, xid=None, data=None):
9108 if xid != None:
9109 self.xid = xid
9110 else:
9111 self.xid = None
9112 if data != None:
9113 self.data = data
9114 else:
9115 self.data = ''
9116 return
9117
9118 def pack(self):
9119 packed = []
9120 packed.append(struct.pack("!B", self.version))
9121 packed.append(struct.pack("!B", self.type))
9122 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9123 packed.append(struct.pack("!L", self.xid))
9124 packed.append(self.data)
9125 length = sum([len(x) for x in packed])
9126 packed[2] = struct.pack("!H", length)
9127 return ''.join(packed)
9128
9129 @staticmethod
9130 def unpack(reader):
9131 obj = echo_request()
9132 _version = reader.read("!B")[0]
9133 assert(_version == 5)
9134 _type = reader.read("!B")[0]
9135 assert(_type == 2)
9136 _length = reader.read("!H")[0]
9137 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009138 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009139 obj.xid = reader.read("!L")[0]
9140 obj.data = str(reader.read_all())
9141 return obj
9142
9143 def __eq__(self, other):
9144 if type(self) != type(other): return False
9145 if self.xid != other.xid: return False
9146 if self.data != other.data: return False
9147 return True
9148
9149 def pretty_print(self, q):
9150 q.text("echo_request {")
9151 with q.group():
9152 with q.indent(2):
9153 q.breakable()
9154 q.text("xid = ");
9155 if self.xid != None:
9156 q.text("%#x" % self.xid)
9157 else:
9158 q.text('None')
9159 q.text(","); q.breakable()
9160 q.text("data = ");
9161 q.pp(self.data)
9162 q.breakable()
9163 q.text('}')
9164
9165message.subtypes[2] = echo_request
9166
9167class experimenter_error_msg(error_msg):
9168 version = 5
9169 type = 1
9170 err_type = 65535
9171
9172 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
9173 if xid != None:
9174 self.xid = xid
9175 else:
9176 self.xid = None
9177 if subtype != None:
9178 self.subtype = subtype
9179 else:
9180 self.subtype = 0
9181 if experimenter != None:
9182 self.experimenter = experimenter
9183 else:
9184 self.experimenter = 0
9185 if data != None:
9186 self.data = data
9187 else:
9188 self.data = ''
9189 return
9190
9191 def pack(self):
9192 packed = []
9193 packed.append(struct.pack("!B", self.version))
9194 packed.append(struct.pack("!B", self.type))
9195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9196 packed.append(struct.pack("!L", self.xid))
9197 packed.append(struct.pack("!H", self.err_type))
9198 packed.append(struct.pack("!H", self.subtype))
9199 packed.append(struct.pack("!L", self.experimenter))
9200 packed.append(self.data)
9201 length = sum([len(x) for x in packed])
9202 packed[2] = struct.pack("!H", length)
9203 return ''.join(packed)
9204
9205 @staticmethod
9206 def unpack(reader):
9207 obj = experimenter_error_msg()
9208 _version = reader.read("!B")[0]
9209 assert(_version == 5)
9210 _type = reader.read("!B")[0]
9211 assert(_type == 1)
9212 _length = reader.read("!H")[0]
9213 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009214 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009215 obj.xid = reader.read("!L")[0]
9216 _err_type = reader.read("!H")[0]
9217 assert(_err_type == 65535)
9218 obj.subtype = reader.read("!H")[0]
9219 obj.experimenter = reader.read("!L")[0]
9220 obj.data = str(reader.read_all())
9221 return obj
9222
9223 def __eq__(self, other):
9224 if type(self) != type(other): return False
9225 if self.xid != other.xid: return False
9226 if self.subtype != other.subtype: return False
9227 if self.experimenter != other.experimenter: return False
9228 if self.data != other.data: return False
9229 return True
9230
9231 def pretty_print(self, q):
9232 q.text("experimenter_error_msg {")
9233 with q.group():
9234 with q.indent(2):
9235 q.breakable()
9236 q.text("xid = ");
9237 if self.xid != None:
9238 q.text("%#x" % self.xid)
9239 else:
9240 q.text('None')
9241 q.text(","); q.breakable()
9242 q.text("subtype = ");
9243 q.text("%#x" % self.subtype)
9244 q.text(","); q.breakable()
9245 q.text("experimenter = ");
9246 q.text("%#x" % self.experimenter)
9247 q.text(","); q.breakable()
9248 q.text("data = ");
9249 q.pp(self.data)
9250 q.breakable()
9251 q.text('}')
9252
9253error_msg.subtypes[65535] = experimenter_error_msg
9254
9255class features_reply(message):
9256 version = 5
9257 type = 6
9258
9259 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
9260 if xid != None:
9261 self.xid = xid
9262 else:
9263 self.xid = None
9264 if datapath_id != None:
9265 self.datapath_id = datapath_id
9266 else:
9267 self.datapath_id = 0
9268 if n_buffers != None:
9269 self.n_buffers = n_buffers
9270 else:
9271 self.n_buffers = 0
9272 if n_tables != None:
9273 self.n_tables = n_tables
9274 else:
9275 self.n_tables = 0
9276 if auxiliary_id != None:
9277 self.auxiliary_id = auxiliary_id
9278 else:
9279 self.auxiliary_id = 0
9280 if capabilities != None:
9281 self.capabilities = capabilities
9282 else:
9283 self.capabilities = 0
9284 if reserved != None:
9285 self.reserved = reserved
9286 else:
9287 self.reserved = 0
9288 return
9289
9290 def pack(self):
9291 packed = []
9292 packed.append(struct.pack("!B", self.version))
9293 packed.append(struct.pack("!B", self.type))
9294 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9295 packed.append(struct.pack("!L", self.xid))
9296 packed.append(struct.pack("!Q", self.datapath_id))
9297 packed.append(struct.pack("!L", self.n_buffers))
9298 packed.append(struct.pack("!B", self.n_tables))
9299 packed.append(struct.pack("!B", self.auxiliary_id))
9300 packed.append('\x00' * 2)
9301 packed.append(struct.pack("!L", self.capabilities))
9302 packed.append(struct.pack("!L", self.reserved))
9303 length = sum([len(x) for x in packed])
9304 packed[2] = struct.pack("!H", length)
9305 return ''.join(packed)
9306
9307 @staticmethod
9308 def unpack(reader):
9309 obj = features_reply()
9310 _version = reader.read("!B")[0]
9311 assert(_version == 5)
9312 _type = reader.read("!B")[0]
9313 assert(_type == 6)
9314 _length = reader.read("!H")[0]
9315 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009316 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009317 obj.xid = reader.read("!L")[0]
9318 obj.datapath_id = reader.read("!Q")[0]
9319 obj.n_buffers = reader.read("!L")[0]
9320 obj.n_tables = reader.read("!B")[0]
9321 obj.auxiliary_id = reader.read("!B")[0]
9322 reader.skip(2)
9323 obj.capabilities = reader.read("!L")[0]
9324 obj.reserved = reader.read("!L")[0]
9325 return obj
9326
9327 def __eq__(self, other):
9328 if type(self) != type(other): return False
9329 if self.xid != other.xid: return False
9330 if self.datapath_id != other.datapath_id: return False
9331 if self.n_buffers != other.n_buffers: return False
9332 if self.n_tables != other.n_tables: return False
9333 if self.auxiliary_id != other.auxiliary_id: return False
9334 if self.capabilities != other.capabilities: return False
9335 if self.reserved != other.reserved: return False
9336 return True
9337
9338 def pretty_print(self, q):
9339 q.text("features_reply {")
9340 with q.group():
9341 with q.indent(2):
9342 q.breakable()
9343 q.text("xid = ");
9344 if self.xid != None:
9345 q.text("%#x" % self.xid)
9346 else:
9347 q.text('None')
9348 q.text(","); q.breakable()
9349 q.text("datapath_id = ");
9350 q.text("%#x" % self.datapath_id)
9351 q.text(","); q.breakable()
9352 q.text("n_buffers = ");
9353 q.text("%#x" % self.n_buffers)
9354 q.text(","); q.breakable()
9355 q.text("n_tables = ");
9356 q.text("%#x" % self.n_tables)
9357 q.text(","); q.breakable()
9358 q.text("auxiliary_id = ");
9359 q.text("%#x" % self.auxiliary_id)
9360 q.text(","); q.breakable()
9361 q.text("capabilities = ");
9362 q.text("%#x" % self.capabilities)
9363 q.text(","); q.breakable()
9364 q.text("reserved = ");
9365 q.text("%#x" % self.reserved)
9366 q.breakable()
9367 q.text('}')
9368
9369message.subtypes[6] = features_reply
9370
9371class features_request(message):
9372 version = 5
9373 type = 5
9374
9375 def __init__(self, xid=None):
9376 if xid != None:
9377 self.xid = xid
9378 else:
9379 self.xid = None
9380 return
9381
9382 def pack(self):
9383 packed = []
9384 packed.append(struct.pack("!B", self.version))
9385 packed.append(struct.pack("!B", self.type))
9386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9387 packed.append(struct.pack("!L", self.xid))
9388 length = sum([len(x) for x in packed])
9389 packed[2] = struct.pack("!H", length)
9390 return ''.join(packed)
9391
9392 @staticmethod
9393 def unpack(reader):
9394 obj = features_request()
9395 _version = reader.read("!B")[0]
9396 assert(_version == 5)
9397 _type = reader.read("!B")[0]
9398 assert(_type == 5)
9399 _length = reader.read("!H")[0]
9400 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009401 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009402 obj.xid = reader.read("!L")[0]
9403 return obj
9404
9405 def __eq__(self, other):
9406 if type(self) != type(other): return False
9407 if self.xid != other.xid: return False
9408 return True
9409
9410 def pretty_print(self, q):
9411 q.text("features_request {")
9412 with q.group():
9413 with q.indent(2):
9414 q.breakable()
9415 q.text("xid = ");
9416 if self.xid != None:
9417 q.text("%#x" % self.xid)
9418 else:
9419 q.text('None')
9420 q.breakable()
9421 q.text('}')
9422
9423message.subtypes[5] = features_request
9424
9425class flow_mod(message):
9426 subtypes = {}
9427
9428 version = 5
9429 type = 14
9430
9431 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):
9432 if xid != None:
9433 self.xid = xid
9434 else:
9435 self.xid = None
9436 if cookie != None:
9437 self.cookie = cookie
9438 else:
9439 self.cookie = 0
9440 if cookie_mask != None:
9441 self.cookie_mask = cookie_mask
9442 else:
9443 self.cookie_mask = 0
9444 if table_id != None:
9445 self.table_id = table_id
9446 else:
9447 self.table_id = 0
9448 if _command != None:
9449 self._command = _command
9450 else:
9451 self._command = 0
9452 if idle_timeout != None:
9453 self.idle_timeout = idle_timeout
9454 else:
9455 self.idle_timeout = 0
9456 if hard_timeout != None:
9457 self.hard_timeout = hard_timeout
9458 else:
9459 self.hard_timeout = 0
9460 if priority != None:
9461 self.priority = priority
9462 else:
9463 self.priority = 0
9464 if buffer_id != None:
9465 self.buffer_id = buffer_id
9466 else:
9467 self.buffer_id = 0
9468 if out_port != None:
9469 self.out_port = out_port
9470 else:
9471 self.out_port = 0
9472 if out_group != None:
9473 self.out_group = out_group
9474 else:
9475 self.out_group = 0
9476 if flags != None:
9477 self.flags = flags
9478 else:
9479 self.flags = 0
9480 if match != None:
9481 self.match = match
9482 else:
9483 self.match = common.match()
9484 if instructions != None:
9485 self.instructions = instructions
9486 else:
9487 self.instructions = []
9488 return
9489
9490 def pack(self):
9491 packed = []
9492 packed.append(struct.pack("!B", self.version))
9493 packed.append(struct.pack("!B", self.type))
9494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9495 packed.append(struct.pack("!L", self.xid))
9496 packed.append(struct.pack("!Q", self.cookie))
9497 packed.append(struct.pack("!Q", self.cookie_mask))
9498 packed.append(struct.pack("!B", self.table_id))
9499 packed.append(util.pack_fm_cmd(self._command))
9500 packed.append(struct.pack("!H", self.idle_timeout))
9501 packed.append(struct.pack("!H", self.hard_timeout))
9502 packed.append(struct.pack("!H", self.priority))
9503 packed.append(struct.pack("!L", self.buffer_id))
9504 packed.append(util.pack_port_no(self.out_port))
9505 packed.append(struct.pack("!L", self.out_group))
9506 packed.append(struct.pack("!H", self.flags))
9507 packed.append('\x00' * 2)
9508 packed.append(self.match.pack())
9509 packed.append(loxi.generic_util.pack_list(self.instructions))
9510 length = sum([len(x) for x in packed])
9511 packed[2] = struct.pack("!H", length)
9512 return ''.join(packed)
9513
9514 @staticmethod
9515 def unpack(reader):
9516 subtype, = reader.peek('B', 25)
9517 subclass = flow_mod.subtypes.get(subtype)
9518 if subclass:
9519 return subclass.unpack(reader)
9520
9521 obj = flow_mod()
9522 _version = reader.read("!B")[0]
9523 assert(_version == 5)
9524 _type = reader.read("!B")[0]
9525 assert(_type == 14)
9526 _length = reader.read("!H")[0]
9527 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009528 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009529 obj.xid = reader.read("!L")[0]
9530 obj.cookie = reader.read("!Q")[0]
9531 obj.cookie_mask = reader.read("!Q")[0]
9532 obj.table_id = reader.read("!B")[0]
9533 obj._command = util.unpack_fm_cmd(reader)
9534 obj.idle_timeout = reader.read("!H")[0]
9535 obj.hard_timeout = reader.read("!H")[0]
9536 obj.priority = reader.read("!H")[0]
9537 obj.buffer_id = reader.read("!L")[0]
9538 obj.out_port = util.unpack_port_no(reader)
9539 obj.out_group = reader.read("!L")[0]
9540 obj.flags = reader.read("!H")[0]
9541 reader.skip(2)
9542 obj.match = common.match.unpack(reader)
9543 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9544 return obj
9545
9546 def __eq__(self, other):
9547 if type(self) != type(other): return False
9548 if self.xid != other.xid: return False
9549 if self.cookie != other.cookie: return False
9550 if self.cookie_mask != other.cookie_mask: return False
9551 if self.table_id != other.table_id: return False
9552 if self._command != other._command: return False
9553 if self.idle_timeout != other.idle_timeout: return False
9554 if self.hard_timeout != other.hard_timeout: return False
9555 if self.priority != other.priority: return False
9556 if self.buffer_id != other.buffer_id: return False
9557 if self.out_port != other.out_port: return False
9558 if self.out_group != other.out_group: return False
9559 if self.flags != other.flags: return False
9560 if self.match != other.match: return False
9561 if self.instructions != other.instructions: return False
9562 return True
9563
9564 def pretty_print(self, q):
9565 q.text("flow_mod {")
9566 with q.group():
9567 with q.indent(2):
9568 q.breakable()
9569 q.text("xid = ");
9570 if self.xid != None:
9571 q.text("%#x" % self.xid)
9572 else:
9573 q.text('None')
9574 q.text(","); q.breakable()
9575 q.text("cookie = ");
9576 q.text("%#x" % self.cookie)
9577 q.text(","); q.breakable()
9578 q.text("cookie_mask = ");
9579 q.text("%#x" % self.cookie_mask)
9580 q.text(","); q.breakable()
9581 q.text("table_id = ");
9582 q.text("%#x" % self.table_id)
9583 q.text(","); q.breakable()
9584 q.text("idle_timeout = ");
9585 q.text("%#x" % self.idle_timeout)
9586 q.text(","); q.breakable()
9587 q.text("hard_timeout = ");
9588 q.text("%#x" % self.hard_timeout)
9589 q.text(","); q.breakable()
9590 q.text("priority = ");
9591 q.text("%#x" % self.priority)
9592 q.text(","); q.breakable()
9593 q.text("buffer_id = ");
9594 q.text("%#x" % self.buffer_id)
9595 q.text(","); q.breakable()
9596 q.text("out_port = ");
9597 q.text(util.pretty_port(self.out_port))
9598 q.text(","); q.breakable()
9599 q.text("out_group = ");
9600 q.text("%#x" % self.out_group)
9601 q.text(","); q.breakable()
9602 q.text("flags = ");
9603 q.text("%#x" % self.flags)
9604 q.text(","); q.breakable()
9605 q.text("match = ");
9606 q.pp(self.match)
9607 q.text(","); q.breakable()
9608 q.text("instructions = ");
9609 q.pp(self.instructions)
9610 q.breakable()
9611 q.text('}')
9612
9613message.subtypes[14] = flow_mod
9614
9615class flow_add(flow_mod):
9616 version = 5
9617 type = 14
9618 _command = 0
9619
9620 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):
9621 if xid != None:
9622 self.xid = xid
9623 else:
9624 self.xid = None
9625 if cookie != None:
9626 self.cookie = cookie
9627 else:
9628 self.cookie = 0
9629 if cookie_mask != None:
9630 self.cookie_mask = cookie_mask
9631 else:
9632 self.cookie_mask = 0
9633 if table_id != None:
9634 self.table_id = table_id
9635 else:
9636 self.table_id = 0
9637 if idle_timeout != None:
9638 self.idle_timeout = idle_timeout
9639 else:
9640 self.idle_timeout = 0
9641 if hard_timeout != None:
9642 self.hard_timeout = hard_timeout
9643 else:
9644 self.hard_timeout = 0
9645 if priority != None:
9646 self.priority = priority
9647 else:
9648 self.priority = 0
9649 if buffer_id != None:
9650 self.buffer_id = buffer_id
9651 else:
9652 self.buffer_id = 0
9653 if out_port != None:
9654 self.out_port = out_port
9655 else:
9656 self.out_port = 0
9657 if out_group != None:
9658 self.out_group = out_group
9659 else:
9660 self.out_group = 0
9661 if flags != None:
9662 self.flags = flags
9663 else:
9664 self.flags = 0
9665 if importance != None:
9666 self.importance = importance
9667 else:
9668 self.importance = 0
9669 if match != None:
9670 self.match = match
9671 else:
9672 self.match = common.match()
9673 if instructions != None:
9674 self.instructions = instructions
9675 else:
9676 self.instructions = []
9677 return
9678
9679 def pack(self):
9680 packed = []
9681 packed.append(struct.pack("!B", self.version))
9682 packed.append(struct.pack("!B", self.type))
9683 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9684 packed.append(struct.pack("!L", self.xid))
9685 packed.append(struct.pack("!Q", self.cookie))
9686 packed.append(struct.pack("!Q", self.cookie_mask))
9687 packed.append(struct.pack("!B", self.table_id))
9688 packed.append(util.pack_fm_cmd(self._command))
9689 packed.append(struct.pack("!H", self.idle_timeout))
9690 packed.append(struct.pack("!H", self.hard_timeout))
9691 packed.append(struct.pack("!H", self.priority))
9692 packed.append(struct.pack("!L", self.buffer_id))
9693 packed.append(util.pack_port_no(self.out_port))
9694 packed.append(struct.pack("!L", self.out_group))
9695 packed.append(struct.pack("!H", self.flags))
9696 packed.append(struct.pack("!H", self.importance))
9697 packed.append(self.match.pack())
9698 packed.append(loxi.generic_util.pack_list(self.instructions))
9699 length = sum([len(x) for x in packed])
9700 packed[2] = struct.pack("!H", length)
9701 return ''.join(packed)
9702
9703 @staticmethod
9704 def unpack(reader):
9705 obj = flow_add()
9706 _version = reader.read("!B")[0]
9707 assert(_version == 5)
9708 _type = reader.read("!B")[0]
9709 assert(_type == 14)
9710 _length = reader.read("!H")[0]
9711 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009712 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009713 obj.xid = reader.read("!L")[0]
9714 obj.cookie = reader.read("!Q")[0]
9715 obj.cookie_mask = reader.read("!Q")[0]
9716 obj.table_id = reader.read("!B")[0]
9717 __command = util.unpack_fm_cmd(reader)
9718 assert(__command == 0)
9719 obj.idle_timeout = reader.read("!H")[0]
9720 obj.hard_timeout = reader.read("!H")[0]
9721 obj.priority = reader.read("!H")[0]
9722 obj.buffer_id = reader.read("!L")[0]
9723 obj.out_port = util.unpack_port_no(reader)
9724 obj.out_group = reader.read("!L")[0]
9725 obj.flags = reader.read("!H")[0]
9726 obj.importance = reader.read("!H")[0]
9727 obj.match = common.match.unpack(reader)
9728 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9729 return obj
9730
9731 def __eq__(self, other):
9732 if type(self) != type(other): return False
9733 if self.xid != other.xid: return False
9734 if self.cookie != other.cookie: return False
9735 if self.cookie_mask != other.cookie_mask: return False
9736 if self.table_id != other.table_id: return False
9737 if self.idle_timeout != other.idle_timeout: return False
9738 if self.hard_timeout != other.hard_timeout: return False
9739 if self.priority != other.priority: return False
9740 if self.buffer_id != other.buffer_id: return False
9741 if self.out_port != other.out_port: return False
9742 if self.out_group != other.out_group: return False
9743 if self.flags != other.flags: return False
9744 if self.importance != other.importance: return False
9745 if self.match != other.match: return False
9746 if self.instructions != other.instructions: return False
9747 return True
9748
9749 def pretty_print(self, q):
9750 q.text("flow_add {")
9751 with q.group():
9752 with q.indent(2):
9753 q.breakable()
9754 q.text("xid = ");
9755 if self.xid != None:
9756 q.text("%#x" % self.xid)
9757 else:
9758 q.text('None')
9759 q.text(","); q.breakable()
9760 q.text("cookie = ");
9761 q.text("%#x" % self.cookie)
9762 q.text(","); q.breakable()
9763 q.text("cookie_mask = ");
9764 q.text("%#x" % self.cookie_mask)
9765 q.text(","); q.breakable()
9766 q.text("table_id = ");
9767 q.text("%#x" % self.table_id)
9768 q.text(","); q.breakable()
9769 q.text("idle_timeout = ");
9770 q.text("%#x" % self.idle_timeout)
9771 q.text(","); q.breakable()
9772 q.text("hard_timeout = ");
9773 q.text("%#x" % self.hard_timeout)
9774 q.text(","); q.breakable()
9775 q.text("priority = ");
9776 q.text("%#x" % self.priority)
9777 q.text(","); q.breakable()
9778 q.text("buffer_id = ");
9779 q.text("%#x" % self.buffer_id)
9780 q.text(","); q.breakable()
9781 q.text("out_port = ");
9782 q.text(util.pretty_port(self.out_port))
9783 q.text(","); q.breakable()
9784 q.text("out_group = ");
9785 q.text("%#x" % self.out_group)
9786 q.text(","); q.breakable()
9787 q.text("flags = ");
9788 q.text("%#x" % self.flags)
9789 q.text(","); q.breakable()
9790 q.text("importance = ");
9791 q.text("%#x" % self.importance)
9792 q.text(","); q.breakable()
9793 q.text("match = ");
9794 q.pp(self.match)
9795 q.text(","); q.breakable()
9796 q.text("instructions = ");
9797 q.pp(self.instructions)
9798 q.breakable()
9799 q.text('}')
9800
9801flow_mod.subtypes[0] = flow_add
9802
9803class flow_delete(flow_mod):
9804 version = 5
9805 type = 14
9806 _command = 3
9807
9808 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):
9809 if xid != None:
9810 self.xid = xid
9811 else:
9812 self.xid = None
9813 if cookie != None:
9814 self.cookie = cookie
9815 else:
9816 self.cookie = 0
9817 if cookie_mask != None:
9818 self.cookie_mask = cookie_mask
9819 else:
9820 self.cookie_mask = 0
9821 if table_id != None:
9822 self.table_id = table_id
9823 else:
9824 self.table_id = 0
9825 if idle_timeout != None:
9826 self.idle_timeout = idle_timeout
9827 else:
9828 self.idle_timeout = 0
9829 if hard_timeout != None:
9830 self.hard_timeout = hard_timeout
9831 else:
9832 self.hard_timeout = 0
9833 if priority != None:
9834 self.priority = priority
9835 else:
9836 self.priority = 0
9837 if buffer_id != None:
9838 self.buffer_id = buffer_id
9839 else:
9840 self.buffer_id = 0
9841 if out_port != None:
9842 self.out_port = out_port
9843 else:
9844 self.out_port = 0
9845 if out_group != None:
9846 self.out_group = out_group
9847 else:
9848 self.out_group = 0
9849 if flags != None:
9850 self.flags = flags
9851 else:
9852 self.flags = 0
9853 if importance != None:
9854 self.importance = importance
9855 else:
9856 self.importance = 0
9857 if match != None:
9858 self.match = match
9859 else:
9860 self.match = common.match()
9861 if instructions != None:
9862 self.instructions = instructions
9863 else:
9864 self.instructions = []
9865 return
9866
9867 def pack(self):
9868 packed = []
9869 packed.append(struct.pack("!B", self.version))
9870 packed.append(struct.pack("!B", self.type))
9871 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9872 packed.append(struct.pack("!L", self.xid))
9873 packed.append(struct.pack("!Q", self.cookie))
9874 packed.append(struct.pack("!Q", self.cookie_mask))
9875 packed.append(struct.pack("!B", self.table_id))
9876 packed.append(util.pack_fm_cmd(self._command))
9877 packed.append(struct.pack("!H", self.idle_timeout))
9878 packed.append(struct.pack("!H", self.hard_timeout))
9879 packed.append(struct.pack("!H", self.priority))
9880 packed.append(struct.pack("!L", self.buffer_id))
9881 packed.append(util.pack_port_no(self.out_port))
9882 packed.append(struct.pack("!L", self.out_group))
9883 packed.append(struct.pack("!H", self.flags))
9884 packed.append(struct.pack("!H", self.importance))
9885 packed.append(self.match.pack())
9886 packed.append(loxi.generic_util.pack_list(self.instructions))
9887 length = sum([len(x) for x in packed])
9888 packed[2] = struct.pack("!H", length)
9889 return ''.join(packed)
9890
9891 @staticmethod
9892 def unpack(reader):
9893 obj = flow_delete()
9894 _version = reader.read("!B")[0]
9895 assert(_version == 5)
9896 _type = reader.read("!B")[0]
9897 assert(_type == 14)
9898 _length = reader.read("!H")[0]
9899 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009900 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009901 obj.xid = reader.read("!L")[0]
9902 obj.cookie = reader.read("!Q")[0]
9903 obj.cookie_mask = reader.read("!Q")[0]
9904 obj.table_id = reader.read("!B")[0]
9905 __command = util.unpack_fm_cmd(reader)
9906 assert(__command == 3)
9907 obj.idle_timeout = reader.read("!H")[0]
9908 obj.hard_timeout = reader.read("!H")[0]
9909 obj.priority = reader.read("!H")[0]
9910 obj.buffer_id = reader.read("!L")[0]
9911 obj.out_port = util.unpack_port_no(reader)
9912 obj.out_group = reader.read("!L")[0]
9913 obj.flags = reader.read("!H")[0]
9914 obj.importance = reader.read("!H")[0]
9915 obj.match = common.match.unpack(reader)
9916 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9917 return obj
9918
9919 def __eq__(self, other):
9920 if type(self) != type(other): return False
9921 if self.xid != other.xid: return False
9922 if self.cookie != other.cookie: return False
9923 if self.cookie_mask != other.cookie_mask: return False
9924 if self.table_id != other.table_id: return False
9925 if self.idle_timeout != other.idle_timeout: return False
9926 if self.hard_timeout != other.hard_timeout: return False
9927 if self.priority != other.priority: return False
9928 if self.buffer_id != other.buffer_id: return False
9929 if self.out_port != other.out_port: return False
9930 if self.out_group != other.out_group: return False
9931 if self.flags != other.flags: return False
9932 if self.importance != other.importance: return False
9933 if self.match != other.match: return False
9934 if self.instructions != other.instructions: return False
9935 return True
9936
9937 def pretty_print(self, q):
9938 q.text("flow_delete {")
9939 with q.group():
9940 with q.indent(2):
9941 q.breakable()
9942 q.text("xid = ");
9943 if self.xid != None:
9944 q.text("%#x" % self.xid)
9945 else:
9946 q.text('None')
9947 q.text(","); q.breakable()
9948 q.text("cookie = ");
9949 q.text("%#x" % self.cookie)
9950 q.text(","); q.breakable()
9951 q.text("cookie_mask = ");
9952 q.text("%#x" % self.cookie_mask)
9953 q.text(","); q.breakable()
9954 q.text("table_id = ");
9955 q.text("%#x" % self.table_id)
9956 q.text(","); q.breakable()
9957 q.text("idle_timeout = ");
9958 q.text("%#x" % self.idle_timeout)
9959 q.text(","); q.breakable()
9960 q.text("hard_timeout = ");
9961 q.text("%#x" % self.hard_timeout)
9962 q.text(","); q.breakable()
9963 q.text("priority = ");
9964 q.text("%#x" % self.priority)
9965 q.text(","); q.breakable()
9966 q.text("buffer_id = ");
9967 q.text("%#x" % self.buffer_id)
9968 q.text(","); q.breakable()
9969 q.text("out_port = ");
9970 q.text(util.pretty_port(self.out_port))
9971 q.text(","); q.breakable()
9972 q.text("out_group = ");
9973 q.text("%#x" % self.out_group)
9974 q.text(","); q.breakable()
9975 q.text("flags = ");
9976 q.text("%#x" % self.flags)
9977 q.text(","); q.breakable()
9978 q.text("importance = ");
9979 q.text("%#x" % self.importance)
9980 q.text(","); q.breakable()
9981 q.text("match = ");
9982 q.pp(self.match)
9983 q.text(","); q.breakable()
9984 q.text("instructions = ");
9985 q.pp(self.instructions)
9986 q.breakable()
9987 q.text('}')
9988
9989flow_mod.subtypes[3] = flow_delete
9990
9991class flow_delete_strict(flow_mod):
9992 version = 5
9993 type = 14
9994 _command = 4
9995
9996 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):
9997 if xid != None:
9998 self.xid = xid
9999 else:
10000 self.xid = None
10001 if cookie != None:
10002 self.cookie = cookie
10003 else:
10004 self.cookie = 0
10005 if cookie_mask != None:
10006 self.cookie_mask = cookie_mask
10007 else:
10008 self.cookie_mask = 0
10009 if table_id != None:
10010 self.table_id = table_id
10011 else:
10012 self.table_id = 0
10013 if idle_timeout != None:
10014 self.idle_timeout = idle_timeout
10015 else:
10016 self.idle_timeout = 0
10017 if hard_timeout != None:
10018 self.hard_timeout = hard_timeout
10019 else:
10020 self.hard_timeout = 0
10021 if priority != None:
10022 self.priority = priority
10023 else:
10024 self.priority = 0
10025 if buffer_id != None:
10026 self.buffer_id = buffer_id
10027 else:
10028 self.buffer_id = 0
10029 if out_port != None:
10030 self.out_port = out_port
10031 else:
10032 self.out_port = 0
10033 if out_group != None:
10034 self.out_group = out_group
10035 else:
10036 self.out_group = 0
10037 if flags != None:
10038 self.flags = flags
10039 else:
10040 self.flags = 0
10041 if importance != None:
10042 self.importance = importance
10043 else:
10044 self.importance = 0
10045 if match != None:
10046 self.match = match
10047 else:
10048 self.match = common.match()
10049 if instructions != None:
10050 self.instructions = instructions
10051 else:
10052 self.instructions = []
10053 return
10054
10055 def pack(self):
10056 packed = []
10057 packed.append(struct.pack("!B", self.version))
10058 packed.append(struct.pack("!B", self.type))
10059 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10060 packed.append(struct.pack("!L", self.xid))
10061 packed.append(struct.pack("!Q", self.cookie))
10062 packed.append(struct.pack("!Q", self.cookie_mask))
10063 packed.append(struct.pack("!B", self.table_id))
10064 packed.append(util.pack_fm_cmd(self._command))
10065 packed.append(struct.pack("!H", self.idle_timeout))
10066 packed.append(struct.pack("!H", self.hard_timeout))
10067 packed.append(struct.pack("!H", self.priority))
10068 packed.append(struct.pack("!L", self.buffer_id))
10069 packed.append(util.pack_port_no(self.out_port))
10070 packed.append(struct.pack("!L", self.out_group))
10071 packed.append(struct.pack("!H", self.flags))
10072 packed.append(struct.pack("!H", self.importance))
10073 packed.append(self.match.pack())
10074 packed.append(loxi.generic_util.pack_list(self.instructions))
10075 length = sum([len(x) for x in packed])
10076 packed[2] = struct.pack("!H", length)
10077 return ''.join(packed)
10078
10079 @staticmethod
10080 def unpack(reader):
10081 obj = flow_delete_strict()
10082 _version = reader.read("!B")[0]
10083 assert(_version == 5)
10084 _type = reader.read("!B")[0]
10085 assert(_type == 14)
10086 _length = reader.read("!H")[0]
10087 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010088 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010089 obj.xid = reader.read("!L")[0]
10090 obj.cookie = reader.read("!Q")[0]
10091 obj.cookie_mask = reader.read("!Q")[0]
10092 obj.table_id = reader.read("!B")[0]
10093 __command = util.unpack_fm_cmd(reader)
10094 assert(__command == 4)
10095 obj.idle_timeout = reader.read("!H")[0]
10096 obj.hard_timeout = reader.read("!H")[0]
10097 obj.priority = reader.read("!H")[0]
10098 obj.buffer_id = reader.read("!L")[0]
10099 obj.out_port = util.unpack_port_no(reader)
10100 obj.out_group = reader.read("!L")[0]
10101 obj.flags = reader.read("!H")[0]
10102 obj.importance = reader.read("!H")[0]
10103 obj.match = common.match.unpack(reader)
10104 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10105 return obj
10106
10107 def __eq__(self, other):
10108 if type(self) != type(other): return False
10109 if self.xid != other.xid: return False
10110 if self.cookie != other.cookie: return False
10111 if self.cookie_mask != other.cookie_mask: return False
10112 if self.table_id != other.table_id: return False
10113 if self.idle_timeout != other.idle_timeout: return False
10114 if self.hard_timeout != other.hard_timeout: return False
10115 if self.priority != other.priority: return False
10116 if self.buffer_id != other.buffer_id: return False
10117 if self.out_port != other.out_port: return False
10118 if self.out_group != other.out_group: return False
10119 if self.flags != other.flags: return False
10120 if self.importance != other.importance: return False
10121 if self.match != other.match: return False
10122 if self.instructions != other.instructions: return False
10123 return True
10124
10125 def pretty_print(self, q):
10126 q.text("flow_delete_strict {")
10127 with q.group():
10128 with q.indent(2):
10129 q.breakable()
10130 q.text("xid = ");
10131 if self.xid != None:
10132 q.text("%#x" % self.xid)
10133 else:
10134 q.text('None')
10135 q.text(","); q.breakable()
10136 q.text("cookie = ");
10137 q.text("%#x" % self.cookie)
10138 q.text(","); q.breakable()
10139 q.text("cookie_mask = ");
10140 q.text("%#x" % self.cookie_mask)
10141 q.text(","); q.breakable()
10142 q.text("table_id = ");
10143 q.text("%#x" % self.table_id)
10144 q.text(","); q.breakable()
10145 q.text("idle_timeout = ");
10146 q.text("%#x" % self.idle_timeout)
10147 q.text(","); q.breakable()
10148 q.text("hard_timeout = ");
10149 q.text("%#x" % self.hard_timeout)
10150 q.text(","); q.breakable()
10151 q.text("priority = ");
10152 q.text("%#x" % self.priority)
10153 q.text(","); q.breakable()
10154 q.text("buffer_id = ");
10155 q.text("%#x" % self.buffer_id)
10156 q.text(","); q.breakable()
10157 q.text("out_port = ");
10158 q.text(util.pretty_port(self.out_port))
10159 q.text(","); q.breakable()
10160 q.text("out_group = ");
10161 q.text("%#x" % self.out_group)
10162 q.text(","); q.breakable()
10163 q.text("flags = ");
10164 q.text("%#x" % self.flags)
10165 q.text(","); q.breakable()
10166 q.text("importance = ");
10167 q.text("%#x" % self.importance)
10168 q.text(","); q.breakable()
10169 q.text("match = ");
10170 q.pp(self.match)
10171 q.text(","); q.breakable()
10172 q.text("instructions = ");
10173 q.pp(self.instructions)
10174 q.breakable()
10175 q.text('}')
10176
10177flow_mod.subtypes[4] = flow_delete_strict
10178
10179class flow_mod_failed_error_msg(error_msg):
10180 version = 5
10181 type = 1
10182 err_type = 5
10183
10184 def __init__(self, xid=None, code=None, data=None):
10185 if xid != None:
10186 self.xid = xid
10187 else:
10188 self.xid = None
10189 if code != None:
10190 self.code = code
10191 else:
10192 self.code = 0
10193 if data != None:
10194 self.data = data
10195 else:
10196 self.data = ''
10197 return
10198
10199 def pack(self):
10200 packed = []
10201 packed.append(struct.pack("!B", self.version))
10202 packed.append(struct.pack("!B", self.type))
10203 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10204 packed.append(struct.pack("!L", self.xid))
10205 packed.append(struct.pack("!H", self.err_type))
10206 packed.append(struct.pack("!H", self.code))
10207 packed.append(self.data)
10208 length = sum([len(x) for x in packed])
10209 packed[2] = struct.pack("!H", length)
10210 return ''.join(packed)
10211
10212 @staticmethod
10213 def unpack(reader):
10214 obj = flow_mod_failed_error_msg()
10215 _version = reader.read("!B")[0]
10216 assert(_version == 5)
10217 _type = reader.read("!B")[0]
10218 assert(_type == 1)
10219 _length = reader.read("!H")[0]
10220 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010221 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010222 obj.xid = reader.read("!L")[0]
10223 _err_type = reader.read("!H")[0]
10224 assert(_err_type == 5)
10225 obj.code = reader.read("!H")[0]
10226 obj.data = str(reader.read_all())
10227 return obj
10228
10229 def __eq__(self, other):
10230 if type(self) != type(other): return False
10231 if self.xid != other.xid: return False
10232 if self.code != other.code: return False
10233 if self.data != other.data: return False
10234 return True
10235
10236 def pretty_print(self, q):
10237 q.text("flow_mod_failed_error_msg {")
10238 with q.group():
10239 with q.indent(2):
10240 q.breakable()
10241 q.text("xid = ");
10242 if self.xid != None:
10243 q.text("%#x" % self.xid)
10244 else:
10245 q.text('None')
10246 q.text(","); q.breakable()
10247 q.text("code = ");
10248 q.text("%#x" % self.code)
10249 q.text(","); q.breakable()
10250 q.text("data = ");
10251 q.pp(self.data)
10252 q.breakable()
10253 q.text('}')
10254
10255error_msg.subtypes[5] = flow_mod_failed_error_msg
10256
10257class flow_modify(flow_mod):
10258 version = 5
10259 type = 14
10260 _command = 1
10261
10262 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):
10263 if xid != None:
10264 self.xid = xid
10265 else:
10266 self.xid = None
10267 if cookie != None:
10268 self.cookie = cookie
10269 else:
10270 self.cookie = 0
10271 if cookie_mask != None:
10272 self.cookie_mask = cookie_mask
10273 else:
10274 self.cookie_mask = 0
10275 if table_id != None:
10276 self.table_id = table_id
10277 else:
10278 self.table_id = 0
10279 if idle_timeout != None:
10280 self.idle_timeout = idle_timeout
10281 else:
10282 self.idle_timeout = 0
10283 if hard_timeout != None:
10284 self.hard_timeout = hard_timeout
10285 else:
10286 self.hard_timeout = 0
10287 if priority != None:
10288 self.priority = priority
10289 else:
10290 self.priority = 0
10291 if buffer_id != None:
10292 self.buffer_id = buffer_id
10293 else:
10294 self.buffer_id = 0
10295 if out_port != None:
10296 self.out_port = out_port
10297 else:
10298 self.out_port = 0
10299 if out_group != None:
10300 self.out_group = out_group
10301 else:
10302 self.out_group = 0
10303 if flags != None:
10304 self.flags = flags
10305 else:
10306 self.flags = 0
10307 if importance != None:
10308 self.importance = importance
10309 else:
10310 self.importance = 0
10311 if match != None:
10312 self.match = match
10313 else:
10314 self.match = common.match()
10315 if instructions != None:
10316 self.instructions = instructions
10317 else:
10318 self.instructions = []
10319 return
10320
10321 def pack(self):
10322 packed = []
10323 packed.append(struct.pack("!B", self.version))
10324 packed.append(struct.pack("!B", self.type))
10325 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10326 packed.append(struct.pack("!L", self.xid))
10327 packed.append(struct.pack("!Q", self.cookie))
10328 packed.append(struct.pack("!Q", self.cookie_mask))
10329 packed.append(struct.pack("!B", self.table_id))
10330 packed.append(util.pack_fm_cmd(self._command))
10331 packed.append(struct.pack("!H", self.idle_timeout))
10332 packed.append(struct.pack("!H", self.hard_timeout))
10333 packed.append(struct.pack("!H", self.priority))
10334 packed.append(struct.pack("!L", self.buffer_id))
10335 packed.append(util.pack_port_no(self.out_port))
10336 packed.append(struct.pack("!L", self.out_group))
10337 packed.append(struct.pack("!H", self.flags))
10338 packed.append(struct.pack("!H", self.importance))
10339 packed.append(self.match.pack())
10340 packed.append(loxi.generic_util.pack_list(self.instructions))
10341 length = sum([len(x) for x in packed])
10342 packed[2] = struct.pack("!H", length)
10343 return ''.join(packed)
10344
10345 @staticmethod
10346 def unpack(reader):
10347 obj = flow_modify()
10348 _version = reader.read("!B")[0]
10349 assert(_version == 5)
10350 _type = reader.read("!B")[0]
10351 assert(_type == 14)
10352 _length = reader.read("!H")[0]
10353 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010354 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010355 obj.xid = reader.read("!L")[0]
10356 obj.cookie = reader.read("!Q")[0]
10357 obj.cookie_mask = reader.read("!Q")[0]
10358 obj.table_id = reader.read("!B")[0]
10359 __command = util.unpack_fm_cmd(reader)
10360 assert(__command == 1)
10361 obj.idle_timeout = reader.read("!H")[0]
10362 obj.hard_timeout = reader.read("!H")[0]
10363 obj.priority = reader.read("!H")[0]
10364 obj.buffer_id = reader.read("!L")[0]
10365 obj.out_port = util.unpack_port_no(reader)
10366 obj.out_group = reader.read("!L")[0]
10367 obj.flags = reader.read("!H")[0]
10368 obj.importance = reader.read("!H")[0]
10369 obj.match = common.match.unpack(reader)
10370 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10371 return obj
10372
10373 def __eq__(self, other):
10374 if type(self) != type(other): return False
10375 if self.xid != other.xid: return False
10376 if self.cookie != other.cookie: return False
10377 if self.cookie_mask != other.cookie_mask: return False
10378 if self.table_id != other.table_id: return False
10379 if self.idle_timeout != other.idle_timeout: return False
10380 if self.hard_timeout != other.hard_timeout: return False
10381 if self.priority != other.priority: return False
10382 if self.buffer_id != other.buffer_id: return False
10383 if self.out_port != other.out_port: return False
10384 if self.out_group != other.out_group: return False
10385 if self.flags != other.flags: return False
10386 if self.importance != other.importance: return False
10387 if self.match != other.match: return False
10388 if self.instructions != other.instructions: return False
10389 return True
10390
10391 def pretty_print(self, q):
10392 q.text("flow_modify {")
10393 with q.group():
10394 with q.indent(2):
10395 q.breakable()
10396 q.text("xid = ");
10397 if self.xid != None:
10398 q.text("%#x" % self.xid)
10399 else:
10400 q.text('None')
10401 q.text(","); q.breakable()
10402 q.text("cookie = ");
10403 q.text("%#x" % self.cookie)
10404 q.text(","); q.breakable()
10405 q.text("cookie_mask = ");
10406 q.text("%#x" % self.cookie_mask)
10407 q.text(","); q.breakable()
10408 q.text("table_id = ");
10409 q.text("%#x" % self.table_id)
10410 q.text(","); q.breakable()
10411 q.text("idle_timeout = ");
10412 q.text("%#x" % self.idle_timeout)
10413 q.text(","); q.breakable()
10414 q.text("hard_timeout = ");
10415 q.text("%#x" % self.hard_timeout)
10416 q.text(","); q.breakable()
10417 q.text("priority = ");
10418 q.text("%#x" % self.priority)
10419 q.text(","); q.breakable()
10420 q.text("buffer_id = ");
10421 q.text("%#x" % self.buffer_id)
10422 q.text(","); q.breakable()
10423 q.text("out_port = ");
10424 q.text(util.pretty_port(self.out_port))
10425 q.text(","); q.breakable()
10426 q.text("out_group = ");
10427 q.text("%#x" % self.out_group)
10428 q.text(","); q.breakable()
10429 q.text("flags = ");
10430 q.text("%#x" % self.flags)
10431 q.text(","); q.breakable()
10432 q.text("importance = ");
10433 q.text("%#x" % self.importance)
10434 q.text(","); q.breakable()
10435 q.text("match = ");
10436 q.pp(self.match)
10437 q.text(","); q.breakable()
10438 q.text("instructions = ");
10439 q.pp(self.instructions)
10440 q.breakable()
10441 q.text('}')
10442
10443flow_mod.subtypes[1] = flow_modify
10444
10445class flow_modify_strict(flow_mod):
10446 version = 5
10447 type = 14
10448 _command = 2
10449
10450 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):
10451 if xid != None:
10452 self.xid = xid
10453 else:
10454 self.xid = None
10455 if cookie != None:
10456 self.cookie = cookie
10457 else:
10458 self.cookie = 0
10459 if cookie_mask != None:
10460 self.cookie_mask = cookie_mask
10461 else:
10462 self.cookie_mask = 0
10463 if table_id != None:
10464 self.table_id = table_id
10465 else:
10466 self.table_id = 0
10467 if idle_timeout != None:
10468 self.idle_timeout = idle_timeout
10469 else:
10470 self.idle_timeout = 0
10471 if hard_timeout != None:
10472 self.hard_timeout = hard_timeout
10473 else:
10474 self.hard_timeout = 0
10475 if priority != None:
10476 self.priority = priority
10477 else:
10478 self.priority = 0
10479 if buffer_id != None:
10480 self.buffer_id = buffer_id
10481 else:
10482 self.buffer_id = 0
10483 if out_port != None:
10484 self.out_port = out_port
10485 else:
10486 self.out_port = 0
10487 if out_group != None:
10488 self.out_group = out_group
10489 else:
10490 self.out_group = 0
10491 if flags != None:
10492 self.flags = flags
10493 else:
10494 self.flags = 0
10495 if importance != None:
10496 self.importance = importance
10497 else:
10498 self.importance = 0
10499 if match != None:
10500 self.match = match
10501 else:
10502 self.match = common.match()
10503 if instructions != None:
10504 self.instructions = instructions
10505 else:
10506 self.instructions = []
10507 return
10508
10509 def pack(self):
10510 packed = []
10511 packed.append(struct.pack("!B", self.version))
10512 packed.append(struct.pack("!B", self.type))
10513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10514 packed.append(struct.pack("!L", self.xid))
10515 packed.append(struct.pack("!Q", self.cookie))
10516 packed.append(struct.pack("!Q", self.cookie_mask))
10517 packed.append(struct.pack("!B", self.table_id))
10518 packed.append(util.pack_fm_cmd(self._command))
10519 packed.append(struct.pack("!H", self.idle_timeout))
10520 packed.append(struct.pack("!H", self.hard_timeout))
10521 packed.append(struct.pack("!H", self.priority))
10522 packed.append(struct.pack("!L", self.buffer_id))
10523 packed.append(util.pack_port_no(self.out_port))
10524 packed.append(struct.pack("!L", self.out_group))
10525 packed.append(struct.pack("!H", self.flags))
10526 packed.append(struct.pack("!H", self.importance))
10527 packed.append(self.match.pack())
10528 packed.append(loxi.generic_util.pack_list(self.instructions))
10529 length = sum([len(x) for x in packed])
10530 packed[2] = struct.pack("!H", length)
10531 return ''.join(packed)
10532
10533 @staticmethod
10534 def unpack(reader):
10535 obj = flow_modify_strict()
10536 _version = reader.read("!B")[0]
10537 assert(_version == 5)
10538 _type = reader.read("!B")[0]
10539 assert(_type == 14)
10540 _length = reader.read("!H")[0]
10541 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010542 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010543 obj.xid = reader.read("!L")[0]
10544 obj.cookie = reader.read("!Q")[0]
10545 obj.cookie_mask = reader.read("!Q")[0]
10546 obj.table_id = reader.read("!B")[0]
10547 __command = util.unpack_fm_cmd(reader)
10548 assert(__command == 2)
10549 obj.idle_timeout = reader.read("!H")[0]
10550 obj.hard_timeout = reader.read("!H")[0]
10551 obj.priority = reader.read("!H")[0]
10552 obj.buffer_id = reader.read("!L")[0]
10553 obj.out_port = util.unpack_port_no(reader)
10554 obj.out_group = reader.read("!L")[0]
10555 obj.flags = reader.read("!H")[0]
10556 obj.importance = reader.read("!H")[0]
10557 obj.match = common.match.unpack(reader)
10558 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10559 return obj
10560
10561 def __eq__(self, other):
10562 if type(self) != type(other): return False
10563 if self.xid != other.xid: return False
10564 if self.cookie != other.cookie: return False
10565 if self.cookie_mask != other.cookie_mask: return False
10566 if self.table_id != other.table_id: return False
10567 if self.idle_timeout != other.idle_timeout: return False
10568 if self.hard_timeout != other.hard_timeout: return False
10569 if self.priority != other.priority: return False
10570 if self.buffer_id != other.buffer_id: return False
10571 if self.out_port != other.out_port: return False
10572 if self.out_group != other.out_group: return False
10573 if self.flags != other.flags: return False
10574 if self.importance != other.importance: return False
10575 if self.match != other.match: return False
10576 if self.instructions != other.instructions: return False
10577 return True
10578
10579 def pretty_print(self, q):
10580 q.text("flow_modify_strict {")
10581 with q.group():
10582 with q.indent(2):
10583 q.breakable()
10584 q.text("xid = ");
10585 if self.xid != None:
10586 q.text("%#x" % self.xid)
10587 else:
10588 q.text('None')
10589 q.text(","); q.breakable()
10590 q.text("cookie = ");
10591 q.text("%#x" % self.cookie)
10592 q.text(","); q.breakable()
10593 q.text("cookie_mask = ");
10594 q.text("%#x" % self.cookie_mask)
10595 q.text(","); q.breakable()
10596 q.text("table_id = ");
10597 q.text("%#x" % self.table_id)
10598 q.text(","); q.breakable()
10599 q.text("idle_timeout = ");
10600 q.text("%#x" % self.idle_timeout)
10601 q.text(","); q.breakable()
10602 q.text("hard_timeout = ");
10603 q.text("%#x" % self.hard_timeout)
10604 q.text(","); q.breakable()
10605 q.text("priority = ");
10606 q.text("%#x" % self.priority)
10607 q.text(","); q.breakable()
10608 q.text("buffer_id = ");
10609 q.text("%#x" % self.buffer_id)
10610 q.text(","); q.breakable()
10611 q.text("out_port = ");
10612 q.text(util.pretty_port(self.out_port))
10613 q.text(","); q.breakable()
10614 q.text("out_group = ");
10615 q.text("%#x" % self.out_group)
10616 q.text(","); q.breakable()
10617 q.text("flags = ");
10618 q.text("%#x" % self.flags)
10619 q.text(","); q.breakable()
10620 q.text("importance = ");
10621 q.text("%#x" % self.importance)
10622 q.text(","); q.breakable()
10623 q.text("match = ");
10624 q.pp(self.match)
10625 q.text(","); q.breakable()
10626 q.text("instructions = ");
10627 q.pp(self.instructions)
10628 q.breakable()
10629 q.text('}')
10630
10631flow_mod.subtypes[2] = flow_modify_strict
10632
Rich Laneccd32ed2014-11-10 17:48:24 -080010633class flow_monitor_failed_error_msg(error_msg):
10634 version = 5
10635 type = 1
10636 err_type = 16
10637
10638 def __init__(self, xid=None, code=None, data=None):
10639 if xid != None:
10640 self.xid = xid
10641 else:
10642 self.xid = None
10643 if code != None:
10644 self.code = code
10645 else:
10646 self.code = 0
10647 if data != None:
10648 self.data = data
10649 else:
10650 self.data = ''
10651 return
10652
10653 def pack(self):
10654 packed = []
10655 packed.append(struct.pack("!B", self.version))
10656 packed.append(struct.pack("!B", self.type))
10657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10658 packed.append(struct.pack("!L", self.xid))
10659 packed.append(struct.pack("!H", self.err_type))
10660 packed.append(struct.pack("!H", self.code))
10661 packed.append(self.data)
10662 length = sum([len(x) for x in packed])
10663 packed[2] = struct.pack("!H", length)
10664 return ''.join(packed)
10665
10666 @staticmethod
10667 def unpack(reader):
10668 obj = flow_monitor_failed_error_msg()
10669 _version = reader.read("!B")[0]
10670 assert(_version == 5)
10671 _type = reader.read("!B")[0]
10672 assert(_type == 1)
10673 _length = reader.read("!H")[0]
10674 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010675 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -080010676 obj.xid = reader.read("!L")[0]
10677 _err_type = reader.read("!H")[0]
10678 assert(_err_type == 16)
10679 obj.code = reader.read("!H")[0]
10680 obj.data = str(reader.read_all())
10681 return obj
10682
10683 def __eq__(self, other):
10684 if type(self) != type(other): return False
10685 if self.xid != other.xid: return False
10686 if self.code != other.code: return False
10687 if self.data != other.data: return False
10688 return True
10689
10690 def pretty_print(self, q):
10691 q.text("flow_monitor_failed_error_msg {")
10692 with q.group():
10693 with q.indent(2):
10694 q.breakable()
10695 q.text("xid = ");
10696 if self.xid != None:
10697 q.text("%#x" % self.xid)
10698 else:
10699 q.text('None')
10700 q.text(","); q.breakable()
10701 q.text("code = ");
10702 q.text("%#x" % self.code)
10703 q.text(","); q.breakable()
10704 q.text("data = ");
10705 q.pp(self.data)
10706 q.breakable()
10707 q.text('}')
10708
10709error_msg.subtypes[16] = flow_monitor_failed_error_msg
10710
Rich Lane2e079da2014-10-29 15:30:24 -070010711class flow_removed(message):
10712 version = 5
10713 type = 11
10714
10715 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):
10716 if xid != None:
10717 self.xid = xid
10718 else:
10719 self.xid = None
10720 if cookie != None:
10721 self.cookie = cookie
10722 else:
10723 self.cookie = 0
10724 if priority != None:
10725 self.priority = priority
10726 else:
10727 self.priority = 0
10728 if reason != None:
10729 self.reason = reason
10730 else:
10731 self.reason = 0
10732 if table_id != None:
10733 self.table_id = table_id
10734 else:
10735 self.table_id = 0
10736 if duration_sec != None:
10737 self.duration_sec = duration_sec
10738 else:
10739 self.duration_sec = 0
10740 if duration_nsec != None:
10741 self.duration_nsec = duration_nsec
10742 else:
10743 self.duration_nsec = 0
10744 if idle_timeout != None:
10745 self.idle_timeout = idle_timeout
10746 else:
10747 self.idle_timeout = 0
10748 if hard_timeout != None:
10749 self.hard_timeout = hard_timeout
10750 else:
10751 self.hard_timeout = 0
10752 if packet_count != None:
10753 self.packet_count = packet_count
10754 else:
10755 self.packet_count = 0
10756 if byte_count != None:
10757 self.byte_count = byte_count
10758 else:
10759 self.byte_count = 0
10760 if match != None:
10761 self.match = match
10762 else:
10763 self.match = common.match()
10764 return
10765
10766 def pack(self):
10767 packed = []
10768 packed.append(struct.pack("!B", self.version))
10769 packed.append(struct.pack("!B", self.type))
10770 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10771 packed.append(struct.pack("!L", self.xid))
10772 packed.append(struct.pack("!Q", self.cookie))
10773 packed.append(struct.pack("!H", self.priority))
10774 packed.append(struct.pack("!B", self.reason))
10775 packed.append(struct.pack("!B", self.table_id))
10776 packed.append(struct.pack("!L", self.duration_sec))
10777 packed.append(struct.pack("!L", self.duration_nsec))
10778 packed.append(struct.pack("!H", self.idle_timeout))
10779 packed.append(struct.pack("!H", self.hard_timeout))
10780 packed.append(struct.pack("!Q", self.packet_count))
10781 packed.append(struct.pack("!Q", self.byte_count))
10782 packed.append(self.match.pack())
10783 length = sum([len(x) for x in packed])
10784 packed[2] = struct.pack("!H", length)
10785 return ''.join(packed)
10786
10787 @staticmethod
10788 def unpack(reader):
10789 obj = flow_removed()
10790 _version = reader.read("!B")[0]
10791 assert(_version == 5)
10792 _type = reader.read("!B")[0]
10793 assert(_type == 11)
10794 _length = reader.read("!H")[0]
10795 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010796 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010797 obj.xid = reader.read("!L")[0]
10798 obj.cookie = reader.read("!Q")[0]
10799 obj.priority = reader.read("!H")[0]
10800 obj.reason = reader.read("!B")[0]
10801 obj.table_id = reader.read("!B")[0]
10802 obj.duration_sec = reader.read("!L")[0]
10803 obj.duration_nsec = reader.read("!L")[0]
10804 obj.idle_timeout = reader.read("!H")[0]
10805 obj.hard_timeout = reader.read("!H")[0]
10806 obj.packet_count = reader.read("!Q")[0]
10807 obj.byte_count = reader.read("!Q")[0]
10808 obj.match = common.match.unpack(reader)
10809 return obj
10810
10811 def __eq__(self, other):
10812 if type(self) != type(other): return False
10813 if self.xid != other.xid: return False
10814 if self.cookie != other.cookie: return False
10815 if self.priority != other.priority: return False
10816 if self.reason != other.reason: return False
10817 if self.table_id != other.table_id: return False
10818 if self.duration_sec != other.duration_sec: return False
10819 if self.duration_nsec != other.duration_nsec: return False
10820 if self.idle_timeout != other.idle_timeout: return False
10821 if self.hard_timeout != other.hard_timeout: return False
10822 if self.packet_count != other.packet_count: return False
10823 if self.byte_count != other.byte_count: return False
10824 if self.match != other.match: return False
10825 return True
10826
10827 def pretty_print(self, q):
10828 q.text("flow_removed {")
10829 with q.group():
10830 with q.indent(2):
10831 q.breakable()
10832 q.text("xid = ");
10833 if self.xid != None:
10834 q.text("%#x" % self.xid)
10835 else:
10836 q.text('None')
10837 q.text(","); q.breakable()
10838 q.text("cookie = ");
10839 q.text("%#x" % self.cookie)
10840 q.text(","); q.breakable()
10841 q.text("priority = ");
10842 q.text("%#x" % self.priority)
10843 q.text(","); q.breakable()
10844 q.text("reason = ");
10845 q.text("%#x" % self.reason)
10846 q.text(","); q.breakable()
10847 q.text("table_id = ");
10848 q.text("%#x" % self.table_id)
10849 q.text(","); q.breakable()
10850 q.text("duration_sec = ");
10851 q.text("%#x" % self.duration_sec)
10852 q.text(","); q.breakable()
10853 q.text("duration_nsec = ");
10854 q.text("%#x" % self.duration_nsec)
10855 q.text(","); q.breakable()
10856 q.text("idle_timeout = ");
10857 q.text("%#x" % self.idle_timeout)
10858 q.text(","); q.breakable()
10859 q.text("hard_timeout = ");
10860 q.text("%#x" % self.hard_timeout)
10861 q.text(","); q.breakable()
10862 q.text("packet_count = ");
10863 q.text("%#x" % self.packet_count)
10864 q.text(","); q.breakable()
10865 q.text("byte_count = ");
10866 q.text("%#x" % self.byte_count)
10867 q.text(","); q.breakable()
10868 q.text("match = ");
10869 q.pp(self.match)
10870 q.breakable()
10871 q.text('}')
10872
10873message.subtypes[11] = flow_removed
10874
10875class flow_stats_reply(stats_reply):
10876 version = 5
10877 type = 19
10878 stats_type = 1
10879
10880 def __init__(self, xid=None, flags=None, entries=None):
10881 if xid != None:
10882 self.xid = xid
10883 else:
10884 self.xid = None
10885 if flags != None:
10886 self.flags = flags
10887 else:
10888 self.flags = 0
10889 if entries != None:
10890 self.entries = entries
10891 else:
10892 self.entries = []
10893 return
10894
10895 def pack(self):
10896 packed = []
10897 packed.append(struct.pack("!B", self.version))
10898 packed.append(struct.pack("!B", self.type))
10899 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10900 packed.append(struct.pack("!L", self.xid))
10901 packed.append(struct.pack("!H", self.stats_type))
10902 packed.append(struct.pack("!H", self.flags))
10903 packed.append('\x00' * 4)
10904 packed.append(loxi.generic_util.pack_list(self.entries))
10905 length = sum([len(x) for x in packed])
10906 packed[2] = struct.pack("!H", length)
10907 return ''.join(packed)
10908
10909 @staticmethod
10910 def unpack(reader):
10911 obj = flow_stats_reply()
10912 _version = reader.read("!B")[0]
10913 assert(_version == 5)
10914 _type = reader.read("!B")[0]
10915 assert(_type == 19)
10916 _length = reader.read("!H")[0]
10917 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010918 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010919 obj.xid = reader.read("!L")[0]
10920 _stats_type = reader.read("!H")[0]
10921 assert(_stats_type == 1)
10922 obj.flags = reader.read("!H")[0]
10923 reader.skip(4)
10924 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
10925 return obj
10926
10927 def __eq__(self, other):
10928 if type(self) != type(other): return False
10929 if self.xid != other.xid: return False
10930 if self.flags != other.flags: return False
10931 if self.entries != other.entries: return False
10932 return True
10933
10934 def pretty_print(self, q):
10935 q.text("flow_stats_reply {")
10936 with q.group():
10937 with q.indent(2):
10938 q.breakable()
10939 q.text("xid = ");
10940 if self.xid != None:
10941 q.text("%#x" % self.xid)
10942 else:
10943 q.text('None')
10944 q.text(","); q.breakable()
10945 q.text("flags = ");
10946 q.text("%#x" % self.flags)
10947 q.text(","); q.breakable()
10948 q.text("entries = ");
10949 q.pp(self.entries)
10950 q.breakable()
10951 q.text('}')
10952
10953stats_reply.subtypes[1] = flow_stats_reply
10954
10955class flow_stats_request(stats_request):
10956 version = 5
10957 type = 18
10958 stats_type = 1
10959
10960 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
10961 if xid != None:
10962 self.xid = xid
10963 else:
10964 self.xid = None
10965 if flags != None:
10966 self.flags = flags
10967 else:
10968 self.flags = 0
10969 if table_id != None:
10970 self.table_id = table_id
10971 else:
10972 self.table_id = 0
10973 if out_port != None:
10974 self.out_port = out_port
10975 else:
10976 self.out_port = 0
10977 if out_group != None:
10978 self.out_group = out_group
10979 else:
10980 self.out_group = 0
10981 if cookie != None:
10982 self.cookie = cookie
10983 else:
10984 self.cookie = 0
10985 if cookie_mask != None:
10986 self.cookie_mask = cookie_mask
10987 else:
10988 self.cookie_mask = 0
10989 if match != None:
10990 self.match = match
10991 else:
10992 self.match = common.match()
10993 return
10994
10995 def pack(self):
10996 packed = []
10997 packed.append(struct.pack("!B", self.version))
10998 packed.append(struct.pack("!B", self.type))
10999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11000 packed.append(struct.pack("!L", self.xid))
11001 packed.append(struct.pack("!H", self.stats_type))
11002 packed.append(struct.pack("!H", self.flags))
11003 packed.append('\x00' * 4)
11004 packed.append(struct.pack("!B", self.table_id))
11005 packed.append('\x00' * 3)
11006 packed.append(util.pack_port_no(self.out_port))
11007 packed.append(struct.pack("!L", self.out_group))
11008 packed.append('\x00' * 4)
11009 packed.append(struct.pack("!Q", self.cookie))
11010 packed.append(struct.pack("!Q", self.cookie_mask))
11011 packed.append(self.match.pack())
11012 length = sum([len(x) for x in packed])
11013 packed[2] = struct.pack("!H", length)
11014 return ''.join(packed)
11015
11016 @staticmethod
11017 def unpack(reader):
11018 obj = flow_stats_request()
11019 _version = reader.read("!B")[0]
11020 assert(_version == 5)
11021 _type = reader.read("!B")[0]
11022 assert(_type == 18)
11023 _length = reader.read("!H")[0]
11024 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011025 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011026 obj.xid = reader.read("!L")[0]
11027 _stats_type = reader.read("!H")[0]
11028 assert(_stats_type == 1)
11029 obj.flags = reader.read("!H")[0]
11030 reader.skip(4)
11031 obj.table_id = reader.read("!B")[0]
11032 reader.skip(3)
11033 obj.out_port = util.unpack_port_no(reader)
11034 obj.out_group = reader.read("!L")[0]
11035 reader.skip(4)
11036 obj.cookie = reader.read("!Q")[0]
11037 obj.cookie_mask = reader.read("!Q")[0]
11038 obj.match = common.match.unpack(reader)
11039 return obj
11040
11041 def __eq__(self, other):
11042 if type(self) != type(other): return False
11043 if self.xid != other.xid: return False
11044 if self.flags != other.flags: return False
11045 if self.table_id != other.table_id: return False
11046 if self.out_port != other.out_port: return False
11047 if self.out_group != other.out_group: return False
11048 if self.cookie != other.cookie: return False
11049 if self.cookie_mask != other.cookie_mask: return False
11050 if self.match != other.match: return False
11051 return True
11052
11053 def pretty_print(self, q):
11054 q.text("flow_stats_request {")
11055 with q.group():
11056 with q.indent(2):
11057 q.breakable()
11058 q.text("xid = ");
11059 if self.xid != None:
11060 q.text("%#x" % self.xid)
11061 else:
11062 q.text('None')
11063 q.text(","); q.breakable()
11064 q.text("flags = ");
11065 q.text("%#x" % self.flags)
11066 q.text(","); q.breakable()
11067 q.text("table_id = ");
11068 q.text("%#x" % self.table_id)
11069 q.text(","); q.breakable()
11070 q.text("out_port = ");
11071 q.text(util.pretty_port(self.out_port))
11072 q.text(","); q.breakable()
11073 q.text("out_group = ");
11074 q.text("%#x" % self.out_group)
11075 q.text(","); q.breakable()
11076 q.text("cookie = ");
11077 q.text("%#x" % self.cookie)
11078 q.text(","); q.breakable()
11079 q.text("cookie_mask = ");
11080 q.text("%#x" % self.cookie_mask)
11081 q.text(","); q.breakable()
11082 q.text("match = ");
11083 q.pp(self.match)
11084 q.breakable()
11085 q.text('}')
11086
11087stats_request.subtypes[1] = flow_stats_request
11088
11089class get_config_reply(message):
11090 version = 5
11091 type = 8
11092
11093 def __init__(self, xid=None, flags=None, miss_send_len=None):
11094 if xid != None:
11095 self.xid = xid
11096 else:
11097 self.xid = None
11098 if flags != None:
11099 self.flags = flags
11100 else:
11101 self.flags = 0
11102 if miss_send_len != None:
11103 self.miss_send_len = miss_send_len
11104 else:
11105 self.miss_send_len = 0
11106 return
11107
11108 def pack(self):
11109 packed = []
11110 packed.append(struct.pack("!B", self.version))
11111 packed.append(struct.pack("!B", self.type))
11112 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11113 packed.append(struct.pack("!L", self.xid))
11114 packed.append(struct.pack("!H", self.flags))
11115 packed.append(struct.pack("!H", self.miss_send_len))
11116 length = sum([len(x) for x in packed])
11117 packed[2] = struct.pack("!H", length)
11118 return ''.join(packed)
11119
11120 @staticmethod
11121 def unpack(reader):
11122 obj = get_config_reply()
11123 _version = reader.read("!B")[0]
11124 assert(_version == 5)
11125 _type = reader.read("!B")[0]
11126 assert(_type == 8)
11127 _length = reader.read("!H")[0]
11128 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011129 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011130 obj.xid = reader.read("!L")[0]
11131 obj.flags = reader.read("!H")[0]
11132 obj.miss_send_len = reader.read("!H")[0]
11133 return obj
11134
11135 def __eq__(self, other):
11136 if type(self) != type(other): return False
11137 if self.xid != other.xid: return False
11138 if self.flags != other.flags: return False
11139 if self.miss_send_len != other.miss_send_len: return False
11140 return True
11141
11142 def pretty_print(self, q):
11143 q.text("get_config_reply {")
11144 with q.group():
11145 with q.indent(2):
11146 q.breakable()
11147 q.text("xid = ");
11148 if self.xid != None:
11149 q.text("%#x" % self.xid)
11150 else:
11151 q.text('None')
11152 q.text(","); q.breakable()
11153 q.text("flags = ");
11154 q.text("%#x" % self.flags)
11155 q.text(","); q.breakable()
11156 q.text("miss_send_len = ");
11157 q.text("%#x" % self.miss_send_len)
11158 q.breakable()
11159 q.text('}')
11160
11161message.subtypes[8] = get_config_reply
11162
11163class get_config_request(message):
11164 version = 5
11165 type = 7
11166
11167 def __init__(self, xid=None):
11168 if xid != None:
11169 self.xid = xid
11170 else:
11171 self.xid = None
11172 return
11173
11174 def pack(self):
11175 packed = []
11176 packed.append(struct.pack("!B", self.version))
11177 packed.append(struct.pack("!B", self.type))
11178 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11179 packed.append(struct.pack("!L", self.xid))
11180 length = sum([len(x) for x in packed])
11181 packed[2] = struct.pack("!H", length)
11182 return ''.join(packed)
11183
11184 @staticmethod
11185 def unpack(reader):
11186 obj = get_config_request()
11187 _version = reader.read("!B")[0]
11188 assert(_version == 5)
11189 _type = reader.read("!B")[0]
11190 assert(_type == 7)
11191 _length = reader.read("!H")[0]
11192 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011193 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011194 obj.xid = reader.read("!L")[0]
11195 return obj
11196
11197 def __eq__(self, other):
11198 if type(self) != type(other): return False
11199 if self.xid != other.xid: return False
11200 return True
11201
11202 def pretty_print(self, q):
11203 q.text("get_config_request {")
11204 with q.group():
11205 with q.indent(2):
11206 q.breakable()
11207 q.text("xid = ");
11208 if self.xid != None:
11209 q.text("%#x" % self.xid)
11210 else:
11211 q.text('None')
11212 q.breakable()
11213 q.text('}')
11214
11215message.subtypes[7] = get_config_request
11216
11217class group_mod(message):
11218 subtypes = {}
11219
11220 version = 5
11221 type = 15
11222
11223 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11224 if xid != None:
11225 self.xid = xid
11226 else:
11227 self.xid = None
11228 if command != None:
11229 self.command = command
11230 else:
11231 self.command = 0
11232 if group_type != None:
11233 self.group_type = group_type
11234 else:
11235 self.group_type = 0
11236 if group_id != None:
11237 self.group_id = group_id
11238 else:
11239 self.group_id = 0
11240 if buckets != None:
11241 self.buckets = buckets
11242 else:
11243 self.buckets = []
11244 return
11245
11246 def pack(self):
11247 packed = []
11248 packed.append(struct.pack("!B", self.version))
11249 packed.append(struct.pack("!B", self.type))
11250 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11251 packed.append(struct.pack("!L", self.xid))
11252 packed.append(struct.pack("!H", self.command))
11253 packed.append(struct.pack("!B", self.group_type))
11254 packed.append('\x00' * 1)
11255 packed.append(struct.pack("!L", self.group_id))
11256 packed.append(loxi.generic_util.pack_list(self.buckets))
11257 length = sum([len(x) for x in packed])
11258 packed[2] = struct.pack("!H", length)
11259 return ''.join(packed)
11260
11261 @staticmethod
11262 def unpack(reader):
11263 subtype, = reader.peek('!H', 8)
11264 subclass = group_mod.subtypes.get(subtype)
11265 if subclass:
11266 return subclass.unpack(reader)
11267
11268 obj = group_mod()
11269 _version = reader.read("!B")[0]
11270 assert(_version == 5)
11271 _type = reader.read("!B")[0]
11272 assert(_type == 15)
11273 _length = reader.read("!H")[0]
11274 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011275 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011276 obj.xid = reader.read("!L")[0]
11277 obj.command = reader.read("!H")[0]
11278 obj.group_type = reader.read("!B")[0]
11279 reader.skip(1)
11280 obj.group_id = reader.read("!L")[0]
11281 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11282 return obj
11283
11284 def __eq__(self, other):
11285 if type(self) != type(other): return False
11286 if self.xid != other.xid: return False
11287 if self.command != other.command: return False
11288 if self.group_type != other.group_type: return False
11289 if self.group_id != other.group_id: return False
11290 if self.buckets != other.buckets: return False
11291 return True
11292
11293 def pretty_print(self, q):
11294 q.text("group_mod {")
11295 with q.group():
11296 with q.indent(2):
11297 q.breakable()
11298 q.text("xid = ");
11299 if self.xid != None:
11300 q.text("%#x" % self.xid)
11301 else:
11302 q.text('None')
11303 q.text(","); q.breakable()
11304 q.text("group_type = ");
11305 q.text("%#x" % self.group_type)
11306 q.text(","); q.breakable()
11307 q.text("group_id = ");
11308 q.text("%#x" % self.group_id)
11309 q.text(","); q.breakable()
11310 q.text("buckets = ");
11311 q.pp(self.buckets)
11312 q.breakable()
11313 q.text('}')
11314
11315message.subtypes[15] = group_mod
11316
11317class group_add(group_mod):
11318 version = 5
11319 type = 15
11320 command = 0
11321
11322 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11323 if xid != None:
11324 self.xid = xid
11325 else:
11326 self.xid = None
11327 if group_type != None:
11328 self.group_type = group_type
11329 else:
11330 self.group_type = 0
11331 if group_id != None:
11332 self.group_id = group_id
11333 else:
11334 self.group_id = 0
11335 if buckets != None:
11336 self.buckets = buckets
11337 else:
11338 self.buckets = []
11339 return
11340
11341 def pack(self):
11342 packed = []
11343 packed.append(struct.pack("!B", self.version))
11344 packed.append(struct.pack("!B", self.type))
11345 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11346 packed.append(struct.pack("!L", self.xid))
11347 packed.append(struct.pack("!H", self.command))
11348 packed.append(struct.pack("!B", self.group_type))
11349 packed.append('\x00' * 1)
11350 packed.append(struct.pack("!L", self.group_id))
11351 packed.append(loxi.generic_util.pack_list(self.buckets))
11352 length = sum([len(x) for x in packed])
11353 packed[2] = struct.pack("!H", length)
11354 return ''.join(packed)
11355
11356 @staticmethod
11357 def unpack(reader):
11358 obj = group_add()
11359 _version = reader.read("!B")[0]
11360 assert(_version == 5)
11361 _type = reader.read("!B")[0]
11362 assert(_type == 15)
11363 _length = reader.read("!H")[0]
11364 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011365 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011366 obj.xid = reader.read("!L")[0]
11367 _command = reader.read("!H")[0]
11368 assert(_command == 0)
11369 obj.group_type = reader.read("!B")[0]
11370 reader.skip(1)
11371 obj.group_id = reader.read("!L")[0]
11372 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11373 return obj
11374
11375 def __eq__(self, other):
11376 if type(self) != type(other): return False
11377 if self.xid != other.xid: return False
11378 if self.group_type != other.group_type: return False
11379 if self.group_id != other.group_id: return False
11380 if self.buckets != other.buckets: return False
11381 return True
11382
11383 def pretty_print(self, q):
11384 q.text("group_add {")
11385 with q.group():
11386 with q.indent(2):
11387 q.breakable()
11388 q.text("xid = ");
11389 if self.xid != None:
11390 q.text("%#x" % self.xid)
11391 else:
11392 q.text('None')
11393 q.text(","); q.breakable()
11394 q.text("group_type = ");
11395 q.text("%#x" % self.group_type)
11396 q.text(","); q.breakable()
11397 q.text("group_id = ");
11398 q.text("%#x" % self.group_id)
11399 q.text(","); q.breakable()
11400 q.text("buckets = ");
11401 q.pp(self.buckets)
11402 q.breakable()
11403 q.text('}')
11404
11405group_mod.subtypes[0] = group_add
11406
11407class group_delete(group_mod):
11408 version = 5
11409 type = 15
11410 command = 2
11411
11412 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11413 if xid != None:
11414 self.xid = xid
11415 else:
11416 self.xid = None
11417 if group_type != None:
11418 self.group_type = group_type
11419 else:
11420 self.group_type = 0
11421 if group_id != None:
11422 self.group_id = group_id
11423 else:
11424 self.group_id = 0
11425 if buckets != None:
11426 self.buckets = buckets
11427 else:
11428 self.buckets = []
11429 return
11430
11431 def pack(self):
11432 packed = []
11433 packed.append(struct.pack("!B", self.version))
11434 packed.append(struct.pack("!B", self.type))
11435 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11436 packed.append(struct.pack("!L", self.xid))
11437 packed.append(struct.pack("!H", self.command))
11438 packed.append(struct.pack("!B", self.group_type))
11439 packed.append('\x00' * 1)
11440 packed.append(struct.pack("!L", self.group_id))
11441 packed.append(loxi.generic_util.pack_list(self.buckets))
11442 length = sum([len(x) for x in packed])
11443 packed[2] = struct.pack("!H", length)
11444 return ''.join(packed)
11445
11446 @staticmethod
11447 def unpack(reader):
11448 obj = group_delete()
11449 _version = reader.read("!B")[0]
11450 assert(_version == 5)
11451 _type = reader.read("!B")[0]
11452 assert(_type == 15)
11453 _length = reader.read("!H")[0]
11454 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011455 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011456 obj.xid = reader.read("!L")[0]
11457 _command = reader.read("!H")[0]
11458 assert(_command == 2)
11459 obj.group_type = reader.read("!B")[0]
11460 reader.skip(1)
11461 obj.group_id = reader.read("!L")[0]
11462 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11463 return obj
11464
11465 def __eq__(self, other):
11466 if type(self) != type(other): return False
11467 if self.xid != other.xid: return False
11468 if self.group_type != other.group_type: return False
11469 if self.group_id != other.group_id: return False
11470 if self.buckets != other.buckets: return False
11471 return True
11472
11473 def pretty_print(self, q):
11474 q.text("group_delete {")
11475 with q.group():
11476 with q.indent(2):
11477 q.breakable()
11478 q.text("xid = ");
11479 if self.xid != None:
11480 q.text("%#x" % self.xid)
11481 else:
11482 q.text('None')
11483 q.text(","); q.breakable()
11484 q.text("group_type = ");
11485 q.text("%#x" % self.group_type)
11486 q.text(","); q.breakable()
11487 q.text("group_id = ");
11488 q.text("%#x" % self.group_id)
11489 q.text(","); q.breakable()
11490 q.text("buckets = ");
11491 q.pp(self.buckets)
11492 q.breakable()
11493 q.text('}')
11494
11495group_mod.subtypes[2] = group_delete
11496
11497class group_desc_stats_reply(stats_reply):
11498 version = 5
11499 type = 19
11500 stats_type = 7
11501
11502 def __init__(self, xid=None, flags=None, entries=None):
11503 if xid != None:
11504 self.xid = xid
11505 else:
11506 self.xid = None
11507 if flags != None:
11508 self.flags = flags
11509 else:
11510 self.flags = 0
11511 if entries != None:
11512 self.entries = entries
11513 else:
11514 self.entries = []
11515 return
11516
11517 def pack(self):
11518 packed = []
11519 packed.append(struct.pack("!B", self.version))
11520 packed.append(struct.pack("!B", self.type))
11521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11522 packed.append(struct.pack("!L", self.xid))
11523 packed.append(struct.pack("!H", self.stats_type))
11524 packed.append(struct.pack("!H", self.flags))
11525 packed.append('\x00' * 4)
11526 packed.append(loxi.generic_util.pack_list(self.entries))
11527 length = sum([len(x) for x in packed])
11528 packed[2] = struct.pack("!H", length)
11529 return ''.join(packed)
11530
11531 @staticmethod
11532 def unpack(reader):
11533 obj = group_desc_stats_reply()
11534 _version = reader.read("!B")[0]
11535 assert(_version == 5)
11536 _type = reader.read("!B")[0]
11537 assert(_type == 19)
11538 _length = reader.read("!H")[0]
11539 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011540 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011541 obj.xid = reader.read("!L")[0]
11542 _stats_type = reader.read("!H")[0]
11543 assert(_stats_type == 7)
11544 obj.flags = reader.read("!H")[0]
11545 reader.skip(4)
11546 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
11547 return obj
11548
11549 def __eq__(self, other):
11550 if type(self) != type(other): return False
11551 if self.xid != other.xid: return False
11552 if self.flags != other.flags: return False
11553 if self.entries != other.entries: return False
11554 return True
11555
11556 def pretty_print(self, q):
11557 q.text("group_desc_stats_reply {")
11558 with q.group():
11559 with q.indent(2):
11560 q.breakable()
11561 q.text("xid = ");
11562 if self.xid != None:
11563 q.text("%#x" % self.xid)
11564 else:
11565 q.text('None')
11566 q.text(","); q.breakable()
11567 q.text("flags = ");
11568 q.text("%#x" % self.flags)
11569 q.text(","); q.breakable()
11570 q.text("entries = ");
11571 q.pp(self.entries)
11572 q.breakable()
11573 q.text('}')
11574
11575stats_reply.subtypes[7] = group_desc_stats_reply
11576
11577class group_desc_stats_request(stats_request):
11578 version = 5
11579 type = 18
11580 stats_type = 7
11581
11582 def __init__(self, xid=None, flags=None):
11583 if xid != None:
11584 self.xid = xid
11585 else:
11586 self.xid = None
11587 if flags != None:
11588 self.flags = flags
11589 else:
11590 self.flags = 0
11591 return
11592
11593 def pack(self):
11594 packed = []
11595 packed.append(struct.pack("!B", self.version))
11596 packed.append(struct.pack("!B", self.type))
11597 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11598 packed.append(struct.pack("!L", self.xid))
11599 packed.append(struct.pack("!H", self.stats_type))
11600 packed.append(struct.pack("!H", self.flags))
11601 packed.append('\x00' * 4)
11602 length = sum([len(x) for x in packed])
11603 packed[2] = struct.pack("!H", length)
11604 return ''.join(packed)
11605
11606 @staticmethod
11607 def unpack(reader):
11608 obj = group_desc_stats_request()
11609 _version = reader.read("!B")[0]
11610 assert(_version == 5)
11611 _type = reader.read("!B")[0]
11612 assert(_type == 18)
11613 _length = reader.read("!H")[0]
11614 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011615 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011616 obj.xid = reader.read("!L")[0]
11617 _stats_type = reader.read("!H")[0]
11618 assert(_stats_type == 7)
11619 obj.flags = reader.read("!H")[0]
11620 reader.skip(4)
11621 return obj
11622
11623 def __eq__(self, other):
11624 if type(self) != type(other): return False
11625 if self.xid != other.xid: return False
11626 if self.flags != other.flags: return False
11627 return True
11628
11629 def pretty_print(self, q):
11630 q.text("group_desc_stats_request {")
11631 with q.group():
11632 with q.indent(2):
11633 q.breakable()
11634 q.text("xid = ");
11635 if self.xid != None:
11636 q.text("%#x" % self.xid)
11637 else:
11638 q.text('None')
11639 q.text(","); q.breakable()
11640 q.text("flags = ");
11641 q.text("%#x" % self.flags)
11642 q.breakable()
11643 q.text('}')
11644
11645stats_request.subtypes[7] = group_desc_stats_request
11646
11647class group_features_stats_reply(stats_reply):
11648 version = 5
11649 type = 19
11650 stats_type = 8
11651
11652 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):
11653 if xid != None:
11654 self.xid = xid
11655 else:
11656 self.xid = None
11657 if flags != None:
11658 self.flags = flags
11659 else:
11660 self.flags = 0
11661 if types != None:
11662 self.types = types
11663 else:
11664 self.types = 0
11665 if capabilities != None:
11666 self.capabilities = capabilities
11667 else:
11668 self.capabilities = 0
11669 if max_groups_all != None:
11670 self.max_groups_all = max_groups_all
11671 else:
11672 self.max_groups_all = 0
11673 if max_groups_select != None:
11674 self.max_groups_select = max_groups_select
11675 else:
11676 self.max_groups_select = 0
11677 if max_groups_indirect != None:
11678 self.max_groups_indirect = max_groups_indirect
11679 else:
11680 self.max_groups_indirect = 0
11681 if max_groups_ff != None:
11682 self.max_groups_ff = max_groups_ff
11683 else:
11684 self.max_groups_ff = 0
11685 if actions_all != None:
11686 self.actions_all = actions_all
11687 else:
11688 self.actions_all = 0
11689 if actions_select != None:
11690 self.actions_select = actions_select
11691 else:
11692 self.actions_select = 0
11693 if actions_indirect != None:
11694 self.actions_indirect = actions_indirect
11695 else:
11696 self.actions_indirect = 0
11697 if actions_ff != None:
11698 self.actions_ff = actions_ff
11699 else:
11700 self.actions_ff = 0
11701 return
11702
11703 def pack(self):
11704 packed = []
11705 packed.append(struct.pack("!B", self.version))
11706 packed.append(struct.pack("!B", self.type))
11707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11708 packed.append(struct.pack("!L", self.xid))
11709 packed.append(struct.pack("!H", self.stats_type))
11710 packed.append(struct.pack("!H", self.flags))
11711 packed.append('\x00' * 4)
11712 packed.append(struct.pack("!L", self.types))
11713 packed.append(struct.pack("!L", self.capabilities))
11714 packed.append(struct.pack("!L", self.max_groups_all))
11715 packed.append(struct.pack("!L", self.max_groups_select))
11716 packed.append(struct.pack("!L", self.max_groups_indirect))
11717 packed.append(struct.pack("!L", self.max_groups_ff))
11718 packed.append(struct.pack("!L", self.actions_all))
11719 packed.append(struct.pack("!L", self.actions_select))
11720 packed.append(struct.pack("!L", self.actions_indirect))
11721 packed.append(struct.pack("!L", self.actions_ff))
11722 length = sum([len(x) for x in packed])
11723 packed[2] = struct.pack("!H", length)
11724 return ''.join(packed)
11725
11726 @staticmethod
11727 def unpack(reader):
11728 obj = group_features_stats_reply()
11729 _version = reader.read("!B")[0]
11730 assert(_version == 5)
11731 _type = reader.read("!B")[0]
11732 assert(_type == 19)
11733 _length = reader.read("!H")[0]
11734 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011735 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011736 obj.xid = reader.read("!L")[0]
11737 _stats_type = reader.read("!H")[0]
11738 assert(_stats_type == 8)
11739 obj.flags = reader.read("!H")[0]
11740 reader.skip(4)
11741 obj.types = reader.read("!L")[0]
11742 obj.capabilities = reader.read("!L")[0]
11743 obj.max_groups_all = reader.read("!L")[0]
11744 obj.max_groups_select = reader.read("!L")[0]
11745 obj.max_groups_indirect = reader.read("!L")[0]
11746 obj.max_groups_ff = reader.read("!L")[0]
11747 obj.actions_all = reader.read("!L")[0]
11748 obj.actions_select = reader.read("!L")[0]
11749 obj.actions_indirect = reader.read("!L")[0]
11750 obj.actions_ff = reader.read("!L")[0]
11751 return obj
11752
11753 def __eq__(self, other):
11754 if type(self) != type(other): return False
11755 if self.xid != other.xid: return False
11756 if self.flags != other.flags: return False
11757 if self.types != other.types: return False
11758 if self.capabilities != other.capabilities: return False
11759 if self.max_groups_all != other.max_groups_all: return False
11760 if self.max_groups_select != other.max_groups_select: return False
11761 if self.max_groups_indirect != other.max_groups_indirect: return False
11762 if self.max_groups_ff != other.max_groups_ff: return False
11763 if self.actions_all != other.actions_all: return False
11764 if self.actions_select != other.actions_select: return False
11765 if self.actions_indirect != other.actions_indirect: return False
11766 if self.actions_ff != other.actions_ff: return False
11767 return True
11768
11769 def pretty_print(self, q):
11770 q.text("group_features_stats_reply {")
11771 with q.group():
11772 with q.indent(2):
11773 q.breakable()
11774 q.text("xid = ");
11775 if self.xid != None:
11776 q.text("%#x" % self.xid)
11777 else:
11778 q.text('None')
11779 q.text(","); q.breakable()
11780 q.text("flags = ");
11781 q.text("%#x" % self.flags)
11782 q.text(","); q.breakable()
11783 q.text("types = ");
11784 q.text("%#x" % self.types)
11785 q.text(","); q.breakable()
11786 q.text("capabilities = ");
11787 q.text("%#x" % self.capabilities)
11788 q.text(","); q.breakable()
11789 q.text("max_groups_all = ");
11790 q.text("%#x" % self.max_groups_all)
11791 q.text(","); q.breakable()
11792 q.text("max_groups_select = ");
11793 q.text("%#x" % self.max_groups_select)
11794 q.text(","); q.breakable()
11795 q.text("max_groups_indirect = ");
11796 q.text("%#x" % self.max_groups_indirect)
11797 q.text(","); q.breakable()
11798 q.text("max_groups_ff = ");
11799 q.text("%#x" % self.max_groups_ff)
11800 q.text(","); q.breakable()
11801 q.text("actions_all = ");
11802 q.text("%#x" % self.actions_all)
11803 q.text(","); q.breakable()
11804 q.text("actions_select = ");
11805 q.text("%#x" % self.actions_select)
11806 q.text(","); q.breakable()
11807 q.text("actions_indirect = ");
11808 q.text("%#x" % self.actions_indirect)
11809 q.text(","); q.breakable()
11810 q.text("actions_ff = ");
11811 q.text("%#x" % self.actions_ff)
11812 q.breakable()
11813 q.text('}')
11814
11815stats_reply.subtypes[8] = group_features_stats_reply
11816
11817class group_features_stats_request(stats_request):
11818 version = 5
11819 type = 18
11820 stats_type = 8
11821
11822 def __init__(self, xid=None, flags=None):
11823 if xid != None:
11824 self.xid = xid
11825 else:
11826 self.xid = None
11827 if flags != None:
11828 self.flags = flags
11829 else:
11830 self.flags = 0
11831 return
11832
11833 def pack(self):
11834 packed = []
11835 packed.append(struct.pack("!B", self.version))
11836 packed.append(struct.pack("!B", self.type))
11837 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11838 packed.append(struct.pack("!L", self.xid))
11839 packed.append(struct.pack("!H", self.stats_type))
11840 packed.append(struct.pack("!H", self.flags))
11841 packed.append('\x00' * 4)
11842 length = sum([len(x) for x in packed])
11843 packed[2] = struct.pack("!H", length)
11844 return ''.join(packed)
11845
11846 @staticmethod
11847 def unpack(reader):
11848 obj = group_features_stats_request()
11849 _version = reader.read("!B")[0]
11850 assert(_version == 5)
11851 _type = reader.read("!B")[0]
11852 assert(_type == 18)
11853 _length = reader.read("!H")[0]
11854 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011855 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011856 obj.xid = reader.read("!L")[0]
11857 _stats_type = reader.read("!H")[0]
11858 assert(_stats_type == 8)
11859 obj.flags = reader.read("!H")[0]
11860 reader.skip(4)
11861 return obj
11862
11863 def __eq__(self, other):
11864 if type(self) != type(other): return False
11865 if self.xid != other.xid: return False
11866 if self.flags != other.flags: return False
11867 return True
11868
11869 def pretty_print(self, q):
11870 q.text("group_features_stats_request {")
11871 with q.group():
11872 with q.indent(2):
11873 q.breakable()
11874 q.text("xid = ");
11875 if self.xid != None:
11876 q.text("%#x" % self.xid)
11877 else:
11878 q.text('None')
11879 q.text(","); q.breakable()
11880 q.text("flags = ");
11881 q.text("%#x" % self.flags)
11882 q.breakable()
11883 q.text('}')
11884
11885stats_request.subtypes[8] = group_features_stats_request
11886
11887class group_mod_failed_error_msg(error_msg):
11888 version = 5
11889 type = 1
11890 err_type = 6
11891
11892 def __init__(self, xid=None, code=None, data=None):
11893 if xid != None:
11894 self.xid = xid
11895 else:
11896 self.xid = None
11897 if code != None:
11898 self.code = code
11899 else:
11900 self.code = 0
11901 if data != None:
11902 self.data = data
11903 else:
11904 self.data = ''
11905 return
11906
11907 def pack(self):
11908 packed = []
11909 packed.append(struct.pack("!B", self.version))
11910 packed.append(struct.pack("!B", self.type))
11911 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11912 packed.append(struct.pack("!L", self.xid))
11913 packed.append(struct.pack("!H", self.err_type))
11914 packed.append(struct.pack("!H", self.code))
11915 packed.append(self.data)
11916 length = sum([len(x) for x in packed])
11917 packed[2] = struct.pack("!H", length)
11918 return ''.join(packed)
11919
11920 @staticmethod
11921 def unpack(reader):
11922 obj = group_mod_failed_error_msg()
11923 _version = reader.read("!B")[0]
11924 assert(_version == 5)
11925 _type = reader.read("!B")[0]
11926 assert(_type == 1)
11927 _length = reader.read("!H")[0]
11928 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011929 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011930 obj.xid = reader.read("!L")[0]
11931 _err_type = reader.read("!H")[0]
11932 assert(_err_type == 6)
11933 obj.code = reader.read("!H")[0]
11934 obj.data = str(reader.read_all())
11935 return obj
11936
11937 def __eq__(self, other):
11938 if type(self) != type(other): return False
11939 if self.xid != other.xid: return False
11940 if self.code != other.code: return False
11941 if self.data != other.data: return False
11942 return True
11943
11944 def pretty_print(self, q):
11945 q.text("group_mod_failed_error_msg {")
11946 with q.group():
11947 with q.indent(2):
11948 q.breakable()
11949 q.text("xid = ");
11950 if self.xid != None:
11951 q.text("%#x" % self.xid)
11952 else:
11953 q.text('None')
11954 q.text(","); q.breakable()
11955 q.text("code = ");
11956 q.text("%#x" % self.code)
11957 q.text(","); q.breakable()
11958 q.text("data = ");
11959 q.pp(self.data)
11960 q.breakable()
11961 q.text('}')
11962
11963error_msg.subtypes[6] = group_mod_failed_error_msg
11964
11965class group_modify(group_mod):
11966 version = 5
11967 type = 15
11968 command = 1
11969
11970 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11971 if xid != None:
11972 self.xid = xid
11973 else:
11974 self.xid = None
11975 if group_type != None:
11976 self.group_type = group_type
11977 else:
11978 self.group_type = 0
11979 if group_id != None:
11980 self.group_id = group_id
11981 else:
11982 self.group_id = 0
11983 if buckets != None:
11984 self.buckets = buckets
11985 else:
11986 self.buckets = []
11987 return
11988
11989 def pack(self):
11990 packed = []
11991 packed.append(struct.pack("!B", self.version))
11992 packed.append(struct.pack("!B", self.type))
11993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11994 packed.append(struct.pack("!L", self.xid))
11995 packed.append(struct.pack("!H", self.command))
11996 packed.append(struct.pack("!B", self.group_type))
11997 packed.append('\x00' * 1)
11998 packed.append(struct.pack("!L", self.group_id))
11999 packed.append(loxi.generic_util.pack_list(self.buckets))
12000 length = sum([len(x) for x in packed])
12001 packed[2] = struct.pack("!H", length)
12002 return ''.join(packed)
12003
12004 @staticmethod
12005 def unpack(reader):
12006 obj = group_modify()
12007 _version = reader.read("!B")[0]
12008 assert(_version == 5)
12009 _type = reader.read("!B")[0]
12010 assert(_type == 15)
12011 _length = reader.read("!H")[0]
12012 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012013 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012014 obj.xid = reader.read("!L")[0]
12015 _command = reader.read("!H")[0]
12016 assert(_command == 1)
12017 obj.group_type = reader.read("!B")[0]
12018 reader.skip(1)
12019 obj.group_id = reader.read("!L")[0]
12020 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
12021 return obj
12022
12023 def __eq__(self, other):
12024 if type(self) != type(other): return False
12025 if self.xid != other.xid: return False
12026 if self.group_type != other.group_type: return False
12027 if self.group_id != other.group_id: return False
12028 if self.buckets != other.buckets: return False
12029 return True
12030
12031 def pretty_print(self, q):
12032 q.text("group_modify {")
12033 with q.group():
12034 with q.indent(2):
12035 q.breakable()
12036 q.text("xid = ");
12037 if self.xid != None:
12038 q.text("%#x" % self.xid)
12039 else:
12040 q.text('None')
12041 q.text(","); q.breakable()
12042 q.text("group_type = ");
12043 q.text("%#x" % self.group_type)
12044 q.text(","); q.breakable()
12045 q.text("group_id = ");
12046 q.text("%#x" % self.group_id)
12047 q.text(","); q.breakable()
12048 q.text("buckets = ");
12049 q.pp(self.buckets)
12050 q.breakable()
12051 q.text('}')
12052
12053group_mod.subtypes[1] = group_modify
12054
12055class group_stats_reply(stats_reply):
12056 version = 5
12057 type = 19
12058 stats_type = 6
12059
12060 def __init__(self, xid=None, flags=None, entries=None):
12061 if xid != None:
12062 self.xid = xid
12063 else:
12064 self.xid = None
12065 if flags != None:
12066 self.flags = flags
12067 else:
12068 self.flags = 0
12069 if entries != None:
12070 self.entries = entries
12071 else:
12072 self.entries = []
12073 return
12074
12075 def pack(self):
12076 packed = []
12077 packed.append(struct.pack("!B", self.version))
12078 packed.append(struct.pack("!B", self.type))
12079 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12080 packed.append(struct.pack("!L", self.xid))
12081 packed.append(struct.pack("!H", self.stats_type))
12082 packed.append(struct.pack("!H", self.flags))
12083 packed.append('\x00' * 4)
12084 packed.append(loxi.generic_util.pack_list(self.entries))
12085 length = sum([len(x) for x in packed])
12086 packed[2] = struct.pack("!H", length)
12087 return ''.join(packed)
12088
12089 @staticmethod
12090 def unpack(reader):
12091 obj = group_stats_reply()
12092 _version = reader.read("!B")[0]
12093 assert(_version == 5)
12094 _type = reader.read("!B")[0]
12095 assert(_type == 19)
12096 _length = reader.read("!H")[0]
12097 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012098 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012099 obj.xid = reader.read("!L")[0]
12100 _stats_type = reader.read("!H")[0]
12101 assert(_stats_type == 6)
12102 obj.flags = reader.read("!H")[0]
12103 reader.skip(4)
12104 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
12105 return obj
12106
12107 def __eq__(self, other):
12108 if type(self) != type(other): return False
12109 if self.xid != other.xid: return False
12110 if self.flags != other.flags: return False
12111 if self.entries != other.entries: return False
12112 return True
12113
12114 def pretty_print(self, q):
12115 q.text("group_stats_reply {")
12116 with q.group():
12117 with q.indent(2):
12118 q.breakable()
12119 q.text("xid = ");
12120 if self.xid != None:
12121 q.text("%#x" % self.xid)
12122 else:
12123 q.text('None')
12124 q.text(","); q.breakable()
12125 q.text("flags = ");
12126 q.text("%#x" % self.flags)
12127 q.text(","); q.breakable()
12128 q.text("entries = ");
12129 q.pp(self.entries)
12130 q.breakable()
12131 q.text('}')
12132
12133stats_reply.subtypes[6] = group_stats_reply
12134
12135class group_stats_request(stats_request):
12136 version = 5
12137 type = 18
12138 stats_type = 6
12139
12140 def __init__(self, xid=None, flags=None, group_id=None):
12141 if xid != None:
12142 self.xid = xid
12143 else:
12144 self.xid = None
12145 if flags != None:
12146 self.flags = flags
12147 else:
12148 self.flags = 0
12149 if group_id != None:
12150 self.group_id = group_id
12151 else:
12152 self.group_id = 0
12153 return
12154
12155 def pack(self):
12156 packed = []
12157 packed.append(struct.pack("!B", self.version))
12158 packed.append(struct.pack("!B", self.type))
12159 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12160 packed.append(struct.pack("!L", self.xid))
12161 packed.append(struct.pack("!H", self.stats_type))
12162 packed.append(struct.pack("!H", self.flags))
12163 packed.append('\x00' * 4)
12164 packed.append(struct.pack("!L", self.group_id))
12165 packed.append('\x00' * 4)
12166 length = sum([len(x) for x in packed])
12167 packed[2] = struct.pack("!H", length)
12168 return ''.join(packed)
12169
12170 @staticmethod
12171 def unpack(reader):
12172 obj = group_stats_request()
12173 _version = reader.read("!B")[0]
12174 assert(_version == 5)
12175 _type = reader.read("!B")[0]
12176 assert(_type == 18)
12177 _length = reader.read("!H")[0]
12178 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012179 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012180 obj.xid = reader.read("!L")[0]
12181 _stats_type = reader.read("!H")[0]
12182 assert(_stats_type == 6)
12183 obj.flags = reader.read("!H")[0]
12184 reader.skip(4)
12185 obj.group_id = reader.read("!L")[0]
12186 reader.skip(4)
12187 return obj
12188
12189 def __eq__(self, other):
12190 if type(self) != type(other): return False
12191 if self.xid != other.xid: return False
12192 if self.flags != other.flags: return False
12193 if self.group_id != other.group_id: return False
12194 return True
12195
12196 def pretty_print(self, q):
12197 q.text("group_stats_request {")
12198 with q.group():
12199 with q.indent(2):
12200 q.breakable()
12201 q.text("xid = ");
12202 if self.xid != None:
12203 q.text("%#x" % self.xid)
12204 else:
12205 q.text('None')
12206 q.text(","); q.breakable()
12207 q.text("flags = ");
12208 q.text("%#x" % self.flags)
12209 q.text(","); q.breakable()
12210 q.text("group_id = ");
12211 q.text("%#x" % self.group_id)
12212 q.breakable()
12213 q.text('}')
12214
12215stats_request.subtypes[6] = group_stats_request
12216
12217class hello(message):
12218 version = 5
12219 type = 0
12220
12221 def __init__(self, xid=None, elements=None):
12222 if xid != None:
12223 self.xid = xid
12224 else:
12225 self.xid = None
12226 if elements != None:
12227 self.elements = elements
12228 else:
12229 self.elements = []
12230 return
12231
12232 def pack(self):
12233 packed = []
12234 packed.append(struct.pack("!B", self.version))
12235 packed.append(struct.pack("!B", self.type))
12236 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12237 packed.append(struct.pack("!L", self.xid))
12238 packed.append(loxi.generic_util.pack_list(self.elements))
12239 length = sum([len(x) for x in packed])
12240 packed[2] = struct.pack("!H", length)
12241 return ''.join(packed)
12242
12243 @staticmethod
12244 def unpack(reader):
12245 obj = hello()
12246 _version = reader.read("!B")[0]
12247 assert(_version == 5)
12248 _type = reader.read("!B")[0]
12249 assert(_type == 0)
12250 _length = reader.read("!H")[0]
12251 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012252 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012253 obj.xid = reader.read("!L")[0]
12254 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
12255 return obj
12256
12257 def __eq__(self, other):
12258 if type(self) != type(other): return False
12259 if self.xid != other.xid: return False
12260 if self.elements != other.elements: return False
12261 return True
12262
12263 def pretty_print(self, q):
12264 q.text("hello {")
12265 with q.group():
12266 with q.indent(2):
12267 q.breakable()
12268 q.text("xid = ");
12269 if self.xid != None:
12270 q.text("%#x" % self.xid)
12271 else:
12272 q.text('None')
12273 q.text(","); q.breakable()
12274 q.text("elements = ");
12275 q.pp(self.elements)
12276 q.breakable()
12277 q.text('}')
12278
12279message.subtypes[0] = hello
12280
12281class hello_failed_error_msg(error_msg):
12282 version = 5
12283 type = 1
12284 err_type = 0
12285
12286 def __init__(self, xid=None, code=None, data=None):
12287 if xid != None:
12288 self.xid = xid
12289 else:
12290 self.xid = None
12291 if code != None:
12292 self.code = code
12293 else:
12294 self.code = 0
12295 if data != None:
12296 self.data = data
12297 else:
12298 self.data = ''
12299 return
12300
12301 def pack(self):
12302 packed = []
12303 packed.append(struct.pack("!B", self.version))
12304 packed.append(struct.pack("!B", self.type))
12305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12306 packed.append(struct.pack("!L", self.xid))
12307 packed.append(struct.pack("!H", self.err_type))
12308 packed.append(struct.pack("!H", self.code))
12309 packed.append(self.data)
12310 length = sum([len(x) for x in packed])
12311 packed[2] = struct.pack("!H", length)
12312 return ''.join(packed)
12313
12314 @staticmethod
12315 def unpack(reader):
12316 obj = hello_failed_error_msg()
12317 _version = reader.read("!B")[0]
12318 assert(_version == 5)
12319 _type = reader.read("!B")[0]
12320 assert(_type == 1)
12321 _length = reader.read("!H")[0]
12322 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012323 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012324 obj.xid = reader.read("!L")[0]
12325 _err_type = reader.read("!H")[0]
12326 assert(_err_type == 0)
12327 obj.code = reader.read("!H")[0]
12328 obj.data = str(reader.read_all())
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.code != other.code: return False
12335 if self.data != other.data: return False
12336 return True
12337
12338 def pretty_print(self, q):
12339 q.text("hello_failed_error_msg {")
12340 with q.group():
12341 with q.indent(2):
12342 q.breakable()
12343 q.text("xid = ");
12344 if self.xid != None:
12345 q.text("%#x" % self.xid)
12346 else:
12347 q.text('None')
12348 q.text(","); q.breakable()
12349 q.text("code = ");
12350 q.text("%#x" % self.code)
12351 q.text(","); q.breakable()
12352 q.text("data = ");
12353 q.pp(self.data)
12354 q.breakable()
12355 q.text('}')
12356
12357error_msg.subtypes[0] = hello_failed_error_msg
12358
12359class meter_config_stats_reply(stats_reply):
12360 version = 5
12361 type = 19
12362 stats_type = 10
12363
12364 def __init__(self, xid=None, flags=None, entries=None):
12365 if xid != None:
12366 self.xid = xid
12367 else:
12368 self.xid = None
12369 if flags != None:
12370 self.flags = flags
12371 else:
12372 self.flags = 0
12373 if entries != None:
12374 self.entries = entries
12375 else:
12376 self.entries = []
12377 return
12378
12379 def pack(self):
12380 packed = []
12381 packed.append(struct.pack("!B", self.version))
12382 packed.append(struct.pack("!B", self.type))
12383 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12384 packed.append(struct.pack("!L", self.xid))
12385 packed.append(struct.pack("!H", self.stats_type))
12386 packed.append(struct.pack("!H", self.flags))
12387 packed.append('\x00' * 4)
12388 packed.append(loxi.generic_util.pack_list(self.entries))
12389 length = sum([len(x) for x in packed])
12390 packed[2] = struct.pack("!H", length)
12391 return ''.join(packed)
12392
12393 @staticmethod
12394 def unpack(reader):
12395 obj = meter_config_stats_reply()
12396 _version = reader.read("!B")[0]
12397 assert(_version == 5)
12398 _type = reader.read("!B")[0]
12399 assert(_type == 19)
12400 _length = reader.read("!H")[0]
12401 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012402 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012403 obj.xid = reader.read("!L")[0]
12404 _stats_type = reader.read("!H")[0]
12405 assert(_stats_type == 10)
12406 obj.flags = reader.read("!H")[0]
12407 reader.skip(4)
12408 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
12409 return obj
12410
12411 def __eq__(self, other):
12412 if type(self) != type(other): return False
12413 if self.xid != other.xid: return False
12414 if self.flags != other.flags: return False
12415 if self.entries != other.entries: return False
12416 return True
12417
12418 def pretty_print(self, q):
12419 q.text("meter_config_stats_reply {")
12420 with q.group():
12421 with q.indent(2):
12422 q.breakable()
12423 q.text("xid = ");
12424 if self.xid != None:
12425 q.text("%#x" % self.xid)
12426 else:
12427 q.text('None')
12428 q.text(","); q.breakable()
12429 q.text("flags = ");
12430 q.text("%#x" % self.flags)
12431 q.text(","); q.breakable()
12432 q.text("entries = ");
12433 q.pp(self.entries)
12434 q.breakable()
12435 q.text('}')
12436
12437stats_reply.subtypes[10] = meter_config_stats_reply
12438
12439class meter_config_stats_request(stats_request):
12440 version = 5
12441 type = 18
12442 stats_type = 10
12443
12444 def __init__(self, xid=None, flags=None, meter_id=None):
12445 if xid != None:
12446 self.xid = xid
12447 else:
12448 self.xid = None
12449 if flags != None:
12450 self.flags = flags
12451 else:
12452 self.flags = 0
12453 if meter_id != None:
12454 self.meter_id = meter_id
12455 else:
12456 self.meter_id = 0
12457 return
12458
12459 def pack(self):
12460 packed = []
12461 packed.append(struct.pack("!B", self.version))
12462 packed.append(struct.pack("!B", self.type))
12463 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12464 packed.append(struct.pack("!L", self.xid))
12465 packed.append(struct.pack("!H", self.stats_type))
12466 packed.append(struct.pack("!H", self.flags))
12467 packed.append('\x00' * 4)
12468 packed.append(struct.pack("!L", self.meter_id))
12469 packed.append('\x00' * 4)
12470 length = sum([len(x) for x in packed])
12471 packed[2] = struct.pack("!H", length)
12472 return ''.join(packed)
12473
12474 @staticmethod
12475 def unpack(reader):
12476 obj = meter_config_stats_request()
12477 _version = reader.read("!B")[0]
12478 assert(_version == 5)
12479 _type = reader.read("!B")[0]
12480 assert(_type == 18)
12481 _length = reader.read("!H")[0]
12482 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012483 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012484 obj.xid = reader.read("!L")[0]
12485 _stats_type = reader.read("!H")[0]
12486 assert(_stats_type == 10)
12487 obj.flags = reader.read("!H")[0]
12488 reader.skip(4)
12489 obj.meter_id = reader.read("!L")[0]
12490 reader.skip(4)
12491 return obj
12492
12493 def __eq__(self, other):
12494 if type(self) != type(other): return False
12495 if self.xid != other.xid: return False
12496 if self.flags != other.flags: return False
12497 if self.meter_id != other.meter_id: return False
12498 return True
12499
12500 def pretty_print(self, q):
12501 q.text("meter_config_stats_request {")
12502 with q.group():
12503 with q.indent(2):
12504 q.breakable()
12505 q.text("xid = ");
12506 if self.xid != None:
12507 q.text("%#x" % self.xid)
12508 else:
12509 q.text('None')
12510 q.text(","); q.breakable()
12511 q.text("flags = ");
12512 q.text("%#x" % self.flags)
12513 q.text(","); q.breakable()
12514 q.text("meter_id = ");
12515 q.text("%#x" % self.meter_id)
12516 q.breakable()
12517 q.text('}')
12518
12519stats_request.subtypes[10] = meter_config_stats_request
12520
12521class meter_features_stats_reply(stats_reply):
12522 version = 5
12523 type = 19
12524 stats_type = 11
12525
12526 def __init__(self, xid=None, flags=None, features=None):
12527 if xid != None:
12528 self.xid = xid
12529 else:
12530 self.xid = None
12531 if flags != None:
12532 self.flags = flags
12533 else:
12534 self.flags = 0
12535 if features != None:
12536 self.features = features
12537 else:
12538 self.features = common.meter_features()
12539 return
12540
12541 def pack(self):
12542 packed = []
12543 packed.append(struct.pack("!B", self.version))
12544 packed.append(struct.pack("!B", self.type))
12545 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12546 packed.append(struct.pack("!L", self.xid))
12547 packed.append(struct.pack("!H", self.stats_type))
12548 packed.append(struct.pack("!H", self.flags))
12549 packed.append('\x00' * 4)
12550 packed.append(self.features.pack())
12551 length = sum([len(x) for x in packed])
12552 packed[2] = struct.pack("!H", length)
12553 return ''.join(packed)
12554
12555 @staticmethod
12556 def unpack(reader):
12557 obj = meter_features_stats_reply()
12558 _version = reader.read("!B")[0]
12559 assert(_version == 5)
12560 _type = reader.read("!B")[0]
12561 assert(_type == 19)
12562 _length = reader.read("!H")[0]
12563 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012564 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012565 obj.xid = reader.read("!L")[0]
12566 _stats_type = reader.read("!H")[0]
12567 assert(_stats_type == 11)
12568 obj.flags = reader.read("!H")[0]
12569 reader.skip(4)
12570 obj.features = common.meter_features.unpack(reader)
12571 return obj
12572
12573 def __eq__(self, other):
12574 if type(self) != type(other): return False
12575 if self.xid != other.xid: return False
12576 if self.flags != other.flags: return False
12577 if self.features != other.features: return False
12578 return True
12579
12580 def pretty_print(self, q):
12581 q.text("meter_features_stats_reply {")
12582 with q.group():
12583 with q.indent(2):
12584 q.breakable()
12585 q.text("xid = ");
12586 if self.xid != None:
12587 q.text("%#x" % self.xid)
12588 else:
12589 q.text('None')
12590 q.text(","); q.breakable()
12591 q.text("flags = ");
12592 q.text("%#x" % self.flags)
12593 q.text(","); q.breakable()
12594 q.text("features = ");
12595 q.pp(self.features)
12596 q.breakable()
12597 q.text('}')
12598
12599stats_reply.subtypes[11] = meter_features_stats_reply
12600
12601class meter_features_stats_request(stats_request):
12602 version = 5
12603 type = 18
12604 stats_type = 11
12605
12606 def __init__(self, xid=None, flags=None):
12607 if xid != None:
12608 self.xid = xid
12609 else:
12610 self.xid = None
12611 if flags != None:
12612 self.flags = flags
12613 else:
12614 self.flags = 0
12615 return
12616
12617 def pack(self):
12618 packed = []
12619 packed.append(struct.pack("!B", self.version))
12620 packed.append(struct.pack("!B", self.type))
12621 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12622 packed.append(struct.pack("!L", self.xid))
12623 packed.append(struct.pack("!H", self.stats_type))
12624 packed.append(struct.pack("!H", self.flags))
12625 packed.append('\x00' * 4)
12626 length = sum([len(x) for x in packed])
12627 packed[2] = struct.pack("!H", length)
12628 return ''.join(packed)
12629
12630 @staticmethod
12631 def unpack(reader):
12632 obj = meter_features_stats_request()
12633 _version = reader.read("!B")[0]
12634 assert(_version == 5)
12635 _type = reader.read("!B")[0]
12636 assert(_type == 18)
12637 _length = reader.read("!H")[0]
12638 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012639 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012640 obj.xid = reader.read("!L")[0]
12641 _stats_type = reader.read("!H")[0]
12642 assert(_stats_type == 11)
12643 obj.flags = reader.read("!H")[0]
12644 reader.skip(4)
12645 return obj
12646
12647 def __eq__(self, other):
12648 if type(self) != type(other): return False
12649 if self.xid != other.xid: return False
12650 if self.flags != other.flags: return False
12651 return True
12652
12653 def pretty_print(self, q):
12654 q.text("meter_features_stats_request {")
12655 with q.group():
12656 with q.indent(2):
12657 q.breakable()
12658 q.text("xid = ");
12659 if self.xid != None:
12660 q.text("%#x" % self.xid)
12661 else:
12662 q.text('None')
12663 q.text(","); q.breakable()
12664 q.text("flags = ");
12665 q.text("%#x" % self.flags)
12666 q.breakable()
12667 q.text('}')
12668
12669stats_request.subtypes[11] = meter_features_stats_request
12670
12671class meter_mod(message):
12672 version = 5
12673 type = 29
12674
12675 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
12676 if xid != None:
12677 self.xid = xid
12678 else:
12679 self.xid = None
12680 if command != None:
12681 self.command = command
12682 else:
12683 self.command = 0
12684 if flags != None:
12685 self.flags = flags
12686 else:
12687 self.flags = 0
12688 if meter_id != None:
12689 self.meter_id = meter_id
12690 else:
12691 self.meter_id = 0
12692 if bands != None:
12693 self.bands = bands
12694 else:
12695 self.bands = []
12696 return
12697
12698 def pack(self):
12699 packed = []
12700 packed.append(struct.pack("!B", self.version))
12701 packed.append(struct.pack("!B", self.type))
12702 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12703 packed.append(struct.pack("!L", self.xid))
12704 packed.append(struct.pack("!H", self.command))
12705 packed.append(struct.pack("!H", self.flags))
12706 packed.append(struct.pack("!L", self.meter_id))
12707 packed.append(loxi.generic_util.pack_list(self.bands))
12708 length = sum([len(x) for x in packed])
12709 packed[2] = struct.pack("!H", length)
12710 return ''.join(packed)
12711
12712 @staticmethod
12713 def unpack(reader):
12714 obj = meter_mod()
12715 _version = reader.read("!B")[0]
12716 assert(_version == 5)
12717 _type = reader.read("!B")[0]
12718 assert(_type == 29)
12719 _length = reader.read("!H")[0]
12720 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012721 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012722 obj.xid = reader.read("!L")[0]
12723 obj.command = reader.read("!H")[0]
12724 obj.flags = reader.read("!H")[0]
12725 obj.meter_id = reader.read("!L")[0]
12726 obj.bands = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
12727 return obj
12728
12729 def __eq__(self, other):
12730 if type(self) != type(other): return False
12731 if self.xid != other.xid: return False
12732 if self.command != other.command: return False
12733 if self.flags != other.flags: return False
12734 if self.meter_id != other.meter_id: return False
12735 if self.bands != other.bands: return False
12736 return True
12737
12738 def pretty_print(self, q):
12739 q.text("meter_mod {")
12740 with q.group():
12741 with q.indent(2):
12742 q.breakable()
12743 q.text("xid = ");
12744 if self.xid != None:
12745 q.text("%#x" % self.xid)
12746 else:
12747 q.text('None')
12748 q.text(","); q.breakable()
12749 q.text("command = ");
12750 q.text("%#x" % self.command)
12751 q.text(","); q.breakable()
12752 q.text("flags = ");
12753 q.text("%#x" % self.flags)
12754 q.text(","); q.breakable()
12755 q.text("meter_id = ");
12756 q.text("%#x" % self.meter_id)
12757 q.text(","); q.breakable()
12758 q.text("bands = ");
12759 q.pp(self.bands)
12760 q.breakable()
12761 q.text('}')
12762
12763message.subtypes[29] = meter_mod
12764
12765class meter_mod_failed_error_msg(error_msg):
12766 version = 5
12767 type = 1
12768 err_type = 12
12769
12770 def __init__(self, xid=None, code=None, data=None):
12771 if xid != None:
12772 self.xid = xid
12773 else:
12774 self.xid = None
12775 if code != None:
12776 self.code = code
12777 else:
12778 self.code = 0
12779 if data != None:
12780 self.data = data
12781 else:
12782 self.data = ''
12783 return
12784
12785 def pack(self):
12786 packed = []
12787 packed.append(struct.pack("!B", self.version))
12788 packed.append(struct.pack("!B", self.type))
12789 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12790 packed.append(struct.pack("!L", self.xid))
12791 packed.append(struct.pack("!H", self.err_type))
12792 packed.append(struct.pack("!H", self.code))
12793 packed.append(self.data)
12794 length = sum([len(x) for x in packed])
12795 packed[2] = struct.pack("!H", length)
12796 return ''.join(packed)
12797
12798 @staticmethod
12799 def unpack(reader):
12800 obj = meter_mod_failed_error_msg()
12801 _version = reader.read("!B")[0]
12802 assert(_version == 5)
12803 _type = reader.read("!B")[0]
12804 assert(_type == 1)
12805 _length = reader.read("!H")[0]
12806 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012807 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012808 obj.xid = reader.read("!L")[0]
12809 _err_type = reader.read("!H")[0]
12810 assert(_err_type == 12)
12811 obj.code = reader.read("!H")[0]
12812 obj.data = str(reader.read_all())
12813 return obj
12814
12815 def __eq__(self, other):
12816 if type(self) != type(other): return False
12817 if self.xid != other.xid: return False
12818 if self.code != other.code: return False
12819 if self.data != other.data: return False
12820 return True
12821
12822 def pretty_print(self, q):
12823 q.text("meter_mod_failed_error_msg {")
12824 with q.group():
12825 with q.indent(2):
12826 q.breakable()
12827 q.text("xid = ");
12828 if self.xid != None:
12829 q.text("%#x" % self.xid)
12830 else:
12831 q.text('None')
12832 q.text(","); q.breakable()
12833 q.text("code = ");
12834 q.text("%#x" % self.code)
12835 q.text(","); q.breakable()
12836 q.text("data = ");
12837 q.pp(self.data)
12838 q.breakable()
12839 q.text('}')
12840
12841error_msg.subtypes[12] = meter_mod_failed_error_msg
12842
12843class meter_stats_reply(stats_reply):
12844 version = 5
12845 type = 19
12846 stats_type = 9
12847
12848 def __init__(self, xid=None, flags=None, entries=None):
12849 if xid != None:
12850 self.xid = xid
12851 else:
12852 self.xid = None
12853 if flags != None:
12854 self.flags = flags
12855 else:
12856 self.flags = 0
12857 if entries != None:
12858 self.entries = entries
12859 else:
12860 self.entries = []
12861 return
12862
12863 def pack(self):
12864 packed = []
12865 packed.append(struct.pack("!B", self.version))
12866 packed.append(struct.pack("!B", self.type))
12867 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12868 packed.append(struct.pack("!L", self.xid))
12869 packed.append(struct.pack("!H", self.stats_type))
12870 packed.append(struct.pack("!H", self.flags))
12871 packed.append('\x00' * 4)
12872 packed.append(loxi.generic_util.pack_list(self.entries))
12873 length = sum([len(x) for x in packed])
12874 packed[2] = struct.pack("!H", length)
12875 return ''.join(packed)
12876
12877 @staticmethod
12878 def unpack(reader):
12879 obj = meter_stats_reply()
12880 _version = reader.read("!B")[0]
12881 assert(_version == 5)
12882 _type = reader.read("!B")[0]
12883 assert(_type == 19)
12884 _length = reader.read("!H")[0]
12885 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012886 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012887 obj.xid = reader.read("!L")[0]
12888 _stats_type = reader.read("!H")[0]
12889 assert(_stats_type == 9)
12890 obj.flags = reader.read("!H")[0]
12891 reader.skip(4)
12892 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
12893 return obj
12894
12895 def __eq__(self, other):
12896 if type(self) != type(other): return False
12897 if self.xid != other.xid: return False
12898 if self.flags != other.flags: return False
12899 if self.entries != other.entries: return False
12900 return True
12901
12902 def pretty_print(self, q):
12903 q.text("meter_stats_reply {")
12904 with q.group():
12905 with q.indent(2):
12906 q.breakable()
12907 q.text("xid = ");
12908 if self.xid != None:
12909 q.text("%#x" % self.xid)
12910 else:
12911 q.text('None')
12912 q.text(","); q.breakable()
12913 q.text("flags = ");
12914 q.text("%#x" % self.flags)
12915 q.text(","); q.breakable()
12916 q.text("entries = ");
12917 q.pp(self.entries)
12918 q.breakable()
12919 q.text('}')
12920
12921stats_reply.subtypes[9] = meter_stats_reply
12922
12923class meter_stats_request(stats_request):
12924 version = 5
12925 type = 18
12926 stats_type = 9
12927
12928 def __init__(self, xid=None, flags=None, meter_id=None):
12929 if xid != None:
12930 self.xid = xid
12931 else:
12932 self.xid = None
12933 if flags != None:
12934 self.flags = flags
12935 else:
12936 self.flags = 0
12937 if meter_id != None:
12938 self.meter_id = meter_id
12939 else:
12940 self.meter_id = 0
12941 return
12942
12943 def pack(self):
12944 packed = []
12945 packed.append(struct.pack("!B", self.version))
12946 packed.append(struct.pack("!B", self.type))
12947 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12948 packed.append(struct.pack("!L", self.xid))
12949 packed.append(struct.pack("!H", self.stats_type))
12950 packed.append(struct.pack("!H", self.flags))
12951 packed.append('\x00' * 4)
12952 packed.append(struct.pack("!L", self.meter_id))
12953 packed.append('\x00' * 4)
12954 length = sum([len(x) for x in packed])
12955 packed[2] = struct.pack("!H", length)
12956 return ''.join(packed)
12957
12958 @staticmethod
12959 def unpack(reader):
12960 obj = meter_stats_request()
12961 _version = reader.read("!B")[0]
12962 assert(_version == 5)
12963 _type = reader.read("!B")[0]
12964 assert(_type == 18)
12965 _length = reader.read("!H")[0]
12966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012967 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012968 obj.xid = reader.read("!L")[0]
12969 _stats_type = reader.read("!H")[0]
12970 assert(_stats_type == 9)
12971 obj.flags = reader.read("!H")[0]
12972 reader.skip(4)
12973 obj.meter_id = reader.read("!L")[0]
12974 reader.skip(4)
12975 return obj
12976
12977 def __eq__(self, other):
12978 if type(self) != type(other): return False
12979 if self.xid != other.xid: return False
12980 if self.flags != other.flags: return False
12981 if self.meter_id != other.meter_id: return False
12982 return True
12983
12984 def pretty_print(self, q):
12985 q.text("meter_stats_request {")
12986 with q.group():
12987 with q.indent(2):
12988 q.breakable()
12989 q.text("xid = ");
12990 if self.xid != None:
12991 q.text("%#x" % self.xid)
12992 else:
12993 q.text('None')
12994 q.text(","); q.breakable()
12995 q.text("flags = ");
12996 q.text("%#x" % self.flags)
12997 q.text(","); q.breakable()
12998 q.text("meter_id = ");
12999 q.text("%#x" % self.meter_id)
13000 q.breakable()
13001 q.text('}')
13002
13003stats_request.subtypes[9] = meter_stats_request
13004
13005class nicira_header(experimenter):
13006 subtypes = {}
13007
13008 version = 5
13009 type = 4
13010 experimenter = 8992
13011
13012 def __init__(self, xid=None, subtype=None):
13013 if xid != None:
13014 self.xid = xid
13015 else:
13016 self.xid = None
13017 if subtype != None:
13018 self.subtype = subtype
13019 else:
13020 self.subtype = 0
13021 return
13022
13023 def pack(self):
13024 packed = []
13025 packed.append(struct.pack("!B", self.version))
13026 packed.append(struct.pack("!B", self.type))
13027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13028 packed.append(struct.pack("!L", self.xid))
13029 packed.append(struct.pack("!L", self.experimenter))
13030 packed.append(struct.pack("!L", self.subtype))
13031 length = sum([len(x) for x in packed])
13032 packed[2] = struct.pack("!H", length)
13033 return ''.join(packed)
13034
13035 @staticmethod
13036 def unpack(reader):
13037 subtype, = reader.peek('!L', 12)
13038 subclass = nicira_header.subtypes.get(subtype)
13039 if subclass:
13040 return subclass.unpack(reader)
13041
13042 obj = nicira_header()
13043 _version = reader.read("!B")[0]
13044 assert(_version == 5)
13045 _type = reader.read("!B")[0]
13046 assert(_type == 4)
13047 _length = reader.read("!H")[0]
13048 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013049 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013050 obj.xid = reader.read("!L")[0]
13051 _experimenter = reader.read("!L")[0]
13052 assert(_experimenter == 8992)
13053 obj.subtype = reader.read("!L")[0]
13054 return obj
13055
13056 def __eq__(self, other):
13057 if type(self) != type(other): return False
13058 if self.xid != other.xid: return False
13059 if self.subtype != other.subtype: return False
13060 return True
13061
13062 def pretty_print(self, q):
13063 q.text("nicira_header {")
13064 with q.group():
13065 with q.indent(2):
13066 q.breakable()
13067 q.text("xid = ");
13068 if self.xid != None:
13069 q.text("%#x" % self.xid)
13070 else:
13071 q.text('None')
13072 q.breakable()
13073 q.text('}')
13074
13075experimenter.subtypes[8992] = nicira_header
13076
13077class packet_in(message):
13078 version = 5
13079 type = 10
13080
13081 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13082 if xid != None:
13083 self.xid = xid
13084 else:
13085 self.xid = None
13086 if buffer_id != None:
13087 self.buffer_id = buffer_id
13088 else:
13089 self.buffer_id = 0
13090 if total_len != None:
13091 self.total_len = total_len
13092 else:
13093 self.total_len = 0
13094 if reason != None:
13095 self.reason = reason
13096 else:
13097 self.reason = 0
13098 if table_id != None:
13099 self.table_id = table_id
13100 else:
13101 self.table_id = 0
13102 if cookie != None:
13103 self.cookie = cookie
13104 else:
13105 self.cookie = 0
13106 if match != None:
13107 self.match = match
13108 else:
13109 self.match = common.match()
13110 if data != None:
13111 self.data = data
13112 else:
13113 self.data = ''
13114 return
13115
13116 def pack(self):
13117 packed = []
13118 packed.append(struct.pack("!B", self.version))
13119 packed.append(struct.pack("!B", self.type))
13120 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13121 packed.append(struct.pack("!L", self.xid))
13122 packed.append(struct.pack("!L", self.buffer_id))
13123 packed.append(struct.pack("!H", self.total_len))
13124 packed.append(struct.pack("!B", self.reason))
13125 packed.append(struct.pack("!B", self.table_id))
13126 packed.append(struct.pack("!Q", self.cookie))
13127 packed.append(self.match.pack())
13128 packed.append('\x00' * 2)
13129 packed.append(self.data)
13130 length = sum([len(x) for x in packed])
13131 packed[2] = struct.pack("!H", length)
13132 return ''.join(packed)
13133
13134 @staticmethod
13135 def unpack(reader):
13136 obj = packet_in()
13137 _version = reader.read("!B")[0]
13138 assert(_version == 5)
13139 _type = reader.read("!B")[0]
13140 assert(_type == 10)
13141 _length = reader.read("!H")[0]
13142 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013143 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013144 obj.xid = reader.read("!L")[0]
13145 obj.buffer_id = reader.read("!L")[0]
13146 obj.total_len = reader.read("!H")[0]
13147 obj.reason = reader.read("!B")[0]
13148 obj.table_id = reader.read("!B")[0]
13149 obj.cookie = reader.read("!Q")[0]
13150 obj.match = common.match.unpack(reader)
13151 reader.skip(2)
13152 obj.data = str(reader.read_all())
13153 return obj
13154
13155 def __eq__(self, other):
13156 if type(self) != type(other): return False
13157 if self.xid != other.xid: return False
13158 if self.buffer_id != other.buffer_id: return False
13159 if self.total_len != other.total_len: return False
13160 if self.reason != other.reason: return False
13161 if self.table_id != other.table_id: return False
13162 if self.cookie != other.cookie: return False
13163 if self.match != other.match: return False
13164 if self.data != other.data: return False
13165 return True
13166
13167 def pretty_print(self, q):
13168 q.text("packet_in {")
13169 with q.group():
13170 with q.indent(2):
13171 q.breakable()
13172 q.text("xid = ");
13173 if self.xid != None:
13174 q.text("%#x" % self.xid)
13175 else:
13176 q.text('None')
13177 q.text(","); q.breakable()
13178 q.text("buffer_id = ");
13179 q.text("%#x" % self.buffer_id)
13180 q.text(","); q.breakable()
13181 q.text("total_len = ");
13182 q.text("%#x" % self.total_len)
13183 q.text(","); q.breakable()
13184 q.text("reason = ");
13185 q.text("%#x" % self.reason)
13186 q.text(","); q.breakable()
13187 q.text("table_id = ");
13188 q.text("%#x" % self.table_id)
13189 q.text(","); q.breakable()
13190 q.text("cookie = ");
13191 q.text("%#x" % self.cookie)
13192 q.text(","); q.breakable()
13193 q.text("match = ");
13194 q.pp(self.match)
13195 q.text(","); q.breakable()
13196 q.text("data = ");
13197 q.pp(self.data)
13198 q.breakable()
13199 q.text('}')
13200
13201message.subtypes[10] = packet_in
13202
13203class packet_out(message):
13204 version = 5
13205 type = 13
13206
13207 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13208 if xid != None:
13209 self.xid = xid
13210 else:
13211 self.xid = None
13212 if buffer_id != None:
13213 self.buffer_id = buffer_id
13214 else:
13215 self.buffer_id = 0
13216 if in_port != None:
13217 self.in_port = in_port
13218 else:
13219 self.in_port = 0
13220 if actions != None:
13221 self.actions = actions
13222 else:
13223 self.actions = []
13224 if data != None:
13225 self.data = data
13226 else:
13227 self.data = ''
13228 return
13229
13230 def pack(self):
13231 packed = []
13232 packed.append(struct.pack("!B", self.version))
13233 packed.append(struct.pack("!B", self.type))
13234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13235 packed.append(struct.pack("!L", self.xid))
13236 packed.append(struct.pack("!L", self.buffer_id))
13237 packed.append(util.pack_port_no(self.in_port))
13238 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13239 packed.append('\x00' * 6)
13240 packed.append(loxi.generic_util.pack_list(self.actions))
13241 packed[6] = struct.pack("!H", len(packed[-1]))
13242 packed.append(self.data)
13243 length = sum([len(x) for x in packed])
13244 packed[2] = struct.pack("!H", length)
13245 return ''.join(packed)
13246
13247 @staticmethod
13248 def unpack(reader):
13249 obj = packet_out()
13250 _version = reader.read("!B")[0]
13251 assert(_version == 5)
13252 _type = reader.read("!B")[0]
13253 assert(_type == 13)
13254 _length = reader.read("!H")[0]
13255 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013256 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013257 obj.xid = reader.read("!L")[0]
13258 obj.buffer_id = reader.read("!L")[0]
13259 obj.in_port = util.unpack_port_no(reader)
13260 _actions_len = reader.read("!H")[0]
13261 reader.skip(6)
13262 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
13263 obj.data = str(reader.read_all())
13264 return obj
13265
13266 def __eq__(self, other):
13267 if type(self) != type(other): return False
13268 if self.xid != other.xid: return False
13269 if self.buffer_id != other.buffer_id: return False
13270 if self.in_port != other.in_port: return False
13271 if self.actions != other.actions: return False
13272 if self.data != other.data: return False
13273 return True
13274
13275 def pretty_print(self, q):
13276 q.text("packet_out {")
13277 with q.group():
13278 with q.indent(2):
13279 q.breakable()
13280 q.text("xid = ");
13281 if self.xid != None:
13282 q.text("%#x" % self.xid)
13283 else:
13284 q.text('None')
13285 q.text(","); q.breakable()
13286 q.text("buffer_id = ");
13287 q.text("%#x" % self.buffer_id)
13288 q.text(","); q.breakable()
13289 q.text("in_port = ");
13290 q.text(util.pretty_port(self.in_port))
13291 q.text(","); q.breakable()
13292 q.text("actions = ");
13293 q.pp(self.actions)
13294 q.text(","); q.breakable()
13295 q.text("data = ");
13296 q.pp(self.data)
13297 q.breakable()
13298 q.text('}')
13299
13300message.subtypes[13] = packet_out
13301
13302class port_desc_stats_reply(stats_reply):
13303 version = 5
13304 type = 19
13305 stats_type = 13
13306
13307 def __init__(self, xid=None, flags=None, entries=None):
13308 if xid != None:
13309 self.xid = xid
13310 else:
13311 self.xid = None
13312 if flags != None:
13313 self.flags = flags
13314 else:
13315 self.flags = 0
13316 if entries != None:
13317 self.entries = entries
13318 else:
13319 self.entries = []
13320 return
13321
13322 def pack(self):
13323 packed = []
13324 packed.append(struct.pack("!B", self.version))
13325 packed.append(struct.pack("!B", self.type))
13326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13327 packed.append(struct.pack("!L", self.xid))
13328 packed.append(struct.pack("!H", self.stats_type))
13329 packed.append(struct.pack("!H", self.flags))
13330 packed.append('\x00' * 4)
13331 packed.append(loxi.generic_util.pack_list(self.entries))
13332 length = sum([len(x) for x in packed])
13333 packed[2] = struct.pack("!H", length)
13334 return ''.join(packed)
13335
13336 @staticmethod
13337 def unpack(reader):
13338 obj = port_desc_stats_reply()
13339 _version = reader.read("!B")[0]
13340 assert(_version == 5)
13341 _type = reader.read("!B")[0]
13342 assert(_type == 19)
13343 _length = reader.read("!H")[0]
13344 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013345 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013346 obj.xid = reader.read("!L")[0]
13347 _stats_type = reader.read("!H")[0]
13348 assert(_stats_type == 13)
13349 obj.flags = reader.read("!H")[0]
13350 reader.skip(4)
13351 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
13352 return obj
13353
13354 def __eq__(self, other):
13355 if type(self) != type(other): return False
13356 if self.xid != other.xid: return False
13357 if self.flags != other.flags: return False
13358 if self.entries != other.entries: return False
13359 return True
13360
13361 def pretty_print(self, q):
13362 q.text("port_desc_stats_reply {")
13363 with q.group():
13364 with q.indent(2):
13365 q.breakable()
13366 q.text("xid = ");
13367 if self.xid != None:
13368 q.text("%#x" % self.xid)
13369 else:
13370 q.text('None')
13371 q.text(","); q.breakable()
13372 q.text("flags = ");
13373 q.text("%#x" % self.flags)
13374 q.text(","); q.breakable()
13375 q.text("entries = ");
13376 q.pp(self.entries)
13377 q.breakable()
13378 q.text('}')
13379
13380stats_reply.subtypes[13] = port_desc_stats_reply
13381
13382class port_desc_stats_request(stats_request):
13383 version = 5
13384 type = 18
13385 stats_type = 13
13386
13387 def __init__(self, xid=None, flags=None):
13388 if xid != None:
13389 self.xid = xid
13390 else:
13391 self.xid = None
13392 if flags != None:
13393 self.flags = flags
13394 else:
13395 self.flags = 0
13396 return
13397
13398 def pack(self):
13399 packed = []
13400 packed.append(struct.pack("!B", self.version))
13401 packed.append(struct.pack("!B", self.type))
13402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13403 packed.append(struct.pack("!L", self.xid))
13404 packed.append(struct.pack("!H", self.stats_type))
13405 packed.append(struct.pack("!H", self.flags))
13406 packed.append('\x00' * 4)
13407 length = sum([len(x) for x in packed])
13408 packed[2] = struct.pack("!H", length)
13409 return ''.join(packed)
13410
13411 @staticmethod
13412 def unpack(reader):
13413 obj = port_desc_stats_request()
13414 _version = reader.read("!B")[0]
13415 assert(_version == 5)
13416 _type = reader.read("!B")[0]
13417 assert(_type == 18)
13418 _length = reader.read("!H")[0]
13419 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013420 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013421 obj.xid = reader.read("!L")[0]
13422 _stats_type = reader.read("!H")[0]
13423 assert(_stats_type == 13)
13424 obj.flags = reader.read("!H")[0]
13425 reader.skip(4)
13426 return obj
13427
13428 def __eq__(self, other):
13429 if type(self) != type(other): return False
13430 if self.xid != other.xid: return False
13431 if self.flags != other.flags: return False
13432 return True
13433
13434 def pretty_print(self, q):
13435 q.text("port_desc_stats_request {")
13436 with q.group():
13437 with q.indent(2):
13438 q.breakable()
13439 q.text("xid = ");
13440 if self.xid != None:
13441 q.text("%#x" % self.xid)
13442 else:
13443 q.text('None')
13444 q.text(","); q.breakable()
13445 q.text("flags = ");
13446 q.text("%#x" % self.flags)
13447 q.breakable()
13448 q.text('}')
13449
13450stats_request.subtypes[13] = port_desc_stats_request
13451
13452class port_mod(message):
13453 version = 5
13454 type = 16
13455
13456 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
13457 if xid != None:
13458 self.xid = xid
13459 else:
13460 self.xid = None
13461 if port_no != None:
13462 self.port_no = port_no
13463 else:
13464 self.port_no = 0
13465 if hw_addr != None:
13466 self.hw_addr = hw_addr
13467 else:
13468 self.hw_addr = [0,0,0,0,0,0]
13469 if config != None:
13470 self.config = config
13471 else:
13472 self.config = 0
13473 if mask != None:
13474 self.mask = mask
13475 else:
13476 self.mask = 0
13477 if properties != None:
13478 self.properties = properties
13479 else:
13480 self.properties = []
13481 return
13482
13483 def pack(self):
13484 packed = []
13485 packed.append(struct.pack("!B", self.version))
13486 packed.append(struct.pack("!B", self.type))
13487 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13488 packed.append(struct.pack("!L", self.xid))
13489 packed.append(util.pack_port_no(self.port_no))
13490 packed.append('\x00' * 4)
13491 packed.append(struct.pack("!6B", *self.hw_addr))
13492 packed.append('\x00' * 2)
13493 packed.append(struct.pack("!L", self.config))
13494 packed.append(struct.pack("!L", self.mask))
13495 packed.append(loxi.generic_util.pack_list(self.properties))
13496 length = sum([len(x) for x in packed])
13497 packed[2] = struct.pack("!H", length)
13498 return ''.join(packed)
13499
13500 @staticmethod
13501 def unpack(reader):
13502 obj = port_mod()
13503 _version = reader.read("!B")[0]
13504 assert(_version == 5)
13505 _type = reader.read("!B")[0]
13506 assert(_type == 16)
13507 _length = reader.read("!H")[0]
13508 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013509 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013510 obj.xid = reader.read("!L")[0]
13511 obj.port_no = util.unpack_port_no(reader)
13512 reader.skip(4)
13513 obj.hw_addr = list(reader.read('!6B'))
13514 reader.skip(2)
13515 obj.config = reader.read("!L")[0]
13516 obj.mask = reader.read("!L")[0]
13517 obj.properties = loxi.generic_util.unpack_list(reader, port_mod_prop.port_mod_prop.unpack)
13518 return obj
13519
13520 def __eq__(self, other):
13521 if type(self) != type(other): return False
13522 if self.xid != other.xid: return False
13523 if self.port_no != other.port_no: return False
13524 if self.hw_addr != other.hw_addr: return False
13525 if self.config != other.config: return False
13526 if self.mask != other.mask: return False
13527 if self.properties != other.properties: return False
13528 return True
13529
13530 def pretty_print(self, q):
13531 q.text("port_mod {")
13532 with q.group():
13533 with q.indent(2):
13534 q.breakable()
13535 q.text("xid = ");
13536 if self.xid != None:
13537 q.text("%#x" % self.xid)
13538 else:
13539 q.text('None')
13540 q.text(","); q.breakable()
13541 q.text("port_no = ");
13542 q.text(util.pretty_port(self.port_no))
13543 q.text(","); q.breakable()
13544 q.text("hw_addr = ");
13545 q.text(util.pretty_mac(self.hw_addr))
13546 q.text(","); q.breakable()
13547 q.text("config = ");
13548 q.text("%#x" % self.config)
13549 q.text(","); q.breakable()
13550 q.text("mask = ");
13551 q.text("%#x" % self.mask)
13552 q.text(","); q.breakable()
13553 q.text("properties = ");
13554 q.pp(self.properties)
13555 q.breakable()
13556 q.text('}')
13557
13558message.subtypes[16] = port_mod
13559
13560class port_mod_failed_error_msg(error_msg):
13561 version = 5
13562 type = 1
13563 err_type = 7
13564
13565 def __init__(self, xid=None, code=None, data=None):
13566 if xid != None:
13567 self.xid = xid
13568 else:
13569 self.xid = None
13570 if code != None:
13571 self.code = code
13572 else:
13573 self.code = 0
13574 if data != None:
13575 self.data = data
13576 else:
13577 self.data = ''
13578 return
13579
13580 def pack(self):
13581 packed = []
13582 packed.append(struct.pack("!B", self.version))
13583 packed.append(struct.pack("!B", self.type))
13584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13585 packed.append(struct.pack("!L", self.xid))
13586 packed.append(struct.pack("!H", self.err_type))
13587 packed.append(struct.pack("!H", self.code))
13588 packed.append(self.data)
13589 length = sum([len(x) for x in packed])
13590 packed[2] = struct.pack("!H", length)
13591 return ''.join(packed)
13592
13593 @staticmethod
13594 def unpack(reader):
13595 obj = port_mod_failed_error_msg()
13596 _version = reader.read("!B")[0]
13597 assert(_version == 5)
13598 _type = reader.read("!B")[0]
13599 assert(_type == 1)
13600 _length = reader.read("!H")[0]
13601 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013602 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013603 obj.xid = reader.read("!L")[0]
13604 _err_type = reader.read("!H")[0]
13605 assert(_err_type == 7)
13606 obj.code = reader.read("!H")[0]
13607 obj.data = str(reader.read_all())
13608 return obj
13609
13610 def __eq__(self, other):
13611 if type(self) != type(other): return False
13612 if self.xid != other.xid: return False
13613 if self.code != other.code: return False
13614 if self.data != other.data: return False
13615 return True
13616
13617 def pretty_print(self, q):
13618 q.text("port_mod_failed_error_msg {")
13619 with q.group():
13620 with q.indent(2):
13621 q.breakable()
13622 q.text("xid = ");
13623 if self.xid != None:
13624 q.text("%#x" % self.xid)
13625 else:
13626 q.text('None')
13627 q.text(","); q.breakable()
13628 q.text("code = ");
13629 q.text("%#x" % self.code)
13630 q.text(","); q.breakable()
13631 q.text("data = ");
13632 q.pp(self.data)
13633 q.breakable()
13634 q.text('}')
13635
13636error_msg.subtypes[7] = port_mod_failed_error_msg
13637
13638class port_stats_reply(stats_reply):
13639 version = 5
13640 type = 19
13641 stats_type = 4
13642
13643 def __init__(self, xid=None, flags=None, entries=None):
13644 if xid != None:
13645 self.xid = xid
13646 else:
13647 self.xid = None
13648 if flags != None:
13649 self.flags = flags
13650 else:
13651 self.flags = 0
13652 if entries != None:
13653 self.entries = entries
13654 else:
13655 self.entries = []
13656 return
13657
13658 def pack(self):
13659 packed = []
13660 packed.append(struct.pack("!B", self.version))
13661 packed.append(struct.pack("!B", self.type))
13662 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13663 packed.append(struct.pack("!L", self.xid))
13664 packed.append(struct.pack("!H", self.stats_type))
13665 packed.append(struct.pack("!H", self.flags))
13666 packed.append('\x00' * 4)
13667 packed.append(loxi.generic_util.pack_list(self.entries))
13668 length = sum([len(x) for x in packed])
13669 packed[2] = struct.pack("!H", length)
13670 return ''.join(packed)
13671
13672 @staticmethod
13673 def unpack(reader):
13674 obj = port_stats_reply()
13675 _version = reader.read("!B")[0]
13676 assert(_version == 5)
13677 _type = reader.read("!B")[0]
13678 assert(_type == 19)
13679 _length = reader.read("!H")[0]
13680 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013681 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013682 obj.xid = reader.read("!L")[0]
13683 _stats_type = reader.read("!H")[0]
13684 assert(_stats_type == 4)
13685 obj.flags = reader.read("!H")[0]
13686 reader.skip(4)
13687 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13688 return obj
13689
13690 def __eq__(self, other):
13691 if type(self) != type(other): return False
13692 if self.xid != other.xid: return False
13693 if self.flags != other.flags: return False
13694 if self.entries != other.entries: return False
13695 return True
13696
13697 def pretty_print(self, q):
13698 q.text("port_stats_reply {")
13699 with q.group():
13700 with q.indent(2):
13701 q.breakable()
13702 q.text("xid = ");
13703 if self.xid != None:
13704 q.text("%#x" % self.xid)
13705 else:
13706 q.text('None')
13707 q.text(","); q.breakable()
13708 q.text("flags = ");
13709 q.text("%#x" % self.flags)
13710 q.text(","); q.breakable()
13711 q.text("entries = ");
13712 q.pp(self.entries)
13713 q.breakable()
13714 q.text('}')
13715
13716stats_reply.subtypes[4] = port_stats_reply
13717
13718class port_stats_request(stats_request):
13719 version = 5
13720 type = 18
13721 stats_type = 4
13722
13723 def __init__(self, xid=None, flags=None, port_no=None):
13724 if xid != None:
13725 self.xid = xid
13726 else:
13727 self.xid = None
13728 if flags != None:
13729 self.flags = flags
13730 else:
13731 self.flags = 0
13732 if port_no != None:
13733 self.port_no = port_no
13734 else:
13735 self.port_no = 0
13736 return
13737
13738 def pack(self):
13739 packed = []
13740 packed.append(struct.pack("!B", self.version))
13741 packed.append(struct.pack("!B", self.type))
13742 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13743 packed.append(struct.pack("!L", self.xid))
13744 packed.append(struct.pack("!H", self.stats_type))
13745 packed.append(struct.pack("!H", self.flags))
13746 packed.append('\x00' * 4)
13747 packed.append(util.pack_port_no(self.port_no))
13748 packed.append('\x00' * 4)
13749 length = sum([len(x) for x in packed])
13750 packed[2] = struct.pack("!H", length)
13751 return ''.join(packed)
13752
13753 @staticmethod
13754 def unpack(reader):
13755 obj = port_stats_request()
13756 _version = reader.read("!B")[0]
13757 assert(_version == 5)
13758 _type = reader.read("!B")[0]
13759 assert(_type == 18)
13760 _length = reader.read("!H")[0]
13761 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013762 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013763 obj.xid = reader.read("!L")[0]
13764 _stats_type = reader.read("!H")[0]
13765 assert(_stats_type == 4)
13766 obj.flags = reader.read("!H")[0]
13767 reader.skip(4)
13768 obj.port_no = util.unpack_port_no(reader)
13769 reader.skip(4)
13770 return obj
13771
13772 def __eq__(self, other):
13773 if type(self) != type(other): return False
13774 if self.xid != other.xid: return False
13775 if self.flags != other.flags: return False
13776 if self.port_no != other.port_no: return False
13777 return True
13778
13779 def pretty_print(self, q):
13780 q.text("port_stats_request {")
13781 with q.group():
13782 with q.indent(2):
13783 q.breakable()
13784 q.text("xid = ");
13785 if self.xid != None:
13786 q.text("%#x" % self.xid)
13787 else:
13788 q.text('None')
13789 q.text(","); q.breakable()
13790 q.text("flags = ");
13791 q.text("%#x" % self.flags)
13792 q.text(","); q.breakable()
13793 q.text("port_no = ");
13794 q.text(util.pretty_port(self.port_no))
13795 q.breakable()
13796 q.text('}')
13797
13798stats_request.subtypes[4] = port_stats_request
13799
13800class port_status(message):
13801 version = 5
13802 type = 12
13803
13804 def __init__(self, xid=None, reason=None, desc=None):
13805 if xid != None:
13806 self.xid = xid
13807 else:
13808 self.xid = None
13809 if reason != None:
13810 self.reason = reason
13811 else:
13812 self.reason = 0
13813 if desc != None:
13814 self.desc = desc
13815 else:
13816 self.desc = common.port_desc()
13817 return
13818
13819 def pack(self):
13820 packed = []
13821 packed.append(struct.pack("!B", self.version))
13822 packed.append(struct.pack("!B", self.type))
13823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13824 packed.append(struct.pack("!L", self.xid))
13825 packed.append(struct.pack("!B", self.reason))
13826 packed.append('\x00' * 7)
13827 packed.append(self.desc.pack())
13828 length = sum([len(x) for x in packed])
13829 packed[2] = struct.pack("!H", length)
13830 return ''.join(packed)
13831
13832 @staticmethod
13833 def unpack(reader):
13834 obj = port_status()
13835 _version = reader.read("!B")[0]
13836 assert(_version == 5)
13837 _type = reader.read("!B")[0]
13838 assert(_type == 12)
13839 _length = reader.read("!H")[0]
13840 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013841 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013842 obj.xid = reader.read("!L")[0]
13843 obj.reason = reader.read("!B")[0]
13844 reader.skip(7)
13845 obj.desc = common.port_desc.unpack(reader)
13846 return obj
13847
13848 def __eq__(self, other):
13849 if type(self) != type(other): return False
13850 if self.xid != other.xid: return False
13851 if self.reason != other.reason: return False
13852 if self.desc != other.desc: return False
13853 return True
13854
13855 def pretty_print(self, q):
13856 q.text("port_status {")
13857 with q.group():
13858 with q.indent(2):
13859 q.breakable()
13860 q.text("xid = ");
13861 if self.xid != None:
13862 q.text("%#x" % self.xid)
13863 else:
13864 q.text('None')
13865 q.text(","); q.breakable()
13866 q.text("reason = ");
13867 q.text("%#x" % self.reason)
13868 q.text(","); q.breakable()
13869 q.text("desc = ");
13870 q.pp(self.desc)
13871 q.breakable()
13872 q.text('}')
13873
13874message.subtypes[12] = port_status
13875
13876class queue_desc_stats_reply(stats_reply):
13877 version = 5
13878 type = 19
13879 stats_type = 15
13880
13881 def __init__(self, xid=None, flags=None, entries=None):
13882 if xid != None:
13883 self.xid = xid
13884 else:
13885 self.xid = None
13886 if flags != None:
13887 self.flags = flags
13888 else:
13889 self.flags = 0
13890 if entries != None:
13891 self.entries = entries
13892 else:
13893 self.entries = []
13894 return
13895
13896 def pack(self):
13897 packed = []
13898 packed.append(struct.pack("!B", self.version))
13899 packed.append(struct.pack("!B", self.type))
13900 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13901 packed.append(struct.pack("!L", self.xid))
13902 packed.append(struct.pack("!H", self.stats_type))
13903 packed.append(struct.pack("!H", self.flags))
13904 packed.append('\x00' * 4)
13905 packed.append(loxi.generic_util.pack_list(self.entries))
13906 length = sum([len(x) for x in packed])
13907 packed[2] = struct.pack("!H", length)
13908 return ''.join(packed)
13909
13910 @staticmethod
13911 def unpack(reader):
13912 obj = queue_desc_stats_reply()
13913 _version = reader.read("!B")[0]
13914 assert(_version == 5)
13915 _type = reader.read("!B")[0]
13916 assert(_type == 19)
13917 _length = reader.read("!H")[0]
13918 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013919 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013920 obj.xid = reader.read("!L")[0]
13921 _stats_type = reader.read("!H")[0]
13922 assert(_stats_type == 15)
13923 obj.flags = reader.read("!H")[0]
13924 reader.skip(4)
13925 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_desc.unpack)
13926 return obj
13927
13928 def __eq__(self, other):
13929 if type(self) != type(other): return False
13930 if self.xid != other.xid: return False
13931 if self.flags != other.flags: return False
13932 if self.entries != other.entries: return False
13933 return True
13934
13935 def pretty_print(self, q):
13936 q.text("queue_desc_stats_reply {")
13937 with q.group():
13938 with q.indent(2):
13939 q.breakable()
13940 q.text("xid = ");
13941 if self.xid != None:
13942 q.text("%#x" % self.xid)
13943 else:
13944 q.text('None')
13945 q.text(","); q.breakable()
13946 q.text("flags = ");
13947 q.text("%#x" % self.flags)
13948 q.text(","); q.breakable()
13949 q.text("entries = ");
13950 q.pp(self.entries)
13951 q.breakable()
13952 q.text('}')
13953
13954stats_reply.subtypes[15] = queue_desc_stats_reply
13955
13956class queue_desc_stats_request(stats_request):
13957 version = 5
13958 type = 18
13959 stats_type = 15
13960
13961 def __init__(self, xid=None, flags=None):
13962 if xid != None:
13963 self.xid = xid
13964 else:
13965 self.xid = None
13966 if flags != None:
13967 self.flags = flags
13968 else:
13969 self.flags = 0
13970 return
13971
13972 def pack(self):
13973 packed = []
13974 packed.append(struct.pack("!B", self.version))
13975 packed.append(struct.pack("!B", self.type))
13976 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13977 packed.append(struct.pack("!L", self.xid))
13978 packed.append(struct.pack("!H", self.stats_type))
13979 packed.append(struct.pack("!H", self.flags))
13980 packed.append('\x00' * 4)
13981 length = sum([len(x) for x in packed])
13982 packed[2] = struct.pack("!H", length)
13983 return ''.join(packed)
13984
13985 @staticmethod
13986 def unpack(reader):
13987 obj = queue_desc_stats_request()
13988 _version = reader.read("!B")[0]
13989 assert(_version == 5)
13990 _type = reader.read("!B")[0]
13991 assert(_type == 18)
13992 _length = reader.read("!H")[0]
13993 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013994 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013995 obj.xid = reader.read("!L")[0]
13996 _stats_type = reader.read("!H")[0]
13997 assert(_stats_type == 15)
13998 obj.flags = reader.read("!H")[0]
13999 reader.skip(4)
14000 return obj
14001
14002 def __eq__(self, other):
14003 if type(self) != type(other): return False
14004 if self.xid != other.xid: return False
14005 if self.flags != other.flags: return False
14006 return True
14007
14008 def pretty_print(self, q):
14009 q.text("queue_desc_stats_request {")
14010 with q.group():
14011 with q.indent(2):
14012 q.breakable()
14013 q.text("xid = ");
14014 if self.xid != None:
14015 q.text("%#x" % self.xid)
14016 else:
14017 q.text('None')
14018 q.text(","); q.breakable()
14019 q.text("flags = ");
14020 q.text("%#x" % self.flags)
14021 q.breakable()
14022 q.text('}')
14023
14024stats_request.subtypes[15] = queue_desc_stats_request
14025
14026class queue_op_failed_error_msg(error_msg):
14027 version = 5
14028 type = 1
14029 err_type = 9
14030
14031 def __init__(self, xid=None, code=None, data=None):
14032 if xid != None:
14033 self.xid = xid
14034 else:
14035 self.xid = None
14036 if code != None:
14037 self.code = code
14038 else:
14039 self.code = 0
14040 if data != None:
14041 self.data = data
14042 else:
14043 self.data = ''
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.err_type))
14053 packed.append(struct.pack("!H", self.code))
14054 packed.append(self.data)
14055 length = sum([len(x) for x in packed])
14056 packed[2] = struct.pack("!H", length)
14057 return ''.join(packed)
14058
14059 @staticmethod
14060 def unpack(reader):
14061 obj = queue_op_failed_error_msg()
14062 _version = reader.read("!B")[0]
14063 assert(_version == 5)
14064 _type = reader.read("!B")[0]
14065 assert(_type == 1)
14066 _length = reader.read("!H")[0]
14067 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014068 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014069 obj.xid = reader.read("!L")[0]
14070 _err_type = reader.read("!H")[0]
14071 assert(_err_type == 9)
14072 obj.code = reader.read("!H")[0]
14073 obj.data = str(reader.read_all())
14074 return obj
14075
14076 def __eq__(self, other):
14077 if type(self) != type(other): return False
14078 if self.xid != other.xid: return False
14079 if self.code != other.code: return False
14080 if self.data != other.data: return False
14081 return True
14082
14083 def pretty_print(self, q):
14084 q.text("queue_op_failed_error_msg {")
14085 with q.group():
14086 with q.indent(2):
14087 q.breakable()
14088 q.text("xid = ");
14089 if self.xid != None:
14090 q.text("%#x" % self.xid)
14091 else:
14092 q.text('None')
14093 q.text(","); q.breakable()
14094 q.text("code = ");
14095 q.text("%#x" % self.code)
14096 q.text(","); q.breakable()
14097 q.text("data = ");
14098 q.pp(self.data)
14099 q.breakable()
14100 q.text('}')
14101
14102error_msg.subtypes[9] = queue_op_failed_error_msg
14103
14104class queue_stats_reply(stats_reply):
14105 version = 5
14106 type = 19
14107 stats_type = 5
14108
14109 def __init__(self, xid=None, flags=None, entries=None):
14110 if xid != None:
14111 self.xid = xid
14112 else:
14113 self.xid = None
14114 if flags != None:
14115 self.flags = flags
14116 else:
14117 self.flags = 0
14118 if entries != None:
14119 self.entries = entries
14120 else:
14121 self.entries = []
14122 return
14123
14124 def pack(self):
14125 packed = []
14126 packed.append(struct.pack("!B", self.version))
14127 packed.append(struct.pack("!B", self.type))
14128 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14129 packed.append(struct.pack("!L", self.xid))
14130 packed.append(struct.pack("!H", self.stats_type))
14131 packed.append(struct.pack("!H", self.flags))
14132 packed.append('\x00' * 4)
14133 packed.append(loxi.generic_util.pack_list(self.entries))
14134 length = sum([len(x) for x in packed])
14135 packed[2] = struct.pack("!H", length)
14136 return ''.join(packed)
14137
14138 @staticmethod
14139 def unpack(reader):
14140 obj = queue_stats_reply()
14141 _version = reader.read("!B")[0]
14142 assert(_version == 5)
14143 _type = reader.read("!B")[0]
14144 assert(_type == 19)
14145 _length = reader.read("!H")[0]
14146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014147 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014148 obj.xid = reader.read("!L")[0]
14149 _stats_type = reader.read("!H")[0]
14150 assert(_stats_type == 5)
14151 obj.flags = reader.read("!H")[0]
14152 reader.skip(4)
14153 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
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.flags != other.flags: return False
14160 if self.entries != other.entries: return False
14161 return True
14162
14163 def pretty_print(self, q):
14164 q.text("queue_stats_reply {")
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("flags = ");
14175 q.text("%#x" % self.flags)
14176 q.text(","); q.breakable()
14177 q.text("entries = ");
14178 q.pp(self.entries)
14179 q.breakable()
14180 q.text('}')
14181
14182stats_reply.subtypes[5] = queue_stats_reply
14183
14184class queue_stats_request(stats_request):
14185 version = 5
14186 type = 18
14187 stats_type = 5
14188
14189 def __init__(self, xid=None, flags=None, port_no=None, queue_id=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 port_no != None:
14199 self.port_no = port_no
14200 else:
14201 self.port_no = 0
14202 if queue_id != None:
14203 self.queue_id = queue_id
14204 else:
14205 self.queue_id = 0
14206 return
14207
14208 def pack(self):
14209 packed = []
14210 packed.append(struct.pack("!B", self.version))
14211 packed.append(struct.pack("!B", self.type))
14212 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14213 packed.append(struct.pack("!L", self.xid))
14214 packed.append(struct.pack("!H", self.stats_type))
14215 packed.append(struct.pack("!H", self.flags))
14216 packed.append('\x00' * 4)
14217 packed.append(util.pack_port_no(self.port_no))
14218 packed.append(struct.pack("!L", self.queue_id))
14219 length = sum([len(x) for x in packed])
14220 packed[2] = struct.pack("!H", length)
14221 return ''.join(packed)
14222
14223 @staticmethod
14224 def unpack(reader):
14225 obj = queue_stats_request()
14226 _version = reader.read("!B")[0]
14227 assert(_version == 5)
14228 _type = reader.read("!B")[0]
14229 assert(_type == 18)
14230 _length = reader.read("!H")[0]
14231 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014232 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014233 obj.xid = reader.read("!L")[0]
14234 _stats_type = reader.read("!H")[0]
14235 assert(_stats_type == 5)
14236 obj.flags = reader.read("!H")[0]
14237 reader.skip(4)
14238 obj.port_no = util.unpack_port_no(reader)
14239 obj.queue_id = reader.read("!L")[0]
14240 return obj
14241
14242 def __eq__(self, other):
14243 if type(self) != type(other): return False
14244 if self.xid != other.xid: return False
14245 if self.flags != other.flags: return False
14246 if self.port_no != other.port_no: return False
14247 if self.queue_id != other.queue_id: return False
14248 return True
14249
14250 def pretty_print(self, q):
14251 q.text("queue_stats_request {")
14252 with q.group():
14253 with q.indent(2):
14254 q.breakable()
14255 q.text("xid = ");
14256 if self.xid != None:
14257 q.text("%#x" % self.xid)
14258 else:
14259 q.text('None')
14260 q.text(","); q.breakable()
14261 q.text("flags = ");
14262 q.text("%#x" % self.flags)
14263 q.text(","); q.breakable()
14264 q.text("port_no = ");
14265 q.text(util.pretty_port(self.port_no))
14266 q.text(","); q.breakable()
14267 q.text("queue_id = ");
14268 q.text("%#x" % self.queue_id)
14269 q.breakable()
14270 q.text('}')
14271
14272stats_request.subtypes[5] = queue_stats_request
14273
14274class requestforward(message):
14275 version = 5
14276 type = 32
14277
14278 def __init__(self, xid=None, role=None, data=None):
14279 if xid != None:
14280 self.xid = xid
14281 else:
14282 self.xid = None
14283 if role != None:
14284 self.role = role
14285 else:
14286 self.role = 0
14287 if data != None:
14288 self.data = data
14289 else:
14290 self.data = ''
14291 return
14292
14293 def pack(self):
14294 packed = []
14295 packed.append(struct.pack("!B", self.version))
14296 packed.append(struct.pack("!B", self.type))
14297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14298 packed.append(struct.pack("!L", self.xid))
14299 packed.append(struct.pack("!L", self.role))
14300 packed.append(self.data)
14301 length = sum([len(x) for x in packed])
14302 packed[2] = struct.pack("!H", length)
14303 return ''.join(packed)
14304
14305 @staticmethod
14306 def unpack(reader):
14307 obj = requestforward()
14308 _version = reader.read("!B")[0]
14309 assert(_version == 5)
14310 _type = reader.read("!B")[0]
14311 assert(_type == 32)
14312 _length = reader.read("!H")[0]
14313 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014314 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014315 obj.xid = reader.read("!L")[0]
14316 obj.role = reader.read("!L")[0]
14317 obj.data = str(reader.read_all())
14318 return obj
14319
14320 def __eq__(self, other):
14321 if type(self) != type(other): return False
14322 if self.xid != other.xid: return False
14323 if self.role != other.role: return False
14324 if self.data != other.data: return False
14325 return True
14326
14327 def pretty_print(self, q):
14328 q.text("requestforward {")
14329 with q.group():
14330 with q.indent(2):
14331 q.breakable()
14332 q.text("xid = ");
14333 if self.xid != None:
14334 q.text("%#x" % self.xid)
14335 else:
14336 q.text('None')
14337 q.text(","); q.breakable()
14338 q.text("role = ");
14339 q.text("%#x" % self.role)
14340 q.text(","); q.breakable()
14341 q.text("data = ");
14342 q.pp(self.data)
14343 q.breakable()
14344 q.text('}')
14345
14346message.subtypes[32] = requestforward
14347
14348class role_reply(message):
14349 version = 5
14350 type = 25
14351
14352 def __init__(self, xid=None, role=None, generation_id=None):
14353 if xid != None:
14354 self.xid = xid
14355 else:
14356 self.xid = None
14357 if role != None:
14358 self.role = role
14359 else:
14360 self.role = 0
14361 if generation_id != None:
14362 self.generation_id = generation_id
14363 else:
14364 self.generation_id = 0
14365 return
14366
14367 def pack(self):
14368 packed = []
14369 packed.append(struct.pack("!B", self.version))
14370 packed.append(struct.pack("!B", self.type))
14371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14372 packed.append(struct.pack("!L", self.xid))
14373 packed.append(struct.pack("!L", self.role))
14374 packed.append('\x00' * 4)
14375 packed.append(struct.pack("!Q", self.generation_id))
14376 length = sum([len(x) for x in packed])
14377 packed[2] = struct.pack("!H", length)
14378 return ''.join(packed)
14379
14380 @staticmethod
14381 def unpack(reader):
14382 obj = role_reply()
14383 _version = reader.read("!B")[0]
14384 assert(_version == 5)
14385 _type = reader.read("!B")[0]
14386 assert(_type == 25)
14387 _length = reader.read("!H")[0]
14388 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014389 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014390 obj.xid = reader.read("!L")[0]
14391 obj.role = reader.read("!L")[0]
14392 reader.skip(4)
14393 obj.generation_id = reader.read("!Q")[0]
14394 return obj
14395
14396 def __eq__(self, other):
14397 if type(self) != type(other): return False
14398 if self.xid != other.xid: return False
14399 if self.role != other.role: return False
14400 if self.generation_id != other.generation_id: return False
14401 return True
14402
14403 def pretty_print(self, q):
14404 q.text("role_reply {")
14405 with q.group():
14406 with q.indent(2):
14407 q.breakable()
14408 q.text("xid = ");
14409 if self.xid != None:
14410 q.text("%#x" % self.xid)
14411 else:
14412 q.text('None')
14413 q.text(","); q.breakable()
14414 q.text("role = ");
14415 q.text("%#x" % self.role)
14416 q.text(","); q.breakable()
14417 q.text("generation_id = ");
14418 q.text("%#x" % self.generation_id)
14419 q.breakable()
14420 q.text('}')
14421
14422message.subtypes[25] = role_reply
14423
14424class role_request(message):
14425 version = 5
14426 type = 24
14427
14428 def __init__(self, xid=None, role=None, generation_id=None):
14429 if xid != None:
14430 self.xid = xid
14431 else:
14432 self.xid = None
14433 if role != None:
14434 self.role = role
14435 else:
14436 self.role = 0
14437 if generation_id != None:
14438 self.generation_id = generation_id
14439 else:
14440 self.generation_id = 0
14441 return
14442
14443 def pack(self):
14444 packed = []
14445 packed.append(struct.pack("!B", self.version))
14446 packed.append(struct.pack("!B", self.type))
14447 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14448 packed.append(struct.pack("!L", self.xid))
14449 packed.append(struct.pack("!L", self.role))
14450 packed.append('\x00' * 4)
14451 packed.append(struct.pack("!Q", self.generation_id))
14452 length = sum([len(x) for x in packed])
14453 packed[2] = struct.pack("!H", length)
14454 return ''.join(packed)
14455
14456 @staticmethod
14457 def unpack(reader):
14458 obj = role_request()
14459 _version = reader.read("!B")[0]
14460 assert(_version == 5)
14461 _type = reader.read("!B")[0]
14462 assert(_type == 24)
14463 _length = reader.read("!H")[0]
14464 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014465 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014466 obj.xid = reader.read("!L")[0]
14467 obj.role = reader.read("!L")[0]
14468 reader.skip(4)
14469 obj.generation_id = reader.read("!Q")[0]
14470 return obj
14471
14472 def __eq__(self, other):
14473 if type(self) != type(other): return False
14474 if self.xid != other.xid: return False
14475 if self.role != other.role: return False
14476 if self.generation_id != other.generation_id: return False
14477 return True
14478
14479 def pretty_print(self, q):
14480 q.text("role_request {")
14481 with q.group():
14482 with q.indent(2):
14483 q.breakable()
14484 q.text("xid = ");
14485 if self.xid != None:
14486 q.text("%#x" % self.xid)
14487 else:
14488 q.text('None')
14489 q.text(","); q.breakable()
14490 q.text("role = ");
14491 q.text("%#x" % self.role)
14492 q.text(","); q.breakable()
14493 q.text("generation_id = ");
14494 q.text("%#x" % self.generation_id)
14495 q.breakable()
14496 q.text('}')
14497
14498message.subtypes[24] = role_request
14499
14500class role_request_failed_error_msg(error_msg):
14501 version = 5
14502 type = 1
14503 err_type = 11
14504
14505 def __init__(self, xid=None, code=None, data=None):
14506 if xid != None:
14507 self.xid = xid
14508 else:
14509 self.xid = None
14510 if code != None:
14511 self.code = code
14512 else:
14513 self.code = 0
14514 if data != None:
14515 self.data = data
14516 else:
14517 self.data = ''
14518 return
14519
14520 def pack(self):
14521 packed = []
14522 packed.append(struct.pack("!B", self.version))
14523 packed.append(struct.pack("!B", self.type))
14524 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14525 packed.append(struct.pack("!L", self.xid))
14526 packed.append(struct.pack("!H", self.err_type))
14527 packed.append(struct.pack("!H", self.code))
14528 packed.append(self.data)
14529 length = sum([len(x) for x in packed])
14530 packed[2] = struct.pack("!H", length)
14531 return ''.join(packed)
14532
14533 @staticmethod
14534 def unpack(reader):
14535 obj = role_request_failed_error_msg()
14536 _version = reader.read("!B")[0]
14537 assert(_version == 5)
14538 _type = reader.read("!B")[0]
14539 assert(_type == 1)
14540 _length = reader.read("!H")[0]
14541 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014542 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014543 obj.xid = reader.read("!L")[0]
14544 _err_type = reader.read("!H")[0]
14545 assert(_err_type == 11)
14546 obj.code = reader.read("!H")[0]
14547 obj.data = str(reader.read_all())
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.code != other.code: return False
14554 if self.data != other.data: return False
14555 return True
14556
14557 def pretty_print(self, q):
14558 q.text("role_request_failed_error_msg {")
14559 with q.group():
14560 with q.indent(2):
14561 q.breakable()
14562 q.text("xid = ");
14563 if self.xid != None:
14564 q.text("%#x" % self.xid)
14565 else:
14566 q.text('None')
14567 q.text(","); q.breakable()
14568 q.text("code = ");
14569 q.text("%#x" % self.code)
14570 q.text(","); q.breakable()
14571 q.text("data = ");
14572 q.pp(self.data)
14573 q.breakable()
14574 q.text('}')
14575
14576error_msg.subtypes[11] = role_request_failed_error_msg
14577
14578class role_status(message):
14579 version = 5
14580 type = 30
14581
14582 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
14583 if xid != None:
14584 self.xid = xid
14585 else:
14586 self.xid = None
14587 if role != None:
14588 self.role = role
14589 else:
14590 self.role = 0
14591 if reason != None:
14592 self.reason = reason
14593 else:
14594 self.reason = 0
14595 if generation_id != None:
14596 self.generation_id = generation_id
14597 else:
14598 self.generation_id = 0
14599 if properties != None:
14600 self.properties = properties
14601 else:
14602 self.properties = []
14603 return
14604
14605 def pack(self):
14606 packed = []
14607 packed.append(struct.pack("!B", self.version))
14608 packed.append(struct.pack("!B", self.type))
14609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14610 packed.append(struct.pack("!L", self.xid))
14611 packed.append(struct.pack("!L", self.role))
14612 packed.append(struct.pack("!B", self.reason))
14613 packed.append('\x00' * 3)
14614 packed.append(struct.pack("!Q", self.generation_id))
14615 packed.append(loxi.generic_util.pack_list(self.properties))
14616 length = sum([len(x) for x in packed])
14617 packed[2] = struct.pack("!H", length)
14618 return ''.join(packed)
14619
14620 @staticmethod
14621 def unpack(reader):
14622 obj = role_status()
14623 _version = reader.read("!B")[0]
14624 assert(_version == 5)
14625 _type = reader.read("!B")[0]
14626 assert(_type == 30)
14627 _length = reader.read("!H")[0]
14628 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014629 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014630 obj.xid = reader.read("!L")[0]
14631 obj.role = reader.read("!L")[0]
14632 obj.reason = reader.read("!B")[0]
14633 reader.skip(3)
14634 obj.generation_id = reader.read("!Q")[0]
14635 obj.properties = loxi.generic_util.unpack_list(reader, role_prop.role_prop.unpack)
14636 return obj
14637
14638 def __eq__(self, other):
14639 if type(self) != type(other): return False
14640 if self.xid != other.xid: return False
14641 if self.role != other.role: return False
14642 if self.reason != other.reason: return False
14643 if self.generation_id != other.generation_id: return False
14644 if self.properties != other.properties: return False
14645 return True
14646
14647 def pretty_print(self, q):
14648 q.text("role_status {")
14649 with q.group():
14650 with q.indent(2):
14651 q.breakable()
14652 q.text("xid = ");
14653 if self.xid != None:
14654 q.text("%#x" % self.xid)
14655 else:
14656 q.text('None')
14657 q.text(","); q.breakable()
14658 q.text("role = ");
14659 q.text("%#x" % self.role)
14660 q.text(","); q.breakable()
14661 q.text("reason = ");
14662 q.text("%#x" % self.reason)
14663 q.text(","); q.breakable()
14664 q.text("generation_id = ");
14665 q.text("%#x" % self.generation_id)
14666 q.text(","); q.breakable()
14667 q.text("properties = ");
14668 q.pp(self.properties)
14669 q.breakable()
14670 q.text('}')
14671
14672message.subtypes[30] = role_status
14673
14674class set_config(message):
14675 version = 5
14676 type = 9
14677
14678 def __init__(self, xid=None, flags=None, miss_send_len=None):
14679 if xid != None:
14680 self.xid = xid
14681 else:
14682 self.xid = None
14683 if flags != None:
14684 self.flags = flags
14685 else:
14686 self.flags = 0
14687 if miss_send_len != None:
14688 self.miss_send_len = miss_send_len
14689 else:
14690 self.miss_send_len = 0
14691 return
14692
14693 def pack(self):
14694 packed = []
14695 packed.append(struct.pack("!B", self.version))
14696 packed.append(struct.pack("!B", self.type))
14697 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14698 packed.append(struct.pack("!L", self.xid))
14699 packed.append(struct.pack("!H", self.flags))
14700 packed.append(struct.pack("!H", self.miss_send_len))
14701 length = sum([len(x) for x in packed])
14702 packed[2] = struct.pack("!H", length)
14703 return ''.join(packed)
14704
14705 @staticmethod
14706 def unpack(reader):
14707 obj = set_config()
14708 _version = reader.read("!B")[0]
14709 assert(_version == 5)
14710 _type = reader.read("!B")[0]
14711 assert(_type == 9)
14712 _length = reader.read("!H")[0]
14713 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014714 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014715 obj.xid = reader.read("!L")[0]
14716 obj.flags = reader.read("!H")[0]
14717 obj.miss_send_len = reader.read("!H")[0]
14718 return obj
14719
14720 def __eq__(self, other):
14721 if type(self) != type(other): return False
14722 if self.xid != other.xid: return False
14723 if self.flags != other.flags: return False
14724 if self.miss_send_len != other.miss_send_len: return False
14725 return True
14726
14727 def pretty_print(self, q):
14728 q.text("set_config {")
14729 with q.group():
14730 with q.indent(2):
14731 q.breakable()
14732 q.text("xid = ");
14733 if self.xid != None:
14734 q.text("%#x" % self.xid)
14735 else:
14736 q.text('None')
14737 q.text(","); q.breakable()
14738 q.text("flags = ");
14739 q.text("%#x" % self.flags)
14740 q.text(","); q.breakable()
14741 q.text("miss_send_len = ");
14742 q.text("%#x" % self.miss_send_len)
14743 q.breakable()
14744 q.text('}')
14745
14746message.subtypes[9] = set_config
14747
14748class switch_config_failed_error_msg(error_msg):
14749 version = 5
14750 type = 1
14751 err_type = 10
14752
14753 def __init__(self, xid=None, code=None, data=None):
14754 if xid != None:
14755 self.xid = xid
14756 else:
14757 self.xid = None
14758 if code != None:
14759 self.code = code
14760 else:
14761 self.code = 0
14762 if data != None:
14763 self.data = data
14764 else:
14765 self.data = ''
14766 return
14767
14768 def pack(self):
14769 packed = []
14770 packed.append(struct.pack("!B", self.version))
14771 packed.append(struct.pack("!B", self.type))
14772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14773 packed.append(struct.pack("!L", self.xid))
14774 packed.append(struct.pack("!H", self.err_type))
14775 packed.append(struct.pack("!H", self.code))
14776 packed.append(self.data)
14777 length = sum([len(x) for x in packed])
14778 packed[2] = struct.pack("!H", length)
14779 return ''.join(packed)
14780
14781 @staticmethod
14782 def unpack(reader):
14783 obj = switch_config_failed_error_msg()
14784 _version = reader.read("!B")[0]
14785 assert(_version == 5)
14786 _type = reader.read("!B")[0]
14787 assert(_type == 1)
14788 _length = reader.read("!H")[0]
14789 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014790 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014791 obj.xid = reader.read("!L")[0]
14792 _err_type = reader.read("!H")[0]
14793 assert(_err_type == 10)
14794 obj.code = reader.read("!H")[0]
14795 obj.data = str(reader.read_all())
14796 return obj
14797
14798 def __eq__(self, other):
14799 if type(self) != type(other): return False
14800 if self.xid != other.xid: return False
14801 if self.code != other.code: return False
14802 if self.data != other.data: return False
14803 return True
14804
14805 def pretty_print(self, q):
14806 q.text("switch_config_failed_error_msg {")
14807 with q.group():
14808 with q.indent(2):
14809 q.breakable()
14810 q.text("xid = ");
14811 if self.xid != None:
14812 q.text("%#x" % self.xid)
14813 else:
14814 q.text('None')
14815 q.text(","); q.breakable()
14816 q.text("code = ");
14817 q.text("%#x" % self.code)
14818 q.text(","); q.breakable()
14819 q.text("data = ");
14820 q.pp(self.data)
14821 q.breakable()
14822 q.text('}')
14823
14824error_msg.subtypes[10] = switch_config_failed_error_msg
14825
14826class table_desc_stats_reply(stats_reply):
14827 version = 5
14828 type = 19
14829 stats_type = 14
14830
14831 def __init__(self, xid=None, flags=None, entries=None):
14832 if xid != None:
14833 self.xid = xid
14834 else:
14835 self.xid = None
14836 if flags != None:
14837 self.flags = flags
14838 else:
14839 self.flags = 0
14840 if entries != None:
14841 self.entries = entries
14842 else:
14843 self.entries = []
14844 return
14845
14846 def pack(self):
14847 packed = []
14848 packed.append(struct.pack("!B", self.version))
14849 packed.append(struct.pack("!B", self.type))
14850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14851 packed.append(struct.pack("!L", self.xid))
14852 packed.append(struct.pack("!H", self.stats_type))
14853 packed.append(struct.pack("!H", self.flags))
14854 packed.append('\x00' * 4)
14855 packed.append(loxi.generic_util.pack_list(self.entries))
14856 length = sum([len(x) for x in packed])
14857 packed[2] = struct.pack("!H", length)
14858 return ''.join(packed)
14859
14860 @staticmethod
14861 def unpack(reader):
14862 obj = table_desc_stats_reply()
14863 _version = reader.read("!B")[0]
14864 assert(_version == 5)
14865 _type = reader.read("!B")[0]
14866 assert(_type == 19)
14867 _length = reader.read("!H")[0]
14868 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014869 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014870 obj.xid = reader.read("!L")[0]
14871 _stats_type = reader.read("!H")[0]
14872 assert(_stats_type == 14)
14873 obj.flags = reader.read("!H")[0]
14874 reader.skip(4)
14875 obj.entries = loxi.generic_util.unpack_list(reader, common.table_desc.unpack)
14876 return obj
14877
14878 def __eq__(self, other):
14879 if type(self) != type(other): return False
14880 if self.xid != other.xid: return False
14881 if self.flags != other.flags: return False
14882 if self.entries != other.entries: return False
14883 return True
14884
14885 def pretty_print(self, q):
14886 q.text("table_desc_stats_reply {")
14887 with q.group():
14888 with q.indent(2):
14889 q.breakable()
14890 q.text("xid = ");
14891 if self.xid != None:
14892 q.text("%#x" % self.xid)
14893 else:
14894 q.text('None')
14895 q.text(","); q.breakable()
14896 q.text("flags = ");
14897 q.text("%#x" % self.flags)
14898 q.text(","); q.breakable()
14899 q.text("entries = ");
14900 q.pp(self.entries)
14901 q.breakable()
14902 q.text('}')
14903
14904stats_reply.subtypes[14] = table_desc_stats_reply
14905
14906class table_desc_stats_request(stats_request):
14907 version = 5
14908 type = 18
14909 stats_type = 14
14910
14911 def __init__(self, xid=None, flags=None):
14912 if xid != None:
14913 self.xid = xid
14914 else:
14915 self.xid = None
14916 if flags != None:
14917 self.flags = flags
14918 else:
14919 self.flags = 0
14920 return
14921
14922 def pack(self):
14923 packed = []
14924 packed.append(struct.pack("!B", self.version))
14925 packed.append(struct.pack("!B", self.type))
14926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14927 packed.append(struct.pack("!L", self.xid))
14928 packed.append(struct.pack("!H", self.stats_type))
14929 packed.append(struct.pack("!H", self.flags))
14930 packed.append('\x00' * 4)
14931 length = sum([len(x) for x in packed])
14932 packed[2] = struct.pack("!H", length)
14933 return ''.join(packed)
14934
14935 @staticmethod
14936 def unpack(reader):
14937 obj = table_desc_stats_request()
14938 _version = reader.read("!B")[0]
14939 assert(_version == 5)
14940 _type = reader.read("!B")[0]
14941 assert(_type == 18)
14942 _length = reader.read("!H")[0]
14943 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014944 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014945 obj.xid = reader.read("!L")[0]
14946 _stats_type = reader.read("!H")[0]
14947 assert(_stats_type == 14)
14948 obj.flags = reader.read("!H")[0]
14949 reader.skip(4)
14950 return obj
14951
14952 def __eq__(self, other):
14953 if type(self) != type(other): return False
14954 if self.xid != other.xid: return False
14955 if self.flags != other.flags: return False
14956 return True
14957
14958 def pretty_print(self, q):
14959 q.text("table_desc_stats_request {")
14960 with q.group():
14961 with q.indent(2):
14962 q.breakable()
14963 q.text("xid = ");
14964 if self.xid != None:
14965 q.text("%#x" % self.xid)
14966 else:
14967 q.text('None')
14968 q.text(","); q.breakable()
14969 q.text("flags = ");
14970 q.text("%#x" % self.flags)
14971 q.breakable()
14972 q.text('}')
14973
14974stats_request.subtypes[14] = table_desc_stats_request
14975
14976class table_features_failed_error_msg(error_msg):
14977 version = 5
14978 type = 1
14979 err_type = 13
14980
14981 def __init__(self, xid=None, code=None, data=None):
14982 if xid != None:
14983 self.xid = xid
14984 else:
14985 self.xid = None
14986 if code != None:
14987 self.code = code
14988 else:
14989 self.code = 0
14990 if data != None:
14991 self.data = data
14992 else:
14993 self.data = ''
14994 return
14995
14996 def pack(self):
14997 packed = []
14998 packed.append(struct.pack("!B", self.version))
14999 packed.append(struct.pack("!B", self.type))
15000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15001 packed.append(struct.pack("!L", self.xid))
15002 packed.append(struct.pack("!H", self.err_type))
15003 packed.append(struct.pack("!H", self.code))
15004 packed.append(self.data)
15005 length = sum([len(x) for x in packed])
15006 packed[2] = struct.pack("!H", length)
15007 return ''.join(packed)
15008
15009 @staticmethod
15010 def unpack(reader):
15011 obj = table_features_failed_error_msg()
15012 _version = reader.read("!B")[0]
15013 assert(_version == 5)
15014 _type = reader.read("!B")[0]
15015 assert(_type == 1)
15016 _length = reader.read("!H")[0]
15017 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015018 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015019 obj.xid = reader.read("!L")[0]
15020 _err_type = reader.read("!H")[0]
15021 assert(_err_type == 13)
15022 obj.code = reader.read("!H")[0]
15023 obj.data = str(reader.read_all())
15024 return obj
15025
15026 def __eq__(self, other):
15027 if type(self) != type(other): return False
15028 if self.xid != other.xid: return False
15029 if self.code != other.code: return False
15030 if self.data != other.data: return False
15031 return True
15032
15033 def pretty_print(self, q):
15034 q.text("table_features_failed_error_msg {")
15035 with q.group():
15036 with q.indent(2):
15037 q.breakable()
15038 q.text("xid = ");
15039 if self.xid != None:
15040 q.text("%#x" % self.xid)
15041 else:
15042 q.text('None')
15043 q.text(","); q.breakable()
15044 q.text("code = ");
15045 q.text("%#x" % self.code)
15046 q.text(","); q.breakable()
15047 q.text("data = ");
15048 q.pp(self.data)
15049 q.breakable()
15050 q.text('}')
15051
15052error_msg.subtypes[13] = table_features_failed_error_msg
15053
15054class table_features_stats_reply(stats_reply):
15055 version = 5
15056 type = 19
15057 stats_type = 12
15058
15059 def __init__(self, xid=None, flags=None, entries=None):
15060 if xid != None:
15061 self.xid = xid
15062 else:
15063 self.xid = None
15064 if flags != None:
15065 self.flags = flags
15066 else:
15067 self.flags = 0
15068 if entries != None:
15069 self.entries = entries
15070 else:
15071 self.entries = []
15072 return
15073
15074 def pack(self):
15075 packed = []
15076 packed.append(struct.pack("!B", self.version))
15077 packed.append(struct.pack("!B", self.type))
15078 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15079 packed.append(struct.pack("!L", self.xid))
15080 packed.append(struct.pack("!H", self.stats_type))
15081 packed.append(struct.pack("!H", self.flags))
15082 packed.append('\x00' * 4)
15083 packed.append(loxi.generic_util.pack_list(self.entries))
15084 length = sum([len(x) for x in packed])
15085 packed[2] = struct.pack("!H", length)
15086 return ''.join(packed)
15087
15088 @staticmethod
15089 def unpack(reader):
15090 obj = table_features_stats_reply()
15091 _version = reader.read("!B")[0]
15092 assert(_version == 5)
15093 _type = reader.read("!B")[0]
15094 assert(_type == 19)
15095 _length = reader.read("!H")[0]
15096 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015097 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015098 obj.xid = reader.read("!L")[0]
15099 _stats_type = reader.read("!H")[0]
15100 assert(_stats_type == 12)
15101 obj.flags = reader.read("!H")[0]
15102 reader.skip(4)
15103 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
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.flags != other.flags: return False
15110 if self.entries != other.entries: return False
15111 return True
15112
15113 def pretty_print(self, q):
15114 q.text("table_features_stats_reply {")
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("flags = ");
15125 q.text("%#x" % self.flags)
15126 q.text(","); q.breakable()
15127 q.text("entries = ");
15128 q.pp(self.entries)
15129 q.breakable()
15130 q.text('}')
15131
15132stats_reply.subtypes[12] = table_features_stats_reply
15133
15134class table_features_stats_request(stats_request):
15135 version = 5
15136 type = 18
15137 stats_type = 12
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_features_stats_request()
15171 _version = reader.read("!B")[0]
15172 assert(_version == 5)
15173 _type = reader.read("!B")[0]
15174 assert(_type == 18)
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 == 12)
15181 obj.flags = reader.read("!H")[0]
15182 reader.skip(4)
15183 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.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_features_stats_request {")
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_request.subtypes[12] = table_features_stats_request
15213
15214class table_mod(message):
15215 version = 5
15216 type = 17
15217
15218 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15219 if xid != None:
15220 self.xid = xid
15221 else:
15222 self.xid = None
15223 if table_id != None:
15224 self.table_id = table_id
15225 else:
15226 self.table_id = 0
15227 if config != None:
15228 self.config = config
15229 else:
15230 self.config = 0
15231 if properties != None:
15232 self.properties = properties
15233 else:
15234 self.properties = []
15235 return
15236
15237 def pack(self):
15238 packed = []
15239 packed.append(struct.pack("!B", self.version))
15240 packed.append(struct.pack("!B", self.type))
15241 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15242 packed.append(struct.pack("!L", self.xid))
15243 packed.append(struct.pack("!B", self.table_id))
15244 packed.append('\x00' * 3)
15245 packed.append(struct.pack("!L", self.config))
15246 packed.append(loxi.generic_util.pack_list(self.properties))
15247 length = sum([len(x) for x in packed])
15248 packed[2] = struct.pack("!H", length)
15249 return ''.join(packed)
15250
15251 @staticmethod
15252 def unpack(reader):
15253 obj = table_mod()
15254 _version = reader.read("!B")[0]
15255 assert(_version == 5)
15256 _type = reader.read("!B")[0]
15257 assert(_type == 17)
15258 _length = reader.read("!H")[0]
15259 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015260 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015261 obj.xid = reader.read("!L")[0]
15262 obj.table_id = reader.read("!B")[0]
15263 reader.skip(3)
15264 obj.config = reader.read("!L")[0]
15265 obj.properties = loxi.generic_util.unpack_list(reader, table_mod_prop.table_mod_prop.unpack)
15266 return obj
15267
15268 def __eq__(self, other):
15269 if type(self) != type(other): return False
15270 if self.xid != other.xid: return False
15271 if self.table_id != other.table_id: return False
15272 if self.config != other.config: return False
15273 if self.properties != other.properties: return False
15274 return True
15275
15276 def pretty_print(self, q):
15277 q.text("table_mod {")
15278 with q.group():
15279 with q.indent(2):
15280 q.breakable()
15281 q.text("xid = ");
15282 if self.xid != None:
15283 q.text("%#x" % self.xid)
15284 else:
15285 q.text('None')
15286 q.text(","); q.breakable()
15287 q.text("table_id = ");
15288 q.text("%#x" % self.table_id)
15289 q.text(","); q.breakable()
15290 q.text("config = ");
15291 q.text("%#x" % self.config)
15292 q.text(","); q.breakable()
15293 q.text("properties = ");
15294 q.pp(self.properties)
15295 q.breakable()
15296 q.text('}')
15297
15298message.subtypes[17] = table_mod
15299
15300class table_mod_failed_error_msg(error_msg):
15301 version = 5
15302 type = 1
15303 err_type = 8
15304
15305 def __init__(self, xid=None, code=None, data=None):
15306 if xid != None:
15307 self.xid = xid
15308 else:
15309 self.xid = None
15310 if code != None:
15311 self.code = code
15312 else:
15313 self.code = 0
15314 if data != None:
15315 self.data = data
15316 else:
15317 self.data = ''
15318 return
15319
15320 def pack(self):
15321 packed = []
15322 packed.append(struct.pack("!B", self.version))
15323 packed.append(struct.pack("!B", self.type))
15324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15325 packed.append(struct.pack("!L", self.xid))
15326 packed.append(struct.pack("!H", self.err_type))
15327 packed.append(struct.pack("!H", self.code))
15328 packed.append(self.data)
15329 length = sum([len(x) for x in packed])
15330 packed[2] = struct.pack("!H", length)
15331 return ''.join(packed)
15332
15333 @staticmethod
15334 def unpack(reader):
15335 obj = table_mod_failed_error_msg()
15336 _version = reader.read("!B")[0]
15337 assert(_version == 5)
15338 _type = reader.read("!B")[0]
15339 assert(_type == 1)
15340 _length = reader.read("!H")[0]
15341 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015342 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015343 obj.xid = reader.read("!L")[0]
15344 _err_type = reader.read("!H")[0]
15345 assert(_err_type == 8)
15346 obj.code = reader.read("!H")[0]
15347 obj.data = str(reader.read_all())
15348 return obj
15349
15350 def __eq__(self, other):
15351 if type(self) != type(other): return False
15352 if self.xid != other.xid: return False
15353 if self.code != other.code: return False
15354 if self.data != other.data: return False
15355 return True
15356
15357 def pretty_print(self, q):
15358 q.text("table_mod_failed_error_msg {")
15359 with q.group():
15360 with q.indent(2):
15361 q.breakable()
15362 q.text("xid = ");
15363 if self.xid != None:
15364 q.text("%#x" % self.xid)
15365 else:
15366 q.text('None')
15367 q.text(","); q.breakable()
15368 q.text("code = ");
15369 q.text("%#x" % self.code)
15370 q.text(","); q.breakable()
15371 q.text("data = ");
15372 q.pp(self.data)
15373 q.breakable()
15374 q.text('}')
15375
15376error_msg.subtypes[8] = table_mod_failed_error_msg
15377
15378class table_stats_reply(stats_reply):
15379 version = 5
15380 type = 19
15381 stats_type = 3
15382
15383 def __init__(self, xid=None, flags=None, entries=None):
15384 if xid != None:
15385 self.xid = xid
15386 else:
15387 self.xid = None
15388 if flags != None:
15389 self.flags = flags
15390 else:
15391 self.flags = 0
15392 if entries != None:
15393 self.entries = entries
15394 else:
15395 self.entries = []
15396 return
15397
15398 def pack(self):
15399 packed = []
15400 packed.append(struct.pack("!B", self.version))
15401 packed.append(struct.pack("!B", self.type))
15402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15403 packed.append(struct.pack("!L", self.xid))
15404 packed.append(struct.pack("!H", self.stats_type))
15405 packed.append(struct.pack("!H", self.flags))
15406 packed.append('\x00' * 4)
15407 packed.append(loxi.generic_util.pack_list(self.entries))
15408 length = sum([len(x) for x in packed])
15409 packed[2] = struct.pack("!H", length)
15410 return ''.join(packed)
15411
15412 @staticmethod
15413 def unpack(reader):
15414 obj = table_stats_reply()
15415 _version = reader.read("!B")[0]
15416 assert(_version == 5)
15417 _type = reader.read("!B")[0]
15418 assert(_type == 19)
15419 _length = reader.read("!H")[0]
15420 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015421 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015422 obj.xid = reader.read("!L")[0]
15423 _stats_type = reader.read("!H")[0]
15424 assert(_stats_type == 3)
15425 obj.flags = reader.read("!H")[0]
15426 reader.skip(4)
15427 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
15428 return obj
15429
15430 def __eq__(self, other):
15431 if type(self) != type(other): return False
15432 if self.xid != other.xid: return False
15433 if self.flags != other.flags: return False
15434 if self.entries != other.entries: return False
15435 return True
15436
15437 def pretty_print(self, q):
15438 q.text("table_stats_reply {")
15439 with q.group():
15440 with q.indent(2):
15441 q.breakable()
15442 q.text("xid = ");
15443 if self.xid != None:
15444 q.text("%#x" % self.xid)
15445 else:
15446 q.text('None')
15447 q.text(","); q.breakable()
15448 q.text("flags = ");
15449 q.text("%#x" % self.flags)
15450 q.text(","); q.breakable()
15451 q.text("entries = ");
15452 q.pp(self.entries)
15453 q.breakable()
15454 q.text('}')
15455
15456stats_reply.subtypes[3] = table_stats_reply
15457
15458class table_stats_request(stats_request):
15459 version = 5
15460 type = 18
15461 stats_type = 3
15462
15463 def __init__(self, xid=None, flags=None):
15464 if xid != None:
15465 self.xid = xid
15466 else:
15467 self.xid = None
15468 if flags != None:
15469 self.flags = flags
15470 else:
15471 self.flags = 0
15472 return
15473
15474 def pack(self):
15475 packed = []
15476 packed.append(struct.pack("!B", self.version))
15477 packed.append(struct.pack("!B", self.type))
15478 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15479 packed.append(struct.pack("!L", self.xid))
15480 packed.append(struct.pack("!H", self.stats_type))
15481 packed.append(struct.pack("!H", self.flags))
15482 packed.append('\x00' * 4)
15483 length = sum([len(x) for x in packed])
15484 packed[2] = struct.pack("!H", length)
15485 return ''.join(packed)
15486
15487 @staticmethod
15488 def unpack(reader):
15489 obj = table_stats_request()
15490 _version = reader.read("!B")[0]
15491 assert(_version == 5)
15492 _type = reader.read("!B")[0]
15493 assert(_type == 18)
15494 _length = reader.read("!H")[0]
15495 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015496 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015497 obj.xid = reader.read("!L")[0]
15498 _stats_type = reader.read("!H")[0]
15499 assert(_stats_type == 3)
15500 obj.flags = reader.read("!H")[0]
15501 reader.skip(4)
15502 return obj
15503
15504 def __eq__(self, other):
15505 if type(self) != type(other): return False
15506 if self.xid != other.xid: return False
15507 if self.flags != other.flags: return False
15508 return True
15509
15510 def pretty_print(self, q):
15511 q.text("table_stats_request {")
15512 with q.group():
15513 with q.indent(2):
15514 q.breakable()
15515 q.text("xid = ");
15516 if self.xid != None:
15517 q.text("%#x" % self.xid)
15518 else:
15519 q.text('None')
15520 q.text(","); q.breakable()
15521 q.text("flags = ");
15522 q.text("%#x" % self.flags)
15523 q.breakable()
15524 q.text('}')
15525
15526stats_request.subtypes[3] = table_stats_request
15527
15528class table_status(message):
15529 version = 5
15530 type = 31
15531
15532 def __init__(self, xid=None, role=None, reason=None, table=None):
15533 if xid != None:
15534 self.xid = xid
15535 else:
15536 self.xid = None
15537 if role != None:
15538 self.role = role
15539 else:
15540 self.role = 0
15541 if reason != None:
15542 self.reason = reason
15543 else:
15544 self.reason = 0
15545 if table != None:
15546 self.table = table
15547 else:
15548 self.table = common.table_desc()
15549 return
15550
15551 def pack(self):
15552 packed = []
15553 packed.append(struct.pack("!B", self.version))
15554 packed.append(struct.pack("!B", self.type))
15555 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15556 packed.append(struct.pack("!L", self.xid))
15557 packed.append(struct.pack("!L", self.role))
15558 packed.append(struct.pack("!B", self.reason))
15559 packed.append('\x00' * 7)
15560 packed.append(self.table.pack())
15561 length = sum([len(x) for x in packed])
15562 packed[2] = struct.pack("!H", length)
15563 return ''.join(packed)
15564
15565 @staticmethod
15566 def unpack(reader):
15567 obj = table_status()
15568 _version = reader.read("!B")[0]
15569 assert(_version == 5)
15570 _type = reader.read("!B")[0]
15571 assert(_type == 31)
15572 _length = reader.read("!H")[0]
15573 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015574 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015575 obj.xid = reader.read("!L")[0]
15576 obj.role = reader.read("!L")[0]
15577 obj.reason = reader.read("!B")[0]
15578 reader.skip(7)
15579 obj.table = common.table_desc.unpack(reader)
15580 return obj
15581
15582 def __eq__(self, other):
15583 if type(self) != type(other): return False
15584 if self.xid != other.xid: return False
15585 if self.role != other.role: return False
15586 if self.reason != other.reason: return False
15587 if self.table != other.table: return False
15588 return True
15589
15590 def pretty_print(self, q):
15591 q.text("table_status {")
15592 with q.group():
15593 with q.indent(2):
15594 q.breakable()
15595 q.text("xid = ");
15596 if self.xid != None:
15597 q.text("%#x" % self.xid)
15598 else:
15599 q.text('None')
15600 q.text(","); q.breakable()
15601 q.text("role = ");
15602 q.text("%#x" % self.role)
15603 q.text(","); q.breakable()
15604 q.text("reason = ");
15605 q.text("%#x" % self.reason)
15606 q.text(","); q.breakable()
15607 q.text("table = ");
15608 q.pp(self.table)
15609 q.breakable()
15610 q.text('}')
15611
15612message.subtypes[31] = table_status
15613
15614
15615def parse_header(buf):
15616 if len(buf) < 8:
15617 raise loxi.ProtocolError("too short to be an OpenFlow message")
15618 return struct.unpack_from("!BBHL", buf)
15619
15620def parse_message(buf):
15621 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
15622 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
15623 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
15624 if len(buf) != msg_len:
15625 raise loxi.ProtocolError("incorrect message size")
15626 return message.unpack(loxi.generic_util.OFReader(buf))