blob: 957435ec25b6130c9c85c62ddc1ed57558d5e306 [file] [log] [blame]
Nathan Knuth418fdc82016-09-16 22:51:15 -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 util
12import loxi.generic_util
13
14import sys
15ofp = sys.modules['loxi.of14']
16
17class message(loxi.OFObject):
18 subtypes = {}
19
20 version = 5
21
22 def __init__(self, type=None, xid=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 if xid != None:
28 self.xid = xid
29 else:
30 self.xid = None
31 return
32
33 def pack(self):
34 packed = []
35 packed.append(struct.pack("!B", self.version))
36 packed.append(struct.pack("!B", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
38 packed.append(struct.pack("!L", self.xid))
39 length = sum([len(x) for x in packed])
40 packed[2] = struct.pack("!H", length)
41 return ''.join(packed)
42
43 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('B', 1)
46 subclass = message.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = message()
51 _version = reader.read("!B")[0]
52 assert(_version == 5)
53 obj.type = reader.read("!B")[0]
54 _length = reader.read("!H")[0]
55 orig_reader = reader
56 reader = orig_reader.slice(_length, 4)
57 obj.xid = reader.read("!L")[0]
58 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.type != other.type: return False
63 if self.xid != other.xid: return False
64 return True
65
66 def pretty_print(self, q):
67 q.text("message {")
68 with q.group():
69 with q.indent(2):
70 q.breakable()
71 q.text("xid = ");
72 if self.xid != None:
73 q.text("%#x" % self.xid)
74 else:
75 q.text('None')
76 q.breakable()
77 q.text('}')
78
79
80class stats_reply(message):
81 subtypes = {}
82
83 version = 5
84 type = 19
85
86 def __init__(self, xid=None, stats_type=None, flags=None):
87 if xid != None:
88 self.xid = xid
89 else:
90 self.xid = None
91 if stats_type != None:
92 self.stats_type = stats_type
93 else:
94 self.stats_type = 0
95 if flags != None:
96 self.flags = flags
97 else:
98 self.flags = 0
99 return
100
101 def pack(self):
102 packed = []
103 packed.append(struct.pack("!B", self.version))
104 packed.append(struct.pack("!B", self.type))
105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
106 packed.append(struct.pack("!L", self.xid))
107 packed.append(struct.pack("!H", self.stats_type))
108 packed.append(struct.pack("!H", self.flags))
109 packed.append('\x00' * 4)
110 length = sum([len(x) for x in packed])
111 packed[2] = struct.pack("!H", length)
112 return ''.join(packed)
113
114 @staticmethod
115 def unpack(reader):
116 subtype, = reader.peek('!H', 8)
117 subclass = stats_reply.subtypes.get(subtype)
118 if subclass:
119 return subclass.unpack(reader)
120
121 obj = stats_reply()
122 _version = reader.read("!B")[0]
123 assert(_version == 5)
124 _type = reader.read("!B")[0]
125 assert(_type == 19)
126 _length = reader.read("!H")[0]
127 orig_reader = reader
128 reader = orig_reader.slice(_length, 4)
129 obj.xid = reader.read("!L")[0]
130 obj.stats_type = reader.read("!H")[0]
131 obj.flags = reader.read("!H")[0]
132 reader.skip(4)
133 return obj
134
135 def __eq__(self, other):
136 if type(self) != type(other): return False
137 if self.xid != other.xid: return False
138 if self.stats_type != other.stats_type: return False
139 if self.flags != other.flags: return False
140 return True
141
142 def pretty_print(self, q):
143 q.text("stats_reply {")
144 with q.group():
145 with q.indent(2):
146 q.breakable()
147 q.text("xid = ");
148 if self.xid != None:
149 q.text("%#x" % self.xid)
150 else:
151 q.text('None')
152 q.text(","); q.breakable()
153 q.text("flags = ");
154 q.text("%#x" % self.flags)
155 q.breakable()
156 q.text('}')
157
158message.subtypes[19] = stats_reply
159
160class aggregate_stats_reply(stats_reply):
161 version = 5
162 type = 19
163 stats_type = 2
164
165 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
166 if xid != None:
167 self.xid = xid
168 else:
169 self.xid = None
170 if flags != None:
171 self.flags = flags
172 else:
173 self.flags = 0
174 if packet_count != None:
175 self.packet_count = packet_count
176 else:
177 self.packet_count = 0
178 if byte_count != None:
179 self.byte_count = byte_count
180 else:
181 self.byte_count = 0
182 if flow_count != None:
183 self.flow_count = flow_count
184 else:
185 self.flow_count = 0
186 return
187
188 def pack(self):
189 packed = []
190 packed.append(struct.pack("!B", self.version))
191 packed.append(struct.pack("!B", self.type))
192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
193 packed.append(struct.pack("!L", self.xid))
194 packed.append(struct.pack("!H", self.stats_type))
195 packed.append(struct.pack("!H", self.flags))
196 packed.append('\x00' * 4)
197 packed.append(struct.pack("!Q", self.packet_count))
198 packed.append(struct.pack("!Q", self.byte_count))
199 packed.append(struct.pack("!L", self.flow_count))
200 packed.append('\x00' * 4)
201 length = sum([len(x) for x in packed])
202 packed[2] = struct.pack("!H", length)
203 return ''.join(packed)
204
205 @staticmethod
206 def unpack(reader):
207 obj = aggregate_stats_reply()
208 _version = reader.read("!B")[0]
209 assert(_version == 5)
210 _type = reader.read("!B")[0]
211 assert(_type == 19)
212 _length = reader.read("!H")[0]
213 orig_reader = reader
214 reader = orig_reader.slice(_length, 4)
215 obj.xid = reader.read("!L")[0]
216 _stats_type = reader.read("!H")[0]
217 assert(_stats_type == 2)
218 obj.flags = reader.read("!H")[0]
219 reader.skip(4)
220 obj.packet_count = reader.read("!Q")[0]
221 obj.byte_count = reader.read("!Q")[0]
222 obj.flow_count = reader.read("!L")[0]
223 reader.skip(4)
224 return obj
225
226 def __eq__(self, other):
227 if type(self) != type(other): return False
228 if self.xid != other.xid: return False
229 if self.flags != other.flags: return False
230 if self.packet_count != other.packet_count: return False
231 if self.byte_count != other.byte_count: return False
232 if self.flow_count != other.flow_count: return False
233 return True
234
235 def pretty_print(self, q):
236 q.text("aggregate_stats_reply {")
237 with q.group():
238 with q.indent(2):
239 q.breakable()
240 q.text("xid = ");
241 if self.xid != None:
242 q.text("%#x" % self.xid)
243 else:
244 q.text('None')
245 q.text(","); q.breakable()
246 q.text("flags = ");
247 q.text("%#x" % self.flags)
248 q.text(","); q.breakable()
249 q.text("packet_count = ");
250 q.text("%#x" % self.packet_count)
251 q.text(","); q.breakable()
252 q.text("byte_count = ");
253 q.text("%#x" % self.byte_count)
254 q.text(","); q.breakable()
255 q.text("flow_count = ");
256 q.text("%#x" % self.flow_count)
257 q.breakable()
258 q.text('}')
259
260stats_reply.subtypes[2] = aggregate_stats_reply
261
262class stats_request(message):
263 subtypes = {}
264
265 version = 5
266 type = 18
267
268 def __init__(self, xid=None, stats_type=None, flags=None):
269 if xid != None:
270 self.xid = xid
271 else:
272 self.xid = None
273 if stats_type != None:
274 self.stats_type = stats_type
275 else:
276 self.stats_type = 0
277 if flags != None:
278 self.flags = flags
279 else:
280 self.flags = 0
281 return
282
283 def pack(self):
284 packed = []
285 packed.append(struct.pack("!B", self.version))
286 packed.append(struct.pack("!B", self.type))
287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
288 packed.append(struct.pack("!L", self.xid))
289 packed.append(struct.pack("!H", self.stats_type))
290 packed.append(struct.pack("!H", self.flags))
291 packed.append('\x00' * 4)
292 length = sum([len(x) for x in packed])
293 packed[2] = struct.pack("!H", length)
294 return ''.join(packed)
295
296 @staticmethod
297 def unpack(reader):
298 subtype, = reader.peek('!H', 8)
299 subclass = stats_request.subtypes.get(subtype)
300 if subclass:
301 return subclass.unpack(reader)
302
303 obj = stats_request()
304 _version = reader.read("!B")[0]
305 assert(_version == 5)
306 _type = reader.read("!B")[0]
307 assert(_type == 18)
308 _length = reader.read("!H")[0]
309 orig_reader = reader
310 reader = orig_reader.slice(_length, 4)
311 obj.xid = reader.read("!L")[0]
312 obj.stats_type = reader.read("!H")[0]
313 obj.flags = reader.read("!H")[0]
314 reader.skip(4)
315 return obj
316
317 def __eq__(self, other):
318 if type(self) != type(other): return False
319 if self.xid != other.xid: return False
320 if self.stats_type != other.stats_type: return False
321 if self.flags != other.flags: return False
322 return True
323
324 def pretty_print(self, q):
325 q.text("stats_request {")
326 with q.group():
327 with q.indent(2):
328 q.breakable()
329 q.text("xid = ");
330 if self.xid != None:
331 q.text("%#x" % self.xid)
332 else:
333 q.text('None')
334 q.text(","); q.breakable()
335 q.text("flags = ");
336 q.text("%#x" % self.flags)
337 q.breakable()
338 q.text('}')
339
340message.subtypes[18] = stats_request
341
342class aggregate_stats_request(stats_request):
343 version = 5
344 type = 18
345 stats_type = 2
346
347 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
348 if xid != None:
349 self.xid = xid
350 else:
351 self.xid = None
352 if flags != None:
353 self.flags = flags
354 else:
355 self.flags = 0
356 if table_id != None:
357 self.table_id = table_id
358 else:
359 self.table_id = 0
360 if out_port != None:
361 self.out_port = out_port
362 else:
363 self.out_port = 0
364 if out_group != None:
365 self.out_group = out_group
366 else:
367 self.out_group = 0
368 if cookie != None:
369 self.cookie = cookie
370 else:
371 self.cookie = 0
372 if cookie_mask != None:
373 self.cookie_mask = cookie_mask
374 else:
375 self.cookie_mask = 0
376 if match != None:
377 self.match = match
378 else:
379 self.match = ofp.match()
380 return
381
382 def pack(self):
383 packed = []
384 packed.append(struct.pack("!B", self.version))
385 packed.append(struct.pack("!B", self.type))
386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
387 packed.append(struct.pack("!L", self.xid))
388 packed.append(struct.pack("!H", self.stats_type))
389 packed.append(struct.pack("!H", self.flags))
390 packed.append('\x00' * 4)
391 packed.append(struct.pack("!B", self.table_id))
392 packed.append('\x00' * 3)
393 packed.append(util.pack_port_no(self.out_port))
394 packed.append(struct.pack("!L", self.out_group))
395 packed.append('\x00' * 4)
396 packed.append(struct.pack("!Q", self.cookie))
397 packed.append(struct.pack("!Q", self.cookie_mask))
398 packed.append(self.match.pack())
399 length = sum([len(x) for x in packed])
400 packed[2] = struct.pack("!H", length)
401 return ''.join(packed)
402
403 @staticmethod
404 def unpack(reader):
405 obj = aggregate_stats_request()
406 _version = reader.read("!B")[0]
407 assert(_version == 5)
408 _type = reader.read("!B")[0]
409 assert(_type == 18)
410 _length = reader.read("!H")[0]
411 orig_reader = reader
412 reader = orig_reader.slice(_length, 4)
413 obj.xid = reader.read("!L")[0]
414 _stats_type = reader.read("!H")[0]
415 assert(_stats_type == 2)
416 obj.flags = reader.read("!H")[0]
417 reader.skip(4)
418 obj.table_id = reader.read("!B")[0]
419 reader.skip(3)
420 obj.out_port = util.unpack_port_no(reader)
421 obj.out_group = reader.read("!L")[0]
422 reader.skip(4)
423 obj.cookie = reader.read("!Q")[0]
424 obj.cookie_mask = reader.read("!Q")[0]
425 obj.match = ofp.match.unpack(reader)
426 return obj
427
428 def __eq__(self, other):
429 if type(self) != type(other): return False
430 if self.xid != other.xid: return False
431 if self.flags != other.flags: return False
432 if self.table_id != other.table_id: return False
433 if self.out_port != other.out_port: return False
434 if self.out_group != other.out_group: return False
435 if self.cookie != other.cookie: return False
436 if self.cookie_mask != other.cookie_mask: return False
437 if self.match != other.match: return False
438 return True
439
440 def pretty_print(self, q):
441 q.text("aggregate_stats_request {")
442 with q.group():
443 with q.indent(2):
444 q.breakable()
445 q.text("xid = ");
446 if self.xid != None:
447 q.text("%#x" % self.xid)
448 else:
449 q.text('None')
450 q.text(","); q.breakable()
451 q.text("flags = ");
452 q.text("%#x" % self.flags)
453 q.text(","); q.breakable()
454 q.text("table_id = ");
455 q.text("%#x" % self.table_id)
456 q.text(","); q.breakable()
457 q.text("out_port = ");
458 q.text(util.pretty_port(self.out_port))
459 q.text(","); q.breakable()
460 q.text("out_group = ");
461 q.text("%#x" % self.out_group)
462 q.text(","); q.breakable()
463 q.text("cookie = ");
464 q.text("%#x" % self.cookie)
465 q.text(","); q.breakable()
466 q.text("cookie_mask = ");
467 q.text("%#x" % self.cookie_mask)
468 q.text(","); q.breakable()
469 q.text("match = ");
470 q.pp(self.match)
471 q.breakable()
472 q.text('}')
473
474stats_request.subtypes[2] = aggregate_stats_request
475
476class error_msg(message):
477 subtypes = {}
478
479 version = 5
480 type = 1
481
482 def __init__(self, xid=None, err_type=None):
483 if xid != None:
484 self.xid = xid
485 else:
486 self.xid = None
487 if err_type != None:
488 self.err_type = err_type
489 else:
490 self.err_type = 0
491 return
492
493 def pack(self):
494 packed = []
495 packed.append(struct.pack("!B", self.version))
496 packed.append(struct.pack("!B", self.type))
497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
498 packed.append(struct.pack("!L", self.xid))
499 packed.append(struct.pack("!H", self.err_type))
500 length = sum([len(x) for x in packed])
501 packed[2] = struct.pack("!H", length)
502 return ''.join(packed)
503
504 @staticmethod
505 def unpack(reader):
506 subtype, = reader.peek('!H', 8)
507 subclass = error_msg.subtypes.get(subtype)
508 if subclass:
509 return subclass.unpack(reader)
510
511 obj = error_msg()
512 _version = reader.read("!B")[0]
513 assert(_version == 5)
514 _type = reader.read("!B")[0]
515 assert(_type == 1)
516 _length = reader.read("!H")[0]
517 orig_reader = reader
518 reader = orig_reader.slice(_length, 4)
519 obj.xid = reader.read("!L")[0]
520 obj.err_type = reader.read("!H")[0]
521 return obj
522
523 def __eq__(self, other):
524 if type(self) != type(other): return False
525 if self.xid != other.xid: return False
526 if self.err_type != other.err_type: return False
527 return True
528
529 def pretty_print(self, q):
530 q.text("error_msg {")
531 with q.group():
532 with q.indent(2):
533 q.breakable()
534 q.text("xid = ");
535 if self.xid != None:
536 q.text("%#x" % self.xid)
537 else:
538 q.text('None')
539 q.breakable()
540 q.text('}')
541
542message.subtypes[1] = error_msg
543
544class async_config_failed_error_msg(error_msg):
545 version = 5
546 type = 1
547 err_type = 15
548
549 def __init__(self, xid=None, code=None, data=None):
550 if xid != None:
551 self.xid = xid
552 else:
553 self.xid = None
554 if code != None:
555 self.code = code
556 else:
557 self.code = 0
558 if data != None:
559 self.data = data
560 else:
561 self.data = ''
562 return
563
564 def pack(self):
565 packed = []
566 packed.append(struct.pack("!B", self.version))
567 packed.append(struct.pack("!B", self.type))
568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
569 packed.append(struct.pack("!L", self.xid))
570 packed.append(struct.pack("!H", self.err_type))
571 packed.append(struct.pack("!H", self.code))
572 packed.append(self.data)
573 length = sum([len(x) for x in packed])
574 packed[2] = struct.pack("!H", length)
575 return ''.join(packed)
576
577 @staticmethod
578 def unpack(reader):
579 obj = async_config_failed_error_msg()
580 _version = reader.read("!B")[0]
581 assert(_version == 5)
582 _type = reader.read("!B")[0]
583 assert(_type == 1)
584 _length = reader.read("!H")[0]
585 orig_reader = reader
586 reader = orig_reader.slice(_length, 4)
587 obj.xid = reader.read("!L")[0]
588 _err_type = reader.read("!H")[0]
589 assert(_err_type == 15)
590 obj.code = reader.read("!H")[0]
591 obj.data = str(reader.read_all())
592 return obj
593
594 def __eq__(self, other):
595 if type(self) != type(other): return False
596 if self.xid != other.xid: return False
597 if self.code != other.code: return False
598 if self.data != other.data: return False
599 return True
600
601 def pretty_print(self, q):
602 q.text("async_config_failed_error_msg {")
603 with q.group():
604 with q.indent(2):
605 q.breakable()
606 q.text("xid = ");
607 if self.xid != None:
608 q.text("%#x" % self.xid)
609 else:
610 q.text('None')
611 q.text(","); q.breakable()
612 q.text("code = ");
613 q.text("%#x" % self.code)
614 q.text(","); q.breakable()
615 q.text("data = ");
616 q.pp(self.data)
617 q.breakable()
618 q.text('}')
619
620error_msg.subtypes[15] = async_config_failed_error_msg
621
622class async_get_reply(message):
623 version = 5
624 type = 27
625
626 def __init__(self, xid=None, properties=None):
627 if xid != None:
628 self.xid = xid
629 else:
630 self.xid = None
631 if properties != None:
632 self.properties = properties
633 else:
634 self.properties = []
635 return
636
637 def pack(self):
638 packed = []
639 packed.append(struct.pack("!B", self.version))
640 packed.append(struct.pack("!B", self.type))
641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
642 packed.append(struct.pack("!L", self.xid))
643 packed.append(loxi.generic_util.pack_list(self.properties))
644 length = sum([len(x) for x in packed])
645 packed[2] = struct.pack("!H", length)
646 return ''.join(packed)
647
648 @staticmethod
649 def unpack(reader):
650 obj = async_get_reply()
651 _version = reader.read("!B")[0]
652 assert(_version == 5)
653 _type = reader.read("!B")[0]
654 assert(_type == 27)
655 _length = reader.read("!H")[0]
656 orig_reader = reader
657 reader = orig_reader.slice(_length, 4)
658 obj.xid = reader.read("!L")[0]
659 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
660 return obj
661
662 def __eq__(self, other):
663 if type(self) != type(other): return False
664 if self.xid != other.xid: return False
665 if self.properties != other.properties: return False
666 return True
667
668 def pretty_print(self, q):
669 q.text("async_get_reply {")
670 with q.group():
671 with q.indent(2):
672 q.breakable()
673 q.text("xid = ");
674 if self.xid != None:
675 q.text("%#x" % self.xid)
676 else:
677 q.text('None')
678 q.text(","); q.breakable()
679 q.text("properties = ");
680 q.pp(self.properties)
681 q.breakable()
682 q.text('}')
683
684message.subtypes[27] = async_get_reply
685
686class async_get_request(message):
687 version = 5
688 type = 26
689
690 def __init__(self, xid=None):
691 if xid != None:
692 self.xid = xid
693 else:
694 self.xid = None
695 return
696
697 def pack(self):
698 packed = []
699 packed.append(struct.pack("!B", self.version))
700 packed.append(struct.pack("!B", self.type))
701 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
702 packed.append(struct.pack("!L", self.xid))
703 length = sum([len(x) for x in packed])
704 packed[2] = struct.pack("!H", length)
705 return ''.join(packed)
706
707 @staticmethod
708 def unpack(reader):
709 obj = async_get_request()
710 _version = reader.read("!B")[0]
711 assert(_version == 5)
712 _type = reader.read("!B")[0]
713 assert(_type == 26)
714 _length = reader.read("!H")[0]
715 orig_reader = reader
716 reader = orig_reader.slice(_length, 4)
717 obj.xid = reader.read("!L")[0]
718 return obj
719
720 def __eq__(self, other):
721 if type(self) != type(other): return False
722 if self.xid != other.xid: return False
723 return True
724
725 def pretty_print(self, q):
726 q.text("async_get_request {")
727 with q.group():
728 with q.indent(2):
729 q.breakable()
730 q.text("xid = ");
731 if self.xid != None:
732 q.text("%#x" % self.xid)
733 else:
734 q.text('None')
735 q.breakable()
736 q.text('}')
737
738message.subtypes[26] = async_get_request
739
740class async_set(message):
741 version = 5
742 type = 28
743
744 def __init__(self, xid=None, properties=None):
745 if xid != None:
746 self.xid = xid
747 else:
748 self.xid = None
749 if properties != None:
750 self.properties = properties
751 else:
752 self.properties = []
753 return
754
755 def pack(self):
756 packed = []
757 packed.append(struct.pack("!B", self.version))
758 packed.append(struct.pack("!B", self.type))
759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
760 packed.append(struct.pack("!L", self.xid))
761 packed.append(loxi.generic_util.pack_list(self.properties))
762 length = sum([len(x) for x in packed])
763 packed[2] = struct.pack("!H", length)
764 return ''.join(packed)
765
766 @staticmethod
767 def unpack(reader):
768 obj = async_set()
769 _version = reader.read("!B")[0]
770 assert(_version == 5)
771 _type = reader.read("!B")[0]
772 assert(_type == 28)
773 _length = reader.read("!H")[0]
774 orig_reader = reader
775 reader = orig_reader.slice(_length, 4)
776 obj.xid = reader.read("!L")[0]
777 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
778 return obj
779
780 def __eq__(self, other):
781 if type(self) != type(other): return False
782 if self.xid != other.xid: return False
783 if self.properties != other.properties: return False
784 return True
785
786 def pretty_print(self, q):
787 q.text("async_set {")
788 with q.group():
789 with q.indent(2):
790 q.breakable()
791 q.text("xid = ");
792 if self.xid != None:
793 q.text("%#x" % self.xid)
794 else:
795 q.text('None')
796 q.text(","); q.breakable()
797 q.text("properties = ");
798 q.pp(self.properties)
799 q.breakable()
800 q.text('}')
801
802message.subtypes[28] = async_set
803
804class bad_action_error_msg(error_msg):
805 version = 5
806 type = 1
807 err_type = 2
808
809 def __init__(self, xid=None, code=None, data=None):
810 if xid != None:
811 self.xid = xid
812 else:
813 self.xid = None
814 if code != None:
815 self.code = code
816 else:
817 self.code = 0
818 if data != None:
819 self.data = data
820 else:
821 self.data = ''
822 return
823
824 def pack(self):
825 packed = []
826 packed.append(struct.pack("!B", self.version))
827 packed.append(struct.pack("!B", self.type))
828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
829 packed.append(struct.pack("!L", self.xid))
830 packed.append(struct.pack("!H", self.err_type))
831 packed.append(struct.pack("!H", self.code))
832 packed.append(self.data)
833 length = sum([len(x) for x in packed])
834 packed[2] = struct.pack("!H", length)
835 return ''.join(packed)
836
837 @staticmethod
838 def unpack(reader):
839 obj = bad_action_error_msg()
840 _version = reader.read("!B")[0]
841 assert(_version == 5)
842 _type = reader.read("!B")[0]
843 assert(_type == 1)
844 _length = reader.read("!H")[0]
845 orig_reader = reader
846 reader = orig_reader.slice(_length, 4)
847 obj.xid = reader.read("!L")[0]
848 _err_type = reader.read("!H")[0]
849 assert(_err_type == 2)
850 obj.code = reader.read("!H")[0]
851 obj.data = str(reader.read_all())
852 return obj
853
854 def __eq__(self, other):
855 if type(self) != type(other): return False
856 if self.xid != other.xid: return False
857 if self.code != other.code: return False
858 if self.data != other.data: return False
859 return True
860
861 def pretty_print(self, q):
862 q.text("bad_action_error_msg {")
863 with q.group():
864 with q.indent(2):
865 q.breakable()
866 q.text("xid = ");
867 if self.xid != None:
868 q.text("%#x" % self.xid)
869 else:
870 q.text('None')
871 q.text(","); q.breakable()
872 q.text("code = ");
873 q.text("%#x" % self.code)
874 q.text(","); q.breakable()
875 q.text("data = ");
876 q.pp(self.data)
877 q.breakable()
878 q.text('}')
879
880error_msg.subtypes[2] = bad_action_error_msg
881
882class bad_instruction_error_msg(error_msg):
883 version = 5
884 type = 1
885 err_type = 3
886
887 def __init__(self, xid=None, code=None, data=None):
888 if xid != None:
889 self.xid = xid
890 else:
891 self.xid = None
892 if code != None:
893 self.code = code
894 else:
895 self.code = 0
896 if data != None:
897 self.data = data
898 else:
899 self.data = ''
900 return
901
902 def pack(self):
903 packed = []
904 packed.append(struct.pack("!B", self.version))
905 packed.append(struct.pack("!B", self.type))
906 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
907 packed.append(struct.pack("!L", self.xid))
908 packed.append(struct.pack("!H", self.err_type))
909 packed.append(struct.pack("!H", self.code))
910 packed.append(self.data)
911 length = sum([len(x) for x in packed])
912 packed[2] = struct.pack("!H", length)
913 return ''.join(packed)
914
915 @staticmethod
916 def unpack(reader):
917 obj = bad_instruction_error_msg()
918 _version = reader.read("!B")[0]
919 assert(_version == 5)
920 _type = reader.read("!B")[0]
921 assert(_type == 1)
922 _length = reader.read("!H")[0]
923 orig_reader = reader
924 reader = orig_reader.slice(_length, 4)
925 obj.xid = reader.read("!L")[0]
926 _err_type = reader.read("!H")[0]
927 assert(_err_type == 3)
928 obj.code = reader.read("!H")[0]
929 obj.data = str(reader.read_all())
930 return obj
931
932 def __eq__(self, other):
933 if type(self) != type(other): return False
934 if self.xid != other.xid: return False
935 if self.code != other.code: return False
936 if self.data != other.data: return False
937 return True
938
939 def pretty_print(self, q):
940 q.text("bad_instruction_error_msg {")
941 with q.group():
942 with q.indent(2):
943 q.breakable()
944 q.text("xid = ");
945 if self.xid != None:
946 q.text("%#x" % self.xid)
947 else:
948 q.text('None')
949 q.text(","); q.breakable()
950 q.text("code = ");
951 q.text("%#x" % self.code)
952 q.text(","); q.breakable()
953 q.text("data = ");
954 q.pp(self.data)
955 q.breakable()
956 q.text('}')
957
958error_msg.subtypes[3] = bad_instruction_error_msg
959
960class bad_match_error_msg(error_msg):
961 version = 5
962 type = 1
963 err_type = 4
964
965 def __init__(self, xid=None, code=None, data=None):
966 if xid != None:
967 self.xid = xid
968 else:
969 self.xid = None
970 if code != None:
971 self.code = code
972 else:
973 self.code = 0
974 if data != None:
975 self.data = data
976 else:
977 self.data = ''
978 return
979
980 def pack(self):
981 packed = []
982 packed.append(struct.pack("!B", self.version))
983 packed.append(struct.pack("!B", self.type))
984 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
985 packed.append(struct.pack("!L", self.xid))
986 packed.append(struct.pack("!H", self.err_type))
987 packed.append(struct.pack("!H", self.code))
988 packed.append(self.data)
989 length = sum([len(x) for x in packed])
990 packed[2] = struct.pack("!H", length)
991 return ''.join(packed)
992
993 @staticmethod
994 def unpack(reader):
995 obj = bad_match_error_msg()
996 _version = reader.read("!B")[0]
997 assert(_version == 5)
998 _type = reader.read("!B")[0]
999 assert(_type == 1)
1000 _length = reader.read("!H")[0]
1001 orig_reader = reader
1002 reader = orig_reader.slice(_length, 4)
1003 obj.xid = reader.read("!L")[0]
1004 _err_type = reader.read("!H")[0]
1005 assert(_err_type == 4)
1006 obj.code = reader.read("!H")[0]
1007 obj.data = str(reader.read_all())
1008 return obj
1009
1010 def __eq__(self, other):
1011 if type(self) != type(other): return False
1012 if self.xid != other.xid: return False
1013 if self.code != other.code: return False
1014 if self.data != other.data: return False
1015 return True
1016
1017 def pretty_print(self, q):
1018 q.text("bad_match_error_msg {")
1019 with q.group():
1020 with q.indent(2):
1021 q.breakable()
1022 q.text("xid = ");
1023 if self.xid != None:
1024 q.text("%#x" % self.xid)
1025 else:
1026 q.text('None')
1027 q.text(","); q.breakable()
1028 q.text("code = ");
1029 q.text("%#x" % self.code)
1030 q.text(","); q.breakable()
1031 q.text("data = ");
1032 q.pp(self.data)
1033 q.breakable()
1034 q.text('}')
1035
1036error_msg.subtypes[4] = bad_match_error_msg
1037
1038class bad_property_error_msg(error_msg):
1039 version = 5
1040 type = 1
1041 err_type = 14
1042
1043 def __init__(self, xid=None, code=None, data=None):
1044 if xid != None:
1045 self.xid = xid
1046 else:
1047 self.xid = None
1048 if code != None:
1049 self.code = code
1050 else:
1051 self.code = 0
1052 if data != None:
1053 self.data = data
1054 else:
1055 self.data = ''
1056 return
1057
1058 def pack(self):
1059 packed = []
1060 packed.append(struct.pack("!B", self.version))
1061 packed.append(struct.pack("!B", self.type))
1062 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1063 packed.append(struct.pack("!L", self.xid))
1064 packed.append(struct.pack("!H", self.err_type))
1065 packed.append(struct.pack("!H", self.code))
1066 packed.append(self.data)
1067 length = sum([len(x) for x in packed])
1068 packed[2] = struct.pack("!H", length)
1069 return ''.join(packed)
1070
1071 @staticmethod
1072 def unpack(reader):
1073 obj = bad_property_error_msg()
1074 _version = reader.read("!B")[0]
1075 assert(_version == 5)
1076 _type = reader.read("!B")[0]
1077 assert(_type == 1)
1078 _length = reader.read("!H")[0]
1079 orig_reader = reader
1080 reader = orig_reader.slice(_length, 4)
1081 obj.xid = reader.read("!L")[0]
1082 _err_type = reader.read("!H")[0]
1083 assert(_err_type == 14)
1084 obj.code = reader.read("!H")[0]
1085 obj.data = str(reader.read_all())
1086 return obj
1087
1088 def __eq__(self, other):
1089 if type(self) != type(other): return False
1090 if self.xid != other.xid: return False
1091 if self.code != other.code: return False
1092 if self.data != other.data: return False
1093 return True
1094
1095 def pretty_print(self, q):
1096 q.text("bad_property_error_msg {")
1097 with q.group():
1098 with q.indent(2):
1099 q.breakable()
1100 q.text("xid = ");
1101 if self.xid != None:
1102 q.text("%#x" % self.xid)
1103 else:
1104 q.text('None')
1105 q.text(","); q.breakable()
1106 q.text("code = ");
1107 q.text("%#x" % self.code)
1108 q.text(","); q.breakable()
1109 q.text("data = ");
1110 q.pp(self.data)
1111 q.breakable()
1112 q.text('}')
1113
1114error_msg.subtypes[14] = bad_property_error_msg
1115
1116class bad_request_error_msg(error_msg):
1117 version = 5
1118 type = 1
1119 err_type = 1
1120
1121 def __init__(self, xid=None, code=None, data=None):
1122 if xid != None:
1123 self.xid = xid
1124 else:
1125 self.xid = None
1126 if code != None:
1127 self.code = code
1128 else:
1129 self.code = 0
1130 if data != None:
1131 self.data = data
1132 else:
1133 self.data = ''
1134 return
1135
1136 def pack(self):
1137 packed = []
1138 packed.append(struct.pack("!B", self.version))
1139 packed.append(struct.pack("!B", self.type))
1140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1141 packed.append(struct.pack("!L", self.xid))
1142 packed.append(struct.pack("!H", self.err_type))
1143 packed.append(struct.pack("!H", self.code))
1144 packed.append(self.data)
1145 length = sum([len(x) for x in packed])
1146 packed[2] = struct.pack("!H", length)
1147 return ''.join(packed)
1148
1149 @staticmethod
1150 def unpack(reader):
1151 obj = bad_request_error_msg()
1152 _version = reader.read("!B")[0]
1153 assert(_version == 5)
1154 _type = reader.read("!B")[0]
1155 assert(_type == 1)
1156 _length = reader.read("!H")[0]
1157 orig_reader = reader
1158 reader = orig_reader.slice(_length, 4)
1159 obj.xid = reader.read("!L")[0]
1160 _err_type = reader.read("!H")[0]
1161 assert(_err_type == 1)
1162 obj.code = reader.read("!H")[0]
1163 obj.data = str(reader.read_all())
1164 return obj
1165
1166 def __eq__(self, other):
1167 if type(self) != type(other): return False
1168 if self.xid != other.xid: return False
1169 if self.code != other.code: return False
1170 if self.data != other.data: return False
1171 return True
1172
1173 def pretty_print(self, q):
1174 q.text("bad_request_error_msg {")
1175 with q.group():
1176 with q.indent(2):
1177 q.breakable()
1178 q.text("xid = ");
1179 if self.xid != None:
1180 q.text("%#x" % self.xid)
1181 else:
1182 q.text('None')
1183 q.text(","); q.breakable()
1184 q.text("code = ");
1185 q.text("%#x" % self.code)
1186 q.text(","); q.breakable()
1187 q.text("data = ");
1188 q.pp(self.data)
1189 q.breakable()
1190 q.text('}')
1191
1192error_msg.subtypes[1] = bad_request_error_msg
1193
1194class barrier_reply(message):
1195 version = 5
1196 type = 21
1197
1198 def __init__(self, xid=None):
1199 if xid != None:
1200 self.xid = xid
1201 else:
1202 self.xid = None
1203 return
1204
1205 def pack(self):
1206 packed = []
1207 packed.append(struct.pack("!B", self.version))
1208 packed.append(struct.pack("!B", self.type))
1209 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1210 packed.append(struct.pack("!L", self.xid))
1211 length = sum([len(x) for x in packed])
1212 packed[2] = struct.pack("!H", length)
1213 return ''.join(packed)
1214
1215 @staticmethod
1216 def unpack(reader):
1217 obj = barrier_reply()
1218 _version = reader.read("!B")[0]
1219 assert(_version == 5)
1220 _type = reader.read("!B")[0]
1221 assert(_type == 21)
1222 _length = reader.read("!H")[0]
1223 orig_reader = reader
1224 reader = orig_reader.slice(_length, 4)
1225 obj.xid = reader.read("!L")[0]
1226 return obj
1227
1228 def __eq__(self, other):
1229 if type(self) != type(other): return False
1230 if self.xid != other.xid: return False
1231 return True
1232
1233 def pretty_print(self, q):
1234 q.text("barrier_reply {")
1235 with q.group():
1236 with q.indent(2):
1237 q.breakable()
1238 q.text("xid = ");
1239 if self.xid != None:
1240 q.text("%#x" % self.xid)
1241 else:
1242 q.text('None')
1243 q.breakable()
1244 q.text('}')
1245
1246message.subtypes[21] = barrier_reply
1247
1248class barrier_request(message):
1249 version = 5
1250 type = 20
1251
1252 def __init__(self, xid=None):
1253 if xid != None:
1254 self.xid = xid
1255 else:
1256 self.xid = None
1257 return
1258
1259 def pack(self):
1260 packed = []
1261 packed.append(struct.pack("!B", self.version))
1262 packed.append(struct.pack("!B", self.type))
1263 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1264 packed.append(struct.pack("!L", self.xid))
1265 length = sum([len(x) for x in packed])
1266 packed[2] = struct.pack("!H", length)
1267 return ''.join(packed)
1268
1269 @staticmethod
1270 def unpack(reader):
1271 obj = barrier_request()
1272 _version = reader.read("!B")[0]
1273 assert(_version == 5)
1274 _type = reader.read("!B")[0]
1275 assert(_type == 20)
1276 _length = reader.read("!H")[0]
1277 orig_reader = reader
1278 reader = orig_reader.slice(_length, 4)
1279 obj.xid = reader.read("!L")[0]
1280 return obj
1281
1282 def __eq__(self, other):
1283 if type(self) != type(other): return False
1284 if self.xid != other.xid: return False
1285 return True
1286
1287 def pretty_print(self, q):
1288 q.text("barrier_request {")
1289 with q.group():
1290 with q.indent(2):
1291 q.breakable()
1292 q.text("xid = ");
1293 if self.xid != None:
1294 q.text("%#x" % self.xid)
1295 else:
1296 q.text('None')
1297 q.breakable()
1298 q.text('}')
1299
1300message.subtypes[20] = barrier_request
1301
1302class experimenter(message):
1303 subtypes = {}
1304
1305 version = 5
1306 type = 4
1307
1308 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1309 if xid != None:
1310 self.xid = xid
1311 else:
1312 self.xid = None
1313 if experimenter != None:
1314 self.experimenter = experimenter
1315 else:
1316 self.experimenter = 0
1317 if subtype != None:
1318 self.subtype = subtype
1319 else:
1320 self.subtype = 0
1321 if data != None:
1322 self.data = data
1323 else:
1324 self.data = ''
1325 return
1326
1327 def pack(self):
1328 packed = []
1329 packed.append(struct.pack("!B", self.version))
1330 packed.append(struct.pack("!B", self.type))
1331 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1332 packed.append(struct.pack("!L", self.xid))
1333 packed.append(struct.pack("!L", self.experimenter))
1334 packed.append(struct.pack("!L", self.subtype))
1335 packed.append(self.data)
1336 length = sum([len(x) for x in packed])
1337 packed[2] = struct.pack("!H", length)
1338 return ''.join(packed)
1339
1340 @staticmethod
1341 def unpack(reader):
1342 subtype, = reader.peek('!L', 8)
1343 subclass = experimenter.subtypes.get(subtype)
1344 if subclass:
1345 return subclass.unpack(reader)
1346
1347 obj = experimenter()
1348 _version = reader.read("!B")[0]
1349 assert(_version == 5)
1350 _type = reader.read("!B")[0]
1351 assert(_type == 4)
1352 _length = reader.read("!H")[0]
1353 orig_reader = reader
1354 reader = orig_reader.slice(_length, 4)
1355 obj.xid = reader.read("!L")[0]
1356 obj.experimenter = reader.read("!L")[0]
1357 obj.subtype = reader.read("!L")[0]
1358 obj.data = str(reader.read_all())
1359 return obj
1360
1361 def __eq__(self, other):
1362 if type(self) != type(other): return False
1363 if self.xid != other.xid: return False
1364 if self.experimenter != other.experimenter: return False
1365 if self.subtype != other.subtype: return False
1366 if self.data != other.data: return False
1367 return True
1368
1369 def pretty_print(self, q):
1370 q.text("experimenter {")
1371 with q.group():
1372 with q.indent(2):
1373 q.breakable()
1374 q.text("xid = ");
1375 if self.xid != None:
1376 q.text("%#x" % self.xid)
1377 else:
1378 q.text('None')
1379 q.text(","); q.breakable()
1380 q.text("subtype = ");
1381 q.text("%#x" % self.subtype)
1382 q.text(","); q.breakable()
1383 q.text("data = ");
1384 q.pp(self.data)
1385 q.breakable()
1386 q.text('}')
1387
1388message.subtypes[4] = experimenter
1389
1390class bsn_header(experimenter):
1391 subtypes = {}
1392
1393 version = 5
1394 type = 4
1395 experimenter = 6035143
1396
1397 def __init__(self, xid=None, subtype=None):
1398 if xid != None:
1399 self.xid = xid
1400 else:
1401 self.xid = None
1402 if subtype != None:
1403 self.subtype = subtype
1404 else:
1405 self.subtype = 0
1406 return
1407
1408 def pack(self):
1409 packed = []
1410 packed.append(struct.pack("!B", self.version))
1411 packed.append(struct.pack("!B", self.type))
1412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1413 packed.append(struct.pack("!L", self.xid))
1414 packed.append(struct.pack("!L", self.experimenter))
1415 packed.append(struct.pack("!L", self.subtype))
1416 length = sum([len(x) for x in packed])
1417 packed[2] = struct.pack("!H", length)
1418 return ''.join(packed)
1419
1420 @staticmethod
1421 def unpack(reader):
1422 subtype, = reader.peek('!L', 12)
1423 subclass = bsn_header.subtypes.get(subtype)
1424 if subclass:
1425 return subclass.unpack(reader)
1426
1427 obj = bsn_header()
1428 _version = reader.read("!B")[0]
1429 assert(_version == 5)
1430 _type = reader.read("!B")[0]
1431 assert(_type == 4)
1432 _length = reader.read("!H")[0]
1433 orig_reader = reader
1434 reader = orig_reader.slice(_length, 4)
1435 obj.xid = reader.read("!L")[0]
1436 _experimenter = reader.read("!L")[0]
1437 assert(_experimenter == 6035143)
1438 obj.subtype = reader.read("!L")[0]
1439 return obj
1440
1441 def __eq__(self, other):
1442 if type(self) != type(other): return False
1443 if self.xid != other.xid: return False
1444 if self.subtype != other.subtype: return False
1445 return True
1446
1447 def pretty_print(self, q):
1448 q.text("bsn_header {")
1449 with q.group():
1450 with q.indent(2):
1451 q.breakable()
1452 q.text("xid = ");
1453 if self.xid != None:
1454 q.text("%#x" % self.xid)
1455 else:
1456 q.text('None')
1457 q.breakable()
1458 q.text('}')
1459
1460experimenter.subtypes[6035143] = bsn_header
1461
1462class bsn_arp_idle(bsn_header):
1463 version = 5
1464 type = 4
1465 experimenter = 6035143
1466 subtype = 60
1467
1468 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1469 if xid != None:
1470 self.xid = xid
1471 else:
1472 self.xid = None
1473 if vlan_vid != None:
1474 self.vlan_vid = vlan_vid
1475 else:
1476 self.vlan_vid = 0
1477 if ipv4_addr != None:
1478 self.ipv4_addr = ipv4_addr
1479 else:
1480 self.ipv4_addr = 0
1481 return
1482
1483 def pack(self):
1484 packed = []
1485 packed.append(struct.pack("!B", self.version))
1486 packed.append(struct.pack("!B", self.type))
1487 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1488 packed.append(struct.pack("!L", self.xid))
1489 packed.append(struct.pack("!L", self.experimenter))
1490 packed.append(struct.pack("!L", self.subtype))
1491 packed.append(struct.pack("!H", self.vlan_vid))
1492 packed.append('\x00' * 2)
1493 packed.append(struct.pack("!L", self.ipv4_addr))
1494 length = sum([len(x) for x in packed])
1495 packed[2] = struct.pack("!H", length)
1496 return ''.join(packed)
1497
1498 @staticmethod
1499 def unpack(reader):
1500 obj = bsn_arp_idle()
1501 _version = reader.read("!B")[0]
1502 assert(_version == 5)
1503 _type = reader.read("!B")[0]
1504 assert(_type == 4)
1505 _length = reader.read("!H")[0]
1506 orig_reader = reader
1507 reader = orig_reader.slice(_length, 4)
1508 obj.xid = reader.read("!L")[0]
1509 _experimenter = reader.read("!L")[0]
1510 assert(_experimenter == 6035143)
1511 _subtype = reader.read("!L")[0]
1512 assert(_subtype == 60)
1513 obj.vlan_vid = reader.read("!H")[0]
1514 reader.skip(2)
1515 obj.ipv4_addr = reader.read("!L")[0]
1516 return obj
1517
1518 def __eq__(self, other):
1519 if type(self) != type(other): return False
1520 if self.xid != other.xid: return False
1521 if self.vlan_vid != other.vlan_vid: return False
1522 if self.ipv4_addr != other.ipv4_addr: return False
1523 return True
1524
1525 def pretty_print(self, q):
1526 q.text("bsn_arp_idle {")
1527 with q.group():
1528 with q.indent(2):
1529 q.breakable()
1530 q.text("xid = ");
1531 if self.xid != None:
1532 q.text("%#x" % self.xid)
1533 else:
1534 q.text('None')
1535 q.text(","); q.breakable()
1536 q.text("vlan_vid = ");
1537 q.text("%#x" % self.vlan_vid)
1538 q.text(","); q.breakable()
1539 q.text("ipv4_addr = ");
1540 q.text(util.pretty_ipv4(self.ipv4_addr))
1541 q.breakable()
1542 q.text('}')
1543
1544bsn_header.subtypes[60] = bsn_arp_idle
1545
1546class experimenter_error_msg(error_msg):
1547 subtypes = {}
1548
1549 version = 5
1550 type = 1
1551 err_type = 65535
1552
1553 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
1554 if xid != None:
1555 self.xid = xid
1556 else:
1557 self.xid = None
1558 if subtype != None:
1559 self.subtype = subtype
1560 else:
1561 self.subtype = 0
1562 if experimenter != None:
1563 self.experimenter = experimenter
1564 else:
1565 self.experimenter = 0
1566 if data != None:
1567 self.data = data
1568 else:
1569 self.data = ''
1570 return
1571
1572 def pack(self):
1573 packed = []
1574 packed.append(struct.pack("!B", self.version))
1575 packed.append(struct.pack("!B", self.type))
1576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1577 packed.append(struct.pack("!L", self.xid))
1578 packed.append(struct.pack("!H", self.err_type))
1579 packed.append(struct.pack("!H", self.subtype))
1580 packed.append(struct.pack("!L", self.experimenter))
1581 packed.append(self.data)
1582 length = sum([len(x) for x in packed])
1583 packed[2] = struct.pack("!H", length)
1584 return ''.join(packed)
1585
1586 @staticmethod
1587 def unpack(reader):
1588 subtype, = reader.peek('!L', 12)
1589 subclass = experimenter_error_msg.subtypes.get(subtype)
1590 if subclass:
1591 return subclass.unpack(reader)
1592
1593 obj = experimenter_error_msg()
1594 _version = reader.read("!B")[0]
1595 assert(_version == 5)
1596 _type = reader.read("!B")[0]
1597 assert(_type == 1)
1598 _length = reader.read("!H")[0]
1599 orig_reader = reader
1600 reader = orig_reader.slice(_length, 4)
1601 obj.xid = reader.read("!L")[0]
1602 _err_type = reader.read("!H")[0]
1603 assert(_err_type == 65535)
1604 obj.subtype = reader.read("!H")[0]
1605 obj.experimenter = reader.read("!L")[0]
1606 obj.data = str(reader.read_all())
1607 return obj
1608
1609 def __eq__(self, other):
1610 if type(self) != type(other): return False
1611 if self.xid != other.xid: return False
1612 if self.subtype != other.subtype: return False
1613 if self.experimenter != other.experimenter: return False
1614 if self.data != other.data: return False
1615 return True
1616
1617 def pretty_print(self, q):
1618 q.text("experimenter_error_msg {")
1619 with q.group():
1620 with q.indent(2):
1621 q.breakable()
1622 q.text("xid = ");
1623 if self.xid != None:
1624 q.text("%#x" % self.xid)
1625 else:
1626 q.text('None')
1627 q.text(","); q.breakable()
1628 q.text("subtype = ");
1629 q.text("%#x" % self.subtype)
1630 q.text(","); q.breakable()
1631 q.text("data = ");
1632 q.pp(self.data)
1633 q.breakable()
1634 q.text('}')
1635
1636error_msg.subtypes[65535] = experimenter_error_msg
1637
1638class bsn_base_error(experimenter_error_msg):
1639 subtypes = {}
1640
1641 version = 5
1642 type = 1
1643 err_type = 65535
1644 experimenter = 6035143
1645
1646 def __init__(self, xid=None, subtype=None, err_msg=None, data=None):
1647 if xid != None:
1648 self.xid = xid
1649 else:
1650 self.xid = None
1651 if subtype != None:
1652 self.subtype = subtype
1653 else:
1654 self.subtype = 0
1655 if err_msg != None:
1656 self.err_msg = err_msg
1657 else:
1658 self.err_msg = ""
1659 if data != None:
1660 self.data = data
1661 else:
1662 self.data = ''
1663 return
1664
1665 def pack(self):
1666 packed = []
1667 packed.append(struct.pack("!B", self.version))
1668 packed.append(struct.pack("!B", self.type))
1669 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1670 packed.append(struct.pack("!L", self.xid))
1671 packed.append(struct.pack("!H", self.err_type))
1672 packed.append(struct.pack("!H", self.subtype))
1673 packed.append(struct.pack("!L", self.experimenter))
1674 packed.append(struct.pack("!256s", self.err_msg))
1675 packed.append(self.data)
1676 length = sum([len(x) for x in packed])
1677 packed[2] = struct.pack("!H", length)
1678 return ''.join(packed)
1679
1680 @staticmethod
1681 def unpack(reader):
1682 subtype, = reader.peek('!H', 10)
1683 subclass = bsn_base_error.subtypes.get(subtype)
1684 if subclass:
1685 return subclass.unpack(reader)
1686
1687 obj = bsn_base_error()
1688 _version = reader.read("!B")[0]
1689 assert(_version == 5)
1690 _type = reader.read("!B")[0]
1691 assert(_type == 1)
1692 _length = reader.read("!H")[0]
1693 orig_reader = reader
1694 reader = orig_reader.slice(_length, 4)
1695 obj.xid = reader.read("!L")[0]
1696 _err_type = reader.read("!H")[0]
1697 assert(_err_type == 65535)
1698 obj.subtype = reader.read("!H")[0]
1699 _experimenter = reader.read("!L")[0]
1700 assert(_experimenter == 6035143)
1701 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
1702 obj.data = str(reader.read_all())
1703 return obj
1704
1705 def __eq__(self, other):
1706 if type(self) != type(other): return False
1707 if self.xid != other.xid: return False
1708 if self.subtype != other.subtype: return False
1709 if self.err_msg != other.err_msg: return False
1710 if self.data != other.data: return False
1711 return True
1712
1713 def pretty_print(self, q):
1714 q.text("bsn_base_error {")
1715 with q.group():
1716 with q.indent(2):
1717 q.breakable()
1718 q.text("xid = ");
1719 if self.xid != None:
1720 q.text("%#x" % self.xid)
1721 else:
1722 q.text('None')
1723 q.text(","); q.breakable()
1724 q.text("err_msg = ");
1725 q.pp(self.err_msg)
1726 q.text(","); q.breakable()
1727 q.text("data = ");
1728 q.pp(self.data)
1729 q.breakable()
1730 q.text('}')
1731
1732experimenter_error_msg.subtypes[6035143] = bsn_base_error
1733
1734class bsn_bw_clear_data_reply(bsn_header):
1735 version = 5
1736 type = 4
1737 experimenter = 6035143
1738 subtype = 22
1739
1740 def __init__(self, xid=None, status=None):
1741 if xid != None:
1742 self.xid = xid
1743 else:
1744 self.xid = None
1745 if status != None:
1746 self.status = status
1747 else:
1748 self.status = 0
1749 return
1750
1751 def pack(self):
1752 packed = []
1753 packed.append(struct.pack("!B", self.version))
1754 packed.append(struct.pack("!B", self.type))
1755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1756 packed.append(struct.pack("!L", self.xid))
1757 packed.append(struct.pack("!L", self.experimenter))
1758 packed.append(struct.pack("!L", self.subtype))
1759 packed.append(struct.pack("!L", self.status))
1760 length = sum([len(x) for x in packed])
1761 packed[2] = struct.pack("!H", length)
1762 return ''.join(packed)
1763
1764 @staticmethod
1765 def unpack(reader):
1766 obj = bsn_bw_clear_data_reply()
1767 _version = reader.read("!B")[0]
1768 assert(_version == 5)
1769 _type = reader.read("!B")[0]
1770 assert(_type == 4)
1771 _length = reader.read("!H")[0]
1772 orig_reader = reader
1773 reader = orig_reader.slice(_length, 4)
1774 obj.xid = reader.read("!L")[0]
1775 _experimenter = reader.read("!L")[0]
1776 assert(_experimenter == 6035143)
1777 _subtype = reader.read("!L")[0]
1778 assert(_subtype == 22)
1779 obj.status = reader.read("!L")[0]
1780 return obj
1781
1782 def __eq__(self, other):
1783 if type(self) != type(other): return False
1784 if self.xid != other.xid: return False
1785 if self.status != other.status: return False
1786 return True
1787
1788 def pretty_print(self, q):
1789 q.text("bsn_bw_clear_data_reply {")
1790 with q.group():
1791 with q.indent(2):
1792 q.breakable()
1793 q.text("xid = ");
1794 if self.xid != None:
1795 q.text("%#x" % self.xid)
1796 else:
1797 q.text('None')
1798 q.text(","); q.breakable()
1799 q.text("status = ");
1800 q.text("%#x" % self.status)
1801 q.breakable()
1802 q.text('}')
1803
1804bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1805
1806class bsn_bw_clear_data_request(bsn_header):
1807 version = 5
1808 type = 4
1809 experimenter = 6035143
1810 subtype = 21
1811
1812 def __init__(self, xid=None):
1813 if xid != None:
1814 self.xid = xid
1815 else:
1816 self.xid = None
1817 return
1818
1819 def pack(self):
1820 packed = []
1821 packed.append(struct.pack("!B", self.version))
1822 packed.append(struct.pack("!B", self.type))
1823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1824 packed.append(struct.pack("!L", self.xid))
1825 packed.append(struct.pack("!L", self.experimenter))
1826 packed.append(struct.pack("!L", self.subtype))
1827 length = sum([len(x) for x in packed])
1828 packed[2] = struct.pack("!H", length)
1829 return ''.join(packed)
1830
1831 @staticmethod
1832 def unpack(reader):
1833 obj = bsn_bw_clear_data_request()
1834 _version = reader.read("!B")[0]
1835 assert(_version == 5)
1836 _type = reader.read("!B")[0]
1837 assert(_type == 4)
1838 _length = reader.read("!H")[0]
1839 orig_reader = reader
1840 reader = orig_reader.slice(_length, 4)
1841 obj.xid = reader.read("!L")[0]
1842 _experimenter = reader.read("!L")[0]
1843 assert(_experimenter == 6035143)
1844 _subtype = reader.read("!L")[0]
1845 assert(_subtype == 21)
1846 return obj
1847
1848 def __eq__(self, other):
1849 if type(self) != type(other): return False
1850 if self.xid != other.xid: return False
1851 return True
1852
1853 def pretty_print(self, q):
1854 q.text("bsn_bw_clear_data_request {")
1855 with q.group():
1856 with q.indent(2):
1857 q.breakable()
1858 q.text("xid = ");
1859 if self.xid != None:
1860 q.text("%#x" % self.xid)
1861 else:
1862 q.text('None')
1863 q.breakable()
1864 q.text('}')
1865
1866bsn_header.subtypes[21] = bsn_bw_clear_data_request
1867
1868class bsn_bw_enable_get_reply(bsn_header):
1869 version = 5
1870 type = 4
1871 experimenter = 6035143
1872 subtype = 20
1873
1874 def __init__(self, xid=None, enabled=None):
1875 if xid != None:
1876 self.xid = xid
1877 else:
1878 self.xid = None
1879 if enabled != None:
1880 self.enabled = enabled
1881 else:
1882 self.enabled = 0
1883 return
1884
1885 def pack(self):
1886 packed = []
1887 packed.append(struct.pack("!B", self.version))
1888 packed.append(struct.pack("!B", self.type))
1889 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1890 packed.append(struct.pack("!L", self.xid))
1891 packed.append(struct.pack("!L", self.experimenter))
1892 packed.append(struct.pack("!L", self.subtype))
1893 packed.append(struct.pack("!L", self.enabled))
1894 length = sum([len(x) for x in packed])
1895 packed[2] = struct.pack("!H", length)
1896 return ''.join(packed)
1897
1898 @staticmethod
1899 def unpack(reader):
1900 obj = bsn_bw_enable_get_reply()
1901 _version = reader.read("!B")[0]
1902 assert(_version == 5)
1903 _type = reader.read("!B")[0]
1904 assert(_type == 4)
1905 _length = reader.read("!H")[0]
1906 orig_reader = reader
1907 reader = orig_reader.slice(_length, 4)
1908 obj.xid = reader.read("!L")[0]
1909 _experimenter = reader.read("!L")[0]
1910 assert(_experimenter == 6035143)
1911 _subtype = reader.read("!L")[0]
1912 assert(_subtype == 20)
1913 obj.enabled = reader.read("!L")[0]
1914 return obj
1915
1916 def __eq__(self, other):
1917 if type(self) != type(other): return False
1918 if self.xid != other.xid: return False
1919 if self.enabled != other.enabled: return False
1920 return True
1921
1922 def pretty_print(self, q):
1923 q.text("bsn_bw_enable_get_reply {")
1924 with q.group():
1925 with q.indent(2):
1926 q.breakable()
1927 q.text("xid = ");
1928 if self.xid != None:
1929 q.text("%#x" % self.xid)
1930 else:
1931 q.text('None')
1932 q.text(","); q.breakable()
1933 q.text("enabled = ");
1934 q.text("%#x" % self.enabled)
1935 q.breakable()
1936 q.text('}')
1937
1938bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1939
1940class bsn_bw_enable_get_request(bsn_header):
1941 version = 5
1942 type = 4
1943 experimenter = 6035143
1944 subtype = 19
1945
1946 def __init__(self, xid=None):
1947 if xid != None:
1948 self.xid = xid
1949 else:
1950 self.xid = None
1951 return
1952
1953 def pack(self):
1954 packed = []
1955 packed.append(struct.pack("!B", self.version))
1956 packed.append(struct.pack("!B", self.type))
1957 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1958 packed.append(struct.pack("!L", self.xid))
1959 packed.append(struct.pack("!L", self.experimenter))
1960 packed.append(struct.pack("!L", self.subtype))
1961 length = sum([len(x) for x in packed])
1962 packed[2] = struct.pack("!H", length)
1963 return ''.join(packed)
1964
1965 @staticmethod
1966 def unpack(reader):
1967 obj = bsn_bw_enable_get_request()
1968 _version = reader.read("!B")[0]
1969 assert(_version == 5)
1970 _type = reader.read("!B")[0]
1971 assert(_type == 4)
1972 _length = reader.read("!H")[0]
1973 orig_reader = reader
1974 reader = orig_reader.slice(_length, 4)
1975 obj.xid = reader.read("!L")[0]
1976 _experimenter = reader.read("!L")[0]
1977 assert(_experimenter == 6035143)
1978 _subtype = reader.read("!L")[0]
1979 assert(_subtype == 19)
1980 return obj
1981
1982 def __eq__(self, other):
1983 if type(self) != type(other): return False
1984 if self.xid != other.xid: return False
1985 return True
1986
1987 def pretty_print(self, q):
1988 q.text("bsn_bw_enable_get_request {")
1989 with q.group():
1990 with q.indent(2):
1991 q.breakable()
1992 q.text("xid = ");
1993 if self.xid != None:
1994 q.text("%#x" % self.xid)
1995 else:
1996 q.text('None')
1997 q.breakable()
1998 q.text('}')
1999
2000bsn_header.subtypes[19] = bsn_bw_enable_get_request
2001
2002class bsn_bw_enable_set_reply(bsn_header):
2003 version = 5
2004 type = 4
2005 experimenter = 6035143
2006 subtype = 23
2007
2008 def __init__(self, xid=None, enable=None, status=None):
2009 if xid != None:
2010 self.xid = xid
2011 else:
2012 self.xid = None
2013 if enable != None:
2014 self.enable = enable
2015 else:
2016 self.enable = 0
2017 if status != None:
2018 self.status = status
2019 else:
2020 self.status = 0
2021 return
2022
2023 def pack(self):
2024 packed = []
2025 packed.append(struct.pack("!B", self.version))
2026 packed.append(struct.pack("!B", self.type))
2027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2028 packed.append(struct.pack("!L", self.xid))
2029 packed.append(struct.pack("!L", self.experimenter))
2030 packed.append(struct.pack("!L", self.subtype))
2031 packed.append(struct.pack("!L", self.enable))
2032 packed.append(struct.pack("!L", self.status))
2033 length = sum([len(x) for x in packed])
2034 packed[2] = struct.pack("!H", length)
2035 return ''.join(packed)
2036
2037 @staticmethod
2038 def unpack(reader):
2039 obj = bsn_bw_enable_set_reply()
2040 _version = reader.read("!B")[0]
2041 assert(_version == 5)
2042 _type = reader.read("!B")[0]
2043 assert(_type == 4)
2044 _length = reader.read("!H")[0]
2045 orig_reader = reader
2046 reader = orig_reader.slice(_length, 4)
2047 obj.xid = reader.read("!L")[0]
2048 _experimenter = reader.read("!L")[0]
2049 assert(_experimenter == 6035143)
2050 _subtype = reader.read("!L")[0]
2051 assert(_subtype == 23)
2052 obj.enable = reader.read("!L")[0]
2053 obj.status = reader.read("!L")[0]
2054 return obj
2055
2056 def __eq__(self, other):
2057 if type(self) != type(other): return False
2058 if self.xid != other.xid: return False
2059 if self.enable != other.enable: return False
2060 if self.status != other.status: return False
2061 return True
2062
2063 def pretty_print(self, q):
2064 q.text("bsn_bw_enable_set_reply {")
2065 with q.group():
2066 with q.indent(2):
2067 q.breakable()
2068 q.text("xid = ");
2069 if self.xid != None:
2070 q.text("%#x" % self.xid)
2071 else:
2072 q.text('None')
2073 q.text(","); q.breakable()
2074 q.text("enable = ");
2075 q.text("%#x" % self.enable)
2076 q.text(","); q.breakable()
2077 q.text("status = ");
2078 q.text("%#x" % self.status)
2079 q.breakable()
2080 q.text('}')
2081
2082bsn_header.subtypes[23] = bsn_bw_enable_set_reply
2083
2084class bsn_bw_enable_set_request(bsn_header):
2085 version = 5
2086 type = 4
2087 experimenter = 6035143
2088 subtype = 18
2089
2090 def __init__(self, xid=None, enable=None):
2091 if xid != None:
2092 self.xid = xid
2093 else:
2094 self.xid = None
2095 if enable != None:
2096 self.enable = enable
2097 else:
2098 self.enable = 0
2099 return
2100
2101 def pack(self):
2102 packed = []
2103 packed.append(struct.pack("!B", self.version))
2104 packed.append(struct.pack("!B", self.type))
2105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2106 packed.append(struct.pack("!L", self.xid))
2107 packed.append(struct.pack("!L", self.experimenter))
2108 packed.append(struct.pack("!L", self.subtype))
2109 packed.append(struct.pack("!L", self.enable))
2110 length = sum([len(x) for x in packed])
2111 packed[2] = struct.pack("!H", length)
2112 return ''.join(packed)
2113
2114 @staticmethod
2115 def unpack(reader):
2116 obj = bsn_bw_enable_set_request()
2117 _version = reader.read("!B")[0]
2118 assert(_version == 5)
2119 _type = reader.read("!B")[0]
2120 assert(_type == 4)
2121 _length = reader.read("!H")[0]
2122 orig_reader = reader
2123 reader = orig_reader.slice(_length, 4)
2124 obj.xid = reader.read("!L")[0]
2125 _experimenter = reader.read("!L")[0]
2126 assert(_experimenter == 6035143)
2127 _subtype = reader.read("!L")[0]
2128 assert(_subtype == 18)
2129 obj.enable = reader.read("!L")[0]
2130 return obj
2131
2132 def __eq__(self, other):
2133 if type(self) != type(other): return False
2134 if self.xid != other.xid: return False
2135 if self.enable != other.enable: return False
2136 return True
2137
2138 def pretty_print(self, q):
2139 q.text("bsn_bw_enable_set_request {")
2140 with q.group():
2141 with q.indent(2):
2142 q.breakable()
2143 q.text("xid = ");
2144 if self.xid != None:
2145 q.text("%#x" % self.xid)
2146 else:
2147 q.text('None')
2148 q.text(","); q.breakable()
2149 q.text("enable = ");
2150 q.text("%#x" % self.enable)
2151 q.breakable()
2152 q.text('}')
2153
2154bsn_header.subtypes[18] = bsn_bw_enable_set_request
2155
2156class bsn_controller_connections_reply(bsn_header):
2157 version = 5
2158 type = 4
2159 experimenter = 6035143
2160 subtype = 57
2161
2162 def __init__(self, xid=None, connections=None):
2163 if xid != None:
2164 self.xid = xid
2165 else:
2166 self.xid = None
2167 if connections != None:
2168 self.connections = connections
2169 else:
2170 self.connections = []
2171 return
2172
2173 def pack(self):
2174 packed = []
2175 packed.append(struct.pack("!B", self.version))
2176 packed.append(struct.pack("!B", self.type))
2177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2178 packed.append(struct.pack("!L", self.xid))
2179 packed.append(struct.pack("!L", self.experimenter))
2180 packed.append(struct.pack("!L", self.subtype))
2181 packed.append(loxi.generic_util.pack_list(self.connections))
2182 length = sum([len(x) for x in packed])
2183 packed[2] = struct.pack("!H", length)
2184 return ''.join(packed)
2185
2186 @staticmethod
2187 def unpack(reader):
2188 obj = bsn_controller_connections_reply()
2189 _version = reader.read("!B")[0]
2190 assert(_version == 5)
2191 _type = reader.read("!B")[0]
2192 assert(_type == 4)
2193 _length = reader.read("!H")[0]
2194 orig_reader = reader
2195 reader = orig_reader.slice(_length, 4)
2196 obj.xid = reader.read("!L")[0]
2197 _experimenter = reader.read("!L")[0]
2198 assert(_experimenter == 6035143)
2199 _subtype = reader.read("!L")[0]
2200 assert(_subtype == 57)
2201 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
2202 return obj
2203
2204 def __eq__(self, other):
2205 if type(self) != type(other): return False
2206 if self.xid != other.xid: return False
2207 if self.connections != other.connections: return False
2208 return True
2209
2210 def pretty_print(self, q):
2211 q.text("bsn_controller_connections_reply {")
2212 with q.group():
2213 with q.indent(2):
2214 q.breakable()
2215 q.text("xid = ");
2216 if self.xid != None:
2217 q.text("%#x" % self.xid)
2218 else:
2219 q.text('None')
2220 q.text(","); q.breakable()
2221 q.text("connections = ");
2222 q.pp(self.connections)
2223 q.breakable()
2224 q.text('}')
2225
2226bsn_header.subtypes[57] = bsn_controller_connections_reply
2227
2228class bsn_controller_connections_request(bsn_header):
2229 version = 5
2230 type = 4
2231 experimenter = 6035143
2232 subtype = 56
2233
2234 def __init__(self, xid=None):
2235 if xid != None:
2236 self.xid = xid
2237 else:
2238 self.xid = None
2239 return
2240
2241 def pack(self):
2242 packed = []
2243 packed.append(struct.pack("!B", self.version))
2244 packed.append(struct.pack("!B", self.type))
2245 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2246 packed.append(struct.pack("!L", self.xid))
2247 packed.append(struct.pack("!L", self.experimenter))
2248 packed.append(struct.pack("!L", self.subtype))
2249 length = sum([len(x) for x in packed])
2250 packed[2] = struct.pack("!H", length)
2251 return ''.join(packed)
2252
2253 @staticmethod
2254 def unpack(reader):
2255 obj = bsn_controller_connections_request()
2256 _version = reader.read("!B")[0]
2257 assert(_version == 5)
2258 _type = reader.read("!B")[0]
2259 assert(_type == 4)
2260 _length = reader.read("!H")[0]
2261 orig_reader = reader
2262 reader = orig_reader.slice(_length, 4)
2263 obj.xid = reader.read("!L")[0]
2264 _experimenter = reader.read("!L")[0]
2265 assert(_experimenter == 6035143)
2266 _subtype = reader.read("!L")[0]
2267 assert(_subtype == 56)
2268 return obj
2269
2270 def __eq__(self, other):
2271 if type(self) != type(other): return False
2272 if self.xid != other.xid: return False
2273 return True
2274
2275 def pretty_print(self, q):
2276 q.text("bsn_controller_connections_request {")
2277 with q.group():
2278 with q.indent(2):
2279 q.breakable()
2280 q.text("xid = ");
2281 if self.xid != None:
2282 q.text("%#x" % self.xid)
2283 else:
2284 q.text('None')
2285 q.breakable()
2286 q.text('}')
2287
2288bsn_header.subtypes[56] = bsn_controller_connections_request
2289
2290class experimenter_stats_reply(stats_reply):
2291 subtypes = {}
2292
2293 version = 5
2294 type = 19
2295 stats_type = 65535
2296
2297 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2298 if xid != None:
2299 self.xid = xid
2300 else:
2301 self.xid = None
2302 if flags != None:
2303 self.flags = flags
2304 else:
2305 self.flags = 0
2306 if experimenter != None:
2307 self.experimenter = experimenter
2308 else:
2309 self.experimenter = 0
2310 if subtype != None:
2311 self.subtype = subtype
2312 else:
2313 self.subtype = 0
2314 return
2315
2316 def pack(self):
2317 packed = []
2318 packed.append(struct.pack("!B", self.version))
2319 packed.append(struct.pack("!B", self.type))
2320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2321 packed.append(struct.pack("!L", self.xid))
2322 packed.append(struct.pack("!H", self.stats_type))
2323 packed.append(struct.pack("!H", self.flags))
2324 packed.append('\x00' * 4)
2325 packed.append(struct.pack("!L", self.experimenter))
2326 packed.append(struct.pack("!L", self.subtype))
2327 length = sum([len(x) for x in packed])
2328 packed[2] = struct.pack("!H", length)
2329 return ''.join(packed)
2330
2331 @staticmethod
2332 def unpack(reader):
2333 subtype, = reader.peek('!L', 16)
2334 subclass = experimenter_stats_reply.subtypes.get(subtype)
2335 if subclass:
2336 return subclass.unpack(reader)
2337
2338 obj = experimenter_stats_reply()
2339 _version = reader.read("!B")[0]
2340 assert(_version == 5)
2341 _type = reader.read("!B")[0]
2342 assert(_type == 19)
2343 _length = reader.read("!H")[0]
2344 orig_reader = reader
2345 reader = orig_reader.slice(_length, 4)
2346 obj.xid = reader.read("!L")[0]
2347 _stats_type = reader.read("!H")[0]
2348 assert(_stats_type == 65535)
2349 obj.flags = reader.read("!H")[0]
2350 reader.skip(4)
2351 obj.experimenter = reader.read("!L")[0]
2352 obj.subtype = reader.read("!L")[0]
2353 return obj
2354
2355 def __eq__(self, other):
2356 if type(self) != type(other): return False
2357 if self.xid != other.xid: return False
2358 if self.flags != other.flags: return False
2359 if self.experimenter != other.experimenter: return False
2360 if self.subtype != other.subtype: return False
2361 return True
2362
2363 def pretty_print(self, q):
2364 q.text("experimenter_stats_reply {")
2365 with q.group():
2366 with q.indent(2):
2367 q.breakable()
2368 q.text("xid = ");
2369 if self.xid != None:
2370 q.text("%#x" % self.xid)
2371 else:
2372 q.text('None')
2373 q.text(","); q.breakable()
2374 q.text("flags = ");
2375 q.text("%#x" % self.flags)
2376 q.text(","); q.breakable()
2377 q.text("subtype = ");
2378 q.text("%#x" % self.subtype)
2379 q.breakable()
2380 q.text('}')
2381
2382stats_reply.subtypes[65535] = experimenter_stats_reply
2383
2384class bsn_stats_reply(experimenter_stats_reply):
2385 subtypes = {}
2386
2387 version = 5
2388 type = 19
2389 stats_type = 65535
2390 experimenter = 6035143
2391
2392 def __init__(self, xid=None, flags=None, subtype=None):
2393 if xid != None:
2394 self.xid = xid
2395 else:
2396 self.xid = None
2397 if flags != None:
2398 self.flags = flags
2399 else:
2400 self.flags = 0
2401 if subtype != None:
2402 self.subtype = subtype
2403 else:
2404 self.subtype = 0
2405 return
2406
2407 def pack(self):
2408 packed = []
2409 packed.append(struct.pack("!B", self.version))
2410 packed.append(struct.pack("!B", self.type))
2411 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2412 packed.append(struct.pack("!L", self.xid))
2413 packed.append(struct.pack("!H", self.stats_type))
2414 packed.append(struct.pack("!H", self.flags))
2415 packed.append('\x00' * 4)
2416 packed.append(struct.pack("!L", self.experimenter))
2417 packed.append(struct.pack("!L", self.subtype))
2418 length = sum([len(x) for x in packed])
2419 packed[2] = struct.pack("!H", length)
2420 return ''.join(packed)
2421
2422 @staticmethod
2423 def unpack(reader):
2424 subtype, = reader.peek('!L', 20)
2425 subclass = bsn_stats_reply.subtypes.get(subtype)
2426 if subclass:
2427 return subclass.unpack(reader)
2428
2429 obj = bsn_stats_reply()
2430 _version = reader.read("!B")[0]
2431 assert(_version == 5)
2432 _type = reader.read("!B")[0]
2433 assert(_type == 19)
2434 _length = reader.read("!H")[0]
2435 orig_reader = reader
2436 reader = orig_reader.slice(_length, 4)
2437 obj.xid = reader.read("!L")[0]
2438 _stats_type = reader.read("!H")[0]
2439 assert(_stats_type == 65535)
2440 obj.flags = reader.read("!H")[0]
2441 reader.skip(4)
2442 _experimenter = reader.read("!L")[0]
2443 assert(_experimenter == 6035143)
2444 obj.subtype = reader.read("!L")[0]
2445 return obj
2446
2447 def __eq__(self, other):
2448 if type(self) != type(other): return False
2449 if self.xid != other.xid: return False
2450 if self.flags != other.flags: return False
2451 if self.subtype != other.subtype: return False
2452 return True
2453
2454 def pretty_print(self, q):
2455 q.text("bsn_stats_reply {")
2456 with q.group():
2457 with q.indent(2):
2458 q.breakable()
2459 q.text("xid = ");
2460 if self.xid != None:
2461 q.text("%#x" % self.xid)
2462 else:
2463 q.text('None')
2464 q.text(","); q.breakable()
2465 q.text("flags = ");
2466 q.text("%#x" % self.flags)
2467 q.breakable()
2468 q.text('}')
2469
2470experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2471
2472class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
2473 version = 5
2474 type = 19
2475 stats_type = 65535
2476 experimenter = 6035143
2477 subtype = 13
2478
2479 def __init__(self, xid=None, flags=None, entries=None):
2480 if xid != None:
2481 self.xid = xid
2482 else:
2483 self.xid = None
2484 if flags != None:
2485 self.flags = flags
2486 else:
2487 self.flags = 0
2488 if entries != None:
2489 self.entries = entries
2490 else:
2491 self.entries = []
2492 return
2493
2494 def pack(self):
2495 packed = []
2496 packed.append(struct.pack("!B", self.version))
2497 packed.append(struct.pack("!B", self.type))
2498 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2499 packed.append(struct.pack("!L", self.xid))
2500 packed.append(struct.pack("!H", self.stats_type))
2501 packed.append(struct.pack("!H", self.flags))
2502 packed.append('\x00' * 4)
2503 packed.append(struct.pack("!L", self.experimenter))
2504 packed.append(struct.pack("!L", self.subtype))
2505 packed.append(loxi.generic_util.pack_list(self.entries))
2506 length = sum([len(x) for x in packed])
2507 packed[2] = struct.pack("!H", length)
2508 return ''.join(packed)
2509
2510 @staticmethod
2511 def unpack(reader):
2512 obj = bsn_debug_counter_desc_stats_reply()
2513 _version = reader.read("!B")[0]
2514 assert(_version == 5)
2515 _type = reader.read("!B")[0]
2516 assert(_type == 19)
2517 _length = reader.read("!H")[0]
2518 orig_reader = reader
2519 reader = orig_reader.slice(_length, 4)
2520 obj.xid = reader.read("!L")[0]
2521 _stats_type = reader.read("!H")[0]
2522 assert(_stats_type == 65535)
2523 obj.flags = reader.read("!H")[0]
2524 reader.skip(4)
2525 _experimenter = reader.read("!L")[0]
2526 assert(_experimenter == 6035143)
2527 _subtype = reader.read("!L")[0]
2528 assert(_subtype == 13)
2529 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
2530 return obj
2531
2532 def __eq__(self, other):
2533 if type(self) != type(other): return False
2534 if self.xid != other.xid: return False
2535 if self.flags != other.flags: return False
2536 if self.entries != other.entries: return False
2537 return True
2538
2539 def pretty_print(self, q):
2540 q.text("bsn_debug_counter_desc_stats_reply {")
2541 with q.group():
2542 with q.indent(2):
2543 q.breakable()
2544 q.text("xid = ");
2545 if self.xid != None:
2546 q.text("%#x" % self.xid)
2547 else:
2548 q.text('None')
2549 q.text(","); q.breakable()
2550 q.text("flags = ");
2551 q.text("%#x" % self.flags)
2552 q.text(","); q.breakable()
2553 q.text("entries = ");
2554 q.pp(self.entries)
2555 q.breakable()
2556 q.text('}')
2557
2558bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
2559
2560class experimenter_stats_request(stats_request):
2561 subtypes = {}
2562
2563 version = 5
2564 type = 18
2565 stats_type = 65535
2566
2567 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2568 if xid != None:
2569 self.xid = xid
2570 else:
2571 self.xid = None
2572 if flags != None:
2573 self.flags = flags
2574 else:
2575 self.flags = 0
2576 if experimenter != None:
2577 self.experimenter = experimenter
2578 else:
2579 self.experimenter = 0
2580 if subtype != None:
2581 self.subtype = subtype
2582 else:
2583 self.subtype = 0
2584 return
2585
2586 def pack(self):
2587 packed = []
2588 packed.append(struct.pack("!B", self.version))
2589 packed.append(struct.pack("!B", self.type))
2590 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2591 packed.append(struct.pack("!L", self.xid))
2592 packed.append(struct.pack("!H", self.stats_type))
2593 packed.append(struct.pack("!H", self.flags))
2594 packed.append('\x00' * 4)
2595 packed.append(struct.pack("!L", self.experimenter))
2596 packed.append(struct.pack("!L", self.subtype))
2597 length = sum([len(x) for x in packed])
2598 packed[2] = struct.pack("!H", length)
2599 return ''.join(packed)
2600
2601 @staticmethod
2602 def unpack(reader):
2603 subtype, = reader.peek('!L', 16)
2604 subclass = experimenter_stats_request.subtypes.get(subtype)
2605 if subclass:
2606 return subclass.unpack(reader)
2607
2608 obj = experimenter_stats_request()
2609 _version = reader.read("!B")[0]
2610 assert(_version == 5)
2611 _type = reader.read("!B")[0]
2612 assert(_type == 18)
2613 _length = reader.read("!H")[0]
2614 orig_reader = reader
2615 reader = orig_reader.slice(_length, 4)
2616 obj.xid = reader.read("!L")[0]
2617 _stats_type = reader.read("!H")[0]
2618 assert(_stats_type == 65535)
2619 obj.flags = reader.read("!H")[0]
2620 reader.skip(4)
2621 obj.experimenter = reader.read("!L")[0]
2622 obj.subtype = reader.read("!L")[0]
2623 return obj
2624
2625 def __eq__(self, other):
2626 if type(self) != type(other): return False
2627 if self.xid != other.xid: return False
2628 if self.flags != other.flags: return False
2629 if self.experimenter != other.experimenter: return False
2630 if self.subtype != other.subtype: return False
2631 return True
2632
2633 def pretty_print(self, q):
2634 q.text("experimenter_stats_request {")
2635 with q.group():
2636 with q.indent(2):
2637 q.breakable()
2638 q.text("xid = ");
2639 if self.xid != None:
2640 q.text("%#x" % self.xid)
2641 else:
2642 q.text('None')
2643 q.text(","); q.breakable()
2644 q.text("flags = ");
2645 q.text("%#x" % self.flags)
2646 q.text(","); q.breakable()
2647 q.text("subtype = ");
2648 q.text("%#x" % self.subtype)
2649 q.breakable()
2650 q.text('}')
2651
2652stats_request.subtypes[65535] = experimenter_stats_request
2653
2654class bsn_stats_request(experimenter_stats_request):
2655 subtypes = {}
2656
2657 version = 5
2658 type = 18
2659 stats_type = 65535
2660 experimenter = 6035143
2661
2662 def __init__(self, xid=None, flags=None, subtype=None):
2663 if xid != None:
2664 self.xid = xid
2665 else:
2666 self.xid = None
2667 if flags != None:
2668 self.flags = flags
2669 else:
2670 self.flags = 0
2671 if subtype != None:
2672 self.subtype = subtype
2673 else:
2674 self.subtype = 0
2675 return
2676
2677 def pack(self):
2678 packed = []
2679 packed.append(struct.pack("!B", self.version))
2680 packed.append(struct.pack("!B", self.type))
2681 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2682 packed.append(struct.pack("!L", self.xid))
2683 packed.append(struct.pack("!H", self.stats_type))
2684 packed.append(struct.pack("!H", self.flags))
2685 packed.append('\x00' * 4)
2686 packed.append(struct.pack("!L", self.experimenter))
2687 packed.append(struct.pack("!L", self.subtype))
2688 length = sum([len(x) for x in packed])
2689 packed[2] = struct.pack("!H", length)
2690 return ''.join(packed)
2691
2692 @staticmethod
2693 def unpack(reader):
2694 subtype, = reader.peek('!L', 20)
2695 subclass = bsn_stats_request.subtypes.get(subtype)
2696 if subclass:
2697 return subclass.unpack(reader)
2698
2699 obj = bsn_stats_request()
2700 _version = reader.read("!B")[0]
2701 assert(_version == 5)
2702 _type = reader.read("!B")[0]
2703 assert(_type == 18)
2704 _length = reader.read("!H")[0]
2705 orig_reader = reader
2706 reader = orig_reader.slice(_length, 4)
2707 obj.xid = reader.read("!L")[0]
2708 _stats_type = reader.read("!H")[0]
2709 assert(_stats_type == 65535)
2710 obj.flags = reader.read("!H")[0]
2711 reader.skip(4)
2712 _experimenter = reader.read("!L")[0]
2713 assert(_experimenter == 6035143)
2714 obj.subtype = reader.read("!L")[0]
2715 return obj
2716
2717 def __eq__(self, other):
2718 if type(self) != type(other): return False
2719 if self.xid != other.xid: return False
2720 if self.flags != other.flags: return False
2721 if self.subtype != other.subtype: return False
2722 return True
2723
2724 def pretty_print(self, q):
2725 q.text("bsn_stats_request {")
2726 with q.group():
2727 with q.indent(2):
2728 q.breakable()
2729 q.text("xid = ");
2730 if self.xid != None:
2731 q.text("%#x" % self.xid)
2732 else:
2733 q.text('None')
2734 q.text(","); q.breakable()
2735 q.text("flags = ");
2736 q.text("%#x" % self.flags)
2737 q.breakable()
2738 q.text('}')
2739
2740experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2741
2742class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2743 version = 5
2744 type = 18
2745 stats_type = 65535
2746 experimenter = 6035143
2747 subtype = 13
2748
2749 def __init__(self, xid=None, flags=None):
2750 if xid != None:
2751 self.xid = xid
2752 else:
2753 self.xid = None
2754 if flags != None:
2755 self.flags = flags
2756 else:
2757 self.flags = 0
2758 return
2759
2760 def pack(self):
2761 packed = []
2762 packed.append(struct.pack("!B", self.version))
2763 packed.append(struct.pack("!B", self.type))
2764 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2765 packed.append(struct.pack("!L", self.xid))
2766 packed.append(struct.pack("!H", self.stats_type))
2767 packed.append(struct.pack("!H", self.flags))
2768 packed.append('\x00' * 4)
2769 packed.append(struct.pack("!L", self.experimenter))
2770 packed.append(struct.pack("!L", self.subtype))
2771 length = sum([len(x) for x in packed])
2772 packed[2] = struct.pack("!H", length)
2773 return ''.join(packed)
2774
2775 @staticmethod
2776 def unpack(reader):
2777 obj = bsn_debug_counter_desc_stats_request()
2778 _version = reader.read("!B")[0]
2779 assert(_version == 5)
2780 _type = reader.read("!B")[0]
2781 assert(_type == 18)
2782 _length = reader.read("!H")[0]
2783 orig_reader = reader
2784 reader = orig_reader.slice(_length, 4)
2785 obj.xid = reader.read("!L")[0]
2786 _stats_type = reader.read("!H")[0]
2787 assert(_stats_type == 65535)
2788 obj.flags = reader.read("!H")[0]
2789 reader.skip(4)
2790 _experimenter = reader.read("!L")[0]
2791 assert(_experimenter == 6035143)
2792 _subtype = reader.read("!L")[0]
2793 assert(_subtype == 13)
2794 return obj
2795
2796 def __eq__(self, other):
2797 if type(self) != type(other): return False
2798 if self.xid != other.xid: return False
2799 if self.flags != other.flags: return False
2800 return True
2801
2802 def pretty_print(self, q):
2803 q.text("bsn_debug_counter_desc_stats_request {")
2804 with q.group():
2805 with q.indent(2):
2806 q.breakable()
2807 q.text("xid = ");
2808 if self.xid != None:
2809 q.text("%#x" % self.xid)
2810 else:
2811 q.text('None')
2812 q.text(","); q.breakable()
2813 q.text("flags = ");
2814 q.text("%#x" % self.flags)
2815 q.breakable()
2816 q.text('}')
2817
2818bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2819
2820class bsn_debug_counter_stats_reply(bsn_stats_reply):
2821 version = 5
2822 type = 19
2823 stats_type = 65535
2824 experimenter = 6035143
2825 subtype = 12
2826
2827 def __init__(self, xid=None, flags=None, entries=None):
2828 if xid != None:
2829 self.xid = xid
2830 else:
2831 self.xid = None
2832 if flags != None:
2833 self.flags = flags
2834 else:
2835 self.flags = 0
2836 if entries != None:
2837 self.entries = entries
2838 else:
2839 self.entries = []
2840 return
2841
2842 def pack(self):
2843 packed = []
2844 packed.append(struct.pack("!B", self.version))
2845 packed.append(struct.pack("!B", self.type))
2846 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2847 packed.append(struct.pack("!L", self.xid))
2848 packed.append(struct.pack("!H", self.stats_type))
2849 packed.append(struct.pack("!H", self.flags))
2850 packed.append('\x00' * 4)
2851 packed.append(struct.pack("!L", self.experimenter))
2852 packed.append(struct.pack("!L", self.subtype))
2853 packed.append(loxi.generic_util.pack_list(self.entries))
2854 length = sum([len(x) for x in packed])
2855 packed[2] = struct.pack("!H", length)
2856 return ''.join(packed)
2857
2858 @staticmethod
2859 def unpack(reader):
2860 obj = bsn_debug_counter_stats_reply()
2861 _version = reader.read("!B")[0]
2862 assert(_version == 5)
2863 _type = reader.read("!B")[0]
2864 assert(_type == 19)
2865 _length = reader.read("!H")[0]
2866 orig_reader = reader
2867 reader = orig_reader.slice(_length, 4)
2868 obj.xid = reader.read("!L")[0]
2869 _stats_type = reader.read("!H")[0]
2870 assert(_stats_type == 65535)
2871 obj.flags = reader.read("!H")[0]
2872 reader.skip(4)
2873 _experimenter = reader.read("!L")[0]
2874 assert(_experimenter == 6035143)
2875 _subtype = reader.read("!L")[0]
2876 assert(_subtype == 12)
2877 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
2878 return obj
2879
2880 def __eq__(self, other):
2881 if type(self) != type(other): return False
2882 if self.xid != other.xid: return False
2883 if self.flags != other.flags: return False
2884 if self.entries != other.entries: return False
2885 return True
2886
2887 def pretty_print(self, q):
2888 q.text("bsn_debug_counter_stats_reply {")
2889 with q.group():
2890 with q.indent(2):
2891 q.breakable()
2892 q.text("xid = ");
2893 if self.xid != None:
2894 q.text("%#x" % self.xid)
2895 else:
2896 q.text('None')
2897 q.text(","); q.breakable()
2898 q.text("flags = ");
2899 q.text("%#x" % self.flags)
2900 q.text(","); q.breakable()
2901 q.text("entries = ");
2902 q.pp(self.entries)
2903 q.breakable()
2904 q.text('}')
2905
2906bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2907
2908class bsn_debug_counter_stats_request(bsn_stats_request):
2909 version = 5
2910 type = 18
2911 stats_type = 65535
2912 experimenter = 6035143
2913 subtype = 12
2914
2915 def __init__(self, xid=None, flags=None):
2916 if xid != None:
2917 self.xid = xid
2918 else:
2919 self.xid = None
2920 if flags != None:
2921 self.flags = flags
2922 else:
2923 self.flags = 0
2924 return
2925
2926 def pack(self):
2927 packed = []
2928 packed.append(struct.pack("!B", self.version))
2929 packed.append(struct.pack("!B", self.type))
2930 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2931 packed.append(struct.pack("!L", self.xid))
2932 packed.append(struct.pack("!H", self.stats_type))
2933 packed.append(struct.pack("!H", self.flags))
2934 packed.append('\x00' * 4)
2935 packed.append(struct.pack("!L", self.experimenter))
2936 packed.append(struct.pack("!L", self.subtype))
2937 length = sum([len(x) for x in packed])
2938 packed[2] = struct.pack("!H", length)
2939 return ''.join(packed)
2940
2941 @staticmethod
2942 def unpack(reader):
2943 obj = bsn_debug_counter_stats_request()
2944 _version = reader.read("!B")[0]
2945 assert(_version == 5)
2946 _type = reader.read("!B")[0]
2947 assert(_type == 18)
2948 _length = reader.read("!H")[0]
2949 orig_reader = reader
2950 reader = orig_reader.slice(_length, 4)
2951 obj.xid = reader.read("!L")[0]
2952 _stats_type = reader.read("!H")[0]
2953 assert(_stats_type == 65535)
2954 obj.flags = reader.read("!H")[0]
2955 reader.skip(4)
2956 _experimenter = reader.read("!L")[0]
2957 assert(_experimenter == 6035143)
2958 _subtype = reader.read("!L")[0]
2959 assert(_subtype == 12)
2960 return obj
2961
2962 def __eq__(self, other):
2963 if type(self) != type(other): return False
2964 if self.xid != other.xid: return False
2965 if self.flags != other.flags: return False
2966 return True
2967
2968 def pretty_print(self, q):
2969 q.text("bsn_debug_counter_stats_request {")
2970 with q.group():
2971 with q.indent(2):
2972 q.breakable()
2973 q.text("xid = ");
2974 if self.xid != None:
2975 q.text("%#x" % self.xid)
2976 else:
2977 q.text('None')
2978 q.text(","); q.breakable()
2979 q.text("flags = ");
2980 q.text("%#x" % self.flags)
2981 q.breakable()
2982 q.text('}')
2983
2984bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2985
2986class bsn_error(bsn_base_error):
2987 version = 5
2988 type = 1
2989 err_type = 65535
2990 subtype = 1
2991 experimenter = 6035143
2992
2993 def __init__(self, xid=None, err_msg=None, data=None):
2994 if xid != None:
2995 self.xid = xid
2996 else:
2997 self.xid = None
2998 if err_msg != None:
2999 self.err_msg = err_msg
3000 else:
3001 self.err_msg = ""
3002 if data != None:
3003 self.data = data
3004 else:
3005 self.data = ''
3006 return
3007
3008 def pack(self):
3009 packed = []
3010 packed.append(struct.pack("!B", self.version))
3011 packed.append(struct.pack("!B", self.type))
3012 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3013 packed.append(struct.pack("!L", self.xid))
3014 packed.append(struct.pack("!H", self.err_type))
3015 packed.append(struct.pack("!H", self.subtype))
3016 packed.append(struct.pack("!L", self.experimenter))
3017 packed.append(struct.pack("!256s", self.err_msg))
3018 packed.append(self.data)
3019 length = sum([len(x) for x in packed])
3020 packed[2] = struct.pack("!H", length)
3021 return ''.join(packed)
3022
3023 @staticmethod
3024 def unpack(reader):
3025 obj = bsn_error()
3026 _version = reader.read("!B")[0]
3027 assert(_version == 5)
3028 _type = reader.read("!B")[0]
3029 assert(_type == 1)
3030 _length = reader.read("!H")[0]
3031 orig_reader = reader
3032 reader = orig_reader.slice(_length, 4)
3033 obj.xid = reader.read("!L")[0]
3034 _err_type = reader.read("!H")[0]
3035 assert(_err_type == 65535)
3036 _subtype = reader.read("!H")[0]
3037 assert(_subtype == 1)
3038 _experimenter = reader.read("!L")[0]
3039 assert(_experimenter == 6035143)
3040 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
3041 obj.data = str(reader.read_all())
3042 return obj
3043
3044 def __eq__(self, other):
3045 if type(self) != type(other): return False
3046 if self.xid != other.xid: return False
3047 if self.err_msg != other.err_msg: return False
3048 if self.data != other.data: return False
3049 return True
3050
3051 def pretty_print(self, q):
3052 q.text("bsn_error {")
3053 with q.group():
3054 with q.indent(2):
3055 q.breakable()
3056 q.text("xid = ");
3057 if self.xid != None:
3058 q.text("%#x" % self.xid)
3059 else:
3060 q.text('None')
3061 q.text(","); q.breakable()
3062 q.text("err_msg = ");
3063 q.pp(self.err_msg)
3064 q.text(","); q.breakable()
3065 q.text("data = ");
3066 q.pp(self.data)
3067 q.breakable()
3068 q.text('}')
3069
3070bsn_base_error.subtypes[1] = bsn_error
3071
3072class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
3073 version = 5
3074 type = 19
3075 stats_type = 65535
3076 experimenter = 6035143
3077 subtype = 10
3078
3079 def __init__(self, xid=None, flags=None, entries=None):
3080 if xid != None:
3081 self.xid = xid
3082 else:
3083 self.xid = None
3084 if flags != None:
3085 self.flags = flags
3086 else:
3087 self.flags = 0
3088 if entries != None:
3089 self.entries = entries
3090 else:
3091 self.entries = []
3092 return
3093
3094 def pack(self):
3095 packed = []
3096 packed.append(struct.pack("!B", self.version))
3097 packed.append(struct.pack("!B", self.type))
3098 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3099 packed.append(struct.pack("!L", self.xid))
3100 packed.append(struct.pack("!H", self.stats_type))
3101 packed.append(struct.pack("!H", self.flags))
3102 packed.append('\x00' * 4)
3103 packed.append(struct.pack("!L", self.experimenter))
3104 packed.append(struct.pack("!L", self.subtype))
3105 packed.append(loxi.generic_util.pack_list(self.entries))
3106 length = sum([len(x) for x in packed])
3107 packed[2] = struct.pack("!H", length)
3108 return ''.join(packed)
3109
3110 @staticmethod
3111 def unpack(reader):
3112 obj = bsn_flow_checksum_bucket_stats_reply()
3113 _version = reader.read("!B")[0]
3114 assert(_version == 5)
3115 _type = reader.read("!B")[0]
3116 assert(_type == 19)
3117 _length = reader.read("!H")[0]
3118 orig_reader = reader
3119 reader = orig_reader.slice(_length, 4)
3120 obj.xid = reader.read("!L")[0]
3121 _stats_type = reader.read("!H")[0]
3122 assert(_stats_type == 65535)
3123 obj.flags = reader.read("!H")[0]
3124 reader.skip(4)
3125 _experimenter = reader.read("!L")[0]
3126 assert(_experimenter == 6035143)
3127 _subtype = reader.read("!L")[0]
3128 assert(_subtype == 10)
3129 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
3130 return obj
3131
3132 def __eq__(self, other):
3133 if type(self) != type(other): return False
3134 if self.xid != other.xid: return False
3135 if self.flags != other.flags: return False
3136 if self.entries != other.entries: return False
3137 return True
3138
3139 def pretty_print(self, q):
3140 q.text("bsn_flow_checksum_bucket_stats_reply {")
3141 with q.group():
3142 with q.indent(2):
3143 q.breakable()
3144 q.text("xid = ");
3145 if self.xid != None:
3146 q.text("%#x" % self.xid)
3147 else:
3148 q.text('None')
3149 q.text(","); q.breakable()
3150 q.text("flags = ");
3151 q.text("%#x" % self.flags)
3152 q.text(","); q.breakable()
3153 q.text("entries = ");
3154 q.pp(self.entries)
3155 q.breakable()
3156 q.text('}')
3157
3158bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
3159
3160class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
3161 version = 5
3162 type = 18
3163 stats_type = 65535
3164 experimenter = 6035143
3165 subtype = 10
3166
3167 def __init__(self, xid=None, flags=None, table_id=None):
3168 if xid != None:
3169 self.xid = xid
3170 else:
3171 self.xid = None
3172 if flags != None:
3173 self.flags = flags
3174 else:
3175 self.flags = 0
3176 if table_id != None:
3177 self.table_id = table_id
3178 else:
3179 self.table_id = 0
3180 return
3181
3182 def pack(self):
3183 packed = []
3184 packed.append(struct.pack("!B", self.version))
3185 packed.append(struct.pack("!B", self.type))
3186 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3187 packed.append(struct.pack("!L", self.xid))
3188 packed.append(struct.pack("!H", self.stats_type))
3189 packed.append(struct.pack("!H", self.flags))
3190 packed.append('\x00' * 4)
3191 packed.append(struct.pack("!L", self.experimenter))
3192 packed.append(struct.pack("!L", self.subtype))
3193 packed.append(struct.pack("!B", self.table_id))
3194 length = sum([len(x) for x in packed])
3195 packed[2] = struct.pack("!H", length)
3196 return ''.join(packed)
3197
3198 @staticmethod
3199 def unpack(reader):
3200 obj = bsn_flow_checksum_bucket_stats_request()
3201 _version = reader.read("!B")[0]
3202 assert(_version == 5)
3203 _type = reader.read("!B")[0]
3204 assert(_type == 18)
3205 _length = reader.read("!H")[0]
3206 orig_reader = reader
3207 reader = orig_reader.slice(_length, 4)
3208 obj.xid = reader.read("!L")[0]
3209 _stats_type = reader.read("!H")[0]
3210 assert(_stats_type == 65535)
3211 obj.flags = reader.read("!H")[0]
3212 reader.skip(4)
3213 _experimenter = reader.read("!L")[0]
3214 assert(_experimenter == 6035143)
3215 _subtype = reader.read("!L")[0]
3216 assert(_subtype == 10)
3217 obj.table_id = reader.read("!B")[0]
3218 return obj
3219
3220 def __eq__(self, other):
3221 if type(self) != type(other): return False
3222 if self.xid != other.xid: return False
3223 if self.flags != other.flags: return False
3224 if self.table_id != other.table_id: return False
3225 return True
3226
3227 def pretty_print(self, q):
3228 q.text("bsn_flow_checksum_bucket_stats_request {")
3229 with q.group():
3230 with q.indent(2):
3231 q.breakable()
3232 q.text("xid = ");
3233 if self.xid != None:
3234 q.text("%#x" % self.xid)
3235 else:
3236 q.text('None')
3237 q.text(","); q.breakable()
3238 q.text("flags = ");
3239 q.text("%#x" % self.flags)
3240 q.text(","); q.breakable()
3241 q.text("table_id = ");
3242 q.text("%#x" % self.table_id)
3243 q.breakable()
3244 q.text('}')
3245
3246bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
3247
3248class bsn_flow_idle(bsn_header):
3249 version = 5
3250 type = 4
3251 experimenter = 6035143
3252 subtype = 40
3253
3254 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
3255 if xid != None:
3256 self.xid = xid
3257 else:
3258 self.xid = None
3259 if cookie != None:
3260 self.cookie = cookie
3261 else:
3262 self.cookie = 0
3263 if priority != None:
3264 self.priority = priority
3265 else:
3266 self.priority = 0
3267 if table_id != None:
3268 self.table_id = table_id
3269 else:
3270 self.table_id = 0
3271 if match != None:
3272 self.match = match
3273 else:
3274 self.match = ofp.match()
3275 return
3276
3277 def pack(self):
3278 packed = []
3279 packed.append(struct.pack("!B", self.version))
3280 packed.append(struct.pack("!B", self.type))
3281 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3282 packed.append(struct.pack("!L", self.xid))
3283 packed.append(struct.pack("!L", self.experimenter))
3284 packed.append(struct.pack("!L", self.subtype))
3285 packed.append(struct.pack("!Q", self.cookie))
3286 packed.append(struct.pack("!H", self.priority))
3287 packed.append(struct.pack("!B", self.table_id))
3288 packed.append('\x00' * 5)
3289 packed.append(self.match.pack())
3290 length = sum([len(x) for x in packed])
3291 packed[2] = struct.pack("!H", length)
3292 return ''.join(packed)
3293
3294 @staticmethod
3295 def unpack(reader):
3296 obj = bsn_flow_idle()
3297 _version = reader.read("!B")[0]
3298 assert(_version == 5)
3299 _type = reader.read("!B")[0]
3300 assert(_type == 4)
3301 _length = reader.read("!H")[0]
3302 orig_reader = reader
3303 reader = orig_reader.slice(_length, 4)
3304 obj.xid = reader.read("!L")[0]
3305 _experimenter = reader.read("!L")[0]
3306 assert(_experimenter == 6035143)
3307 _subtype = reader.read("!L")[0]
3308 assert(_subtype == 40)
3309 obj.cookie = reader.read("!Q")[0]
3310 obj.priority = reader.read("!H")[0]
3311 obj.table_id = reader.read("!B")[0]
3312 reader.skip(5)
3313 obj.match = ofp.match.unpack(reader)
3314 return obj
3315
3316 def __eq__(self, other):
3317 if type(self) != type(other): return False
3318 if self.xid != other.xid: return False
3319 if self.cookie != other.cookie: return False
3320 if self.priority != other.priority: return False
3321 if self.table_id != other.table_id: return False
3322 if self.match != other.match: return False
3323 return True
3324
3325 def pretty_print(self, q):
3326 q.text("bsn_flow_idle {")
3327 with q.group():
3328 with q.indent(2):
3329 q.breakable()
3330 q.text("xid = ");
3331 if self.xid != None:
3332 q.text("%#x" % self.xid)
3333 else:
3334 q.text('None')
3335 q.text(","); q.breakable()
3336 q.text("cookie = ");
3337 q.text("%#x" % self.cookie)
3338 q.text(","); q.breakable()
3339 q.text("priority = ");
3340 q.text("%#x" % self.priority)
3341 q.text(","); q.breakable()
3342 q.text("table_id = ");
3343 q.text("%#x" % self.table_id)
3344 q.text(","); q.breakable()
3345 q.text("match = ");
3346 q.pp(self.match)
3347 q.breakable()
3348 q.text('}')
3349
3350bsn_header.subtypes[40] = bsn_flow_idle
3351
3352class bsn_flow_idle_enable_get_reply(bsn_header):
3353 version = 5
3354 type = 4
3355 experimenter = 6035143
3356 subtype = 39
3357
3358 def __init__(self, xid=None, enabled=None):
3359 if xid != None:
3360 self.xid = xid
3361 else:
3362 self.xid = None
3363 if enabled != None:
3364 self.enabled = enabled
3365 else:
3366 self.enabled = 0
3367 return
3368
3369 def pack(self):
3370 packed = []
3371 packed.append(struct.pack("!B", self.version))
3372 packed.append(struct.pack("!B", self.type))
3373 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3374 packed.append(struct.pack("!L", self.xid))
3375 packed.append(struct.pack("!L", self.experimenter))
3376 packed.append(struct.pack("!L", self.subtype))
3377 packed.append(struct.pack("!L", self.enabled))
3378 length = sum([len(x) for x in packed])
3379 packed[2] = struct.pack("!H", length)
3380 return ''.join(packed)
3381
3382 @staticmethod
3383 def unpack(reader):
3384 obj = bsn_flow_idle_enable_get_reply()
3385 _version = reader.read("!B")[0]
3386 assert(_version == 5)
3387 _type = reader.read("!B")[0]
3388 assert(_type == 4)
3389 _length = reader.read("!H")[0]
3390 orig_reader = reader
3391 reader = orig_reader.slice(_length, 4)
3392 obj.xid = reader.read("!L")[0]
3393 _experimenter = reader.read("!L")[0]
3394 assert(_experimenter == 6035143)
3395 _subtype = reader.read("!L")[0]
3396 assert(_subtype == 39)
3397 obj.enabled = reader.read("!L")[0]
3398 return obj
3399
3400 def __eq__(self, other):
3401 if type(self) != type(other): return False
3402 if self.xid != other.xid: return False
3403 if self.enabled != other.enabled: return False
3404 return True
3405
3406 def pretty_print(self, q):
3407 q.text("bsn_flow_idle_enable_get_reply {")
3408 with q.group():
3409 with q.indent(2):
3410 q.breakable()
3411 q.text("xid = ");
3412 if self.xid != None:
3413 q.text("%#x" % self.xid)
3414 else:
3415 q.text('None')
3416 q.text(","); q.breakable()
3417 q.text("enabled = ");
3418 q.text("%#x" % self.enabled)
3419 q.breakable()
3420 q.text('}')
3421
3422bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3423
3424class bsn_flow_idle_enable_get_request(bsn_header):
3425 version = 5
3426 type = 4
3427 experimenter = 6035143
3428 subtype = 38
3429
3430 def __init__(self, xid=None):
3431 if xid != None:
3432 self.xid = xid
3433 else:
3434 self.xid = None
3435 return
3436
3437 def pack(self):
3438 packed = []
3439 packed.append(struct.pack("!B", self.version))
3440 packed.append(struct.pack("!B", self.type))
3441 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3442 packed.append(struct.pack("!L", self.xid))
3443 packed.append(struct.pack("!L", self.experimenter))
3444 packed.append(struct.pack("!L", self.subtype))
3445 length = sum([len(x) for x in packed])
3446 packed[2] = struct.pack("!H", length)
3447 return ''.join(packed)
3448
3449 @staticmethod
3450 def unpack(reader):
3451 obj = bsn_flow_idle_enable_get_request()
3452 _version = reader.read("!B")[0]
3453 assert(_version == 5)
3454 _type = reader.read("!B")[0]
3455 assert(_type == 4)
3456 _length = reader.read("!H")[0]
3457 orig_reader = reader
3458 reader = orig_reader.slice(_length, 4)
3459 obj.xid = reader.read("!L")[0]
3460 _experimenter = reader.read("!L")[0]
3461 assert(_experimenter == 6035143)
3462 _subtype = reader.read("!L")[0]
3463 assert(_subtype == 38)
3464 return obj
3465
3466 def __eq__(self, other):
3467 if type(self) != type(other): return False
3468 if self.xid != other.xid: return False
3469 return True
3470
3471 def pretty_print(self, q):
3472 q.text("bsn_flow_idle_enable_get_request {")
3473 with q.group():
3474 with q.indent(2):
3475 q.breakable()
3476 q.text("xid = ");
3477 if self.xid != None:
3478 q.text("%#x" % self.xid)
3479 else:
3480 q.text('None')
3481 q.breakable()
3482 q.text('}')
3483
3484bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3485
3486class bsn_flow_idle_enable_set_reply(bsn_header):
3487 version = 5
3488 type = 4
3489 experimenter = 6035143
3490 subtype = 37
3491
3492 def __init__(self, xid=None, enable=None, status=None):
3493 if xid != None:
3494 self.xid = xid
3495 else:
3496 self.xid = None
3497 if enable != None:
3498 self.enable = enable
3499 else:
3500 self.enable = 0
3501 if status != None:
3502 self.status = status
3503 else:
3504 self.status = 0
3505 return
3506
3507 def pack(self):
3508 packed = []
3509 packed.append(struct.pack("!B", self.version))
3510 packed.append(struct.pack("!B", self.type))
3511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3512 packed.append(struct.pack("!L", self.xid))
3513 packed.append(struct.pack("!L", self.experimenter))
3514 packed.append(struct.pack("!L", self.subtype))
3515 packed.append(struct.pack("!L", self.enable))
3516 packed.append(struct.pack("!L", self.status))
3517 length = sum([len(x) for x in packed])
3518 packed[2] = struct.pack("!H", length)
3519 return ''.join(packed)
3520
3521 @staticmethod
3522 def unpack(reader):
3523 obj = bsn_flow_idle_enable_set_reply()
3524 _version = reader.read("!B")[0]
3525 assert(_version == 5)
3526 _type = reader.read("!B")[0]
3527 assert(_type == 4)
3528 _length = reader.read("!H")[0]
3529 orig_reader = reader
3530 reader = orig_reader.slice(_length, 4)
3531 obj.xid = reader.read("!L")[0]
3532 _experimenter = reader.read("!L")[0]
3533 assert(_experimenter == 6035143)
3534 _subtype = reader.read("!L")[0]
3535 assert(_subtype == 37)
3536 obj.enable = reader.read("!L")[0]
3537 obj.status = reader.read("!L")[0]
3538 return obj
3539
3540 def __eq__(self, other):
3541 if type(self) != type(other): return False
3542 if self.xid != other.xid: return False
3543 if self.enable != other.enable: return False
3544 if self.status != other.status: return False
3545 return True
3546
3547 def pretty_print(self, q):
3548 q.text("bsn_flow_idle_enable_set_reply {")
3549 with q.group():
3550 with q.indent(2):
3551 q.breakable()
3552 q.text("xid = ");
3553 if self.xid != None:
3554 q.text("%#x" % self.xid)
3555 else:
3556 q.text('None')
3557 q.text(","); q.breakable()
3558 q.text("enable = ");
3559 q.text("%#x" % self.enable)
3560 q.text(","); q.breakable()
3561 q.text("status = ");
3562 q.text("%#x" % self.status)
3563 q.breakable()
3564 q.text('}')
3565
3566bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3567
3568class bsn_flow_idle_enable_set_request(bsn_header):
3569 version = 5
3570 type = 4
3571 experimenter = 6035143
3572 subtype = 36
3573
3574 def __init__(self, xid=None, enable=None):
3575 if xid != None:
3576 self.xid = xid
3577 else:
3578 self.xid = None
3579 if enable != None:
3580 self.enable = enable
3581 else:
3582 self.enable = 0
3583 return
3584
3585 def pack(self):
3586 packed = []
3587 packed.append(struct.pack("!B", self.version))
3588 packed.append(struct.pack("!B", self.type))
3589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3590 packed.append(struct.pack("!L", self.xid))
3591 packed.append(struct.pack("!L", self.experimenter))
3592 packed.append(struct.pack("!L", self.subtype))
3593 packed.append(struct.pack("!L", self.enable))
3594 length = sum([len(x) for x in packed])
3595 packed[2] = struct.pack("!H", length)
3596 return ''.join(packed)
3597
3598 @staticmethod
3599 def unpack(reader):
3600 obj = bsn_flow_idle_enable_set_request()
3601 _version = reader.read("!B")[0]
3602 assert(_version == 5)
3603 _type = reader.read("!B")[0]
3604 assert(_type == 4)
3605 _length = reader.read("!H")[0]
3606 orig_reader = reader
3607 reader = orig_reader.slice(_length, 4)
3608 obj.xid = reader.read("!L")[0]
3609 _experimenter = reader.read("!L")[0]
3610 assert(_experimenter == 6035143)
3611 _subtype = reader.read("!L")[0]
3612 assert(_subtype == 36)
3613 obj.enable = reader.read("!L")[0]
3614 return obj
3615
3616 def __eq__(self, other):
3617 if type(self) != type(other): return False
3618 if self.xid != other.xid: return False
3619 if self.enable != other.enable: return False
3620 return True
3621
3622 def pretty_print(self, q):
3623 q.text("bsn_flow_idle_enable_set_request {")
3624 with q.group():
3625 with q.indent(2):
3626 q.breakable()
3627 q.text("xid = ");
3628 if self.xid != None:
3629 q.text("%#x" % self.xid)
3630 else:
3631 q.text('None')
3632 q.text(","); q.breakable()
3633 q.text("enable = ");
3634 q.text("%#x" % self.enable)
3635 q.breakable()
3636 q.text('}')
3637
3638bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3639
3640class bsn_generic_async(bsn_header):
3641 version = 5
3642 type = 4
3643 experimenter = 6035143
3644 subtype = 68
3645
3646 def __init__(self, xid=None, name=None, tlvs=None):
3647 if xid != None:
3648 self.xid = xid
3649 else:
3650 self.xid = None
3651 if name != None:
3652 self.name = name
3653 else:
3654 self.name = ""
3655 if tlvs != None:
3656 self.tlvs = tlvs
3657 else:
3658 self.tlvs = []
3659 return
3660
3661 def pack(self):
3662 packed = []
3663 packed.append(struct.pack("!B", self.version))
3664 packed.append(struct.pack("!B", self.type))
3665 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3666 packed.append(struct.pack("!L", self.xid))
3667 packed.append(struct.pack("!L", self.experimenter))
3668 packed.append(struct.pack("!L", self.subtype))
3669 packed.append(struct.pack("!64s", self.name))
3670 packed.append(loxi.generic_util.pack_list(self.tlvs))
3671 length = sum([len(x) for x in packed])
3672 packed[2] = struct.pack("!H", length)
3673 return ''.join(packed)
3674
3675 @staticmethod
3676 def unpack(reader):
3677 obj = bsn_generic_async()
3678 _version = reader.read("!B")[0]
3679 assert(_version == 5)
3680 _type = reader.read("!B")[0]
3681 assert(_type == 4)
3682 _length = reader.read("!H")[0]
3683 orig_reader = reader
3684 reader = orig_reader.slice(_length, 4)
3685 obj.xid = reader.read("!L")[0]
3686 _experimenter = reader.read("!L")[0]
3687 assert(_experimenter == 6035143)
3688 _subtype = reader.read("!L")[0]
3689 assert(_subtype == 68)
3690 obj.name = reader.read("!64s")[0].rstrip("\x00")
3691 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3692 return obj
3693
3694 def __eq__(self, other):
3695 if type(self) != type(other): return False
3696 if self.xid != other.xid: return False
3697 if self.name != other.name: return False
3698 if self.tlvs != other.tlvs: return False
3699 return True
3700
3701 def pretty_print(self, q):
3702 q.text("bsn_generic_async {")
3703 with q.group():
3704 with q.indent(2):
3705 q.breakable()
3706 q.text("xid = ");
3707 if self.xid != None:
3708 q.text("%#x" % self.xid)
3709 else:
3710 q.text('None')
3711 q.text(","); q.breakable()
3712 q.text("name = ");
3713 q.pp(self.name)
3714 q.text(","); q.breakable()
3715 q.text("tlvs = ");
3716 q.pp(self.tlvs)
3717 q.breakable()
3718 q.text('}')
3719
3720bsn_header.subtypes[68] = bsn_generic_async
3721
3722class bsn_generic_command(bsn_header):
3723 version = 5
3724 type = 4
3725 experimenter = 6035143
3726 subtype = 71
3727
3728 def __init__(self, xid=None, name=None, tlvs=None):
3729 if xid != None:
3730 self.xid = xid
3731 else:
3732 self.xid = None
3733 if name != None:
3734 self.name = name
3735 else:
3736 self.name = ""
3737 if tlvs != None:
3738 self.tlvs = tlvs
3739 else:
3740 self.tlvs = []
3741 return
3742
3743 def pack(self):
3744 packed = []
3745 packed.append(struct.pack("!B", self.version))
3746 packed.append(struct.pack("!B", self.type))
3747 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3748 packed.append(struct.pack("!L", self.xid))
3749 packed.append(struct.pack("!L", self.experimenter))
3750 packed.append(struct.pack("!L", self.subtype))
3751 packed.append(struct.pack("!64s", self.name))
3752 packed.append(loxi.generic_util.pack_list(self.tlvs))
3753 length = sum([len(x) for x in packed])
3754 packed[2] = struct.pack("!H", length)
3755 return ''.join(packed)
3756
3757 @staticmethod
3758 def unpack(reader):
3759 obj = bsn_generic_command()
3760 _version = reader.read("!B")[0]
3761 assert(_version == 5)
3762 _type = reader.read("!B")[0]
3763 assert(_type == 4)
3764 _length = reader.read("!H")[0]
3765 orig_reader = reader
3766 reader = orig_reader.slice(_length, 4)
3767 obj.xid = reader.read("!L")[0]
3768 _experimenter = reader.read("!L")[0]
3769 assert(_experimenter == 6035143)
3770 _subtype = reader.read("!L")[0]
3771 assert(_subtype == 71)
3772 obj.name = reader.read("!64s")[0].rstrip("\x00")
3773 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3774 return obj
3775
3776 def __eq__(self, other):
3777 if type(self) != type(other): return False
3778 if self.xid != other.xid: return False
3779 if self.name != other.name: return False
3780 if self.tlvs != other.tlvs: return False
3781 return True
3782
3783 def pretty_print(self, q):
3784 q.text("bsn_generic_command {")
3785 with q.group():
3786 with q.indent(2):
3787 q.breakable()
3788 q.text("xid = ");
3789 if self.xid != None:
3790 q.text("%#x" % self.xid)
3791 else:
3792 q.text('None')
3793 q.text(","); q.breakable()
3794 q.text("name = ");
3795 q.pp(self.name)
3796 q.text(","); q.breakable()
3797 q.text("tlvs = ");
3798 q.pp(self.tlvs)
3799 q.breakable()
3800 q.text('}')
3801
3802bsn_header.subtypes[71] = bsn_generic_command
3803
3804class bsn_generic_stats_reply(bsn_stats_reply):
3805 version = 5
3806 type = 19
3807 stats_type = 65535
3808 experimenter = 6035143
3809 subtype = 16
3810
3811 def __init__(self, xid=None, flags=None, entries=None):
3812 if xid != None:
3813 self.xid = xid
3814 else:
3815 self.xid = None
3816 if flags != None:
3817 self.flags = flags
3818 else:
3819 self.flags = 0
3820 if entries != None:
3821 self.entries = entries
3822 else:
3823 self.entries = []
3824 return
3825
3826 def pack(self):
3827 packed = []
3828 packed.append(struct.pack("!B", self.version))
3829 packed.append(struct.pack("!B", self.type))
3830 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3831 packed.append(struct.pack("!L", self.xid))
3832 packed.append(struct.pack("!H", self.stats_type))
3833 packed.append(struct.pack("!H", self.flags))
3834 packed.append('\x00' * 4)
3835 packed.append(struct.pack("!L", self.experimenter))
3836 packed.append(struct.pack("!L", self.subtype))
3837 packed.append(loxi.generic_util.pack_list(self.entries))
3838 length = sum([len(x) for x in packed])
3839 packed[2] = struct.pack("!H", length)
3840 return ''.join(packed)
3841
3842 @staticmethod
3843 def unpack(reader):
3844 obj = bsn_generic_stats_reply()
3845 _version = reader.read("!B")[0]
3846 assert(_version == 5)
3847 _type = reader.read("!B")[0]
3848 assert(_type == 19)
3849 _length = reader.read("!H")[0]
3850 orig_reader = reader
3851 reader = orig_reader.slice(_length, 4)
3852 obj.xid = reader.read("!L")[0]
3853 _stats_type = reader.read("!H")[0]
3854 assert(_stats_type == 65535)
3855 obj.flags = reader.read("!H")[0]
3856 reader.skip(4)
3857 _experimenter = reader.read("!L")[0]
3858 assert(_experimenter == 6035143)
3859 _subtype = reader.read("!L")[0]
3860 assert(_subtype == 16)
3861 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
3862 return obj
3863
3864 def __eq__(self, other):
3865 if type(self) != type(other): return False
3866 if self.xid != other.xid: return False
3867 if self.flags != other.flags: return False
3868 if self.entries != other.entries: return False
3869 return True
3870
3871 def pretty_print(self, q):
3872 q.text("bsn_generic_stats_reply {")
3873 with q.group():
3874 with q.indent(2):
3875 q.breakable()
3876 q.text("xid = ");
3877 if self.xid != None:
3878 q.text("%#x" % self.xid)
3879 else:
3880 q.text('None')
3881 q.text(","); q.breakable()
3882 q.text("flags = ");
3883 q.text("%#x" % self.flags)
3884 q.text(","); q.breakable()
3885 q.text("entries = ");
3886 q.pp(self.entries)
3887 q.breakable()
3888 q.text('}')
3889
3890bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3891
3892class bsn_generic_stats_request(bsn_stats_request):
3893 version = 5
3894 type = 18
3895 stats_type = 65535
3896 experimenter = 6035143
3897 subtype = 16
3898
3899 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3900 if xid != None:
3901 self.xid = xid
3902 else:
3903 self.xid = None
3904 if flags != None:
3905 self.flags = flags
3906 else:
3907 self.flags = 0
3908 if name != None:
3909 self.name = name
3910 else:
3911 self.name = ""
3912 if tlvs != None:
3913 self.tlvs = tlvs
3914 else:
3915 self.tlvs = []
3916 return
3917
3918 def pack(self):
3919 packed = []
3920 packed.append(struct.pack("!B", self.version))
3921 packed.append(struct.pack("!B", self.type))
3922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3923 packed.append(struct.pack("!L", self.xid))
3924 packed.append(struct.pack("!H", self.stats_type))
3925 packed.append(struct.pack("!H", self.flags))
3926 packed.append('\x00' * 4)
3927 packed.append(struct.pack("!L", self.experimenter))
3928 packed.append(struct.pack("!L", self.subtype))
3929 packed.append(struct.pack("!64s", self.name))
3930 packed.append(loxi.generic_util.pack_list(self.tlvs))
3931 length = sum([len(x) for x in packed])
3932 packed[2] = struct.pack("!H", length)
3933 return ''.join(packed)
3934
3935 @staticmethod
3936 def unpack(reader):
3937 obj = bsn_generic_stats_request()
3938 _version = reader.read("!B")[0]
3939 assert(_version == 5)
3940 _type = reader.read("!B")[0]
3941 assert(_type == 18)
3942 _length = reader.read("!H")[0]
3943 orig_reader = reader
3944 reader = orig_reader.slice(_length, 4)
3945 obj.xid = reader.read("!L")[0]
3946 _stats_type = reader.read("!H")[0]
3947 assert(_stats_type == 65535)
3948 obj.flags = reader.read("!H")[0]
3949 reader.skip(4)
3950 _experimenter = reader.read("!L")[0]
3951 assert(_experimenter == 6035143)
3952 _subtype = reader.read("!L")[0]
3953 assert(_subtype == 16)
3954 obj.name = reader.read("!64s")[0].rstrip("\x00")
3955 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3956 return obj
3957
3958 def __eq__(self, other):
3959 if type(self) != type(other): return False
3960 if self.xid != other.xid: return False
3961 if self.flags != other.flags: return False
3962 if self.name != other.name: return False
3963 if self.tlvs != other.tlvs: return False
3964 return True
3965
3966 def pretty_print(self, q):
3967 q.text("bsn_generic_stats_request {")
3968 with q.group():
3969 with q.indent(2):
3970 q.breakable()
3971 q.text("xid = ");
3972 if self.xid != None:
3973 q.text("%#x" % self.xid)
3974 else:
3975 q.text('None')
3976 q.text(","); q.breakable()
3977 q.text("flags = ");
3978 q.text("%#x" % self.flags)
3979 q.text(","); q.breakable()
3980 q.text("name = ");
3981 q.pp(self.name)
3982 q.text(","); q.breakable()
3983 q.text("tlvs = ");
3984 q.pp(self.tlvs)
3985 q.breakable()
3986 q.text('}')
3987
3988bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3989
3990class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3991 version = 5
3992 type = 19
3993 stats_type = 65535
3994 experimenter = 6035143
3995 subtype = 5
3996
3997 def __init__(self, xid=None, flags=None, entries=None):
3998 if xid != None:
3999 self.xid = xid
4000 else:
4001 self.xid = None
4002 if flags != None:
4003 self.flags = flags
4004 else:
4005 self.flags = 0
4006 if entries != None:
4007 self.entries = entries
4008 else:
4009 self.entries = []
4010 return
4011
4012 def pack(self):
4013 packed = []
4014 packed.append(struct.pack("!B", self.version))
4015 packed.append(struct.pack("!B", self.type))
4016 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4017 packed.append(struct.pack("!L", self.xid))
4018 packed.append(struct.pack("!H", self.stats_type))
4019 packed.append(struct.pack("!H", self.flags))
4020 packed.append('\x00' * 4)
4021 packed.append(struct.pack("!L", self.experimenter))
4022 packed.append(struct.pack("!L", self.subtype))
4023 packed.append(loxi.generic_util.pack_list(self.entries))
4024 length = sum([len(x) for x in packed])
4025 packed[2] = struct.pack("!H", length)
4026 return ''.join(packed)
4027
4028 @staticmethod
4029 def unpack(reader):
4030 obj = bsn_gentable_bucket_stats_reply()
4031 _version = reader.read("!B")[0]
4032 assert(_version == 5)
4033 _type = reader.read("!B")[0]
4034 assert(_type == 19)
4035 _length = reader.read("!H")[0]
4036 orig_reader = reader
4037 reader = orig_reader.slice(_length, 4)
4038 obj.xid = reader.read("!L")[0]
4039 _stats_type = reader.read("!H")[0]
4040 assert(_stats_type == 65535)
4041 obj.flags = reader.read("!H")[0]
4042 reader.skip(4)
4043 _experimenter = reader.read("!L")[0]
4044 assert(_experimenter == 6035143)
4045 _subtype = reader.read("!L")[0]
4046 assert(_subtype == 5)
4047 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
4048 return obj
4049
4050 def __eq__(self, other):
4051 if type(self) != type(other): return False
4052 if self.xid != other.xid: return False
4053 if self.flags != other.flags: return False
4054 if self.entries != other.entries: return False
4055 return True
4056
4057 def pretty_print(self, q):
4058 q.text("bsn_gentable_bucket_stats_reply {")
4059 with q.group():
4060 with q.indent(2):
4061 q.breakable()
4062 q.text("xid = ");
4063 if self.xid != None:
4064 q.text("%#x" % self.xid)
4065 else:
4066 q.text('None')
4067 q.text(","); q.breakable()
4068 q.text("flags = ");
4069 q.text("%#x" % self.flags)
4070 q.text(","); q.breakable()
4071 q.text("entries = ");
4072 q.pp(self.entries)
4073 q.breakable()
4074 q.text('}')
4075
4076bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
4077
4078class bsn_gentable_bucket_stats_request(bsn_stats_request):
4079 version = 5
4080 type = 18
4081 stats_type = 65535
4082 experimenter = 6035143
4083 subtype = 5
4084
4085 def __init__(self, xid=None, flags=None, table_id=None):
4086 if xid != None:
4087 self.xid = xid
4088 else:
4089 self.xid = None
4090 if flags != None:
4091 self.flags = flags
4092 else:
4093 self.flags = 0
4094 if table_id != None:
4095 self.table_id = table_id
4096 else:
4097 self.table_id = 0
4098 return
4099
4100 def pack(self):
4101 packed = []
4102 packed.append(struct.pack("!B", self.version))
4103 packed.append(struct.pack("!B", self.type))
4104 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4105 packed.append(struct.pack("!L", self.xid))
4106 packed.append(struct.pack("!H", self.stats_type))
4107 packed.append(struct.pack("!H", self.flags))
4108 packed.append('\x00' * 4)
4109 packed.append(struct.pack("!L", self.experimenter))
4110 packed.append(struct.pack("!L", self.subtype))
4111 packed.append(struct.pack("!H", self.table_id))
4112 length = sum([len(x) for x in packed])
4113 packed[2] = struct.pack("!H", length)
4114 return ''.join(packed)
4115
4116 @staticmethod
4117 def unpack(reader):
4118 obj = bsn_gentable_bucket_stats_request()
4119 _version = reader.read("!B")[0]
4120 assert(_version == 5)
4121 _type = reader.read("!B")[0]
4122 assert(_type == 18)
4123 _length = reader.read("!H")[0]
4124 orig_reader = reader
4125 reader = orig_reader.slice(_length, 4)
4126 obj.xid = reader.read("!L")[0]
4127 _stats_type = reader.read("!H")[0]
4128 assert(_stats_type == 65535)
4129 obj.flags = reader.read("!H")[0]
4130 reader.skip(4)
4131 _experimenter = reader.read("!L")[0]
4132 assert(_experimenter == 6035143)
4133 _subtype = reader.read("!L")[0]
4134 assert(_subtype == 5)
4135 obj.table_id = reader.read("!H")[0]
4136 return obj
4137
4138 def __eq__(self, other):
4139 if type(self) != type(other): return False
4140 if self.xid != other.xid: return False
4141 if self.flags != other.flags: return False
4142 if self.table_id != other.table_id: return False
4143 return True
4144
4145 def pretty_print(self, q):
4146 q.text("bsn_gentable_bucket_stats_request {")
4147 with q.group():
4148 with q.indent(2):
4149 q.breakable()
4150 q.text("xid = ");
4151 if self.xid != None:
4152 q.text("%#x" % self.xid)
4153 else:
4154 q.text('None')
4155 q.text(","); q.breakable()
4156 q.text("flags = ");
4157 q.text("%#x" % self.flags)
4158 q.text(","); q.breakable()
4159 q.text("table_id = ");
4160 q.text("%#x" % self.table_id)
4161 q.breakable()
4162 q.text('}')
4163
4164bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
4165
4166class bsn_gentable_clear_reply(bsn_header):
4167 version = 5
4168 type = 4
4169 experimenter = 6035143
4170 subtype = 49
4171
4172 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
4173 if xid != None:
4174 self.xid = xid
4175 else:
4176 self.xid = None
4177 if table_id != None:
4178 self.table_id = table_id
4179 else:
4180 self.table_id = 0
4181 if deleted_count != None:
4182 self.deleted_count = deleted_count
4183 else:
4184 self.deleted_count = 0
4185 if error_count != None:
4186 self.error_count = error_count
4187 else:
4188 self.error_count = 0
4189 return
4190
4191 def pack(self):
4192 packed = []
4193 packed.append(struct.pack("!B", self.version))
4194 packed.append(struct.pack("!B", self.type))
4195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4196 packed.append(struct.pack("!L", self.xid))
4197 packed.append(struct.pack("!L", self.experimenter))
4198 packed.append(struct.pack("!L", self.subtype))
4199 packed.append(struct.pack("!H", self.table_id))
4200 packed.append('\x00' * 2)
4201 packed.append(struct.pack("!L", self.deleted_count))
4202 packed.append(struct.pack("!L", self.error_count))
4203 length = sum([len(x) for x in packed])
4204 packed[2] = struct.pack("!H", length)
4205 return ''.join(packed)
4206
4207 @staticmethod
4208 def unpack(reader):
4209 obj = bsn_gentable_clear_reply()
4210 _version = reader.read("!B")[0]
4211 assert(_version == 5)
4212 _type = reader.read("!B")[0]
4213 assert(_type == 4)
4214 _length = reader.read("!H")[0]
4215 orig_reader = reader
4216 reader = orig_reader.slice(_length, 4)
4217 obj.xid = reader.read("!L")[0]
4218 _experimenter = reader.read("!L")[0]
4219 assert(_experimenter == 6035143)
4220 _subtype = reader.read("!L")[0]
4221 assert(_subtype == 49)
4222 obj.table_id = reader.read("!H")[0]
4223 reader.skip(2)
4224 obj.deleted_count = reader.read("!L")[0]
4225 obj.error_count = reader.read("!L")[0]
4226 return obj
4227
4228 def __eq__(self, other):
4229 if type(self) != type(other): return False
4230 if self.xid != other.xid: return False
4231 if self.table_id != other.table_id: return False
4232 if self.deleted_count != other.deleted_count: return False
4233 if self.error_count != other.error_count: return False
4234 return True
4235
4236 def pretty_print(self, q):
4237 q.text("bsn_gentable_clear_reply {")
4238 with q.group():
4239 with q.indent(2):
4240 q.breakable()
4241 q.text("xid = ");
4242 if self.xid != None:
4243 q.text("%#x" % self.xid)
4244 else:
4245 q.text('None')
4246 q.text(","); q.breakable()
4247 q.text("table_id = ");
4248 q.text("%#x" % self.table_id)
4249 q.text(","); q.breakable()
4250 q.text("deleted_count = ");
4251 q.text("%#x" % self.deleted_count)
4252 q.text(","); q.breakable()
4253 q.text("error_count = ");
4254 q.text("%#x" % self.error_count)
4255 q.breakable()
4256 q.text('}')
4257
4258bsn_header.subtypes[49] = bsn_gentable_clear_reply
4259
4260class bsn_gentable_clear_request(bsn_header):
4261 version = 5
4262 type = 4
4263 experimenter = 6035143
4264 subtype = 48
4265
4266 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
4267 if xid != None:
4268 self.xid = xid
4269 else:
4270 self.xid = None
4271 if table_id != None:
4272 self.table_id = table_id
4273 else:
4274 self.table_id = 0
4275 if checksum != None:
4276 self.checksum = checksum
4277 else:
4278 self.checksum = 0
4279 if checksum_mask != None:
4280 self.checksum_mask = checksum_mask
4281 else:
4282 self.checksum_mask = 0
4283 return
4284
4285 def pack(self):
4286 packed = []
4287 packed.append(struct.pack("!B", self.version))
4288 packed.append(struct.pack("!B", self.type))
4289 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4290 packed.append(struct.pack("!L", self.xid))
4291 packed.append(struct.pack("!L", self.experimenter))
4292 packed.append(struct.pack("!L", self.subtype))
4293 packed.append(struct.pack("!H", self.table_id))
4294 packed.append('\x00' * 2)
4295 packed.append(util.pack_checksum_128(self.checksum))
4296 packed.append(util.pack_checksum_128(self.checksum_mask))
4297 length = sum([len(x) for x in packed])
4298 packed[2] = struct.pack("!H", length)
4299 return ''.join(packed)
4300
4301 @staticmethod
4302 def unpack(reader):
4303 obj = bsn_gentable_clear_request()
4304 _version = reader.read("!B")[0]
4305 assert(_version == 5)
4306 _type = reader.read("!B")[0]
4307 assert(_type == 4)
4308 _length = reader.read("!H")[0]
4309 orig_reader = reader
4310 reader = orig_reader.slice(_length, 4)
4311 obj.xid = reader.read("!L")[0]
4312 _experimenter = reader.read("!L")[0]
4313 assert(_experimenter == 6035143)
4314 _subtype = reader.read("!L")[0]
4315 assert(_subtype == 48)
4316 obj.table_id = reader.read("!H")[0]
4317 reader.skip(2)
4318 obj.checksum = util.unpack_checksum_128(reader)
4319 obj.checksum_mask = util.unpack_checksum_128(reader)
4320 return obj
4321
4322 def __eq__(self, other):
4323 if type(self) != type(other): return False
4324 if self.xid != other.xid: return False
4325 if self.table_id != other.table_id: return False
4326 if self.checksum != other.checksum: return False
4327 if self.checksum_mask != other.checksum_mask: return False
4328 return True
4329
4330 def pretty_print(self, q):
4331 q.text("bsn_gentable_clear_request {")
4332 with q.group():
4333 with q.indent(2):
4334 q.breakable()
4335 q.text("xid = ");
4336 if self.xid != None:
4337 q.text("%#x" % self.xid)
4338 else:
4339 q.text('None')
4340 q.text(","); q.breakable()
4341 q.text("table_id = ");
4342 q.text("%#x" % self.table_id)
4343 q.text(","); q.breakable()
4344 q.text("checksum = ");
4345 q.pp(self.checksum)
4346 q.text(","); q.breakable()
4347 q.text("checksum_mask = ");
4348 q.pp(self.checksum_mask)
4349 q.breakable()
4350 q.text('}')
4351
4352bsn_header.subtypes[48] = bsn_gentable_clear_request
4353
4354class bsn_gentable_desc_stats_reply(bsn_stats_reply):
4355 version = 5
4356 type = 19
4357 stats_type = 65535
4358 experimenter = 6035143
4359 subtype = 4
4360
4361 def __init__(self, xid=None, flags=None, entries=None):
4362 if xid != None:
4363 self.xid = xid
4364 else:
4365 self.xid = None
4366 if flags != None:
4367 self.flags = flags
4368 else:
4369 self.flags = 0
4370 if entries != None:
4371 self.entries = entries
4372 else:
4373 self.entries = []
4374 return
4375
4376 def pack(self):
4377 packed = []
4378 packed.append(struct.pack("!B", self.version))
4379 packed.append(struct.pack("!B", self.type))
4380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4381 packed.append(struct.pack("!L", self.xid))
4382 packed.append(struct.pack("!H", self.stats_type))
4383 packed.append(struct.pack("!H", self.flags))
4384 packed.append('\x00' * 4)
4385 packed.append(struct.pack("!L", self.experimenter))
4386 packed.append(struct.pack("!L", self.subtype))
4387 packed.append(loxi.generic_util.pack_list(self.entries))
4388 length = sum([len(x) for x in packed])
4389 packed[2] = struct.pack("!H", length)
4390 return ''.join(packed)
4391
4392 @staticmethod
4393 def unpack(reader):
4394 obj = bsn_gentable_desc_stats_reply()
4395 _version = reader.read("!B")[0]
4396 assert(_version == 5)
4397 _type = reader.read("!B")[0]
4398 assert(_type == 19)
4399 _length = reader.read("!H")[0]
4400 orig_reader = reader
4401 reader = orig_reader.slice(_length, 4)
4402 obj.xid = reader.read("!L")[0]
4403 _stats_type = reader.read("!H")[0]
4404 assert(_stats_type == 65535)
4405 obj.flags = reader.read("!H")[0]
4406 reader.skip(4)
4407 _experimenter = reader.read("!L")[0]
4408 assert(_experimenter == 6035143)
4409 _subtype = reader.read("!L")[0]
4410 assert(_subtype == 4)
4411 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
4412 return obj
4413
4414 def __eq__(self, other):
4415 if type(self) != type(other): return False
4416 if self.xid != other.xid: return False
4417 if self.flags != other.flags: return False
4418 if self.entries != other.entries: return False
4419 return True
4420
4421 def pretty_print(self, q):
4422 q.text("bsn_gentable_desc_stats_reply {")
4423 with q.group():
4424 with q.indent(2):
4425 q.breakable()
4426 q.text("xid = ");
4427 if self.xid != None:
4428 q.text("%#x" % self.xid)
4429 else:
4430 q.text('None')
4431 q.text(","); q.breakable()
4432 q.text("flags = ");
4433 q.text("%#x" % self.flags)
4434 q.text(","); q.breakable()
4435 q.text("entries = ");
4436 q.pp(self.entries)
4437 q.breakable()
4438 q.text('}')
4439
4440bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4441
4442class bsn_gentable_desc_stats_request(bsn_stats_request):
4443 version = 5
4444 type = 18
4445 stats_type = 65535
4446 experimenter = 6035143
4447 subtype = 4
4448
4449 def __init__(self, xid=None, flags=None):
4450 if xid != None:
4451 self.xid = xid
4452 else:
4453 self.xid = None
4454 if flags != None:
4455 self.flags = flags
4456 else:
4457 self.flags = 0
4458 return
4459
4460 def pack(self):
4461 packed = []
4462 packed.append(struct.pack("!B", self.version))
4463 packed.append(struct.pack("!B", self.type))
4464 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4465 packed.append(struct.pack("!L", self.xid))
4466 packed.append(struct.pack("!H", self.stats_type))
4467 packed.append(struct.pack("!H", self.flags))
4468 packed.append('\x00' * 4)
4469 packed.append(struct.pack("!L", self.experimenter))
4470 packed.append(struct.pack("!L", self.subtype))
4471 length = sum([len(x) for x in packed])
4472 packed[2] = struct.pack("!H", length)
4473 return ''.join(packed)
4474
4475 @staticmethod
4476 def unpack(reader):
4477 obj = bsn_gentable_desc_stats_request()
4478 _version = reader.read("!B")[0]
4479 assert(_version == 5)
4480 _type = reader.read("!B")[0]
4481 assert(_type == 18)
4482 _length = reader.read("!H")[0]
4483 orig_reader = reader
4484 reader = orig_reader.slice(_length, 4)
4485 obj.xid = reader.read("!L")[0]
4486 _stats_type = reader.read("!H")[0]
4487 assert(_stats_type == 65535)
4488 obj.flags = reader.read("!H")[0]
4489 reader.skip(4)
4490 _experimenter = reader.read("!L")[0]
4491 assert(_experimenter == 6035143)
4492 _subtype = reader.read("!L")[0]
4493 assert(_subtype == 4)
4494 return obj
4495
4496 def __eq__(self, other):
4497 if type(self) != type(other): return False
4498 if self.xid != other.xid: return False
4499 if self.flags != other.flags: return False
4500 return True
4501
4502 def pretty_print(self, q):
4503 q.text("bsn_gentable_desc_stats_request {")
4504 with q.group():
4505 with q.indent(2):
4506 q.breakable()
4507 q.text("xid = ");
4508 if self.xid != None:
4509 q.text("%#x" % self.xid)
4510 else:
4511 q.text('None')
4512 q.text(","); q.breakable()
4513 q.text("flags = ");
4514 q.text("%#x" % self.flags)
4515 q.breakable()
4516 q.text('}')
4517
4518bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4519
4520class bsn_gentable_entry_add(bsn_header):
4521 version = 5
4522 type = 4
4523 experimenter = 6035143
4524 subtype = 46
4525
4526 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4527 if xid != None:
4528 self.xid = xid
4529 else:
4530 self.xid = None
4531 if table_id != None:
4532 self.table_id = table_id
4533 else:
4534 self.table_id = 0
4535 if checksum != None:
4536 self.checksum = checksum
4537 else:
4538 self.checksum = 0
4539 if key != None:
4540 self.key = key
4541 else:
4542 self.key = []
4543 if value != None:
4544 self.value = value
4545 else:
4546 self.value = []
4547 return
4548
4549 def pack(self):
4550 packed = []
4551 packed.append(struct.pack("!B", self.version))
4552 packed.append(struct.pack("!B", self.type))
4553 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4554 packed.append(struct.pack("!L", self.xid))
4555 packed.append(struct.pack("!L", self.experimenter))
4556 packed.append(struct.pack("!L", self.subtype))
4557 packed.append(struct.pack("!H", self.table_id))
4558 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4559 packed.append(util.pack_checksum_128(self.checksum))
4560 packed.append(loxi.generic_util.pack_list(self.key))
4561 packed[7] = struct.pack("!H", len(packed[-1]))
4562 packed.append(loxi.generic_util.pack_list(self.value))
4563 length = sum([len(x) for x in packed])
4564 packed[2] = struct.pack("!H", length)
4565 return ''.join(packed)
4566
4567 @staticmethod
4568 def unpack(reader):
4569 obj = bsn_gentable_entry_add()
4570 _version = reader.read("!B")[0]
4571 assert(_version == 5)
4572 _type = reader.read("!B")[0]
4573 assert(_type == 4)
4574 _length = reader.read("!H")[0]
4575 orig_reader = reader
4576 reader = orig_reader.slice(_length, 4)
4577 obj.xid = reader.read("!L")[0]
4578 _experimenter = reader.read("!L")[0]
4579 assert(_experimenter == 6035143)
4580 _subtype = reader.read("!L")[0]
4581 assert(_subtype == 46)
4582 obj.table_id = reader.read("!H")[0]
4583 _key_length = reader.read("!H")[0]
4584 obj.checksum = util.unpack_checksum_128(reader)
4585 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4586 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4587 return obj
4588
4589 def __eq__(self, other):
4590 if type(self) != type(other): return False
4591 if self.xid != other.xid: return False
4592 if self.table_id != other.table_id: return False
4593 if self.checksum != other.checksum: return False
4594 if self.key != other.key: return False
4595 if self.value != other.value: return False
4596 return True
4597
4598 def pretty_print(self, q):
4599 q.text("bsn_gentable_entry_add {")
4600 with q.group():
4601 with q.indent(2):
4602 q.breakable()
4603 q.text("xid = ");
4604 if self.xid != None:
4605 q.text("%#x" % self.xid)
4606 else:
4607 q.text('None')
4608 q.text(","); q.breakable()
4609 q.text("table_id = ");
4610 q.text("%#x" % self.table_id)
4611 q.text(","); q.breakable()
4612 q.text("checksum = ");
4613 q.pp(self.checksum)
4614 q.text(","); q.breakable()
4615 q.text("key = ");
4616 q.pp(self.key)
4617 q.text(","); q.breakable()
4618 q.text("value = ");
4619 q.pp(self.value)
4620 q.breakable()
4621 q.text('}')
4622
4623bsn_header.subtypes[46] = bsn_gentable_entry_add
4624
4625class bsn_gentable_entry_delete(bsn_header):
4626 version = 5
4627 type = 4
4628 experimenter = 6035143
4629 subtype = 47
4630
4631 def __init__(self, xid=None, table_id=None, key=None):
4632 if xid != None:
4633 self.xid = xid
4634 else:
4635 self.xid = None
4636 if table_id != None:
4637 self.table_id = table_id
4638 else:
4639 self.table_id = 0
4640 if key != None:
4641 self.key = key
4642 else:
4643 self.key = []
4644 return
4645
4646 def pack(self):
4647 packed = []
4648 packed.append(struct.pack("!B", self.version))
4649 packed.append(struct.pack("!B", self.type))
4650 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4651 packed.append(struct.pack("!L", self.xid))
4652 packed.append(struct.pack("!L", self.experimenter))
4653 packed.append(struct.pack("!L", self.subtype))
4654 packed.append(struct.pack("!H", self.table_id))
4655 packed.append(loxi.generic_util.pack_list(self.key))
4656 length = sum([len(x) for x in packed])
4657 packed[2] = struct.pack("!H", length)
4658 return ''.join(packed)
4659
4660 @staticmethod
4661 def unpack(reader):
4662 obj = bsn_gentable_entry_delete()
4663 _version = reader.read("!B")[0]
4664 assert(_version == 5)
4665 _type = reader.read("!B")[0]
4666 assert(_type == 4)
4667 _length = reader.read("!H")[0]
4668 orig_reader = reader
4669 reader = orig_reader.slice(_length, 4)
4670 obj.xid = reader.read("!L")[0]
4671 _experimenter = reader.read("!L")[0]
4672 assert(_experimenter == 6035143)
4673 _subtype = reader.read("!L")[0]
4674 assert(_subtype == 47)
4675 obj.table_id = reader.read("!H")[0]
4676 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4677 return obj
4678
4679 def __eq__(self, other):
4680 if type(self) != type(other): return False
4681 if self.xid != other.xid: return False
4682 if self.table_id != other.table_id: return False
4683 if self.key != other.key: return False
4684 return True
4685
4686 def pretty_print(self, q):
4687 q.text("bsn_gentable_entry_delete {")
4688 with q.group():
4689 with q.indent(2):
4690 q.breakable()
4691 q.text("xid = ");
4692 if self.xid != None:
4693 q.text("%#x" % self.xid)
4694 else:
4695 q.text('None')
4696 q.text(","); q.breakable()
4697 q.text("table_id = ");
4698 q.text("%#x" % self.table_id)
4699 q.text(","); q.breakable()
4700 q.text("key = ");
4701 q.pp(self.key)
4702 q.breakable()
4703 q.text('}')
4704
4705bsn_header.subtypes[47] = bsn_gentable_entry_delete
4706
4707class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4708 version = 5
4709 type = 19
4710 stats_type = 65535
4711 experimenter = 6035143
4712 subtype = 2
4713
4714 def __init__(self, xid=None, flags=None, entries=None):
4715 if xid != None:
4716 self.xid = xid
4717 else:
4718 self.xid = None
4719 if flags != None:
4720 self.flags = flags
4721 else:
4722 self.flags = 0
4723 if entries != None:
4724 self.entries = entries
4725 else:
4726 self.entries = []
4727 return
4728
4729 def pack(self):
4730 packed = []
4731 packed.append(struct.pack("!B", self.version))
4732 packed.append(struct.pack("!B", self.type))
4733 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4734 packed.append(struct.pack("!L", self.xid))
4735 packed.append(struct.pack("!H", self.stats_type))
4736 packed.append(struct.pack("!H", self.flags))
4737 packed.append('\x00' * 4)
4738 packed.append(struct.pack("!L", self.experimenter))
4739 packed.append(struct.pack("!L", self.subtype))
4740 packed.append(loxi.generic_util.pack_list(self.entries))
4741 length = sum([len(x) for x in packed])
4742 packed[2] = struct.pack("!H", length)
4743 return ''.join(packed)
4744
4745 @staticmethod
4746 def unpack(reader):
4747 obj = bsn_gentable_entry_desc_stats_reply()
4748 _version = reader.read("!B")[0]
4749 assert(_version == 5)
4750 _type = reader.read("!B")[0]
4751 assert(_type == 19)
4752 _length = reader.read("!H")[0]
4753 orig_reader = reader
4754 reader = orig_reader.slice(_length, 4)
4755 obj.xid = reader.read("!L")[0]
4756 _stats_type = reader.read("!H")[0]
4757 assert(_stats_type == 65535)
4758 obj.flags = reader.read("!H")[0]
4759 reader.skip(4)
4760 _experimenter = reader.read("!L")[0]
4761 assert(_experimenter == 6035143)
4762 _subtype = reader.read("!L")[0]
4763 assert(_subtype == 2)
4764 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
4765 return obj
4766
4767 def __eq__(self, other):
4768 if type(self) != type(other): return False
4769 if self.xid != other.xid: return False
4770 if self.flags != other.flags: return False
4771 if self.entries != other.entries: return False
4772 return True
4773
4774 def pretty_print(self, q):
4775 q.text("bsn_gentable_entry_desc_stats_reply {")
4776 with q.group():
4777 with q.indent(2):
4778 q.breakable()
4779 q.text("xid = ");
4780 if self.xid != None:
4781 q.text("%#x" % self.xid)
4782 else:
4783 q.text('None')
4784 q.text(","); q.breakable()
4785 q.text("flags = ");
4786 q.text("%#x" % self.flags)
4787 q.text(","); q.breakable()
4788 q.text("entries = ");
4789 q.pp(self.entries)
4790 q.breakable()
4791 q.text('}')
4792
4793bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4794
4795class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4796 version = 5
4797 type = 18
4798 stats_type = 65535
4799 experimenter = 6035143
4800 subtype = 2
4801
4802 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4803 if xid != None:
4804 self.xid = xid
4805 else:
4806 self.xid = None
4807 if flags != None:
4808 self.flags = flags
4809 else:
4810 self.flags = 0
4811 if table_id != None:
4812 self.table_id = table_id
4813 else:
4814 self.table_id = 0
4815 if checksum != None:
4816 self.checksum = checksum
4817 else:
4818 self.checksum = 0
4819 if checksum_mask != None:
4820 self.checksum_mask = checksum_mask
4821 else:
4822 self.checksum_mask = 0
4823 return
4824
4825 def pack(self):
4826 packed = []
4827 packed.append(struct.pack("!B", self.version))
4828 packed.append(struct.pack("!B", self.type))
4829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4830 packed.append(struct.pack("!L", self.xid))
4831 packed.append(struct.pack("!H", self.stats_type))
4832 packed.append(struct.pack("!H", self.flags))
4833 packed.append('\x00' * 4)
4834 packed.append(struct.pack("!L", self.experimenter))
4835 packed.append(struct.pack("!L", self.subtype))
4836 packed.append(struct.pack("!H", self.table_id))
4837 packed.append('\x00' * 2)
4838 packed.append(util.pack_checksum_128(self.checksum))
4839 packed.append(util.pack_checksum_128(self.checksum_mask))
4840 length = sum([len(x) for x in packed])
4841 packed[2] = struct.pack("!H", length)
4842 return ''.join(packed)
4843
4844 @staticmethod
4845 def unpack(reader):
4846 obj = bsn_gentable_entry_desc_stats_request()
4847 _version = reader.read("!B")[0]
4848 assert(_version == 5)
4849 _type = reader.read("!B")[0]
4850 assert(_type == 18)
4851 _length = reader.read("!H")[0]
4852 orig_reader = reader
4853 reader = orig_reader.slice(_length, 4)
4854 obj.xid = reader.read("!L")[0]
4855 _stats_type = reader.read("!H")[0]
4856 assert(_stats_type == 65535)
4857 obj.flags = reader.read("!H")[0]
4858 reader.skip(4)
4859 _experimenter = reader.read("!L")[0]
4860 assert(_experimenter == 6035143)
4861 _subtype = reader.read("!L")[0]
4862 assert(_subtype == 2)
4863 obj.table_id = reader.read("!H")[0]
4864 reader.skip(2)
4865 obj.checksum = util.unpack_checksum_128(reader)
4866 obj.checksum_mask = util.unpack_checksum_128(reader)
4867 return obj
4868
4869 def __eq__(self, other):
4870 if type(self) != type(other): return False
4871 if self.xid != other.xid: return False
4872 if self.flags != other.flags: return False
4873 if self.table_id != other.table_id: return False
4874 if self.checksum != other.checksum: return False
4875 if self.checksum_mask != other.checksum_mask: return False
4876 return True
4877
4878 def pretty_print(self, q):
4879 q.text("bsn_gentable_entry_desc_stats_request {")
4880 with q.group():
4881 with q.indent(2):
4882 q.breakable()
4883 q.text("xid = ");
4884 if self.xid != None:
4885 q.text("%#x" % self.xid)
4886 else:
4887 q.text('None')
4888 q.text(","); q.breakable()
4889 q.text("flags = ");
4890 q.text("%#x" % self.flags)
4891 q.text(","); q.breakable()
4892 q.text("table_id = ");
4893 q.text("%#x" % self.table_id)
4894 q.text(","); q.breakable()
4895 q.text("checksum = ");
4896 q.pp(self.checksum)
4897 q.text(","); q.breakable()
4898 q.text("checksum_mask = ");
4899 q.pp(self.checksum_mask)
4900 q.breakable()
4901 q.text('}')
4902
4903bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4904
4905class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4906 version = 5
4907 type = 19
4908 stats_type = 65535
4909 experimenter = 6035143
4910 subtype = 3
4911
4912 def __init__(self, xid=None, flags=None, entries=None):
4913 if xid != None:
4914 self.xid = xid
4915 else:
4916 self.xid = None
4917 if flags != None:
4918 self.flags = flags
4919 else:
4920 self.flags = 0
4921 if entries != None:
4922 self.entries = entries
4923 else:
4924 self.entries = []
4925 return
4926
4927 def pack(self):
4928 packed = []
4929 packed.append(struct.pack("!B", self.version))
4930 packed.append(struct.pack("!B", self.type))
4931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4932 packed.append(struct.pack("!L", self.xid))
4933 packed.append(struct.pack("!H", self.stats_type))
4934 packed.append(struct.pack("!H", self.flags))
4935 packed.append('\x00' * 4)
4936 packed.append(struct.pack("!L", self.experimenter))
4937 packed.append(struct.pack("!L", self.subtype))
4938 packed.append(loxi.generic_util.pack_list(self.entries))
4939 length = sum([len(x) for x in packed])
4940 packed[2] = struct.pack("!H", length)
4941 return ''.join(packed)
4942
4943 @staticmethod
4944 def unpack(reader):
4945 obj = bsn_gentable_entry_stats_reply()
4946 _version = reader.read("!B")[0]
4947 assert(_version == 5)
4948 _type = reader.read("!B")[0]
4949 assert(_type == 19)
4950 _length = reader.read("!H")[0]
4951 orig_reader = reader
4952 reader = orig_reader.slice(_length, 4)
4953 obj.xid = reader.read("!L")[0]
4954 _stats_type = reader.read("!H")[0]
4955 assert(_stats_type == 65535)
4956 obj.flags = reader.read("!H")[0]
4957 reader.skip(4)
4958 _experimenter = reader.read("!L")[0]
4959 assert(_experimenter == 6035143)
4960 _subtype = reader.read("!L")[0]
4961 assert(_subtype == 3)
4962 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
4963 return obj
4964
4965 def __eq__(self, other):
4966 if type(self) != type(other): return False
4967 if self.xid != other.xid: return False
4968 if self.flags != other.flags: return False
4969 if self.entries != other.entries: return False
4970 return True
4971
4972 def pretty_print(self, q):
4973 q.text("bsn_gentable_entry_stats_reply {")
4974 with q.group():
4975 with q.indent(2):
4976 q.breakable()
4977 q.text("xid = ");
4978 if self.xid != None:
4979 q.text("%#x" % self.xid)
4980 else:
4981 q.text('None')
4982 q.text(","); q.breakable()
4983 q.text("flags = ");
4984 q.text("%#x" % self.flags)
4985 q.text(","); q.breakable()
4986 q.text("entries = ");
4987 q.pp(self.entries)
4988 q.breakable()
4989 q.text('}')
4990
4991bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4992
4993class bsn_gentable_entry_stats_request(bsn_stats_request):
4994 version = 5
4995 type = 18
4996 stats_type = 65535
4997 experimenter = 6035143
4998 subtype = 3
4999
5000 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
5001 if xid != None:
5002 self.xid = xid
5003 else:
5004 self.xid = None
5005 if flags != None:
5006 self.flags = flags
5007 else:
5008 self.flags = 0
5009 if table_id != None:
5010 self.table_id = table_id
5011 else:
5012 self.table_id = 0
5013 if checksum != None:
5014 self.checksum = checksum
5015 else:
5016 self.checksum = 0
5017 if checksum_mask != None:
5018 self.checksum_mask = checksum_mask
5019 else:
5020 self.checksum_mask = 0
5021 return
5022
5023 def pack(self):
5024 packed = []
5025 packed.append(struct.pack("!B", self.version))
5026 packed.append(struct.pack("!B", self.type))
5027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5028 packed.append(struct.pack("!L", self.xid))
5029 packed.append(struct.pack("!H", self.stats_type))
5030 packed.append(struct.pack("!H", self.flags))
5031 packed.append('\x00' * 4)
5032 packed.append(struct.pack("!L", self.experimenter))
5033 packed.append(struct.pack("!L", self.subtype))
5034 packed.append(struct.pack("!H", self.table_id))
5035 packed.append('\x00' * 2)
5036 packed.append(util.pack_checksum_128(self.checksum))
5037 packed.append(util.pack_checksum_128(self.checksum_mask))
5038 length = sum([len(x) for x in packed])
5039 packed[2] = struct.pack("!H", length)
5040 return ''.join(packed)
5041
5042 @staticmethod
5043 def unpack(reader):
5044 obj = bsn_gentable_entry_stats_request()
5045 _version = reader.read("!B")[0]
5046 assert(_version == 5)
5047 _type = reader.read("!B")[0]
5048 assert(_type == 18)
5049 _length = reader.read("!H")[0]
5050 orig_reader = reader
5051 reader = orig_reader.slice(_length, 4)
5052 obj.xid = reader.read("!L")[0]
5053 _stats_type = reader.read("!H")[0]
5054 assert(_stats_type == 65535)
5055 obj.flags = reader.read("!H")[0]
5056 reader.skip(4)
5057 _experimenter = reader.read("!L")[0]
5058 assert(_experimenter == 6035143)
5059 _subtype = reader.read("!L")[0]
5060 assert(_subtype == 3)
5061 obj.table_id = reader.read("!H")[0]
5062 reader.skip(2)
5063 obj.checksum = util.unpack_checksum_128(reader)
5064 obj.checksum_mask = util.unpack_checksum_128(reader)
5065 return obj
5066
5067 def __eq__(self, other):
5068 if type(self) != type(other): return False
5069 if self.xid != other.xid: return False
5070 if self.flags != other.flags: return False
5071 if self.table_id != other.table_id: return False
5072 if self.checksum != other.checksum: return False
5073 if self.checksum_mask != other.checksum_mask: return False
5074 return True
5075
5076 def pretty_print(self, q):
5077 q.text("bsn_gentable_entry_stats_request {")
5078 with q.group():
5079 with q.indent(2):
5080 q.breakable()
5081 q.text("xid = ");
5082 if self.xid != None:
5083 q.text("%#x" % self.xid)
5084 else:
5085 q.text('None')
5086 q.text(","); q.breakable()
5087 q.text("flags = ");
5088 q.text("%#x" % self.flags)
5089 q.text(","); q.breakable()
5090 q.text("table_id = ");
5091 q.text("%#x" % self.table_id)
5092 q.text(","); q.breakable()
5093 q.text("checksum = ");
5094 q.pp(self.checksum)
5095 q.text(","); q.breakable()
5096 q.text("checksum_mask = ");
5097 q.pp(self.checksum_mask)
5098 q.breakable()
5099 q.text('}')
5100
5101bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
5102
5103class bsn_gentable_set_buckets_size(bsn_header):
5104 version = 5
5105 type = 4
5106 experimenter = 6035143
5107 subtype = 50
5108
5109 def __init__(self, xid=None, table_id=None, buckets_size=None):
5110 if xid != None:
5111 self.xid = xid
5112 else:
5113 self.xid = None
5114 if table_id != None:
5115 self.table_id = table_id
5116 else:
5117 self.table_id = 0
5118 if buckets_size != None:
5119 self.buckets_size = buckets_size
5120 else:
5121 self.buckets_size = 0
5122 return
5123
5124 def pack(self):
5125 packed = []
5126 packed.append(struct.pack("!B", self.version))
5127 packed.append(struct.pack("!B", self.type))
5128 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5129 packed.append(struct.pack("!L", self.xid))
5130 packed.append(struct.pack("!L", self.experimenter))
5131 packed.append(struct.pack("!L", self.subtype))
5132 packed.append(struct.pack("!H", self.table_id))
5133 packed.append('\x00' * 2)
5134 packed.append(struct.pack("!L", self.buckets_size))
5135 length = sum([len(x) for x in packed])
5136 packed[2] = struct.pack("!H", length)
5137 return ''.join(packed)
5138
5139 @staticmethod
5140 def unpack(reader):
5141 obj = bsn_gentable_set_buckets_size()
5142 _version = reader.read("!B")[0]
5143 assert(_version == 5)
5144 _type = reader.read("!B")[0]
5145 assert(_type == 4)
5146 _length = reader.read("!H")[0]
5147 orig_reader = reader
5148 reader = orig_reader.slice(_length, 4)
5149 obj.xid = reader.read("!L")[0]
5150 _experimenter = reader.read("!L")[0]
5151 assert(_experimenter == 6035143)
5152 _subtype = reader.read("!L")[0]
5153 assert(_subtype == 50)
5154 obj.table_id = reader.read("!H")[0]
5155 reader.skip(2)
5156 obj.buckets_size = reader.read("!L")[0]
5157 return obj
5158
5159 def __eq__(self, other):
5160 if type(self) != type(other): return False
5161 if self.xid != other.xid: return False
5162 if self.table_id != other.table_id: return False
5163 if self.buckets_size != other.buckets_size: return False
5164 return True
5165
5166 def pretty_print(self, q):
5167 q.text("bsn_gentable_set_buckets_size {")
5168 with q.group():
5169 with q.indent(2):
5170 q.breakable()
5171 q.text("xid = ");
5172 if self.xid != None:
5173 q.text("%#x" % self.xid)
5174 else:
5175 q.text('None')
5176 q.text(","); q.breakable()
5177 q.text("table_id = ");
5178 q.text("%#x" % self.table_id)
5179 q.text(","); q.breakable()
5180 q.text("buckets_size = ");
5181 q.text("%#x" % self.buckets_size)
5182 q.breakable()
5183 q.text('}')
5184
5185bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
5186
5187class bsn_gentable_stats_reply(bsn_stats_reply):
5188 version = 5
5189 type = 19
5190 stats_type = 65535
5191 experimenter = 6035143
5192 subtype = 7
5193
5194 def __init__(self, xid=None, flags=None, entries=None):
5195 if xid != None:
5196 self.xid = xid
5197 else:
5198 self.xid = None
5199 if flags != None:
5200 self.flags = flags
5201 else:
5202 self.flags = 0
5203 if entries != None:
5204 self.entries = entries
5205 else:
5206 self.entries = []
5207 return
5208
5209 def pack(self):
5210 packed = []
5211 packed.append(struct.pack("!B", self.version))
5212 packed.append(struct.pack("!B", self.type))
5213 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5214 packed.append(struct.pack("!L", self.xid))
5215 packed.append(struct.pack("!H", self.stats_type))
5216 packed.append(struct.pack("!H", self.flags))
5217 packed.append('\x00' * 4)
5218 packed.append(struct.pack("!L", self.experimenter))
5219 packed.append(struct.pack("!L", self.subtype))
5220 packed.append(loxi.generic_util.pack_list(self.entries))
5221 length = sum([len(x) for x in packed])
5222 packed[2] = struct.pack("!H", length)
5223 return ''.join(packed)
5224
5225 @staticmethod
5226 def unpack(reader):
5227 obj = bsn_gentable_stats_reply()
5228 _version = reader.read("!B")[0]
5229 assert(_version == 5)
5230 _type = reader.read("!B")[0]
5231 assert(_type == 19)
5232 _length = reader.read("!H")[0]
5233 orig_reader = reader
5234 reader = orig_reader.slice(_length, 4)
5235 obj.xid = reader.read("!L")[0]
5236 _stats_type = reader.read("!H")[0]
5237 assert(_stats_type == 65535)
5238 obj.flags = reader.read("!H")[0]
5239 reader.skip(4)
5240 _experimenter = reader.read("!L")[0]
5241 assert(_experimenter == 6035143)
5242 _subtype = reader.read("!L")[0]
5243 assert(_subtype == 7)
5244 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
5245 return obj
5246
5247 def __eq__(self, other):
5248 if type(self) != type(other): return False
5249 if self.xid != other.xid: return False
5250 if self.flags != other.flags: return False
5251 if self.entries != other.entries: return False
5252 return True
5253
5254 def pretty_print(self, q):
5255 q.text("bsn_gentable_stats_reply {")
5256 with q.group():
5257 with q.indent(2):
5258 q.breakable()
5259 q.text("xid = ");
5260 if self.xid != None:
5261 q.text("%#x" % self.xid)
5262 else:
5263 q.text('None')
5264 q.text(","); q.breakable()
5265 q.text("flags = ");
5266 q.text("%#x" % self.flags)
5267 q.text(","); q.breakable()
5268 q.text("entries = ");
5269 q.pp(self.entries)
5270 q.breakable()
5271 q.text('}')
5272
5273bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
5274
5275class bsn_gentable_stats_request(bsn_stats_request):
5276 version = 5
5277 type = 18
5278 stats_type = 65535
5279 experimenter = 6035143
5280 subtype = 7
5281
5282 def __init__(self, xid=None, flags=None):
5283 if xid != None:
5284 self.xid = xid
5285 else:
5286 self.xid = None
5287 if flags != None:
5288 self.flags = flags
5289 else:
5290 self.flags = 0
5291 return
5292
5293 def pack(self):
5294 packed = []
5295 packed.append(struct.pack("!B", self.version))
5296 packed.append(struct.pack("!B", self.type))
5297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5298 packed.append(struct.pack("!L", self.xid))
5299 packed.append(struct.pack("!H", self.stats_type))
5300 packed.append(struct.pack("!H", self.flags))
5301 packed.append('\x00' * 4)
5302 packed.append(struct.pack("!L", self.experimenter))
5303 packed.append(struct.pack("!L", self.subtype))
5304 length = sum([len(x) for x in packed])
5305 packed[2] = struct.pack("!H", length)
5306 return ''.join(packed)
5307
5308 @staticmethod
5309 def unpack(reader):
5310 obj = bsn_gentable_stats_request()
5311 _version = reader.read("!B")[0]
5312 assert(_version == 5)
5313 _type = reader.read("!B")[0]
5314 assert(_type == 18)
5315 _length = reader.read("!H")[0]
5316 orig_reader = reader
5317 reader = orig_reader.slice(_length, 4)
5318 obj.xid = reader.read("!L")[0]
5319 _stats_type = reader.read("!H")[0]
5320 assert(_stats_type == 65535)
5321 obj.flags = reader.read("!H")[0]
5322 reader.skip(4)
5323 _experimenter = reader.read("!L")[0]
5324 assert(_experimenter == 6035143)
5325 _subtype = reader.read("!L")[0]
5326 assert(_subtype == 7)
5327 return obj
5328
5329 def __eq__(self, other):
5330 if type(self) != type(other): return False
5331 if self.xid != other.xid: return False
5332 if self.flags != other.flags: return False
5333 return True
5334
5335 def pretty_print(self, q):
5336 q.text("bsn_gentable_stats_request {")
5337 with q.group():
5338 with q.indent(2):
5339 q.breakable()
5340 q.text("xid = ");
5341 if self.xid != None:
5342 q.text("%#x" % self.xid)
5343 else:
5344 q.text('None')
5345 q.text(","); q.breakable()
5346 q.text("flags = ");
5347 q.text("%#x" % self.flags)
5348 q.breakable()
5349 q.text('}')
5350
5351bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
5352
5353class bsn_get_interfaces_reply(bsn_header):
5354 version = 5
5355 type = 4
5356 experimenter = 6035143
5357 subtype = 10
5358
5359 def __init__(self, xid=None, interfaces=None):
5360 if xid != None:
5361 self.xid = xid
5362 else:
5363 self.xid = None
5364 if interfaces != None:
5365 self.interfaces = interfaces
5366 else:
5367 self.interfaces = []
5368 return
5369
5370 def pack(self):
5371 packed = []
5372 packed.append(struct.pack("!B", self.version))
5373 packed.append(struct.pack("!B", self.type))
5374 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5375 packed.append(struct.pack("!L", self.xid))
5376 packed.append(struct.pack("!L", self.experimenter))
5377 packed.append(struct.pack("!L", self.subtype))
5378 packed.append(loxi.generic_util.pack_list(self.interfaces))
5379 length = sum([len(x) for x in packed])
5380 packed[2] = struct.pack("!H", length)
5381 return ''.join(packed)
5382
5383 @staticmethod
5384 def unpack(reader):
5385 obj = bsn_get_interfaces_reply()
5386 _version = reader.read("!B")[0]
5387 assert(_version == 5)
5388 _type = reader.read("!B")[0]
5389 assert(_type == 4)
5390 _length = reader.read("!H")[0]
5391 orig_reader = reader
5392 reader = orig_reader.slice(_length, 4)
5393 obj.xid = reader.read("!L")[0]
5394 _experimenter = reader.read("!L")[0]
5395 assert(_experimenter == 6035143)
5396 _subtype = reader.read("!L")[0]
5397 assert(_subtype == 10)
5398 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
5399 return obj
5400
5401 def __eq__(self, other):
5402 if type(self) != type(other): return False
5403 if self.xid != other.xid: return False
5404 if self.interfaces != other.interfaces: return False
5405 return True
5406
5407 def pretty_print(self, q):
5408 q.text("bsn_get_interfaces_reply {")
5409 with q.group():
5410 with q.indent(2):
5411 q.breakable()
5412 q.text("xid = ");
5413 if self.xid != None:
5414 q.text("%#x" % self.xid)
5415 else:
5416 q.text('None')
5417 q.text(","); q.breakable()
5418 q.text("interfaces = ");
5419 q.pp(self.interfaces)
5420 q.breakable()
5421 q.text('}')
5422
5423bsn_header.subtypes[10] = bsn_get_interfaces_reply
5424
5425class bsn_get_interfaces_request(bsn_header):
5426 version = 5
5427 type = 4
5428 experimenter = 6035143
5429 subtype = 9
5430
5431 def __init__(self, xid=None):
5432 if xid != None:
5433 self.xid = xid
5434 else:
5435 self.xid = None
5436 return
5437
5438 def pack(self):
5439 packed = []
5440 packed.append(struct.pack("!B", self.version))
5441 packed.append(struct.pack("!B", self.type))
5442 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5443 packed.append(struct.pack("!L", self.xid))
5444 packed.append(struct.pack("!L", self.experimenter))
5445 packed.append(struct.pack("!L", self.subtype))
5446 length = sum([len(x) for x in packed])
5447 packed[2] = struct.pack("!H", length)
5448 return ''.join(packed)
5449
5450 @staticmethod
5451 def unpack(reader):
5452 obj = bsn_get_interfaces_request()
5453 _version = reader.read("!B")[0]
5454 assert(_version == 5)
5455 _type = reader.read("!B")[0]
5456 assert(_type == 4)
5457 _length = reader.read("!H")[0]
5458 orig_reader = reader
5459 reader = orig_reader.slice(_length, 4)
5460 obj.xid = reader.read("!L")[0]
5461 _experimenter = reader.read("!L")[0]
5462 assert(_experimenter == 6035143)
5463 _subtype = reader.read("!L")[0]
5464 assert(_subtype == 9)
5465 return obj
5466
5467 def __eq__(self, other):
5468 if type(self) != type(other): return False
5469 if self.xid != other.xid: return False
5470 return True
5471
5472 def pretty_print(self, q):
5473 q.text("bsn_get_interfaces_request {")
5474 with q.group():
5475 with q.indent(2):
5476 q.breakable()
5477 q.text("xid = ");
5478 if self.xid != None:
5479 q.text("%#x" % self.xid)
5480 else:
5481 q.text('None')
5482 q.breakable()
5483 q.text('}')
5484
5485bsn_header.subtypes[9] = bsn_get_interfaces_request
5486
5487class bsn_get_mirroring_reply(bsn_header):
5488 version = 5
5489 type = 4
5490 experimenter = 6035143
5491 subtype = 5
5492
5493 def __init__(self, xid=None, report_mirror_ports=None):
5494 if xid != None:
5495 self.xid = xid
5496 else:
5497 self.xid = None
5498 if report_mirror_ports != None:
5499 self.report_mirror_ports = report_mirror_ports
5500 else:
5501 self.report_mirror_ports = 0
5502 return
5503
5504 def pack(self):
5505 packed = []
5506 packed.append(struct.pack("!B", self.version))
5507 packed.append(struct.pack("!B", self.type))
5508 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5509 packed.append(struct.pack("!L", self.xid))
5510 packed.append(struct.pack("!L", self.experimenter))
5511 packed.append(struct.pack("!L", self.subtype))
5512 packed.append(struct.pack("!B", self.report_mirror_ports))
5513 packed.append('\x00' * 3)
5514 length = sum([len(x) for x in packed])
5515 packed[2] = struct.pack("!H", length)
5516 return ''.join(packed)
5517
5518 @staticmethod
5519 def unpack(reader):
5520 obj = bsn_get_mirroring_reply()
5521 _version = reader.read("!B")[0]
5522 assert(_version == 5)
5523 _type = reader.read("!B")[0]
5524 assert(_type == 4)
5525 _length = reader.read("!H")[0]
5526 orig_reader = reader
5527 reader = orig_reader.slice(_length, 4)
5528 obj.xid = reader.read("!L")[0]
5529 _experimenter = reader.read("!L")[0]
5530 assert(_experimenter == 6035143)
5531 _subtype = reader.read("!L")[0]
5532 assert(_subtype == 5)
5533 obj.report_mirror_ports = reader.read("!B")[0]
5534 reader.skip(3)
5535 return obj
5536
5537 def __eq__(self, other):
5538 if type(self) != type(other): return False
5539 if self.xid != other.xid: return False
5540 if self.report_mirror_ports != other.report_mirror_ports: return False
5541 return True
5542
5543 def pretty_print(self, q):
5544 q.text("bsn_get_mirroring_reply {")
5545 with q.group():
5546 with q.indent(2):
5547 q.breakable()
5548 q.text("xid = ");
5549 if self.xid != None:
5550 q.text("%#x" % self.xid)
5551 else:
5552 q.text('None')
5553 q.text(","); q.breakable()
5554 q.text("report_mirror_ports = ");
5555 q.text("%#x" % self.report_mirror_ports)
5556 q.breakable()
5557 q.text('}')
5558
5559bsn_header.subtypes[5] = bsn_get_mirroring_reply
5560
5561class bsn_get_mirroring_request(bsn_header):
5562 version = 5
5563 type = 4
5564 experimenter = 6035143
5565 subtype = 4
5566
5567 def __init__(self, xid=None, report_mirror_ports=None):
5568 if xid != None:
5569 self.xid = xid
5570 else:
5571 self.xid = None
5572 if report_mirror_ports != None:
5573 self.report_mirror_ports = report_mirror_ports
5574 else:
5575 self.report_mirror_ports = 0
5576 return
5577
5578 def pack(self):
5579 packed = []
5580 packed.append(struct.pack("!B", self.version))
5581 packed.append(struct.pack("!B", self.type))
5582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5583 packed.append(struct.pack("!L", self.xid))
5584 packed.append(struct.pack("!L", self.experimenter))
5585 packed.append(struct.pack("!L", self.subtype))
5586 packed.append(struct.pack("!B", self.report_mirror_ports))
5587 packed.append('\x00' * 3)
5588 length = sum([len(x) for x in packed])
5589 packed[2] = struct.pack("!H", length)
5590 return ''.join(packed)
5591
5592 @staticmethod
5593 def unpack(reader):
5594 obj = bsn_get_mirroring_request()
5595 _version = reader.read("!B")[0]
5596 assert(_version == 5)
5597 _type = reader.read("!B")[0]
5598 assert(_type == 4)
5599 _length = reader.read("!H")[0]
5600 orig_reader = reader
5601 reader = orig_reader.slice(_length, 4)
5602 obj.xid = reader.read("!L")[0]
5603 _experimenter = reader.read("!L")[0]
5604 assert(_experimenter == 6035143)
5605 _subtype = reader.read("!L")[0]
5606 assert(_subtype == 4)
5607 obj.report_mirror_ports = reader.read("!B")[0]
5608 reader.skip(3)
5609 return obj
5610
5611 def __eq__(self, other):
5612 if type(self) != type(other): return False
5613 if self.xid != other.xid: return False
5614 if self.report_mirror_ports != other.report_mirror_ports: return False
5615 return True
5616
5617 def pretty_print(self, q):
5618 q.text("bsn_get_mirroring_request {")
5619 with q.group():
5620 with q.indent(2):
5621 q.breakable()
5622 q.text("xid = ");
5623 if self.xid != None:
5624 q.text("%#x" % self.xid)
5625 else:
5626 q.text('None')
5627 q.text(","); q.breakable()
5628 q.text("report_mirror_ports = ");
5629 q.text("%#x" % self.report_mirror_ports)
5630 q.breakable()
5631 q.text('}')
5632
5633bsn_header.subtypes[4] = bsn_get_mirroring_request
5634
5635class bsn_get_switch_pipeline_reply(bsn_header):
5636 version = 5
5637 type = 4
5638 experimenter = 6035143
5639 subtype = 52
5640
5641 def __init__(self, xid=None, pipeline=None):
5642 if xid != None:
5643 self.xid = xid
5644 else:
5645 self.xid = None
5646 if pipeline != None:
5647 self.pipeline = pipeline
5648 else:
5649 self.pipeline = ""
5650 return
5651
5652 def pack(self):
5653 packed = []
5654 packed.append(struct.pack("!B", self.version))
5655 packed.append(struct.pack("!B", self.type))
5656 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5657 packed.append(struct.pack("!L", self.xid))
5658 packed.append(struct.pack("!L", self.experimenter))
5659 packed.append(struct.pack("!L", self.subtype))
5660 packed.append(struct.pack("!256s", self.pipeline))
5661 length = sum([len(x) for x in packed])
5662 packed[2] = struct.pack("!H", length)
5663 return ''.join(packed)
5664
5665 @staticmethod
5666 def unpack(reader):
5667 obj = bsn_get_switch_pipeline_reply()
5668 _version = reader.read("!B")[0]
5669 assert(_version == 5)
5670 _type = reader.read("!B")[0]
5671 assert(_type == 4)
5672 _length = reader.read("!H")[0]
5673 orig_reader = reader
5674 reader = orig_reader.slice(_length, 4)
5675 obj.xid = reader.read("!L")[0]
5676 _experimenter = reader.read("!L")[0]
5677 assert(_experimenter == 6035143)
5678 _subtype = reader.read("!L")[0]
5679 assert(_subtype == 52)
5680 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5681 return obj
5682
5683 def __eq__(self, other):
5684 if type(self) != type(other): return False
5685 if self.xid != other.xid: return False
5686 if self.pipeline != other.pipeline: return False
5687 return True
5688
5689 def pretty_print(self, q):
5690 q.text("bsn_get_switch_pipeline_reply {")
5691 with q.group():
5692 with q.indent(2):
5693 q.breakable()
5694 q.text("xid = ");
5695 if self.xid != None:
5696 q.text("%#x" % self.xid)
5697 else:
5698 q.text('None')
5699 q.text(","); q.breakable()
5700 q.text("pipeline = ");
5701 q.pp(self.pipeline)
5702 q.breakable()
5703 q.text('}')
5704
5705bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5706
5707class bsn_get_switch_pipeline_request(bsn_header):
5708 version = 5
5709 type = 4
5710 experimenter = 6035143
5711 subtype = 51
5712
5713 def __init__(self, xid=None):
5714 if xid != None:
5715 self.xid = xid
5716 else:
5717 self.xid = None
5718 return
5719
5720 def pack(self):
5721 packed = []
5722 packed.append(struct.pack("!B", self.version))
5723 packed.append(struct.pack("!B", self.type))
5724 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5725 packed.append(struct.pack("!L", self.xid))
5726 packed.append(struct.pack("!L", self.experimenter))
5727 packed.append(struct.pack("!L", self.subtype))
5728 length = sum([len(x) for x in packed])
5729 packed[2] = struct.pack("!H", length)
5730 return ''.join(packed)
5731
5732 @staticmethod
5733 def unpack(reader):
5734 obj = bsn_get_switch_pipeline_request()
5735 _version = reader.read("!B")[0]
5736 assert(_version == 5)
5737 _type = reader.read("!B")[0]
5738 assert(_type == 4)
5739 _length = reader.read("!H")[0]
5740 orig_reader = reader
5741 reader = orig_reader.slice(_length, 4)
5742 obj.xid = reader.read("!L")[0]
5743 _experimenter = reader.read("!L")[0]
5744 assert(_experimenter == 6035143)
5745 _subtype = reader.read("!L")[0]
5746 assert(_subtype == 51)
5747 return obj
5748
5749 def __eq__(self, other):
5750 if type(self) != type(other): return False
5751 if self.xid != other.xid: return False
5752 return True
5753
5754 def pretty_print(self, q):
5755 q.text("bsn_get_switch_pipeline_request {")
5756 with q.group():
5757 with q.indent(2):
5758 q.breakable()
5759 q.text("xid = ");
5760 if self.xid != None:
5761 q.text("%#x" % self.xid)
5762 else:
5763 q.text('None')
5764 q.breakable()
5765 q.text('}')
5766
5767bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5768
5769class bsn_image_desc_stats_reply(bsn_stats_reply):
5770 version = 5
5771 type = 19
5772 stats_type = 65535
5773 experimenter = 6035143
5774 subtype = 14
5775
5776 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5777 if xid != None:
5778 self.xid = xid
5779 else:
5780 self.xid = None
5781 if flags != None:
5782 self.flags = flags
5783 else:
5784 self.flags = 0
5785 if image_checksum != None:
5786 self.image_checksum = image_checksum
5787 else:
5788 self.image_checksum = ""
5789 if startup_config_checksum != None:
5790 self.startup_config_checksum = startup_config_checksum
5791 else:
5792 self.startup_config_checksum = ""
5793 return
5794
5795 def pack(self):
5796 packed = []
5797 packed.append(struct.pack("!B", self.version))
5798 packed.append(struct.pack("!B", self.type))
5799 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5800 packed.append(struct.pack("!L", self.xid))
5801 packed.append(struct.pack("!H", self.stats_type))
5802 packed.append(struct.pack("!H", self.flags))
5803 packed.append('\x00' * 4)
5804 packed.append(struct.pack("!L", self.experimenter))
5805 packed.append(struct.pack("!L", self.subtype))
5806 packed.append(struct.pack("!256s", self.image_checksum))
5807 packed.append(struct.pack("!256s", self.startup_config_checksum))
5808 length = sum([len(x) for x in packed])
5809 packed[2] = struct.pack("!H", length)
5810 return ''.join(packed)
5811
5812 @staticmethod
5813 def unpack(reader):
5814 obj = bsn_image_desc_stats_reply()
5815 _version = reader.read("!B")[0]
5816 assert(_version == 5)
5817 _type = reader.read("!B")[0]
5818 assert(_type == 19)
5819 _length = reader.read("!H")[0]
5820 orig_reader = reader
5821 reader = orig_reader.slice(_length, 4)
5822 obj.xid = reader.read("!L")[0]
5823 _stats_type = reader.read("!H")[0]
5824 assert(_stats_type == 65535)
5825 obj.flags = reader.read("!H")[0]
5826 reader.skip(4)
5827 _experimenter = reader.read("!L")[0]
5828 assert(_experimenter == 6035143)
5829 _subtype = reader.read("!L")[0]
5830 assert(_subtype == 14)
5831 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5832 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5833 return obj
5834
5835 def __eq__(self, other):
5836 if type(self) != type(other): return False
5837 if self.xid != other.xid: return False
5838 if self.flags != other.flags: return False
5839 if self.image_checksum != other.image_checksum: return False
5840 if self.startup_config_checksum != other.startup_config_checksum: return False
5841 return True
5842
5843 def pretty_print(self, q):
5844 q.text("bsn_image_desc_stats_reply {")
5845 with q.group():
5846 with q.indent(2):
5847 q.breakable()
5848 q.text("xid = ");
5849 if self.xid != None:
5850 q.text("%#x" % self.xid)
5851 else:
5852 q.text('None')
5853 q.text(","); q.breakable()
5854 q.text("flags = ");
5855 q.text("%#x" % self.flags)
5856 q.text(","); q.breakable()
5857 q.text("image_checksum = ");
5858 q.pp(self.image_checksum)
5859 q.text(","); q.breakable()
5860 q.text("startup_config_checksum = ");
5861 q.pp(self.startup_config_checksum)
5862 q.breakable()
5863 q.text('}')
5864
5865bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5866
5867class bsn_image_desc_stats_request(bsn_stats_request):
5868 version = 5
5869 type = 18
5870 stats_type = 65535
5871 experimenter = 6035143
5872 subtype = 14
5873
5874 def __init__(self, xid=None, flags=None):
5875 if xid != None:
5876 self.xid = xid
5877 else:
5878 self.xid = None
5879 if flags != None:
5880 self.flags = flags
5881 else:
5882 self.flags = 0
5883 return
5884
5885 def pack(self):
5886 packed = []
5887 packed.append(struct.pack("!B", self.version))
5888 packed.append(struct.pack("!B", self.type))
5889 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5890 packed.append(struct.pack("!L", self.xid))
5891 packed.append(struct.pack("!H", self.stats_type))
5892 packed.append(struct.pack("!H", self.flags))
5893 packed.append('\x00' * 4)
5894 packed.append(struct.pack("!L", self.experimenter))
5895 packed.append(struct.pack("!L", self.subtype))
5896 length = sum([len(x) for x in packed])
5897 packed[2] = struct.pack("!H", length)
5898 return ''.join(packed)
5899
5900 @staticmethod
5901 def unpack(reader):
5902 obj = bsn_image_desc_stats_request()
5903 _version = reader.read("!B")[0]
5904 assert(_version == 5)
5905 _type = reader.read("!B")[0]
5906 assert(_type == 18)
5907 _length = reader.read("!H")[0]
5908 orig_reader = reader
5909 reader = orig_reader.slice(_length, 4)
5910 obj.xid = reader.read("!L")[0]
5911 _stats_type = reader.read("!H")[0]
5912 assert(_stats_type == 65535)
5913 obj.flags = reader.read("!H")[0]
5914 reader.skip(4)
5915 _experimenter = reader.read("!L")[0]
5916 assert(_experimenter == 6035143)
5917 _subtype = reader.read("!L")[0]
5918 assert(_subtype == 14)
5919 return obj
5920
5921 def __eq__(self, other):
5922 if type(self) != type(other): return False
5923 if self.xid != other.xid: return False
5924 if self.flags != other.flags: return False
5925 return True
5926
5927 def pretty_print(self, q):
5928 q.text("bsn_image_desc_stats_request {")
5929 with q.group():
5930 with q.indent(2):
5931 q.breakable()
5932 q.text("xid = ");
5933 if self.xid != None:
5934 q.text("%#x" % self.xid)
5935 else:
5936 q.text('None')
5937 q.text(","); q.breakable()
5938 q.text("flags = ");
5939 q.text("%#x" % self.flags)
5940 q.breakable()
5941 q.text('}')
5942
5943bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5944
5945class bsn_lacp_convergence_notif(bsn_header):
5946 version = 5
5947 type = 4
5948 experimenter = 6035143
5949 subtype = 43
5950
5951 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):
5952 if xid != None:
5953 self.xid = xid
5954 else:
5955 self.xid = None
5956 if convergence_status != None:
5957 self.convergence_status = convergence_status
5958 else:
5959 self.convergence_status = 0
5960 if port_no != None:
5961 self.port_no = port_no
5962 else:
5963 self.port_no = 0
5964 if actor_sys_priority != None:
5965 self.actor_sys_priority = actor_sys_priority
5966 else:
5967 self.actor_sys_priority = 0
5968 if actor_sys_mac != None:
5969 self.actor_sys_mac = actor_sys_mac
5970 else:
5971 self.actor_sys_mac = [0,0,0,0,0,0]
5972 if actor_port_priority != None:
5973 self.actor_port_priority = actor_port_priority
5974 else:
5975 self.actor_port_priority = 0
5976 if actor_port_num != None:
5977 self.actor_port_num = actor_port_num
5978 else:
5979 self.actor_port_num = 0
5980 if actor_key != None:
5981 self.actor_key = actor_key
5982 else:
5983 self.actor_key = 0
5984 if partner_sys_priority != None:
5985 self.partner_sys_priority = partner_sys_priority
5986 else:
5987 self.partner_sys_priority = 0
5988 if partner_sys_mac != None:
5989 self.partner_sys_mac = partner_sys_mac
5990 else:
5991 self.partner_sys_mac = [0,0,0,0,0,0]
5992 if partner_port_priority != None:
5993 self.partner_port_priority = partner_port_priority
5994 else:
5995 self.partner_port_priority = 0
5996 if partner_port_num != None:
5997 self.partner_port_num = partner_port_num
5998 else:
5999 self.partner_port_num = 0
6000 if partner_key != None:
6001 self.partner_key = partner_key
6002 else:
6003 self.partner_key = 0
6004 return
6005
6006 def pack(self):
6007 packed = []
6008 packed.append(struct.pack("!B", self.version))
6009 packed.append(struct.pack("!B", self.type))
6010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6011 packed.append(struct.pack("!L", self.xid))
6012 packed.append(struct.pack("!L", self.experimenter))
6013 packed.append(struct.pack("!L", self.subtype))
6014 packed.append(struct.pack("!B", self.convergence_status))
6015 packed.append('\x00' * 3)
6016 packed.append(util.pack_port_no(self.port_no))
6017 packed.append(struct.pack("!H", self.actor_sys_priority))
6018 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6019 packed.append(struct.pack("!H", self.actor_port_priority))
6020 packed.append(struct.pack("!H", self.actor_port_num))
6021 packed.append(struct.pack("!H", self.actor_key))
6022 packed.append(struct.pack("!H", self.partner_sys_priority))
6023 packed.append(struct.pack("!6B", *self.partner_sys_mac))
6024 packed.append(struct.pack("!H", self.partner_port_priority))
6025 packed.append(struct.pack("!H", self.partner_port_num))
6026 packed.append(struct.pack("!H", self.partner_key))
6027 length = sum([len(x) for x in packed])
6028 packed[2] = struct.pack("!H", length)
6029 return ''.join(packed)
6030
6031 @staticmethod
6032 def unpack(reader):
6033 obj = bsn_lacp_convergence_notif()
6034 _version = reader.read("!B")[0]
6035 assert(_version == 5)
6036 _type = reader.read("!B")[0]
6037 assert(_type == 4)
6038 _length = reader.read("!H")[0]
6039 orig_reader = reader
6040 reader = orig_reader.slice(_length, 4)
6041 obj.xid = reader.read("!L")[0]
6042 _experimenter = reader.read("!L")[0]
6043 assert(_experimenter == 6035143)
6044 _subtype = reader.read("!L")[0]
6045 assert(_subtype == 43)
6046 obj.convergence_status = reader.read("!B")[0]
6047 reader.skip(3)
6048 obj.port_no = util.unpack_port_no(reader)
6049 obj.actor_sys_priority = reader.read("!H")[0]
6050 obj.actor_sys_mac = list(reader.read('!6B'))
6051 obj.actor_port_priority = reader.read("!H")[0]
6052 obj.actor_port_num = reader.read("!H")[0]
6053 obj.actor_key = reader.read("!H")[0]
6054 obj.partner_sys_priority = reader.read("!H")[0]
6055 obj.partner_sys_mac = list(reader.read('!6B'))
6056 obj.partner_port_priority = reader.read("!H")[0]
6057 obj.partner_port_num = reader.read("!H")[0]
6058 obj.partner_key = reader.read("!H")[0]
6059 return obj
6060
6061 def __eq__(self, other):
6062 if type(self) != type(other): return False
6063 if self.xid != other.xid: return False
6064 if self.convergence_status != other.convergence_status: return False
6065 if self.port_no != other.port_no: return False
6066 if self.actor_sys_priority != other.actor_sys_priority: return False
6067 if self.actor_sys_mac != other.actor_sys_mac: return False
6068 if self.actor_port_priority != other.actor_port_priority: return False
6069 if self.actor_port_num != other.actor_port_num: return False
6070 if self.actor_key != other.actor_key: return False
6071 if self.partner_sys_priority != other.partner_sys_priority: return False
6072 if self.partner_sys_mac != other.partner_sys_mac: return False
6073 if self.partner_port_priority != other.partner_port_priority: return False
6074 if self.partner_port_num != other.partner_port_num: return False
6075 if self.partner_key != other.partner_key: return False
6076 return True
6077
6078 def pretty_print(self, q):
6079 q.text("bsn_lacp_convergence_notif {")
6080 with q.group():
6081 with q.indent(2):
6082 q.breakable()
6083 q.text("xid = ");
6084 if self.xid != None:
6085 q.text("%#x" % self.xid)
6086 else:
6087 q.text('None')
6088 q.text(","); q.breakable()
6089 q.text("convergence_status = ");
6090 q.text("%#x" % self.convergence_status)
6091 q.text(","); q.breakable()
6092 q.text("port_no = ");
6093 q.text(util.pretty_port(self.port_no))
6094 q.text(","); q.breakable()
6095 q.text("actor_sys_priority = ");
6096 q.text("%#x" % self.actor_sys_priority)
6097 q.text(","); q.breakable()
6098 q.text("actor_sys_mac = ");
6099 q.text(util.pretty_mac(self.actor_sys_mac))
6100 q.text(","); q.breakable()
6101 q.text("actor_port_priority = ");
6102 q.text("%#x" % self.actor_port_priority)
6103 q.text(","); q.breakable()
6104 q.text("actor_port_num = ");
6105 q.text("%#x" % self.actor_port_num)
6106 q.text(","); q.breakable()
6107 q.text("actor_key = ");
6108 q.text("%#x" % self.actor_key)
6109 q.text(","); q.breakable()
6110 q.text("partner_sys_priority = ");
6111 q.text("%#x" % self.partner_sys_priority)
6112 q.text(","); q.breakable()
6113 q.text("partner_sys_mac = ");
6114 q.text(util.pretty_mac(self.partner_sys_mac))
6115 q.text(","); q.breakable()
6116 q.text("partner_port_priority = ");
6117 q.text("%#x" % self.partner_port_priority)
6118 q.text(","); q.breakable()
6119 q.text("partner_port_num = ");
6120 q.text("%#x" % self.partner_port_num)
6121 q.text(","); q.breakable()
6122 q.text("partner_key = ");
6123 q.text("%#x" % self.partner_key)
6124 q.breakable()
6125 q.text('}')
6126
6127bsn_header.subtypes[43] = bsn_lacp_convergence_notif
6128
6129class bsn_lacp_stats_reply(bsn_stats_reply):
6130 version = 5
6131 type = 19
6132 stats_type = 65535
6133 experimenter = 6035143
6134 subtype = 1
6135
6136 def __init__(self, xid=None, flags=None, entries=None):
6137 if xid != None:
6138 self.xid = xid
6139 else:
6140 self.xid = None
6141 if flags != None:
6142 self.flags = flags
6143 else:
6144 self.flags = 0
6145 if entries != None:
6146 self.entries = entries
6147 else:
6148 self.entries = []
6149 return
6150
6151 def pack(self):
6152 packed = []
6153 packed.append(struct.pack("!B", self.version))
6154 packed.append(struct.pack("!B", self.type))
6155 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6156 packed.append(struct.pack("!L", self.xid))
6157 packed.append(struct.pack("!H", self.stats_type))
6158 packed.append(struct.pack("!H", self.flags))
6159 packed.append('\x00' * 4)
6160 packed.append(struct.pack("!L", self.experimenter))
6161 packed.append(struct.pack("!L", self.subtype))
6162 packed.append(loxi.generic_util.pack_list(self.entries))
6163 length = sum([len(x) for x in packed])
6164 packed[2] = struct.pack("!H", length)
6165 return ''.join(packed)
6166
6167 @staticmethod
6168 def unpack(reader):
6169 obj = bsn_lacp_stats_reply()
6170 _version = reader.read("!B")[0]
6171 assert(_version == 5)
6172 _type = reader.read("!B")[0]
6173 assert(_type == 19)
6174 _length = reader.read("!H")[0]
6175 orig_reader = reader
6176 reader = orig_reader.slice(_length, 4)
6177 obj.xid = reader.read("!L")[0]
6178 _stats_type = reader.read("!H")[0]
6179 assert(_stats_type == 65535)
6180 obj.flags = reader.read("!H")[0]
6181 reader.skip(4)
6182 _experimenter = reader.read("!L")[0]
6183 assert(_experimenter == 6035143)
6184 _subtype = reader.read("!L")[0]
6185 assert(_subtype == 1)
6186 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
6187 return obj
6188
6189 def __eq__(self, other):
6190 if type(self) != type(other): return False
6191 if self.xid != other.xid: return False
6192 if self.flags != other.flags: return False
6193 if self.entries != other.entries: return False
6194 return True
6195
6196 def pretty_print(self, q):
6197 q.text("bsn_lacp_stats_reply {")
6198 with q.group():
6199 with q.indent(2):
6200 q.breakable()
6201 q.text("xid = ");
6202 if self.xid != None:
6203 q.text("%#x" % self.xid)
6204 else:
6205 q.text('None')
6206 q.text(","); q.breakable()
6207 q.text("flags = ");
6208 q.text("%#x" % self.flags)
6209 q.text(","); q.breakable()
6210 q.text("entries = ");
6211 q.pp(self.entries)
6212 q.breakable()
6213 q.text('}')
6214
6215bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
6216
6217class bsn_lacp_stats_request(bsn_stats_request):
6218 version = 5
6219 type = 18
6220 stats_type = 65535
6221 experimenter = 6035143
6222 subtype = 1
6223
6224 def __init__(self, xid=None, flags=None):
6225 if xid != None:
6226 self.xid = xid
6227 else:
6228 self.xid = None
6229 if flags != None:
6230 self.flags = flags
6231 else:
6232 self.flags = 0
6233 return
6234
6235 def pack(self):
6236 packed = []
6237 packed.append(struct.pack("!B", self.version))
6238 packed.append(struct.pack("!B", self.type))
6239 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6240 packed.append(struct.pack("!L", self.xid))
6241 packed.append(struct.pack("!H", self.stats_type))
6242 packed.append(struct.pack("!H", self.flags))
6243 packed.append('\x00' * 4)
6244 packed.append(struct.pack("!L", self.experimenter))
6245 packed.append(struct.pack("!L", self.subtype))
6246 length = sum([len(x) for x in packed])
6247 packed[2] = struct.pack("!H", length)
6248 return ''.join(packed)
6249
6250 @staticmethod
6251 def unpack(reader):
6252 obj = bsn_lacp_stats_request()
6253 _version = reader.read("!B")[0]
6254 assert(_version == 5)
6255 _type = reader.read("!B")[0]
6256 assert(_type == 18)
6257 _length = reader.read("!H")[0]
6258 orig_reader = reader
6259 reader = orig_reader.slice(_length, 4)
6260 obj.xid = reader.read("!L")[0]
6261 _stats_type = reader.read("!H")[0]
6262 assert(_stats_type == 65535)
6263 obj.flags = reader.read("!H")[0]
6264 reader.skip(4)
6265 _experimenter = reader.read("!L")[0]
6266 assert(_experimenter == 6035143)
6267 _subtype = reader.read("!L")[0]
6268 assert(_subtype == 1)
6269 return obj
6270
6271 def __eq__(self, other):
6272 if type(self) != type(other): return False
6273 if self.xid != other.xid: return False
6274 if self.flags != other.flags: return False
6275 return True
6276
6277 def pretty_print(self, q):
6278 q.text("bsn_lacp_stats_request {")
6279 with q.group():
6280 with q.indent(2):
6281 q.breakable()
6282 q.text("xid = ");
6283 if self.xid != None:
6284 q.text("%#x" % self.xid)
6285 else:
6286 q.text('None')
6287 q.text(","); q.breakable()
6288 q.text("flags = ");
6289 q.text("%#x" % self.flags)
6290 q.breakable()
6291 q.text('}')
6292
6293bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
6294
6295class bsn_log(bsn_header):
6296 version = 5
6297 type = 4
6298 experimenter = 6035143
6299 subtype = 63
6300
6301 def __init__(self, xid=None, loglevel=None, data=None):
6302 if xid != None:
6303 self.xid = xid
6304 else:
6305 self.xid = None
6306 if loglevel != None:
6307 self.loglevel = loglevel
6308 else:
6309 self.loglevel = 0
6310 if data != None:
6311 self.data = data
6312 else:
6313 self.data = ''
6314 return
6315
6316 def pack(self):
6317 packed = []
6318 packed.append(struct.pack("!B", self.version))
6319 packed.append(struct.pack("!B", self.type))
6320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6321 packed.append(struct.pack("!L", self.xid))
6322 packed.append(struct.pack("!L", self.experimenter))
6323 packed.append(struct.pack("!L", self.subtype))
6324 packed.append(struct.pack("!B", self.loglevel))
6325 packed.append(self.data)
6326 length = sum([len(x) for x in packed])
6327 packed[2] = struct.pack("!H", length)
6328 return ''.join(packed)
6329
6330 @staticmethod
6331 def unpack(reader):
6332 obj = bsn_log()
6333 _version = reader.read("!B")[0]
6334 assert(_version == 5)
6335 _type = reader.read("!B")[0]
6336 assert(_type == 4)
6337 _length = reader.read("!H")[0]
6338 orig_reader = reader
6339 reader = orig_reader.slice(_length, 4)
6340 obj.xid = reader.read("!L")[0]
6341 _experimenter = reader.read("!L")[0]
6342 assert(_experimenter == 6035143)
6343 _subtype = reader.read("!L")[0]
6344 assert(_subtype == 63)
6345 obj.loglevel = reader.read("!B")[0]
6346 obj.data = str(reader.read_all())
6347 return obj
6348
6349 def __eq__(self, other):
6350 if type(self) != type(other): return False
6351 if self.xid != other.xid: return False
6352 if self.loglevel != other.loglevel: return False
6353 if self.data != other.data: return False
6354 return True
6355
6356 def pretty_print(self, q):
6357 q.text("bsn_log {")
6358 with q.group():
6359 with q.indent(2):
6360 q.breakable()
6361 q.text("xid = ");
6362 if self.xid != None:
6363 q.text("%#x" % self.xid)
6364 else:
6365 q.text('None')
6366 q.text(","); q.breakable()
6367 q.text("loglevel = ");
6368 q.text("%#x" % self.loglevel)
6369 q.text(","); q.breakable()
6370 q.text("data = ");
6371 q.pp(self.data)
6372 q.breakable()
6373 q.text('}')
6374
6375bsn_header.subtypes[63] = bsn_log
6376
6377class bsn_lua_command_reply(bsn_header):
6378 version = 5
6379 type = 4
6380 experimenter = 6035143
6381 subtype = 66
6382
6383 def __init__(self, xid=None, data=None):
6384 if xid != None:
6385 self.xid = xid
6386 else:
6387 self.xid = None
6388 if data != None:
6389 self.data = data
6390 else:
6391 self.data = ''
6392 return
6393
6394 def pack(self):
6395 packed = []
6396 packed.append(struct.pack("!B", self.version))
6397 packed.append(struct.pack("!B", self.type))
6398 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6399 packed.append(struct.pack("!L", self.xid))
6400 packed.append(struct.pack("!L", self.experimenter))
6401 packed.append(struct.pack("!L", self.subtype))
6402 packed.append(self.data)
6403 length = sum([len(x) for x in packed])
6404 packed[2] = struct.pack("!H", length)
6405 return ''.join(packed)
6406
6407 @staticmethod
6408 def unpack(reader):
6409 obj = bsn_lua_command_reply()
6410 _version = reader.read("!B")[0]
6411 assert(_version == 5)
6412 _type = reader.read("!B")[0]
6413 assert(_type == 4)
6414 _length = reader.read("!H")[0]
6415 orig_reader = reader
6416 reader = orig_reader.slice(_length, 4)
6417 obj.xid = reader.read("!L")[0]
6418 _experimenter = reader.read("!L")[0]
6419 assert(_experimenter == 6035143)
6420 _subtype = reader.read("!L")[0]
6421 assert(_subtype == 66)
6422 obj.data = str(reader.read_all())
6423 return obj
6424
6425 def __eq__(self, other):
6426 if type(self) != type(other): return False
6427 if self.xid != other.xid: return False
6428 if self.data != other.data: return False
6429 return True
6430
6431 def pretty_print(self, q):
6432 q.text("bsn_lua_command_reply {")
6433 with q.group():
6434 with q.indent(2):
6435 q.breakable()
6436 q.text("xid = ");
6437 if self.xid != None:
6438 q.text("%#x" % self.xid)
6439 else:
6440 q.text('None')
6441 q.text(","); q.breakable()
6442 q.text("data = ");
6443 q.pp(self.data)
6444 q.breakable()
6445 q.text('}')
6446
6447bsn_header.subtypes[66] = bsn_lua_command_reply
6448
6449class bsn_lua_command_request(bsn_header):
6450 version = 5
6451 type = 4
6452 experimenter = 6035143
6453 subtype = 65
6454
6455 def __init__(self, xid=None, data=None):
6456 if xid != None:
6457 self.xid = xid
6458 else:
6459 self.xid = None
6460 if data != None:
6461 self.data = data
6462 else:
6463 self.data = ''
6464 return
6465
6466 def pack(self):
6467 packed = []
6468 packed.append(struct.pack("!B", self.version))
6469 packed.append(struct.pack("!B", self.type))
6470 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6471 packed.append(struct.pack("!L", self.xid))
6472 packed.append(struct.pack("!L", self.experimenter))
6473 packed.append(struct.pack("!L", self.subtype))
6474 packed.append(self.data)
6475 length = sum([len(x) for x in packed])
6476 packed[2] = struct.pack("!H", length)
6477 return ''.join(packed)
6478
6479 @staticmethod
6480 def unpack(reader):
6481 obj = bsn_lua_command_request()
6482 _version = reader.read("!B")[0]
6483 assert(_version == 5)
6484 _type = reader.read("!B")[0]
6485 assert(_type == 4)
6486 _length = reader.read("!H")[0]
6487 orig_reader = reader
6488 reader = orig_reader.slice(_length, 4)
6489 obj.xid = reader.read("!L")[0]
6490 _experimenter = reader.read("!L")[0]
6491 assert(_experimenter == 6035143)
6492 _subtype = reader.read("!L")[0]
6493 assert(_subtype == 65)
6494 obj.data = str(reader.read_all())
6495 return obj
6496
6497 def __eq__(self, other):
6498 if type(self) != type(other): return False
6499 if self.xid != other.xid: return False
6500 if self.data != other.data: return False
6501 return True
6502
6503 def pretty_print(self, q):
6504 q.text("bsn_lua_command_request {")
6505 with q.group():
6506 with q.indent(2):
6507 q.breakable()
6508 q.text("xid = ");
6509 if self.xid != None:
6510 q.text("%#x" % self.xid)
6511 else:
6512 q.text('None')
6513 q.text(","); q.breakable()
6514 q.text("data = ");
6515 q.pp(self.data)
6516 q.breakable()
6517 q.text('}')
6518
6519bsn_header.subtypes[65] = bsn_lua_command_request
6520
6521class bsn_lua_notification(bsn_header):
6522 version = 5
6523 type = 4
6524 experimenter = 6035143
6525 subtype = 67
6526
6527 def __init__(self, xid=None, data=None):
6528 if xid != None:
6529 self.xid = xid
6530 else:
6531 self.xid = None
6532 if data != None:
6533 self.data = data
6534 else:
6535 self.data = ''
6536 return
6537
6538 def pack(self):
6539 packed = []
6540 packed.append(struct.pack("!B", self.version))
6541 packed.append(struct.pack("!B", self.type))
6542 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6543 packed.append(struct.pack("!L", self.xid))
6544 packed.append(struct.pack("!L", self.experimenter))
6545 packed.append(struct.pack("!L", self.subtype))
6546 packed.append(self.data)
6547 length = sum([len(x) for x in packed])
6548 packed[2] = struct.pack("!H", length)
6549 return ''.join(packed)
6550
6551 @staticmethod
6552 def unpack(reader):
6553 obj = bsn_lua_notification()
6554 _version = reader.read("!B")[0]
6555 assert(_version == 5)
6556 _type = reader.read("!B")[0]
6557 assert(_type == 4)
6558 _length = reader.read("!H")[0]
6559 orig_reader = reader
6560 reader = orig_reader.slice(_length, 4)
6561 obj.xid = reader.read("!L")[0]
6562 _experimenter = reader.read("!L")[0]
6563 assert(_experimenter == 6035143)
6564 _subtype = reader.read("!L")[0]
6565 assert(_subtype == 67)
6566 obj.data = str(reader.read_all())
6567 return obj
6568
6569 def __eq__(self, other):
6570 if type(self) != type(other): return False
6571 if self.xid != other.xid: return False
6572 if self.data != other.data: return False
6573 return True
6574
6575 def pretty_print(self, q):
6576 q.text("bsn_lua_notification {")
6577 with q.group():
6578 with q.indent(2):
6579 q.breakable()
6580 q.text("xid = ");
6581 if self.xid != None:
6582 q.text("%#x" % self.xid)
6583 else:
6584 q.text('None')
6585 q.text(","); q.breakable()
6586 q.text("data = ");
6587 q.pp(self.data)
6588 q.breakable()
6589 q.text('}')
6590
6591bsn_header.subtypes[67] = bsn_lua_notification
6592
6593class bsn_lua_upload(bsn_header):
6594 version = 5
6595 type = 4
6596 experimenter = 6035143
6597 subtype = 64
6598
6599 def __init__(self, xid=None, flags=None, filename=None, data=None):
6600 if xid != None:
6601 self.xid = xid
6602 else:
6603 self.xid = None
6604 if flags != None:
6605 self.flags = flags
6606 else:
6607 self.flags = 0
6608 if filename != None:
6609 self.filename = filename
6610 else:
6611 self.filename = ""
6612 if data != None:
6613 self.data = data
6614 else:
6615 self.data = ''
6616 return
6617
6618 def pack(self):
6619 packed = []
6620 packed.append(struct.pack("!B", self.version))
6621 packed.append(struct.pack("!B", self.type))
6622 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6623 packed.append(struct.pack("!L", self.xid))
6624 packed.append(struct.pack("!L", self.experimenter))
6625 packed.append(struct.pack("!L", self.subtype))
6626 packed.append(struct.pack("!H", self.flags))
6627 packed.append(struct.pack("!64s", self.filename))
6628 packed.append(self.data)
6629 length = sum([len(x) for x in packed])
6630 packed[2] = struct.pack("!H", length)
6631 return ''.join(packed)
6632
6633 @staticmethod
6634 def unpack(reader):
6635 obj = bsn_lua_upload()
6636 _version = reader.read("!B")[0]
6637 assert(_version == 5)
6638 _type = reader.read("!B")[0]
6639 assert(_type == 4)
6640 _length = reader.read("!H")[0]
6641 orig_reader = reader
6642 reader = orig_reader.slice(_length, 4)
6643 obj.xid = reader.read("!L")[0]
6644 _experimenter = reader.read("!L")[0]
6645 assert(_experimenter == 6035143)
6646 _subtype = reader.read("!L")[0]
6647 assert(_subtype == 64)
6648 obj.flags = reader.read("!H")[0]
6649 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6650 obj.data = str(reader.read_all())
6651 return obj
6652
6653 def __eq__(self, other):
6654 if type(self) != type(other): return False
6655 if self.xid != other.xid: return False
6656 if self.flags != other.flags: return False
6657 if self.filename != other.filename: return False
6658 if self.data != other.data: return False
6659 return True
6660
6661 def pretty_print(self, q):
6662 q.text("bsn_lua_upload {")
6663 with q.group():
6664 with q.indent(2):
6665 q.breakable()
6666 q.text("xid = ");
6667 if self.xid != None:
6668 q.text("%#x" % self.xid)
6669 else:
6670 q.text('None')
6671 q.text(","); q.breakable()
6672 q.text("flags = ");
6673 q.text("%#x" % self.flags)
6674 q.text(","); q.breakable()
6675 q.text("filename = ");
6676 q.pp(self.filename)
6677 q.text(","); q.breakable()
6678 q.text("data = ");
6679 q.pp(self.data)
6680 q.breakable()
6681 q.text('}')
6682
6683bsn_header.subtypes[64] = bsn_lua_upload
6684
6685class bsn_pdu_rx_reply(bsn_header):
6686 version = 5
6687 type = 4
6688 experimenter = 6035143
6689 subtype = 34
6690
6691 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6692 if xid != None:
6693 self.xid = xid
6694 else:
6695 self.xid = None
6696 if status != None:
6697 self.status = status
6698 else:
6699 self.status = 0
6700 if port_no != None:
6701 self.port_no = port_no
6702 else:
6703 self.port_no = 0
6704 if slot_num != None:
6705 self.slot_num = slot_num
6706 else:
6707 self.slot_num = 0
6708 return
6709
6710 def pack(self):
6711 packed = []
6712 packed.append(struct.pack("!B", self.version))
6713 packed.append(struct.pack("!B", self.type))
6714 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6715 packed.append(struct.pack("!L", self.xid))
6716 packed.append(struct.pack("!L", self.experimenter))
6717 packed.append(struct.pack("!L", self.subtype))
6718 packed.append(struct.pack("!L", self.status))
6719 packed.append(util.pack_port_no(self.port_no))
6720 packed.append(struct.pack("!B", self.slot_num))
6721 length = sum([len(x) for x in packed])
6722 packed[2] = struct.pack("!H", length)
6723 return ''.join(packed)
6724
6725 @staticmethod
6726 def unpack(reader):
6727 obj = bsn_pdu_rx_reply()
6728 _version = reader.read("!B")[0]
6729 assert(_version == 5)
6730 _type = reader.read("!B")[0]
6731 assert(_type == 4)
6732 _length = reader.read("!H")[0]
6733 orig_reader = reader
6734 reader = orig_reader.slice(_length, 4)
6735 obj.xid = reader.read("!L")[0]
6736 _experimenter = reader.read("!L")[0]
6737 assert(_experimenter == 6035143)
6738 _subtype = reader.read("!L")[0]
6739 assert(_subtype == 34)
6740 obj.status = reader.read("!L")[0]
6741 obj.port_no = util.unpack_port_no(reader)
6742 obj.slot_num = reader.read("!B")[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.status != other.status: return False
6749 if self.port_no != other.port_no: return False
6750 if self.slot_num != other.slot_num: return False
6751 return True
6752
6753 def pretty_print(self, q):
6754 q.text("bsn_pdu_rx_reply {")
6755 with q.group():
6756 with q.indent(2):
6757 q.breakable()
6758 q.text("xid = ");
6759 if self.xid != None:
6760 q.text("%#x" % self.xid)
6761 else:
6762 q.text('None')
6763 q.text(","); q.breakable()
6764 q.text("status = ");
6765 q.text("%#x" % self.status)
6766 q.text(","); q.breakable()
6767 q.text("port_no = ");
6768 q.text(util.pretty_port(self.port_no))
6769 q.text(","); q.breakable()
6770 q.text("slot_num = ");
6771 q.text("%#x" % self.slot_num)
6772 q.breakable()
6773 q.text('}')
6774
6775bsn_header.subtypes[34] = bsn_pdu_rx_reply
6776
6777class bsn_pdu_rx_request(bsn_header):
6778 version = 5
6779 type = 4
6780 experimenter = 6035143
6781 subtype = 33
6782
6783 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6784 if xid != None:
6785 self.xid = xid
6786 else:
6787 self.xid = None
6788 if timeout_ms != None:
6789 self.timeout_ms = timeout_ms
6790 else:
6791 self.timeout_ms = 0
6792 if port_no != None:
6793 self.port_no = port_no
6794 else:
6795 self.port_no = 0
6796 if slot_num != None:
6797 self.slot_num = slot_num
6798 else:
6799 self.slot_num = 0
6800 if data != None:
6801 self.data = data
6802 else:
6803 self.data = ''
6804 return
6805
6806 def pack(self):
6807 packed = []
6808 packed.append(struct.pack("!B", self.version))
6809 packed.append(struct.pack("!B", self.type))
6810 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6811 packed.append(struct.pack("!L", self.xid))
6812 packed.append(struct.pack("!L", self.experimenter))
6813 packed.append(struct.pack("!L", self.subtype))
6814 packed.append(struct.pack("!L", self.timeout_ms))
6815 packed.append(util.pack_port_no(self.port_no))
6816 packed.append(struct.pack("!B", self.slot_num))
6817 packed.append('\x00' * 3)
6818 packed.append(self.data)
6819 length = sum([len(x) for x in packed])
6820 packed[2] = struct.pack("!H", length)
6821 return ''.join(packed)
6822
6823 @staticmethod
6824 def unpack(reader):
6825 obj = bsn_pdu_rx_request()
6826 _version = reader.read("!B")[0]
6827 assert(_version == 5)
6828 _type = reader.read("!B")[0]
6829 assert(_type == 4)
6830 _length = reader.read("!H")[0]
6831 orig_reader = reader
6832 reader = orig_reader.slice(_length, 4)
6833 obj.xid = reader.read("!L")[0]
6834 _experimenter = reader.read("!L")[0]
6835 assert(_experimenter == 6035143)
6836 _subtype = reader.read("!L")[0]
6837 assert(_subtype == 33)
6838 obj.timeout_ms = reader.read("!L")[0]
6839 obj.port_no = util.unpack_port_no(reader)
6840 obj.slot_num = reader.read("!B")[0]
6841 reader.skip(3)
6842 obj.data = str(reader.read_all())
6843 return obj
6844
6845 def __eq__(self, other):
6846 if type(self) != type(other): return False
6847 if self.xid != other.xid: return False
6848 if self.timeout_ms != other.timeout_ms: return False
6849 if self.port_no != other.port_no: return False
6850 if self.slot_num != other.slot_num: return False
6851 if self.data != other.data: return False
6852 return True
6853
6854 def pretty_print(self, q):
6855 q.text("bsn_pdu_rx_request {")
6856 with q.group():
6857 with q.indent(2):
6858 q.breakable()
6859 q.text("xid = ");
6860 if self.xid != None:
6861 q.text("%#x" % self.xid)
6862 else:
6863 q.text('None')
6864 q.text(","); q.breakable()
6865 q.text("timeout_ms = ");
6866 q.text("%#x" % self.timeout_ms)
6867 q.text(","); q.breakable()
6868 q.text("port_no = ");
6869 q.text(util.pretty_port(self.port_no))
6870 q.text(","); q.breakable()
6871 q.text("slot_num = ");
6872 q.text("%#x" % self.slot_num)
6873 q.text(","); q.breakable()
6874 q.text("data = ");
6875 q.pp(self.data)
6876 q.breakable()
6877 q.text('}')
6878
6879bsn_header.subtypes[33] = bsn_pdu_rx_request
6880
6881class bsn_pdu_rx_timeout(bsn_header):
6882 version = 5
6883 type = 4
6884 experimenter = 6035143
6885 subtype = 35
6886
6887 def __init__(self, xid=None, port_no=None, slot_num=None):
6888 if xid != None:
6889 self.xid = xid
6890 else:
6891 self.xid = None
6892 if port_no != None:
6893 self.port_no = port_no
6894 else:
6895 self.port_no = 0
6896 if slot_num != None:
6897 self.slot_num = slot_num
6898 else:
6899 self.slot_num = 0
6900 return
6901
6902 def pack(self):
6903 packed = []
6904 packed.append(struct.pack("!B", self.version))
6905 packed.append(struct.pack("!B", self.type))
6906 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6907 packed.append(struct.pack("!L", self.xid))
6908 packed.append(struct.pack("!L", self.experimenter))
6909 packed.append(struct.pack("!L", self.subtype))
6910 packed.append(util.pack_port_no(self.port_no))
6911 packed.append(struct.pack("!B", self.slot_num))
6912 length = sum([len(x) for x in packed])
6913 packed[2] = struct.pack("!H", length)
6914 return ''.join(packed)
6915
6916 @staticmethod
6917 def unpack(reader):
6918 obj = bsn_pdu_rx_timeout()
6919 _version = reader.read("!B")[0]
6920 assert(_version == 5)
6921 _type = reader.read("!B")[0]
6922 assert(_type == 4)
6923 _length = reader.read("!H")[0]
6924 orig_reader = reader
6925 reader = orig_reader.slice(_length, 4)
6926 obj.xid = reader.read("!L")[0]
6927 _experimenter = reader.read("!L")[0]
6928 assert(_experimenter == 6035143)
6929 _subtype = reader.read("!L")[0]
6930 assert(_subtype == 35)
6931 obj.port_no = util.unpack_port_no(reader)
6932 obj.slot_num = reader.read("!B")[0]
6933 return obj
6934
6935 def __eq__(self, other):
6936 if type(self) != type(other): return False
6937 if self.xid != other.xid: return False
6938 if self.port_no != other.port_no: return False
6939 if self.slot_num != other.slot_num: return False
6940 return True
6941
6942 def pretty_print(self, q):
6943 q.text("bsn_pdu_rx_timeout {")
6944 with q.group():
6945 with q.indent(2):
6946 q.breakable()
6947 q.text("xid = ");
6948 if self.xid != None:
6949 q.text("%#x" % self.xid)
6950 else:
6951 q.text('None')
6952 q.text(","); q.breakable()
6953 q.text("port_no = ");
6954 q.text(util.pretty_port(self.port_no))
6955 q.text(","); q.breakable()
6956 q.text("slot_num = ");
6957 q.text("%#x" % self.slot_num)
6958 q.breakable()
6959 q.text('}')
6960
6961bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6962
6963class bsn_pdu_tx_reply(bsn_header):
6964 version = 5
6965 type = 4
6966 experimenter = 6035143
6967 subtype = 32
6968
6969 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6970 if xid != None:
6971 self.xid = xid
6972 else:
6973 self.xid = None
6974 if status != None:
6975 self.status = status
6976 else:
6977 self.status = 0
6978 if port_no != None:
6979 self.port_no = port_no
6980 else:
6981 self.port_no = 0
6982 if slot_num != None:
6983 self.slot_num = slot_num
6984 else:
6985 self.slot_num = 0
6986 return
6987
6988 def pack(self):
6989 packed = []
6990 packed.append(struct.pack("!B", self.version))
6991 packed.append(struct.pack("!B", self.type))
6992 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6993 packed.append(struct.pack("!L", self.xid))
6994 packed.append(struct.pack("!L", self.experimenter))
6995 packed.append(struct.pack("!L", self.subtype))
6996 packed.append(struct.pack("!L", self.status))
6997 packed.append(util.pack_port_no(self.port_no))
6998 packed.append(struct.pack("!B", self.slot_num))
6999 length = sum([len(x) for x in packed])
7000 packed[2] = struct.pack("!H", length)
7001 return ''.join(packed)
7002
7003 @staticmethod
7004 def unpack(reader):
7005 obj = bsn_pdu_tx_reply()
7006 _version = reader.read("!B")[0]
7007 assert(_version == 5)
7008 _type = reader.read("!B")[0]
7009 assert(_type == 4)
7010 _length = reader.read("!H")[0]
7011 orig_reader = reader
7012 reader = orig_reader.slice(_length, 4)
7013 obj.xid = reader.read("!L")[0]
7014 _experimenter = reader.read("!L")[0]
7015 assert(_experimenter == 6035143)
7016 _subtype = reader.read("!L")[0]
7017 assert(_subtype == 32)
7018 obj.status = reader.read("!L")[0]
7019 obj.port_no = util.unpack_port_no(reader)
7020 obj.slot_num = reader.read("!B")[0]
7021 return obj
7022
7023 def __eq__(self, other):
7024 if type(self) != type(other): return False
7025 if self.xid != other.xid: return False
7026 if self.status != other.status: return False
7027 if self.port_no != other.port_no: return False
7028 if self.slot_num != other.slot_num: return False
7029 return True
7030
7031 def pretty_print(self, q):
7032 q.text("bsn_pdu_tx_reply {")
7033 with q.group():
7034 with q.indent(2):
7035 q.breakable()
7036 q.text("xid = ");
7037 if self.xid != None:
7038 q.text("%#x" % self.xid)
7039 else:
7040 q.text('None')
7041 q.text(","); q.breakable()
7042 q.text("status = ");
7043 q.text("%#x" % self.status)
7044 q.text(","); q.breakable()
7045 q.text("port_no = ");
7046 q.text(util.pretty_port(self.port_no))
7047 q.text(","); q.breakable()
7048 q.text("slot_num = ");
7049 q.text("%#x" % self.slot_num)
7050 q.breakable()
7051 q.text('}')
7052
7053bsn_header.subtypes[32] = bsn_pdu_tx_reply
7054
7055class bsn_pdu_tx_request(bsn_header):
7056 version = 5
7057 type = 4
7058 experimenter = 6035143
7059 subtype = 31
7060
7061 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
7062 if xid != None:
7063 self.xid = xid
7064 else:
7065 self.xid = None
7066 if tx_interval_ms != None:
7067 self.tx_interval_ms = tx_interval_ms
7068 else:
7069 self.tx_interval_ms = 0
7070 if port_no != None:
7071 self.port_no = port_no
7072 else:
7073 self.port_no = 0
7074 if slot_num != None:
7075 self.slot_num = slot_num
7076 else:
7077 self.slot_num = 0
7078 if data != None:
7079 self.data = data
7080 else:
7081 self.data = ''
7082 return
7083
7084 def pack(self):
7085 packed = []
7086 packed.append(struct.pack("!B", self.version))
7087 packed.append(struct.pack("!B", self.type))
7088 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7089 packed.append(struct.pack("!L", self.xid))
7090 packed.append(struct.pack("!L", self.experimenter))
7091 packed.append(struct.pack("!L", self.subtype))
7092 packed.append(struct.pack("!L", self.tx_interval_ms))
7093 packed.append(util.pack_port_no(self.port_no))
7094 packed.append(struct.pack("!B", self.slot_num))
7095 packed.append('\x00' * 3)
7096 packed.append(self.data)
7097 length = sum([len(x) for x in packed])
7098 packed[2] = struct.pack("!H", length)
7099 return ''.join(packed)
7100
7101 @staticmethod
7102 def unpack(reader):
7103 obj = bsn_pdu_tx_request()
7104 _version = reader.read("!B")[0]
7105 assert(_version == 5)
7106 _type = reader.read("!B")[0]
7107 assert(_type == 4)
7108 _length = reader.read("!H")[0]
7109 orig_reader = reader
7110 reader = orig_reader.slice(_length, 4)
7111 obj.xid = reader.read("!L")[0]
7112 _experimenter = reader.read("!L")[0]
7113 assert(_experimenter == 6035143)
7114 _subtype = reader.read("!L")[0]
7115 assert(_subtype == 31)
7116 obj.tx_interval_ms = reader.read("!L")[0]
7117 obj.port_no = util.unpack_port_no(reader)
7118 obj.slot_num = reader.read("!B")[0]
7119 reader.skip(3)
7120 obj.data = str(reader.read_all())
7121 return obj
7122
7123 def __eq__(self, other):
7124 if type(self) != type(other): return False
7125 if self.xid != other.xid: return False
7126 if self.tx_interval_ms != other.tx_interval_ms: return False
7127 if self.port_no != other.port_no: return False
7128 if self.slot_num != other.slot_num: return False
7129 if self.data != other.data: return False
7130 return True
7131
7132 def pretty_print(self, q):
7133 q.text("bsn_pdu_tx_request {")
7134 with q.group():
7135 with q.indent(2):
7136 q.breakable()
7137 q.text("xid = ");
7138 if self.xid != None:
7139 q.text("%#x" % self.xid)
7140 else:
7141 q.text('None')
7142 q.text(","); q.breakable()
7143 q.text("tx_interval_ms = ");
7144 q.text("%#x" % self.tx_interval_ms)
7145 q.text(","); q.breakable()
7146 q.text("port_no = ");
7147 q.text(util.pretty_port(self.port_no))
7148 q.text(","); q.breakable()
7149 q.text("slot_num = ");
7150 q.text("%#x" % self.slot_num)
7151 q.text(","); q.breakable()
7152 q.text("data = ");
7153 q.pp(self.data)
7154 q.breakable()
7155 q.text('}')
7156
7157bsn_header.subtypes[31] = bsn_pdu_tx_request
7158
7159class bsn_port_counter_stats_reply(bsn_stats_reply):
7160 version = 5
7161 type = 19
7162 stats_type = 65535
7163 experimenter = 6035143
7164 subtype = 8
7165
7166 def __init__(self, xid=None, flags=None, entries=None):
7167 if xid != None:
7168 self.xid = xid
7169 else:
7170 self.xid = None
7171 if flags != None:
7172 self.flags = flags
7173 else:
7174 self.flags = 0
7175 if entries != None:
7176 self.entries = entries
7177 else:
7178 self.entries = []
7179 return
7180
7181 def pack(self):
7182 packed = []
7183 packed.append(struct.pack("!B", self.version))
7184 packed.append(struct.pack("!B", self.type))
7185 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7186 packed.append(struct.pack("!L", self.xid))
7187 packed.append(struct.pack("!H", self.stats_type))
7188 packed.append(struct.pack("!H", self.flags))
7189 packed.append('\x00' * 4)
7190 packed.append(struct.pack("!L", self.experimenter))
7191 packed.append(struct.pack("!L", self.subtype))
7192 packed.append(loxi.generic_util.pack_list(self.entries))
7193 length = sum([len(x) for x in packed])
7194 packed[2] = struct.pack("!H", length)
7195 return ''.join(packed)
7196
7197 @staticmethod
7198 def unpack(reader):
7199 obj = bsn_port_counter_stats_reply()
7200 _version = reader.read("!B")[0]
7201 assert(_version == 5)
7202 _type = reader.read("!B")[0]
7203 assert(_type == 19)
7204 _length = reader.read("!H")[0]
7205 orig_reader = reader
7206 reader = orig_reader.slice(_length, 4)
7207 obj.xid = reader.read("!L")[0]
7208 _stats_type = reader.read("!H")[0]
7209 assert(_stats_type == 65535)
7210 obj.flags = reader.read("!H")[0]
7211 reader.skip(4)
7212 _experimenter = reader.read("!L")[0]
7213 assert(_experimenter == 6035143)
7214 _subtype = reader.read("!L")[0]
7215 assert(_subtype == 8)
7216 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
7217 return obj
7218
7219 def __eq__(self, other):
7220 if type(self) != type(other): return False
7221 if self.xid != other.xid: return False
7222 if self.flags != other.flags: return False
7223 if self.entries != other.entries: return False
7224 return True
7225
7226 def pretty_print(self, q):
7227 q.text("bsn_port_counter_stats_reply {")
7228 with q.group():
7229 with q.indent(2):
7230 q.breakable()
7231 q.text("xid = ");
7232 if self.xid != None:
7233 q.text("%#x" % self.xid)
7234 else:
7235 q.text('None')
7236 q.text(","); q.breakable()
7237 q.text("flags = ");
7238 q.text("%#x" % self.flags)
7239 q.text(","); q.breakable()
7240 q.text("entries = ");
7241 q.pp(self.entries)
7242 q.breakable()
7243 q.text('}')
7244
7245bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
7246
7247class bsn_port_counter_stats_request(bsn_stats_request):
7248 version = 5
7249 type = 18
7250 stats_type = 65535
7251 experimenter = 6035143
7252 subtype = 8
7253
7254 def __init__(self, xid=None, flags=None, port_no=None):
7255 if xid != None:
7256 self.xid = xid
7257 else:
7258 self.xid = None
7259 if flags != None:
7260 self.flags = flags
7261 else:
7262 self.flags = 0
7263 if port_no != None:
7264 self.port_no = port_no
7265 else:
7266 self.port_no = 0
7267 return
7268
7269 def pack(self):
7270 packed = []
7271 packed.append(struct.pack("!B", self.version))
7272 packed.append(struct.pack("!B", self.type))
7273 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7274 packed.append(struct.pack("!L", self.xid))
7275 packed.append(struct.pack("!H", self.stats_type))
7276 packed.append(struct.pack("!H", self.flags))
7277 packed.append('\x00' * 4)
7278 packed.append(struct.pack("!L", self.experimenter))
7279 packed.append(struct.pack("!L", self.subtype))
7280 packed.append(util.pack_port_no(self.port_no))
7281 length = sum([len(x) for x in packed])
7282 packed[2] = struct.pack("!H", length)
7283 return ''.join(packed)
7284
7285 @staticmethod
7286 def unpack(reader):
7287 obj = bsn_port_counter_stats_request()
7288 _version = reader.read("!B")[0]
7289 assert(_version == 5)
7290 _type = reader.read("!B")[0]
7291 assert(_type == 18)
7292 _length = reader.read("!H")[0]
7293 orig_reader = reader
7294 reader = orig_reader.slice(_length, 4)
7295 obj.xid = reader.read("!L")[0]
7296 _stats_type = reader.read("!H")[0]
7297 assert(_stats_type == 65535)
7298 obj.flags = reader.read("!H")[0]
7299 reader.skip(4)
7300 _experimenter = reader.read("!L")[0]
7301 assert(_experimenter == 6035143)
7302 _subtype = reader.read("!L")[0]
7303 assert(_subtype == 8)
7304 obj.port_no = util.unpack_port_no(reader)
7305 return obj
7306
7307 def __eq__(self, other):
7308 if type(self) != type(other): return False
7309 if self.xid != other.xid: return False
7310 if self.flags != other.flags: return False
7311 if self.port_no != other.port_no: return False
7312 return True
7313
7314 def pretty_print(self, q):
7315 q.text("bsn_port_counter_stats_request {")
7316 with q.group():
7317 with q.indent(2):
7318 q.breakable()
7319 q.text("xid = ");
7320 if self.xid != None:
7321 q.text("%#x" % self.xid)
7322 else:
7323 q.text('None')
7324 q.text(","); q.breakable()
7325 q.text("flags = ");
7326 q.text("%#x" % self.flags)
7327 q.text(","); q.breakable()
7328 q.text("port_no = ");
7329 q.text(util.pretty_port(self.port_no))
7330 q.breakable()
7331 q.text('}')
7332
7333bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
7334
7335class bsn_set_aux_cxns_reply(bsn_header):
7336 version = 5
7337 type = 4
7338 experimenter = 6035143
7339 subtype = 59
7340
7341 def __init__(self, xid=None, num_aux=None, status=None):
7342 if xid != None:
7343 self.xid = xid
7344 else:
7345 self.xid = None
7346 if num_aux != None:
7347 self.num_aux = num_aux
7348 else:
7349 self.num_aux = 0
7350 if status != None:
7351 self.status = status
7352 else:
7353 self.status = 0
7354 return
7355
7356 def pack(self):
7357 packed = []
7358 packed.append(struct.pack("!B", self.version))
7359 packed.append(struct.pack("!B", self.type))
7360 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7361 packed.append(struct.pack("!L", self.xid))
7362 packed.append(struct.pack("!L", self.experimenter))
7363 packed.append(struct.pack("!L", self.subtype))
7364 packed.append(struct.pack("!L", self.num_aux))
7365 packed.append(struct.pack("!L", self.status))
7366 length = sum([len(x) for x in packed])
7367 packed[2] = struct.pack("!H", length)
7368 return ''.join(packed)
7369
7370 @staticmethod
7371 def unpack(reader):
7372 obj = bsn_set_aux_cxns_reply()
7373 _version = reader.read("!B")[0]
7374 assert(_version == 5)
7375 _type = reader.read("!B")[0]
7376 assert(_type == 4)
7377 _length = reader.read("!H")[0]
7378 orig_reader = reader
7379 reader = orig_reader.slice(_length, 4)
7380 obj.xid = reader.read("!L")[0]
7381 _experimenter = reader.read("!L")[0]
7382 assert(_experimenter == 6035143)
7383 _subtype = reader.read("!L")[0]
7384 assert(_subtype == 59)
7385 obj.num_aux = reader.read("!L")[0]
7386 obj.status = reader.read("!L")[0]
7387 return obj
7388
7389 def __eq__(self, other):
7390 if type(self) != type(other): return False
7391 if self.xid != other.xid: return False
7392 if self.num_aux != other.num_aux: return False
7393 if self.status != other.status: return False
7394 return True
7395
7396 def pretty_print(self, q):
7397 q.text("bsn_set_aux_cxns_reply {")
7398 with q.group():
7399 with q.indent(2):
7400 q.breakable()
7401 q.text("xid = ");
7402 if self.xid != None:
7403 q.text("%#x" % self.xid)
7404 else:
7405 q.text('None')
7406 q.text(","); q.breakable()
7407 q.text("num_aux = ");
7408 q.text("%#x" % self.num_aux)
7409 q.text(","); q.breakable()
7410 q.text("status = ");
7411 q.text("%#x" % self.status)
7412 q.breakable()
7413 q.text('}')
7414
7415bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7416
7417class bsn_set_aux_cxns_request(bsn_header):
7418 version = 5
7419 type = 4
7420 experimenter = 6035143
7421 subtype = 58
7422
7423 def __init__(self, xid=None, num_aux=None):
7424 if xid != None:
7425 self.xid = xid
7426 else:
7427 self.xid = None
7428 if num_aux != None:
7429 self.num_aux = num_aux
7430 else:
7431 self.num_aux = 0
7432 return
7433
7434 def pack(self):
7435 packed = []
7436 packed.append(struct.pack("!B", self.version))
7437 packed.append(struct.pack("!B", self.type))
7438 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7439 packed.append(struct.pack("!L", self.xid))
7440 packed.append(struct.pack("!L", self.experimenter))
7441 packed.append(struct.pack("!L", self.subtype))
7442 packed.append(struct.pack("!L", self.num_aux))
7443 length = sum([len(x) for x in packed])
7444 packed[2] = struct.pack("!H", length)
7445 return ''.join(packed)
7446
7447 @staticmethod
7448 def unpack(reader):
7449 obj = bsn_set_aux_cxns_request()
7450 _version = reader.read("!B")[0]
7451 assert(_version == 5)
7452 _type = reader.read("!B")[0]
7453 assert(_type == 4)
7454 _length = reader.read("!H")[0]
7455 orig_reader = reader
7456 reader = orig_reader.slice(_length, 4)
7457 obj.xid = reader.read("!L")[0]
7458 _experimenter = reader.read("!L")[0]
7459 assert(_experimenter == 6035143)
7460 _subtype = reader.read("!L")[0]
7461 assert(_subtype == 58)
7462 obj.num_aux = reader.read("!L")[0]
7463 return obj
7464
7465 def __eq__(self, other):
7466 if type(self) != type(other): return False
7467 if self.xid != other.xid: return False
7468 if self.num_aux != other.num_aux: return False
7469 return True
7470
7471 def pretty_print(self, q):
7472 q.text("bsn_set_aux_cxns_request {")
7473 with q.group():
7474 with q.indent(2):
7475 q.breakable()
7476 q.text("xid = ");
7477 if self.xid != None:
7478 q.text("%#x" % self.xid)
7479 else:
7480 q.text('None')
7481 q.text(","); q.breakable()
7482 q.text("num_aux = ");
7483 q.text("%#x" % self.num_aux)
7484 q.breakable()
7485 q.text('}')
7486
7487bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7488
7489class bsn_set_lacp_reply(bsn_header):
7490 version = 5
7491 type = 4
7492 experimenter = 6035143
7493 subtype = 42
7494
7495 def __init__(self, xid=None, status=None, port_no=None):
7496 if xid != None:
7497 self.xid = xid
7498 else:
7499 self.xid = None
7500 if status != None:
7501 self.status = status
7502 else:
7503 self.status = 0
7504 if port_no != None:
7505 self.port_no = port_no
7506 else:
7507 self.port_no = 0
7508 return
7509
7510 def pack(self):
7511 packed = []
7512 packed.append(struct.pack("!B", self.version))
7513 packed.append(struct.pack("!B", self.type))
7514 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7515 packed.append(struct.pack("!L", self.xid))
7516 packed.append(struct.pack("!L", self.experimenter))
7517 packed.append(struct.pack("!L", self.subtype))
7518 packed.append(struct.pack("!L", self.status))
7519 packed.append(util.pack_port_no(self.port_no))
7520 length = sum([len(x) for x in packed])
7521 packed[2] = struct.pack("!H", length)
7522 return ''.join(packed)
7523
7524 @staticmethod
7525 def unpack(reader):
7526 obj = bsn_set_lacp_reply()
7527 _version = reader.read("!B")[0]
7528 assert(_version == 5)
7529 _type = reader.read("!B")[0]
7530 assert(_type == 4)
7531 _length = reader.read("!H")[0]
7532 orig_reader = reader
7533 reader = orig_reader.slice(_length, 4)
7534 obj.xid = reader.read("!L")[0]
7535 _experimenter = reader.read("!L")[0]
7536 assert(_experimenter == 6035143)
7537 _subtype = reader.read("!L")[0]
7538 assert(_subtype == 42)
7539 obj.status = reader.read("!L")[0]
7540 obj.port_no = util.unpack_port_no(reader)
7541 return obj
7542
7543 def __eq__(self, other):
7544 if type(self) != type(other): return False
7545 if self.xid != other.xid: return False
7546 if self.status != other.status: return False
7547 if self.port_no != other.port_no: return False
7548 return True
7549
7550 def pretty_print(self, q):
7551 q.text("bsn_set_lacp_reply {")
7552 with q.group():
7553 with q.indent(2):
7554 q.breakable()
7555 q.text("xid = ");
7556 if self.xid != None:
7557 q.text("%#x" % self.xid)
7558 else:
7559 q.text('None')
7560 q.text(","); q.breakable()
7561 q.text("status = ");
7562 q.text("%#x" % self.status)
7563 q.text(","); q.breakable()
7564 q.text("port_no = ");
7565 q.text(util.pretty_port(self.port_no))
7566 q.breakable()
7567 q.text('}')
7568
7569bsn_header.subtypes[42] = bsn_set_lacp_reply
7570
7571class bsn_set_lacp_request(bsn_header):
7572 version = 5
7573 type = 4
7574 experimenter = 6035143
7575 subtype = 41
7576
7577 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):
7578 if xid != None:
7579 self.xid = xid
7580 else:
7581 self.xid = None
7582 if enabled != None:
7583 self.enabled = enabled
7584 else:
7585 self.enabled = 0
7586 if port_no != None:
7587 self.port_no = port_no
7588 else:
7589 self.port_no = 0
7590 if actor_sys_priority != None:
7591 self.actor_sys_priority = actor_sys_priority
7592 else:
7593 self.actor_sys_priority = 0
7594 if actor_sys_mac != None:
7595 self.actor_sys_mac = actor_sys_mac
7596 else:
7597 self.actor_sys_mac = [0,0,0,0,0,0]
7598 if actor_port_priority != None:
7599 self.actor_port_priority = actor_port_priority
7600 else:
7601 self.actor_port_priority = 0
7602 if actor_port_num != None:
7603 self.actor_port_num = actor_port_num
7604 else:
7605 self.actor_port_num = 0
7606 if actor_key != None:
7607 self.actor_key = actor_key
7608 else:
7609 self.actor_key = 0
7610 return
7611
7612 def pack(self):
7613 packed = []
7614 packed.append(struct.pack("!B", self.version))
7615 packed.append(struct.pack("!B", self.type))
7616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7617 packed.append(struct.pack("!L", self.xid))
7618 packed.append(struct.pack("!L", self.experimenter))
7619 packed.append(struct.pack("!L", self.subtype))
7620 packed.append(struct.pack("!B", self.enabled))
7621 packed.append('\x00' * 3)
7622 packed.append(util.pack_port_no(self.port_no))
7623 packed.append(struct.pack("!H", self.actor_sys_priority))
7624 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7625 packed.append(struct.pack("!H", self.actor_port_priority))
7626 packed.append(struct.pack("!H", self.actor_port_num))
7627 packed.append(struct.pack("!H", self.actor_key))
7628 length = sum([len(x) for x in packed])
7629 packed[2] = struct.pack("!H", length)
7630 return ''.join(packed)
7631
7632 @staticmethod
7633 def unpack(reader):
7634 obj = bsn_set_lacp_request()
7635 _version = reader.read("!B")[0]
7636 assert(_version == 5)
7637 _type = reader.read("!B")[0]
7638 assert(_type == 4)
7639 _length = reader.read("!H")[0]
7640 orig_reader = reader
7641 reader = orig_reader.slice(_length, 4)
7642 obj.xid = reader.read("!L")[0]
7643 _experimenter = reader.read("!L")[0]
7644 assert(_experimenter == 6035143)
7645 _subtype = reader.read("!L")[0]
7646 assert(_subtype == 41)
7647 obj.enabled = reader.read("!B")[0]
7648 reader.skip(3)
7649 obj.port_no = util.unpack_port_no(reader)
7650 obj.actor_sys_priority = reader.read("!H")[0]
7651 obj.actor_sys_mac = list(reader.read('!6B'))
7652 obj.actor_port_priority = reader.read("!H")[0]
7653 obj.actor_port_num = reader.read("!H")[0]
7654 obj.actor_key = reader.read("!H")[0]
7655 return obj
7656
7657 def __eq__(self, other):
7658 if type(self) != type(other): return False
7659 if self.xid != other.xid: return False
7660 if self.enabled != other.enabled: return False
7661 if self.port_no != other.port_no: return False
7662 if self.actor_sys_priority != other.actor_sys_priority: return False
7663 if self.actor_sys_mac != other.actor_sys_mac: return False
7664 if self.actor_port_priority != other.actor_port_priority: return False
7665 if self.actor_port_num != other.actor_port_num: return False
7666 if self.actor_key != other.actor_key: return False
7667 return True
7668
7669 def pretty_print(self, q):
7670 q.text("bsn_set_lacp_request {")
7671 with q.group():
7672 with q.indent(2):
7673 q.breakable()
7674 q.text("xid = ");
7675 if self.xid != None:
7676 q.text("%#x" % self.xid)
7677 else:
7678 q.text('None')
7679 q.text(","); q.breakable()
7680 q.text("enabled = ");
7681 q.text("%#x" % self.enabled)
7682 q.text(","); q.breakable()
7683 q.text("port_no = ");
7684 q.text(util.pretty_port(self.port_no))
7685 q.text(","); q.breakable()
7686 q.text("actor_sys_priority = ");
7687 q.text("%#x" % self.actor_sys_priority)
7688 q.text(","); q.breakable()
7689 q.text("actor_sys_mac = ");
7690 q.text(util.pretty_mac(self.actor_sys_mac))
7691 q.text(","); q.breakable()
7692 q.text("actor_port_priority = ");
7693 q.text("%#x" % self.actor_port_priority)
7694 q.text(","); q.breakable()
7695 q.text("actor_port_num = ");
7696 q.text("%#x" % self.actor_port_num)
7697 q.text(","); q.breakable()
7698 q.text("actor_key = ");
7699 q.text("%#x" % self.actor_key)
7700 q.breakable()
7701 q.text('}')
7702
7703bsn_header.subtypes[41] = bsn_set_lacp_request
7704
7705class bsn_set_mirroring(bsn_header):
7706 version = 5
7707 type = 4
7708 experimenter = 6035143
7709 subtype = 3
7710
7711 def __init__(self, xid=None, report_mirror_ports=None):
7712 if xid != None:
7713 self.xid = xid
7714 else:
7715 self.xid = None
7716 if report_mirror_ports != None:
7717 self.report_mirror_ports = report_mirror_ports
7718 else:
7719 self.report_mirror_ports = 0
7720 return
7721
7722 def pack(self):
7723 packed = []
7724 packed.append(struct.pack("!B", self.version))
7725 packed.append(struct.pack("!B", self.type))
7726 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7727 packed.append(struct.pack("!L", self.xid))
7728 packed.append(struct.pack("!L", self.experimenter))
7729 packed.append(struct.pack("!L", self.subtype))
7730 packed.append(struct.pack("!B", self.report_mirror_ports))
7731 packed.append('\x00' * 3)
7732 length = sum([len(x) for x in packed])
7733 packed[2] = struct.pack("!H", length)
7734 return ''.join(packed)
7735
7736 @staticmethod
7737 def unpack(reader):
7738 obj = bsn_set_mirroring()
7739 _version = reader.read("!B")[0]
7740 assert(_version == 5)
7741 _type = reader.read("!B")[0]
7742 assert(_type == 4)
7743 _length = reader.read("!H")[0]
7744 orig_reader = reader
7745 reader = orig_reader.slice(_length, 4)
7746 obj.xid = reader.read("!L")[0]
7747 _experimenter = reader.read("!L")[0]
7748 assert(_experimenter == 6035143)
7749 _subtype = reader.read("!L")[0]
7750 assert(_subtype == 3)
7751 obj.report_mirror_ports = reader.read("!B")[0]
7752 reader.skip(3)
7753 return obj
7754
7755 def __eq__(self, other):
7756 if type(self) != type(other): return False
7757 if self.xid != other.xid: return False
7758 if self.report_mirror_ports != other.report_mirror_ports: return False
7759 return True
7760
7761 def pretty_print(self, q):
7762 q.text("bsn_set_mirroring {")
7763 with q.group():
7764 with q.indent(2):
7765 q.breakable()
7766 q.text("xid = ");
7767 if self.xid != None:
7768 q.text("%#x" % self.xid)
7769 else:
7770 q.text('None')
7771 q.text(","); q.breakable()
7772 q.text("report_mirror_ports = ");
7773 q.text("%#x" % self.report_mirror_ports)
7774 q.breakable()
7775 q.text('}')
7776
7777bsn_header.subtypes[3] = bsn_set_mirroring
7778
7779class bsn_set_pktin_suppression_reply(bsn_header):
7780 version = 5
7781 type = 4
7782 experimenter = 6035143
7783 subtype = 25
7784
7785 def __init__(self, xid=None, status=None):
7786 if xid != None:
7787 self.xid = xid
7788 else:
7789 self.xid = None
7790 if status != None:
7791 self.status = status
7792 else:
7793 self.status = 0
7794 return
7795
7796 def pack(self):
7797 packed = []
7798 packed.append(struct.pack("!B", self.version))
7799 packed.append(struct.pack("!B", self.type))
7800 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7801 packed.append(struct.pack("!L", self.xid))
7802 packed.append(struct.pack("!L", self.experimenter))
7803 packed.append(struct.pack("!L", self.subtype))
7804 packed.append(struct.pack("!L", self.status))
7805 length = sum([len(x) for x in packed])
7806 packed[2] = struct.pack("!H", length)
7807 return ''.join(packed)
7808
7809 @staticmethod
7810 def unpack(reader):
7811 obj = bsn_set_pktin_suppression_reply()
7812 _version = reader.read("!B")[0]
7813 assert(_version == 5)
7814 _type = reader.read("!B")[0]
7815 assert(_type == 4)
7816 _length = reader.read("!H")[0]
7817 orig_reader = reader
7818 reader = orig_reader.slice(_length, 4)
7819 obj.xid = reader.read("!L")[0]
7820 _experimenter = reader.read("!L")[0]
7821 assert(_experimenter == 6035143)
7822 _subtype = reader.read("!L")[0]
7823 assert(_subtype == 25)
7824 obj.status = reader.read("!L")[0]
7825 return obj
7826
7827 def __eq__(self, other):
7828 if type(self) != type(other): return False
7829 if self.xid != other.xid: return False
7830 if self.status != other.status: return False
7831 return True
7832
7833 def pretty_print(self, q):
7834 q.text("bsn_set_pktin_suppression_reply {")
7835 with q.group():
7836 with q.indent(2):
7837 q.breakable()
7838 q.text("xid = ");
7839 if self.xid != None:
7840 q.text("%#x" % self.xid)
7841 else:
7842 q.text('None')
7843 q.text(","); q.breakable()
7844 q.text("status = ");
7845 q.text("%#x" % self.status)
7846 q.breakable()
7847 q.text('}')
7848
7849bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7850
7851class bsn_set_pktin_suppression_request(bsn_header):
7852 version = 5
7853 type = 4
7854 experimenter = 6035143
7855 subtype = 11
7856
7857 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7858 if xid != None:
7859 self.xid = xid
7860 else:
7861 self.xid = None
7862 if enabled != None:
7863 self.enabled = enabled
7864 else:
7865 self.enabled = 0
7866 if idle_timeout != None:
7867 self.idle_timeout = idle_timeout
7868 else:
7869 self.idle_timeout = 0
7870 if hard_timeout != None:
7871 self.hard_timeout = hard_timeout
7872 else:
7873 self.hard_timeout = 0
7874 if priority != None:
7875 self.priority = priority
7876 else:
7877 self.priority = 0
7878 if cookie != None:
7879 self.cookie = cookie
7880 else:
7881 self.cookie = 0
7882 return
7883
7884 def pack(self):
7885 packed = []
7886 packed.append(struct.pack("!B", self.version))
7887 packed.append(struct.pack("!B", self.type))
7888 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7889 packed.append(struct.pack("!L", self.xid))
7890 packed.append(struct.pack("!L", self.experimenter))
7891 packed.append(struct.pack("!L", self.subtype))
7892 packed.append(struct.pack("!B", self.enabled))
7893 packed.append('\x00' * 1)
7894 packed.append(struct.pack("!H", self.idle_timeout))
7895 packed.append(struct.pack("!H", self.hard_timeout))
7896 packed.append(struct.pack("!H", self.priority))
7897 packed.append(struct.pack("!Q", self.cookie))
7898 length = sum([len(x) for x in packed])
7899 packed[2] = struct.pack("!H", length)
7900 return ''.join(packed)
7901
7902 @staticmethod
7903 def unpack(reader):
7904 obj = bsn_set_pktin_suppression_request()
7905 _version = reader.read("!B")[0]
7906 assert(_version == 5)
7907 _type = reader.read("!B")[0]
7908 assert(_type == 4)
7909 _length = reader.read("!H")[0]
7910 orig_reader = reader
7911 reader = orig_reader.slice(_length, 4)
7912 obj.xid = reader.read("!L")[0]
7913 _experimenter = reader.read("!L")[0]
7914 assert(_experimenter == 6035143)
7915 _subtype = reader.read("!L")[0]
7916 assert(_subtype == 11)
7917 obj.enabled = reader.read("!B")[0]
7918 reader.skip(1)
7919 obj.idle_timeout = reader.read("!H")[0]
7920 obj.hard_timeout = reader.read("!H")[0]
7921 obj.priority = reader.read("!H")[0]
7922 obj.cookie = reader.read("!Q")[0]
7923 return obj
7924
7925 def __eq__(self, other):
7926 if type(self) != type(other): return False
7927 if self.xid != other.xid: return False
7928 if self.enabled != other.enabled: return False
7929 if self.idle_timeout != other.idle_timeout: return False
7930 if self.hard_timeout != other.hard_timeout: return False
7931 if self.priority != other.priority: return False
7932 if self.cookie != other.cookie: return False
7933 return True
7934
7935 def pretty_print(self, q):
7936 q.text("bsn_set_pktin_suppression_request {")
7937 with q.group():
7938 with q.indent(2):
7939 q.breakable()
7940 q.text("xid = ");
7941 if self.xid != None:
7942 q.text("%#x" % self.xid)
7943 else:
7944 q.text('None')
7945 q.text(","); q.breakable()
7946 q.text("enabled = ");
7947 q.text("%#x" % self.enabled)
7948 q.text(","); q.breakable()
7949 q.text("idle_timeout = ");
7950 q.text("%#x" % self.idle_timeout)
7951 q.text(","); q.breakable()
7952 q.text("hard_timeout = ");
7953 q.text("%#x" % self.hard_timeout)
7954 q.text(","); q.breakable()
7955 q.text("priority = ");
7956 q.text("%#x" % self.priority)
7957 q.text(","); q.breakable()
7958 q.text("cookie = ");
7959 q.text("%#x" % self.cookie)
7960 q.breakable()
7961 q.text('}')
7962
7963bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7964
7965class bsn_set_switch_pipeline_reply(bsn_header):
7966 version = 5
7967 type = 4
7968 experimenter = 6035143
7969 subtype = 54
7970
7971 def __init__(self, xid=None, status=None):
7972 if xid != None:
7973 self.xid = xid
7974 else:
7975 self.xid = None
7976 if status != None:
7977 self.status = status
7978 else:
7979 self.status = 0
7980 return
7981
7982 def pack(self):
7983 packed = []
7984 packed.append(struct.pack("!B", self.version))
7985 packed.append(struct.pack("!B", self.type))
7986 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7987 packed.append(struct.pack("!L", self.xid))
7988 packed.append(struct.pack("!L", self.experimenter))
7989 packed.append(struct.pack("!L", self.subtype))
7990 packed.append(struct.pack("!L", self.status))
7991 length = sum([len(x) for x in packed])
7992 packed[2] = struct.pack("!H", length)
7993 return ''.join(packed)
7994
7995 @staticmethod
7996 def unpack(reader):
7997 obj = bsn_set_switch_pipeline_reply()
7998 _version = reader.read("!B")[0]
7999 assert(_version == 5)
8000 _type = reader.read("!B")[0]
8001 assert(_type == 4)
8002 _length = reader.read("!H")[0]
8003 orig_reader = reader
8004 reader = orig_reader.slice(_length, 4)
8005 obj.xid = reader.read("!L")[0]
8006 _experimenter = reader.read("!L")[0]
8007 assert(_experimenter == 6035143)
8008 _subtype = reader.read("!L")[0]
8009 assert(_subtype == 54)
8010 obj.status = reader.read("!L")[0]
8011 return obj
8012
8013 def __eq__(self, other):
8014 if type(self) != type(other): return False
8015 if self.xid != other.xid: return False
8016 if self.status != other.status: return False
8017 return True
8018
8019 def pretty_print(self, q):
8020 q.text("bsn_set_switch_pipeline_reply {")
8021 with q.group():
8022 with q.indent(2):
8023 q.breakable()
8024 q.text("xid = ");
8025 if self.xid != None:
8026 q.text("%#x" % self.xid)
8027 else:
8028 q.text('None')
8029 q.text(","); q.breakable()
8030 q.text("status = ");
8031 q.text("%#x" % self.status)
8032 q.breakable()
8033 q.text('}')
8034
8035bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
8036
8037class bsn_set_switch_pipeline_request(bsn_header):
8038 version = 5
8039 type = 4
8040 experimenter = 6035143
8041 subtype = 53
8042
8043 def __init__(self, xid=None, pipeline=None):
8044 if xid != None:
8045 self.xid = xid
8046 else:
8047 self.xid = None
8048 if pipeline != None:
8049 self.pipeline = pipeline
8050 else:
8051 self.pipeline = ""
8052 return
8053
8054 def pack(self):
8055 packed = []
8056 packed.append(struct.pack("!B", self.version))
8057 packed.append(struct.pack("!B", self.type))
8058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8059 packed.append(struct.pack("!L", self.xid))
8060 packed.append(struct.pack("!L", self.experimenter))
8061 packed.append(struct.pack("!L", self.subtype))
8062 packed.append(struct.pack("!256s", self.pipeline))
8063 length = sum([len(x) for x in packed])
8064 packed[2] = struct.pack("!H", length)
8065 return ''.join(packed)
8066
8067 @staticmethod
8068 def unpack(reader):
8069 obj = bsn_set_switch_pipeline_request()
8070 _version = reader.read("!B")[0]
8071 assert(_version == 5)
8072 _type = reader.read("!B")[0]
8073 assert(_type == 4)
8074 _length = reader.read("!H")[0]
8075 orig_reader = reader
8076 reader = orig_reader.slice(_length, 4)
8077 obj.xid = reader.read("!L")[0]
8078 _experimenter = reader.read("!L")[0]
8079 assert(_experimenter == 6035143)
8080 _subtype = reader.read("!L")[0]
8081 assert(_subtype == 53)
8082 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
8083 return obj
8084
8085 def __eq__(self, other):
8086 if type(self) != type(other): return False
8087 if self.xid != other.xid: return False
8088 if self.pipeline != other.pipeline: return False
8089 return True
8090
8091 def pretty_print(self, q):
8092 q.text("bsn_set_switch_pipeline_request {")
8093 with q.group():
8094 with q.indent(2):
8095 q.breakable()
8096 q.text("xid = ");
8097 if self.xid != None:
8098 q.text("%#x" % self.xid)
8099 else:
8100 q.text('None')
8101 q.text(","); q.breakable()
8102 q.text("pipeline = ");
8103 q.pp(self.pipeline)
8104 q.breakable()
8105 q.text('}')
8106
8107bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
8108
8109class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
8110 version = 5
8111 type = 19
8112 stats_type = 65535
8113 experimenter = 6035143
8114 subtype = 6
8115
8116 def __init__(self, xid=None, flags=None, entries=None):
8117 if xid != None:
8118 self.xid = xid
8119 else:
8120 self.xid = None
8121 if flags != None:
8122 self.flags = flags
8123 else:
8124 self.flags = 0
8125 if entries != None:
8126 self.entries = entries
8127 else:
8128 self.entries = []
8129 return
8130
8131 def pack(self):
8132 packed = []
8133 packed.append(struct.pack("!B", self.version))
8134 packed.append(struct.pack("!B", self.type))
8135 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8136 packed.append(struct.pack("!L", self.xid))
8137 packed.append(struct.pack("!H", self.stats_type))
8138 packed.append(struct.pack("!H", self.flags))
8139 packed.append('\x00' * 4)
8140 packed.append(struct.pack("!L", self.experimenter))
8141 packed.append(struct.pack("!L", self.subtype))
8142 packed.append(loxi.generic_util.pack_list(self.entries))
8143 length = sum([len(x) for x in packed])
8144 packed[2] = struct.pack("!H", length)
8145 return ''.join(packed)
8146
8147 @staticmethod
8148 def unpack(reader):
8149 obj = bsn_switch_pipeline_stats_reply()
8150 _version = reader.read("!B")[0]
8151 assert(_version == 5)
8152 _type = reader.read("!B")[0]
8153 assert(_type == 19)
8154 _length = reader.read("!H")[0]
8155 orig_reader = reader
8156 reader = orig_reader.slice(_length, 4)
8157 obj.xid = reader.read("!L")[0]
8158 _stats_type = reader.read("!H")[0]
8159 assert(_stats_type == 65535)
8160 obj.flags = reader.read("!H")[0]
8161 reader.skip(4)
8162 _experimenter = reader.read("!L")[0]
8163 assert(_experimenter == 6035143)
8164 _subtype = reader.read("!L")[0]
8165 assert(_subtype == 6)
8166 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
8167 return obj
8168
8169 def __eq__(self, other):
8170 if type(self) != type(other): return False
8171 if self.xid != other.xid: return False
8172 if self.flags != other.flags: return False
8173 if self.entries != other.entries: return False
8174 return True
8175
8176 def pretty_print(self, q):
8177 q.text("bsn_switch_pipeline_stats_reply {")
8178 with q.group():
8179 with q.indent(2):
8180 q.breakable()
8181 q.text("xid = ");
8182 if self.xid != None:
8183 q.text("%#x" % self.xid)
8184 else:
8185 q.text('None')
8186 q.text(","); q.breakable()
8187 q.text("flags = ");
8188 q.text("%#x" % self.flags)
8189 q.text(","); q.breakable()
8190 q.text("entries = ");
8191 q.pp(self.entries)
8192 q.breakable()
8193 q.text('}')
8194
8195bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
8196
8197class bsn_switch_pipeline_stats_request(bsn_stats_request):
8198 version = 5
8199 type = 18
8200 stats_type = 65535
8201 experimenter = 6035143
8202 subtype = 6
8203
8204 def __init__(self, xid=None, flags=None):
8205 if xid != None:
8206 self.xid = xid
8207 else:
8208 self.xid = None
8209 if flags != None:
8210 self.flags = flags
8211 else:
8212 self.flags = 0
8213 return
8214
8215 def pack(self):
8216 packed = []
8217 packed.append(struct.pack("!B", self.version))
8218 packed.append(struct.pack("!B", self.type))
8219 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8220 packed.append(struct.pack("!L", self.xid))
8221 packed.append(struct.pack("!H", self.stats_type))
8222 packed.append(struct.pack("!H", self.flags))
8223 packed.append('\x00' * 4)
8224 packed.append(struct.pack("!L", self.experimenter))
8225 packed.append(struct.pack("!L", self.subtype))
8226 length = sum([len(x) for x in packed])
8227 packed[2] = struct.pack("!H", length)
8228 return ''.join(packed)
8229
8230 @staticmethod
8231 def unpack(reader):
8232 obj = bsn_switch_pipeline_stats_request()
8233 _version = reader.read("!B")[0]
8234 assert(_version == 5)
8235 _type = reader.read("!B")[0]
8236 assert(_type == 18)
8237 _length = reader.read("!H")[0]
8238 orig_reader = reader
8239 reader = orig_reader.slice(_length, 4)
8240 obj.xid = reader.read("!L")[0]
8241 _stats_type = reader.read("!H")[0]
8242 assert(_stats_type == 65535)
8243 obj.flags = reader.read("!H")[0]
8244 reader.skip(4)
8245 _experimenter = reader.read("!L")[0]
8246 assert(_experimenter == 6035143)
8247 _subtype = reader.read("!L")[0]
8248 assert(_subtype == 6)
8249 return obj
8250
8251 def __eq__(self, other):
8252 if type(self) != type(other): return False
8253 if self.xid != other.xid: return False
8254 if self.flags != other.flags: return False
8255 return True
8256
8257 def pretty_print(self, q):
8258 q.text("bsn_switch_pipeline_stats_request {")
8259 with q.group():
8260 with q.indent(2):
8261 q.breakable()
8262 q.text("xid = ");
8263 if self.xid != None:
8264 q.text("%#x" % self.xid)
8265 else:
8266 q.text('None')
8267 q.text(","); q.breakable()
8268 q.text("flags = ");
8269 q.text("%#x" % self.flags)
8270 q.breakable()
8271 q.text('}')
8272
8273bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
8274
8275class bsn_table_checksum_stats_reply(bsn_stats_reply):
8276 version = 5
8277 type = 19
8278 stats_type = 65535
8279 experimenter = 6035143
8280 subtype = 11
8281
8282 def __init__(self, xid=None, flags=None, entries=None):
8283 if xid != None:
8284 self.xid = xid
8285 else:
8286 self.xid = None
8287 if flags != None:
8288 self.flags = flags
8289 else:
8290 self.flags = 0
8291 if entries != None:
8292 self.entries = entries
8293 else:
8294 self.entries = []
8295 return
8296
8297 def pack(self):
8298 packed = []
8299 packed.append(struct.pack("!B", self.version))
8300 packed.append(struct.pack("!B", self.type))
8301 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8302 packed.append(struct.pack("!L", self.xid))
8303 packed.append(struct.pack("!H", self.stats_type))
8304 packed.append(struct.pack("!H", self.flags))
8305 packed.append('\x00' * 4)
8306 packed.append(struct.pack("!L", self.experimenter))
8307 packed.append(struct.pack("!L", self.subtype))
8308 packed.append(loxi.generic_util.pack_list(self.entries))
8309 length = sum([len(x) for x in packed])
8310 packed[2] = struct.pack("!H", length)
8311 return ''.join(packed)
8312
8313 @staticmethod
8314 def unpack(reader):
8315 obj = bsn_table_checksum_stats_reply()
8316 _version = reader.read("!B")[0]
8317 assert(_version == 5)
8318 _type = reader.read("!B")[0]
8319 assert(_type == 19)
8320 _length = reader.read("!H")[0]
8321 orig_reader = reader
8322 reader = orig_reader.slice(_length, 4)
8323 obj.xid = reader.read("!L")[0]
8324 _stats_type = reader.read("!H")[0]
8325 assert(_stats_type == 65535)
8326 obj.flags = reader.read("!H")[0]
8327 reader.skip(4)
8328 _experimenter = reader.read("!L")[0]
8329 assert(_experimenter == 6035143)
8330 _subtype = reader.read("!L")[0]
8331 assert(_subtype == 11)
8332 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
8333 return obj
8334
8335 def __eq__(self, other):
8336 if type(self) != type(other): return False
8337 if self.xid != other.xid: return False
8338 if self.flags != other.flags: return False
8339 if self.entries != other.entries: return False
8340 return True
8341
8342 def pretty_print(self, q):
8343 q.text("bsn_table_checksum_stats_reply {")
8344 with q.group():
8345 with q.indent(2):
8346 q.breakable()
8347 q.text("xid = ");
8348 if self.xid != None:
8349 q.text("%#x" % self.xid)
8350 else:
8351 q.text('None')
8352 q.text(","); q.breakable()
8353 q.text("flags = ");
8354 q.text("%#x" % self.flags)
8355 q.text(","); q.breakable()
8356 q.text("entries = ");
8357 q.pp(self.entries)
8358 q.breakable()
8359 q.text('}')
8360
8361bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8362
8363class bsn_table_checksum_stats_request(bsn_stats_request):
8364 version = 5
8365 type = 18
8366 stats_type = 65535
8367 experimenter = 6035143
8368 subtype = 11
8369
8370 def __init__(self, xid=None, flags=None):
8371 if xid != None:
8372 self.xid = xid
8373 else:
8374 self.xid = None
8375 if flags != None:
8376 self.flags = flags
8377 else:
8378 self.flags = 0
8379 return
8380
8381 def pack(self):
8382 packed = []
8383 packed.append(struct.pack("!B", self.version))
8384 packed.append(struct.pack("!B", self.type))
8385 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8386 packed.append(struct.pack("!L", self.xid))
8387 packed.append(struct.pack("!H", self.stats_type))
8388 packed.append(struct.pack("!H", self.flags))
8389 packed.append('\x00' * 4)
8390 packed.append(struct.pack("!L", self.experimenter))
8391 packed.append(struct.pack("!L", self.subtype))
8392 length = sum([len(x) for x in packed])
8393 packed[2] = struct.pack("!H", length)
8394 return ''.join(packed)
8395
8396 @staticmethod
8397 def unpack(reader):
8398 obj = bsn_table_checksum_stats_request()
8399 _version = reader.read("!B")[0]
8400 assert(_version == 5)
8401 _type = reader.read("!B")[0]
8402 assert(_type == 18)
8403 _length = reader.read("!H")[0]
8404 orig_reader = reader
8405 reader = orig_reader.slice(_length, 4)
8406 obj.xid = reader.read("!L")[0]
8407 _stats_type = reader.read("!H")[0]
8408 assert(_stats_type == 65535)
8409 obj.flags = reader.read("!H")[0]
8410 reader.skip(4)
8411 _experimenter = reader.read("!L")[0]
8412 assert(_experimenter == 6035143)
8413 _subtype = reader.read("!L")[0]
8414 assert(_subtype == 11)
8415 return obj
8416
8417 def __eq__(self, other):
8418 if type(self) != type(other): return False
8419 if self.xid != other.xid: return False
8420 if self.flags != other.flags: return False
8421 return True
8422
8423 def pretty_print(self, q):
8424 q.text("bsn_table_checksum_stats_request {")
8425 with q.group():
8426 with q.indent(2):
8427 q.breakable()
8428 q.text("xid = ");
8429 if self.xid != None:
8430 q.text("%#x" % self.xid)
8431 else:
8432 q.text('None')
8433 q.text(","); q.breakable()
8434 q.text("flags = ");
8435 q.text("%#x" % self.flags)
8436 q.breakable()
8437 q.text('}')
8438
8439bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8440
8441class bsn_table_set_buckets_size(bsn_header):
8442 version = 5
8443 type = 4
8444 experimenter = 6035143
8445 subtype = 61
8446
8447 def __init__(self, xid=None, table_id=None, buckets_size=None):
8448 if xid != None:
8449 self.xid = xid
8450 else:
8451 self.xid = None
8452 if table_id != None:
8453 self.table_id = table_id
8454 else:
8455 self.table_id = 0
8456 if buckets_size != None:
8457 self.buckets_size = buckets_size
8458 else:
8459 self.buckets_size = 0
8460 return
8461
8462 def pack(self):
8463 packed = []
8464 packed.append(struct.pack("!B", self.version))
8465 packed.append(struct.pack("!B", self.type))
8466 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8467 packed.append(struct.pack("!L", self.xid))
8468 packed.append(struct.pack("!L", self.experimenter))
8469 packed.append(struct.pack("!L", self.subtype))
8470 packed.append('\x00' * 1)
8471 packed.append(struct.pack("!B", self.table_id))
8472 packed.append('\x00' * 2)
8473 packed.append(struct.pack("!L", self.buckets_size))
8474 length = sum([len(x) for x in packed])
8475 packed[2] = struct.pack("!H", length)
8476 return ''.join(packed)
8477
8478 @staticmethod
8479 def unpack(reader):
8480 obj = bsn_table_set_buckets_size()
8481 _version = reader.read("!B")[0]
8482 assert(_version == 5)
8483 _type = reader.read("!B")[0]
8484 assert(_type == 4)
8485 _length = reader.read("!H")[0]
8486 orig_reader = reader
8487 reader = orig_reader.slice(_length, 4)
8488 obj.xid = reader.read("!L")[0]
8489 _experimenter = reader.read("!L")[0]
8490 assert(_experimenter == 6035143)
8491 _subtype = reader.read("!L")[0]
8492 assert(_subtype == 61)
8493 reader.skip(1)
8494 obj.table_id = reader.read("!B")[0]
8495 reader.skip(2)
8496 obj.buckets_size = reader.read("!L")[0]
8497 return obj
8498
8499 def __eq__(self, other):
8500 if type(self) != type(other): return False
8501 if self.xid != other.xid: return False
8502 if self.table_id != other.table_id: return False
8503 if self.buckets_size != other.buckets_size: return False
8504 return True
8505
8506 def pretty_print(self, q):
8507 q.text("bsn_table_set_buckets_size {")
8508 with q.group():
8509 with q.indent(2):
8510 q.breakable()
8511 q.text("xid = ");
8512 if self.xid != None:
8513 q.text("%#x" % self.xid)
8514 else:
8515 q.text('None')
8516 q.text(","); q.breakable()
8517 q.text("table_id = ");
8518 q.text("%#x" % self.table_id)
8519 q.text(","); q.breakable()
8520 q.text("buckets_size = ");
8521 q.text("%#x" % self.buckets_size)
8522 q.breakable()
8523 q.text('}')
8524
8525bsn_header.subtypes[61] = bsn_table_set_buckets_size
8526
8527class bsn_takeover(bsn_header):
8528 version = 5
8529 type = 4
8530 experimenter = 6035143
8531 subtype = 69
8532
8533 def __init__(self, xid=None):
8534 if xid != None:
8535 self.xid = xid
8536 else:
8537 self.xid = None
8538 return
8539
8540 def pack(self):
8541 packed = []
8542 packed.append(struct.pack("!B", self.version))
8543 packed.append(struct.pack("!B", self.type))
8544 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8545 packed.append(struct.pack("!L", self.xid))
8546 packed.append(struct.pack("!L", self.experimenter))
8547 packed.append(struct.pack("!L", self.subtype))
8548 length = sum([len(x) for x in packed])
8549 packed[2] = struct.pack("!H", length)
8550 return ''.join(packed)
8551
8552 @staticmethod
8553 def unpack(reader):
8554 obj = bsn_takeover()
8555 _version = reader.read("!B")[0]
8556 assert(_version == 5)
8557 _type = reader.read("!B")[0]
8558 assert(_type == 4)
8559 _length = reader.read("!H")[0]
8560 orig_reader = reader
8561 reader = orig_reader.slice(_length, 4)
8562 obj.xid = reader.read("!L")[0]
8563 _experimenter = reader.read("!L")[0]
8564 assert(_experimenter == 6035143)
8565 _subtype = reader.read("!L")[0]
8566 assert(_subtype == 69)
8567 return obj
8568
8569 def __eq__(self, other):
8570 if type(self) != type(other): return False
8571 if self.xid != other.xid: return False
8572 return True
8573
8574 def pretty_print(self, q):
8575 q.text("bsn_takeover {")
8576 with q.group():
8577 with q.indent(2):
8578 q.breakable()
8579 q.text("xid = ");
8580 if self.xid != None:
8581 q.text("%#x" % self.xid)
8582 else:
8583 q.text('None')
8584 q.breakable()
8585 q.text('}')
8586
8587bsn_header.subtypes[69] = bsn_takeover
8588
8589class bsn_time_reply(bsn_header):
8590 version = 5
8591 type = 4
8592 experimenter = 6035143
8593 subtype = 45
8594
8595 def __init__(self, xid=None, time_ms=None):
8596 if xid != None:
8597 self.xid = xid
8598 else:
8599 self.xid = None
8600 if time_ms != None:
8601 self.time_ms = time_ms
8602 else:
8603 self.time_ms = 0
8604 return
8605
8606 def pack(self):
8607 packed = []
8608 packed.append(struct.pack("!B", self.version))
8609 packed.append(struct.pack("!B", self.type))
8610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8611 packed.append(struct.pack("!L", self.xid))
8612 packed.append(struct.pack("!L", self.experimenter))
8613 packed.append(struct.pack("!L", self.subtype))
8614 packed.append(struct.pack("!Q", self.time_ms))
8615 length = sum([len(x) for x in packed])
8616 packed[2] = struct.pack("!H", length)
8617 return ''.join(packed)
8618
8619 @staticmethod
8620 def unpack(reader):
8621 obj = bsn_time_reply()
8622 _version = reader.read("!B")[0]
8623 assert(_version == 5)
8624 _type = reader.read("!B")[0]
8625 assert(_type == 4)
8626 _length = reader.read("!H")[0]
8627 orig_reader = reader
8628 reader = orig_reader.slice(_length, 4)
8629 obj.xid = reader.read("!L")[0]
8630 _experimenter = reader.read("!L")[0]
8631 assert(_experimenter == 6035143)
8632 _subtype = reader.read("!L")[0]
8633 assert(_subtype == 45)
8634 obj.time_ms = reader.read("!Q")[0]
8635 return obj
8636
8637 def __eq__(self, other):
8638 if type(self) != type(other): return False
8639 if self.xid != other.xid: return False
8640 if self.time_ms != other.time_ms: return False
8641 return True
8642
8643 def pretty_print(self, q):
8644 q.text("bsn_time_reply {")
8645 with q.group():
8646 with q.indent(2):
8647 q.breakable()
8648 q.text("xid = ");
8649 if self.xid != None:
8650 q.text("%#x" % self.xid)
8651 else:
8652 q.text('None')
8653 q.text(","); q.breakable()
8654 q.text("time_ms = ");
8655 q.text("%#x" % self.time_ms)
8656 q.breakable()
8657 q.text('}')
8658
8659bsn_header.subtypes[45] = bsn_time_reply
8660
8661class bsn_time_request(bsn_header):
8662 version = 5
8663 type = 4
8664 experimenter = 6035143
8665 subtype = 44
8666
8667 def __init__(self, xid=None):
8668 if xid != None:
8669 self.xid = xid
8670 else:
8671 self.xid = None
8672 return
8673
8674 def pack(self):
8675 packed = []
8676 packed.append(struct.pack("!B", self.version))
8677 packed.append(struct.pack("!B", self.type))
8678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8679 packed.append(struct.pack("!L", self.xid))
8680 packed.append(struct.pack("!L", self.experimenter))
8681 packed.append(struct.pack("!L", self.subtype))
8682 length = sum([len(x) for x in packed])
8683 packed[2] = struct.pack("!H", length)
8684 return ''.join(packed)
8685
8686 @staticmethod
8687 def unpack(reader):
8688 obj = bsn_time_request()
8689 _version = reader.read("!B")[0]
8690 assert(_version == 5)
8691 _type = reader.read("!B")[0]
8692 assert(_type == 4)
8693 _length = reader.read("!H")[0]
8694 orig_reader = reader
8695 reader = orig_reader.slice(_length, 4)
8696 obj.xid = reader.read("!L")[0]
8697 _experimenter = reader.read("!L")[0]
8698 assert(_experimenter == 6035143)
8699 _subtype = reader.read("!L")[0]
8700 assert(_subtype == 44)
8701 return obj
8702
8703 def __eq__(self, other):
8704 if type(self) != type(other): return False
8705 if self.xid != other.xid: return False
8706 return True
8707
8708 def pretty_print(self, q):
8709 q.text("bsn_time_request {")
8710 with q.group():
8711 with q.indent(2):
8712 q.breakable()
8713 q.text("xid = ");
8714 if self.xid != None:
8715 q.text("%#x" % self.xid)
8716 else:
8717 q.text('None')
8718 q.breakable()
8719 q.text('}')
8720
8721bsn_header.subtypes[44] = bsn_time_request
8722
8723class bsn_virtual_port_create_reply(bsn_header):
8724 version = 5
8725 type = 4
8726 experimenter = 6035143
8727 subtype = 16
8728
8729 def __init__(self, xid=None, status=None, vport_no=None):
8730 if xid != None:
8731 self.xid = xid
8732 else:
8733 self.xid = None
8734 if status != None:
8735 self.status = status
8736 else:
8737 self.status = 0
8738 if vport_no != None:
8739 self.vport_no = vport_no
8740 else:
8741 self.vport_no = 0
8742 return
8743
8744 def pack(self):
8745 packed = []
8746 packed.append(struct.pack("!B", self.version))
8747 packed.append(struct.pack("!B", self.type))
8748 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8749 packed.append(struct.pack("!L", self.xid))
8750 packed.append(struct.pack("!L", self.experimenter))
8751 packed.append(struct.pack("!L", self.subtype))
8752 packed.append(struct.pack("!L", self.status))
8753 packed.append(struct.pack("!L", self.vport_no))
8754 length = sum([len(x) for x in packed])
8755 packed[2] = struct.pack("!H", length)
8756 return ''.join(packed)
8757
8758 @staticmethod
8759 def unpack(reader):
8760 obj = bsn_virtual_port_create_reply()
8761 _version = reader.read("!B")[0]
8762 assert(_version == 5)
8763 _type = reader.read("!B")[0]
8764 assert(_type == 4)
8765 _length = reader.read("!H")[0]
8766 orig_reader = reader
8767 reader = orig_reader.slice(_length, 4)
8768 obj.xid = reader.read("!L")[0]
8769 _experimenter = reader.read("!L")[0]
8770 assert(_experimenter == 6035143)
8771 _subtype = reader.read("!L")[0]
8772 assert(_subtype == 16)
8773 obj.status = reader.read("!L")[0]
8774 obj.vport_no = reader.read("!L")[0]
8775 return obj
8776
8777 def __eq__(self, other):
8778 if type(self) != type(other): return False
8779 if self.xid != other.xid: return False
8780 if self.status != other.status: return False
8781 if self.vport_no != other.vport_no: return False
8782 return True
8783
8784 def pretty_print(self, q):
8785 q.text("bsn_virtual_port_create_reply {")
8786 with q.group():
8787 with q.indent(2):
8788 q.breakable()
8789 q.text("xid = ");
8790 if self.xid != None:
8791 q.text("%#x" % self.xid)
8792 else:
8793 q.text('None')
8794 q.text(","); q.breakable()
8795 q.text("status = ");
8796 q.text("%#x" % self.status)
8797 q.text(","); q.breakable()
8798 q.text("vport_no = ");
8799 q.text("%#x" % self.vport_no)
8800 q.breakable()
8801 q.text('}')
8802
8803bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8804
8805class bsn_virtual_port_create_request(bsn_header):
8806 version = 5
8807 type = 4
8808 experimenter = 6035143
8809 subtype = 15
8810
8811 def __init__(self, xid=None, vport=None):
8812 if xid != None:
8813 self.xid = xid
8814 else:
8815 self.xid = None
8816 if vport != None:
8817 self.vport = vport
8818 else:
8819 self.vport = ofp.bsn_vport()
8820 return
8821
8822 def pack(self):
8823 packed = []
8824 packed.append(struct.pack("!B", self.version))
8825 packed.append(struct.pack("!B", self.type))
8826 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8827 packed.append(struct.pack("!L", self.xid))
8828 packed.append(struct.pack("!L", self.experimenter))
8829 packed.append(struct.pack("!L", self.subtype))
8830 packed.append(self.vport.pack())
8831 length = sum([len(x) for x in packed])
8832 packed[2] = struct.pack("!H", length)
8833 return ''.join(packed)
8834
8835 @staticmethod
8836 def unpack(reader):
8837 obj = bsn_virtual_port_create_request()
8838 _version = reader.read("!B")[0]
8839 assert(_version == 5)
8840 _type = reader.read("!B")[0]
8841 assert(_type == 4)
8842 _length = reader.read("!H")[0]
8843 orig_reader = reader
8844 reader = orig_reader.slice(_length, 4)
8845 obj.xid = reader.read("!L")[0]
8846 _experimenter = reader.read("!L")[0]
8847 assert(_experimenter == 6035143)
8848 _subtype = reader.read("!L")[0]
8849 assert(_subtype == 15)
8850 obj.vport = ofp.bsn_vport.unpack(reader)
8851 return obj
8852
8853 def __eq__(self, other):
8854 if type(self) != type(other): return False
8855 if self.xid != other.xid: return False
8856 if self.vport != other.vport: return False
8857 return True
8858
8859 def pretty_print(self, q):
8860 q.text("bsn_virtual_port_create_request {")
8861 with q.group():
8862 with q.indent(2):
8863 q.breakable()
8864 q.text("xid = ");
8865 if self.xid != None:
8866 q.text("%#x" % self.xid)
8867 else:
8868 q.text('None')
8869 q.text(","); q.breakable()
8870 q.text("vport = ");
8871 q.pp(self.vport)
8872 q.breakable()
8873 q.text('}')
8874
8875bsn_header.subtypes[15] = bsn_virtual_port_create_request
8876
8877class bsn_virtual_port_remove_reply(bsn_header):
8878 version = 5
8879 type = 4
8880 experimenter = 6035143
8881 subtype = 26
8882
8883 def __init__(self, xid=None, status=None):
8884 if xid != None:
8885 self.xid = xid
8886 else:
8887 self.xid = None
8888 if status != None:
8889 self.status = status
8890 else:
8891 self.status = 0
8892 return
8893
8894 def pack(self):
8895 packed = []
8896 packed.append(struct.pack("!B", self.version))
8897 packed.append(struct.pack("!B", self.type))
8898 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8899 packed.append(struct.pack("!L", self.xid))
8900 packed.append(struct.pack("!L", self.experimenter))
8901 packed.append(struct.pack("!L", self.subtype))
8902 packed.append(struct.pack("!L", self.status))
8903 length = sum([len(x) for x in packed])
8904 packed[2] = struct.pack("!H", length)
8905 return ''.join(packed)
8906
8907 @staticmethod
8908 def unpack(reader):
8909 obj = bsn_virtual_port_remove_reply()
8910 _version = reader.read("!B")[0]
8911 assert(_version == 5)
8912 _type = reader.read("!B")[0]
8913 assert(_type == 4)
8914 _length = reader.read("!H")[0]
8915 orig_reader = reader
8916 reader = orig_reader.slice(_length, 4)
8917 obj.xid = reader.read("!L")[0]
8918 _experimenter = reader.read("!L")[0]
8919 assert(_experimenter == 6035143)
8920 _subtype = reader.read("!L")[0]
8921 assert(_subtype == 26)
8922 obj.status = reader.read("!L")[0]
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.status != other.status: return False
8929 return True
8930
8931 def pretty_print(self, q):
8932 q.text("bsn_virtual_port_remove_reply {")
8933 with q.group():
8934 with q.indent(2):
8935 q.breakable()
8936 q.text("xid = ");
8937 if self.xid != None:
8938 q.text("%#x" % self.xid)
8939 else:
8940 q.text('None')
8941 q.text(","); q.breakable()
8942 q.text("status = ");
8943 q.text("%#x" % self.status)
8944 q.breakable()
8945 q.text('}')
8946
8947bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8948
8949class bsn_virtual_port_remove_request(bsn_header):
8950 version = 5
8951 type = 4
8952 experimenter = 6035143
8953 subtype = 17
8954
8955 def __init__(self, xid=None, vport_no=None):
8956 if xid != None:
8957 self.xid = xid
8958 else:
8959 self.xid = None
8960 if vport_no != None:
8961 self.vport_no = vport_no
8962 else:
8963 self.vport_no = 0
8964 return
8965
8966 def pack(self):
8967 packed = []
8968 packed.append(struct.pack("!B", self.version))
8969 packed.append(struct.pack("!B", self.type))
8970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8971 packed.append(struct.pack("!L", self.xid))
8972 packed.append(struct.pack("!L", self.experimenter))
8973 packed.append(struct.pack("!L", self.subtype))
8974 packed.append(struct.pack("!L", self.vport_no))
8975 length = sum([len(x) for x in packed])
8976 packed[2] = struct.pack("!H", length)
8977 return ''.join(packed)
8978
8979 @staticmethod
8980 def unpack(reader):
8981 obj = bsn_virtual_port_remove_request()
8982 _version = reader.read("!B")[0]
8983 assert(_version == 5)
8984 _type = reader.read("!B")[0]
8985 assert(_type == 4)
8986 _length = reader.read("!H")[0]
8987 orig_reader = reader
8988 reader = orig_reader.slice(_length, 4)
8989 obj.xid = reader.read("!L")[0]
8990 _experimenter = reader.read("!L")[0]
8991 assert(_experimenter == 6035143)
8992 _subtype = reader.read("!L")[0]
8993 assert(_subtype == 17)
8994 obj.vport_no = reader.read("!L")[0]
8995 return obj
8996
8997 def __eq__(self, other):
8998 if type(self) != type(other): return False
8999 if self.xid != other.xid: return False
9000 if self.vport_no != other.vport_no: return False
9001 return True
9002
9003 def pretty_print(self, q):
9004 q.text("bsn_virtual_port_remove_request {")
9005 with q.group():
9006 with q.indent(2):
9007 q.breakable()
9008 q.text("xid = ");
9009 if self.xid != None:
9010 q.text("%#x" % self.xid)
9011 else:
9012 q.text('None')
9013 q.text(","); q.breakable()
9014 q.text("vport_no = ");
9015 q.text("%#x" % self.vport_no)
9016 q.breakable()
9017 q.text('}')
9018
9019bsn_header.subtypes[17] = bsn_virtual_port_remove_request
9020
9021class bsn_vlan_counter_clear(bsn_header):
9022 version = 5
9023 type = 4
9024 experimenter = 6035143
9025 subtype = 70
9026
9027 def __init__(self, xid=None, vlan_vid=None):
9028 if xid != None:
9029 self.xid = xid
9030 else:
9031 self.xid = None
9032 if vlan_vid != None:
9033 self.vlan_vid = vlan_vid
9034 else:
9035 self.vlan_vid = 0
9036 return
9037
9038 def pack(self):
9039 packed = []
9040 packed.append(struct.pack("!B", self.version))
9041 packed.append(struct.pack("!B", self.type))
9042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9043 packed.append(struct.pack("!L", self.xid))
9044 packed.append(struct.pack("!L", self.experimenter))
9045 packed.append(struct.pack("!L", self.subtype))
9046 packed.append(struct.pack("!H", self.vlan_vid))
9047 length = sum([len(x) for x in packed])
9048 packed[2] = struct.pack("!H", length)
9049 return ''.join(packed)
9050
9051 @staticmethod
9052 def unpack(reader):
9053 obj = bsn_vlan_counter_clear()
9054 _version = reader.read("!B")[0]
9055 assert(_version == 5)
9056 _type = reader.read("!B")[0]
9057 assert(_type == 4)
9058 _length = reader.read("!H")[0]
9059 orig_reader = reader
9060 reader = orig_reader.slice(_length, 4)
9061 obj.xid = reader.read("!L")[0]
9062 _experimenter = reader.read("!L")[0]
9063 assert(_experimenter == 6035143)
9064 _subtype = reader.read("!L")[0]
9065 assert(_subtype == 70)
9066 obj.vlan_vid = reader.read("!H")[0]
9067 return obj
9068
9069 def __eq__(self, other):
9070 if type(self) != type(other): return False
9071 if self.xid != other.xid: return False
9072 if self.vlan_vid != other.vlan_vid: return False
9073 return True
9074
9075 def pretty_print(self, q):
9076 q.text("bsn_vlan_counter_clear {")
9077 with q.group():
9078 with q.indent(2):
9079 q.breakable()
9080 q.text("xid = ");
9081 if self.xid != None:
9082 q.text("%#x" % self.xid)
9083 else:
9084 q.text('None')
9085 q.text(","); q.breakable()
9086 q.text("vlan_vid = ");
9087 q.text("%#x" % self.vlan_vid)
9088 q.breakable()
9089 q.text('}')
9090
9091bsn_header.subtypes[70] = bsn_vlan_counter_clear
9092
9093class bsn_vlan_counter_stats_reply(bsn_stats_reply):
9094 version = 5
9095 type = 19
9096 stats_type = 65535
9097 experimenter = 6035143
9098 subtype = 9
9099
9100 def __init__(self, xid=None, flags=None, entries=None):
9101 if xid != None:
9102 self.xid = xid
9103 else:
9104 self.xid = None
9105 if flags != None:
9106 self.flags = flags
9107 else:
9108 self.flags = 0
9109 if entries != None:
9110 self.entries = entries
9111 else:
9112 self.entries = []
9113 return
9114
9115 def pack(self):
9116 packed = []
9117 packed.append(struct.pack("!B", self.version))
9118 packed.append(struct.pack("!B", self.type))
9119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9120 packed.append(struct.pack("!L", self.xid))
9121 packed.append(struct.pack("!H", self.stats_type))
9122 packed.append(struct.pack("!H", self.flags))
9123 packed.append('\x00' * 4)
9124 packed.append(struct.pack("!L", self.experimenter))
9125 packed.append(struct.pack("!L", self.subtype))
9126 packed.append(loxi.generic_util.pack_list(self.entries))
9127 length = sum([len(x) for x in packed])
9128 packed[2] = struct.pack("!H", length)
9129 return ''.join(packed)
9130
9131 @staticmethod
9132 def unpack(reader):
9133 obj = bsn_vlan_counter_stats_reply()
9134 _version = reader.read("!B")[0]
9135 assert(_version == 5)
9136 _type = reader.read("!B")[0]
9137 assert(_type == 19)
9138 _length = reader.read("!H")[0]
9139 orig_reader = reader
9140 reader = orig_reader.slice(_length, 4)
9141 obj.xid = reader.read("!L")[0]
9142 _stats_type = reader.read("!H")[0]
9143 assert(_stats_type == 65535)
9144 obj.flags = reader.read("!H")[0]
9145 reader.skip(4)
9146 _experimenter = reader.read("!L")[0]
9147 assert(_experimenter == 6035143)
9148 _subtype = reader.read("!L")[0]
9149 assert(_subtype == 9)
9150 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
9151 return obj
9152
9153 def __eq__(self, other):
9154 if type(self) != type(other): return False
9155 if self.xid != other.xid: return False
9156 if self.flags != other.flags: return False
9157 if self.entries != other.entries: return False
9158 return True
9159
9160 def pretty_print(self, q):
9161 q.text("bsn_vlan_counter_stats_reply {")
9162 with q.group():
9163 with q.indent(2):
9164 q.breakable()
9165 q.text("xid = ");
9166 if self.xid != None:
9167 q.text("%#x" % self.xid)
9168 else:
9169 q.text('None')
9170 q.text(","); q.breakable()
9171 q.text("flags = ");
9172 q.text("%#x" % self.flags)
9173 q.text(","); q.breakable()
9174 q.text("entries = ");
9175 q.pp(self.entries)
9176 q.breakable()
9177 q.text('}')
9178
9179bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
9180
9181class bsn_vlan_counter_stats_request(bsn_stats_request):
9182 version = 5
9183 type = 18
9184 stats_type = 65535
9185 experimenter = 6035143
9186 subtype = 9
9187
9188 def __init__(self, xid=None, flags=None, vlan_vid=None):
9189 if xid != None:
9190 self.xid = xid
9191 else:
9192 self.xid = None
9193 if flags != None:
9194 self.flags = flags
9195 else:
9196 self.flags = 0
9197 if vlan_vid != None:
9198 self.vlan_vid = vlan_vid
9199 else:
9200 self.vlan_vid = 0
9201 return
9202
9203 def pack(self):
9204 packed = []
9205 packed.append(struct.pack("!B", self.version))
9206 packed.append(struct.pack("!B", self.type))
9207 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9208 packed.append(struct.pack("!L", self.xid))
9209 packed.append(struct.pack("!H", self.stats_type))
9210 packed.append(struct.pack("!H", self.flags))
9211 packed.append('\x00' * 4)
9212 packed.append(struct.pack("!L", self.experimenter))
9213 packed.append(struct.pack("!L", self.subtype))
9214 packed.append(struct.pack("!H", self.vlan_vid))
9215 length = sum([len(x) for x in packed])
9216 packed[2] = struct.pack("!H", length)
9217 return ''.join(packed)
9218
9219 @staticmethod
9220 def unpack(reader):
9221 obj = bsn_vlan_counter_stats_request()
9222 _version = reader.read("!B")[0]
9223 assert(_version == 5)
9224 _type = reader.read("!B")[0]
9225 assert(_type == 18)
9226 _length = reader.read("!H")[0]
9227 orig_reader = reader
9228 reader = orig_reader.slice(_length, 4)
9229 obj.xid = reader.read("!L")[0]
9230 _stats_type = reader.read("!H")[0]
9231 assert(_stats_type == 65535)
9232 obj.flags = reader.read("!H")[0]
9233 reader.skip(4)
9234 _experimenter = reader.read("!L")[0]
9235 assert(_experimenter == 6035143)
9236 _subtype = reader.read("!L")[0]
9237 assert(_subtype == 9)
9238 obj.vlan_vid = reader.read("!H")[0]
9239 return obj
9240
9241 def __eq__(self, other):
9242 if type(self) != type(other): return False
9243 if self.xid != other.xid: return False
9244 if self.flags != other.flags: return False
9245 if self.vlan_vid != other.vlan_vid: return False
9246 return True
9247
9248 def pretty_print(self, q):
9249 q.text("bsn_vlan_counter_stats_request {")
9250 with q.group():
9251 with q.indent(2):
9252 q.breakable()
9253 q.text("xid = ");
9254 if self.xid != None:
9255 q.text("%#x" % self.xid)
9256 else:
9257 q.text('None')
9258 q.text(","); q.breakable()
9259 q.text("flags = ");
9260 q.text("%#x" % self.flags)
9261 q.text(","); q.breakable()
9262 q.text("vlan_vid = ");
9263 q.text("%#x" % self.vlan_vid)
9264 q.breakable()
9265 q.text('}')
9266
9267bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
9268
9269class bsn_vrf_counter_stats_reply(bsn_stats_reply):
9270 version = 5
9271 type = 19
9272 stats_type = 65535
9273 experimenter = 6035143
9274 subtype = 15
9275
9276 def __init__(self, xid=None, flags=None, entries=None):
9277 if xid != None:
9278 self.xid = xid
9279 else:
9280 self.xid = None
9281 if flags != None:
9282 self.flags = flags
9283 else:
9284 self.flags = 0
9285 if entries != None:
9286 self.entries = entries
9287 else:
9288 self.entries = []
9289 return
9290
9291 def pack(self):
9292 packed = []
9293 packed.append(struct.pack("!B", self.version))
9294 packed.append(struct.pack("!B", self.type))
9295 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9296 packed.append(struct.pack("!L", self.xid))
9297 packed.append(struct.pack("!H", self.stats_type))
9298 packed.append(struct.pack("!H", self.flags))
9299 packed.append('\x00' * 4)
9300 packed.append(struct.pack("!L", self.experimenter))
9301 packed.append(struct.pack("!L", self.subtype))
9302 packed.append(loxi.generic_util.pack_list(self.entries))
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 = bsn_vrf_counter_stats_reply()
9310 _version = reader.read("!B")[0]
9311 assert(_version == 5)
9312 _type = reader.read("!B")[0]
9313 assert(_type == 19)
9314 _length = reader.read("!H")[0]
9315 orig_reader = reader
9316 reader = orig_reader.slice(_length, 4)
9317 obj.xid = reader.read("!L")[0]
9318 _stats_type = reader.read("!H")[0]
9319 assert(_stats_type == 65535)
9320 obj.flags = reader.read("!H")[0]
9321 reader.skip(4)
9322 _experimenter = reader.read("!L")[0]
9323 assert(_experimenter == 6035143)
9324 _subtype = reader.read("!L")[0]
9325 assert(_subtype == 15)
9326 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
9327 return obj
9328
9329 def __eq__(self, other):
9330 if type(self) != type(other): return False
9331 if self.xid != other.xid: return False
9332 if self.flags != other.flags: return False
9333 if self.entries != other.entries: return False
9334 return True
9335
9336 def pretty_print(self, q):
9337 q.text("bsn_vrf_counter_stats_reply {")
9338 with q.group():
9339 with q.indent(2):
9340 q.breakable()
9341 q.text("xid = ");
9342 if self.xid != None:
9343 q.text("%#x" % self.xid)
9344 else:
9345 q.text('None')
9346 q.text(","); q.breakable()
9347 q.text("flags = ");
9348 q.text("%#x" % self.flags)
9349 q.text(","); q.breakable()
9350 q.text("entries = ");
9351 q.pp(self.entries)
9352 q.breakable()
9353 q.text('}')
9354
9355bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
9356
9357class bsn_vrf_counter_stats_request(bsn_stats_request):
9358 version = 5
9359 type = 18
9360 stats_type = 65535
9361 experimenter = 6035143
9362 subtype = 15
9363
9364 def __init__(self, xid=None, flags=None, vrf=None):
9365 if xid != None:
9366 self.xid = xid
9367 else:
9368 self.xid = None
9369 if flags != None:
9370 self.flags = flags
9371 else:
9372 self.flags = 0
9373 if vrf != None:
9374 self.vrf = vrf
9375 else:
9376 self.vrf = 0
9377 return
9378
9379 def pack(self):
9380 packed = []
9381 packed.append(struct.pack("!B", self.version))
9382 packed.append(struct.pack("!B", self.type))
9383 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9384 packed.append(struct.pack("!L", self.xid))
9385 packed.append(struct.pack("!H", self.stats_type))
9386 packed.append(struct.pack("!H", self.flags))
9387 packed.append('\x00' * 4)
9388 packed.append(struct.pack("!L", self.experimenter))
9389 packed.append(struct.pack("!L", self.subtype))
9390 packed.append(struct.pack("!L", self.vrf))
9391 length = sum([len(x) for x in packed])
9392 packed[2] = struct.pack("!H", length)
9393 return ''.join(packed)
9394
9395 @staticmethod
9396 def unpack(reader):
9397 obj = bsn_vrf_counter_stats_request()
9398 _version = reader.read("!B")[0]
9399 assert(_version == 5)
9400 _type = reader.read("!B")[0]
9401 assert(_type == 18)
9402 _length = reader.read("!H")[0]
9403 orig_reader = reader
9404 reader = orig_reader.slice(_length, 4)
9405 obj.xid = reader.read("!L")[0]
9406 _stats_type = reader.read("!H")[0]
9407 assert(_stats_type == 65535)
9408 obj.flags = reader.read("!H")[0]
9409 reader.skip(4)
9410 _experimenter = reader.read("!L")[0]
9411 assert(_experimenter == 6035143)
9412 _subtype = reader.read("!L")[0]
9413 assert(_subtype == 15)
9414 obj.vrf = reader.read("!L")[0]
9415 return obj
9416
9417 def __eq__(self, other):
9418 if type(self) != type(other): return False
9419 if self.xid != other.xid: return False
9420 if self.flags != other.flags: return False
9421 if self.vrf != other.vrf: return False
9422 return True
9423
9424 def pretty_print(self, q):
9425 q.text("bsn_vrf_counter_stats_request {")
9426 with q.group():
9427 with q.indent(2):
9428 q.breakable()
9429 q.text("xid = ");
9430 if self.xid != None:
9431 q.text("%#x" % self.xid)
9432 else:
9433 q.text('None')
9434 q.text(","); q.breakable()
9435 q.text("flags = ");
9436 q.text("%#x" % self.flags)
9437 q.text(","); q.breakable()
9438 q.text("vrf = ");
9439 q.text("%#x" % self.vrf)
9440 q.breakable()
9441 q.text('}')
9442
9443bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
9444
9445class bundle_add_msg(message):
9446 version = 5
9447 type = 34
9448
9449 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
9450 if xid != None:
9451 self.xid = xid
9452 else:
9453 self.xid = None
9454 if bundle_id != None:
9455 self.bundle_id = bundle_id
9456 else:
9457 self.bundle_id = 0
9458 if flags != None:
9459 self.flags = flags
9460 else:
9461 self.flags = 0
9462 if data != None:
9463 self.data = data
9464 else:
9465 self.data = ''
9466 return
9467
9468 def pack(self):
9469 packed = []
9470 packed.append(struct.pack("!B", self.version))
9471 packed.append(struct.pack("!B", self.type))
9472 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9473 packed.append(struct.pack("!L", self.xid))
9474 packed.append(struct.pack("!L", self.bundle_id))
9475 packed.append('\x00' * 2)
9476 packed.append(struct.pack("!H", self.flags))
9477 packed.append(self.data)
9478 length = sum([len(x) for x in packed])
9479 packed[2] = struct.pack("!H", length)
9480 return ''.join(packed)
9481
9482 @staticmethod
9483 def unpack(reader):
9484 obj = bundle_add_msg()
9485 _version = reader.read("!B")[0]
9486 assert(_version == 5)
9487 _type = reader.read("!B")[0]
9488 assert(_type == 34)
9489 _length = reader.read("!H")[0]
9490 orig_reader = reader
9491 reader = orig_reader.slice(_length, 4)
9492 obj.xid = reader.read("!L")[0]
9493 obj.bundle_id = reader.read("!L")[0]
9494 reader.skip(2)
9495 obj.flags = reader.read("!H")[0]
9496 obj.data = str(reader.read_all())
9497 return obj
9498
9499 def __eq__(self, other):
9500 if type(self) != type(other): return False
9501 if self.xid != other.xid: return False
9502 if self.bundle_id != other.bundle_id: return False
9503 if self.flags != other.flags: return False
9504 if self.data != other.data: return False
9505 return True
9506
9507 def pretty_print(self, q):
9508 q.text("bundle_add_msg {")
9509 with q.group():
9510 with q.indent(2):
9511 q.breakable()
9512 q.text("xid = ");
9513 if self.xid != None:
9514 q.text("%#x" % self.xid)
9515 else:
9516 q.text('None')
9517 q.text(","); q.breakable()
9518 q.text("bundle_id = ");
9519 q.text("%#x" % self.bundle_id)
9520 q.text(","); q.breakable()
9521 q.text("flags = ");
9522 q.text("%#x" % self.flags)
9523 q.text(","); q.breakable()
9524 q.text("data = ");
9525 q.pp(self.data)
9526 q.breakable()
9527 q.text('}')
9528
9529message.subtypes[34] = bundle_add_msg
9530
9531class bundle_ctrl_msg(message):
9532 version = 5
9533 type = 33
9534
9535 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
9536 if xid != None:
9537 self.xid = xid
9538 else:
9539 self.xid = None
9540 if bundle_id != None:
9541 self.bundle_id = bundle_id
9542 else:
9543 self.bundle_id = 0
9544 if bundle_ctrl_type != None:
9545 self.bundle_ctrl_type = bundle_ctrl_type
9546 else:
9547 self.bundle_ctrl_type = 0
9548 if flags != None:
9549 self.flags = flags
9550 else:
9551 self.flags = 0
9552 if properties != None:
9553 self.properties = properties
9554 else:
9555 self.properties = []
9556 return
9557
9558 def pack(self):
9559 packed = []
9560 packed.append(struct.pack("!B", self.version))
9561 packed.append(struct.pack("!B", self.type))
9562 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9563 packed.append(struct.pack("!L", self.xid))
9564 packed.append(struct.pack("!L", self.bundle_id))
9565 packed.append(struct.pack("!H", self.bundle_ctrl_type))
9566 packed.append(struct.pack("!H", self.flags))
9567 packed.append(loxi.generic_util.pack_list(self.properties))
9568 length = sum([len(x) for x in packed])
9569 packed[2] = struct.pack("!H", length)
9570 return ''.join(packed)
9571
9572 @staticmethod
9573 def unpack(reader):
9574 obj = bundle_ctrl_msg()
9575 _version = reader.read("!B")[0]
9576 assert(_version == 5)
9577 _type = reader.read("!B")[0]
9578 assert(_type == 33)
9579 _length = reader.read("!H")[0]
9580 orig_reader = reader
9581 reader = orig_reader.slice(_length, 4)
9582 obj.xid = reader.read("!L")[0]
9583 obj.bundle_id = reader.read("!L")[0]
9584 obj.bundle_ctrl_type = reader.read("!H")[0]
9585 obj.flags = reader.read("!H")[0]
9586 obj.properties = loxi.generic_util.unpack_list(reader, ofp.bundle_prop.bundle_prop.unpack)
9587 return obj
9588
9589 def __eq__(self, other):
9590 if type(self) != type(other): return False
9591 if self.xid != other.xid: return False
9592 if self.bundle_id != other.bundle_id: return False
9593 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
9594 if self.flags != other.flags: return False
9595 if self.properties != other.properties: return False
9596 return True
9597
9598 def pretty_print(self, q):
9599 q.text("bundle_ctrl_msg {")
9600 with q.group():
9601 with q.indent(2):
9602 q.breakable()
9603 q.text("xid = ");
9604 if self.xid != None:
9605 q.text("%#x" % self.xid)
9606 else:
9607 q.text('None')
9608 q.text(","); q.breakable()
9609 q.text("bundle_id = ");
9610 q.text("%#x" % self.bundle_id)
9611 q.text(","); q.breakable()
9612 q.text("bundle_ctrl_type = ");
9613 q.text("%#x" % self.bundle_ctrl_type)
9614 q.text(","); q.breakable()
9615 q.text("flags = ");
9616 q.text("%#x" % self.flags)
9617 q.text(","); q.breakable()
9618 q.text("properties = ");
9619 q.pp(self.properties)
9620 q.breakable()
9621 q.text('}')
9622
9623message.subtypes[33] = bundle_ctrl_msg
9624
9625class bundle_failed_error_msg(error_msg):
9626 version = 5
9627 type = 1
9628 err_type = 17
9629
9630 def __init__(self, xid=None, code=None, data=None):
9631 if xid != None:
9632 self.xid = xid
9633 else:
9634 self.xid = None
9635 if code != None:
9636 self.code = code
9637 else:
9638 self.code = 0
9639 if data != None:
9640 self.data = data
9641 else:
9642 self.data = ''
9643 return
9644
9645 def pack(self):
9646 packed = []
9647 packed.append(struct.pack("!B", self.version))
9648 packed.append(struct.pack("!B", self.type))
9649 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9650 packed.append(struct.pack("!L", self.xid))
9651 packed.append(struct.pack("!H", self.err_type))
9652 packed.append(struct.pack("!H", self.code))
9653 packed.append(self.data)
9654 length = sum([len(x) for x in packed])
9655 packed[2] = struct.pack("!H", length)
9656 return ''.join(packed)
9657
9658 @staticmethod
9659 def unpack(reader):
9660 obj = bundle_failed_error_msg()
9661 _version = reader.read("!B")[0]
9662 assert(_version == 5)
9663 _type = reader.read("!B")[0]
9664 assert(_type == 1)
9665 _length = reader.read("!H")[0]
9666 orig_reader = reader
9667 reader = orig_reader.slice(_length, 4)
9668 obj.xid = reader.read("!L")[0]
9669 _err_type = reader.read("!H")[0]
9670 assert(_err_type == 17)
9671 obj.code = reader.read("!H")[0]
9672 obj.data = str(reader.read_all())
9673 return obj
9674
9675 def __eq__(self, other):
9676 if type(self) != type(other): return False
9677 if self.xid != other.xid: return False
9678 if self.code != other.code: return False
9679 if self.data != other.data: return False
9680 return True
9681
9682 def pretty_print(self, q):
9683 q.text("bundle_failed_error_msg {")
9684 with q.group():
9685 with q.indent(2):
9686 q.breakable()
9687 q.text("xid = ");
9688 if self.xid != None:
9689 q.text("%#x" % self.xid)
9690 else:
9691 q.text('None')
9692 q.text(","); q.breakable()
9693 q.text("code = ");
9694 q.text("%#x" % self.code)
9695 q.text(","); q.breakable()
9696 q.text("data = ");
9697 q.pp(self.data)
9698 q.breakable()
9699 q.text('}')
9700
9701error_msg.subtypes[17] = bundle_failed_error_msg
9702
9703class desc_stats_reply(stats_reply):
9704 version = 5
9705 type = 19
9706 stats_type = 0
9707
9708 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
9709 if xid != None:
9710 self.xid = xid
9711 else:
9712 self.xid = None
9713 if flags != None:
9714 self.flags = flags
9715 else:
9716 self.flags = 0
9717 if mfr_desc != None:
9718 self.mfr_desc = mfr_desc
9719 else:
9720 self.mfr_desc = ""
9721 if hw_desc != None:
9722 self.hw_desc = hw_desc
9723 else:
9724 self.hw_desc = ""
9725 if sw_desc != None:
9726 self.sw_desc = sw_desc
9727 else:
9728 self.sw_desc = ""
9729 if serial_num != None:
9730 self.serial_num = serial_num
9731 else:
9732 self.serial_num = ""
9733 if dp_desc != None:
9734 self.dp_desc = dp_desc
9735 else:
9736 self.dp_desc = ""
9737 return
9738
9739 def pack(self):
9740 packed = []
9741 packed.append(struct.pack("!B", self.version))
9742 packed.append(struct.pack("!B", self.type))
9743 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9744 packed.append(struct.pack("!L", self.xid))
9745 packed.append(struct.pack("!H", self.stats_type))
9746 packed.append(struct.pack("!H", self.flags))
9747 packed.append('\x00' * 4)
9748 packed.append(struct.pack("!256s", self.mfr_desc))
9749 packed.append(struct.pack("!256s", self.hw_desc))
9750 packed.append(struct.pack("!256s", self.sw_desc))
9751 packed.append(struct.pack("!32s", self.serial_num))
9752 packed.append(struct.pack("!256s", self.dp_desc))
9753 length = sum([len(x) for x in packed])
9754 packed[2] = struct.pack("!H", length)
9755 return ''.join(packed)
9756
9757 @staticmethod
9758 def unpack(reader):
9759 obj = desc_stats_reply()
9760 _version = reader.read("!B")[0]
9761 assert(_version == 5)
9762 _type = reader.read("!B")[0]
9763 assert(_type == 19)
9764 _length = reader.read("!H")[0]
9765 orig_reader = reader
9766 reader = orig_reader.slice(_length, 4)
9767 obj.xid = reader.read("!L")[0]
9768 _stats_type = reader.read("!H")[0]
9769 assert(_stats_type == 0)
9770 obj.flags = reader.read("!H")[0]
9771 reader.skip(4)
9772 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9773 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9774 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9775 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9776 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9777 return obj
9778
9779 def __eq__(self, other):
9780 if type(self) != type(other): return False
9781 if self.xid != other.xid: return False
9782 if self.flags != other.flags: return False
9783 if self.mfr_desc != other.mfr_desc: return False
9784 if self.hw_desc != other.hw_desc: return False
9785 if self.sw_desc != other.sw_desc: return False
9786 if self.serial_num != other.serial_num: return False
9787 if self.dp_desc != other.dp_desc: return False
9788 return True
9789
9790 def pretty_print(self, q):
9791 q.text("desc_stats_reply {")
9792 with q.group():
9793 with q.indent(2):
9794 q.breakable()
9795 q.text("xid = ");
9796 if self.xid != None:
9797 q.text("%#x" % self.xid)
9798 else:
9799 q.text('None')
9800 q.text(","); q.breakable()
9801 q.text("flags = ");
9802 q.text("%#x" % self.flags)
9803 q.text(","); q.breakable()
9804 q.text("mfr_desc = ");
9805 q.pp(self.mfr_desc)
9806 q.text(","); q.breakable()
9807 q.text("hw_desc = ");
9808 q.pp(self.hw_desc)
9809 q.text(","); q.breakable()
9810 q.text("sw_desc = ");
9811 q.pp(self.sw_desc)
9812 q.text(","); q.breakable()
9813 q.text("serial_num = ");
9814 q.pp(self.serial_num)
9815 q.text(","); q.breakable()
9816 q.text("dp_desc = ");
9817 q.pp(self.dp_desc)
9818 q.breakable()
9819 q.text('}')
9820
9821stats_reply.subtypes[0] = desc_stats_reply
9822
9823class desc_stats_request(stats_request):
9824 version = 5
9825 type = 18
9826 stats_type = 0
9827
9828 def __init__(self, xid=None, flags=None):
9829 if xid != None:
9830 self.xid = xid
9831 else:
9832 self.xid = None
9833 if flags != None:
9834 self.flags = flags
9835 else:
9836 self.flags = 0
9837 return
9838
9839 def pack(self):
9840 packed = []
9841 packed.append(struct.pack("!B", self.version))
9842 packed.append(struct.pack("!B", self.type))
9843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9844 packed.append(struct.pack("!L", self.xid))
9845 packed.append(struct.pack("!H", self.stats_type))
9846 packed.append(struct.pack("!H", self.flags))
9847 packed.append('\x00' * 4)
9848 length = sum([len(x) for x in packed])
9849 packed[2] = struct.pack("!H", length)
9850 return ''.join(packed)
9851
9852 @staticmethod
9853 def unpack(reader):
9854 obj = desc_stats_request()
9855 _version = reader.read("!B")[0]
9856 assert(_version == 5)
9857 _type = reader.read("!B")[0]
9858 assert(_type == 18)
9859 _length = reader.read("!H")[0]
9860 orig_reader = reader
9861 reader = orig_reader.slice(_length, 4)
9862 obj.xid = reader.read("!L")[0]
9863 _stats_type = reader.read("!H")[0]
9864 assert(_stats_type == 0)
9865 obj.flags = reader.read("!H")[0]
9866 reader.skip(4)
9867 return obj
9868
9869 def __eq__(self, other):
9870 if type(self) != type(other): return False
9871 if self.xid != other.xid: return False
9872 if self.flags != other.flags: return False
9873 return True
9874
9875 def pretty_print(self, q):
9876 q.text("desc_stats_request {")
9877 with q.group():
9878 with q.indent(2):
9879 q.breakable()
9880 q.text("xid = ");
9881 if self.xid != None:
9882 q.text("%#x" % self.xid)
9883 else:
9884 q.text('None')
9885 q.text(","); q.breakable()
9886 q.text("flags = ");
9887 q.text("%#x" % self.flags)
9888 q.breakable()
9889 q.text('}')
9890
9891stats_request.subtypes[0] = desc_stats_request
9892
9893class echo_reply(message):
9894 version = 5
9895 type = 3
9896
9897 def __init__(self, xid=None, data=None):
9898 if xid != None:
9899 self.xid = xid
9900 else:
9901 self.xid = None
9902 if data != None:
9903 self.data = data
9904 else:
9905 self.data = ''
9906 return
9907
9908 def pack(self):
9909 packed = []
9910 packed.append(struct.pack("!B", self.version))
9911 packed.append(struct.pack("!B", self.type))
9912 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9913 packed.append(struct.pack("!L", self.xid))
9914 packed.append(self.data)
9915 length = sum([len(x) for x in packed])
9916 packed[2] = struct.pack("!H", length)
9917 return ''.join(packed)
9918
9919 @staticmethod
9920 def unpack(reader):
9921 obj = echo_reply()
9922 _version = reader.read("!B")[0]
9923 assert(_version == 5)
9924 _type = reader.read("!B")[0]
9925 assert(_type == 3)
9926 _length = reader.read("!H")[0]
9927 orig_reader = reader
9928 reader = orig_reader.slice(_length, 4)
9929 obj.xid = reader.read("!L")[0]
9930 obj.data = str(reader.read_all())
9931 return obj
9932
9933 def __eq__(self, other):
9934 if type(self) != type(other): return False
9935 if self.xid != other.xid: return False
9936 if self.data != other.data: return False
9937 return True
9938
9939 def pretty_print(self, q):
9940 q.text("echo_reply {")
9941 with q.group():
9942 with q.indent(2):
9943 q.breakable()
9944 q.text("xid = ");
9945 if self.xid != None:
9946 q.text("%#x" % self.xid)
9947 else:
9948 q.text('None')
9949 q.text(","); q.breakable()
9950 q.text("data = ");
9951 q.pp(self.data)
9952 q.breakable()
9953 q.text('}')
9954
9955message.subtypes[3] = echo_reply
9956
9957class echo_request(message):
9958 version = 5
9959 type = 2
9960
9961 def __init__(self, xid=None, data=None):
9962 if xid != None:
9963 self.xid = xid
9964 else:
9965 self.xid = None
9966 if data != None:
9967 self.data = data
9968 else:
9969 self.data = ''
9970 return
9971
9972 def pack(self):
9973 packed = []
9974 packed.append(struct.pack("!B", self.version))
9975 packed.append(struct.pack("!B", self.type))
9976 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9977 packed.append(struct.pack("!L", self.xid))
9978 packed.append(self.data)
9979 length = sum([len(x) for x in packed])
9980 packed[2] = struct.pack("!H", length)
9981 return ''.join(packed)
9982
9983 @staticmethod
9984 def unpack(reader):
9985 obj = echo_request()
9986 _version = reader.read("!B")[0]
9987 assert(_version == 5)
9988 _type = reader.read("!B")[0]
9989 assert(_type == 2)
9990 _length = reader.read("!H")[0]
9991 orig_reader = reader
9992 reader = orig_reader.slice(_length, 4)
9993 obj.xid = reader.read("!L")[0]
9994 obj.data = str(reader.read_all())
9995 return obj
9996
9997 def __eq__(self, other):
9998 if type(self) != type(other): return False
9999 if self.xid != other.xid: return False
10000 if self.data != other.data: return False
10001 return True
10002
10003 def pretty_print(self, q):
10004 q.text("echo_request {")
10005 with q.group():
10006 with q.indent(2):
10007 q.breakable()
10008 q.text("xid = ");
10009 if self.xid != None:
10010 q.text("%#x" % self.xid)
10011 else:
10012 q.text('None')
10013 q.text(","); q.breakable()
10014 q.text("data = ");
10015 q.pp(self.data)
10016 q.breakable()
10017 q.text('}')
10018
10019message.subtypes[2] = echo_request
10020
10021class features_reply(message):
10022 version = 5
10023 type = 6
10024
10025 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
10026 if xid != None:
10027 self.xid = xid
10028 else:
10029 self.xid = None
10030 if datapath_id != None:
10031 self.datapath_id = datapath_id
10032 else:
10033 self.datapath_id = 0
10034 if n_buffers != None:
10035 self.n_buffers = n_buffers
10036 else:
10037 self.n_buffers = 0
10038 if n_tables != None:
10039 self.n_tables = n_tables
10040 else:
10041 self.n_tables = 0
10042 if auxiliary_id != None:
10043 self.auxiliary_id = auxiliary_id
10044 else:
10045 self.auxiliary_id = 0
10046 if capabilities != None:
10047 self.capabilities = capabilities
10048 else:
10049 self.capabilities = 0
10050 if reserved != None:
10051 self.reserved = reserved
10052 else:
10053 self.reserved = 0
10054 return
10055
10056 def pack(self):
10057 packed = []
10058 packed.append(struct.pack("!B", self.version))
10059 packed.append(struct.pack("!B", self.type))
10060 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10061 packed.append(struct.pack("!L", self.xid))
10062 packed.append(struct.pack("!Q", self.datapath_id))
10063 packed.append(struct.pack("!L", self.n_buffers))
10064 packed.append(struct.pack("!B", self.n_tables))
10065 packed.append(struct.pack("!B", self.auxiliary_id))
10066 packed.append('\x00' * 2)
10067 packed.append(struct.pack("!L", self.capabilities))
10068 packed.append(struct.pack("!L", self.reserved))
10069 length = sum([len(x) for x in packed])
10070 packed[2] = struct.pack("!H", length)
10071 return ''.join(packed)
10072
10073 @staticmethod
10074 def unpack(reader):
10075 obj = features_reply()
10076 _version = reader.read("!B")[0]
10077 assert(_version == 5)
10078 _type = reader.read("!B")[0]
10079 assert(_type == 6)
10080 _length = reader.read("!H")[0]
10081 orig_reader = reader
10082 reader = orig_reader.slice(_length, 4)
10083 obj.xid = reader.read("!L")[0]
10084 obj.datapath_id = reader.read("!Q")[0]
10085 obj.n_buffers = reader.read("!L")[0]
10086 obj.n_tables = reader.read("!B")[0]
10087 obj.auxiliary_id = reader.read("!B")[0]
10088 reader.skip(2)
10089 obj.capabilities = reader.read("!L")[0]
10090 obj.reserved = reader.read("!L")[0]
10091 return obj
10092
10093 def __eq__(self, other):
10094 if type(self) != type(other): return False
10095 if self.xid != other.xid: return False
10096 if self.datapath_id != other.datapath_id: return False
10097 if self.n_buffers != other.n_buffers: return False
10098 if self.n_tables != other.n_tables: return False
10099 if self.auxiliary_id != other.auxiliary_id: return False
10100 if self.capabilities != other.capabilities: return False
10101 if self.reserved != other.reserved: return False
10102 return True
10103
10104 def pretty_print(self, q):
10105 q.text("features_reply {")
10106 with q.group():
10107 with q.indent(2):
10108 q.breakable()
10109 q.text("xid = ");
10110 if self.xid != None:
10111 q.text("%#x" % self.xid)
10112 else:
10113 q.text('None')
10114 q.text(","); q.breakable()
10115 q.text("datapath_id = ");
10116 q.text("%#x" % self.datapath_id)
10117 q.text(","); q.breakable()
10118 q.text("n_buffers = ");
10119 q.text("%#x" % self.n_buffers)
10120 q.text(","); q.breakable()
10121 q.text("n_tables = ");
10122 q.text("%#x" % self.n_tables)
10123 q.text(","); q.breakable()
10124 q.text("auxiliary_id = ");
10125 q.text("%#x" % self.auxiliary_id)
10126 q.text(","); q.breakable()
10127 q.text("capabilities = ");
10128 q.text("%#x" % self.capabilities)
10129 q.text(","); q.breakable()
10130 q.text("reserved = ");
10131 q.text("%#x" % self.reserved)
10132 q.breakable()
10133 q.text('}')
10134
10135message.subtypes[6] = features_reply
10136
10137class features_request(message):
10138 version = 5
10139 type = 5
10140
10141 def __init__(self, xid=None):
10142 if xid != None:
10143 self.xid = xid
10144 else:
10145 self.xid = None
10146 return
10147
10148 def pack(self):
10149 packed = []
10150 packed.append(struct.pack("!B", self.version))
10151 packed.append(struct.pack("!B", self.type))
10152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10153 packed.append(struct.pack("!L", self.xid))
10154 length = sum([len(x) for x in packed])
10155 packed[2] = struct.pack("!H", length)
10156 return ''.join(packed)
10157
10158 @staticmethod
10159 def unpack(reader):
10160 obj = features_request()
10161 _version = reader.read("!B")[0]
10162 assert(_version == 5)
10163 _type = reader.read("!B")[0]
10164 assert(_type == 5)
10165 _length = reader.read("!H")[0]
10166 orig_reader = reader
10167 reader = orig_reader.slice(_length, 4)
10168 obj.xid = reader.read("!L")[0]
10169 return obj
10170
10171 def __eq__(self, other):
10172 if type(self) != type(other): return False
10173 if self.xid != other.xid: return False
10174 return True
10175
10176 def pretty_print(self, q):
10177 q.text("features_request {")
10178 with q.group():
10179 with q.indent(2):
10180 q.breakable()
10181 q.text("xid = ");
10182 if self.xid != None:
10183 q.text("%#x" % self.xid)
10184 else:
10185 q.text('None')
10186 q.breakable()
10187 q.text('}')
10188
10189message.subtypes[5] = features_request
10190
10191class flow_mod(message):
10192 subtypes = {}
10193
10194 version = 5
10195 type = 14
10196
10197 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):
10198 if xid != None:
10199 self.xid = xid
10200 else:
10201 self.xid = None
10202 if cookie != None:
10203 self.cookie = cookie
10204 else:
10205 self.cookie = 0
10206 if cookie_mask != None:
10207 self.cookie_mask = cookie_mask
10208 else:
10209 self.cookie_mask = 0
10210 if table_id != None:
10211 self.table_id = table_id
10212 else:
10213 self.table_id = 0
10214 if _command != None:
10215 self._command = _command
10216 else:
10217 self._command = 0
10218 if idle_timeout != None:
10219 self.idle_timeout = idle_timeout
10220 else:
10221 self.idle_timeout = 0
10222 if hard_timeout != None:
10223 self.hard_timeout = hard_timeout
10224 else:
10225 self.hard_timeout = 0
10226 if priority != None:
10227 self.priority = priority
10228 else:
10229 self.priority = 0
10230 if buffer_id != None:
10231 self.buffer_id = buffer_id
10232 else:
10233 self.buffer_id = 0
10234 if out_port != None:
10235 self.out_port = out_port
10236 else:
10237 self.out_port = 0
10238 if out_group != None:
10239 self.out_group = out_group
10240 else:
10241 self.out_group = 0
10242 if flags != None:
10243 self.flags = flags
10244 else:
10245 self.flags = 0
10246 if match != None:
10247 self.match = match
10248 else:
10249 self.match = ofp.match()
10250 if instructions != None:
10251 self.instructions = instructions
10252 else:
10253 self.instructions = []
10254 return
10255
10256 def pack(self):
10257 packed = []
10258 packed.append(struct.pack("!B", self.version))
10259 packed.append(struct.pack("!B", self.type))
10260 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10261 packed.append(struct.pack("!L", self.xid))
10262 packed.append(struct.pack("!Q", self.cookie))
10263 packed.append(struct.pack("!Q", self.cookie_mask))
10264 packed.append(struct.pack("!B", self.table_id))
10265 packed.append(util.pack_fm_cmd(self._command))
10266 packed.append(struct.pack("!H", self.idle_timeout))
10267 packed.append(struct.pack("!H", self.hard_timeout))
10268 packed.append(struct.pack("!H", self.priority))
10269 packed.append(struct.pack("!L", self.buffer_id))
10270 packed.append(util.pack_port_no(self.out_port))
10271 packed.append(struct.pack("!L", self.out_group))
10272 packed.append(struct.pack("!H", self.flags))
10273 packed.append('\x00' * 2)
10274 packed.append(self.match.pack())
10275 packed.append(loxi.generic_util.pack_list(self.instructions))
10276 length = sum([len(x) for x in packed])
10277 packed[2] = struct.pack("!H", length)
10278 return ''.join(packed)
10279
10280 @staticmethod
10281 def unpack(reader):
10282 subtype, = reader.peek('B', 25)
10283 subclass = flow_mod.subtypes.get(subtype)
10284 if subclass:
10285 return subclass.unpack(reader)
10286
10287 obj = flow_mod()
10288 _version = reader.read("!B")[0]
10289 assert(_version == 5)
10290 _type = reader.read("!B")[0]
10291 assert(_type == 14)
10292 _length = reader.read("!H")[0]
10293 orig_reader = reader
10294 reader = orig_reader.slice(_length, 4)
10295 obj.xid = reader.read("!L")[0]
10296 obj.cookie = reader.read("!Q")[0]
10297 obj.cookie_mask = reader.read("!Q")[0]
10298 obj.table_id = reader.read("!B")[0]
10299 obj._command = util.unpack_fm_cmd(reader)
10300 obj.idle_timeout = reader.read("!H")[0]
10301 obj.hard_timeout = reader.read("!H")[0]
10302 obj.priority = reader.read("!H")[0]
10303 obj.buffer_id = reader.read("!L")[0]
10304 obj.out_port = util.unpack_port_no(reader)
10305 obj.out_group = reader.read("!L")[0]
10306 obj.flags = reader.read("!H")[0]
10307 reader.skip(2)
10308 obj.match = ofp.match.unpack(reader)
10309 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10310 return obj
10311
10312 def __eq__(self, other):
10313 if type(self) != type(other): return False
10314 if self.xid != other.xid: return False
10315 if self.cookie != other.cookie: return False
10316 if self.cookie_mask != other.cookie_mask: return False
10317 if self.table_id != other.table_id: return False
10318 if self._command != other._command: return False
10319 if self.idle_timeout != other.idle_timeout: return False
10320 if self.hard_timeout != other.hard_timeout: return False
10321 if self.priority != other.priority: return False
10322 if self.buffer_id != other.buffer_id: return False
10323 if self.out_port != other.out_port: return False
10324 if self.out_group != other.out_group: return False
10325 if self.flags != other.flags: return False
10326 if self.match != other.match: return False
10327 if self.instructions != other.instructions: return False
10328 return True
10329
10330 def pretty_print(self, q):
10331 q.text("flow_mod {")
10332 with q.group():
10333 with q.indent(2):
10334 q.breakable()
10335 q.text("xid = ");
10336 if self.xid != None:
10337 q.text("%#x" % self.xid)
10338 else:
10339 q.text('None')
10340 q.text(","); q.breakable()
10341 q.text("cookie = ");
10342 q.text("%#x" % self.cookie)
10343 q.text(","); q.breakable()
10344 q.text("cookie_mask = ");
10345 q.text("%#x" % self.cookie_mask)
10346 q.text(","); q.breakable()
10347 q.text("table_id = ");
10348 q.text("%#x" % self.table_id)
10349 q.text(","); q.breakable()
10350 q.text("idle_timeout = ");
10351 q.text("%#x" % self.idle_timeout)
10352 q.text(","); q.breakable()
10353 q.text("hard_timeout = ");
10354 q.text("%#x" % self.hard_timeout)
10355 q.text(","); q.breakable()
10356 q.text("priority = ");
10357 q.text("%#x" % self.priority)
10358 q.text(","); q.breakable()
10359 q.text("buffer_id = ");
10360 q.text("%#x" % self.buffer_id)
10361 q.text(","); q.breakable()
10362 q.text("out_port = ");
10363 q.text(util.pretty_port(self.out_port))
10364 q.text(","); q.breakable()
10365 q.text("out_group = ");
10366 q.text("%#x" % self.out_group)
10367 q.text(","); q.breakable()
10368 q.text("flags = ");
10369 q.text("%#x" % self.flags)
10370 q.text(","); q.breakable()
10371 q.text("match = ");
10372 q.pp(self.match)
10373 q.text(","); q.breakable()
10374 q.text("instructions = ");
10375 q.pp(self.instructions)
10376 q.breakable()
10377 q.text('}')
10378
10379message.subtypes[14] = flow_mod
10380
10381class flow_add(flow_mod):
10382 version = 5
10383 type = 14
10384 _command = 0
10385
10386 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):
10387 if xid != None:
10388 self.xid = xid
10389 else:
10390 self.xid = None
10391 if cookie != None:
10392 self.cookie = cookie
10393 else:
10394 self.cookie = 0
10395 if cookie_mask != None:
10396 self.cookie_mask = cookie_mask
10397 else:
10398 self.cookie_mask = 0
10399 if table_id != None:
10400 self.table_id = table_id
10401 else:
10402 self.table_id = 0
10403 if idle_timeout != None:
10404 self.idle_timeout = idle_timeout
10405 else:
10406 self.idle_timeout = 0
10407 if hard_timeout != None:
10408 self.hard_timeout = hard_timeout
10409 else:
10410 self.hard_timeout = 0
10411 if priority != None:
10412 self.priority = priority
10413 else:
10414 self.priority = 0
10415 if buffer_id != None:
10416 self.buffer_id = buffer_id
10417 else:
10418 self.buffer_id = 0
10419 if out_port != None:
10420 self.out_port = out_port
10421 else:
10422 self.out_port = 0
10423 if out_group != None:
10424 self.out_group = out_group
10425 else:
10426 self.out_group = 0
10427 if flags != None:
10428 self.flags = flags
10429 else:
10430 self.flags = 0
10431 if importance != None:
10432 self.importance = importance
10433 else:
10434 self.importance = 0
10435 if match != None:
10436 self.match = match
10437 else:
10438 self.match = ofp.match()
10439 if instructions != None:
10440 self.instructions = instructions
10441 else:
10442 self.instructions = []
10443 return
10444
10445 def pack(self):
10446 packed = []
10447 packed.append(struct.pack("!B", self.version))
10448 packed.append(struct.pack("!B", self.type))
10449 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10450 packed.append(struct.pack("!L", self.xid))
10451 packed.append(struct.pack("!Q", self.cookie))
10452 packed.append(struct.pack("!Q", self.cookie_mask))
10453 packed.append(struct.pack("!B", self.table_id))
10454 packed.append(util.pack_fm_cmd(self._command))
10455 packed.append(struct.pack("!H", self.idle_timeout))
10456 packed.append(struct.pack("!H", self.hard_timeout))
10457 packed.append(struct.pack("!H", self.priority))
10458 packed.append(struct.pack("!L", self.buffer_id))
10459 packed.append(util.pack_port_no(self.out_port))
10460 packed.append(struct.pack("!L", self.out_group))
10461 packed.append(struct.pack("!H", self.flags))
10462 packed.append(struct.pack("!H", self.importance))
10463 packed.append(self.match.pack())
10464 packed.append(loxi.generic_util.pack_list(self.instructions))
10465 length = sum([len(x) for x in packed])
10466 packed[2] = struct.pack("!H", length)
10467 return ''.join(packed)
10468
10469 @staticmethod
10470 def unpack(reader):
10471 obj = flow_add()
10472 _version = reader.read("!B")[0]
10473 assert(_version == 5)
10474 _type = reader.read("!B")[0]
10475 assert(_type == 14)
10476 _length = reader.read("!H")[0]
10477 orig_reader = reader
10478 reader = orig_reader.slice(_length, 4)
10479 obj.xid = reader.read("!L")[0]
10480 obj.cookie = reader.read("!Q")[0]
10481 obj.cookie_mask = reader.read("!Q")[0]
10482 obj.table_id = reader.read("!B")[0]
10483 __command = util.unpack_fm_cmd(reader)
10484 assert(__command == 0)
10485 obj.idle_timeout = reader.read("!H")[0]
10486 obj.hard_timeout = reader.read("!H")[0]
10487 obj.priority = reader.read("!H")[0]
10488 obj.buffer_id = reader.read("!L")[0]
10489 obj.out_port = util.unpack_port_no(reader)
10490 obj.out_group = reader.read("!L")[0]
10491 obj.flags = reader.read("!H")[0]
10492 obj.importance = reader.read("!H")[0]
10493 obj.match = ofp.match.unpack(reader)
10494 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10495 return obj
10496
10497 def __eq__(self, other):
10498 if type(self) != type(other): return False
10499 if self.xid != other.xid: return False
10500 if self.cookie != other.cookie: return False
10501 if self.cookie_mask != other.cookie_mask: return False
10502 if self.table_id != other.table_id: return False
10503 if self.idle_timeout != other.idle_timeout: return False
10504 if self.hard_timeout != other.hard_timeout: return False
10505 if self.priority != other.priority: return False
10506 if self.buffer_id != other.buffer_id: return False
10507 if self.out_port != other.out_port: return False
10508 if self.out_group != other.out_group: return False
10509 if self.flags != other.flags: return False
10510 if self.importance != other.importance: return False
10511 if self.match != other.match: return False
10512 if self.instructions != other.instructions: return False
10513 return True
10514
10515 def pretty_print(self, q):
10516 q.text("flow_add {")
10517 with q.group():
10518 with q.indent(2):
10519 q.breakable()
10520 q.text("xid = ");
10521 if self.xid != None:
10522 q.text("%#x" % self.xid)
10523 else:
10524 q.text('None')
10525 q.text(","); q.breakable()
10526 q.text("cookie = ");
10527 q.text("%#x" % self.cookie)
10528 q.text(","); q.breakable()
10529 q.text("cookie_mask = ");
10530 q.text("%#x" % self.cookie_mask)
10531 q.text(","); q.breakable()
10532 q.text("table_id = ");
10533 q.text("%#x" % self.table_id)
10534 q.text(","); q.breakable()
10535 q.text("idle_timeout = ");
10536 q.text("%#x" % self.idle_timeout)
10537 q.text(","); q.breakable()
10538 q.text("hard_timeout = ");
10539 q.text("%#x" % self.hard_timeout)
10540 q.text(","); q.breakable()
10541 q.text("priority = ");
10542 q.text("%#x" % self.priority)
10543 q.text(","); q.breakable()
10544 q.text("buffer_id = ");
10545 q.text("%#x" % self.buffer_id)
10546 q.text(","); q.breakable()
10547 q.text("out_port = ");
10548 q.text(util.pretty_port(self.out_port))
10549 q.text(","); q.breakable()
10550 q.text("out_group = ");
10551 q.text("%#x" % self.out_group)
10552 q.text(","); q.breakable()
10553 q.text("flags = ");
10554 q.text("%#x" % self.flags)
10555 q.text(","); q.breakable()
10556 q.text("importance = ");
10557 q.text("%#x" % self.importance)
10558 q.text(","); q.breakable()
10559 q.text("match = ");
10560 q.pp(self.match)
10561 q.text(","); q.breakable()
10562 q.text("instructions = ");
10563 q.pp(self.instructions)
10564 q.breakable()
10565 q.text('}')
10566
10567flow_mod.subtypes[0] = flow_add
10568
10569class flow_delete(flow_mod):
10570 version = 5
10571 type = 14
10572 _command = 3
10573
10574 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):
10575 if xid != None:
10576 self.xid = xid
10577 else:
10578 self.xid = None
10579 if cookie != None:
10580 self.cookie = cookie
10581 else:
10582 self.cookie = 0
10583 if cookie_mask != None:
10584 self.cookie_mask = cookie_mask
10585 else:
10586 self.cookie_mask = 0
10587 if table_id != None:
10588 self.table_id = table_id
10589 else:
10590 self.table_id = 0
10591 if idle_timeout != None:
10592 self.idle_timeout = idle_timeout
10593 else:
10594 self.idle_timeout = 0
10595 if hard_timeout != None:
10596 self.hard_timeout = hard_timeout
10597 else:
10598 self.hard_timeout = 0
10599 if priority != None:
10600 self.priority = priority
10601 else:
10602 self.priority = 0
10603 if buffer_id != None:
10604 self.buffer_id = buffer_id
10605 else:
10606 self.buffer_id = 0
10607 if out_port != None:
10608 self.out_port = out_port
10609 else:
10610 self.out_port = 0
10611 if out_group != None:
10612 self.out_group = out_group
10613 else:
10614 self.out_group = 0
10615 if flags != None:
10616 self.flags = flags
10617 else:
10618 self.flags = 0
10619 if importance != None:
10620 self.importance = importance
10621 else:
10622 self.importance = 0
10623 if match != None:
10624 self.match = match
10625 else:
10626 self.match = ofp.match()
10627 if instructions != None:
10628 self.instructions = instructions
10629 else:
10630 self.instructions = []
10631 return
10632
10633 def pack(self):
10634 packed = []
10635 packed.append(struct.pack("!B", self.version))
10636 packed.append(struct.pack("!B", self.type))
10637 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10638 packed.append(struct.pack("!L", self.xid))
10639 packed.append(struct.pack("!Q", self.cookie))
10640 packed.append(struct.pack("!Q", self.cookie_mask))
10641 packed.append(struct.pack("!B", self.table_id))
10642 packed.append(util.pack_fm_cmd(self._command))
10643 packed.append(struct.pack("!H", self.idle_timeout))
10644 packed.append(struct.pack("!H", self.hard_timeout))
10645 packed.append(struct.pack("!H", self.priority))
10646 packed.append(struct.pack("!L", self.buffer_id))
10647 packed.append(util.pack_port_no(self.out_port))
10648 packed.append(struct.pack("!L", self.out_group))
10649 packed.append(struct.pack("!H", self.flags))
10650 packed.append(struct.pack("!H", self.importance))
10651 packed.append(self.match.pack())
10652 packed.append(loxi.generic_util.pack_list(self.instructions))
10653 length = sum([len(x) for x in packed])
10654 packed[2] = struct.pack("!H", length)
10655 return ''.join(packed)
10656
10657 @staticmethod
10658 def unpack(reader):
10659 obj = flow_delete()
10660 _version = reader.read("!B")[0]
10661 assert(_version == 5)
10662 _type = reader.read("!B")[0]
10663 assert(_type == 14)
10664 _length = reader.read("!H")[0]
10665 orig_reader = reader
10666 reader = orig_reader.slice(_length, 4)
10667 obj.xid = reader.read("!L")[0]
10668 obj.cookie = reader.read("!Q")[0]
10669 obj.cookie_mask = reader.read("!Q")[0]
10670 obj.table_id = reader.read("!B")[0]
10671 __command = util.unpack_fm_cmd(reader)
10672 assert(__command == 3)
10673 obj.idle_timeout = reader.read("!H")[0]
10674 obj.hard_timeout = reader.read("!H")[0]
10675 obj.priority = reader.read("!H")[0]
10676 obj.buffer_id = reader.read("!L")[0]
10677 obj.out_port = util.unpack_port_no(reader)
10678 obj.out_group = reader.read("!L")[0]
10679 obj.flags = reader.read("!H")[0]
10680 obj.importance = reader.read("!H")[0]
10681 obj.match = ofp.match.unpack(reader)
10682 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10683 return obj
10684
10685 def __eq__(self, other):
10686 if type(self) != type(other): return False
10687 if self.xid != other.xid: return False
10688 if self.cookie != other.cookie: return False
10689 if self.cookie_mask != other.cookie_mask: return False
10690 if self.table_id != other.table_id: return False
10691 if self.idle_timeout != other.idle_timeout: return False
10692 if self.hard_timeout != other.hard_timeout: return False
10693 if self.priority != other.priority: return False
10694 if self.buffer_id != other.buffer_id: return False
10695 if self.out_port != other.out_port: return False
10696 if self.out_group != other.out_group: return False
10697 if self.flags != other.flags: return False
10698 if self.importance != other.importance: return False
10699 if self.match != other.match: return False
10700 if self.instructions != other.instructions: return False
10701 return True
10702
10703 def pretty_print(self, q):
10704 q.text("flow_delete {")
10705 with q.group():
10706 with q.indent(2):
10707 q.breakable()
10708 q.text("xid = ");
10709 if self.xid != None:
10710 q.text("%#x" % self.xid)
10711 else:
10712 q.text('None')
10713 q.text(","); q.breakable()
10714 q.text("cookie = ");
10715 q.text("%#x" % self.cookie)
10716 q.text(","); q.breakable()
10717 q.text("cookie_mask = ");
10718 q.text("%#x" % self.cookie_mask)
10719 q.text(","); q.breakable()
10720 q.text("table_id = ");
10721 q.text("%#x" % self.table_id)
10722 q.text(","); q.breakable()
10723 q.text("idle_timeout = ");
10724 q.text("%#x" % self.idle_timeout)
10725 q.text(","); q.breakable()
10726 q.text("hard_timeout = ");
10727 q.text("%#x" % self.hard_timeout)
10728 q.text(","); q.breakable()
10729 q.text("priority = ");
10730 q.text("%#x" % self.priority)
10731 q.text(","); q.breakable()
10732 q.text("buffer_id = ");
10733 q.text("%#x" % self.buffer_id)
10734 q.text(","); q.breakable()
10735 q.text("out_port = ");
10736 q.text(util.pretty_port(self.out_port))
10737 q.text(","); q.breakable()
10738 q.text("out_group = ");
10739 q.text("%#x" % self.out_group)
10740 q.text(","); q.breakable()
10741 q.text("flags = ");
10742 q.text("%#x" % self.flags)
10743 q.text(","); q.breakable()
10744 q.text("importance = ");
10745 q.text("%#x" % self.importance)
10746 q.text(","); q.breakable()
10747 q.text("match = ");
10748 q.pp(self.match)
10749 q.text(","); q.breakable()
10750 q.text("instructions = ");
10751 q.pp(self.instructions)
10752 q.breakable()
10753 q.text('}')
10754
10755flow_mod.subtypes[3] = flow_delete
10756
10757class flow_delete_strict(flow_mod):
10758 version = 5
10759 type = 14
10760 _command = 4
10761
10762 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):
10763 if xid != None:
10764 self.xid = xid
10765 else:
10766 self.xid = None
10767 if cookie != None:
10768 self.cookie = cookie
10769 else:
10770 self.cookie = 0
10771 if cookie_mask != None:
10772 self.cookie_mask = cookie_mask
10773 else:
10774 self.cookie_mask = 0
10775 if table_id != None:
10776 self.table_id = table_id
10777 else:
10778 self.table_id = 0
10779 if idle_timeout != None:
10780 self.idle_timeout = idle_timeout
10781 else:
10782 self.idle_timeout = 0
10783 if hard_timeout != None:
10784 self.hard_timeout = hard_timeout
10785 else:
10786 self.hard_timeout = 0
10787 if priority != None:
10788 self.priority = priority
10789 else:
10790 self.priority = 0
10791 if buffer_id != None:
10792 self.buffer_id = buffer_id
10793 else:
10794 self.buffer_id = 0
10795 if out_port != None:
10796 self.out_port = out_port
10797 else:
10798 self.out_port = 0
10799 if out_group != None:
10800 self.out_group = out_group
10801 else:
10802 self.out_group = 0
10803 if flags != None:
10804 self.flags = flags
10805 else:
10806 self.flags = 0
10807 if importance != None:
10808 self.importance = importance
10809 else:
10810 self.importance = 0
10811 if match != None:
10812 self.match = match
10813 else:
10814 self.match = ofp.match()
10815 if instructions != None:
10816 self.instructions = instructions
10817 else:
10818 self.instructions = []
10819 return
10820
10821 def pack(self):
10822 packed = []
10823 packed.append(struct.pack("!B", self.version))
10824 packed.append(struct.pack("!B", self.type))
10825 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10826 packed.append(struct.pack("!L", self.xid))
10827 packed.append(struct.pack("!Q", self.cookie))
10828 packed.append(struct.pack("!Q", self.cookie_mask))
10829 packed.append(struct.pack("!B", self.table_id))
10830 packed.append(util.pack_fm_cmd(self._command))
10831 packed.append(struct.pack("!H", self.idle_timeout))
10832 packed.append(struct.pack("!H", self.hard_timeout))
10833 packed.append(struct.pack("!H", self.priority))
10834 packed.append(struct.pack("!L", self.buffer_id))
10835 packed.append(util.pack_port_no(self.out_port))
10836 packed.append(struct.pack("!L", self.out_group))
10837 packed.append(struct.pack("!H", self.flags))
10838 packed.append(struct.pack("!H", self.importance))
10839 packed.append(self.match.pack())
10840 packed.append(loxi.generic_util.pack_list(self.instructions))
10841 length = sum([len(x) for x in packed])
10842 packed[2] = struct.pack("!H", length)
10843 return ''.join(packed)
10844
10845 @staticmethod
10846 def unpack(reader):
10847 obj = flow_delete_strict()
10848 _version = reader.read("!B")[0]
10849 assert(_version == 5)
10850 _type = reader.read("!B")[0]
10851 assert(_type == 14)
10852 _length = reader.read("!H")[0]
10853 orig_reader = reader
10854 reader = orig_reader.slice(_length, 4)
10855 obj.xid = reader.read("!L")[0]
10856 obj.cookie = reader.read("!Q")[0]
10857 obj.cookie_mask = reader.read("!Q")[0]
10858 obj.table_id = reader.read("!B")[0]
10859 __command = util.unpack_fm_cmd(reader)
10860 assert(__command == 4)
10861 obj.idle_timeout = reader.read("!H")[0]
10862 obj.hard_timeout = reader.read("!H")[0]
10863 obj.priority = reader.read("!H")[0]
10864 obj.buffer_id = reader.read("!L")[0]
10865 obj.out_port = util.unpack_port_no(reader)
10866 obj.out_group = reader.read("!L")[0]
10867 obj.flags = reader.read("!H")[0]
10868 obj.importance = reader.read("!H")[0]
10869 obj.match = ofp.match.unpack(reader)
10870 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10871 return obj
10872
10873 def __eq__(self, other):
10874 if type(self) != type(other): return False
10875 if self.xid != other.xid: return False
10876 if self.cookie != other.cookie: return False
10877 if self.cookie_mask != other.cookie_mask: return False
10878 if self.table_id != other.table_id: return False
10879 if self.idle_timeout != other.idle_timeout: return False
10880 if self.hard_timeout != other.hard_timeout: return False
10881 if self.priority != other.priority: return False
10882 if self.buffer_id != other.buffer_id: return False
10883 if self.out_port != other.out_port: return False
10884 if self.out_group != other.out_group: return False
10885 if self.flags != other.flags: return False
10886 if self.importance != other.importance: return False
10887 if self.match != other.match: return False
10888 if self.instructions != other.instructions: return False
10889 return True
10890
10891 def pretty_print(self, q):
10892 q.text("flow_delete_strict {")
10893 with q.group():
10894 with q.indent(2):
10895 q.breakable()
10896 q.text("xid = ");
10897 if self.xid != None:
10898 q.text("%#x" % self.xid)
10899 else:
10900 q.text('None')
10901 q.text(","); q.breakable()
10902 q.text("cookie = ");
10903 q.text("%#x" % self.cookie)
10904 q.text(","); q.breakable()
10905 q.text("cookie_mask = ");
10906 q.text("%#x" % self.cookie_mask)
10907 q.text(","); q.breakable()
10908 q.text("table_id = ");
10909 q.text("%#x" % self.table_id)
10910 q.text(","); q.breakable()
10911 q.text("idle_timeout = ");
10912 q.text("%#x" % self.idle_timeout)
10913 q.text(","); q.breakable()
10914 q.text("hard_timeout = ");
10915 q.text("%#x" % self.hard_timeout)
10916 q.text(","); q.breakable()
10917 q.text("priority = ");
10918 q.text("%#x" % self.priority)
10919 q.text(","); q.breakable()
10920 q.text("buffer_id = ");
10921 q.text("%#x" % self.buffer_id)
10922 q.text(","); q.breakable()
10923 q.text("out_port = ");
10924 q.text(util.pretty_port(self.out_port))
10925 q.text(","); q.breakable()
10926 q.text("out_group = ");
10927 q.text("%#x" % self.out_group)
10928 q.text(","); q.breakable()
10929 q.text("flags = ");
10930 q.text("%#x" % self.flags)
10931 q.text(","); q.breakable()
10932 q.text("importance = ");
10933 q.text("%#x" % self.importance)
10934 q.text(","); q.breakable()
10935 q.text("match = ");
10936 q.pp(self.match)
10937 q.text(","); q.breakable()
10938 q.text("instructions = ");
10939 q.pp(self.instructions)
10940 q.breakable()
10941 q.text('}')
10942
10943flow_mod.subtypes[4] = flow_delete_strict
10944
10945class flow_mod_failed_error_msg(error_msg):
10946 version = 5
10947 type = 1
10948 err_type = 5
10949
10950 def __init__(self, xid=None, code=None, data=None):
10951 if xid != None:
10952 self.xid = xid
10953 else:
10954 self.xid = None
10955 if code != None:
10956 self.code = code
10957 else:
10958 self.code = 0
10959 if data != None:
10960 self.data = data
10961 else:
10962 self.data = ''
10963 return
10964
10965 def pack(self):
10966 packed = []
10967 packed.append(struct.pack("!B", self.version))
10968 packed.append(struct.pack("!B", self.type))
10969 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10970 packed.append(struct.pack("!L", self.xid))
10971 packed.append(struct.pack("!H", self.err_type))
10972 packed.append(struct.pack("!H", self.code))
10973 packed.append(self.data)
10974 length = sum([len(x) for x in packed])
10975 packed[2] = struct.pack("!H", length)
10976 return ''.join(packed)
10977
10978 @staticmethod
10979 def unpack(reader):
10980 obj = flow_mod_failed_error_msg()
10981 _version = reader.read("!B")[0]
10982 assert(_version == 5)
10983 _type = reader.read("!B")[0]
10984 assert(_type == 1)
10985 _length = reader.read("!H")[0]
10986 orig_reader = reader
10987 reader = orig_reader.slice(_length, 4)
10988 obj.xid = reader.read("!L")[0]
10989 _err_type = reader.read("!H")[0]
10990 assert(_err_type == 5)
10991 obj.code = reader.read("!H")[0]
10992 obj.data = str(reader.read_all())
10993 return obj
10994
10995 def __eq__(self, other):
10996 if type(self) != type(other): return False
10997 if self.xid != other.xid: return False
10998 if self.code != other.code: return False
10999 if self.data != other.data: return False
11000 return True
11001
11002 def pretty_print(self, q):
11003 q.text("flow_mod_failed_error_msg {")
11004 with q.group():
11005 with q.indent(2):
11006 q.breakable()
11007 q.text("xid = ");
11008 if self.xid != None:
11009 q.text("%#x" % self.xid)
11010 else:
11011 q.text('None')
11012 q.text(","); q.breakable()
11013 q.text("code = ");
11014 q.text("%#x" % self.code)
11015 q.text(","); q.breakable()
11016 q.text("data = ");
11017 q.pp(self.data)
11018 q.breakable()
11019 q.text('}')
11020
11021error_msg.subtypes[5] = flow_mod_failed_error_msg
11022
11023class flow_modify(flow_mod):
11024 version = 5
11025 type = 14
11026 _command = 1
11027
11028 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):
11029 if xid != None:
11030 self.xid = xid
11031 else:
11032 self.xid = None
11033 if cookie != None:
11034 self.cookie = cookie
11035 else:
11036 self.cookie = 0
11037 if cookie_mask != None:
11038 self.cookie_mask = cookie_mask
11039 else:
11040 self.cookie_mask = 0
11041 if table_id != None:
11042 self.table_id = table_id
11043 else:
11044 self.table_id = 0
11045 if idle_timeout != None:
11046 self.idle_timeout = idle_timeout
11047 else:
11048 self.idle_timeout = 0
11049 if hard_timeout != None:
11050 self.hard_timeout = hard_timeout
11051 else:
11052 self.hard_timeout = 0
11053 if priority != None:
11054 self.priority = priority
11055 else:
11056 self.priority = 0
11057 if buffer_id != None:
11058 self.buffer_id = buffer_id
11059 else:
11060 self.buffer_id = 0
11061 if out_port != None:
11062 self.out_port = out_port
11063 else:
11064 self.out_port = 0
11065 if out_group != None:
11066 self.out_group = out_group
11067 else:
11068 self.out_group = 0
11069 if flags != None:
11070 self.flags = flags
11071 else:
11072 self.flags = 0
11073 if importance != None:
11074 self.importance = importance
11075 else:
11076 self.importance = 0
11077 if match != None:
11078 self.match = match
11079 else:
11080 self.match = ofp.match()
11081 if instructions != None:
11082 self.instructions = instructions
11083 else:
11084 self.instructions = []
11085 return
11086
11087 def pack(self):
11088 packed = []
11089 packed.append(struct.pack("!B", self.version))
11090 packed.append(struct.pack("!B", self.type))
11091 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11092 packed.append(struct.pack("!L", self.xid))
11093 packed.append(struct.pack("!Q", self.cookie))
11094 packed.append(struct.pack("!Q", self.cookie_mask))
11095 packed.append(struct.pack("!B", self.table_id))
11096 packed.append(util.pack_fm_cmd(self._command))
11097 packed.append(struct.pack("!H", self.idle_timeout))
11098 packed.append(struct.pack("!H", self.hard_timeout))
11099 packed.append(struct.pack("!H", self.priority))
11100 packed.append(struct.pack("!L", self.buffer_id))
11101 packed.append(util.pack_port_no(self.out_port))
11102 packed.append(struct.pack("!L", self.out_group))
11103 packed.append(struct.pack("!H", self.flags))
11104 packed.append(struct.pack("!H", self.importance))
11105 packed.append(self.match.pack())
11106 packed.append(loxi.generic_util.pack_list(self.instructions))
11107 length = sum([len(x) for x in packed])
11108 packed[2] = struct.pack("!H", length)
11109 return ''.join(packed)
11110
11111 @staticmethod
11112 def unpack(reader):
11113 obj = flow_modify()
11114 _version = reader.read("!B")[0]
11115 assert(_version == 5)
11116 _type = reader.read("!B")[0]
11117 assert(_type == 14)
11118 _length = reader.read("!H")[0]
11119 orig_reader = reader
11120 reader = orig_reader.slice(_length, 4)
11121 obj.xid = reader.read("!L")[0]
11122 obj.cookie = reader.read("!Q")[0]
11123 obj.cookie_mask = reader.read("!Q")[0]
11124 obj.table_id = reader.read("!B")[0]
11125 __command = util.unpack_fm_cmd(reader)
11126 assert(__command == 1)
11127 obj.idle_timeout = reader.read("!H")[0]
11128 obj.hard_timeout = reader.read("!H")[0]
11129 obj.priority = reader.read("!H")[0]
11130 obj.buffer_id = reader.read("!L")[0]
11131 obj.out_port = util.unpack_port_no(reader)
11132 obj.out_group = reader.read("!L")[0]
11133 obj.flags = reader.read("!H")[0]
11134 obj.importance = reader.read("!H")[0]
11135 obj.match = ofp.match.unpack(reader)
11136 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
11137 return obj
11138
11139 def __eq__(self, other):
11140 if type(self) != type(other): return False
11141 if self.xid != other.xid: return False
11142 if self.cookie != other.cookie: return False
11143 if self.cookie_mask != other.cookie_mask: return False
11144 if self.table_id != other.table_id: return False
11145 if self.idle_timeout != other.idle_timeout: return False
11146 if self.hard_timeout != other.hard_timeout: return False
11147 if self.priority != other.priority: return False
11148 if self.buffer_id != other.buffer_id: return False
11149 if self.out_port != other.out_port: return False
11150 if self.out_group != other.out_group: return False
11151 if self.flags != other.flags: return False
11152 if self.importance != other.importance: return False
11153 if self.match != other.match: return False
11154 if self.instructions != other.instructions: return False
11155 return True
11156
11157 def pretty_print(self, q):
11158 q.text("flow_modify {")
11159 with q.group():
11160 with q.indent(2):
11161 q.breakable()
11162 q.text("xid = ");
11163 if self.xid != None:
11164 q.text("%#x" % self.xid)
11165 else:
11166 q.text('None')
11167 q.text(","); q.breakable()
11168 q.text("cookie = ");
11169 q.text("%#x" % self.cookie)
11170 q.text(","); q.breakable()
11171 q.text("cookie_mask = ");
11172 q.text("%#x" % self.cookie_mask)
11173 q.text(","); q.breakable()
11174 q.text("table_id = ");
11175 q.text("%#x" % self.table_id)
11176 q.text(","); q.breakable()
11177 q.text("idle_timeout = ");
11178 q.text("%#x" % self.idle_timeout)
11179 q.text(","); q.breakable()
11180 q.text("hard_timeout = ");
11181 q.text("%#x" % self.hard_timeout)
11182 q.text(","); q.breakable()
11183 q.text("priority = ");
11184 q.text("%#x" % self.priority)
11185 q.text(","); q.breakable()
11186 q.text("buffer_id = ");
11187 q.text("%#x" % self.buffer_id)
11188 q.text(","); q.breakable()
11189 q.text("out_port = ");
11190 q.text(util.pretty_port(self.out_port))
11191 q.text(","); q.breakable()
11192 q.text("out_group = ");
11193 q.text("%#x" % self.out_group)
11194 q.text(","); q.breakable()
11195 q.text("flags = ");
11196 q.text("%#x" % self.flags)
11197 q.text(","); q.breakable()
11198 q.text("importance = ");
11199 q.text("%#x" % self.importance)
11200 q.text(","); q.breakable()
11201 q.text("match = ");
11202 q.pp(self.match)
11203 q.text(","); q.breakable()
11204 q.text("instructions = ");
11205 q.pp(self.instructions)
11206 q.breakable()
11207 q.text('}')
11208
11209flow_mod.subtypes[1] = flow_modify
11210
11211class flow_modify_strict(flow_mod):
11212 version = 5
11213 type = 14
11214 _command = 2
11215
11216 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):
11217 if xid != None:
11218 self.xid = xid
11219 else:
11220 self.xid = None
11221 if cookie != None:
11222 self.cookie = cookie
11223 else:
11224 self.cookie = 0
11225 if cookie_mask != None:
11226 self.cookie_mask = cookie_mask
11227 else:
11228 self.cookie_mask = 0
11229 if table_id != None:
11230 self.table_id = table_id
11231 else:
11232 self.table_id = 0
11233 if idle_timeout != None:
11234 self.idle_timeout = idle_timeout
11235 else:
11236 self.idle_timeout = 0
11237 if hard_timeout != None:
11238 self.hard_timeout = hard_timeout
11239 else:
11240 self.hard_timeout = 0
11241 if priority != None:
11242 self.priority = priority
11243 else:
11244 self.priority = 0
11245 if buffer_id != None:
11246 self.buffer_id = buffer_id
11247 else:
11248 self.buffer_id = 0
11249 if out_port != None:
11250 self.out_port = out_port
11251 else:
11252 self.out_port = 0
11253 if out_group != None:
11254 self.out_group = out_group
11255 else:
11256 self.out_group = 0
11257 if flags != None:
11258 self.flags = flags
11259 else:
11260 self.flags = 0
11261 if importance != None:
11262 self.importance = importance
11263 else:
11264 self.importance = 0
11265 if match != None:
11266 self.match = match
11267 else:
11268 self.match = ofp.match()
11269 if instructions != None:
11270 self.instructions = instructions
11271 else:
11272 self.instructions = []
11273 return
11274
11275 def pack(self):
11276 packed = []
11277 packed.append(struct.pack("!B", self.version))
11278 packed.append(struct.pack("!B", self.type))
11279 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11280 packed.append(struct.pack("!L", self.xid))
11281 packed.append(struct.pack("!Q", self.cookie))
11282 packed.append(struct.pack("!Q", self.cookie_mask))
11283 packed.append(struct.pack("!B", self.table_id))
11284 packed.append(util.pack_fm_cmd(self._command))
11285 packed.append(struct.pack("!H", self.idle_timeout))
11286 packed.append(struct.pack("!H", self.hard_timeout))
11287 packed.append(struct.pack("!H", self.priority))
11288 packed.append(struct.pack("!L", self.buffer_id))
11289 packed.append(util.pack_port_no(self.out_port))
11290 packed.append(struct.pack("!L", self.out_group))
11291 packed.append(struct.pack("!H", self.flags))
11292 packed.append(struct.pack("!H", self.importance))
11293 packed.append(self.match.pack())
11294 packed.append(loxi.generic_util.pack_list(self.instructions))
11295 length = sum([len(x) for x in packed])
11296 packed[2] = struct.pack("!H", length)
11297 return ''.join(packed)
11298
11299 @staticmethod
11300 def unpack(reader):
11301 obj = flow_modify_strict()
11302 _version = reader.read("!B")[0]
11303 assert(_version == 5)
11304 _type = reader.read("!B")[0]
11305 assert(_type == 14)
11306 _length = reader.read("!H")[0]
11307 orig_reader = reader
11308 reader = orig_reader.slice(_length, 4)
11309 obj.xid = reader.read("!L")[0]
11310 obj.cookie = reader.read("!Q")[0]
11311 obj.cookie_mask = reader.read("!Q")[0]
11312 obj.table_id = reader.read("!B")[0]
11313 __command = util.unpack_fm_cmd(reader)
11314 assert(__command == 2)
11315 obj.idle_timeout = reader.read("!H")[0]
11316 obj.hard_timeout = reader.read("!H")[0]
11317 obj.priority = reader.read("!H")[0]
11318 obj.buffer_id = reader.read("!L")[0]
11319 obj.out_port = util.unpack_port_no(reader)
11320 obj.out_group = reader.read("!L")[0]
11321 obj.flags = reader.read("!H")[0]
11322 obj.importance = reader.read("!H")[0]
11323 obj.match = ofp.match.unpack(reader)
11324 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
11325 return obj
11326
11327 def __eq__(self, other):
11328 if type(self) != type(other): return False
11329 if self.xid != other.xid: return False
11330 if self.cookie != other.cookie: return False
11331 if self.cookie_mask != other.cookie_mask: return False
11332 if self.table_id != other.table_id: return False
11333 if self.idle_timeout != other.idle_timeout: return False
11334 if self.hard_timeout != other.hard_timeout: return False
11335 if self.priority != other.priority: return False
11336 if self.buffer_id != other.buffer_id: return False
11337 if self.out_port != other.out_port: return False
11338 if self.out_group != other.out_group: return False
11339 if self.flags != other.flags: return False
11340 if self.importance != other.importance: return False
11341 if self.match != other.match: return False
11342 if self.instructions != other.instructions: return False
11343 return True
11344
11345 def pretty_print(self, q):
11346 q.text("flow_modify_strict {")
11347 with q.group():
11348 with q.indent(2):
11349 q.breakable()
11350 q.text("xid = ");
11351 if self.xid != None:
11352 q.text("%#x" % self.xid)
11353 else:
11354 q.text('None')
11355 q.text(","); q.breakable()
11356 q.text("cookie = ");
11357 q.text("%#x" % self.cookie)
11358 q.text(","); q.breakable()
11359 q.text("cookie_mask = ");
11360 q.text("%#x" % self.cookie_mask)
11361 q.text(","); q.breakable()
11362 q.text("table_id = ");
11363 q.text("%#x" % self.table_id)
11364 q.text(","); q.breakable()
11365 q.text("idle_timeout = ");
11366 q.text("%#x" % self.idle_timeout)
11367 q.text(","); q.breakable()
11368 q.text("hard_timeout = ");
11369 q.text("%#x" % self.hard_timeout)
11370 q.text(","); q.breakable()
11371 q.text("priority = ");
11372 q.text("%#x" % self.priority)
11373 q.text(","); q.breakable()
11374 q.text("buffer_id = ");
11375 q.text("%#x" % self.buffer_id)
11376 q.text(","); q.breakable()
11377 q.text("out_port = ");
11378 q.text(util.pretty_port(self.out_port))
11379 q.text(","); q.breakable()
11380 q.text("out_group = ");
11381 q.text("%#x" % self.out_group)
11382 q.text(","); q.breakable()
11383 q.text("flags = ");
11384 q.text("%#x" % self.flags)
11385 q.text(","); q.breakable()
11386 q.text("importance = ");
11387 q.text("%#x" % self.importance)
11388 q.text(","); q.breakable()
11389 q.text("match = ");
11390 q.pp(self.match)
11391 q.text(","); q.breakable()
11392 q.text("instructions = ");
11393 q.pp(self.instructions)
11394 q.breakable()
11395 q.text('}')
11396
11397flow_mod.subtypes[2] = flow_modify_strict
11398
11399class flow_monitor_failed_error_msg(error_msg):
11400 version = 5
11401 type = 1
11402 err_type = 16
11403
11404 def __init__(self, xid=None, code=None, data=None):
11405 if xid != None:
11406 self.xid = xid
11407 else:
11408 self.xid = None
11409 if code != None:
11410 self.code = code
11411 else:
11412 self.code = 0
11413 if data != None:
11414 self.data = data
11415 else:
11416 self.data = ''
11417 return
11418
11419 def pack(self):
11420 packed = []
11421 packed.append(struct.pack("!B", self.version))
11422 packed.append(struct.pack("!B", self.type))
11423 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11424 packed.append(struct.pack("!L", self.xid))
11425 packed.append(struct.pack("!H", self.err_type))
11426 packed.append(struct.pack("!H", self.code))
11427 packed.append(self.data)
11428 length = sum([len(x) for x in packed])
11429 packed[2] = struct.pack("!H", length)
11430 return ''.join(packed)
11431
11432 @staticmethod
11433 def unpack(reader):
11434 obj = flow_monitor_failed_error_msg()
11435 _version = reader.read("!B")[0]
11436 assert(_version == 5)
11437 _type = reader.read("!B")[0]
11438 assert(_type == 1)
11439 _length = reader.read("!H")[0]
11440 orig_reader = reader
11441 reader = orig_reader.slice(_length, 4)
11442 obj.xid = reader.read("!L")[0]
11443 _err_type = reader.read("!H")[0]
11444 assert(_err_type == 16)
11445 obj.code = reader.read("!H")[0]
11446 obj.data = str(reader.read_all())
11447 return obj
11448
11449 def __eq__(self, other):
11450 if type(self) != type(other): return False
11451 if self.xid != other.xid: return False
11452 if self.code != other.code: return False
11453 if self.data != other.data: return False
11454 return True
11455
11456 def pretty_print(self, q):
11457 q.text("flow_monitor_failed_error_msg {")
11458 with q.group():
11459 with q.indent(2):
11460 q.breakable()
11461 q.text("xid = ");
11462 if self.xid != None:
11463 q.text("%#x" % self.xid)
11464 else:
11465 q.text('None')
11466 q.text(","); q.breakable()
11467 q.text("code = ");
11468 q.text("%#x" % self.code)
11469 q.text(","); q.breakable()
11470 q.text("data = ");
11471 q.pp(self.data)
11472 q.breakable()
11473 q.text('}')
11474
11475error_msg.subtypes[16] = flow_monitor_failed_error_msg
11476
11477class flow_removed(message):
11478 version = 5
11479 type = 11
11480
11481 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):
11482 if xid != None:
11483 self.xid = xid
11484 else:
11485 self.xid = None
11486 if cookie != None:
11487 self.cookie = cookie
11488 else:
11489 self.cookie = 0
11490 if priority != None:
11491 self.priority = priority
11492 else:
11493 self.priority = 0
11494 if reason != None:
11495 self.reason = reason
11496 else:
11497 self.reason = 0
11498 if table_id != None:
11499 self.table_id = table_id
11500 else:
11501 self.table_id = 0
11502 if duration_sec != None:
11503 self.duration_sec = duration_sec
11504 else:
11505 self.duration_sec = 0
11506 if duration_nsec != None:
11507 self.duration_nsec = duration_nsec
11508 else:
11509 self.duration_nsec = 0
11510 if idle_timeout != None:
11511 self.idle_timeout = idle_timeout
11512 else:
11513 self.idle_timeout = 0
11514 if hard_timeout != None:
11515 self.hard_timeout = hard_timeout
11516 else:
11517 self.hard_timeout = 0
11518 if packet_count != None:
11519 self.packet_count = packet_count
11520 else:
11521 self.packet_count = 0
11522 if byte_count != None:
11523 self.byte_count = byte_count
11524 else:
11525 self.byte_count = 0
11526 if match != None:
11527 self.match = match
11528 else:
11529 self.match = ofp.match()
11530 return
11531
11532 def pack(self):
11533 packed = []
11534 packed.append(struct.pack("!B", self.version))
11535 packed.append(struct.pack("!B", self.type))
11536 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11537 packed.append(struct.pack("!L", self.xid))
11538 packed.append(struct.pack("!Q", self.cookie))
11539 packed.append(struct.pack("!H", self.priority))
11540 packed.append(struct.pack("!B", self.reason))
11541 packed.append(struct.pack("!B", self.table_id))
11542 packed.append(struct.pack("!L", self.duration_sec))
11543 packed.append(struct.pack("!L", self.duration_nsec))
11544 packed.append(struct.pack("!H", self.idle_timeout))
11545 packed.append(struct.pack("!H", self.hard_timeout))
11546 packed.append(struct.pack("!Q", self.packet_count))
11547 packed.append(struct.pack("!Q", self.byte_count))
11548 packed.append(self.match.pack())
11549 length = sum([len(x) for x in packed])
11550 packed[2] = struct.pack("!H", length)
11551 return ''.join(packed)
11552
11553 @staticmethod
11554 def unpack(reader):
11555 obj = flow_removed()
11556 _version = reader.read("!B")[0]
11557 assert(_version == 5)
11558 _type = reader.read("!B")[0]
11559 assert(_type == 11)
11560 _length = reader.read("!H")[0]
11561 orig_reader = reader
11562 reader = orig_reader.slice(_length, 4)
11563 obj.xid = reader.read("!L")[0]
11564 obj.cookie = reader.read("!Q")[0]
11565 obj.priority = reader.read("!H")[0]
11566 obj.reason = reader.read("!B")[0]
11567 obj.table_id = reader.read("!B")[0]
11568 obj.duration_sec = reader.read("!L")[0]
11569 obj.duration_nsec = reader.read("!L")[0]
11570 obj.idle_timeout = reader.read("!H")[0]
11571 obj.hard_timeout = reader.read("!H")[0]
11572 obj.packet_count = reader.read("!Q")[0]
11573 obj.byte_count = reader.read("!Q")[0]
11574 obj.match = ofp.match.unpack(reader)
11575 return obj
11576
11577 def __eq__(self, other):
11578 if type(self) != type(other): return False
11579 if self.xid != other.xid: return False
11580 if self.cookie != other.cookie: return False
11581 if self.priority != other.priority: return False
11582 if self.reason != other.reason: return False
11583 if self.table_id != other.table_id: return False
11584 if self.duration_sec != other.duration_sec: return False
11585 if self.duration_nsec != other.duration_nsec: return False
11586 if self.idle_timeout != other.idle_timeout: return False
11587 if self.hard_timeout != other.hard_timeout: return False
11588 if self.packet_count != other.packet_count: return False
11589 if self.byte_count != other.byte_count: return False
11590 if self.match != other.match: return False
11591 return True
11592
11593 def pretty_print(self, q):
11594 q.text("flow_removed {")
11595 with q.group():
11596 with q.indent(2):
11597 q.breakable()
11598 q.text("xid = ");
11599 if self.xid != None:
11600 q.text("%#x" % self.xid)
11601 else:
11602 q.text('None')
11603 q.text(","); q.breakable()
11604 q.text("cookie = ");
11605 q.text("%#x" % self.cookie)
11606 q.text(","); q.breakable()
11607 q.text("priority = ");
11608 q.text("%#x" % self.priority)
11609 q.text(","); q.breakable()
11610 q.text("reason = ");
11611 q.text("%#x" % self.reason)
11612 q.text(","); q.breakable()
11613 q.text("table_id = ");
11614 q.text("%#x" % self.table_id)
11615 q.text(","); q.breakable()
11616 q.text("duration_sec = ");
11617 q.text("%#x" % self.duration_sec)
11618 q.text(","); q.breakable()
11619 q.text("duration_nsec = ");
11620 q.text("%#x" % self.duration_nsec)
11621 q.text(","); q.breakable()
11622 q.text("idle_timeout = ");
11623 q.text("%#x" % self.idle_timeout)
11624 q.text(","); q.breakable()
11625 q.text("hard_timeout = ");
11626 q.text("%#x" % self.hard_timeout)
11627 q.text(","); q.breakable()
11628 q.text("packet_count = ");
11629 q.text("%#x" % self.packet_count)
11630 q.text(","); q.breakable()
11631 q.text("byte_count = ");
11632 q.text("%#x" % self.byte_count)
11633 q.text(","); q.breakable()
11634 q.text("match = ");
11635 q.pp(self.match)
11636 q.breakable()
11637 q.text('}')
11638
11639message.subtypes[11] = flow_removed
11640
11641class flow_stats_reply(stats_reply):
11642 version = 5
11643 type = 19
11644 stats_type = 1
11645
11646 def __init__(self, xid=None, flags=None, entries=None):
11647 if xid != None:
11648 self.xid = xid
11649 else:
11650 self.xid = None
11651 if flags != None:
11652 self.flags = flags
11653 else:
11654 self.flags = 0
11655 if entries != None:
11656 self.entries = entries
11657 else:
11658 self.entries = []
11659 return
11660
11661 def pack(self):
11662 packed = []
11663 packed.append(struct.pack("!B", self.version))
11664 packed.append(struct.pack("!B", self.type))
11665 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11666 packed.append(struct.pack("!L", self.xid))
11667 packed.append(struct.pack("!H", self.stats_type))
11668 packed.append(struct.pack("!H", self.flags))
11669 packed.append('\x00' * 4)
11670 packed.append(loxi.generic_util.pack_list(self.entries))
11671 length = sum([len(x) for x in packed])
11672 packed[2] = struct.pack("!H", length)
11673 return ''.join(packed)
11674
11675 @staticmethod
11676 def unpack(reader):
11677 obj = flow_stats_reply()
11678 _version = reader.read("!B")[0]
11679 assert(_version == 5)
11680 _type = reader.read("!B")[0]
11681 assert(_type == 19)
11682 _length = reader.read("!H")[0]
11683 orig_reader = reader
11684 reader = orig_reader.slice(_length, 4)
11685 obj.xid = reader.read("!L")[0]
11686 _stats_type = reader.read("!H")[0]
11687 assert(_stats_type == 1)
11688 obj.flags = reader.read("!H")[0]
11689 reader.skip(4)
11690 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
11691 return obj
11692
11693 def __eq__(self, other):
11694 if type(self) != type(other): return False
11695 if self.xid != other.xid: return False
11696 if self.flags != other.flags: return False
11697 if self.entries != other.entries: return False
11698 return True
11699
11700 def pretty_print(self, q):
11701 q.text("flow_stats_reply {")
11702 with q.group():
11703 with q.indent(2):
11704 q.breakable()
11705 q.text("xid = ");
11706 if self.xid != None:
11707 q.text("%#x" % self.xid)
11708 else:
11709 q.text('None')
11710 q.text(","); q.breakable()
11711 q.text("flags = ");
11712 q.text("%#x" % self.flags)
11713 q.text(","); q.breakable()
11714 q.text("entries = ");
11715 q.pp(self.entries)
11716 q.breakable()
11717 q.text('}')
11718
11719stats_reply.subtypes[1] = flow_stats_reply
11720
11721class flow_stats_request(stats_request):
11722 version = 5
11723 type = 18
11724 stats_type = 1
11725
11726 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
11727 if xid != None:
11728 self.xid = xid
11729 else:
11730 self.xid = None
11731 if flags != None:
11732 self.flags = flags
11733 else:
11734 self.flags = 0
11735 if table_id != None:
11736 self.table_id = table_id
11737 else:
11738 self.table_id = 0
11739 if out_port != None:
11740 self.out_port = out_port
11741 else:
11742 self.out_port = 0
11743 if out_group != None:
11744 self.out_group = out_group
11745 else:
11746 self.out_group = 0
11747 if cookie != None:
11748 self.cookie = cookie
11749 else:
11750 self.cookie = 0
11751 if cookie_mask != None:
11752 self.cookie_mask = cookie_mask
11753 else:
11754 self.cookie_mask = 0
11755 if match != None:
11756 self.match = match
11757 else:
11758 self.match = ofp.match()
11759 return
11760
11761 def pack(self):
11762 packed = []
11763 packed.append(struct.pack("!B", self.version))
11764 packed.append(struct.pack("!B", self.type))
11765 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11766 packed.append(struct.pack("!L", self.xid))
11767 packed.append(struct.pack("!H", self.stats_type))
11768 packed.append(struct.pack("!H", self.flags))
11769 packed.append('\x00' * 4)
11770 packed.append(struct.pack("!B", self.table_id))
11771 packed.append('\x00' * 3)
11772 packed.append(util.pack_port_no(self.out_port))
11773 packed.append(struct.pack("!L", self.out_group))
11774 packed.append('\x00' * 4)
11775 packed.append(struct.pack("!Q", self.cookie))
11776 packed.append(struct.pack("!Q", self.cookie_mask))
11777 packed.append(self.match.pack())
11778 length = sum([len(x) for x in packed])
11779 packed[2] = struct.pack("!H", length)
11780 return ''.join(packed)
11781
11782 @staticmethod
11783 def unpack(reader):
11784 obj = flow_stats_request()
11785 _version = reader.read("!B")[0]
11786 assert(_version == 5)
11787 _type = reader.read("!B")[0]
11788 assert(_type == 18)
11789 _length = reader.read("!H")[0]
11790 orig_reader = reader
11791 reader = orig_reader.slice(_length, 4)
11792 obj.xid = reader.read("!L")[0]
11793 _stats_type = reader.read("!H")[0]
11794 assert(_stats_type == 1)
11795 obj.flags = reader.read("!H")[0]
11796 reader.skip(4)
11797 obj.table_id = reader.read("!B")[0]
11798 reader.skip(3)
11799 obj.out_port = util.unpack_port_no(reader)
11800 obj.out_group = reader.read("!L")[0]
11801 reader.skip(4)
11802 obj.cookie = reader.read("!Q")[0]
11803 obj.cookie_mask = reader.read("!Q")[0]
11804 obj.match = ofp.match.unpack(reader)
11805 return obj
11806
11807 def __eq__(self, other):
11808 if type(self) != type(other): return False
11809 if self.xid != other.xid: return False
11810 if self.flags != other.flags: return False
11811 if self.table_id != other.table_id: return False
11812 if self.out_port != other.out_port: return False
11813 if self.out_group != other.out_group: return False
11814 if self.cookie != other.cookie: return False
11815 if self.cookie_mask != other.cookie_mask: return False
11816 if self.match != other.match: return False
11817 return True
11818
11819 def pretty_print(self, q):
11820 q.text("flow_stats_request {")
11821 with q.group():
11822 with q.indent(2):
11823 q.breakable()
11824 q.text("xid = ");
11825 if self.xid != None:
11826 q.text("%#x" % self.xid)
11827 else:
11828 q.text('None')
11829 q.text(","); q.breakable()
11830 q.text("flags = ");
11831 q.text("%#x" % self.flags)
11832 q.text(","); q.breakable()
11833 q.text("table_id = ");
11834 q.text("%#x" % self.table_id)
11835 q.text(","); q.breakable()
11836 q.text("out_port = ");
11837 q.text(util.pretty_port(self.out_port))
11838 q.text(","); q.breakable()
11839 q.text("out_group = ");
11840 q.text("%#x" % self.out_group)
11841 q.text(","); q.breakable()
11842 q.text("cookie = ");
11843 q.text("%#x" % self.cookie)
11844 q.text(","); q.breakable()
11845 q.text("cookie_mask = ");
11846 q.text("%#x" % self.cookie_mask)
11847 q.text(","); q.breakable()
11848 q.text("match = ");
11849 q.pp(self.match)
11850 q.breakable()
11851 q.text('}')
11852
11853stats_request.subtypes[1] = flow_stats_request
11854
11855class get_config_reply(message):
11856 version = 5
11857 type = 8
11858
11859 def __init__(self, xid=None, flags=None, miss_send_len=None):
11860 if xid != None:
11861 self.xid = xid
11862 else:
11863 self.xid = None
11864 if flags != None:
11865 self.flags = flags
11866 else:
11867 self.flags = 0
11868 if miss_send_len != None:
11869 self.miss_send_len = miss_send_len
11870 else:
11871 self.miss_send_len = 0
11872 return
11873
11874 def pack(self):
11875 packed = []
11876 packed.append(struct.pack("!B", self.version))
11877 packed.append(struct.pack("!B", self.type))
11878 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11879 packed.append(struct.pack("!L", self.xid))
11880 packed.append(struct.pack("!H", self.flags))
11881 packed.append(struct.pack("!H", self.miss_send_len))
11882 length = sum([len(x) for x in packed])
11883 packed[2] = struct.pack("!H", length)
11884 return ''.join(packed)
11885
11886 @staticmethod
11887 def unpack(reader):
11888 obj = get_config_reply()
11889 _version = reader.read("!B")[0]
11890 assert(_version == 5)
11891 _type = reader.read("!B")[0]
11892 assert(_type == 8)
11893 _length = reader.read("!H")[0]
11894 orig_reader = reader
11895 reader = orig_reader.slice(_length, 4)
11896 obj.xid = reader.read("!L")[0]
11897 obj.flags = reader.read("!H")[0]
11898 obj.miss_send_len = reader.read("!H")[0]
11899 return obj
11900
11901 def __eq__(self, other):
11902 if type(self) != type(other): return False
11903 if self.xid != other.xid: return False
11904 if self.flags != other.flags: return False
11905 if self.miss_send_len != other.miss_send_len: return False
11906 return True
11907
11908 def pretty_print(self, q):
11909 q.text("get_config_reply {")
11910 with q.group():
11911 with q.indent(2):
11912 q.breakable()
11913 q.text("xid = ");
11914 if self.xid != None:
11915 q.text("%#x" % self.xid)
11916 else:
11917 q.text('None')
11918 q.text(","); q.breakable()
11919 q.text("flags = ");
11920 q.text("%#x" % self.flags)
11921 q.text(","); q.breakable()
11922 q.text("miss_send_len = ");
11923 q.text("%#x" % self.miss_send_len)
11924 q.breakable()
11925 q.text('}')
11926
11927message.subtypes[8] = get_config_reply
11928
11929class get_config_request(message):
11930 version = 5
11931 type = 7
11932
11933 def __init__(self, xid=None):
11934 if xid != None:
11935 self.xid = xid
11936 else:
11937 self.xid = None
11938 return
11939
11940 def pack(self):
11941 packed = []
11942 packed.append(struct.pack("!B", self.version))
11943 packed.append(struct.pack("!B", self.type))
11944 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11945 packed.append(struct.pack("!L", self.xid))
11946 length = sum([len(x) for x in packed])
11947 packed[2] = struct.pack("!H", length)
11948 return ''.join(packed)
11949
11950 @staticmethod
11951 def unpack(reader):
11952 obj = get_config_request()
11953 _version = reader.read("!B")[0]
11954 assert(_version == 5)
11955 _type = reader.read("!B")[0]
11956 assert(_type == 7)
11957 _length = reader.read("!H")[0]
11958 orig_reader = reader
11959 reader = orig_reader.slice(_length, 4)
11960 obj.xid = reader.read("!L")[0]
11961 return obj
11962
11963 def __eq__(self, other):
11964 if type(self) != type(other): return False
11965 if self.xid != other.xid: return False
11966 return True
11967
11968 def pretty_print(self, q):
11969 q.text("get_config_request {")
11970 with q.group():
11971 with q.indent(2):
11972 q.breakable()
11973 q.text("xid = ");
11974 if self.xid != None:
11975 q.text("%#x" % self.xid)
11976 else:
11977 q.text('None')
11978 q.breakable()
11979 q.text('}')
11980
11981message.subtypes[7] = get_config_request
11982
11983class group_mod(message):
11984 subtypes = {}
11985
11986 version = 5
11987 type = 15
11988
11989 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11990 if xid != None:
11991 self.xid = xid
11992 else:
11993 self.xid = None
11994 if command != None:
11995 self.command = command
11996 else:
11997 self.command = 0
11998 if group_type != None:
11999 self.group_type = group_type
12000 else:
12001 self.group_type = 0
12002 if group_id != None:
12003 self.group_id = group_id
12004 else:
12005 self.group_id = 0
12006 if buckets != None:
12007 self.buckets = buckets
12008 else:
12009 self.buckets = []
12010 return
12011
12012 def pack(self):
12013 packed = []
12014 packed.append(struct.pack("!B", self.version))
12015 packed.append(struct.pack("!B", self.type))
12016 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12017 packed.append(struct.pack("!L", self.xid))
12018 packed.append(struct.pack("!H", self.command))
12019 packed.append(struct.pack("!B", self.group_type))
12020 packed.append('\x00' * 1)
12021 packed.append(struct.pack("!L", self.group_id))
12022 packed.append(loxi.generic_util.pack_list(self.buckets))
12023 length = sum([len(x) for x in packed])
12024 packed[2] = struct.pack("!H", length)
12025 return ''.join(packed)
12026
12027 @staticmethod
12028 def unpack(reader):
12029 subtype, = reader.peek('!H', 8)
12030 subclass = group_mod.subtypes.get(subtype)
12031 if subclass:
12032 return subclass.unpack(reader)
12033
12034 obj = group_mod()
12035 _version = reader.read("!B")[0]
12036 assert(_version == 5)
12037 _type = reader.read("!B")[0]
12038 assert(_type == 15)
12039 _length = reader.read("!H")[0]
12040 orig_reader = reader
12041 reader = orig_reader.slice(_length, 4)
12042 obj.xid = reader.read("!L")[0]
12043 obj.command = reader.read("!H")[0]
12044 obj.group_type = reader.read("!B")[0]
12045 reader.skip(1)
12046 obj.group_id = reader.read("!L")[0]
12047 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12048 return obj
12049
12050 def __eq__(self, other):
12051 if type(self) != type(other): return False
12052 if self.xid != other.xid: return False
12053 if self.command != other.command: return False
12054 if self.group_type != other.group_type: return False
12055 if self.group_id != other.group_id: return False
12056 if self.buckets != other.buckets: return False
12057 return True
12058
12059 def pretty_print(self, q):
12060 q.text("group_mod {")
12061 with q.group():
12062 with q.indent(2):
12063 q.breakable()
12064 q.text("xid = ");
12065 if self.xid != None:
12066 q.text("%#x" % self.xid)
12067 else:
12068 q.text('None')
12069 q.text(","); q.breakable()
12070 q.text("group_type = ");
12071 q.text("%#x" % self.group_type)
12072 q.text(","); q.breakable()
12073 q.text("group_id = ");
12074 q.text("%#x" % self.group_id)
12075 q.text(","); q.breakable()
12076 q.text("buckets = ");
12077 q.pp(self.buckets)
12078 q.breakable()
12079 q.text('}')
12080
12081message.subtypes[15] = group_mod
12082
12083class group_add(group_mod):
12084 version = 5
12085 type = 15
12086 command = 0
12087
12088 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12089 if xid != None:
12090 self.xid = xid
12091 else:
12092 self.xid = None
12093 if group_type != None:
12094 self.group_type = group_type
12095 else:
12096 self.group_type = 0
12097 if group_id != None:
12098 self.group_id = group_id
12099 else:
12100 self.group_id = 0
12101 if buckets != None:
12102 self.buckets = buckets
12103 else:
12104 self.buckets = []
12105 return
12106
12107 def pack(self):
12108 packed = []
12109 packed.append(struct.pack("!B", self.version))
12110 packed.append(struct.pack("!B", self.type))
12111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12112 packed.append(struct.pack("!L", self.xid))
12113 packed.append(struct.pack("!H", self.command))
12114 packed.append(struct.pack("!B", self.group_type))
12115 packed.append('\x00' * 1)
12116 packed.append(struct.pack("!L", self.group_id))
12117 packed.append(loxi.generic_util.pack_list(self.buckets))
12118 length = sum([len(x) for x in packed])
12119 packed[2] = struct.pack("!H", length)
12120 return ''.join(packed)
12121
12122 @staticmethod
12123 def unpack(reader):
12124 obj = group_add()
12125 _version = reader.read("!B")[0]
12126 assert(_version == 5)
12127 _type = reader.read("!B")[0]
12128 assert(_type == 15)
12129 _length = reader.read("!H")[0]
12130 orig_reader = reader
12131 reader = orig_reader.slice(_length, 4)
12132 obj.xid = reader.read("!L")[0]
12133 _command = reader.read("!H")[0]
12134 assert(_command == 0)
12135 obj.group_type = reader.read("!B")[0]
12136 reader.skip(1)
12137 obj.group_id = reader.read("!L")[0]
12138 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12139 return obj
12140
12141 def __eq__(self, other):
12142 if type(self) != type(other): return False
12143 if self.xid != other.xid: return False
12144 if self.group_type != other.group_type: return False
12145 if self.group_id != other.group_id: return False
12146 if self.buckets != other.buckets: return False
12147 return True
12148
12149 def pretty_print(self, q):
12150 q.text("group_add {")
12151 with q.group():
12152 with q.indent(2):
12153 q.breakable()
12154 q.text("xid = ");
12155 if self.xid != None:
12156 q.text("%#x" % self.xid)
12157 else:
12158 q.text('None')
12159 q.text(","); q.breakable()
12160 q.text("group_type = ");
12161 q.text("%#x" % self.group_type)
12162 q.text(","); q.breakable()
12163 q.text("group_id = ");
12164 q.text("%#x" % self.group_id)
12165 q.text(","); q.breakable()
12166 q.text("buckets = ");
12167 q.pp(self.buckets)
12168 q.breakable()
12169 q.text('}')
12170
12171group_mod.subtypes[0] = group_add
12172
12173class group_delete(group_mod):
12174 version = 5
12175 type = 15
12176 command = 2
12177
12178 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12179 if xid != None:
12180 self.xid = xid
12181 else:
12182 self.xid = None
12183 if group_type != None:
12184 self.group_type = group_type
12185 else:
12186 self.group_type = 0
12187 if group_id != None:
12188 self.group_id = group_id
12189 else:
12190 self.group_id = 0
12191 if buckets != None:
12192 self.buckets = buckets
12193 else:
12194 self.buckets = []
12195 return
12196
12197 def pack(self):
12198 packed = []
12199 packed.append(struct.pack("!B", self.version))
12200 packed.append(struct.pack("!B", self.type))
12201 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12202 packed.append(struct.pack("!L", self.xid))
12203 packed.append(struct.pack("!H", self.command))
12204 packed.append(struct.pack("!B", self.group_type))
12205 packed.append('\x00' * 1)
12206 packed.append(struct.pack("!L", self.group_id))
12207 packed.append(loxi.generic_util.pack_list(self.buckets))
12208 length = sum([len(x) for x in packed])
12209 packed[2] = struct.pack("!H", length)
12210 return ''.join(packed)
12211
12212 @staticmethod
12213 def unpack(reader):
12214 obj = group_delete()
12215 _version = reader.read("!B")[0]
12216 assert(_version == 5)
12217 _type = reader.read("!B")[0]
12218 assert(_type == 15)
12219 _length = reader.read("!H")[0]
12220 orig_reader = reader
12221 reader = orig_reader.slice(_length, 4)
12222 obj.xid = reader.read("!L")[0]
12223 _command = reader.read("!H")[0]
12224 assert(_command == 2)
12225 obj.group_type = reader.read("!B")[0]
12226 reader.skip(1)
12227 obj.group_id = reader.read("!L")[0]
12228 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12229 return obj
12230
12231 def __eq__(self, other):
12232 if type(self) != type(other): return False
12233 if self.xid != other.xid: return False
12234 if self.group_type != other.group_type: return False
12235 if self.group_id != other.group_id: return False
12236 if self.buckets != other.buckets: return False
12237 return True
12238
12239 def pretty_print(self, q):
12240 q.text("group_delete {")
12241 with q.group():
12242 with q.indent(2):
12243 q.breakable()
12244 q.text("xid = ");
12245 if self.xid != None:
12246 q.text("%#x" % self.xid)
12247 else:
12248 q.text('None')
12249 q.text(","); q.breakable()
12250 q.text("group_type = ");
12251 q.text("%#x" % self.group_type)
12252 q.text(","); q.breakable()
12253 q.text("group_id = ");
12254 q.text("%#x" % self.group_id)
12255 q.text(","); q.breakable()
12256 q.text("buckets = ");
12257 q.pp(self.buckets)
12258 q.breakable()
12259 q.text('}')
12260
12261group_mod.subtypes[2] = group_delete
12262
12263class group_desc_stats_reply(stats_reply):
12264 version = 5
12265 type = 19
12266 stats_type = 7
12267
12268 def __init__(self, xid=None, flags=None, entries=None):
12269 if xid != None:
12270 self.xid = xid
12271 else:
12272 self.xid = None
12273 if flags != None:
12274 self.flags = flags
12275 else:
12276 self.flags = 0
12277 if entries != None:
12278 self.entries = entries
12279 else:
12280 self.entries = []
12281 return
12282
12283 def pack(self):
12284 packed = []
12285 packed.append(struct.pack("!B", self.version))
12286 packed.append(struct.pack("!B", self.type))
12287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12288 packed.append(struct.pack("!L", self.xid))
12289 packed.append(struct.pack("!H", self.stats_type))
12290 packed.append(struct.pack("!H", self.flags))
12291 packed.append('\x00' * 4)
12292 packed.append(loxi.generic_util.pack_list(self.entries))
12293 length = sum([len(x) for x in packed])
12294 packed[2] = struct.pack("!H", length)
12295 return ''.join(packed)
12296
12297 @staticmethod
12298 def unpack(reader):
12299 obj = group_desc_stats_reply()
12300 _version = reader.read("!B")[0]
12301 assert(_version == 5)
12302 _type = reader.read("!B")[0]
12303 assert(_type == 19)
12304 _length = reader.read("!H")[0]
12305 orig_reader = reader
12306 reader = orig_reader.slice(_length, 4)
12307 obj.xid = reader.read("!L")[0]
12308 _stats_type = reader.read("!H")[0]
12309 assert(_stats_type == 7)
12310 obj.flags = reader.read("!H")[0]
12311 reader.skip(4)
12312 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
12313 return obj
12314
12315 def __eq__(self, other):
12316 if type(self) != type(other): return False
12317 if self.xid != other.xid: return False
12318 if self.flags != other.flags: return False
12319 if self.entries != other.entries: return False
12320 return True
12321
12322 def pretty_print(self, q):
12323 q.text("group_desc_stats_reply {")
12324 with q.group():
12325 with q.indent(2):
12326 q.breakable()
12327 q.text("xid = ");
12328 if self.xid != None:
12329 q.text("%#x" % self.xid)
12330 else:
12331 q.text('None')
12332 q.text(","); q.breakable()
12333 q.text("flags = ");
12334 q.text("%#x" % self.flags)
12335 q.text(","); q.breakable()
12336 q.text("entries = ");
12337 q.pp(self.entries)
12338 q.breakable()
12339 q.text('}')
12340
12341stats_reply.subtypes[7] = group_desc_stats_reply
12342
12343class group_desc_stats_request(stats_request):
12344 version = 5
12345 type = 18
12346 stats_type = 7
12347
12348 def __init__(self, xid=None, flags=None):
12349 if xid != None:
12350 self.xid = xid
12351 else:
12352 self.xid = None
12353 if flags != None:
12354 self.flags = flags
12355 else:
12356 self.flags = 0
12357 return
12358
12359 def pack(self):
12360 packed = []
12361 packed.append(struct.pack("!B", self.version))
12362 packed.append(struct.pack("!B", self.type))
12363 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12364 packed.append(struct.pack("!L", self.xid))
12365 packed.append(struct.pack("!H", self.stats_type))
12366 packed.append(struct.pack("!H", self.flags))
12367 packed.append('\x00' * 4)
12368 length = sum([len(x) for x in packed])
12369 packed[2] = struct.pack("!H", length)
12370 return ''.join(packed)
12371
12372 @staticmethod
12373 def unpack(reader):
12374 obj = group_desc_stats_request()
12375 _version = reader.read("!B")[0]
12376 assert(_version == 5)
12377 _type = reader.read("!B")[0]
12378 assert(_type == 18)
12379 _length = reader.read("!H")[0]
12380 orig_reader = reader
12381 reader = orig_reader.slice(_length, 4)
12382 obj.xid = reader.read("!L")[0]
12383 _stats_type = reader.read("!H")[0]
12384 assert(_stats_type == 7)
12385 obj.flags = reader.read("!H")[0]
12386 reader.skip(4)
12387 return obj
12388
12389 def __eq__(self, other):
12390 if type(self) != type(other): return False
12391 if self.xid != other.xid: return False
12392 if self.flags != other.flags: return False
12393 return True
12394
12395 def pretty_print(self, q):
12396 q.text("group_desc_stats_request {")
12397 with q.group():
12398 with q.indent(2):
12399 q.breakable()
12400 q.text("xid = ");
12401 if self.xid != None:
12402 q.text("%#x" % self.xid)
12403 else:
12404 q.text('None')
12405 q.text(","); q.breakable()
12406 q.text("flags = ");
12407 q.text("%#x" % self.flags)
12408 q.breakable()
12409 q.text('}')
12410
12411stats_request.subtypes[7] = group_desc_stats_request
12412
12413class group_features_stats_reply(stats_reply):
12414 version = 5
12415 type = 19
12416 stats_type = 8
12417
12418 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):
12419 if xid != None:
12420 self.xid = xid
12421 else:
12422 self.xid = None
12423 if flags != None:
12424 self.flags = flags
12425 else:
12426 self.flags = 0
12427 if types != None:
12428 self.types = types
12429 else:
12430 self.types = 0
12431 if capabilities != None:
12432 self.capabilities = capabilities
12433 else:
12434 self.capabilities = 0
12435 if max_groups_all != None:
12436 self.max_groups_all = max_groups_all
12437 else:
12438 self.max_groups_all = 0
12439 if max_groups_select != None:
12440 self.max_groups_select = max_groups_select
12441 else:
12442 self.max_groups_select = 0
12443 if max_groups_indirect != None:
12444 self.max_groups_indirect = max_groups_indirect
12445 else:
12446 self.max_groups_indirect = 0
12447 if max_groups_ff != None:
12448 self.max_groups_ff = max_groups_ff
12449 else:
12450 self.max_groups_ff = 0
12451 if actions_all != None:
12452 self.actions_all = actions_all
12453 else:
12454 self.actions_all = 0
12455 if actions_select != None:
12456 self.actions_select = actions_select
12457 else:
12458 self.actions_select = 0
12459 if actions_indirect != None:
12460 self.actions_indirect = actions_indirect
12461 else:
12462 self.actions_indirect = 0
12463 if actions_ff != None:
12464 self.actions_ff = actions_ff
12465 else:
12466 self.actions_ff = 0
12467 return
12468
12469 def pack(self):
12470 packed = []
12471 packed.append(struct.pack("!B", self.version))
12472 packed.append(struct.pack("!B", self.type))
12473 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12474 packed.append(struct.pack("!L", self.xid))
12475 packed.append(struct.pack("!H", self.stats_type))
12476 packed.append(struct.pack("!H", self.flags))
12477 packed.append('\x00' * 4)
12478 packed.append(struct.pack("!L", self.types))
12479 packed.append(struct.pack("!L", self.capabilities))
12480 packed.append(struct.pack("!L", self.max_groups_all))
12481 packed.append(struct.pack("!L", self.max_groups_select))
12482 packed.append(struct.pack("!L", self.max_groups_indirect))
12483 packed.append(struct.pack("!L", self.max_groups_ff))
12484 packed.append(struct.pack("!L", self.actions_all))
12485 packed.append(struct.pack("!L", self.actions_select))
12486 packed.append(struct.pack("!L", self.actions_indirect))
12487 packed.append(struct.pack("!L", self.actions_ff))
12488 length = sum([len(x) for x in packed])
12489 packed[2] = struct.pack("!H", length)
12490 return ''.join(packed)
12491
12492 @staticmethod
12493 def unpack(reader):
12494 obj = group_features_stats_reply()
12495 _version = reader.read("!B")[0]
12496 assert(_version == 5)
12497 _type = reader.read("!B")[0]
12498 assert(_type == 19)
12499 _length = reader.read("!H")[0]
12500 orig_reader = reader
12501 reader = orig_reader.slice(_length, 4)
12502 obj.xid = reader.read("!L")[0]
12503 _stats_type = reader.read("!H")[0]
12504 assert(_stats_type == 8)
12505 obj.flags = reader.read("!H")[0]
12506 reader.skip(4)
12507 obj.types = reader.read("!L")[0]
12508 obj.capabilities = reader.read("!L")[0]
12509 obj.max_groups_all = reader.read("!L")[0]
12510 obj.max_groups_select = reader.read("!L")[0]
12511 obj.max_groups_indirect = reader.read("!L")[0]
12512 obj.max_groups_ff = reader.read("!L")[0]
12513 obj.actions_all = reader.read("!L")[0]
12514 obj.actions_select = reader.read("!L")[0]
12515 obj.actions_indirect = reader.read("!L")[0]
12516 obj.actions_ff = reader.read("!L")[0]
12517 return obj
12518
12519 def __eq__(self, other):
12520 if type(self) != type(other): return False
12521 if self.xid != other.xid: return False
12522 if self.flags != other.flags: return False
12523 if self.types != other.types: return False
12524 if self.capabilities != other.capabilities: return False
12525 if self.max_groups_all != other.max_groups_all: return False
12526 if self.max_groups_select != other.max_groups_select: return False
12527 if self.max_groups_indirect != other.max_groups_indirect: return False
12528 if self.max_groups_ff != other.max_groups_ff: return False
12529 if self.actions_all != other.actions_all: return False
12530 if self.actions_select != other.actions_select: return False
12531 if self.actions_indirect != other.actions_indirect: return False
12532 if self.actions_ff != other.actions_ff: return False
12533 return True
12534
12535 def pretty_print(self, q):
12536 q.text("group_features_stats_reply {")
12537 with q.group():
12538 with q.indent(2):
12539 q.breakable()
12540 q.text("xid = ");
12541 if self.xid != None:
12542 q.text("%#x" % self.xid)
12543 else:
12544 q.text('None')
12545 q.text(","); q.breakable()
12546 q.text("flags = ");
12547 q.text("%#x" % self.flags)
12548 q.text(","); q.breakable()
12549 q.text("types = ");
12550 q.text("%#x" % self.types)
12551 q.text(","); q.breakable()
12552 q.text("capabilities = ");
12553 q.text("%#x" % self.capabilities)
12554 q.text(","); q.breakable()
12555 q.text("max_groups_all = ");
12556 q.text("%#x" % self.max_groups_all)
12557 q.text(","); q.breakable()
12558 q.text("max_groups_select = ");
12559 q.text("%#x" % self.max_groups_select)
12560 q.text(","); q.breakable()
12561 q.text("max_groups_indirect = ");
12562 q.text("%#x" % self.max_groups_indirect)
12563 q.text(","); q.breakable()
12564 q.text("max_groups_ff = ");
12565 q.text("%#x" % self.max_groups_ff)
12566 q.text(","); q.breakable()
12567 q.text("actions_all = ");
12568 q.text("%#x" % self.actions_all)
12569 q.text(","); q.breakable()
12570 q.text("actions_select = ");
12571 q.text("%#x" % self.actions_select)
12572 q.text(","); q.breakable()
12573 q.text("actions_indirect = ");
12574 q.text("%#x" % self.actions_indirect)
12575 q.text(","); q.breakable()
12576 q.text("actions_ff = ");
12577 q.text("%#x" % self.actions_ff)
12578 q.breakable()
12579 q.text('}')
12580
12581stats_reply.subtypes[8] = group_features_stats_reply
12582
12583class group_features_stats_request(stats_request):
12584 version = 5
12585 type = 18
12586 stats_type = 8
12587
12588 def __init__(self, xid=None, flags=None):
12589 if xid != None:
12590 self.xid = xid
12591 else:
12592 self.xid = None
12593 if flags != None:
12594 self.flags = flags
12595 else:
12596 self.flags = 0
12597 return
12598
12599 def pack(self):
12600 packed = []
12601 packed.append(struct.pack("!B", self.version))
12602 packed.append(struct.pack("!B", self.type))
12603 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12604 packed.append(struct.pack("!L", self.xid))
12605 packed.append(struct.pack("!H", self.stats_type))
12606 packed.append(struct.pack("!H", self.flags))
12607 packed.append('\x00' * 4)
12608 length = sum([len(x) for x in packed])
12609 packed[2] = struct.pack("!H", length)
12610 return ''.join(packed)
12611
12612 @staticmethod
12613 def unpack(reader):
12614 obj = group_features_stats_request()
12615 _version = reader.read("!B")[0]
12616 assert(_version == 5)
12617 _type = reader.read("!B")[0]
12618 assert(_type == 18)
12619 _length = reader.read("!H")[0]
12620 orig_reader = reader
12621 reader = orig_reader.slice(_length, 4)
12622 obj.xid = reader.read("!L")[0]
12623 _stats_type = reader.read("!H")[0]
12624 assert(_stats_type == 8)
12625 obj.flags = reader.read("!H")[0]
12626 reader.skip(4)
12627 return obj
12628
12629 def __eq__(self, other):
12630 if type(self) != type(other): return False
12631 if self.xid != other.xid: return False
12632 if self.flags != other.flags: return False
12633 return True
12634
12635 def pretty_print(self, q):
12636 q.text("group_features_stats_request {")
12637 with q.group():
12638 with q.indent(2):
12639 q.breakable()
12640 q.text("xid = ");
12641 if self.xid != None:
12642 q.text("%#x" % self.xid)
12643 else:
12644 q.text('None')
12645 q.text(","); q.breakable()
12646 q.text("flags = ");
12647 q.text("%#x" % self.flags)
12648 q.breakable()
12649 q.text('}')
12650
12651stats_request.subtypes[8] = group_features_stats_request
12652
12653class group_mod_failed_error_msg(error_msg):
12654 version = 5
12655 type = 1
12656 err_type = 6
12657
12658 def __init__(self, xid=None, code=None, data=None):
12659 if xid != None:
12660 self.xid = xid
12661 else:
12662 self.xid = None
12663 if code != None:
12664 self.code = code
12665 else:
12666 self.code = 0
12667 if data != None:
12668 self.data = data
12669 else:
12670 self.data = ''
12671 return
12672
12673 def pack(self):
12674 packed = []
12675 packed.append(struct.pack("!B", self.version))
12676 packed.append(struct.pack("!B", self.type))
12677 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12678 packed.append(struct.pack("!L", self.xid))
12679 packed.append(struct.pack("!H", self.err_type))
12680 packed.append(struct.pack("!H", self.code))
12681 packed.append(self.data)
12682 length = sum([len(x) for x in packed])
12683 packed[2] = struct.pack("!H", length)
12684 return ''.join(packed)
12685
12686 @staticmethod
12687 def unpack(reader):
12688 obj = group_mod_failed_error_msg()
12689 _version = reader.read("!B")[0]
12690 assert(_version == 5)
12691 _type = reader.read("!B")[0]
12692 assert(_type == 1)
12693 _length = reader.read("!H")[0]
12694 orig_reader = reader
12695 reader = orig_reader.slice(_length, 4)
12696 obj.xid = reader.read("!L")[0]
12697 _err_type = reader.read("!H")[0]
12698 assert(_err_type == 6)
12699 obj.code = reader.read("!H")[0]
12700 obj.data = str(reader.read_all())
12701 return obj
12702
12703 def __eq__(self, other):
12704 if type(self) != type(other): return False
12705 if self.xid != other.xid: return False
12706 if self.code != other.code: return False
12707 if self.data != other.data: return False
12708 return True
12709
12710 def pretty_print(self, q):
12711 q.text("group_mod_failed_error_msg {")
12712 with q.group():
12713 with q.indent(2):
12714 q.breakable()
12715 q.text("xid = ");
12716 if self.xid != None:
12717 q.text("%#x" % self.xid)
12718 else:
12719 q.text('None')
12720 q.text(","); q.breakable()
12721 q.text("code = ");
12722 q.text("%#x" % self.code)
12723 q.text(","); q.breakable()
12724 q.text("data = ");
12725 q.pp(self.data)
12726 q.breakable()
12727 q.text('}')
12728
12729error_msg.subtypes[6] = group_mod_failed_error_msg
12730
12731class group_modify(group_mod):
12732 version = 5
12733 type = 15
12734 command = 1
12735
12736 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12737 if xid != None:
12738 self.xid = xid
12739 else:
12740 self.xid = None
12741 if group_type != None:
12742 self.group_type = group_type
12743 else:
12744 self.group_type = 0
12745 if group_id != None:
12746 self.group_id = group_id
12747 else:
12748 self.group_id = 0
12749 if buckets != None:
12750 self.buckets = buckets
12751 else:
12752 self.buckets = []
12753 return
12754
12755 def pack(self):
12756 packed = []
12757 packed.append(struct.pack("!B", self.version))
12758 packed.append(struct.pack("!B", self.type))
12759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12760 packed.append(struct.pack("!L", self.xid))
12761 packed.append(struct.pack("!H", self.command))
12762 packed.append(struct.pack("!B", self.group_type))
12763 packed.append('\x00' * 1)
12764 packed.append(struct.pack("!L", self.group_id))
12765 packed.append(loxi.generic_util.pack_list(self.buckets))
12766 length = sum([len(x) for x in packed])
12767 packed[2] = struct.pack("!H", length)
12768 return ''.join(packed)
12769
12770 @staticmethod
12771 def unpack(reader):
12772 obj = group_modify()
12773 _version = reader.read("!B")[0]
12774 assert(_version == 5)
12775 _type = reader.read("!B")[0]
12776 assert(_type == 15)
12777 _length = reader.read("!H")[0]
12778 orig_reader = reader
12779 reader = orig_reader.slice(_length, 4)
12780 obj.xid = reader.read("!L")[0]
12781 _command = reader.read("!H")[0]
12782 assert(_command == 1)
12783 obj.group_type = reader.read("!B")[0]
12784 reader.skip(1)
12785 obj.group_id = reader.read("!L")[0]
12786 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12787 return obj
12788
12789 def __eq__(self, other):
12790 if type(self) != type(other): return False
12791 if self.xid != other.xid: return False
12792 if self.group_type != other.group_type: return False
12793 if self.group_id != other.group_id: return False
12794 if self.buckets != other.buckets: return False
12795 return True
12796
12797 def pretty_print(self, q):
12798 q.text("group_modify {")
12799 with q.group():
12800 with q.indent(2):
12801 q.breakable()
12802 q.text("xid = ");
12803 if self.xid != None:
12804 q.text("%#x" % self.xid)
12805 else:
12806 q.text('None')
12807 q.text(","); q.breakable()
12808 q.text("group_type = ");
12809 q.text("%#x" % self.group_type)
12810 q.text(","); q.breakable()
12811 q.text("group_id = ");
12812 q.text("%#x" % self.group_id)
12813 q.text(","); q.breakable()
12814 q.text("buckets = ");
12815 q.pp(self.buckets)
12816 q.breakable()
12817 q.text('}')
12818
12819group_mod.subtypes[1] = group_modify
12820
12821class group_stats_reply(stats_reply):
12822 version = 5
12823 type = 19
12824 stats_type = 6
12825
12826 def __init__(self, xid=None, flags=None, entries=None):
12827 if xid != None:
12828 self.xid = xid
12829 else:
12830 self.xid = None
12831 if flags != None:
12832 self.flags = flags
12833 else:
12834 self.flags = 0
12835 if entries != None:
12836 self.entries = entries
12837 else:
12838 self.entries = []
12839 return
12840
12841 def pack(self):
12842 packed = []
12843 packed.append(struct.pack("!B", self.version))
12844 packed.append(struct.pack("!B", self.type))
12845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12846 packed.append(struct.pack("!L", self.xid))
12847 packed.append(struct.pack("!H", self.stats_type))
12848 packed.append(struct.pack("!H", self.flags))
12849 packed.append('\x00' * 4)
12850 packed.append(loxi.generic_util.pack_list(self.entries))
12851 length = sum([len(x) for x in packed])
12852 packed[2] = struct.pack("!H", length)
12853 return ''.join(packed)
12854
12855 @staticmethod
12856 def unpack(reader):
12857 obj = group_stats_reply()
12858 _version = reader.read("!B")[0]
12859 assert(_version == 5)
12860 _type = reader.read("!B")[0]
12861 assert(_type == 19)
12862 _length = reader.read("!H")[0]
12863 orig_reader = reader
12864 reader = orig_reader.slice(_length, 4)
12865 obj.xid = reader.read("!L")[0]
12866 _stats_type = reader.read("!H")[0]
12867 assert(_stats_type == 6)
12868 obj.flags = reader.read("!H")[0]
12869 reader.skip(4)
12870 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
12871 return obj
12872
12873 def __eq__(self, other):
12874 if type(self) != type(other): return False
12875 if self.xid != other.xid: return False
12876 if self.flags != other.flags: return False
12877 if self.entries != other.entries: return False
12878 return True
12879
12880 def pretty_print(self, q):
12881 q.text("group_stats_reply {")
12882 with q.group():
12883 with q.indent(2):
12884 q.breakable()
12885 q.text("xid = ");
12886 if self.xid != None:
12887 q.text("%#x" % self.xid)
12888 else:
12889 q.text('None')
12890 q.text(","); q.breakable()
12891 q.text("flags = ");
12892 q.text("%#x" % self.flags)
12893 q.text(","); q.breakable()
12894 q.text("entries = ");
12895 q.pp(self.entries)
12896 q.breakable()
12897 q.text('}')
12898
12899stats_reply.subtypes[6] = group_stats_reply
12900
12901class group_stats_request(stats_request):
12902 version = 5
12903 type = 18
12904 stats_type = 6
12905
12906 def __init__(self, xid=None, flags=None, group_id=None):
12907 if xid != None:
12908 self.xid = xid
12909 else:
12910 self.xid = None
12911 if flags != None:
12912 self.flags = flags
12913 else:
12914 self.flags = 0
12915 if group_id != None:
12916 self.group_id = group_id
12917 else:
12918 self.group_id = 0
12919 return
12920
12921 def pack(self):
12922 packed = []
12923 packed.append(struct.pack("!B", self.version))
12924 packed.append(struct.pack("!B", self.type))
12925 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12926 packed.append(struct.pack("!L", self.xid))
12927 packed.append(struct.pack("!H", self.stats_type))
12928 packed.append(struct.pack("!H", self.flags))
12929 packed.append('\x00' * 4)
12930 packed.append(struct.pack("!L", self.group_id))
12931 packed.append('\x00' * 4)
12932 length = sum([len(x) for x in packed])
12933 packed[2] = struct.pack("!H", length)
12934 return ''.join(packed)
12935
12936 @staticmethod
12937 def unpack(reader):
12938 obj = group_stats_request()
12939 _version = reader.read("!B")[0]
12940 assert(_version == 5)
12941 _type = reader.read("!B")[0]
12942 assert(_type == 18)
12943 _length = reader.read("!H")[0]
12944 orig_reader = reader
12945 reader = orig_reader.slice(_length, 4)
12946 obj.xid = reader.read("!L")[0]
12947 _stats_type = reader.read("!H")[0]
12948 assert(_stats_type == 6)
12949 obj.flags = reader.read("!H")[0]
12950 reader.skip(4)
12951 obj.group_id = reader.read("!L")[0]
12952 reader.skip(4)
12953 return obj
12954
12955 def __eq__(self, other):
12956 if type(self) != type(other): return False
12957 if self.xid != other.xid: return False
12958 if self.flags != other.flags: return False
12959 if self.group_id != other.group_id: return False
12960 return True
12961
12962 def pretty_print(self, q):
12963 q.text("group_stats_request {")
12964 with q.group():
12965 with q.indent(2):
12966 q.breakable()
12967 q.text("xid = ");
12968 if self.xid != None:
12969 q.text("%#x" % self.xid)
12970 else:
12971 q.text('None')
12972 q.text(","); q.breakable()
12973 q.text("flags = ");
12974 q.text("%#x" % self.flags)
12975 q.text(","); q.breakable()
12976 q.text("group_id = ");
12977 q.text("%#x" % self.group_id)
12978 q.breakable()
12979 q.text('}')
12980
12981stats_request.subtypes[6] = group_stats_request
12982
12983class hello(message):
12984 version = 5
12985 type = 0
12986
12987 def __init__(self, xid=None, elements=None):
12988 if xid != None:
12989 self.xid = xid
12990 else:
12991 self.xid = None
12992 if elements != None:
12993 self.elements = elements
12994 else:
12995 self.elements = []
12996 return
12997
12998 def pack(self):
12999 packed = []
13000 packed.append(struct.pack("!B", self.version))
13001 packed.append(struct.pack("!B", self.type))
13002 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13003 packed.append(struct.pack("!L", self.xid))
13004 packed.append(loxi.generic_util.pack_list(self.elements))
13005 length = sum([len(x) for x in packed])
13006 packed[2] = struct.pack("!H", length)
13007 return ''.join(packed)
13008
13009 @staticmethod
13010 def unpack(reader):
13011 obj = hello()
13012 _version = reader.read("!B")[0]
13013 assert(_version == 5)
13014 _type = reader.read("!B")[0]
13015 assert(_type == 0)
13016 _length = reader.read("!H")[0]
13017 orig_reader = reader
13018 reader = orig_reader.slice(_length, 4)
13019 obj.xid = reader.read("!L")[0]
13020 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
13021 return obj
13022
13023 def __eq__(self, other):
13024 if type(self) != type(other): return False
13025 if self.xid != other.xid: return False
13026 if self.elements != other.elements: return False
13027 return True
13028
13029 def pretty_print(self, q):
13030 q.text("hello {")
13031 with q.group():
13032 with q.indent(2):
13033 q.breakable()
13034 q.text("xid = ");
13035 if self.xid != None:
13036 q.text("%#x" % self.xid)
13037 else:
13038 q.text('None')
13039 q.text(","); q.breakable()
13040 q.text("elements = ");
13041 q.pp(self.elements)
13042 q.breakable()
13043 q.text('}')
13044
13045message.subtypes[0] = hello
13046
13047class hello_failed_error_msg(error_msg):
13048 version = 5
13049 type = 1
13050 err_type = 0
13051
13052 def __init__(self, xid=None, code=None, data=None):
13053 if xid != None:
13054 self.xid = xid
13055 else:
13056 self.xid = None
13057 if code != None:
13058 self.code = code
13059 else:
13060 self.code = 0
13061 if data != None:
13062 self.data = data
13063 else:
13064 self.data = ''
13065 return
13066
13067 def pack(self):
13068 packed = []
13069 packed.append(struct.pack("!B", self.version))
13070 packed.append(struct.pack("!B", self.type))
13071 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13072 packed.append(struct.pack("!L", self.xid))
13073 packed.append(struct.pack("!H", self.err_type))
13074 packed.append(struct.pack("!H", self.code))
13075 packed.append(self.data)
13076 length = sum([len(x) for x in packed])
13077 packed[2] = struct.pack("!H", length)
13078 return ''.join(packed)
13079
13080 @staticmethod
13081 def unpack(reader):
13082 obj = hello_failed_error_msg()
13083 _version = reader.read("!B")[0]
13084 assert(_version == 5)
13085 _type = reader.read("!B")[0]
13086 assert(_type == 1)
13087 _length = reader.read("!H")[0]
13088 orig_reader = reader
13089 reader = orig_reader.slice(_length, 4)
13090 obj.xid = reader.read("!L")[0]
13091 _err_type = reader.read("!H")[0]
13092 assert(_err_type == 0)
13093 obj.code = reader.read("!H")[0]
13094 obj.data = str(reader.read_all())
13095 return obj
13096
13097 def __eq__(self, other):
13098 if type(self) != type(other): return False
13099 if self.xid != other.xid: return False
13100 if self.code != other.code: return False
13101 if self.data != other.data: return False
13102 return True
13103
13104 def pretty_print(self, q):
13105 q.text("hello_failed_error_msg {")
13106 with q.group():
13107 with q.indent(2):
13108 q.breakable()
13109 q.text("xid = ");
13110 if self.xid != None:
13111 q.text("%#x" % self.xid)
13112 else:
13113 q.text('None')
13114 q.text(","); q.breakable()
13115 q.text("code = ");
13116 q.text("%#x" % self.code)
13117 q.text(","); q.breakable()
13118 q.text("data = ");
13119 q.pp(self.data)
13120 q.breakable()
13121 q.text('}')
13122
13123error_msg.subtypes[0] = hello_failed_error_msg
13124
13125class meter_config_stats_reply(stats_reply):
13126 version = 5
13127 type = 19
13128 stats_type = 10
13129
13130 def __init__(self, xid=None, flags=None, entries=None):
13131 if xid != None:
13132 self.xid = xid
13133 else:
13134 self.xid = None
13135 if flags != None:
13136 self.flags = flags
13137 else:
13138 self.flags = 0
13139 if entries != None:
13140 self.entries = entries
13141 else:
13142 self.entries = []
13143 return
13144
13145 def pack(self):
13146 packed = []
13147 packed.append(struct.pack("!B", self.version))
13148 packed.append(struct.pack("!B", self.type))
13149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13150 packed.append(struct.pack("!L", self.xid))
13151 packed.append(struct.pack("!H", self.stats_type))
13152 packed.append(struct.pack("!H", self.flags))
13153 packed.append('\x00' * 4)
13154 packed.append(loxi.generic_util.pack_list(self.entries))
13155 length = sum([len(x) for x in packed])
13156 packed[2] = struct.pack("!H", length)
13157 return ''.join(packed)
13158
13159 @staticmethod
13160 def unpack(reader):
13161 obj = meter_config_stats_reply()
13162 _version = reader.read("!B")[0]
13163 assert(_version == 5)
13164 _type = reader.read("!B")[0]
13165 assert(_type == 19)
13166 _length = reader.read("!H")[0]
13167 orig_reader = reader
13168 reader = orig_reader.slice(_length, 4)
13169 obj.xid = reader.read("!L")[0]
13170 _stats_type = reader.read("!H")[0]
13171 assert(_stats_type == 10)
13172 obj.flags = reader.read("!H")[0]
13173 reader.skip(4)
13174 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_config.unpack)
13175 return obj
13176
13177 def __eq__(self, other):
13178 if type(self) != type(other): return False
13179 if self.xid != other.xid: return False
13180 if self.flags != other.flags: return False
13181 if self.entries != other.entries: return False
13182 return True
13183
13184 def pretty_print(self, q):
13185 q.text("meter_config_stats_reply {")
13186 with q.group():
13187 with q.indent(2):
13188 q.breakable()
13189 q.text("xid = ");
13190 if self.xid != None:
13191 q.text("%#x" % self.xid)
13192 else:
13193 q.text('None')
13194 q.text(","); q.breakable()
13195 q.text("flags = ");
13196 q.text("%#x" % self.flags)
13197 q.text(","); q.breakable()
13198 q.text("entries = ");
13199 q.pp(self.entries)
13200 q.breakable()
13201 q.text('}')
13202
13203stats_reply.subtypes[10] = meter_config_stats_reply
13204
13205class meter_config_stats_request(stats_request):
13206 version = 5
13207 type = 18
13208 stats_type = 10
13209
13210 def __init__(self, xid=None, flags=None, meter_id=None):
13211 if xid != None:
13212 self.xid = xid
13213 else:
13214 self.xid = None
13215 if flags != None:
13216 self.flags = flags
13217 else:
13218 self.flags = 0
13219 if meter_id != None:
13220 self.meter_id = meter_id
13221 else:
13222 self.meter_id = 0
13223 return
13224
13225 def pack(self):
13226 packed = []
13227 packed.append(struct.pack("!B", self.version))
13228 packed.append(struct.pack("!B", self.type))
13229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13230 packed.append(struct.pack("!L", self.xid))
13231 packed.append(struct.pack("!H", self.stats_type))
13232 packed.append(struct.pack("!H", self.flags))
13233 packed.append('\x00' * 4)
13234 packed.append(struct.pack("!L", self.meter_id))
13235 packed.append('\x00' * 4)
13236 length = sum([len(x) for x in packed])
13237 packed[2] = struct.pack("!H", length)
13238 return ''.join(packed)
13239
13240 @staticmethod
13241 def unpack(reader):
13242 obj = meter_config_stats_request()
13243 _version = reader.read("!B")[0]
13244 assert(_version == 5)
13245 _type = reader.read("!B")[0]
13246 assert(_type == 18)
13247 _length = reader.read("!H")[0]
13248 orig_reader = reader
13249 reader = orig_reader.slice(_length, 4)
13250 obj.xid = reader.read("!L")[0]
13251 _stats_type = reader.read("!H")[0]
13252 assert(_stats_type == 10)
13253 obj.flags = reader.read("!H")[0]
13254 reader.skip(4)
13255 obj.meter_id = reader.read("!L")[0]
13256 reader.skip(4)
13257 return obj
13258
13259 def __eq__(self, other):
13260 if type(self) != type(other): return False
13261 if self.xid != other.xid: return False
13262 if self.flags != other.flags: return False
13263 if self.meter_id != other.meter_id: return False
13264 return True
13265
13266 def pretty_print(self, q):
13267 q.text("meter_config_stats_request {")
13268 with q.group():
13269 with q.indent(2):
13270 q.breakable()
13271 q.text("xid = ");
13272 if self.xid != None:
13273 q.text("%#x" % self.xid)
13274 else:
13275 q.text('None')
13276 q.text(","); q.breakable()
13277 q.text("flags = ");
13278 q.text("%#x" % self.flags)
13279 q.text(","); q.breakable()
13280 q.text("meter_id = ");
13281 q.text("%#x" % self.meter_id)
13282 q.breakable()
13283 q.text('}')
13284
13285stats_request.subtypes[10] = meter_config_stats_request
13286
13287class meter_features_stats_reply(stats_reply):
13288 version = 5
13289 type = 19
13290 stats_type = 11
13291
13292 def __init__(self, xid=None, flags=None, features=None):
13293 if xid != None:
13294 self.xid = xid
13295 else:
13296 self.xid = None
13297 if flags != None:
13298 self.flags = flags
13299 else:
13300 self.flags = 0
13301 if features != None:
13302 self.features = features
13303 else:
13304 self.features = ofp.meter_features()
13305 return
13306
13307 def pack(self):
13308 packed = []
13309 packed.append(struct.pack("!B", self.version))
13310 packed.append(struct.pack("!B", self.type))
13311 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13312 packed.append(struct.pack("!L", self.xid))
13313 packed.append(struct.pack("!H", self.stats_type))
13314 packed.append(struct.pack("!H", self.flags))
13315 packed.append('\x00' * 4)
13316 packed.append(self.features.pack())
13317 length = sum([len(x) for x in packed])
13318 packed[2] = struct.pack("!H", length)
13319 return ''.join(packed)
13320
13321 @staticmethod
13322 def unpack(reader):
13323 obj = meter_features_stats_reply()
13324 _version = reader.read("!B")[0]
13325 assert(_version == 5)
13326 _type = reader.read("!B")[0]
13327 assert(_type == 19)
13328 _length = reader.read("!H")[0]
13329 orig_reader = reader
13330 reader = orig_reader.slice(_length, 4)
13331 obj.xid = reader.read("!L")[0]
13332 _stats_type = reader.read("!H")[0]
13333 assert(_stats_type == 11)
13334 obj.flags = reader.read("!H")[0]
13335 reader.skip(4)
13336 obj.features = ofp.meter_features.unpack(reader)
13337 return obj
13338
13339 def __eq__(self, other):
13340 if type(self) != type(other): return False
13341 if self.xid != other.xid: return False
13342 if self.flags != other.flags: return False
13343 if self.features != other.features: return False
13344 return True
13345
13346 def pretty_print(self, q):
13347 q.text("meter_features_stats_reply {")
13348 with q.group():
13349 with q.indent(2):
13350 q.breakable()
13351 q.text("xid = ");
13352 if self.xid != None:
13353 q.text("%#x" % self.xid)
13354 else:
13355 q.text('None')
13356 q.text(","); q.breakable()
13357 q.text("flags = ");
13358 q.text("%#x" % self.flags)
13359 q.text(","); q.breakable()
13360 q.text("features = ");
13361 q.pp(self.features)
13362 q.breakable()
13363 q.text('}')
13364
13365stats_reply.subtypes[11] = meter_features_stats_reply
13366
13367class meter_features_stats_request(stats_request):
13368 version = 5
13369 type = 18
13370 stats_type = 11
13371
13372 def __init__(self, xid=None, flags=None):
13373 if xid != None:
13374 self.xid = xid
13375 else:
13376 self.xid = None
13377 if flags != None:
13378 self.flags = flags
13379 else:
13380 self.flags = 0
13381 return
13382
13383 def pack(self):
13384 packed = []
13385 packed.append(struct.pack("!B", self.version))
13386 packed.append(struct.pack("!B", self.type))
13387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13388 packed.append(struct.pack("!L", self.xid))
13389 packed.append(struct.pack("!H", self.stats_type))
13390 packed.append(struct.pack("!H", self.flags))
13391 packed.append('\x00' * 4)
13392 length = sum([len(x) for x in packed])
13393 packed[2] = struct.pack("!H", length)
13394 return ''.join(packed)
13395
13396 @staticmethod
13397 def unpack(reader):
13398 obj = meter_features_stats_request()
13399 _version = reader.read("!B")[0]
13400 assert(_version == 5)
13401 _type = reader.read("!B")[0]
13402 assert(_type == 18)
13403 _length = reader.read("!H")[0]
13404 orig_reader = reader
13405 reader = orig_reader.slice(_length, 4)
13406 obj.xid = reader.read("!L")[0]
13407 _stats_type = reader.read("!H")[0]
13408 assert(_stats_type == 11)
13409 obj.flags = reader.read("!H")[0]
13410 reader.skip(4)
13411 return obj
13412
13413 def __eq__(self, other):
13414 if type(self) != type(other): return False
13415 if self.xid != other.xid: return False
13416 if self.flags != other.flags: return False
13417 return True
13418
13419 def pretty_print(self, q):
13420 q.text("meter_features_stats_request {")
13421 with q.group():
13422 with q.indent(2):
13423 q.breakable()
13424 q.text("xid = ");
13425 if self.xid != None:
13426 q.text("%#x" % self.xid)
13427 else:
13428 q.text('None')
13429 q.text(","); q.breakable()
13430 q.text("flags = ");
13431 q.text("%#x" % self.flags)
13432 q.breakable()
13433 q.text('}')
13434
13435stats_request.subtypes[11] = meter_features_stats_request
13436
13437class meter_mod(message):
13438 version = 5
13439 type = 29
13440
13441 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
13442 if xid != None:
13443 self.xid = xid
13444 else:
13445 self.xid = None
13446 if command != None:
13447 self.command = command
13448 else:
13449 self.command = 0
13450 if flags != None:
13451 self.flags = flags
13452 else:
13453 self.flags = 0
13454 if meter_id != None:
13455 self.meter_id = meter_id
13456 else:
13457 self.meter_id = 0
13458 if bands != None:
13459 self.bands = bands
13460 else:
13461 self.bands = []
13462 return
13463
13464 def pack(self):
13465 packed = []
13466 packed.append(struct.pack("!B", self.version))
13467 packed.append(struct.pack("!B", self.type))
13468 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13469 packed.append(struct.pack("!L", self.xid))
13470 packed.append(struct.pack("!H", self.command))
13471 packed.append(struct.pack("!H", self.flags))
13472 packed.append(struct.pack("!L", self.meter_id))
13473 packed.append(loxi.generic_util.pack_list(self.bands))
13474 length = sum([len(x) for x in packed])
13475 packed[2] = struct.pack("!H", length)
13476 return ''.join(packed)
13477
13478 @staticmethod
13479 def unpack(reader):
13480 obj = meter_mod()
13481 _version = reader.read("!B")[0]
13482 assert(_version == 5)
13483 _type = reader.read("!B")[0]
13484 assert(_type == 29)
13485 _length = reader.read("!H")[0]
13486 orig_reader = reader
13487 reader = orig_reader.slice(_length, 4)
13488 obj.xid = reader.read("!L")[0]
13489 obj.command = reader.read("!H")[0]
13490 obj.flags = reader.read("!H")[0]
13491 obj.meter_id = reader.read("!L")[0]
13492 obj.bands = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
13493 return obj
13494
13495 def __eq__(self, other):
13496 if type(self) != type(other): return False
13497 if self.xid != other.xid: return False
13498 if self.command != other.command: return False
13499 if self.flags != other.flags: return False
13500 if self.meter_id != other.meter_id: return False
13501 if self.bands != other.bands: return False
13502 return True
13503
13504 def pretty_print(self, q):
13505 q.text("meter_mod {")
13506 with q.group():
13507 with q.indent(2):
13508 q.breakable()
13509 q.text("xid = ");
13510 if self.xid != None:
13511 q.text("%#x" % self.xid)
13512 else:
13513 q.text('None')
13514 q.text(","); q.breakable()
13515 q.text("command = ");
13516 q.text("%#x" % self.command)
13517 q.text(","); q.breakable()
13518 q.text("flags = ");
13519 q.text("%#x" % self.flags)
13520 q.text(","); q.breakable()
13521 q.text("meter_id = ");
13522 q.text("%#x" % self.meter_id)
13523 q.text(","); q.breakable()
13524 q.text("bands = ");
13525 q.pp(self.bands)
13526 q.breakable()
13527 q.text('}')
13528
13529message.subtypes[29] = meter_mod
13530
13531class meter_mod_failed_error_msg(error_msg):
13532 version = 5
13533 type = 1
13534 err_type = 12
13535
13536 def __init__(self, xid=None, code=None, data=None):
13537 if xid != None:
13538 self.xid = xid
13539 else:
13540 self.xid = None
13541 if code != None:
13542 self.code = code
13543 else:
13544 self.code = 0
13545 if data != None:
13546 self.data = data
13547 else:
13548 self.data = ''
13549 return
13550
13551 def pack(self):
13552 packed = []
13553 packed.append(struct.pack("!B", self.version))
13554 packed.append(struct.pack("!B", self.type))
13555 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13556 packed.append(struct.pack("!L", self.xid))
13557 packed.append(struct.pack("!H", self.err_type))
13558 packed.append(struct.pack("!H", self.code))
13559 packed.append(self.data)
13560 length = sum([len(x) for x in packed])
13561 packed[2] = struct.pack("!H", length)
13562 return ''.join(packed)
13563
13564 @staticmethod
13565 def unpack(reader):
13566 obj = meter_mod_failed_error_msg()
13567 _version = reader.read("!B")[0]
13568 assert(_version == 5)
13569 _type = reader.read("!B")[0]
13570 assert(_type == 1)
13571 _length = reader.read("!H")[0]
13572 orig_reader = reader
13573 reader = orig_reader.slice(_length, 4)
13574 obj.xid = reader.read("!L")[0]
13575 _err_type = reader.read("!H")[0]
13576 assert(_err_type == 12)
13577 obj.code = reader.read("!H")[0]
13578 obj.data = str(reader.read_all())
13579 return obj
13580
13581 def __eq__(self, other):
13582 if type(self) != type(other): return False
13583 if self.xid != other.xid: return False
13584 if self.code != other.code: return False
13585 if self.data != other.data: return False
13586 return True
13587
13588 def pretty_print(self, q):
13589 q.text("meter_mod_failed_error_msg {")
13590 with q.group():
13591 with q.indent(2):
13592 q.breakable()
13593 q.text("xid = ");
13594 if self.xid != None:
13595 q.text("%#x" % self.xid)
13596 else:
13597 q.text('None')
13598 q.text(","); q.breakable()
13599 q.text("code = ");
13600 q.text("%#x" % self.code)
13601 q.text(","); q.breakable()
13602 q.text("data = ");
13603 q.pp(self.data)
13604 q.breakable()
13605 q.text('}')
13606
13607error_msg.subtypes[12] = meter_mod_failed_error_msg
13608
13609class meter_stats_reply(stats_reply):
13610 version = 5
13611 type = 19
13612 stats_type = 9
13613
13614 def __init__(self, xid=None, flags=None, entries=None):
13615 if xid != None:
13616 self.xid = xid
13617 else:
13618 self.xid = None
13619 if flags != None:
13620 self.flags = flags
13621 else:
13622 self.flags = 0
13623 if entries != None:
13624 self.entries = entries
13625 else:
13626 self.entries = []
13627 return
13628
13629 def pack(self):
13630 packed = []
13631 packed.append(struct.pack("!B", self.version))
13632 packed.append(struct.pack("!B", self.type))
13633 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13634 packed.append(struct.pack("!L", self.xid))
13635 packed.append(struct.pack("!H", self.stats_type))
13636 packed.append(struct.pack("!H", self.flags))
13637 packed.append('\x00' * 4)
13638 packed.append(loxi.generic_util.pack_list(self.entries))
13639 length = sum([len(x) for x in packed])
13640 packed[2] = struct.pack("!H", length)
13641 return ''.join(packed)
13642
13643 @staticmethod
13644 def unpack(reader):
13645 obj = meter_stats_reply()
13646 _version = reader.read("!B")[0]
13647 assert(_version == 5)
13648 _type = reader.read("!B")[0]
13649 assert(_type == 19)
13650 _length = reader.read("!H")[0]
13651 orig_reader = reader
13652 reader = orig_reader.slice(_length, 4)
13653 obj.xid = reader.read("!L")[0]
13654 _stats_type = reader.read("!H")[0]
13655 assert(_stats_type == 9)
13656 obj.flags = reader.read("!H")[0]
13657 reader.skip(4)
13658 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
13659 return obj
13660
13661 def __eq__(self, other):
13662 if type(self) != type(other): return False
13663 if self.xid != other.xid: return False
13664 if self.flags != other.flags: return False
13665 if self.entries != other.entries: return False
13666 return True
13667
13668 def pretty_print(self, q):
13669 q.text("meter_stats_reply {")
13670 with q.group():
13671 with q.indent(2):
13672 q.breakable()
13673 q.text("xid = ");
13674 if self.xid != None:
13675 q.text("%#x" % self.xid)
13676 else:
13677 q.text('None')
13678 q.text(","); q.breakable()
13679 q.text("flags = ");
13680 q.text("%#x" % self.flags)
13681 q.text(","); q.breakable()
13682 q.text("entries = ");
13683 q.pp(self.entries)
13684 q.breakable()
13685 q.text('}')
13686
13687stats_reply.subtypes[9] = meter_stats_reply
13688
13689class meter_stats_request(stats_request):
13690 version = 5
13691 type = 18
13692 stats_type = 9
13693
13694 def __init__(self, xid=None, flags=None, meter_id=None):
13695 if xid != None:
13696 self.xid = xid
13697 else:
13698 self.xid = None
13699 if flags != None:
13700 self.flags = flags
13701 else:
13702 self.flags = 0
13703 if meter_id != None:
13704 self.meter_id = meter_id
13705 else:
13706 self.meter_id = 0
13707 return
13708
13709 def pack(self):
13710 packed = []
13711 packed.append(struct.pack("!B", self.version))
13712 packed.append(struct.pack("!B", self.type))
13713 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13714 packed.append(struct.pack("!L", self.xid))
13715 packed.append(struct.pack("!H", self.stats_type))
13716 packed.append(struct.pack("!H", self.flags))
13717 packed.append('\x00' * 4)
13718 packed.append(struct.pack("!L", self.meter_id))
13719 packed.append('\x00' * 4)
13720 length = sum([len(x) for x in packed])
13721 packed[2] = struct.pack("!H", length)
13722 return ''.join(packed)
13723
13724 @staticmethod
13725 def unpack(reader):
13726 obj = meter_stats_request()
13727 _version = reader.read("!B")[0]
13728 assert(_version == 5)
13729 _type = reader.read("!B")[0]
13730 assert(_type == 18)
13731 _length = reader.read("!H")[0]
13732 orig_reader = reader
13733 reader = orig_reader.slice(_length, 4)
13734 obj.xid = reader.read("!L")[0]
13735 _stats_type = reader.read("!H")[0]
13736 assert(_stats_type == 9)
13737 obj.flags = reader.read("!H")[0]
13738 reader.skip(4)
13739 obj.meter_id = reader.read("!L")[0]
13740 reader.skip(4)
13741 return obj
13742
13743 def __eq__(self, other):
13744 if type(self) != type(other): return False
13745 if self.xid != other.xid: return False
13746 if self.flags != other.flags: return False
13747 if self.meter_id != other.meter_id: return False
13748 return True
13749
13750 def pretty_print(self, q):
13751 q.text("meter_stats_request {")
13752 with q.group():
13753 with q.indent(2):
13754 q.breakable()
13755 q.text("xid = ");
13756 if self.xid != None:
13757 q.text("%#x" % self.xid)
13758 else:
13759 q.text('None')
13760 q.text(","); q.breakable()
13761 q.text("flags = ");
13762 q.text("%#x" % self.flags)
13763 q.text(","); q.breakable()
13764 q.text("meter_id = ");
13765 q.text("%#x" % self.meter_id)
13766 q.breakable()
13767 q.text('}')
13768
13769stats_request.subtypes[9] = meter_stats_request
13770
13771class nicira_header(experimenter):
13772 subtypes = {}
13773
13774 version = 5
13775 type = 4
13776 experimenter = 8992
13777
13778 def __init__(self, xid=None, subtype=None):
13779 if xid != None:
13780 self.xid = xid
13781 else:
13782 self.xid = None
13783 if subtype != None:
13784 self.subtype = subtype
13785 else:
13786 self.subtype = 0
13787 return
13788
13789 def pack(self):
13790 packed = []
13791 packed.append(struct.pack("!B", self.version))
13792 packed.append(struct.pack("!B", self.type))
13793 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13794 packed.append(struct.pack("!L", self.xid))
13795 packed.append(struct.pack("!L", self.experimenter))
13796 packed.append(struct.pack("!L", self.subtype))
13797 length = sum([len(x) for x in packed])
13798 packed[2] = struct.pack("!H", length)
13799 return ''.join(packed)
13800
13801 @staticmethod
13802 def unpack(reader):
13803 subtype, = reader.peek('!L', 12)
13804 subclass = nicira_header.subtypes.get(subtype)
13805 if subclass:
13806 return subclass.unpack(reader)
13807
13808 obj = nicira_header()
13809 _version = reader.read("!B")[0]
13810 assert(_version == 5)
13811 _type = reader.read("!B")[0]
13812 assert(_type == 4)
13813 _length = reader.read("!H")[0]
13814 orig_reader = reader
13815 reader = orig_reader.slice(_length, 4)
13816 obj.xid = reader.read("!L")[0]
13817 _experimenter = reader.read("!L")[0]
13818 assert(_experimenter == 8992)
13819 obj.subtype = reader.read("!L")[0]
13820 return obj
13821
13822 def __eq__(self, other):
13823 if type(self) != type(other): return False
13824 if self.xid != other.xid: return False
13825 if self.subtype != other.subtype: return False
13826 return True
13827
13828 def pretty_print(self, q):
13829 q.text("nicira_header {")
13830 with q.group():
13831 with q.indent(2):
13832 q.breakable()
13833 q.text("xid = ");
13834 if self.xid != None:
13835 q.text("%#x" % self.xid)
13836 else:
13837 q.text('None')
13838 q.breakable()
13839 q.text('}')
13840
13841experimenter.subtypes[8992] = nicira_header
13842
13843class packet_in(message):
13844 version = 5
13845 type = 10
13846
13847 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13848 if xid != None:
13849 self.xid = xid
13850 else:
13851 self.xid = None
13852 if buffer_id != None:
13853 self.buffer_id = buffer_id
13854 else:
13855 self.buffer_id = 0
13856 if total_len != None:
13857 self.total_len = total_len
13858 else:
13859 self.total_len = 0
13860 if reason != None:
13861 self.reason = reason
13862 else:
13863 self.reason = 0
13864 if table_id != None:
13865 self.table_id = table_id
13866 else:
13867 self.table_id = 0
13868 if cookie != None:
13869 self.cookie = cookie
13870 else:
13871 self.cookie = 0
13872 if match != None:
13873 self.match = match
13874 else:
13875 self.match = ofp.match()
13876 if data != None:
13877 self.data = data
13878 else:
13879 self.data = ''
13880 return
13881
13882 def pack(self):
13883 packed = []
13884 packed.append(struct.pack("!B", self.version))
13885 packed.append(struct.pack("!B", self.type))
13886 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13887 packed.append(struct.pack("!L", self.xid))
13888 packed.append(struct.pack("!L", self.buffer_id))
13889 packed.append(struct.pack("!H", self.total_len))
13890 packed.append(struct.pack("!B", self.reason))
13891 packed.append(struct.pack("!B", self.table_id))
13892 packed.append(struct.pack("!Q", self.cookie))
13893 packed.append(self.match.pack())
13894 packed.append('\x00' * 2)
13895 packed.append(self.data)
13896 length = sum([len(x) for x in packed])
13897 packed[2] = struct.pack("!H", length)
13898 return ''.join(packed)
13899
13900 @staticmethod
13901 def unpack(reader):
13902 obj = packet_in()
13903 _version = reader.read("!B")[0]
13904 assert(_version == 5)
13905 _type = reader.read("!B")[0]
13906 assert(_type == 10)
13907 _length = reader.read("!H")[0]
13908 orig_reader = reader
13909 reader = orig_reader.slice(_length, 4)
13910 obj.xid = reader.read("!L")[0]
13911 obj.buffer_id = reader.read("!L")[0]
13912 obj.total_len = reader.read("!H")[0]
13913 obj.reason = reader.read("!B")[0]
13914 obj.table_id = reader.read("!B")[0]
13915 obj.cookie = reader.read("!Q")[0]
13916 obj.match = ofp.match.unpack(reader)
13917 reader.skip(2)
13918 obj.data = str(reader.read_all())
13919 return obj
13920
13921 def __eq__(self, other):
13922 if type(self) != type(other): return False
13923 if self.xid != other.xid: return False
13924 if self.buffer_id != other.buffer_id: return False
13925 if self.total_len != other.total_len: return False
13926 if self.reason != other.reason: return False
13927 if self.table_id != other.table_id: return False
13928 if self.cookie != other.cookie: return False
13929 if self.match != other.match: return False
13930 if self.data != other.data: return False
13931 return True
13932
13933 def pretty_print(self, q):
13934 q.text("packet_in {")
13935 with q.group():
13936 with q.indent(2):
13937 q.breakable()
13938 q.text("xid = ");
13939 if self.xid != None:
13940 q.text("%#x" % self.xid)
13941 else:
13942 q.text('None')
13943 q.text(","); q.breakable()
13944 q.text("buffer_id = ");
13945 q.text("%#x" % self.buffer_id)
13946 q.text(","); q.breakable()
13947 q.text("total_len = ");
13948 q.text("%#x" % self.total_len)
13949 q.text(","); q.breakable()
13950 q.text("reason = ");
13951 q.text("%#x" % self.reason)
13952 q.text(","); q.breakable()
13953 q.text("table_id = ");
13954 q.text("%#x" % self.table_id)
13955 q.text(","); q.breakable()
13956 q.text("cookie = ");
13957 q.text("%#x" % self.cookie)
13958 q.text(","); q.breakable()
13959 q.text("match = ");
13960 q.pp(self.match)
13961 q.text(","); q.breakable()
13962 q.text("data = ");
13963 q.pp(self.data)
13964 q.breakable()
13965 q.text('}')
13966
13967message.subtypes[10] = packet_in
13968
13969class packet_out(message):
13970 version = 5
13971 type = 13
13972
13973 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13974 if xid != None:
13975 self.xid = xid
13976 else:
13977 self.xid = None
13978 if buffer_id != None:
13979 self.buffer_id = buffer_id
13980 else:
13981 self.buffer_id = 0
13982 if in_port != None:
13983 self.in_port = in_port
13984 else:
13985 self.in_port = 0
13986 if actions != None:
13987 self.actions = actions
13988 else:
13989 self.actions = []
13990 if data != None:
13991 self.data = data
13992 else:
13993 self.data = ''
13994 return
13995
13996 def pack(self):
13997 packed = []
13998 packed.append(struct.pack("!B", self.version))
13999 packed.append(struct.pack("!B", self.type))
14000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14001 packed.append(struct.pack("!L", self.xid))
14002 packed.append(struct.pack("!L", self.buffer_id))
14003 packed.append(util.pack_port_no(self.in_port))
14004 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
14005 packed.append('\x00' * 6)
14006 packed.append(loxi.generic_util.pack_list(self.actions))
14007 packed[6] = struct.pack("!H", len(packed[-1]))
14008 packed.append(self.data)
14009 length = sum([len(x) for x in packed])
14010 packed[2] = struct.pack("!H", length)
14011 return ''.join(packed)
14012
14013 @staticmethod
14014 def unpack(reader):
14015 obj = packet_out()
14016 _version = reader.read("!B")[0]
14017 assert(_version == 5)
14018 _type = reader.read("!B")[0]
14019 assert(_type == 13)
14020 _length = reader.read("!H")[0]
14021 orig_reader = reader
14022 reader = orig_reader.slice(_length, 4)
14023 obj.xid = reader.read("!L")[0]
14024 obj.buffer_id = reader.read("!L")[0]
14025 obj.in_port = util.unpack_port_no(reader)
14026 _actions_len = reader.read("!H")[0]
14027 reader.skip(6)
14028 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
14029 obj.data = str(reader.read_all())
14030 return obj
14031
14032 def __eq__(self, other):
14033 if type(self) != type(other): return False
14034 if self.xid != other.xid: return False
14035 if self.buffer_id != other.buffer_id: return False
14036 if self.in_port != other.in_port: return False
14037 if self.actions != other.actions: return False
14038 if self.data != other.data: return False
14039 return True
14040
14041 def pretty_print(self, q):
14042 q.text("packet_out {")
14043 with q.group():
14044 with q.indent(2):
14045 q.breakable()
14046 q.text("xid = ");
14047 if self.xid != None:
14048 q.text("%#x" % self.xid)
14049 else:
14050 q.text('None')
14051 q.text(","); q.breakable()
14052 q.text("buffer_id = ");
14053 q.text("%#x" % self.buffer_id)
14054 q.text(","); q.breakable()
14055 q.text("in_port = ");
14056 q.text(util.pretty_port(self.in_port))
14057 q.text(","); q.breakable()
14058 q.text("actions = ");
14059 q.pp(self.actions)
14060 q.text(","); q.breakable()
14061 q.text("data = ");
14062 q.pp(self.data)
14063 q.breakable()
14064 q.text('}')
14065
14066message.subtypes[13] = packet_out
14067
14068class port_desc_stats_reply(stats_reply):
14069 version = 5
14070 type = 19
14071 stats_type = 13
14072
14073 def __init__(self, xid=None, flags=None, entries=None):
14074 if xid != None:
14075 self.xid = xid
14076 else:
14077 self.xid = None
14078 if flags != None:
14079 self.flags = flags
14080 else:
14081 self.flags = 0
14082 if entries != None:
14083 self.entries = entries
14084 else:
14085 self.entries = []
14086 return
14087
14088 def pack(self):
14089 packed = []
14090 packed.append(struct.pack("!B", self.version))
14091 packed.append(struct.pack("!B", self.type))
14092 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14093 packed.append(struct.pack("!L", self.xid))
14094 packed.append(struct.pack("!H", self.stats_type))
14095 packed.append(struct.pack("!H", self.flags))
14096 packed.append('\x00' * 4)
14097 packed.append(loxi.generic_util.pack_list(self.entries))
14098 length = sum([len(x) for x in packed])
14099 packed[2] = struct.pack("!H", length)
14100 return ''.join(packed)
14101
14102 @staticmethod
14103 def unpack(reader):
14104 obj = port_desc_stats_reply()
14105 _version = reader.read("!B")[0]
14106 assert(_version == 5)
14107 _type = reader.read("!B")[0]
14108 assert(_type == 19)
14109 _length = reader.read("!H")[0]
14110 orig_reader = reader
14111 reader = orig_reader.slice(_length, 4)
14112 obj.xid = reader.read("!L")[0]
14113 _stats_type = reader.read("!H")[0]
14114 assert(_stats_type == 13)
14115 obj.flags = reader.read("!H")[0]
14116 reader.skip(4)
14117 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
14118 return obj
14119
14120 def __eq__(self, other):
14121 if type(self) != type(other): return False
14122 if self.xid != other.xid: return False
14123 if self.flags != other.flags: return False
14124 if self.entries != other.entries: return False
14125 return True
14126
14127 def pretty_print(self, q):
14128 q.text("port_desc_stats_reply {")
14129 with q.group():
14130 with q.indent(2):
14131 q.breakable()
14132 q.text("xid = ");
14133 if self.xid != None:
14134 q.text("%#x" % self.xid)
14135 else:
14136 q.text('None')
14137 q.text(","); q.breakable()
14138 q.text("flags = ");
14139 q.text("%#x" % self.flags)
14140 q.text(","); q.breakable()
14141 q.text("entries = ");
14142 q.pp(self.entries)
14143 q.breakable()
14144 q.text('}')
14145
14146stats_reply.subtypes[13] = port_desc_stats_reply
14147
14148class port_desc_stats_request(stats_request):
14149 version = 5
14150 type = 18
14151 stats_type = 13
14152
14153 def __init__(self, xid=None, flags=None):
14154 if xid != None:
14155 self.xid = xid
14156 else:
14157 self.xid = None
14158 if flags != None:
14159 self.flags = flags
14160 else:
14161 self.flags = 0
14162 return
14163
14164 def pack(self):
14165 packed = []
14166 packed.append(struct.pack("!B", self.version))
14167 packed.append(struct.pack("!B", self.type))
14168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14169 packed.append(struct.pack("!L", self.xid))
14170 packed.append(struct.pack("!H", self.stats_type))
14171 packed.append(struct.pack("!H", self.flags))
14172 packed.append('\x00' * 4)
14173 length = sum([len(x) for x in packed])
14174 packed[2] = struct.pack("!H", length)
14175 return ''.join(packed)
14176
14177 @staticmethod
14178 def unpack(reader):
14179 obj = port_desc_stats_request()
14180 _version = reader.read("!B")[0]
14181 assert(_version == 5)
14182 _type = reader.read("!B")[0]
14183 assert(_type == 18)
14184 _length = reader.read("!H")[0]
14185 orig_reader = reader
14186 reader = orig_reader.slice(_length, 4)
14187 obj.xid = reader.read("!L")[0]
14188 _stats_type = reader.read("!H")[0]
14189 assert(_stats_type == 13)
14190 obj.flags = reader.read("!H")[0]
14191 reader.skip(4)
14192 return obj
14193
14194 def __eq__(self, other):
14195 if type(self) != type(other): return False
14196 if self.xid != other.xid: return False
14197 if self.flags != other.flags: return False
14198 return True
14199
14200 def pretty_print(self, q):
14201 q.text("port_desc_stats_request {")
14202 with q.group():
14203 with q.indent(2):
14204 q.breakable()
14205 q.text("xid = ");
14206 if self.xid != None:
14207 q.text("%#x" % self.xid)
14208 else:
14209 q.text('None')
14210 q.text(","); q.breakable()
14211 q.text("flags = ");
14212 q.text("%#x" % self.flags)
14213 q.breakable()
14214 q.text('}')
14215
14216stats_request.subtypes[13] = port_desc_stats_request
14217
14218class port_mod(message):
14219 version = 5
14220 type = 16
14221
14222 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
14223 if xid != None:
14224 self.xid = xid
14225 else:
14226 self.xid = None
14227 if port_no != None:
14228 self.port_no = port_no
14229 else:
14230 self.port_no = 0
14231 if hw_addr != None:
14232 self.hw_addr = hw_addr
14233 else:
14234 self.hw_addr = [0,0,0,0,0,0]
14235 if config != None:
14236 self.config = config
14237 else:
14238 self.config = 0
14239 if mask != None:
14240 self.mask = mask
14241 else:
14242 self.mask = 0
14243 if properties != None:
14244 self.properties = properties
14245 else:
14246 self.properties = []
14247 return
14248
14249 def pack(self):
14250 packed = []
14251 packed.append(struct.pack("!B", self.version))
14252 packed.append(struct.pack("!B", self.type))
14253 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14254 packed.append(struct.pack("!L", self.xid))
14255 packed.append(util.pack_port_no(self.port_no))
14256 packed.append('\x00' * 4)
14257 packed.append(struct.pack("!6B", *self.hw_addr))
14258 packed.append('\x00' * 2)
14259 packed.append(struct.pack("!L", self.config))
14260 packed.append(struct.pack("!L", self.mask))
14261 packed.append(loxi.generic_util.pack_list(self.properties))
14262 length = sum([len(x) for x in packed])
14263 packed[2] = struct.pack("!H", length)
14264 return ''.join(packed)
14265
14266 @staticmethod
14267 def unpack(reader):
14268 obj = port_mod()
14269 _version = reader.read("!B")[0]
14270 assert(_version == 5)
14271 _type = reader.read("!B")[0]
14272 assert(_type == 16)
14273 _length = reader.read("!H")[0]
14274 orig_reader = reader
14275 reader = orig_reader.slice(_length, 4)
14276 obj.xid = reader.read("!L")[0]
14277 obj.port_no = util.unpack_port_no(reader)
14278 reader.skip(4)
14279 obj.hw_addr = list(reader.read('!6B'))
14280 reader.skip(2)
14281 obj.config = reader.read("!L")[0]
14282 obj.mask = reader.read("!L")[0]
14283 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_mod_prop.port_mod_prop.unpack)
14284 return obj
14285
14286 def __eq__(self, other):
14287 if type(self) != type(other): return False
14288 if self.xid != other.xid: return False
14289 if self.port_no != other.port_no: return False
14290 if self.hw_addr != other.hw_addr: return False
14291 if self.config != other.config: return False
14292 if self.mask != other.mask: return False
14293 if self.properties != other.properties: return False
14294 return True
14295
14296 def pretty_print(self, q):
14297 q.text("port_mod {")
14298 with q.group():
14299 with q.indent(2):
14300 q.breakable()
14301 q.text("xid = ");
14302 if self.xid != None:
14303 q.text("%#x" % self.xid)
14304 else:
14305 q.text('None')
14306 q.text(","); q.breakable()
14307 q.text("port_no = ");
14308 q.text(util.pretty_port(self.port_no))
14309 q.text(","); q.breakable()
14310 q.text("hw_addr = ");
14311 q.text(util.pretty_mac(self.hw_addr))
14312 q.text(","); q.breakable()
14313 q.text("config = ");
14314 q.text("%#x" % self.config)
14315 q.text(","); q.breakable()
14316 q.text("mask = ");
14317 q.text("%#x" % self.mask)
14318 q.text(","); q.breakable()
14319 q.text("properties = ");
14320 q.pp(self.properties)
14321 q.breakable()
14322 q.text('}')
14323
14324message.subtypes[16] = port_mod
14325
14326class port_mod_failed_error_msg(error_msg):
14327 version = 5
14328 type = 1
14329 err_type = 7
14330
14331 def __init__(self, xid=None, code=None, data=None):
14332 if xid != None:
14333 self.xid = xid
14334 else:
14335 self.xid = None
14336 if code != None:
14337 self.code = code
14338 else:
14339 self.code = 0
14340 if data != None:
14341 self.data = data
14342 else:
14343 self.data = ''
14344 return
14345
14346 def pack(self):
14347 packed = []
14348 packed.append(struct.pack("!B", self.version))
14349 packed.append(struct.pack("!B", self.type))
14350 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14351 packed.append(struct.pack("!L", self.xid))
14352 packed.append(struct.pack("!H", self.err_type))
14353 packed.append(struct.pack("!H", self.code))
14354 packed.append(self.data)
14355 length = sum([len(x) for x in packed])
14356 packed[2] = struct.pack("!H", length)
14357 return ''.join(packed)
14358
14359 @staticmethod
14360 def unpack(reader):
14361 obj = port_mod_failed_error_msg()
14362 _version = reader.read("!B")[0]
14363 assert(_version == 5)
14364 _type = reader.read("!B")[0]
14365 assert(_type == 1)
14366 _length = reader.read("!H")[0]
14367 orig_reader = reader
14368 reader = orig_reader.slice(_length, 4)
14369 obj.xid = reader.read("!L")[0]
14370 _err_type = reader.read("!H")[0]
14371 assert(_err_type == 7)
14372 obj.code = reader.read("!H")[0]
14373 obj.data = str(reader.read_all())
14374 return obj
14375
14376 def __eq__(self, other):
14377 if type(self) != type(other): return False
14378 if self.xid != other.xid: return False
14379 if self.code != other.code: return False
14380 if self.data != other.data: return False
14381 return True
14382
14383 def pretty_print(self, q):
14384 q.text("port_mod_failed_error_msg {")
14385 with q.group():
14386 with q.indent(2):
14387 q.breakable()
14388 q.text("xid = ");
14389 if self.xid != None:
14390 q.text("%#x" % self.xid)
14391 else:
14392 q.text('None')
14393 q.text(","); q.breakable()
14394 q.text("code = ");
14395 q.text("%#x" % self.code)
14396 q.text(","); q.breakable()
14397 q.text("data = ");
14398 q.pp(self.data)
14399 q.breakable()
14400 q.text('}')
14401
14402error_msg.subtypes[7] = port_mod_failed_error_msg
14403
14404class port_stats_reply(stats_reply):
14405 version = 5
14406 type = 19
14407 stats_type = 4
14408
14409 def __init__(self, xid=None, flags=None, entries=None):
14410 if xid != None:
14411 self.xid = xid
14412 else:
14413 self.xid = None
14414 if flags != None:
14415 self.flags = flags
14416 else:
14417 self.flags = 0
14418 if entries != None:
14419 self.entries = entries
14420 else:
14421 self.entries = []
14422 return
14423
14424 def pack(self):
14425 packed = []
14426 packed.append(struct.pack("!B", self.version))
14427 packed.append(struct.pack("!B", self.type))
14428 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14429 packed.append(struct.pack("!L", self.xid))
14430 packed.append(struct.pack("!H", self.stats_type))
14431 packed.append(struct.pack("!H", self.flags))
14432 packed.append('\x00' * 4)
14433 packed.append(loxi.generic_util.pack_list(self.entries))
14434 length = sum([len(x) for x in packed])
14435 packed[2] = struct.pack("!H", length)
14436 return ''.join(packed)
14437
14438 @staticmethod
14439 def unpack(reader):
14440 obj = port_stats_reply()
14441 _version = reader.read("!B")[0]
14442 assert(_version == 5)
14443 _type = reader.read("!B")[0]
14444 assert(_type == 19)
14445 _length = reader.read("!H")[0]
14446 orig_reader = reader
14447 reader = orig_reader.slice(_length, 4)
14448 obj.xid = reader.read("!L")[0]
14449 _stats_type = reader.read("!H")[0]
14450 assert(_stats_type == 4)
14451 obj.flags = reader.read("!H")[0]
14452 reader.skip(4)
14453 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
14454 return obj
14455
14456 def __eq__(self, other):
14457 if type(self) != type(other): return False
14458 if self.xid != other.xid: return False
14459 if self.flags != other.flags: return False
14460 if self.entries != other.entries: return False
14461 return True
14462
14463 def pretty_print(self, q):
14464 q.text("port_stats_reply {")
14465 with q.group():
14466 with q.indent(2):
14467 q.breakable()
14468 q.text("xid = ");
14469 if self.xid != None:
14470 q.text("%#x" % self.xid)
14471 else:
14472 q.text('None')
14473 q.text(","); q.breakable()
14474 q.text("flags = ");
14475 q.text("%#x" % self.flags)
14476 q.text(","); q.breakable()
14477 q.text("entries = ");
14478 q.pp(self.entries)
14479 q.breakable()
14480 q.text('}')
14481
14482stats_reply.subtypes[4] = port_stats_reply
14483
14484class port_stats_request(stats_request):
14485 version = 5
14486 type = 18
14487 stats_type = 4
14488
14489 def __init__(self, xid=None, flags=None, port_no=None):
14490 if xid != None:
14491 self.xid = xid
14492 else:
14493 self.xid = None
14494 if flags != None:
14495 self.flags = flags
14496 else:
14497 self.flags = 0
14498 if port_no != None:
14499 self.port_no = port_no
14500 else:
14501 self.port_no = 0
14502 return
14503
14504 def pack(self):
14505 packed = []
14506 packed.append(struct.pack("!B", self.version))
14507 packed.append(struct.pack("!B", self.type))
14508 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14509 packed.append(struct.pack("!L", self.xid))
14510 packed.append(struct.pack("!H", self.stats_type))
14511 packed.append(struct.pack("!H", self.flags))
14512 packed.append('\x00' * 4)
14513 packed.append(util.pack_port_no(self.port_no))
14514 packed.append('\x00' * 4)
14515 length = sum([len(x) for x in packed])
14516 packed[2] = struct.pack("!H", length)
14517 return ''.join(packed)
14518
14519 @staticmethod
14520 def unpack(reader):
14521 obj = port_stats_request()
14522 _version = reader.read("!B")[0]
14523 assert(_version == 5)
14524 _type = reader.read("!B")[0]
14525 assert(_type == 18)
14526 _length = reader.read("!H")[0]
14527 orig_reader = reader
14528 reader = orig_reader.slice(_length, 4)
14529 obj.xid = reader.read("!L")[0]
14530 _stats_type = reader.read("!H")[0]
14531 assert(_stats_type == 4)
14532 obj.flags = reader.read("!H")[0]
14533 reader.skip(4)
14534 obj.port_no = util.unpack_port_no(reader)
14535 reader.skip(4)
14536 return obj
14537
14538 def __eq__(self, other):
14539 if type(self) != type(other): return False
14540 if self.xid != other.xid: return False
14541 if self.flags != other.flags: return False
14542 if self.port_no != other.port_no: return False
14543 return True
14544
14545 def pretty_print(self, q):
14546 q.text("port_stats_request {")
14547 with q.group():
14548 with q.indent(2):
14549 q.breakable()
14550 q.text("xid = ");
14551 if self.xid != None:
14552 q.text("%#x" % self.xid)
14553 else:
14554 q.text('None')
14555 q.text(","); q.breakable()
14556 q.text("flags = ");
14557 q.text("%#x" % self.flags)
14558 q.text(","); q.breakable()
14559 q.text("port_no = ");
14560 q.text(util.pretty_port(self.port_no))
14561 q.breakable()
14562 q.text('}')
14563
14564stats_request.subtypes[4] = port_stats_request
14565
14566class port_status(message):
14567 version = 5
14568 type = 12
14569
14570 def __init__(self, xid=None, reason=None, desc=None):
14571 if xid != None:
14572 self.xid = xid
14573 else:
14574 self.xid = None
14575 if reason != None:
14576 self.reason = reason
14577 else:
14578 self.reason = 0
14579 if desc != None:
14580 self.desc = desc
14581 else:
14582 self.desc = ofp.port_desc()
14583 return
14584
14585 def pack(self):
14586 packed = []
14587 packed.append(struct.pack("!B", self.version))
14588 packed.append(struct.pack("!B", self.type))
14589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14590 packed.append(struct.pack("!L", self.xid))
14591 packed.append(struct.pack("!B", self.reason))
14592 packed.append('\x00' * 7)
14593 packed.append(self.desc.pack())
14594 length = sum([len(x) for x in packed])
14595 packed[2] = struct.pack("!H", length)
14596 return ''.join(packed)
14597
14598 @staticmethod
14599 def unpack(reader):
14600 obj = port_status()
14601 _version = reader.read("!B")[0]
14602 assert(_version == 5)
14603 _type = reader.read("!B")[0]
14604 assert(_type == 12)
14605 _length = reader.read("!H")[0]
14606 orig_reader = reader
14607 reader = orig_reader.slice(_length, 4)
14608 obj.xid = reader.read("!L")[0]
14609 obj.reason = reader.read("!B")[0]
14610 reader.skip(7)
14611 obj.desc = ofp.port_desc.unpack(reader)
14612 return obj
14613
14614 def __eq__(self, other):
14615 if type(self) != type(other): return False
14616 if self.xid != other.xid: return False
14617 if self.reason != other.reason: return False
14618 if self.desc != other.desc: return False
14619 return True
14620
14621 def pretty_print(self, q):
14622 q.text("port_status {")
14623 with q.group():
14624 with q.indent(2):
14625 q.breakable()
14626 q.text("xid = ");
14627 if self.xid != None:
14628 q.text("%#x" % self.xid)
14629 else:
14630 q.text('None')
14631 q.text(","); q.breakable()
14632 q.text("reason = ");
14633 q.text("%#x" % self.reason)
14634 q.text(","); q.breakable()
14635 q.text("desc = ");
14636 q.pp(self.desc)
14637 q.breakable()
14638 q.text('}')
14639
14640message.subtypes[12] = port_status
14641
14642class queue_desc_stats_reply(stats_reply):
14643 version = 5
14644 type = 19
14645 stats_type = 15
14646
14647 def __init__(self, xid=None, flags=None, entries=None):
14648 if xid != None:
14649 self.xid = xid
14650 else:
14651 self.xid = None
14652 if flags != None:
14653 self.flags = flags
14654 else:
14655 self.flags = 0
14656 if entries != None:
14657 self.entries = entries
14658 else:
14659 self.entries = []
14660 return
14661
14662 def pack(self):
14663 packed = []
14664 packed.append(struct.pack("!B", self.version))
14665 packed.append(struct.pack("!B", self.type))
14666 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14667 packed.append(struct.pack("!L", self.xid))
14668 packed.append(struct.pack("!H", self.stats_type))
14669 packed.append(struct.pack("!H", self.flags))
14670 packed.append('\x00' * 4)
14671 packed.append(loxi.generic_util.pack_list(self.entries))
14672 length = sum([len(x) for x in packed])
14673 packed[2] = struct.pack("!H", length)
14674 return ''.join(packed)
14675
14676 @staticmethod
14677 def unpack(reader):
14678 obj = queue_desc_stats_reply()
14679 _version = reader.read("!B")[0]
14680 assert(_version == 5)
14681 _type = reader.read("!B")[0]
14682 assert(_type == 19)
14683 _length = reader.read("!H")[0]
14684 orig_reader = reader
14685 reader = orig_reader.slice(_length, 4)
14686 obj.xid = reader.read("!L")[0]
14687 _stats_type = reader.read("!H")[0]
14688 assert(_stats_type == 15)
14689 obj.flags = reader.read("!H")[0]
14690 reader.skip(4)
14691 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_desc.unpack)
14692 return obj
14693
14694 def __eq__(self, other):
14695 if type(self) != type(other): return False
14696 if self.xid != other.xid: return False
14697 if self.flags != other.flags: return False
14698 if self.entries != other.entries: return False
14699 return True
14700
14701 def pretty_print(self, q):
14702 q.text("queue_desc_stats_reply {")
14703 with q.group():
14704 with q.indent(2):
14705 q.breakable()
14706 q.text("xid = ");
14707 if self.xid != None:
14708 q.text("%#x" % self.xid)
14709 else:
14710 q.text('None')
14711 q.text(","); q.breakable()
14712 q.text("flags = ");
14713 q.text("%#x" % self.flags)
14714 q.text(","); q.breakable()
14715 q.text("entries = ");
14716 q.pp(self.entries)
14717 q.breakable()
14718 q.text('}')
14719
14720stats_reply.subtypes[15] = queue_desc_stats_reply
14721
14722class queue_desc_stats_request(stats_request):
14723 version = 5
14724 type = 18
14725 stats_type = 15
14726
14727 def __init__(self, xid=None, flags=None):
14728 if xid != None:
14729 self.xid = xid
14730 else:
14731 self.xid = None
14732 if flags != None:
14733 self.flags = flags
14734 else:
14735 self.flags = 0
14736 return
14737
14738 def pack(self):
14739 packed = []
14740 packed.append(struct.pack("!B", self.version))
14741 packed.append(struct.pack("!B", self.type))
14742 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14743 packed.append(struct.pack("!L", self.xid))
14744 packed.append(struct.pack("!H", self.stats_type))
14745 packed.append(struct.pack("!H", self.flags))
14746 packed.append('\x00' * 4)
14747 length = sum([len(x) for x in packed])
14748 packed[2] = struct.pack("!H", length)
14749 return ''.join(packed)
14750
14751 @staticmethod
14752 def unpack(reader):
14753 obj = queue_desc_stats_request()
14754 _version = reader.read("!B")[0]
14755 assert(_version == 5)
14756 _type = reader.read("!B")[0]
14757 assert(_type == 18)
14758 _length = reader.read("!H")[0]
14759 orig_reader = reader
14760 reader = orig_reader.slice(_length, 4)
14761 obj.xid = reader.read("!L")[0]
14762 _stats_type = reader.read("!H")[0]
14763 assert(_stats_type == 15)
14764 obj.flags = reader.read("!H")[0]
14765 reader.skip(4)
14766 return obj
14767
14768 def __eq__(self, other):
14769 if type(self) != type(other): return False
14770 if self.xid != other.xid: return False
14771 if self.flags != other.flags: return False
14772 return True
14773
14774 def pretty_print(self, q):
14775 q.text("queue_desc_stats_request {")
14776 with q.group():
14777 with q.indent(2):
14778 q.breakable()
14779 q.text("xid = ");
14780 if self.xid != None:
14781 q.text("%#x" % self.xid)
14782 else:
14783 q.text('None')
14784 q.text(","); q.breakable()
14785 q.text("flags = ");
14786 q.text("%#x" % self.flags)
14787 q.breakable()
14788 q.text('}')
14789
14790stats_request.subtypes[15] = queue_desc_stats_request
14791
14792class queue_op_failed_error_msg(error_msg):
14793 version = 5
14794 type = 1
14795 err_type = 9
14796
14797 def __init__(self, xid=None, code=None, data=None):
14798 if xid != None:
14799 self.xid = xid
14800 else:
14801 self.xid = None
14802 if code != None:
14803 self.code = code
14804 else:
14805 self.code = 0
14806 if data != None:
14807 self.data = data
14808 else:
14809 self.data = ''
14810 return
14811
14812 def pack(self):
14813 packed = []
14814 packed.append(struct.pack("!B", self.version))
14815 packed.append(struct.pack("!B", self.type))
14816 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14817 packed.append(struct.pack("!L", self.xid))
14818 packed.append(struct.pack("!H", self.err_type))
14819 packed.append(struct.pack("!H", self.code))
14820 packed.append(self.data)
14821 length = sum([len(x) for x in packed])
14822 packed[2] = struct.pack("!H", length)
14823 return ''.join(packed)
14824
14825 @staticmethod
14826 def unpack(reader):
14827 obj = queue_op_failed_error_msg()
14828 _version = reader.read("!B")[0]
14829 assert(_version == 5)
14830 _type = reader.read("!B")[0]
14831 assert(_type == 1)
14832 _length = reader.read("!H")[0]
14833 orig_reader = reader
14834 reader = orig_reader.slice(_length, 4)
14835 obj.xid = reader.read("!L")[0]
14836 _err_type = reader.read("!H")[0]
14837 assert(_err_type == 9)
14838 obj.code = reader.read("!H")[0]
14839 obj.data = str(reader.read_all())
14840 return obj
14841
14842 def __eq__(self, other):
14843 if type(self) != type(other): return False
14844 if self.xid != other.xid: return False
14845 if self.code != other.code: return False
14846 if self.data != other.data: return False
14847 return True
14848
14849 def pretty_print(self, q):
14850 q.text("queue_op_failed_error_msg {")
14851 with q.group():
14852 with q.indent(2):
14853 q.breakable()
14854 q.text("xid = ");
14855 if self.xid != None:
14856 q.text("%#x" % self.xid)
14857 else:
14858 q.text('None')
14859 q.text(","); q.breakable()
14860 q.text("code = ");
14861 q.text("%#x" % self.code)
14862 q.text(","); q.breakable()
14863 q.text("data = ");
14864 q.pp(self.data)
14865 q.breakable()
14866 q.text('}')
14867
14868error_msg.subtypes[9] = queue_op_failed_error_msg
14869
14870class queue_stats_reply(stats_reply):
14871 version = 5
14872 type = 19
14873 stats_type = 5
14874
14875 def __init__(self, xid=None, flags=None, entries=None):
14876 if xid != None:
14877 self.xid = xid
14878 else:
14879 self.xid = None
14880 if flags != None:
14881 self.flags = flags
14882 else:
14883 self.flags = 0
14884 if entries != None:
14885 self.entries = entries
14886 else:
14887 self.entries = []
14888 return
14889
14890 def pack(self):
14891 packed = []
14892 packed.append(struct.pack("!B", self.version))
14893 packed.append(struct.pack("!B", self.type))
14894 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14895 packed.append(struct.pack("!L", self.xid))
14896 packed.append(struct.pack("!H", self.stats_type))
14897 packed.append(struct.pack("!H", self.flags))
14898 packed.append('\x00' * 4)
14899 packed.append(loxi.generic_util.pack_list(self.entries))
14900 length = sum([len(x) for x in packed])
14901 packed[2] = struct.pack("!H", length)
14902 return ''.join(packed)
14903
14904 @staticmethod
14905 def unpack(reader):
14906 obj = queue_stats_reply()
14907 _version = reader.read("!B")[0]
14908 assert(_version == 5)
14909 _type = reader.read("!B")[0]
14910 assert(_type == 19)
14911 _length = reader.read("!H")[0]
14912 orig_reader = reader
14913 reader = orig_reader.slice(_length, 4)
14914 obj.xid = reader.read("!L")[0]
14915 _stats_type = reader.read("!H")[0]
14916 assert(_stats_type == 5)
14917 obj.flags = reader.read("!H")[0]
14918 reader.skip(4)
14919 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
14920 return obj
14921
14922 def __eq__(self, other):
14923 if type(self) != type(other): return False
14924 if self.xid != other.xid: return False
14925 if self.flags != other.flags: return False
14926 if self.entries != other.entries: return False
14927 return True
14928
14929 def pretty_print(self, q):
14930 q.text("queue_stats_reply {")
14931 with q.group():
14932 with q.indent(2):
14933 q.breakable()
14934 q.text("xid = ");
14935 if self.xid != None:
14936 q.text("%#x" % self.xid)
14937 else:
14938 q.text('None')
14939 q.text(","); q.breakable()
14940 q.text("flags = ");
14941 q.text("%#x" % self.flags)
14942 q.text(","); q.breakable()
14943 q.text("entries = ");
14944 q.pp(self.entries)
14945 q.breakable()
14946 q.text('}')
14947
14948stats_reply.subtypes[5] = queue_stats_reply
14949
14950class queue_stats_request(stats_request):
14951 version = 5
14952 type = 18
14953 stats_type = 5
14954
14955 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14956 if xid != None:
14957 self.xid = xid
14958 else:
14959 self.xid = None
14960 if flags != None:
14961 self.flags = flags
14962 else:
14963 self.flags = 0
14964 if port_no != None:
14965 self.port_no = port_no
14966 else:
14967 self.port_no = 0
14968 if queue_id != None:
14969 self.queue_id = queue_id
14970 else:
14971 self.queue_id = 0
14972 return
14973
14974 def pack(self):
14975 packed = []
14976 packed.append(struct.pack("!B", self.version))
14977 packed.append(struct.pack("!B", self.type))
14978 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14979 packed.append(struct.pack("!L", self.xid))
14980 packed.append(struct.pack("!H", self.stats_type))
14981 packed.append(struct.pack("!H", self.flags))
14982 packed.append('\x00' * 4)
14983 packed.append(util.pack_port_no(self.port_no))
14984 packed.append(struct.pack("!L", self.queue_id))
14985 length = sum([len(x) for x in packed])
14986 packed[2] = struct.pack("!H", length)
14987 return ''.join(packed)
14988
14989 @staticmethod
14990 def unpack(reader):
14991 obj = queue_stats_request()
14992 _version = reader.read("!B")[0]
14993 assert(_version == 5)
14994 _type = reader.read("!B")[0]
14995 assert(_type == 18)
14996 _length = reader.read("!H")[0]
14997 orig_reader = reader
14998 reader = orig_reader.slice(_length, 4)
14999 obj.xid = reader.read("!L")[0]
15000 _stats_type = reader.read("!H")[0]
15001 assert(_stats_type == 5)
15002 obj.flags = reader.read("!H")[0]
15003 reader.skip(4)
15004 obj.port_no = util.unpack_port_no(reader)
15005 obj.queue_id = reader.read("!L")[0]
15006 return obj
15007
15008 def __eq__(self, other):
15009 if type(self) != type(other): return False
15010 if self.xid != other.xid: return False
15011 if self.flags != other.flags: return False
15012 if self.port_no != other.port_no: return False
15013 if self.queue_id != other.queue_id: return False
15014 return True
15015
15016 def pretty_print(self, q):
15017 q.text("queue_stats_request {")
15018 with q.group():
15019 with q.indent(2):
15020 q.breakable()
15021 q.text("xid = ");
15022 if self.xid != None:
15023 q.text("%#x" % self.xid)
15024 else:
15025 q.text('None')
15026 q.text(","); q.breakable()
15027 q.text("flags = ");
15028 q.text("%#x" % self.flags)
15029 q.text(","); q.breakable()
15030 q.text("port_no = ");
15031 q.text(util.pretty_port(self.port_no))
15032 q.text(","); q.breakable()
15033 q.text("queue_id = ");
15034 q.text("%#x" % self.queue_id)
15035 q.breakable()
15036 q.text('}')
15037
15038stats_request.subtypes[5] = queue_stats_request
15039
15040class requestforward(message):
15041 version = 5
15042 type = 32
15043
15044 def __init__(self, xid=None, role=None, data=None):
15045 if xid != None:
15046 self.xid = xid
15047 else:
15048 self.xid = None
15049 if role != None:
15050 self.role = role
15051 else:
15052 self.role = 0
15053 if data != None:
15054 self.data = data
15055 else:
15056 self.data = ''
15057 return
15058
15059 def pack(self):
15060 packed = []
15061 packed.append(struct.pack("!B", self.version))
15062 packed.append(struct.pack("!B", self.type))
15063 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15064 packed.append(struct.pack("!L", self.xid))
15065 packed.append(struct.pack("!L", self.role))
15066 packed.append(self.data)
15067 length = sum([len(x) for x in packed])
15068 packed[2] = struct.pack("!H", length)
15069 return ''.join(packed)
15070
15071 @staticmethod
15072 def unpack(reader):
15073 obj = requestforward()
15074 _version = reader.read("!B")[0]
15075 assert(_version == 5)
15076 _type = reader.read("!B")[0]
15077 assert(_type == 32)
15078 _length = reader.read("!H")[0]
15079 orig_reader = reader
15080 reader = orig_reader.slice(_length, 4)
15081 obj.xid = reader.read("!L")[0]
15082 obj.role = reader.read("!L")[0]
15083 obj.data = str(reader.read_all())
15084 return obj
15085
15086 def __eq__(self, other):
15087 if type(self) != type(other): return False
15088 if self.xid != other.xid: return False
15089 if self.role != other.role: return False
15090 if self.data != other.data: return False
15091 return True
15092
15093 def pretty_print(self, q):
15094 q.text("requestforward {")
15095 with q.group():
15096 with q.indent(2):
15097 q.breakable()
15098 q.text("xid = ");
15099 if self.xid != None:
15100 q.text("%#x" % self.xid)
15101 else:
15102 q.text('None')
15103 q.text(","); q.breakable()
15104 q.text("role = ");
15105 q.text("%#x" % self.role)
15106 q.text(","); q.breakable()
15107 q.text("data = ");
15108 q.pp(self.data)
15109 q.breakable()
15110 q.text('}')
15111
15112message.subtypes[32] = requestforward
15113
15114class role_reply(message):
15115 version = 5
15116 type = 25
15117
15118 def __init__(self, xid=None, role=None, generation_id=None):
15119 if xid != None:
15120 self.xid = xid
15121 else:
15122 self.xid = None
15123 if role != None:
15124 self.role = role
15125 else:
15126 self.role = 0
15127 if generation_id != None:
15128 self.generation_id = generation_id
15129 else:
15130 self.generation_id = 0
15131 return
15132
15133 def pack(self):
15134 packed = []
15135 packed.append(struct.pack("!B", self.version))
15136 packed.append(struct.pack("!B", self.type))
15137 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15138 packed.append(struct.pack("!L", self.xid))
15139 packed.append(struct.pack("!L", self.role))
15140 packed.append('\x00' * 4)
15141 packed.append(struct.pack("!Q", self.generation_id))
15142 length = sum([len(x) for x in packed])
15143 packed[2] = struct.pack("!H", length)
15144 return ''.join(packed)
15145
15146 @staticmethod
15147 def unpack(reader):
15148 obj = role_reply()
15149 _version = reader.read("!B")[0]
15150 assert(_version == 5)
15151 _type = reader.read("!B")[0]
15152 assert(_type == 25)
15153 _length = reader.read("!H")[0]
15154 orig_reader = reader
15155 reader = orig_reader.slice(_length, 4)
15156 obj.xid = reader.read("!L")[0]
15157 obj.role = reader.read("!L")[0]
15158 reader.skip(4)
15159 obj.generation_id = reader.read("!Q")[0]
15160 return obj
15161
15162 def __eq__(self, other):
15163 if type(self) != type(other): return False
15164 if self.xid != other.xid: return False
15165 if self.role != other.role: return False
15166 if self.generation_id != other.generation_id: return False
15167 return True
15168
15169 def pretty_print(self, q):
15170 q.text("role_reply {")
15171 with q.group():
15172 with q.indent(2):
15173 q.breakable()
15174 q.text("xid = ");
15175 if self.xid != None:
15176 q.text("%#x" % self.xid)
15177 else:
15178 q.text('None')
15179 q.text(","); q.breakable()
15180 q.text("role = ");
15181 q.text("%#x" % self.role)
15182 q.text(","); q.breakable()
15183 q.text("generation_id = ");
15184 q.text("%#x" % self.generation_id)
15185 q.breakable()
15186 q.text('}')
15187
15188message.subtypes[25] = role_reply
15189
15190class role_request(message):
15191 version = 5
15192 type = 24
15193
15194 def __init__(self, xid=None, role=None, generation_id=None):
15195 if xid != None:
15196 self.xid = xid
15197 else:
15198 self.xid = None
15199 if role != None:
15200 self.role = role
15201 else:
15202 self.role = 0
15203 if generation_id != None:
15204 self.generation_id = generation_id
15205 else:
15206 self.generation_id = 0
15207 return
15208
15209 def pack(self):
15210 packed = []
15211 packed.append(struct.pack("!B", self.version))
15212 packed.append(struct.pack("!B", self.type))
15213 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15214 packed.append(struct.pack("!L", self.xid))
15215 packed.append(struct.pack("!L", self.role))
15216 packed.append('\x00' * 4)
15217 packed.append(struct.pack("!Q", self.generation_id))
15218 length = sum([len(x) for x in packed])
15219 packed[2] = struct.pack("!H", length)
15220 return ''.join(packed)
15221
15222 @staticmethod
15223 def unpack(reader):
15224 obj = role_request()
15225 _version = reader.read("!B")[0]
15226 assert(_version == 5)
15227 _type = reader.read("!B")[0]
15228 assert(_type == 24)
15229 _length = reader.read("!H")[0]
15230 orig_reader = reader
15231 reader = orig_reader.slice(_length, 4)
15232 obj.xid = reader.read("!L")[0]
15233 obj.role = reader.read("!L")[0]
15234 reader.skip(4)
15235 obj.generation_id = reader.read("!Q")[0]
15236 return obj
15237
15238 def __eq__(self, other):
15239 if type(self) != type(other): return False
15240 if self.xid != other.xid: return False
15241 if self.role != other.role: return False
15242 if self.generation_id != other.generation_id: return False
15243 return True
15244
15245 def pretty_print(self, q):
15246 q.text("role_request {")
15247 with q.group():
15248 with q.indent(2):
15249 q.breakable()
15250 q.text("xid = ");
15251 if self.xid != None:
15252 q.text("%#x" % self.xid)
15253 else:
15254 q.text('None')
15255 q.text(","); q.breakable()
15256 q.text("role = ");
15257 q.text("%#x" % self.role)
15258 q.text(","); q.breakable()
15259 q.text("generation_id = ");
15260 q.text("%#x" % self.generation_id)
15261 q.breakable()
15262 q.text('}')
15263
15264message.subtypes[24] = role_request
15265
15266class role_request_failed_error_msg(error_msg):
15267 version = 5
15268 type = 1
15269 err_type = 11
15270
15271 def __init__(self, xid=None, code=None, data=None):
15272 if xid != None:
15273 self.xid = xid
15274 else:
15275 self.xid = None
15276 if code != None:
15277 self.code = code
15278 else:
15279 self.code = 0
15280 if data != None:
15281 self.data = data
15282 else:
15283 self.data = ''
15284 return
15285
15286 def pack(self):
15287 packed = []
15288 packed.append(struct.pack("!B", self.version))
15289 packed.append(struct.pack("!B", self.type))
15290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15291 packed.append(struct.pack("!L", self.xid))
15292 packed.append(struct.pack("!H", self.err_type))
15293 packed.append(struct.pack("!H", self.code))
15294 packed.append(self.data)
15295 length = sum([len(x) for x in packed])
15296 packed[2] = struct.pack("!H", length)
15297 return ''.join(packed)
15298
15299 @staticmethod
15300 def unpack(reader):
15301 obj = role_request_failed_error_msg()
15302 _version = reader.read("!B")[0]
15303 assert(_version == 5)
15304 _type = reader.read("!B")[0]
15305 assert(_type == 1)
15306 _length = reader.read("!H")[0]
15307 orig_reader = reader
15308 reader = orig_reader.slice(_length, 4)
15309 obj.xid = reader.read("!L")[0]
15310 _err_type = reader.read("!H")[0]
15311 assert(_err_type == 11)
15312 obj.code = reader.read("!H")[0]
15313 obj.data = str(reader.read_all())
15314 return obj
15315
15316 def __eq__(self, other):
15317 if type(self) != type(other): return False
15318 if self.xid != other.xid: return False
15319 if self.code != other.code: return False
15320 if self.data != other.data: return False
15321 return True
15322
15323 def pretty_print(self, q):
15324 q.text("role_request_failed_error_msg {")
15325 with q.group():
15326 with q.indent(2):
15327 q.breakable()
15328 q.text("xid = ");
15329 if self.xid != None:
15330 q.text("%#x" % self.xid)
15331 else:
15332 q.text('None')
15333 q.text(","); q.breakable()
15334 q.text("code = ");
15335 q.text("%#x" % self.code)
15336 q.text(","); q.breakable()
15337 q.text("data = ");
15338 q.pp(self.data)
15339 q.breakable()
15340 q.text('}')
15341
15342error_msg.subtypes[11] = role_request_failed_error_msg
15343
15344class role_status(message):
15345 version = 5
15346 type = 30
15347
15348 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
15349 if xid != None:
15350 self.xid = xid
15351 else:
15352 self.xid = None
15353 if role != None:
15354 self.role = role
15355 else:
15356 self.role = 0
15357 if reason != None:
15358 self.reason = reason
15359 else:
15360 self.reason = 0
15361 if generation_id != None:
15362 self.generation_id = generation_id
15363 else:
15364 self.generation_id = 0
15365 if properties != None:
15366 self.properties = properties
15367 else:
15368 self.properties = []
15369 return
15370
15371 def pack(self):
15372 packed = []
15373 packed.append(struct.pack("!B", self.version))
15374 packed.append(struct.pack("!B", self.type))
15375 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15376 packed.append(struct.pack("!L", self.xid))
15377 packed.append(struct.pack("!L", self.role))
15378 packed.append(struct.pack("!B", self.reason))
15379 packed.append('\x00' * 3)
15380 packed.append(struct.pack("!Q", self.generation_id))
15381 packed.append(loxi.generic_util.pack_list(self.properties))
15382 length = sum([len(x) for x in packed])
15383 packed[2] = struct.pack("!H", length)
15384 return ''.join(packed)
15385
15386 @staticmethod
15387 def unpack(reader):
15388 obj = role_status()
15389 _version = reader.read("!B")[0]
15390 assert(_version == 5)
15391 _type = reader.read("!B")[0]
15392 assert(_type == 30)
15393 _length = reader.read("!H")[0]
15394 orig_reader = reader
15395 reader = orig_reader.slice(_length, 4)
15396 obj.xid = reader.read("!L")[0]
15397 obj.role = reader.read("!L")[0]
15398 obj.reason = reader.read("!B")[0]
15399 reader.skip(3)
15400 obj.generation_id = reader.read("!Q")[0]
15401 obj.properties = loxi.generic_util.unpack_list(reader, ofp.role_prop.role_prop.unpack)
15402 return obj
15403
15404 def __eq__(self, other):
15405 if type(self) != type(other): return False
15406 if self.xid != other.xid: return False
15407 if self.role != other.role: return False
15408 if self.reason != other.reason: return False
15409 if self.generation_id != other.generation_id: return False
15410 if self.properties != other.properties: return False
15411 return True
15412
15413 def pretty_print(self, q):
15414 q.text("role_status {")
15415 with q.group():
15416 with q.indent(2):
15417 q.breakable()
15418 q.text("xid = ");
15419 if self.xid != None:
15420 q.text("%#x" % self.xid)
15421 else:
15422 q.text('None')
15423 q.text(","); q.breakable()
15424 q.text("role = ");
15425 q.text("%#x" % self.role)
15426 q.text(","); q.breakable()
15427 q.text("reason = ");
15428 q.text("%#x" % self.reason)
15429 q.text(","); q.breakable()
15430 q.text("generation_id = ");
15431 q.text("%#x" % self.generation_id)
15432 q.text(","); q.breakable()
15433 q.text("properties = ");
15434 q.pp(self.properties)
15435 q.breakable()
15436 q.text('}')
15437
15438message.subtypes[30] = role_status
15439
15440class set_config(message):
15441 version = 5
15442 type = 9
15443
15444 def __init__(self, xid=None, flags=None, miss_send_len=None):
15445 if xid != None:
15446 self.xid = xid
15447 else:
15448 self.xid = None
15449 if flags != None:
15450 self.flags = flags
15451 else:
15452 self.flags = 0
15453 if miss_send_len != None:
15454 self.miss_send_len = miss_send_len
15455 else:
15456 self.miss_send_len = 0
15457 return
15458
15459 def pack(self):
15460 packed = []
15461 packed.append(struct.pack("!B", self.version))
15462 packed.append(struct.pack("!B", self.type))
15463 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15464 packed.append(struct.pack("!L", self.xid))
15465 packed.append(struct.pack("!H", self.flags))
15466 packed.append(struct.pack("!H", self.miss_send_len))
15467 length = sum([len(x) for x in packed])
15468 packed[2] = struct.pack("!H", length)
15469 return ''.join(packed)
15470
15471 @staticmethod
15472 def unpack(reader):
15473 obj = set_config()
15474 _version = reader.read("!B")[0]
15475 assert(_version == 5)
15476 _type = reader.read("!B")[0]
15477 assert(_type == 9)
15478 _length = reader.read("!H")[0]
15479 orig_reader = reader
15480 reader = orig_reader.slice(_length, 4)
15481 obj.xid = reader.read("!L")[0]
15482 obj.flags = reader.read("!H")[0]
15483 obj.miss_send_len = reader.read("!H")[0]
15484 return obj
15485
15486 def __eq__(self, other):
15487 if type(self) != type(other): return False
15488 if self.xid != other.xid: return False
15489 if self.flags != other.flags: return False
15490 if self.miss_send_len != other.miss_send_len: return False
15491 return True
15492
15493 def pretty_print(self, q):
15494 q.text("set_config {")
15495 with q.group():
15496 with q.indent(2):
15497 q.breakable()
15498 q.text("xid = ");
15499 if self.xid != None:
15500 q.text("%#x" % self.xid)
15501 else:
15502 q.text('None')
15503 q.text(","); q.breakable()
15504 q.text("flags = ");
15505 q.text("%#x" % self.flags)
15506 q.text(","); q.breakable()
15507 q.text("miss_send_len = ");
15508 q.text("%#x" % self.miss_send_len)
15509 q.breakable()
15510 q.text('}')
15511
15512message.subtypes[9] = set_config
15513
15514class switch_config_failed_error_msg(error_msg):
15515 version = 5
15516 type = 1
15517 err_type = 10
15518
15519 def __init__(self, xid=None, code=None, data=None):
15520 if xid != None:
15521 self.xid = xid
15522 else:
15523 self.xid = None
15524 if code != None:
15525 self.code = code
15526 else:
15527 self.code = 0
15528 if data != None:
15529 self.data = data
15530 else:
15531 self.data = ''
15532 return
15533
15534 def pack(self):
15535 packed = []
15536 packed.append(struct.pack("!B", self.version))
15537 packed.append(struct.pack("!B", self.type))
15538 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15539 packed.append(struct.pack("!L", self.xid))
15540 packed.append(struct.pack("!H", self.err_type))
15541 packed.append(struct.pack("!H", self.code))
15542 packed.append(self.data)
15543 length = sum([len(x) for x in packed])
15544 packed[2] = struct.pack("!H", length)
15545 return ''.join(packed)
15546
15547 @staticmethod
15548 def unpack(reader):
15549 obj = switch_config_failed_error_msg()
15550 _version = reader.read("!B")[0]
15551 assert(_version == 5)
15552 _type = reader.read("!B")[0]
15553 assert(_type == 1)
15554 _length = reader.read("!H")[0]
15555 orig_reader = reader
15556 reader = orig_reader.slice(_length, 4)
15557 obj.xid = reader.read("!L")[0]
15558 _err_type = reader.read("!H")[0]
15559 assert(_err_type == 10)
15560 obj.code = reader.read("!H")[0]
15561 obj.data = str(reader.read_all())
15562 return obj
15563
15564 def __eq__(self, other):
15565 if type(self) != type(other): return False
15566 if self.xid != other.xid: return False
15567 if self.code != other.code: return False
15568 if self.data != other.data: return False
15569 return True
15570
15571 def pretty_print(self, q):
15572 q.text("switch_config_failed_error_msg {")
15573 with q.group():
15574 with q.indent(2):
15575 q.breakable()
15576 q.text("xid = ");
15577 if self.xid != None:
15578 q.text("%#x" % self.xid)
15579 else:
15580 q.text('None')
15581 q.text(","); q.breakable()
15582 q.text("code = ");
15583 q.text("%#x" % self.code)
15584 q.text(","); q.breakable()
15585 q.text("data = ");
15586 q.pp(self.data)
15587 q.breakable()
15588 q.text('}')
15589
15590error_msg.subtypes[10] = switch_config_failed_error_msg
15591
15592class table_desc_stats_reply(stats_reply):
15593 version = 5
15594 type = 19
15595 stats_type = 14
15596
15597 def __init__(self, xid=None, flags=None, entries=None):
15598 if xid != None:
15599 self.xid = xid
15600 else:
15601 self.xid = None
15602 if flags != None:
15603 self.flags = flags
15604 else:
15605 self.flags = 0
15606 if entries != None:
15607 self.entries = entries
15608 else:
15609 self.entries = []
15610 return
15611
15612 def pack(self):
15613 packed = []
15614 packed.append(struct.pack("!B", self.version))
15615 packed.append(struct.pack("!B", self.type))
15616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15617 packed.append(struct.pack("!L", self.xid))
15618 packed.append(struct.pack("!H", self.stats_type))
15619 packed.append(struct.pack("!H", self.flags))
15620 packed.append('\x00' * 4)
15621 packed.append(loxi.generic_util.pack_list(self.entries))
15622 length = sum([len(x) for x in packed])
15623 packed[2] = struct.pack("!H", length)
15624 return ''.join(packed)
15625
15626 @staticmethod
15627 def unpack(reader):
15628 obj = table_desc_stats_reply()
15629 _version = reader.read("!B")[0]
15630 assert(_version == 5)
15631 _type = reader.read("!B")[0]
15632 assert(_type == 19)
15633 _length = reader.read("!H")[0]
15634 orig_reader = reader
15635 reader = orig_reader.slice(_length, 4)
15636 obj.xid = reader.read("!L")[0]
15637 _stats_type = reader.read("!H")[0]
15638 assert(_stats_type == 14)
15639 obj.flags = reader.read("!H")[0]
15640 reader.skip(4)
15641 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_desc.unpack)
15642 return obj
15643
15644 def __eq__(self, other):
15645 if type(self) != type(other): return False
15646 if self.xid != other.xid: return False
15647 if self.flags != other.flags: return False
15648 if self.entries != other.entries: return False
15649 return True
15650
15651 def pretty_print(self, q):
15652 q.text("table_desc_stats_reply {")
15653 with q.group():
15654 with q.indent(2):
15655 q.breakable()
15656 q.text("xid = ");
15657 if self.xid != None:
15658 q.text("%#x" % self.xid)
15659 else:
15660 q.text('None')
15661 q.text(","); q.breakable()
15662 q.text("flags = ");
15663 q.text("%#x" % self.flags)
15664 q.text(","); q.breakable()
15665 q.text("entries = ");
15666 q.pp(self.entries)
15667 q.breakable()
15668 q.text('}')
15669
15670stats_reply.subtypes[14] = table_desc_stats_reply
15671
15672class table_desc_stats_request(stats_request):
15673 version = 5
15674 type = 18
15675 stats_type = 14
15676
15677 def __init__(self, xid=None, flags=None):
15678 if xid != None:
15679 self.xid = xid
15680 else:
15681 self.xid = None
15682 if flags != None:
15683 self.flags = flags
15684 else:
15685 self.flags = 0
15686 return
15687
15688 def pack(self):
15689 packed = []
15690 packed.append(struct.pack("!B", self.version))
15691 packed.append(struct.pack("!B", self.type))
15692 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15693 packed.append(struct.pack("!L", self.xid))
15694 packed.append(struct.pack("!H", self.stats_type))
15695 packed.append(struct.pack("!H", self.flags))
15696 packed.append('\x00' * 4)
15697 length = sum([len(x) for x in packed])
15698 packed[2] = struct.pack("!H", length)
15699 return ''.join(packed)
15700
15701 @staticmethod
15702 def unpack(reader):
15703 obj = table_desc_stats_request()
15704 _version = reader.read("!B")[0]
15705 assert(_version == 5)
15706 _type = reader.read("!B")[0]
15707 assert(_type == 18)
15708 _length = reader.read("!H")[0]
15709 orig_reader = reader
15710 reader = orig_reader.slice(_length, 4)
15711 obj.xid = reader.read("!L")[0]
15712 _stats_type = reader.read("!H")[0]
15713 assert(_stats_type == 14)
15714 obj.flags = reader.read("!H")[0]
15715 reader.skip(4)
15716 return obj
15717
15718 def __eq__(self, other):
15719 if type(self) != type(other): return False
15720 if self.xid != other.xid: return False
15721 if self.flags != other.flags: return False
15722 return True
15723
15724 def pretty_print(self, q):
15725 q.text("table_desc_stats_request {")
15726 with q.group():
15727 with q.indent(2):
15728 q.breakable()
15729 q.text("xid = ");
15730 if self.xid != None:
15731 q.text("%#x" % self.xid)
15732 else:
15733 q.text('None')
15734 q.text(","); q.breakable()
15735 q.text("flags = ");
15736 q.text("%#x" % self.flags)
15737 q.breakable()
15738 q.text('}')
15739
15740stats_request.subtypes[14] = table_desc_stats_request
15741
15742class table_features_failed_error_msg(error_msg):
15743 version = 5
15744 type = 1
15745 err_type = 13
15746
15747 def __init__(self, xid=None, code=None, data=None):
15748 if xid != None:
15749 self.xid = xid
15750 else:
15751 self.xid = None
15752 if code != None:
15753 self.code = code
15754 else:
15755 self.code = 0
15756 if data != None:
15757 self.data = data
15758 else:
15759 self.data = ''
15760 return
15761
15762 def pack(self):
15763 packed = []
15764 packed.append(struct.pack("!B", self.version))
15765 packed.append(struct.pack("!B", self.type))
15766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15767 packed.append(struct.pack("!L", self.xid))
15768 packed.append(struct.pack("!H", self.err_type))
15769 packed.append(struct.pack("!H", self.code))
15770 packed.append(self.data)
15771 length = sum([len(x) for x in packed])
15772 packed[2] = struct.pack("!H", length)
15773 return ''.join(packed)
15774
15775 @staticmethod
15776 def unpack(reader):
15777 obj = table_features_failed_error_msg()
15778 _version = reader.read("!B")[0]
15779 assert(_version == 5)
15780 _type = reader.read("!B")[0]
15781 assert(_type == 1)
15782 _length = reader.read("!H")[0]
15783 orig_reader = reader
15784 reader = orig_reader.slice(_length, 4)
15785 obj.xid = reader.read("!L")[0]
15786 _err_type = reader.read("!H")[0]
15787 assert(_err_type == 13)
15788 obj.code = reader.read("!H")[0]
15789 obj.data = str(reader.read_all())
15790 return obj
15791
15792 def __eq__(self, other):
15793 if type(self) != type(other): return False
15794 if self.xid != other.xid: return False
15795 if self.code != other.code: return False
15796 if self.data != other.data: return False
15797 return True
15798
15799 def pretty_print(self, q):
15800 q.text("table_features_failed_error_msg {")
15801 with q.group():
15802 with q.indent(2):
15803 q.breakable()
15804 q.text("xid = ");
15805 if self.xid != None:
15806 q.text("%#x" % self.xid)
15807 else:
15808 q.text('None')
15809 q.text(","); q.breakable()
15810 q.text("code = ");
15811 q.text("%#x" % self.code)
15812 q.text(","); q.breakable()
15813 q.text("data = ");
15814 q.pp(self.data)
15815 q.breakable()
15816 q.text('}')
15817
15818error_msg.subtypes[13] = table_features_failed_error_msg
15819
15820class table_features_stats_reply(stats_reply):
15821 version = 5
15822 type = 19
15823 stats_type = 12
15824
15825 def __init__(self, xid=None, flags=None, entries=None):
15826 if xid != None:
15827 self.xid = xid
15828 else:
15829 self.xid = None
15830 if flags != None:
15831 self.flags = flags
15832 else:
15833 self.flags = 0
15834 if entries != None:
15835 self.entries = entries
15836 else:
15837 self.entries = []
15838 return
15839
15840 def pack(self):
15841 packed = []
15842 packed.append(struct.pack("!B", self.version))
15843 packed.append(struct.pack("!B", self.type))
15844 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15845 packed.append(struct.pack("!L", self.xid))
15846 packed.append(struct.pack("!H", self.stats_type))
15847 packed.append(struct.pack("!H", self.flags))
15848 packed.append('\x00' * 4)
15849 packed.append(loxi.generic_util.pack_list(self.entries))
15850 length = sum([len(x) for x in packed])
15851 packed[2] = struct.pack("!H", length)
15852 return ''.join(packed)
15853
15854 @staticmethod
15855 def unpack(reader):
15856 obj = table_features_stats_reply()
15857 _version = reader.read("!B")[0]
15858 assert(_version == 5)
15859 _type = reader.read("!B")[0]
15860 assert(_type == 19)
15861 _length = reader.read("!H")[0]
15862 orig_reader = reader
15863 reader = orig_reader.slice(_length, 4)
15864 obj.xid = reader.read("!L")[0]
15865 _stats_type = reader.read("!H")[0]
15866 assert(_stats_type == 12)
15867 obj.flags = reader.read("!H")[0]
15868 reader.skip(4)
15869 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
15870 return obj
15871
15872 def __eq__(self, other):
15873 if type(self) != type(other): return False
15874 if self.xid != other.xid: return False
15875 if self.flags != other.flags: return False
15876 if self.entries != other.entries: return False
15877 return True
15878
15879 def pretty_print(self, q):
15880 q.text("table_features_stats_reply {")
15881 with q.group():
15882 with q.indent(2):
15883 q.breakable()
15884 q.text("xid = ");
15885 if self.xid != None:
15886 q.text("%#x" % self.xid)
15887 else:
15888 q.text('None')
15889 q.text(","); q.breakable()
15890 q.text("flags = ");
15891 q.text("%#x" % self.flags)
15892 q.text(","); q.breakable()
15893 q.text("entries = ");
15894 q.pp(self.entries)
15895 q.breakable()
15896 q.text('}')
15897
15898stats_reply.subtypes[12] = table_features_stats_reply
15899
15900class table_features_stats_request(stats_request):
15901 version = 5
15902 type = 18
15903 stats_type = 12
15904
15905 def __init__(self, xid=None, flags=None, entries=None):
15906 if xid != None:
15907 self.xid = xid
15908 else:
15909 self.xid = None
15910 if flags != None:
15911 self.flags = flags
15912 else:
15913 self.flags = 0
15914 if entries != None:
15915 self.entries = entries
15916 else:
15917 self.entries = []
15918 return
15919
15920 def pack(self):
15921 packed = []
15922 packed.append(struct.pack("!B", self.version))
15923 packed.append(struct.pack("!B", self.type))
15924 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15925 packed.append(struct.pack("!L", self.xid))
15926 packed.append(struct.pack("!H", self.stats_type))
15927 packed.append(struct.pack("!H", self.flags))
15928 packed.append('\x00' * 4)
15929 packed.append(loxi.generic_util.pack_list(self.entries))
15930 length = sum([len(x) for x in packed])
15931 packed[2] = struct.pack("!H", length)
15932 return ''.join(packed)
15933
15934 @staticmethod
15935 def unpack(reader):
15936 obj = table_features_stats_request()
15937 _version = reader.read("!B")[0]
15938 assert(_version == 5)
15939 _type = reader.read("!B")[0]
15940 assert(_type == 18)
15941 _length = reader.read("!H")[0]
15942 orig_reader = reader
15943 reader = orig_reader.slice(_length, 4)
15944 obj.xid = reader.read("!L")[0]
15945 _stats_type = reader.read("!H")[0]
15946 assert(_stats_type == 12)
15947 obj.flags = reader.read("!H")[0]
15948 reader.skip(4)
15949 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
15950 return obj
15951
15952 def __eq__(self, other):
15953 if type(self) != type(other): return False
15954 if self.xid != other.xid: return False
15955 if self.flags != other.flags: return False
15956 if self.entries != other.entries: return False
15957 return True
15958
15959 def pretty_print(self, q):
15960 q.text("table_features_stats_request {")
15961 with q.group():
15962 with q.indent(2):
15963 q.breakable()
15964 q.text("xid = ");
15965 if self.xid != None:
15966 q.text("%#x" % self.xid)
15967 else:
15968 q.text('None')
15969 q.text(","); q.breakable()
15970 q.text("flags = ");
15971 q.text("%#x" % self.flags)
15972 q.text(","); q.breakable()
15973 q.text("entries = ");
15974 q.pp(self.entries)
15975 q.breakable()
15976 q.text('}')
15977
15978stats_request.subtypes[12] = table_features_stats_request
15979
15980class table_mod(message):
15981 version = 5
15982 type = 17
15983
15984 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15985 if xid != None:
15986 self.xid = xid
15987 else:
15988 self.xid = None
15989 if table_id != None:
15990 self.table_id = table_id
15991 else:
15992 self.table_id = 0
15993 if config != None:
15994 self.config = config
15995 else:
15996 self.config = 0
15997 if properties != None:
15998 self.properties = properties
15999 else:
16000 self.properties = []
16001 return
16002
16003 def pack(self):
16004 packed = []
16005 packed.append(struct.pack("!B", self.version))
16006 packed.append(struct.pack("!B", self.type))
16007 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16008 packed.append(struct.pack("!L", self.xid))
16009 packed.append(struct.pack("!B", self.table_id))
16010 packed.append('\x00' * 3)
16011 packed.append(struct.pack("!L", self.config))
16012 packed.append(loxi.generic_util.pack_list(self.properties))
16013 length = sum([len(x) for x in packed])
16014 packed[2] = struct.pack("!H", length)
16015 return ''.join(packed)
16016
16017 @staticmethod
16018 def unpack(reader):
16019 obj = table_mod()
16020 _version = reader.read("!B")[0]
16021 assert(_version == 5)
16022 _type = reader.read("!B")[0]
16023 assert(_type == 17)
16024 _length = reader.read("!H")[0]
16025 orig_reader = reader
16026 reader = orig_reader.slice(_length, 4)
16027 obj.xid = reader.read("!L")[0]
16028 obj.table_id = reader.read("!B")[0]
16029 reader.skip(3)
16030 obj.config = reader.read("!L")[0]
16031 obj.properties = loxi.generic_util.unpack_list(reader, ofp.table_mod_prop.table_mod_prop.unpack)
16032 return obj
16033
16034 def __eq__(self, other):
16035 if type(self) != type(other): return False
16036 if self.xid != other.xid: return False
16037 if self.table_id != other.table_id: return False
16038 if self.config != other.config: return False
16039 if self.properties != other.properties: return False
16040 return True
16041
16042 def pretty_print(self, q):
16043 q.text("table_mod {")
16044 with q.group():
16045 with q.indent(2):
16046 q.breakable()
16047 q.text("xid = ");
16048 if self.xid != None:
16049 q.text("%#x" % self.xid)
16050 else:
16051 q.text('None')
16052 q.text(","); q.breakable()
16053 q.text("table_id = ");
16054 q.text("%#x" % self.table_id)
16055 q.text(","); q.breakable()
16056 q.text("config = ");
16057 q.text("%#x" % self.config)
16058 q.text(","); q.breakable()
16059 q.text("properties = ");
16060 q.pp(self.properties)
16061 q.breakable()
16062 q.text('}')
16063
16064message.subtypes[17] = table_mod
16065
16066class table_mod_failed_error_msg(error_msg):
16067 version = 5
16068 type = 1
16069 err_type = 8
16070
16071 def __init__(self, xid=None, code=None, data=None):
16072 if xid != None:
16073 self.xid = xid
16074 else:
16075 self.xid = None
16076 if code != None:
16077 self.code = code
16078 else:
16079 self.code = 0
16080 if data != None:
16081 self.data = data
16082 else:
16083 self.data = ''
16084 return
16085
16086 def pack(self):
16087 packed = []
16088 packed.append(struct.pack("!B", self.version))
16089 packed.append(struct.pack("!B", self.type))
16090 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16091 packed.append(struct.pack("!L", self.xid))
16092 packed.append(struct.pack("!H", self.err_type))
16093 packed.append(struct.pack("!H", self.code))
16094 packed.append(self.data)
16095 length = sum([len(x) for x in packed])
16096 packed[2] = struct.pack("!H", length)
16097 return ''.join(packed)
16098
16099 @staticmethod
16100 def unpack(reader):
16101 obj = table_mod_failed_error_msg()
16102 _version = reader.read("!B")[0]
16103 assert(_version == 5)
16104 _type = reader.read("!B")[0]
16105 assert(_type == 1)
16106 _length = reader.read("!H")[0]
16107 orig_reader = reader
16108 reader = orig_reader.slice(_length, 4)
16109 obj.xid = reader.read("!L")[0]
16110 _err_type = reader.read("!H")[0]
16111 assert(_err_type == 8)
16112 obj.code = reader.read("!H")[0]
16113 obj.data = str(reader.read_all())
16114 return obj
16115
16116 def __eq__(self, other):
16117 if type(self) != type(other): return False
16118 if self.xid != other.xid: return False
16119 if self.code != other.code: return False
16120 if self.data != other.data: return False
16121 return True
16122
16123 def pretty_print(self, q):
16124 q.text("table_mod_failed_error_msg {")
16125 with q.group():
16126 with q.indent(2):
16127 q.breakable()
16128 q.text("xid = ");
16129 if self.xid != None:
16130 q.text("%#x" % self.xid)
16131 else:
16132 q.text('None')
16133 q.text(","); q.breakable()
16134 q.text("code = ");
16135 q.text("%#x" % self.code)
16136 q.text(","); q.breakable()
16137 q.text("data = ");
16138 q.pp(self.data)
16139 q.breakable()
16140 q.text('}')
16141
16142error_msg.subtypes[8] = table_mod_failed_error_msg
16143
16144class table_stats_reply(stats_reply):
16145 version = 5
16146 type = 19
16147 stats_type = 3
16148
16149 def __init__(self, xid=None, flags=None, entries=None):
16150 if xid != None:
16151 self.xid = xid
16152 else:
16153 self.xid = None
16154 if flags != None:
16155 self.flags = flags
16156 else:
16157 self.flags = 0
16158 if entries != None:
16159 self.entries = entries
16160 else:
16161 self.entries = []
16162 return
16163
16164 def pack(self):
16165 packed = []
16166 packed.append(struct.pack("!B", self.version))
16167 packed.append(struct.pack("!B", self.type))
16168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16169 packed.append(struct.pack("!L", self.xid))
16170 packed.append(struct.pack("!H", self.stats_type))
16171 packed.append(struct.pack("!H", self.flags))
16172 packed.append('\x00' * 4)
16173 packed.append(loxi.generic_util.pack_list(self.entries))
16174 length = sum([len(x) for x in packed])
16175 packed[2] = struct.pack("!H", length)
16176 return ''.join(packed)
16177
16178 @staticmethod
16179 def unpack(reader):
16180 obj = table_stats_reply()
16181 _version = reader.read("!B")[0]
16182 assert(_version == 5)
16183 _type = reader.read("!B")[0]
16184 assert(_type == 19)
16185 _length = reader.read("!H")[0]
16186 orig_reader = reader
16187 reader = orig_reader.slice(_length, 4)
16188 obj.xid = reader.read("!L")[0]
16189 _stats_type = reader.read("!H")[0]
16190 assert(_stats_type == 3)
16191 obj.flags = reader.read("!H")[0]
16192 reader.skip(4)
16193 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
16194 return obj
16195
16196 def __eq__(self, other):
16197 if type(self) != type(other): return False
16198 if self.xid != other.xid: return False
16199 if self.flags != other.flags: return False
16200 if self.entries != other.entries: return False
16201 return True
16202
16203 def pretty_print(self, q):
16204 q.text("table_stats_reply {")
16205 with q.group():
16206 with q.indent(2):
16207 q.breakable()
16208 q.text("xid = ");
16209 if self.xid != None:
16210 q.text("%#x" % self.xid)
16211 else:
16212 q.text('None')
16213 q.text(","); q.breakable()
16214 q.text("flags = ");
16215 q.text("%#x" % self.flags)
16216 q.text(","); q.breakable()
16217 q.text("entries = ");
16218 q.pp(self.entries)
16219 q.breakable()
16220 q.text('}')
16221
16222stats_reply.subtypes[3] = table_stats_reply
16223
16224class table_stats_request(stats_request):
16225 version = 5
16226 type = 18
16227 stats_type = 3
16228
16229 def __init__(self, xid=None, flags=None):
16230 if xid != None:
16231 self.xid = xid
16232 else:
16233 self.xid = None
16234 if flags != None:
16235 self.flags = flags
16236 else:
16237 self.flags = 0
16238 return
16239
16240 def pack(self):
16241 packed = []
16242 packed.append(struct.pack("!B", self.version))
16243 packed.append(struct.pack("!B", self.type))
16244 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16245 packed.append(struct.pack("!L", self.xid))
16246 packed.append(struct.pack("!H", self.stats_type))
16247 packed.append(struct.pack("!H", self.flags))
16248 packed.append('\x00' * 4)
16249 length = sum([len(x) for x in packed])
16250 packed[2] = struct.pack("!H", length)
16251 return ''.join(packed)
16252
16253 @staticmethod
16254 def unpack(reader):
16255 obj = table_stats_request()
16256 _version = reader.read("!B")[0]
16257 assert(_version == 5)
16258 _type = reader.read("!B")[0]
16259 assert(_type == 18)
16260 _length = reader.read("!H")[0]
16261 orig_reader = reader
16262 reader = orig_reader.slice(_length, 4)
16263 obj.xid = reader.read("!L")[0]
16264 _stats_type = reader.read("!H")[0]
16265 assert(_stats_type == 3)
16266 obj.flags = reader.read("!H")[0]
16267 reader.skip(4)
16268 return obj
16269
16270 def __eq__(self, other):
16271 if type(self) != type(other): return False
16272 if self.xid != other.xid: return False
16273 if self.flags != other.flags: return False
16274 return True
16275
16276 def pretty_print(self, q):
16277 q.text("table_stats_request {")
16278 with q.group():
16279 with q.indent(2):
16280 q.breakable()
16281 q.text("xid = ");
16282 if self.xid != None:
16283 q.text("%#x" % self.xid)
16284 else:
16285 q.text('None')
16286 q.text(","); q.breakable()
16287 q.text("flags = ");
16288 q.text("%#x" % self.flags)
16289 q.breakable()
16290 q.text('}')
16291
16292stats_request.subtypes[3] = table_stats_request
16293
16294class table_status(message):
16295 version = 5
16296 type = 31
16297
16298 def __init__(self, xid=None, role=None, reason=None, table=None):
16299 if xid != None:
16300 self.xid = xid
16301 else:
16302 self.xid = None
16303 if role != None:
16304 self.role = role
16305 else:
16306 self.role = 0
16307 if reason != None:
16308 self.reason = reason
16309 else:
16310 self.reason = 0
16311 if table != None:
16312 self.table = table
16313 else:
16314 self.table = ofp.table_desc()
16315 return
16316
16317 def pack(self):
16318 packed = []
16319 packed.append(struct.pack("!B", self.version))
16320 packed.append(struct.pack("!B", self.type))
16321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16322 packed.append(struct.pack("!L", self.xid))
16323 packed.append(struct.pack("!L", self.role))
16324 packed.append(struct.pack("!B", self.reason))
16325 packed.append('\x00' * 7)
16326 packed.append(self.table.pack())
16327 length = sum([len(x) for x in packed])
16328 packed[2] = struct.pack("!H", length)
16329 return ''.join(packed)
16330
16331 @staticmethod
16332 def unpack(reader):
16333 obj = table_status()
16334 _version = reader.read("!B")[0]
16335 assert(_version == 5)
16336 _type = reader.read("!B")[0]
16337 assert(_type == 31)
16338 _length = reader.read("!H")[0]
16339 orig_reader = reader
16340 reader = orig_reader.slice(_length, 4)
16341 obj.xid = reader.read("!L")[0]
16342 obj.role = reader.read("!L")[0]
16343 obj.reason = reader.read("!B")[0]
16344 reader.skip(7)
16345 obj.table = ofp.table_desc.unpack(reader)
16346 return obj
16347
16348 def __eq__(self, other):
16349 if type(self) != type(other): return False
16350 if self.xid != other.xid: return False
16351 if self.role != other.role: return False
16352 if self.reason != other.reason: return False
16353 if self.table != other.table: return False
16354 return True
16355
16356 def pretty_print(self, q):
16357 q.text("table_status {")
16358 with q.group():
16359 with q.indent(2):
16360 q.breakable()
16361 q.text("xid = ");
16362 if self.xid != None:
16363 q.text("%#x" % self.xid)
16364 else:
16365 q.text('None')
16366 q.text(","); q.breakable()
16367 q.text("role = ");
16368 q.text("%#x" % self.role)
16369 q.text(","); q.breakable()
16370 q.text("reason = ");
16371 q.text("%#x" % self.reason)
16372 q.text(","); q.breakable()
16373 q.text("table = ");
16374 q.pp(self.table)
16375 q.breakable()
16376 q.text('}')
16377
16378message.subtypes[31] = table_status
16379
16380
16381def parse_header(buf):
16382 if len(buf) < 8:
16383 raise loxi.ProtocolError("too short to be an OpenFlow message")
16384 return struct.unpack_from("!BBHL", buf)
16385
16386def parse_message(buf):
16387 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
16388 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
16389 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
16390 if len(buf) != msg_len:
16391 raise loxi.ProtocolError("incorrect message size")
16392 return message.unpack(loxi.generic_util.OFReader(buf))