blob: ff34cfa8d56fe87425877dea964cacc530d8b079 [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.of12']
16
17class message(loxi.OFObject):
18 subtypes = {}
19
20 version = 3
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 == 3)
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 = 3
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 == 3)
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 = 3
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 == 3)
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 = 3
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 == 3)
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 = 3
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 == 3)
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 = 3
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 == 3)
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 bad_action_error_msg(error_msg):
545 version = 3
546 type = 1
547 err_type = 2
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 = bad_action_error_msg()
580 _version = reader.read("!B")[0]
581 assert(_version == 3)
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 == 2)
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("bad_action_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[2] = bad_action_error_msg
621
622class bad_instruction_error_msg(error_msg):
623 version = 3
624 type = 1
625 err_type = 3
626
627 def __init__(self, xid=None, code=None, data=None):
628 if xid != None:
629 self.xid = xid
630 else:
631 self.xid = None
632 if code != None:
633 self.code = code
634 else:
635 self.code = 0
636 if data != None:
637 self.data = data
638 else:
639 self.data = ''
640 return
641
642 def pack(self):
643 packed = []
644 packed.append(struct.pack("!B", self.version))
645 packed.append(struct.pack("!B", self.type))
646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
647 packed.append(struct.pack("!L", self.xid))
648 packed.append(struct.pack("!H", self.err_type))
649 packed.append(struct.pack("!H", self.code))
650 packed.append(self.data)
651 length = sum([len(x) for x in packed])
652 packed[2] = struct.pack("!H", length)
653 return ''.join(packed)
654
655 @staticmethod
656 def unpack(reader):
657 obj = bad_instruction_error_msg()
658 _version = reader.read("!B")[0]
659 assert(_version == 3)
660 _type = reader.read("!B")[0]
661 assert(_type == 1)
662 _length = reader.read("!H")[0]
663 orig_reader = reader
664 reader = orig_reader.slice(_length, 4)
665 obj.xid = reader.read("!L")[0]
666 _err_type = reader.read("!H")[0]
667 assert(_err_type == 3)
668 obj.code = reader.read("!H")[0]
669 obj.data = str(reader.read_all())
670 return obj
671
672 def __eq__(self, other):
673 if type(self) != type(other): return False
674 if self.xid != other.xid: return False
675 if self.code != other.code: return False
676 if self.data != other.data: return False
677 return True
678
679 def pretty_print(self, q):
680 q.text("bad_instruction_error_msg {")
681 with q.group():
682 with q.indent(2):
683 q.breakable()
684 q.text("xid = ");
685 if self.xid != None:
686 q.text("%#x" % self.xid)
687 else:
688 q.text('None')
689 q.text(","); q.breakable()
690 q.text("code = ");
691 q.text("%#x" % self.code)
692 q.text(","); q.breakable()
693 q.text("data = ");
694 q.pp(self.data)
695 q.breakable()
696 q.text('}')
697
698error_msg.subtypes[3] = bad_instruction_error_msg
699
700class bad_match_error_msg(error_msg):
701 version = 3
702 type = 1
703 err_type = 4
704
705 def __init__(self, xid=None, code=None, data=None):
706 if xid != None:
707 self.xid = xid
708 else:
709 self.xid = None
710 if code != None:
711 self.code = code
712 else:
713 self.code = 0
714 if data != None:
715 self.data = data
716 else:
717 self.data = ''
718 return
719
720 def pack(self):
721 packed = []
722 packed.append(struct.pack("!B", self.version))
723 packed.append(struct.pack("!B", self.type))
724 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
725 packed.append(struct.pack("!L", self.xid))
726 packed.append(struct.pack("!H", self.err_type))
727 packed.append(struct.pack("!H", self.code))
728 packed.append(self.data)
729 length = sum([len(x) for x in packed])
730 packed[2] = struct.pack("!H", length)
731 return ''.join(packed)
732
733 @staticmethod
734 def unpack(reader):
735 obj = bad_match_error_msg()
736 _version = reader.read("!B")[0]
737 assert(_version == 3)
738 _type = reader.read("!B")[0]
739 assert(_type == 1)
740 _length = reader.read("!H")[0]
741 orig_reader = reader
742 reader = orig_reader.slice(_length, 4)
743 obj.xid = reader.read("!L")[0]
744 _err_type = reader.read("!H")[0]
745 assert(_err_type == 4)
746 obj.code = reader.read("!H")[0]
747 obj.data = str(reader.read_all())
748 return obj
749
750 def __eq__(self, other):
751 if type(self) != type(other): return False
752 if self.xid != other.xid: return False
753 if self.code != other.code: return False
754 if self.data != other.data: return False
755 return True
756
757 def pretty_print(self, q):
758 q.text("bad_match_error_msg {")
759 with q.group():
760 with q.indent(2):
761 q.breakable()
762 q.text("xid = ");
763 if self.xid != None:
764 q.text("%#x" % self.xid)
765 else:
766 q.text('None')
767 q.text(","); q.breakable()
768 q.text("code = ");
769 q.text("%#x" % self.code)
770 q.text(","); q.breakable()
771 q.text("data = ");
772 q.pp(self.data)
773 q.breakable()
774 q.text('}')
775
776error_msg.subtypes[4] = bad_match_error_msg
777
778class bad_request_error_msg(error_msg):
779 version = 3
780 type = 1
781 err_type = 1
782
783 def __init__(self, xid=None, code=None, data=None):
784 if xid != None:
785 self.xid = xid
786 else:
787 self.xid = None
788 if code != None:
789 self.code = code
790 else:
791 self.code = 0
792 if data != None:
793 self.data = data
794 else:
795 self.data = ''
796 return
797
798 def pack(self):
799 packed = []
800 packed.append(struct.pack("!B", self.version))
801 packed.append(struct.pack("!B", self.type))
802 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
803 packed.append(struct.pack("!L", self.xid))
804 packed.append(struct.pack("!H", self.err_type))
805 packed.append(struct.pack("!H", self.code))
806 packed.append(self.data)
807 length = sum([len(x) for x in packed])
808 packed[2] = struct.pack("!H", length)
809 return ''.join(packed)
810
811 @staticmethod
812 def unpack(reader):
813 obj = bad_request_error_msg()
814 _version = reader.read("!B")[0]
815 assert(_version == 3)
816 _type = reader.read("!B")[0]
817 assert(_type == 1)
818 _length = reader.read("!H")[0]
819 orig_reader = reader
820 reader = orig_reader.slice(_length, 4)
821 obj.xid = reader.read("!L")[0]
822 _err_type = reader.read("!H")[0]
823 assert(_err_type == 1)
824 obj.code = reader.read("!H")[0]
825 obj.data = str(reader.read_all())
826 return obj
827
828 def __eq__(self, other):
829 if type(self) != type(other): return False
830 if self.xid != other.xid: return False
831 if self.code != other.code: return False
832 if self.data != other.data: return False
833 return True
834
835 def pretty_print(self, q):
836 q.text("bad_request_error_msg {")
837 with q.group():
838 with q.indent(2):
839 q.breakable()
840 q.text("xid = ");
841 if self.xid != None:
842 q.text("%#x" % self.xid)
843 else:
844 q.text('None')
845 q.text(","); q.breakable()
846 q.text("code = ");
847 q.text("%#x" % self.code)
848 q.text(","); q.breakable()
849 q.text("data = ");
850 q.pp(self.data)
851 q.breakable()
852 q.text('}')
853
854error_msg.subtypes[1] = bad_request_error_msg
855
856class barrier_reply(message):
857 version = 3
858 type = 21
859
860 def __init__(self, xid=None):
861 if xid != None:
862 self.xid = xid
863 else:
864 self.xid = None
865 return
866
867 def pack(self):
868 packed = []
869 packed.append(struct.pack("!B", self.version))
870 packed.append(struct.pack("!B", self.type))
871 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
872 packed.append(struct.pack("!L", self.xid))
873 length = sum([len(x) for x in packed])
874 packed[2] = struct.pack("!H", length)
875 return ''.join(packed)
876
877 @staticmethod
878 def unpack(reader):
879 obj = barrier_reply()
880 _version = reader.read("!B")[0]
881 assert(_version == 3)
882 _type = reader.read("!B")[0]
883 assert(_type == 21)
884 _length = reader.read("!H")[0]
885 orig_reader = reader
886 reader = orig_reader.slice(_length, 4)
887 obj.xid = reader.read("!L")[0]
888 return obj
889
890 def __eq__(self, other):
891 if type(self) != type(other): return False
892 if self.xid != other.xid: return False
893 return True
894
895 def pretty_print(self, q):
896 q.text("barrier_reply {")
897 with q.group():
898 with q.indent(2):
899 q.breakable()
900 q.text("xid = ");
901 if self.xid != None:
902 q.text("%#x" % self.xid)
903 else:
904 q.text('None')
905 q.breakable()
906 q.text('}')
907
908message.subtypes[21] = barrier_reply
909
910class barrier_request(message):
911 version = 3
912 type = 20
913
914 def __init__(self, xid=None):
915 if xid != None:
916 self.xid = xid
917 else:
918 self.xid = None
919 return
920
921 def pack(self):
922 packed = []
923 packed.append(struct.pack("!B", self.version))
924 packed.append(struct.pack("!B", self.type))
925 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
926 packed.append(struct.pack("!L", self.xid))
927 length = sum([len(x) for x in packed])
928 packed[2] = struct.pack("!H", length)
929 return ''.join(packed)
930
931 @staticmethod
932 def unpack(reader):
933 obj = barrier_request()
934 _version = reader.read("!B")[0]
935 assert(_version == 3)
936 _type = reader.read("!B")[0]
937 assert(_type == 20)
938 _length = reader.read("!H")[0]
939 orig_reader = reader
940 reader = orig_reader.slice(_length, 4)
941 obj.xid = reader.read("!L")[0]
942 return obj
943
944 def __eq__(self, other):
945 if type(self) != type(other): return False
946 if self.xid != other.xid: return False
947 return True
948
949 def pretty_print(self, q):
950 q.text("barrier_request {")
951 with q.group():
952 with q.indent(2):
953 q.breakable()
954 q.text("xid = ");
955 if self.xid != None:
956 q.text("%#x" % self.xid)
957 else:
958 q.text('None')
959 q.breakable()
960 q.text('}')
961
962message.subtypes[20] = barrier_request
963
964class experimenter(message):
965 subtypes = {}
966
967 version = 3
968 type = 4
969
970 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
971 if xid != None:
972 self.xid = xid
973 else:
974 self.xid = None
975 if experimenter != None:
976 self.experimenter = experimenter
977 else:
978 self.experimenter = 0
979 if subtype != None:
980 self.subtype = subtype
981 else:
982 self.subtype = 0
983 if data != None:
984 self.data = data
985 else:
986 self.data = ''
987 return
988
989 def pack(self):
990 packed = []
991 packed.append(struct.pack("!B", self.version))
992 packed.append(struct.pack("!B", self.type))
993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
994 packed.append(struct.pack("!L", self.xid))
995 packed.append(struct.pack("!L", self.experimenter))
996 packed.append(struct.pack("!L", self.subtype))
997 packed.append(self.data)
998 length = sum([len(x) for x in packed])
999 packed[2] = struct.pack("!H", length)
1000 return ''.join(packed)
1001
1002 @staticmethod
1003 def unpack(reader):
1004 subtype, = reader.peek('!L', 8)
1005 subclass = experimenter.subtypes.get(subtype)
1006 if subclass:
1007 return subclass.unpack(reader)
1008
1009 obj = experimenter()
1010 _version = reader.read("!B")[0]
1011 assert(_version == 3)
1012 _type = reader.read("!B")[0]
1013 assert(_type == 4)
1014 _length = reader.read("!H")[0]
1015 orig_reader = reader
1016 reader = orig_reader.slice(_length, 4)
1017 obj.xid = reader.read("!L")[0]
1018 obj.experimenter = reader.read("!L")[0]
1019 obj.subtype = reader.read("!L")[0]
1020 obj.data = str(reader.read_all())
1021 return obj
1022
1023 def __eq__(self, other):
1024 if type(self) != type(other): return False
1025 if self.xid != other.xid: return False
1026 if self.experimenter != other.experimenter: return False
1027 if self.subtype != other.subtype: return False
1028 if self.data != other.data: return False
1029 return True
1030
1031 def pretty_print(self, q):
1032 q.text("experimenter {")
1033 with q.group():
1034 with q.indent(2):
1035 q.breakable()
1036 q.text("xid = ");
1037 if self.xid != None:
1038 q.text("%#x" % self.xid)
1039 else:
1040 q.text('None')
1041 q.text(","); q.breakable()
1042 q.text("subtype = ");
1043 q.text("%#x" % self.subtype)
1044 q.text(","); q.breakable()
1045 q.text("data = ");
1046 q.pp(self.data)
1047 q.breakable()
1048 q.text('}')
1049
1050message.subtypes[4] = experimenter
1051
1052class bsn_header(experimenter):
1053 subtypes = {}
1054
1055 version = 3
1056 type = 4
1057 experimenter = 6035143
1058
1059 def __init__(self, xid=None, subtype=None):
1060 if xid != None:
1061 self.xid = xid
1062 else:
1063 self.xid = None
1064 if subtype != None:
1065 self.subtype = subtype
1066 else:
1067 self.subtype = 0
1068 return
1069
1070 def pack(self):
1071 packed = []
1072 packed.append(struct.pack("!B", self.version))
1073 packed.append(struct.pack("!B", self.type))
1074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1075 packed.append(struct.pack("!L", self.xid))
1076 packed.append(struct.pack("!L", self.experimenter))
1077 packed.append(struct.pack("!L", self.subtype))
1078 length = sum([len(x) for x in packed])
1079 packed[2] = struct.pack("!H", length)
1080 return ''.join(packed)
1081
1082 @staticmethod
1083 def unpack(reader):
1084 subtype, = reader.peek('!L', 12)
1085 subclass = bsn_header.subtypes.get(subtype)
1086 if subclass:
1087 return subclass.unpack(reader)
1088
1089 obj = bsn_header()
1090 _version = reader.read("!B")[0]
1091 assert(_version == 3)
1092 _type = reader.read("!B")[0]
1093 assert(_type == 4)
1094 _length = reader.read("!H")[0]
1095 orig_reader = reader
1096 reader = orig_reader.slice(_length, 4)
1097 obj.xid = reader.read("!L")[0]
1098 _experimenter = reader.read("!L")[0]
1099 assert(_experimenter == 6035143)
1100 obj.subtype = reader.read("!L")[0]
1101 return obj
1102
1103 def __eq__(self, other):
1104 if type(self) != type(other): return False
1105 if self.xid != other.xid: return False
1106 if self.subtype != other.subtype: return False
1107 return True
1108
1109 def pretty_print(self, q):
1110 q.text("bsn_header {")
1111 with q.group():
1112 with q.indent(2):
1113 q.breakable()
1114 q.text("xid = ");
1115 if self.xid != None:
1116 q.text("%#x" % self.xid)
1117 else:
1118 q.text('None')
1119 q.breakable()
1120 q.text('}')
1121
1122experimenter.subtypes[6035143] = bsn_header
1123
1124class bsn_bw_clear_data_reply(bsn_header):
1125 version = 3
1126 type = 4
1127 experimenter = 6035143
1128 subtype = 22
1129
1130 def __init__(self, xid=None, status=None):
1131 if xid != None:
1132 self.xid = xid
1133 else:
1134 self.xid = None
1135 if status != None:
1136 self.status = status
1137 else:
1138 self.status = 0
1139 return
1140
1141 def pack(self):
1142 packed = []
1143 packed.append(struct.pack("!B", self.version))
1144 packed.append(struct.pack("!B", self.type))
1145 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1146 packed.append(struct.pack("!L", self.xid))
1147 packed.append(struct.pack("!L", self.experimenter))
1148 packed.append(struct.pack("!L", self.subtype))
1149 packed.append(struct.pack("!L", self.status))
1150 length = sum([len(x) for x in packed])
1151 packed[2] = struct.pack("!H", length)
1152 return ''.join(packed)
1153
1154 @staticmethod
1155 def unpack(reader):
1156 obj = bsn_bw_clear_data_reply()
1157 _version = reader.read("!B")[0]
1158 assert(_version == 3)
1159 _type = reader.read("!B")[0]
1160 assert(_type == 4)
1161 _length = reader.read("!H")[0]
1162 orig_reader = reader
1163 reader = orig_reader.slice(_length, 4)
1164 obj.xid = reader.read("!L")[0]
1165 _experimenter = reader.read("!L")[0]
1166 assert(_experimenter == 6035143)
1167 _subtype = reader.read("!L")[0]
1168 assert(_subtype == 22)
1169 obj.status = reader.read("!L")[0]
1170 return obj
1171
1172 def __eq__(self, other):
1173 if type(self) != type(other): return False
1174 if self.xid != other.xid: return False
1175 if self.status != other.status: return False
1176 return True
1177
1178 def pretty_print(self, q):
1179 q.text("bsn_bw_clear_data_reply {")
1180 with q.group():
1181 with q.indent(2):
1182 q.breakable()
1183 q.text("xid = ");
1184 if self.xid != None:
1185 q.text("%#x" % self.xid)
1186 else:
1187 q.text('None')
1188 q.text(","); q.breakable()
1189 q.text("status = ");
1190 q.text("%#x" % self.status)
1191 q.breakable()
1192 q.text('}')
1193
1194bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1195
1196class bsn_bw_clear_data_request(bsn_header):
1197 version = 3
1198 type = 4
1199 experimenter = 6035143
1200 subtype = 21
1201
1202 def __init__(self, xid=None):
1203 if xid != None:
1204 self.xid = xid
1205 else:
1206 self.xid = None
1207 return
1208
1209 def pack(self):
1210 packed = []
1211 packed.append(struct.pack("!B", self.version))
1212 packed.append(struct.pack("!B", self.type))
1213 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1214 packed.append(struct.pack("!L", self.xid))
1215 packed.append(struct.pack("!L", self.experimenter))
1216 packed.append(struct.pack("!L", self.subtype))
1217 length = sum([len(x) for x in packed])
1218 packed[2] = struct.pack("!H", length)
1219 return ''.join(packed)
1220
1221 @staticmethod
1222 def unpack(reader):
1223 obj = bsn_bw_clear_data_request()
1224 _version = reader.read("!B")[0]
1225 assert(_version == 3)
1226 _type = reader.read("!B")[0]
1227 assert(_type == 4)
1228 _length = reader.read("!H")[0]
1229 orig_reader = reader
1230 reader = orig_reader.slice(_length, 4)
1231 obj.xid = reader.read("!L")[0]
1232 _experimenter = reader.read("!L")[0]
1233 assert(_experimenter == 6035143)
1234 _subtype = reader.read("!L")[0]
1235 assert(_subtype == 21)
1236 return obj
1237
1238 def __eq__(self, other):
1239 if type(self) != type(other): return False
1240 if self.xid != other.xid: return False
1241 return True
1242
1243 def pretty_print(self, q):
1244 q.text("bsn_bw_clear_data_request {")
1245 with q.group():
1246 with q.indent(2):
1247 q.breakable()
1248 q.text("xid = ");
1249 if self.xid != None:
1250 q.text("%#x" % self.xid)
1251 else:
1252 q.text('None')
1253 q.breakable()
1254 q.text('}')
1255
1256bsn_header.subtypes[21] = bsn_bw_clear_data_request
1257
1258class bsn_bw_enable_get_reply(bsn_header):
1259 version = 3
1260 type = 4
1261 experimenter = 6035143
1262 subtype = 20
1263
1264 def __init__(self, xid=None, enabled=None):
1265 if xid != None:
1266 self.xid = xid
1267 else:
1268 self.xid = None
1269 if enabled != None:
1270 self.enabled = enabled
1271 else:
1272 self.enabled = 0
1273 return
1274
1275 def pack(self):
1276 packed = []
1277 packed.append(struct.pack("!B", self.version))
1278 packed.append(struct.pack("!B", self.type))
1279 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1280 packed.append(struct.pack("!L", self.xid))
1281 packed.append(struct.pack("!L", self.experimenter))
1282 packed.append(struct.pack("!L", self.subtype))
1283 packed.append(struct.pack("!L", self.enabled))
1284 length = sum([len(x) for x in packed])
1285 packed[2] = struct.pack("!H", length)
1286 return ''.join(packed)
1287
1288 @staticmethod
1289 def unpack(reader):
1290 obj = bsn_bw_enable_get_reply()
1291 _version = reader.read("!B")[0]
1292 assert(_version == 3)
1293 _type = reader.read("!B")[0]
1294 assert(_type == 4)
1295 _length = reader.read("!H")[0]
1296 orig_reader = reader
1297 reader = orig_reader.slice(_length, 4)
1298 obj.xid = reader.read("!L")[0]
1299 _experimenter = reader.read("!L")[0]
1300 assert(_experimenter == 6035143)
1301 _subtype = reader.read("!L")[0]
1302 assert(_subtype == 20)
1303 obj.enabled = reader.read("!L")[0]
1304 return obj
1305
1306 def __eq__(self, other):
1307 if type(self) != type(other): return False
1308 if self.xid != other.xid: return False
1309 if self.enabled != other.enabled: return False
1310 return True
1311
1312 def pretty_print(self, q):
1313 q.text("bsn_bw_enable_get_reply {")
1314 with q.group():
1315 with q.indent(2):
1316 q.breakable()
1317 q.text("xid = ");
1318 if self.xid != None:
1319 q.text("%#x" % self.xid)
1320 else:
1321 q.text('None')
1322 q.text(","); q.breakable()
1323 q.text("enabled = ");
1324 q.text("%#x" % self.enabled)
1325 q.breakable()
1326 q.text('}')
1327
1328bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1329
1330class bsn_bw_enable_get_request(bsn_header):
1331 version = 3
1332 type = 4
1333 experimenter = 6035143
1334 subtype = 19
1335
1336 def __init__(self, xid=None):
1337 if xid != None:
1338 self.xid = xid
1339 else:
1340 self.xid = None
1341 return
1342
1343 def pack(self):
1344 packed = []
1345 packed.append(struct.pack("!B", self.version))
1346 packed.append(struct.pack("!B", self.type))
1347 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1348 packed.append(struct.pack("!L", self.xid))
1349 packed.append(struct.pack("!L", self.experimenter))
1350 packed.append(struct.pack("!L", self.subtype))
1351 length = sum([len(x) for x in packed])
1352 packed[2] = struct.pack("!H", length)
1353 return ''.join(packed)
1354
1355 @staticmethod
1356 def unpack(reader):
1357 obj = bsn_bw_enable_get_request()
1358 _version = reader.read("!B")[0]
1359 assert(_version == 3)
1360 _type = reader.read("!B")[0]
1361 assert(_type == 4)
1362 _length = reader.read("!H")[0]
1363 orig_reader = reader
1364 reader = orig_reader.slice(_length, 4)
1365 obj.xid = reader.read("!L")[0]
1366 _experimenter = reader.read("!L")[0]
1367 assert(_experimenter == 6035143)
1368 _subtype = reader.read("!L")[0]
1369 assert(_subtype == 19)
1370 return obj
1371
1372 def __eq__(self, other):
1373 if type(self) != type(other): return False
1374 if self.xid != other.xid: return False
1375 return True
1376
1377 def pretty_print(self, q):
1378 q.text("bsn_bw_enable_get_request {")
1379 with q.group():
1380 with q.indent(2):
1381 q.breakable()
1382 q.text("xid = ");
1383 if self.xid != None:
1384 q.text("%#x" % self.xid)
1385 else:
1386 q.text('None')
1387 q.breakable()
1388 q.text('}')
1389
1390bsn_header.subtypes[19] = bsn_bw_enable_get_request
1391
1392class bsn_bw_enable_set_reply(bsn_header):
1393 version = 3
1394 type = 4
1395 experimenter = 6035143
1396 subtype = 23
1397
1398 def __init__(self, xid=None, enable=None, status=None):
1399 if xid != None:
1400 self.xid = xid
1401 else:
1402 self.xid = None
1403 if enable != None:
1404 self.enable = enable
1405 else:
1406 self.enable = 0
1407 if status != None:
1408 self.status = status
1409 else:
1410 self.status = 0
1411 return
1412
1413 def pack(self):
1414 packed = []
1415 packed.append(struct.pack("!B", self.version))
1416 packed.append(struct.pack("!B", self.type))
1417 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1418 packed.append(struct.pack("!L", self.xid))
1419 packed.append(struct.pack("!L", self.experimenter))
1420 packed.append(struct.pack("!L", self.subtype))
1421 packed.append(struct.pack("!L", self.enable))
1422 packed.append(struct.pack("!L", self.status))
1423 length = sum([len(x) for x in packed])
1424 packed[2] = struct.pack("!H", length)
1425 return ''.join(packed)
1426
1427 @staticmethod
1428 def unpack(reader):
1429 obj = bsn_bw_enable_set_reply()
1430 _version = reader.read("!B")[0]
1431 assert(_version == 3)
1432 _type = reader.read("!B")[0]
1433 assert(_type == 4)
1434 _length = reader.read("!H")[0]
1435 orig_reader = reader
1436 reader = orig_reader.slice(_length, 4)
1437 obj.xid = reader.read("!L")[0]
1438 _experimenter = reader.read("!L")[0]
1439 assert(_experimenter == 6035143)
1440 _subtype = reader.read("!L")[0]
1441 assert(_subtype == 23)
1442 obj.enable = reader.read("!L")[0]
1443 obj.status = reader.read("!L")[0]
1444 return obj
1445
1446 def __eq__(self, other):
1447 if type(self) != type(other): return False
1448 if self.xid != other.xid: return False
1449 if self.enable != other.enable: return False
1450 if self.status != other.status: return False
1451 return True
1452
1453 def pretty_print(self, q):
1454 q.text("bsn_bw_enable_set_reply {")
1455 with q.group():
1456 with q.indent(2):
1457 q.breakable()
1458 q.text("xid = ");
1459 if self.xid != None:
1460 q.text("%#x" % self.xid)
1461 else:
1462 q.text('None')
1463 q.text(","); q.breakable()
1464 q.text("enable = ");
1465 q.text("%#x" % self.enable)
1466 q.text(","); q.breakable()
1467 q.text("status = ");
1468 q.text("%#x" % self.status)
1469 q.breakable()
1470 q.text('}')
1471
1472bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1473
1474class bsn_bw_enable_set_request(bsn_header):
1475 version = 3
1476 type = 4
1477 experimenter = 6035143
1478 subtype = 18
1479
1480 def __init__(self, xid=None, enable=None):
1481 if xid != None:
1482 self.xid = xid
1483 else:
1484 self.xid = None
1485 if enable != None:
1486 self.enable = enable
1487 else:
1488 self.enable = 0
1489 return
1490
1491 def pack(self):
1492 packed = []
1493 packed.append(struct.pack("!B", self.version))
1494 packed.append(struct.pack("!B", self.type))
1495 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1496 packed.append(struct.pack("!L", self.xid))
1497 packed.append(struct.pack("!L", self.experimenter))
1498 packed.append(struct.pack("!L", self.subtype))
1499 packed.append(struct.pack("!L", self.enable))
1500 length = sum([len(x) for x in packed])
1501 packed[2] = struct.pack("!H", length)
1502 return ''.join(packed)
1503
1504 @staticmethod
1505 def unpack(reader):
1506 obj = bsn_bw_enable_set_request()
1507 _version = reader.read("!B")[0]
1508 assert(_version == 3)
1509 _type = reader.read("!B")[0]
1510 assert(_type == 4)
1511 _length = reader.read("!H")[0]
1512 orig_reader = reader
1513 reader = orig_reader.slice(_length, 4)
1514 obj.xid = reader.read("!L")[0]
1515 _experimenter = reader.read("!L")[0]
1516 assert(_experimenter == 6035143)
1517 _subtype = reader.read("!L")[0]
1518 assert(_subtype == 18)
1519 obj.enable = reader.read("!L")[0]
1520 return obj
1521
1522 def __eq__(self, other):
1523 if type(self) != type(other): return False
1524 if self.xid != other.xid: return False
1525 if self.enable != other.enable: return False
1526 return True
1527
1528 def pretty_print(self, q):
1529 q.text("bsn_bw_enable_set_request {")
1530 with q.group():
1531 with q.indent(2):
1532 q.breakable()
1533 q.text("xid = ");
1534 if self.xid != None:
1535 q.text("%#x" % self.xid)
1536 else:
1537 q.text('None')
1538 q.text(","); q.breakable()
1539 q.text("enable = ");
1540 q.text("%#x" % self.enable)
1541 q.breakable()
1542 q.text('}')
1543
1544bsn_header.subtypes[18] = bsn_bw_enable_set_request
1545
1546class bsn_get_interfaces_reply(bsn_header):
1547 version = 3
1548 type = 4
1549 experimenter = 6035143
1550 subtype = 10
1551
1552 def __init__(self, xid=None, interfaces=None):
1553 if xid != None:
1554 self.xid = xid
1555 else:
1556 self.xid = None
1557 if interfaces != None:
1558 self.interfaces = interfaces
1559 else:
1560 self.interfaces = []
1561 return
1562
1563 def pack(self):
1564 packed = []
1565 packed.append(struct.pack("!B", self.version))
1566 packed.append(struct.pack("!B", self.type))
1567 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1568 packed.append(struct.pack("!L", self.xid))
1569 packed.append(struct.pack("!L", self.experimenter))
1570 packed.append(struct.pack("!L", self.subtype))
1571 packed.append(loxi.generic_util.pack_list(self.interfaces))
1572 length = sum([len(x) for x in packed])
1573 packed[2] = struct.pack("!H", length)
1574 return ''.join(packed)
1575
1576 @staticmethod
1577 def unpack(reader):
1578 obj = bsn_get_interfaces_reply()
1579 _version = reader.read("!B")[0]
1580 assert(_version == 3)
1581 _type = reader.read("!B")[0]
1582 assert(_type == 4)
1583 _length = reader.read("!H")[0]
1584 orig_reader = reader
1585 reader = orig_reader.slice(_length, 4)
1586 obj.xid = reader.read("!L")[0]
1587 _experimenter = reader.read("!L")[0]
1588 assert(_experimenter == 6035143)
1589 _subtype = reader.read("!L")[0]
1590 assert(_subtype == 10)
1591 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
1592 return obj
1593
1594 def __eq__(self, other):
1595 if type(self) != type(other): return False
1596 if self.xid != other.xid: return False
1597 if self.interfaces != other.interfaces: return False
1598 return True
1599
1600 def pretty_print(self, q):
1601 q.text("bsn_get_interfaces_reply {")
1602 with q.group():
1603 with q.indent(2):
1604 q.breakable()
1605 q.text("xid = ");
1606 if self.xid != None:
1607 q.text("%#x" % self.xid)
1608 else:
1609 q.text('None')
1610 q.text(","); q.breakable()
1611 q.text("interfaces = ");
1612 q.pp(self.interfaces)
1613 q.breakable()
1614 q.text('}')
1615
1616bsn_header.subtypes[10] = bsn_get_interfaces_reply
1617
1618class bsn_get_interfaces_request(bsn_header):
1619 version = 3
1620 type = 4
1621 experimenter = 6035143
1622 subtype = 9
1623
1624 def __init__(self, xid=None):
1625 if xid != None:
1626 self.xid = xid
1627 else:
1628 self.xid = None
1629 return
1630
1631 def pack(self):
1632 packed = []
1633 packed.append(struct.pack("!B", self.version))
1634 packed.append(struct.pack("!B", self.type))
1635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1636 packed.append(struct.pack("!L", self.xid))
1637 packed.append(struct.pack("!L", self.experimenter))
1638 packed.append(struct.pack("!L", self.subtype))
1639 length = sum([len(x) for x in packed])
1640 packed[2] = struct.pack("!H", length)
1641 return ''.join(packed)
1642
1643 @staticmethod
1644 def unpack(reader):
1645 obj = bsn_get_interfaces_request()
1646 _version = reader.read("!B")[0]
1647 assert(_version == 3)
1648 _type = reader.read("!B")[0]
1649 assert(_type == 4)
1650 _length = reader.read("!H")[0]
1651 orig_reader = reader
1652 reader = orig_reader.slice(_length, 4)
1653 obj.xid = reader.read("!L")[0]
1654 _experimenter = reader.read("!L")[0]
1655 assert(_experimenter == 6035143)
1656 _subtype = reader.read("!L")[0]
1657 assert(_subtype == 9)
1658 return obj
1659
1660 def __eq__(self, other):
1661 if type(self) != type(other): return False
1662 if self.xid != other.xid: return False
1663 return True
1664
1665 def pretty_print(self, q):
1666 q.text("bsn_get_interfaces_request {")
1667 with q.group():
1668 with q.indent(2):
1669 q.breakable()
1670 q.text("xid = ");
1671 if self.xid != None:
1672 q.text("%#x" % self.xid)
1673 else:
1674 q.text('None')
1675 q.breakable()
1676 q.text('}')
1677
1678bsn_header.subtypes[9] = bsn_get_interfaces_request
1679
1680class bsn_get_mirroring_reply(bsn_header):
1681 version = 3
1682 type = 4
1683 experimenter = 6035143
1684 subtype = 5
1685
1686 def __init__(self, xid=None, report_mirror_ports=None):
1687 if xid != None:
1688 self.xid = xid
1689 else:
1690 self.xid = None
1691 if report_mirror_ports != None:
1692 self.report_mirror_ports = report_mirror_ports
1693 else:
1694 self.report_mirror_ports = 0
1695 return
1696
1697 def pack(self):
1698 packed = []
1699 packed.append(struct.pack("!B", self.version))
1700 packed.append(struct.pack("!B", self.type))
1701 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1702 packed.append(struct.pack("!L", self.xid))
1703 packed.append(struct.pack("!L", self.experimenter))
1704 packed.append(struct.pack("!L", self.subtype))
1705 packed.append(struct.pack("!B", self.report_mirror_ports))
1706 packed.append('\x00' * 3)
1707 length = sum([len(x) for x in packed])
1708 packed[2] = struct.pack("!H", length)
1709 return ''.join(packed)
1710
1711 @staticmethod
1712 def unpack(reader):
1713 obj = bsn_get_mirroring_reply()
1714 _version = reader.read("!B")[0]
1715 assert(_version == 3)
1716 _type = reader.read("!B")[0]
1717 assert(_type == 4)
1718 _length = reader.read("!H")[0]
1719 orig_reader = reader
1720 reader = orig_reader.slice(_length, 4)
1721 obj.xid = reader.read("!L")[0]
1722 _experimenter = reader.read("!L")[0]
1723 assert(_experimenter == 6035143)
1724 _subtype = reader.read("!L")[0]
1725 assert(_subtype == 5)
1726 obj.report_mirror_ports = reader.read("!B")[0]
1727 reader.skip(3)
1728 return obj
1729
1730 def __eq__(self, other):
1731 if type(self) != type(other): return False
1732 if self.xid != other.xid: return False
1733 if self.report_mirror_ports != other.report_mirror_ports: return False
1734 return True
1735
1736 def pretty_print(self, q):
1737 q.text("bsn_get_mirroring_reply {")
1738 with q.group():
1739 with q.indent(2):
1740 q.breakable()
1741 q.text("xid = ");
1742 if self.xid != None:
1743 q.text("%#x" % self.xid)
1744 else:
1745 q.text('None')
1746 q.text(","); q.breakable()
1747 q.text("report_mirror_ports = ");
1748 q.text("%#x" % self.report_mirror_ports)
1749 q.breakable()
1750 q.text('}')
1751
1752bsn_header.subtypes[5] = bsn_get_mirroring_reply
1753
1754class bsn_get_mirroring_request(bsn_header):
1755 version = 3
1756 type = 4
1757 experimenter = 6035143
1758 subtype = 4
1759
1760 def __init__(self, xid=None, report_mirror_ports=None):
1761 if xid != None:
1762 self.xid = xid
1763 else:
1764 self.xid = None
1765 if report_mirror_ports != None:
1766 self.report_mirror_ports = report_mirror_ports
1767 else:
1768 self.report_mirror_ports = 0
1769 return
1770
1771 def pack(self):
1772 packed = []
1773 packed.append(struct.pack("!B", self.version))
1774 packed.append(struct.pack("!B", self.type))
1775 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1776 packed.append(struct.pack("!L", self.xid))
1777 packed.append(struct.pack("!L", self.experimenter))
1778 packed.append(struct.pack("!L", self.subtype))
1779 packed.append(struct.pack("!B", self.report_mirror_ports))
1780 packed.append('\x00' * 3)
1781 length = sum([len(x) for x in packed])
1782 packed[2] = struct.pack("!H", length)
1783 return ''.join(packed)
1784
1785 @staticmethod
1786 def unpack(reader):
1787 obj = bsn_get_mirroring_request()
1788 _version = reader.read("!B")[0]
1789 assert(_version == 3)
1790 _type = reader.read("!B")[0]
1791 assert(_type == 4)
1792 _length = reader.read("!H")[0]
1793 orig_reader = reader
1794 reader = orig_reader.slice(_length, 4)
1795 obj.xid = reader.read("!L")[0]
1796 _experimenter = reader.read("!L")[0]
1797 assert(_experimenter == 6035143)
1798 _subtype = reader.read("!L")[0]
1799 assert(_subtype == 4)
1800 obj.report_mirror_ports = reader.read("!B")[0]
1801 reader.skip(3)
1802 return obj
1803
1804 def __eq__(self, other):
1805 if type(self) != type(other): return False
1806 if self.xid != other.xid: return False
1807 if self.report_mirror_ports != other.report_mirror_ports: return False
1808 return True
1809
1810 def pretty_print(self, q):
1811 q.text("bsn_get_mirroring_request {")
1812 with q.group():
1813 with q.indent(2):
1814 q.breakable()
1815 q.text("xid = ");
1816 if self.xid != None:
1817 q.text("%#x" % self.xid)
1818 else:
1819 q.text('None')
1820 q.text(","); q.breakable()
1821 q.text("report_mirror_ports = ");
1822 q.text("%#x" % self.report_mirror_ports)
1823 q.breakable()
1824 q.text('}')
1825
1826bsn_header.subtypes[4] = bsn_get_mirroring_request
1827
1828class bsn_pdu_rx_reply(bsn_header):
1829 version = 3
1830 type = 4
1831 experimenter = 6035143
1832 subtype = 34
1833
1834 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
1835 if xid != None:
1836 self.xid = xid
1837 else:
1838 self.xid = None
1839 if status != None:
1840 self.status = status
1841 else:
1842 self.status = 0
1843 if port_no != None:
1844 self.port_no = port_no
1845 else:
1846 self.port_no = 0
1847 if slot_num != None:
1848 self.slot_num = slot_num
1849 else:
1850 self.slot_num = 0
1851 return
1852
1853 def pack(self):
1854 packed = []
1855 packed.append(struct.pack("!B", self.version))
1856 packed.append(struct.pack("!B", self.type))
1857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1858 packed.append(struct.pack("!L", self.xid))
1859 packed.append(struct.pack("!L", self.experimenter))
1860 packed.append(struct.pack("!L", self.subtype))
1861 packed.append(struct.pack("!L", self.status))
1862 packed.append(util.pack_port_no(self.port_no))
1863 packed.append(struct.pack("!B", self.slot_num))
1864 length = sum([len(x) for x in packed])
1865 packed[2] = struct.pack("!H", length)
1866 return ''.join(packed)
1867
1868 @staticmethod
1869 def unpack(reader):
1870 obj = bsn_pdu_rx_reply()
1871 _version = reader.read("!B")[0]
1872 assert(_version == 3)
1873 _type = reader.read("!B")[0]
1874 assert(_type == 4)
1875 _length = reader.read("!H")[0]
1876 orig_reader = reader
1877 reader = orig_reader.slice(_length, 4)
1878 obj.xid = reader.read("!L")[0]
1879 _experimenter = reader.read("!L")[0]
1880 assert(_experimenter == 6035143)
1881 _subtype = reader.read("!L")[0]
1882 assert(_subtype == 34)
1883 obj.status = reader.read("!L")[0]
1884 obj.port_no = util.unpack_port_no(reader)
1885 obj.slot_num = reader.read("!B")[0]
1886 return obj
1887
1888 def __eq__(self, other):
1889 if type(self) != type(other): return False
1890 if self.xid != other.xid: return False
1891 if self.status != other.status: return False
1892 if self.port_no != other.port_no: return False
1893 if self.slot_num != other.slot_num: return False
1894 return True
1895
1896 def pretty_print(self, q):
1897 q.text("bsn_pdu_rx_reply {")
1898 with q.group():
1899 with q.indent(2):
1900 q.breakable()
1901 q.text("xid = ");
1902 if self.xid != None:
1903 q.text("%#x" % self.xid)
1904 else:
1905 q.text('None')
1906 q.text(","); q.breakable()
1907 q.text("status = ");
1908 q.text("%#x" % self.status)
1909 q.text(","); q.breakable()
1910 q.text("port_no = ");
1911 q.text(util.pretty_port(self.port_no))
1912 q.text(","); q.breakable()
1913 q.text("slot_num = ");
1914 q.text("%#x" % self.slot_num)
1915 q.breakable()
1916 q.text('}')
1917
1918bsn_header.subtypes[34] = bsn_pdu_rx_reply
1919
1920class bsn_pdu_rx_request(bsn_header):
1921 version = 3
1922 type = 4
1923 experimenter = 6035143
1924 subtype = 33
1925
1926 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
1927 if xid != None:
1928 self.xid = xid
1929 else:
1930 self.xid = None
1931 if timeout_ms != None:
1932 self.timeout_ms = timeout_ms
1933 else:
1934 self.timeout_ms = 0
1935 if port_no != None:
1936 self.port_no = port_no
1937 else:
1938 self.port_no = 0
1939 if slot_num != None:
1940 self.slot_num = slot_num
1941 else:
1942 self.slot_num = 0
1943 if data != None:
1944 self.data = data
1945 else:
1946 self.data = ''
1947 return
1948
1949 def pack(self):
1950 packed = []
1951 packed.append(struct.pack("!B", self.version))
1952 packed.append(struct.pack("!B", self.type))
1953 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1954 packed.append(struct.pack("!L", self.xid))
1955 packed.append(struct.pack("!L", self.experimenter))
1956 packed.append(struct.pack("!L", self.subtype))
1957 packed.append(struct.pack("!L", self.timeout_ms))
1958 packed.append(util.pack_port_no(self.port_no))
1959 packed.append(struct.pack("!B", self.slot_num))
1960 packed.append('\x00' * 3)
1961 packed.append(self.data)
1962 length = sum([len(x) for x in packed])
1963 packed[2] = struct.pack("!H", length)
1964 return ''.join(packed)
1965
1966 @staticmethod
1967 def unpack(reader):
1968 obj = bsn_pdu_rx_request()
1969 _version = reader.read("!B")[0]
1970 assert(_version == 3)
1971 _type = reader.read("!B")[0]
1972 assert(_type == 4)
1973 _length = reader.read("!H")[0]
1974 orig_reader = reader
1975 reader = orig_reader.slice(_length, 4)
1976 obj.xid = reader.read("!L")[0]
1977 _experimenter = reader.read("!L")[0]
1978 assert(_experimenter == 6035143)
1979 _subtype = reader.read("!L")[0]
1980 assert(_subtype == 33)
1981 obj.timeout_ms = reader.read("!L")[0]
1982 obj.port_no = util.unpack_port_no(reader)
1983 obj.slot_num = reader.read("!B")[0]
1984 reader.skip(3)
1985 obj.data = str(reader.read_all())
1986 return obj
1987
1988 def __eq__(self, other):
1989 if type(self) != type(other): return False
1990 if self.xid != other.xid: return False
1991 if self.timeout_ms != other.timeout_ms: return False
1992 if self.port_no != other.port_no: return False
1993 if self.slot_num != other.slot_num: return False
1994 if self.data != other.data: return False
1995 return True
1996
1997 def pretty_print(self, q):
1998 q.text("bsn_pdu_rx_request {")
1999 with q.group():
2000 with q.indent(2):
2001 q.breakable()
2002 q.text("xid = ");
2003 if self.xid != None:
2004 q.text("%#x" % self.xid)
2005 else:
2006 q.text('None')
2007 q.text(","); q.breakable()
2008 q.text("timeout_ms = ");
2009 q.text("%#x" % self.timeout_ms)
2010 q.text(","); q.breakable()
2011 q.text("port_no = ");
2012 q.text(util.pretty_port(self.port_no))
2013 q.text(","); q.breakable()
2014 q.text("slot_num = ");
2015 q.text("%#x" % self.slot_num)
2016 q.text(","); q.breakable()
2017 q.text("data = ");
2018 q.pp(self.data)
2019 q.breakable()
2020 q.text('}')
2021
2022bsn_header.subtypes[33] = bsn_pdu_rx_request
2023
2024class bsn_pdu_rx_timeout(bsn_header):
2025 version = 3
2026 type = 4
2027 experimenter = 6035143
2028 subtype = 35
2029
2030 def __init__(self, xid=None, port_no=None, slot_num=None):
2031 if xid != None:
2032 self.xid = xid
2033 else:
2034 self.xid = None
2035 if port_no != None:
2036 self.port_no = port_no
2037 else:
2038 self.port_no = 0
2039 if slot_num != None:
2040 self.slot_num = slot_num
2041 else:
2042 self.slot_num = 0
2043 return
2044
2045 def pack(self):
2046 packed = []
2047 packed.append(struct.pack("!B", self.version))
2048 packed.append(struct.pack("!B", self.type))
2049 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2050 packed.append(struct.pack("!L", self.xid))
2051 packed.append(struct.pack("!L", self.experimenter))
2052 packed.append(struct.pack("!L", self.subtype))
2053 packed.append(util.pack_port_no(self.port_no))
2054 packed.append(struct.pack("!B", self.slot_num))
2055 length = sum([len(x) for x in packed])
2056 packed[2] = struct.pack("!H", length)
2057 return ''.join(packed)
2058
2059 @staticmethod
2060 def unpack(reader):
2061 obj = bsn_pdu_rx_timeout()
2062 _version = reader.read("!B")[0]
2063 assert(_version == 3)
2064 _type = reader.read("!B")[0]
2065 assert(_type == 4)
2066 _length = reader.read("!H")[0]
2067 orig_reader = reader
2068 reader = orig_reader.slice(_length, 4)
2069 obj.xid = reader.read("!L")[0]
2070 _experimenter = reader.read("!L")[0]
2071 assert(_experimenter == 6035143)
2072 _subtype = reader.read("!L")[0]
2073 assert(_subtype == 35)
2074 obj.port_no = util.unpack_port_no(reader)
2075 obj.slot_num = reader.read("!B")[0]
2076 return obj
2077
2078 def __eq__(self, other):
2079 if type(self) != type(other): return False
2080 if self.xid != other.xid: return False
2081 if self.port_no != other.port_no: return False
2082 if self.slot_num != other.slot_num: return False
2083 return True
2084
2085 def pretty_print(self, q):
2086 q.text("bsn_pdu_rx_timeout {")
2087 with q.group():
2088 with q.indent(2):
2089 q.breakable()
2090 q.text("xid = ");
2091 if self.xid != None:
2092 q.text("%#x" % self.xid)
2093 else:
2094 q.text('None')
2095 q.text(","); q.breakable()
2096 q.text("port_no = ");
2097 q.text(util.pretty_port(self.port_no))
2098 q.text(","); q.breakable()
2099 q.text("slot_num = ");
2100 q.text("%#x" % self.slot_num)
2101 q.breakable()
2102 q.text('}')
2103
2104bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2105
2106class bsn_pdu_tx_reply(bsn_header):
2107 version = 3
2108 type = 4
2109 experimenter = 6035143
2110 subtype = 32
2111
2112 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
2113 if xid != None:
2114 self.xid = xid
2115 else:
2116 self.xid = None
2117 if status != None:
2118 self.status = status
2119 else:
2120 self.status = 0
2121 if port_no != None:
2122 self.port_no = port_no
2123 else:
2124 self.port_no = 0
2125 if slot_num != None:
2126 self.slot_num = slot_num
2127 else:
2128 self.slot_num = 0
2129 return
2130
2131 def pack(self):
2132 packed = []
2133 packed.append(struct.pack("!B", self.version))
2134 packed.append(struct.pack("!B", self.type))
2135 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2136 packed.append(struct.pack("!L", self.xid))
2137 packed.append(struct.pack("!L", self.experimenter))
2138 packed.append(struct.pack("!L", self.subtype))
2139 packed.append(struct.pack("!L", self.status))
2140 packed.append(util.pack_port_no(self.port_no))
2141 packed.append(struct.pack("!B", self.slot_num))
2142 length = sum([len(x) for x in packed])
2143 packed[2] = struct.pack("!H", length)
2144 return ''.join(packed)
2145
2146 @staticmethod
2147 def unpack(reader):
2148 obj = bsn_pdu_tx_reply()
2149 _version = reader.read("!B")[0]
2150 assert(_version == 3)
2151 _type = reader.read("!B")[0]
2152 assert(_type == 4)
2153 _length = reader.read("!H")[0]
2154 orig_reader = reader
2155 reader = orig_reader.slice(_length, 4)
2156 obj.xid = reader.read("!L")[0]
2157 _experimenter = reader.read("!L")[0]
2158 assert(_experimenter == 6035143)
2159 _subtype = reader.read("!L")[0]
2160 assert(_subtype == 32)
2161 obj.status = reader.read("!L")[0]
2162 obj.port_no = util.unpack_port_no(reader)
2163 obj.slot_num = reader.read("!B")[0]
2164 return obj
2165
2166 def __eq__(self, other):
2167 if type(self) != type(other): return False
2168 if self.xid != other.xid: return False
2169 if self.status != other.status: return False
2170 if self.port_no != other.port_no: return False
2171 if self.slot_num != other.slot_num: return False
2172 return True
2173
2174 def pretty_print(self, q):
2175 q.text("bsn_pdu_tx_reply {")
2176 with q.group():
2177 with q.indent(2):
2178 q.breakable()
2179 q.text("xid = ");
2180 if self.xid != None:
2181 q.text("%#x" % self.xid)
2182 else:
2183 q.text('None')
2184 q.text(","); q.breakable()
2185 q.text("status = ");
2186 q.text("%#x" % self.status)
2187 q.text(","); q.breakable()
2188 q.text("port_no = ");
2189 q.text(util.pretty_port(self.port_no))
2190 q.text(","); q.breakable()
2191 q.text("slot_num = ");
2192 q.text("%#x" % self.slot_num)
2193 q.breakable()
2194 q.text('}')
2195
2196bsn_header.subtypes[32] = bsn_pdu_tx_reply
2197
2198class bsn_pdu_tx_request(bsn_header):
2199 version = 3
2200 type = 4
2201 experimenter = 6035143
2202 subtype = 31
2203
2204 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
2205 if xid != None:
2206 self.xid = xid
2207 else:
2208 self.xid = None
2209 if tx_interval_ms != None:
2210 self.tx_interval_ms = tx_interval_ms
2211 else:
2212 self.tx_interval_ms = 0
2213 if port_no != None:
2214 self.port_no = port_no
2215 else:
2216 self.port_no = 0
2217 if slot_num != None:
2218 self.slot_num = slot_num
2219 else:
2220 self.slot_num = 0
2221 if data != None:
2222 self.data = data
2223 else:
2224 self.data = ''
2225 return
2226
2227 def pack(self):
2228 packed = []
2229 packed.append(struct.pack("!B", self.version))
2230 packed.append(struct.pack("!B", self.type))
2231 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2232 packed.append(struct.pack("!L", self.xid))
2233 packed.append(struct.pack("!L", self.experimenter))
2234 packed.append(struct.pack("!L", self.subtype))
2235 packed.append(struct.pack("!L", self.tx_interval_ms))
2236 packed.append(util.pack_port_no(self.port_no))
2237 packed.append(struct.pack("!B", self.slot_num))
2238 packed.append('\x00' * 3)
2239 packed.append(self.data)
2240 length = sum([len(x) for x in packed])
2241 packed[2] = struct.pack("!H", length)
2242 return ''.join(packed)
2243
2244 @staticmethod
2245 def unpack(reader):
2246 obj = bsn_pdu_tx_request()
2247 _version = reader.read("!B")[0]
2248 assert(_version == 3)
2249 _type = reader.read("!B")[0]
2250 assert(_type == 4)
2251 _length = reader.read("!H")[0]
2252 orig_reader = reader
2253 reader = orig_reader.slice(_length, 4)
2254 obj.xid = reader.read("!L")[0]
2255 _experimenter = reader.read("!L")[0]
2256 assert(_experimenter == 6035143)
2257 _subtype = reader.read("!L")[0]
2258 assert(_subtype == 31)
2259 obj.tx_interval_ms = reader.read("!L")[0]
2260 obj.port_no = util.unpack_port_no(reader)
2261 obj.slot_num = reader.read("!B")[0]
2262 reader.skip(3)
2263 obj.data = str(reader.read_all())
2264 return obj
2265
2266 def __eq__(self, other):
2267 if type(self) != type(other): return False
2268 if self.xid != other.xid: return False
2269 if self.tx_interval_ms != other.tx_interval_ms: return False
2270 if self.port_no != other.port_no: return False
2271 if self.slot_num != other.slot_num: return False
2272 if self.data != other.data: return False
2273 return True
2274
2275 def pretty_print(self, q):
2276 q.text("bsn_pdu_tx_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.text(","); q.breakable()
2286 q.text("tx_interval_ms = ");
2287 q.text("%#x" % self.tx_interval_ms)
2288 q.text(","); q.breakable()
2289 q.text("port_no = ");
2290 q.text(util.pretty_port(self.port_no))
2291 q.text(","); q.breakable()
2292 q.text("slot_num = ");
2293 q.text("%#x" % self.slot_num)
2294 q.text(","); q.breakable()
2295 q.text("data = ");
2296 q.pp(self.data)
2297 q.breakable()
2298 q.text('}')
2299
2300bsn_header.subtypes[31] = bsn_pdu_tx_request
2301
2302class bsn_set_mirroring(bsn_header):
2303 version = 3
2304 type = 4
2305 experimenter = 6035143
2306 subtype = 3
2307
2308 def __init__(self, xid=None, report_mirror_ports=None):
2309 if xid != None:
2310 self.xid = xid
2311 else:
2312 self.xid = None
2313 if report_mirror_ports != None:
2314 self.report_mirror_ports = report_mirror_ports
2315 else:
2316 self.report_mirror_ports = 0
2317 return
2318
2319 def pack(self):
2320 packed = []
2321 packed.append(struct.pack("!B", self.version))
2322 packed.append(struct.pack("!B", self.type))
2323 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2324 packed.append(struct.pack("!L", self.xid))
2325 packed.append(struct.pack("!L", self.experimenter))
2326 packed.append(struct.pack("!L", self.subtype))
2327 packed.append(struct.pack("!B", self.report_mirror_ports))
2328 packed.append('\x00' * 3)
2329 length = sum([len(x) for x in packed])
2330 packed[2] = struct.pack("!H", length)
2331 return ''.join(packed)
2332
2333 @staticmethod
2334 def unpack(reader):
2335 obj = bsn_set_mirroring()
2336 _version = reader.read("!B")[0]
2337 assert(_version == 3)
2338 _type = reader.read("!B")[0]
2339 assert(_type == 4)
2340 _length = reader.read("!H")[0]
2341 orig_reader = reader
2342 reader = orig_reader.slice(_length, 4)
2343 obj.xid = reader.read("!L")[0]
2344 _experimenter = reader.read("!L")[0]
2345 assert(_experimenter == 6035143)
2346 _subtype = reader.read("!L")[0]
2347 assert(_subtype == 3)
2348 obj.report_mirror_ports = reader.read("!B")[0]
2349 reader.skip(3)
2350 return obj
2351
2352 def __eq__(self, other):
2353 if type(self) != type(other): return False
2354 if self.xid != other.xid: return False
2355 if self.report_mirror_ports != other.report_mirror_ports: return False
2356 return True
2357
2358 def pretty_print(self, q):
2359 q.text("bsn_set_mirroring {")
2360 with q.group():
2361 with q.indent(2):
2362 q.breakable()
2363 q.text("xid = ");
2364 if self.xid != None:
2365 q.text("%#x" % self.xid)
2366 else:
2367 q.text('None')
2368 q.text(","); q.breakable()
2369 q.text("report_mirror_ports = ");
2370 q.text("%#x" % self.report_mirror_ports)
2371 q.breakable()
2372 q.text('}')
2373
2374bsn_header.subtypes[3] = bsn_set_mirroring
2375
2376class bsn_set_pktin_suppression_reply(bsn_header):
2377 version = 3
2378 type = 4
2379 experimenter = 6035143
2380 subtype = 25
2381
2382 def __init__(self, xid=None, status=None):
2383 if xid != None:
2384 self.xid = xid
2385 else:
2386 self.xid = None
2387 if status != None:
2388 self.status = status
2389 else:
2390 self.status = 0
2391 return
2392
2393 def pack(self):
2394 packed = []
2395 packed.append(struct.pack("!B", self.version))
2396 packed.append(struct.pack("!B", self.type))
2397 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2398 packed.append(struct.pack("!L", self.xid))
2399 packed.append(struct.pack("!L", self.experimenter))
2400 packed.append(struct.pack("!L", self.subtype))
2401 packed.append(struct.pack("!L", self.status))
2402 length = sum([len(x) for x in packed])
2403 packed[2] = struct.pack("!H", length)
2404 return ''.join(packed)
2405
2406 @staticmethod
2407 def unpack(reader):
2408 obj = bsn_set_pktin_suppression_reply()
2409 _version = reader.read("!B")[0]
2410 assert(_version == 3)
2411 _type = reader.read("!B")[0]
2412 assert(_type == 4)
2413 _length = reader.read("!H")[0]
2414 orig_reader = reader
2415 reader = orig_reader.slice(_length, 4)
2416 obj.xid = reader.read("!L")[0]
2417 _experimenter = reader.read("!L")[0]
2418 assert(_experimenter == 6035143)
2419 _subtype = reader.read("!L")[0]
2420 assert(_subtype == 25)
2421 obj.status = reader.read("!L")[0]
2422 return obj
2423
2424 def __eq__(self, other):
2425 if type(self) != type(other): return False
2426 if self.xid != other.xid: return False
2427 if self.status != other.status: return False
2428 return True
2429
2430 def pretty_print(self, q):
2431 q.text("bsn_set_pktin_suppression_reply {")
2432 with q.group():
2433 with q.indent(2):
2434 q.breakable()
2435 q.text("xid = ");
2436 if self.xid != None:
2437 q.text("%#x" % self.xid)
2438 else:
2439 q.text('None')
2440 q.text(","); q.breakable()
2441 q.text("status = ");
2442 q.text("%#x" % self.status)
2443 q.breakable()
2444 q.text('}')
2445
2446bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2447
2448class bsn_set_pktin_suppression_request(bsn_header):
2449 version = 3
2450 type = 4
2451 experimenter = 6035143
2452 subtype = 11
2453
2454 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
2455 if xid != None:
2456 self.xid = xid
2457 else:
2458 self.xid = None
2459 if enabled != None:
2460 self.enabled = enabled
2461 else:
2462 self.enabled = 0
2463 if idle_timeout != None:
2464 self.idle_timeout = idle_timeout
2465 else:
2466 self.idle_timeout = 0
2467 if hard_timeout != None:
2468 self.hard_timeout = hard_timeout
2469 else:
2470 self.hard_timeout = 0
2471 if priority != None:
2472 self.priority = priority
2473 else:
2474 self.priority = 0
2475 if cookie != None:
2476 self.cookie = cookie
2477 else:
2478 self.cookie = 0
2479 return
2480
2481 def pack(self):
2482 packed = []
2483 packed.append(struct.pack("!B", self.version))
2484 packed.append(struct.pack("!B", self.type))
2485 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2486 packed.append(struct.pack("!L", self.xid))
2487 packed.append(struct.pack("!L", self.experimenter))
2488 packed.append(struct.pack("!L", self.subtype))
2489 packed.append(struct.pack("!B", self.enabled))
2490 packed.append('\x00' * 1)
2491 packed.append(struct.pack("!H", self.idle_timeout))
2492 packed.append(struct.pack("!H", self.hard_timeout))
2493 packed.append(struct.pack("!H", self.priority))
2494 packed.append(struct.pack("!Q", self.cookie))
2495 length = sum([len(x) for x in packed])
2496 packed[2] = struct.pack("!H", length)
2497 return ''.join(packed)
2498
2499 @staticmethod
2500 def unpack(reader):
2501 obj = bsn_set_pktin_suppression_request()
2502 _version = reader.read("!B")[0]
2503 assert(_version == 3)
2504 _type = reader.read("!B")[0]
2505 assert(_type == 4)
2506 _length = reader.read("!H")[0]
2507 orig_reader = reader
2508 reader = orig_reader.slice(_length, 4)
2509 obj.xid = reader.read("!L")[0]
2510 _experimenter = reader.read("!L")[0]
2511 assert(_experimenter == 6035143)
2512 _subtype = reader.read("!L")[0]
2513 assert(_subtype == 11)
2514 obj.enabled = reader.read("!B")[0]
2515 reader.skip(1)
2516 obj.idle_timeout = reader.read("!H")[0]
2517 obj.hard_timeout = reader.read("!H")[0]
2518 obj.priority = reader.read("!H")[0]
2519 obj.cookie = reader.read("!Q")[0]
2520 return obj
2521
2522 def __eq__(self, other):
2523 if type(self) != type(other): return False
2524 if self.xid != other.xid: return False
2525 if self.enabled != other.enabled: return False
2526 if self.idle_timeout != other.idle_timeout: return False
2527 if self.hard_timeout != other.hard_timeout: return False
2528 if self.priority != other.priority: return False
2529 if self.cookie != other.cookie: return False
2530 return True
2531
2532 def pretty_print(self, q):
2533 q.text("bsn_set_pktin_suppression_request {")
2534 with q.group():
2535 with q.indent(2):
2536 q.breakable()
2537 q.text("xid = ");
2538 if self.xid != None:
2539 q.text("%#x" % self.xid)
2540 else:
2541 q.text('None')
2542 q.text(","); q.breakable()
2543 q.text("enabled = ");
2544 q.text("%#x" % self.enabled)
2545 q.text(","); q.breakable()
2546 q.text("idle_timeout = ");
2547 q.text("%#x" % self.idle_timeout)
2548 q.text(","); q.breakable()
2549 q.text("hard_timeout = ");
2550 q.text("%#x" % self.hard_timeout)
2551 q.text(","); q.breakable()
2552 q.text("priority = ");
2553 q.text("%#x" % self.priority)
2554 q.text(","); q.breakable()
2555 q.text("cookie = ");
2556 q.text("%#x" % self.cookie)
2557 q.breakable()
2558 q.text('}')
2559
2560bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
2561
2562class experimenter_stats_reply(stats_reply):
2563 subtypes = {}
2564
2565 version = 3
2566 type = 19
2567 stats_type = 65535
2568
2569 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None):
2570 if xid != None:
2571 self.xid = xid
2572 else:
2573 self.xid = None
2574 if flags != None:
2575 self.flags = flags
2576 else:
2577 self.flags = 0
2578 if experimenter != None:
2579 self.experimenter = experimenter
2580 else:
2581 self.experimenter = 0
2582 if subtype != None:
2583 self.subtype = subtype
2584 else:
2585 self.subtype = 0
2586 if data != None:
2587 self.data = data
2588 else:
2589 self.data = ''
2590 return
2591
2592 def pack(self):
2593 packed = []
2594 packed.append(struct.pack("!B", self.version))
2595 packed.append(struct.pack("!B", self.type))
2596 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2597 packed.append(struct.pack("!L", self.xid))
2598 packed.append(struct.pack("!H", self.stats_type))
2599 packed.append(struct.pack("!H", self.flags))
2600 packed.append('\x00' * 4)
2601 packed.append(struct.pack("!L", self.experimenter))
2602 packed.append(struct.pack("!L", self.subtype))
2603 packed.append(self.data)
2604 length = sum([len(x) for x in packed])
2605 packed[2] = struct.pack("!H", length)
2606 return ''.join(packed)
2607
2608 @staticmethod
2609 def unpack(reader):
2610 subtype, = reader.peek('!L', 16)
2611 subclass = experimenter_stats_reply.subtypes.get(subtype)
2612 if subclass:
2613 return subclass.unpack(reader)
2614
2615 obj = experimenter_stats_reply()
2616 _version = reader.read("!B")[0]
2617 assert(_version == 3)
2618 _type = reader.read("!B")[0]
2619 assert(_type == 19)
2620 _length = reader.read("!H")[0]
2621 orig_reader = reader
2622 reader = orig_reader.slice(_length, 4)
2623 obj.xid = reader.read("!L")[0]
2624 _stats_type = reader.read("!H")[0]
2625 assert(_stats_type == 65535)
2626 obj.flags = reader.read("!H")[0]
2627 reader.skip(4)
2628 obj.experimenter = reader.read("!L")[0]
2629 obj.subtype = reader.read("!L")[0]
2630 obj.data = str(reader.read_all())
2631 return obj
2632
2633 def __eq__(self, other):
2634 if type(self) != type(other): return False
2635 if self.xid != other.xid: return False
2636 if self.flags != other.flags: return False
2637 if self.experimenter != other.experimenter: return False
2638 if self.subtype != other.subtype: return False
2639 if self.data != other.data: return False
2640 return True
2641
2642 def pretty_print(self, q):
2643 q.text("experimenter_stats_reply {")
2644 with q.group():
2645 with q.indent(2):
2646 q.breakable()
2647 q.text("xid = ");
2648 if self.xid != None:
2649 q.text("%#x" % self.xid)
2650 else:
2651 q.text('None')
2652 q.text(","); q.breakable()
2653 q.text("flags = ");
2654 q.text("%#x" % self.flags)
2655 q.text(","); q.breakable()
2656 q.text("subtype = ");
2657 q.text("%#x" % self.subtype)
2658 q.text(","); q.breakable()
2659 q.text("data = ");
2660 q.pp(self.data)
2661 q.breakable()
2662 q.text('}')
2663
2664stats_reply.subtypes[65535] = experimenter_stats_reply
2665
2666class bsn_stats_reply(experimenter_stats_reply):
2667 subtypes = {}
2668
2669 version = 3
2670 type = 19
2671 stats_type = 65535
2672 experimenter = 6035143
2673
2674 def __init__(self, xid=None, flags=None, subtype=None):
2675 if xid != None:
2676 self.xid = xid
2677 else:
2678 self.xid = None
2679 if flags != None:
2680 self.flags = flags
2681 else:
2682 self.flags = 0
2683 if subtype != None:
2684 self.subtype = subtype
2685 else:
2686 self.subtype = 0
2687 return
2688
2689 def pack(self):
2690 packed = []
2691 packed.append(struct.pack("!B", self.version))
2692 packed.append(struct.pack("!B", self.type))
2693 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2694 packed.append(struct.pack("!L", self.xid))
2695 packed.append(struct.pack("!H", self.stats_type))
2696 packed.append(struct.pack("!H", self.flags))
2697 packed.append('\x00' * 4)
2698 packed.append(struct.pack("!L", self.experimenter))
2699 packed.append(struct.pack("!L", self.subtype))
2700 length = sum([len(x) for x in packed])
2701 packed[2] = struct.pack("!H", length)
2702 return ''.join(packed)
2703
2704 @staticmethod
2705 def unpack(reader):
2706 subtype, = reader.peek('!L', 20)
2707 subclass = bsn_stats_reply.subtypes.get(subtype)
2708 if subclass:
2709 return subclass.unpack(reader)
2710
2711 obj = bsn_stats_reply()
2712 _version = reader.read("!B")[0]
2713 assert(_version == 3)
2714 _type = reader.read("!B")[0]
2715 assert(_type == 19)
2716 _length = reader.read("!H")[0]
2717 orig_reader = reader
2718 reader = orig_reader.slice(_length, 4)
2719 obj.xid = reader.read("!L")[0]
2720 _stats_type = reader.read("!H")[0]
2721 assert(_stats_type == 65535)
2722 obj.flags = reader.read("!H")[0]
2723 reader.skip(4)
2724 _experimenter = reader.read("!L")[0]
2725 assert(_experimenter == 6035143)
2726 obj.subtype = reader.read("!L")[0]
2727 return obj
2728
2729 def __eq__(self, other):
2730 if type(self) != type(other): return False
2731 if self.xid != other.xid: return False
2732 if self.flags != other.flags: return False
2733 if self.subtype != other.subtype: return False
2734 return True
2735
2736 def pretty_print(self, q):
2737 q.text("bsn_stats_reply {")
2738 with q.group():
2739 with q.indent(2):
2740 q.breakable()
2741 q.text("xid = ");
2742 if self.xid != None:
2743 q.text("%#x" % self.xid)
2744 else:
2745 q.text('None')
2746 q.text(","); q.breakable()
2747 q.text("flags = ");
2748 q.text("%#x" % self.flags)
2749 q.breakable()
2750 q.text('}')
2751
2752experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2753
2754class experimenter_stats_request(stats_request):
2755 subtypes = {}
2756
2757 version = 3
2758 type = 18
2759 stats_type = 65535
2760
2761 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None):
2762 if xid != None:
2763 self.xid = xid
2764 else:
2765 self.xid = None
2766 if flags != None:
2767 self.flags = flags
2768 else:
2769 self.flags = 0
2770 if experimenter != None:
2771 self.experimenter = experimenter
2772 else:
2773 self.experimenter = 0
2774 if subtype != None:
2775 self.subtype = subtype
2776 else:
2777 self.subtype = 0
2778 if data != None:
2779 self.data = data
2780 else:
2781 self.data = ''
2782 return
2783
2784 def pack(self):
2785 packed = []
2786 packed.append(struct.pack("!B", self.version))
2787 packed.append(struct.pack("!B", self.type))
2788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2789 packed.append(struct.pack("!L", self.xid))
2790 packed.append(struct.pack("!H", self.stats_type))
2791 packed.append(struct.pack("!H", self.flags))
2792 packed.append('\x00' * 4)
2793 packed.append(struct.pack("!L", self.experimenter))
2794 packed.append(struct.pack("!L", self.subtype))
2795 packed.append(self.data)
2796 length = sum([len(x) for x in packed])
2797 packed[2] = struct.pack("!H", length)
2798 return ''.join(packed)
2799
2800 @staticmethod
2801 def unpack(reader):
2802 subtype, = reader.peek('!L', 16)
2803 subclass = experimenter_stats_request.subtypes.get(subtype)
2804 if subclass:
2805 return subclass.unpack(reader)
2806
2807 obj = experimenter_stats_request()
2808 _version = reader.read("!B")[0]
2809 assert(_version == 3)
2810 _type = reader.read("!B")[0]
2811 assert(_type == 18)
2812 _length = reader.read("!H")[0]
2813 orig_reader = reader
2814 reader = orig_reader.slice(_length, 4)
2815 obj.xid = reader.read("!L")[0]
2816 _stats_type = reader.read("!H")[0]
2817 assert(_stats_type == 65535)
2818 obj.flags = reader.read("!H")[0]
2819 reader.skip(4)
2820 obj.experimenter = reader.read("!L")[0]
2821 obj.subtype = reader.read("!L")[0]
2822 obj.data = str(reader.read_all())
2823 return obj
2824
2825 def __eq__(self, other):
2826 if type(self) != type(other): return False
2827 if self.xid != other.xid: return False
2828 if self.flags != other.flags: return False
2829 if self.experimenter != other.experimenter: return False
2830 if self.subtype != other.subtype: return False
2831 if self.data != other.data: return False
2832 return True
2833
2834 def pretty_print(self, q):
2835 q.text("experimenter_stats_request {")
2836 with q.group():
2837 with q.indent(2):
2838 q.breakable()
2839 q.text("xid = ");
2840 if self.xid != None:
2841 q.text("%#x" % self.xid)
2842 else:
2843 q.text('None')
2844 q.text(","); q.breakable()
2845 q.text("flags = ");
2846 q.text("%#x" % self.flags)
2847 q.text(","); q.breakable()
2848 q.text("subtype = ");
2849 q.text("%#x" % self.subtype)
2850 q.text(","); q.breakable()
2851 q.text("data = ");
2852 q.pp(self.data)
2853 q.breakable()
2854 q.text('}')
2855
2856stats_request.subtypes[65535] = experimenter_stats_request
2857
2858class bsn_stats_request(experimenter_stats_request):
2859 subtypes = {}
2860
2861 version = 3
2862 type = 18
2863 stats_type = 65535
2864 experimenter = 6035143
2865
2866 def __init__(self, xid=None, flags=None, subtype=None):
2867 if xid != None:
2868 self.xid = xid
2869 else:
2870 self.xid = None
2871 if flags != None:
2872 self.flags = flags
2873 else:
2874 self.flags = 0
2875 if subtype != None:
2876 self.subtype = subtype
2877 else:
2878 self.subtype = 0
2879 return
2880
2881 def pack(self):
2882 packed = []
2883 packed.append(struct.pack("!B", self.version))
2884 packed.append(struct.pack("!B", self.type))
2885 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2886 packed.append(struct.pack("!L", self.xid))
2887 packed.append(struct.pack("!H", self.stats_type))
2888 packed.append(struct.pack("!H", self.flags))
2889 packed.append('\x00' * 4)
2890 packed.append(struct.pack("!L", self.experimenter))
2891 packed.append(struct.pack("!L", self.subtype))
2892 length = sum([len(x) for x in packed])
2893 packed[2] = struct.pack("!H", length)
2894 return ''.join(packed)
2895
2896 @staticmethod
2897 def unpack(reader):
2898 subtype, = reader.peek('!L', 20)
2899 subclass = bsn_stats_request.subtypes.get(subtype)
2900 if subclass:
2901 return subclass.unpack(reader)
2902
2903 obj = bsn_stats_request()
2904 _version = reader.read("!B")[0]
2905 assert(_version == 3)
2906 _type = reader.read("!B")[0]
2907 assert(_type == 18)
2908 _length = reader.read("!H")[0]
2909 orig_reader = reader
2910 reader = orig_reader.slice(_length, 4)
2911 obj.xid = reader.read("!L")[0]
2912 _stats_type = reader.read("!H")[0]
2913 assert(_stats_type == 65535)
2914 obj.flags = reader.read("!H")[0]
2915 reader.skip(4)
2916 _experimenter = reader.read("!L")[0]
2917 assert(_experimenter == 6035143)
2918 obj.subtype = reader.read("!L")[0]
2919 return obj
2920
2921 def __eq__(self, other):
2922 if type(self) != type(other): return False
2923 if self.xid != other.xid: return False
2924 if self.flags != other.flags: return False
2925 if self.subtype != other.subtype: return False
2926 return True
2927
2928 def pretty_print(self, q):
2929 q.text("bsn_stats_request {")
2930 with q.group():
2931 with q.indent(2):
2932 q.breakable()
2933 q.text("xid = ");
2934 if self.xid != None:
2935 q.text("%#x" % self.xid)
2936 else:
2937 q.text('None')
2938 q.text(","); q.breakable()
2939 q.text("flags = ");
2940 q.text("%#x" % self.flags)
2941 q.breakable()
2942 q.text('}')
2943
2944experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2945
2946class bsn_virtual_port_create_reply(bsn_header):
2947 version = 3
2948 type = 4
2949 experimenter = 6035143
2950 subtype = 16
2951
2952 def __init__(self, xid=None, status=None, vport_no=None):
2953 if xid != None:
2954 self.xid = xid
2955 else:
2956 self.xid = None
2957 if status != None:
2958 self.status = status
2959 else:
2960 self.status = 0
2961 if vport_no != None:
2962 self.vport_no = vport_no
2963 else:
2964 self.vport_no = 0
2965 return
2966
2967 def pack(self):
2968 packed = []
2969 packed.append(struct.pack("!B", self.version))
2970 packed.append(struct.pack("!B", self.type))
2971 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2972 packed.append(struct.pack("!L", self.xid))
2973 packed.append(struct.pack("!L", self.experimenter))
2974 packed.append(struct.pack("!L", self.subtype))
2975 packed.append(struct.pack("!L", self.status))
2976 packed.append(struct.pack("!L", self.vport_no))
2977 length = sum([len(x) for x in packed])
2978 packed[2] = struct.pack("!H", length)
2979 return ''.join(packed)
2980
2981 @staticmethod
2982 def unpack(reader):
2983 obj = bsn_virtual_port_create_reply()
2984 _version = reader.read("!B")[0]
2985 assert(_version == 3)
2986 _type = reader.read("!B")[0]
2987 assert(_type == 4)
2988 _length = reader.read("!H")[0]
2989 orig_reader = reader
2990 reader = orig_reader.slice(_length, 4)
2991 obj.xid = reader.read("!L")[0]
2992 _experimenter = reader.read("!L")[0]
2993 assert(_experimenter == 6035143)
2994 _subtype = reader.read("!L")[0]
2995 assert(_subtype == 16)
2996 obj.status = reader.read("!L")[0]
2997 obj.vport_no = reader.read("!L")[0]
2998 return obj
2999
3000 def __eq__(self, other):
3001 if type(self) != type(other): return False
3002 if self.xid != other.xid: return False
3003 if self.status != other.status: return False
3004 if self.vport_no != other.vport_no: return False
3005 return True
3006
3007 def pretty_print(self, q):
3008 q.text("bsn_virtual_port_create_reply {")
3009 with q.group():
3010 with q.indent(2):
3011 q.breakable()
3012 q.text("xid = ");
3013 if self.xid != None:
3014 q.text("%#x" % self.xid)
3015 else:
3016 q.text('None')
3017 q.text(","); q.breakable()
3018 q.text("status = ");
3019 q.text("%#x" % self.status)
3020 q.text(","); q.breakable()
3021 q.text("vport_no = ");
3022 q.text("%#x" % self.vport_no)
3023 q.breakable()
3024 q.text('}')
3025
3026bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3027
3028class bsn_virtual_port_create_request(bsn_header):
3029 version = 3
3030 type = 4
3031 experimenter = 6035143
3032 subtype = 15
3033
3034 def __init__(self, xid=None, vport=None):
3035 if xid != None:
3036 self.xid = xid
3037 else:
3038 self.xid = None
3039 if vport != None:
3040 self.vport = vport
3041 else:
3042 self.vport = ofp.bsn_vport()
3043 return
3044
3045 def pack(self):
3046 packed = []
3047 packed.append(struct.pack("!B", self.version))
3048 packed.append(struct.pack("!B", self.type))
3049 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3050 packed.append(struct.pack("!L", self.xid))
3051 packed.append(struct.pack("!L", self.experimenter))
3052 packed.append(struct.pack("!L", self.subtype))
3053 packed.append(self.vport.pack())
3054 length = sum([len(x) for x in packed])
3055 packed[2] = struct.pack("!H", length)
3056 return ''.join(packed)
3057
3058 @staticmethod
3059 def unpack(reader):
3060 obj = bsn_virtual_port_create_request()
3061 _version = reader.read("!B")[0]
3062 assert(_version == 3)
3063 _type = reader.read("!B")[0]
3064 assert(_type == 4)
3065 _length = reader.read("!H")[0]
3066 orig_reader = reader
3067 reader = orig_reader.slice(_length, 4)
3068 obj.xid = reader.read("!L")[0]
3069 _experimenter = reader.read("!L")[0]
3070 assert(_experimenter == 6035143)
3071 _subtype = reader.read("!L")[0]
3072 assert(_subtype == 15)
3073 obj.vport = ofp.bsn_vport.unpack(reader)
3074 return obj
3075
3076 def __eq__(self, other):
3077 if type(self) != type(other): return False
3078 if self.xid != other.xid: return False
3079 if self.vport != other.vport: return False
3080 return True
3081
3082 def pretty_print(self, q):
3083 q.text("bsn_virtual_port_create_request {")
3084 with q.group():
3085 with q.indent(2):
3086 q.breakable()
3087 q.text("xid = ");
3088 if self.xid != None:
3089 q.text("%#x" % self.xid)
3090 else:
3091 q.text('None')
3092 q.text(","); q.breakable()
3093 q.text("vport = ");
3094 q.pp(self.vport)
3095 q.breakable()
3096 q.text('}')
3097
3098bsn_header.subtypes[15] = bsn_virtual_port_create_request
3099
3100class bsn_virtual_port_remove_reply(bsn_header):
3101 version = 3
3102 type = 4
3103 experimenter = 6035143
3104 subtype = 26
3105
3106 def __init__(self, xid=None, status=None):
3107 if xid != None:
3108 self.xid = xid
3109 else:
3110 self.xid = None
3111 if status != None:
3112 self.status = status
3113 else:
3114 self.status = 0
3115 return
3116
3117 def pack(self):
3118 packed = []
3119 packed.append(struct.pack("!B", self.version))
3120 packed.append(struct.pack("!B", self.type))
3121 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3122 packed.append(struct.pack("!L", self.xid))
3123 packed.append(struct.pack("!L", self.experimenter))
3124 packed.append(struct.pack("!L", self.subtype))
3125 packed.append(struct.pack("!L", self.status))
3126 length = sum([len(x) for x in packed])
3127 packed[2] = struct.pack("!H", length)
3128 return ''.join(packed)
3129
3130 @staticmethod
3131 def unpack(reader):
3132 obj = bsn_virtual_port_remove_reply()
3133 _version = reader.read("!B")[0]
3134 assert(_version == 3)
3135 _type = reader.read("!B")[0]
3136 assert(_type == 4)
3137 _length = reader.read("!H")[0]
3138 orig_reader = reader
3139 reader = orig_reader.slice(_length, 4)
3140 obj.xid = reader.read("!L")[0]
3141 _experimenter = reader.read("!L")[0]
3142 assert(_experimenter == 6035143)
3143 _subtype = reader.read("!L")[0]
3144 assert(_subtype == 26)
3145 obj.status = reader.read("!L")[0]
3146 return obj
3147
3148 def __eq__(self, other):
3149 if type(self) != type(other): return False
3150 if self.xid != other.xid: return False
3151 if self.status != other.status: return False
3152 return True
3153
3154 def pretty_print(self, q):
3155 q.text("bsn_virtual_port_remove_reply {")
3156 with q.group():
3157 with q.indent(2):
3158 q.breakable()
3159 q.text("xid = ");
3160 if self.xid != None:
3161 q.text("%#x" % self.xid)
3162 else:
3163 q.text('None')
3164 q.text(","); q.breakable()
3165 q.text("status = ");
3166 q.text("%#x" % self.status)
3167 q.breakable()
3168 q.text('}')
3169
3170bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3171
3172class bsn_virtual_port_remove_request(bsn_header):
3173 version = 3
3174 type = 4
3175 experimenter = 6035143
3176 subtype = 17
3177
3178 def __init__(self, xid=None, vport_no=None):
3179 if xid != None:
3180 self.xid = xid
3181 else:
3182 self.xid = None
3183 if vport_no != None:
3184 self.vport_no = vport_no
3185 else:
3186 self.vport_no = 0
3187 return
3188
3189 def pack(self):
3190 packed = []
3191 packed.append(struct.pack("!B", self.version))
3192 packed.append(struct.pack("!B", self.type))
3193 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3194 packed.append(struct.pack("!L", self.xid))
3195 packed.append(struct.pack("!L", self.experimenter))
3196 packed.append(struct.pack("!L", self.subtype))
3197 packed.append(struct.pack("!L", self.vport_no))
3198 length = sum([len(x) for x in packed])
3199 packed[2] = struct.pack("!H", length)
3200 return ''.join(packed)
3201
3202 @staticmethod
3203 def unpack(reader):
3204 obj = bsn_virtual_port_remove_request()
3205 _version = reader.read("!B")[0]
3206 assert(_version == 3)
3207 _type = reader.read("!B")[0]
3208 assert(_type == 4)
3209 _length = reader.read("!H")[0]
3210 orig_reader = reader
3211 reader = orig_reader.slice(_length, 4)
3212 obj.xid = reader.read("!L")[0]
3213 _experimenter = reader.read("!L")[0]
3214 assert(_experimenter == 6035143)
3215 _subtype = reader.read("!L")[0]
3216 assert(_subtype == 17)
3217 obj.vport_no = reader.read("!L")[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.vport_no != other.vport_no: return False
3224 return True
3225
3226 def pretty_print(self, q):
3227 q.text("bsn_virtual_port_remove_request {")
3228 with q.group():
3229 with q.indent(2):
3230 q.breakable()
3231 q.text("xid = ");
3232 if self.xid != None:
3233 q.text("%#x" % self.xid)
3234 else:
3235 q.text('None')
3236 q.text(","); q.breakable()
3237 q.text("vport_no = ");
3238 q.text("%#x" % self.vport_no)
3239 q.breakable()
3240 q.text('}')
3241
3242bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3243
3244class desc_stats_reply(stats_reply):
3245 version = 3
3246 type = 19
3247 stats_type = 0
3248
3249 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
3250 if xid != None:
3251 self.xid = xid
3252 else:
3253 self.xid = None
3254 if flags != None:
3255 self.flags = flags
3256 else:
3257 self.flags = 0
3258 if mfr_desc != None:
3259 self.mfr_desc = mfr_desc
3260 else:
3261 self.mfr_desc = ""
3262 if hw_desc != None:
3263 self.hw_desc = hw_desc
3264 else:
3265 self.hw_desc = ""
3266 if sw_desc != None:
3267 self.sw_desc = sw_desc
3268 else:
3269 self.sw_desc = ""
3270 if serial_num != None:
3271 self.serial_num = serial_num
3272 else:
3273 self.serial_num = ""
3274 if dp_desc != None:
3275 self.dp_desc = dp_desc
3276 else:
3277 self.dp_desc = ""
3278 return
3279
3280 def pack(self):
3281 packed = []
3282 packed.append(struct.pack("!B", self.version))
3283 packed.append(struct.pack("!B", self.type))
3284 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3285 packed.append(struct.pack("!L", self.xid))
3286 packed.append(struct.pack("!H", self.stats_type))
3287 packed.append(struct.pack("!H", self.flags))
3288 packed.append('\x00' * 4)
3289 packed.append(struct.pack("!256s", self.mfr_desc))
3290 packed.append(struct.pack("!256s", self.hw_desc))
3291 packed.append(struct.pack("!256s", self.sw_desc))
3292 packed.append(struct.pack("!32s", self.serial_num))
3293 packed.append(struct.pack("!256s", self.dp_desc))
3294 length = sum([len(x) for x in packed])
3295 packed[2] = struct.pack("!H", length)
3296 return ''.join(packed)
3297
3298 @staticmethod
3299 def unpack(reader):
3300 obj = desc_stats_reply()
3301 _version = reader.read("!B")[0]
3302 assert(_version == 3)
3303 _type = reader.read("!B")[0]
3304 assert(_type == 19)
3305 _length = reader.read("!H")[0]
3306 orig_reader = reader
3307 reader = orig_reader.slice(_length, 4)
3308 obj.xid = reader.read("!L")[0]
3309 _stats_type = reader.read("!H")[0]
3310 assert(_stats_type == 0)
3311 obj.flags = reader.read("!H")[0]
3312 reader.skip(4)
3313 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
3314 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
3315 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
3316 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
3317 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
3318 return obj
3319
3320 def __eq__(self, other):
3321 if type(self) != type(other): return False
3322 if self.xid != other.xid: return False
3323 if self.flags != other.flags: return False
3324 if self.mfr_desc != other.mfr_desc: return False
3325 if self.hw_desc != other.hw_desc: return False
3326 if self.sw_desc != other.sw_desc: return False
3327 if self.serial_num != other.serial_num: return False
3328 if self.dp_desc != other.dp_desc: return False
3329 return True
3330
3331 def pretty_print(self, q):
3332 q.text("desc_stats_reply {")
3333 with q.group():
3334 with q.indent(2):
3335 q.breakable()
3336 q.text("xid = ");
3337 if self.xid != None:
3338 q.text("%#x" % self.xid)
3339 else:
3340 q.text('None')
3341 q.text(","); q.breakable()
3342 q.text("flags = ");
3343 q.text("%#x" % self.flags)
3344 q.text(","); q.breakable()
3345 q.text("mfr_desc = ");
3346 q.pp(self.mfr_desc)
3347 q.text(","); q.breakable()
3348 q.text("hw_desc = ");
3349 q.pp(self.hw_desc)
3350 q.text(","); q.breakable()
3351 q.text("sw_desc = ");
3352 q.pp(self.sw_desc)
3353 q.text(","); q.breakable()
3354 q.text("serial_num = ");
3355 q.pp(self.serial_num)
3356 q.text(","); q.breakable()
3357 q.text("dp_desc = ");
3358 q.pp(self.dp_desc)
3359 q.breakable()
3360 q.text('}')
3361
3362stats_reply.subtypes[0] = desc_stats_reply
3363
3364class desc_stats_request(stats_request):
3365 version = 3
3366 type = 18
3367 stats_type = 0
3368
3369 def __init__(self, xid=None, flags=None):
3370 if xid != None:
3371 self.xid = xid
3372 else:
3373 self.xid = None
3374 if flags != None:
3375 self.flags = flags
3376 else:
3377 self.flags = 0
3378 return
3379
3380 def pack(self):
3381 packed = []
3382 packed.append(struct.pack("!B", self.version))
3383 packed.append(struct.pack("!B", self.type))
3384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3385 packed.append(struct.pack("!L", self.xid))
3386 packed.append(struct.pack("!H", self.stats_type))
3387 packed.append(struct.pack("!H", self.flags))
3388 packed.append('\x00' * 4)
3389 length = sum([len(x) for x in packed])
3390 packed[2] = struct.pack("!H", length)
3391 return ''.join(packed)
3392
3393 @staticmethod
3394 def unpack(reader):
3395 obj = desc_stats_request()
3396 _version = reader.read("!B")[0]
3397 assert(_version == 3)
3398 _type = reader.read("!B")[0]
3399 assert(_type == 18)
3400 _length = reader.read("!H")[0]
3401 orig_reader = reader
3402 reader = orig_reader.slice(_length, 4)
3403 obj.xid = reader.read("!L")[0]
3404 _stats_type = reader.read("!H")[0]
3405 assert(_stats_type == 0)
3406 obj.flags = reader.read("!H")[0]
3407 reader.skip(4)
3408 return obj
3409
3410 def __eq__(self, other):
3411 if type(self) != type(other): return False
3412 if self.xid != other.xid: return False
3413 if self.flags != other.flags: return False
3414 return True
3415
3416 def pretty_print(self, q):
3417 q.text("desc_stats_request {")
3418 with q.group():
3419 with q.indent(2):
3420 q.breakable()
3421 q.text("xid = ");
3422 if self.xid != None:
3423 q.text("%#x" % self.xid)
3424 else:
3425 q.text('None')
3426 q.text(","); q.breakable()
3427 q.text("flags = ");
3428 q.text("%#x" % self.flags)
3429 q.breakable()
3430 q.text('}')
3431
3432stats_request.subtypes[0] = desc_stats_request
3433
3434class echo_reply(message):
3435 version = 3
3436 type = 3
3437
3438 def __init__(self, xid=None, data=None):
3439 if xid != None:
3440 self.xid = xid
3441 else:
3442 self.xid = None
3443 if data != None:
3444 self.data = data
3445 else:
3446 self.data = ''
3447 return
3448
3449 def pack(self):
3450 packed = []
3451 packed.append(struct.pack("!B", self.version))
3452 packed.append(struct.pack("!B", self.type))
3453 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3454 packed.append(struct.pack("!L", self.xid))
3455 packed.append(self.data)
3456 length = sum([len(x) for x in packed])
3457 packed[2] = struct.pack("!H", length)
3458 return ''.join(packed)
3459
3460 @staticmethod
3461 def unpack(reader):
3462 obj = echo_reply()
3463 _version = reader.read("!B")[0]
3464 assert(_version == 3)
3465 _type = reader.read("!B")[0]
3466 assert(_type == 3)
3467 _length = reader.read("!H")[0]
3468 orig_reader = reader
3469 reader = orig_reader.slice(_length, 4)
3470 obj.xid = reader.read("!L")[0]
3471 obj.data = str(reader.read_all())
3472 return obj
3473
3474 def __eq__(self, other):
3475 if type(self) != type(other): return False
3476 if self.xid != other.xid: return False
3477 if self.data != other.data: return False
3478 return True
3479
3480 def pretty_print(self, q):
3481 q.text("echo_reply {")
3482 with q.group():
3483 with q.indent(2):
3484 q.breakable()
3485 q.text("xid = ");
3486 if self.xid != None:
3487 q.text("%#x" % self.xid)
3488 else:
3489 q.text('None')
3490 q.text(","); q.breakable()
3491 q.text("data = ");
3492 q.pp(self.data)
3493 q.breakable()
3494 q.text('}')
3495
3496message.subtypes[3] = echo_reply
3497
3498class echo_request(message):
3499 version = 3
3500 type = 2
3501
3502 def __init__(self, xid=None, data=None):
3503 if xid != None:
3504 self.xid = xid
3505 else:
3506 self.xid = None
3507 if data != None:
3508 self.data = data
3509 else:
3510 self.data = ''
3511 return
3512
3513 def pack(self):
3514 packed = []
3515 packed.append(struct.pack("!B", self.version))
3516 packed.append(struct.pack("!B", self.type))
3517 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3518 packed.append(struct.pack("!L", self.xid))
3519 packed.append(self.data)
3520 length = sum([len(x) for x in packed])
3521 packed[2] = struct.pack("!H", length)
3522 return ''.join(packed)
3523
3524 @staticmethod
3525 def unpack(reader):
3526 obj = echo_request()
3527 _version = reader.read("!B")[0]
3528 assert(_version == 3)
3529 _type = reader.read("!B")[0]
3530 assert(_type == 2)
3531 _length = reader.read("!H")[0]
3532 orig_reader = reader
3533 reader = orig_reader.slice(_length, 4)
3534 obj.xid = reader.read("!L")[0]
3535 obj.data = str(reader.read_all())
3536 return obj
3537
3538 def __eq__(self, other):
3539 if type(self) != type(other): return False
3540 if self.xid != other.xid: return False
3541 if self.data != other.data: return False
3542 return True
3543
3544 def pretty_print(self, q):
3545 q.text("echo_request {")
3546 with q.group():
3547 with q.indent(2):
3548 q.breakable()
3549 q.text("xid = ");
3550 if self.xid != None:
3551 q.text("%#x" % self.xid)
3552 else:
3553 q.text('None')
3554 q.text(","); q.breakable()
3555 q.text("data = ");
3556 q.pp(self.data)
3557 q.breakable()
3558 q.text('}')
3559
3560message.subtypes[2] = echo_request
3561
3562class experimenter_error_msg(error_msg):
3563 subtypes = {}
3564
3565 version = 3
3566 type = 1
3567 err_type = 65535
3568
3569 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
3570 if xid != None:
3571 self.xid = xid
3572 else:
3573 self.xid = None
3574 if subtype != None:
3575 self.subtype = subtype
3576 else:
3577 self.subtype = 0
3578 if experimenter != None:
3579 self.experimenter = experimenter
3580 else:
3581 self.experimenter = 0
3582 if data != None:
3583 self.data = data
3584 else:
3585 self.data = ''
3586 return
3587
3588 def pack(self):
3589 packed = []
3590 packed.append(struct.pack("!B", self.version))
3591 packed.append(struct.pack("!B", self.type))
3592 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3593 packed.append(struct.pack("!L", self.xid))
3594 packed.append(struct.pack("!H", self.err_type))
3595 packed.append(struct.pack("!H", self.subtype))
3596 packed.append(struct.pack("!L", self.experimenter))
3597 packed.append(self.data)
3598 length = sum([len(x) for x in packed])
3599 packed[2] = struct.pack("!H", length)
3600 return ''.join(packed)
3601
3602 @staticmethod
3603 def unpack(reader):
3604 subtype, = reader.peek('!L', 12)
3605 subclass = experimenter_error_msg.subtypes.get(subtype)
3606 if subclass:
3607 return subclass.unpack(reader)
3608
3609 obj = experimenter_error_msg()
3610 _version = reader.read("!B")[0]
3611 assert(_version == 3)
3612 _type = reader.read("!B")[0]
3613 assert(_type == 1)
3614 _length = reader.read("!H")[0]
3615 orig_reader = reader
3616 reader = orig_reader.slice(_length, 4)
3617 obj.xid = reader.read("!L")[0]
3618 _err_type = reader.read("!H")[0]
3619 assert(_err_type == 65535)
3620 obj.subtype = reader.read("!H")[0]
3621 obj.experimenter = reader.read("!L")[0]
3622 obj.data = str(reader.read_all())
3623 return obj
3624
3625 def __eq__(self, other):
3626 if type(self) != type(other): return False
3627 if self.xid != other.xid: return False
3628 if self.subtype != other.subtype: return False
3629 if self.experimenter != other.experimenter: return False
3630 if self.data != other.data: return False
3631 return True
3632
3633 def pretty_print(self, q):
3634 q.text("experimenter_error_msg {")
3635 with q.group():
3636 with q.indent(2):
3637 q.breakable()
3638 q.text("xid = ");
3639 if self.xid != None:
3640 q.text("%#x" % self.xid)
3641 else:
3642 q.text('None')
3643 q.text(","); q.breakable()
3644 q.text("subtype = ");
3645 q.text("%#x" % self.subtype)
3646 q.text(","); q.breakable()
3647 q.text("data = ");
3648 q.pp(self.data)
3649 q.breakable()
3650 q.text('}')
3651
3652error_msg.subtypes[65535] = experimenter_error_msg
3653
3654class features_reply(message):
3655 version = 3
3656 type = 6
3657
3658 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None):
3659 if xid != None:
3660 self.xid = xid
3661 else:
3662 self.xid = None
3663 if datapath_id != None:
3664 self.datapath_id = datapath_id
3665 else:
3666 self.datapath_id = 0
3667 if n_buffers != None:
3668 self.n_buffers = n_buffers
3669 else:
3670 self.n_buffers = 0
3671 if n_tables != None:
3672 self.n_tables = n_tables
3673 else:
3674 self.n_tables = 0
3675 if capabilities != None:
3676 self.capabilities = capabilities
3677 else:
3678 self.capabilities = 0
3679 if reserved != None:
3680 self.reserved = reserved
3681 else:
3682 self.reserved = 0
3683 if ports != None:
3684 self.ports = ports
3685 else:
3686 self.ports = []
3687 return
3688
3689 def pack(self):
3690 packed = []
3691 packed.append(struct.pack("!B", self.version))
3692 packed.append(struct.pack("!B", self.type))
3693 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3694 packed.append(struct.pack("!L", self.xid))
3695 packed.append(struct.pack("!Q", self.datapath_id))
3696 packed.append(struct.pack("!L", self.n_buffers))
3697 packed.append(struct.pack("!B", self.n_tables))
3698 packed.append('\x00' * 3)
3699 packed.append(struct.pack("!L", self.capabilities))
3700 packed.append(struct.pack("!L", self.reserved))
3701 packed.append(loxi.generic_util.pack_list(self.ports))
3702 length = sum([len(x) for x in packed])
3703 packed[2] = struct.pack("!H", length)
3704 return ''.join(packed)
3705
3706 @staticmethod
3707 def unpack(reader):
3708 obj = features_reply()
3709 _version = reader.read("!B")[0]
3710 assert(_version == 3)
3711 _type = reader.read("!B")[0]
3712 assert(_type == 6)
3713 _length = reader.read("!H")[0]
3714 orig_reader = reader
3715 reader = orig_reader.slice(_length, 4)
3716 obj.xid = reader.read("!L")[0]
3717 obj.datapath_id = reader.read("!Q")[0]
3718 obj.n_buffers = reader.read("!L")[0]
3719 obj.n_tables = reader.read("!B")[0]
3720 reader.skip(3)
3721 obj.capabilities = reader.read("!L")[0]
3722 obj.reserved = reader.read("!L")[0]
3723 obj.ports = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
3724 return obj
3725
3726 def __eq__(self, other):
3727 if type(self) != type(other): return False
3728 if self.xid != other.xid: return False
3729 if self.datapath_id != other.datapath_id: return False
3730 if self.n_buffers != other.n_buffers: return False
3731 if self.n_tables != other.n_tables: return False
3732 if self.capabilities != other.capabilities: return False
3733 if self.reserved != other.reserved: return False
3734 if self.ports != other.ports: return False
3735 return True
3736
3737 def pretty_print(self, q):
3738 q.text("features_reply {")
3739 with q.group():
3740 with q.indent(2):
3741 q.breakable()
3742 q.text("xid = ");
3743 if self.xid != None:
3744 q.text("%#x" % self.xid)
3745 else:
3746 q.text('None')
3747 q.text(","); q.breakable()
3748 q.text("datapath_id = ");
3749 q.text("%#x" % self.datapath_id)
3750 q.text(","); q.breakable()
3751 q.text("n_buffers = ");
3752 q.text("%#x" % self.n_buffers)
3753 q.text(","); q.breakable()
3754 q.text("n_tables = ");
3755 q.text("%#x" % self.n_tables)
3756 q.text(","); q.breakable()
3757 q.text("capabilities = ");
3758 q.text("%#x" % self.capabilities)
3759 q.text(","); q.breakable()
3760 q.text("reserved = ");
3761 q.text("%#x" % self.reserved)
3762 q.text(","); q.breakable()
3763 q.text("ports = ");
3764 q.pp(self.ports)
3765 q.breakable()
3766 q.text('}')
3767
3768message.subtypes[6] = features_reply
3769
3770class features_request(message):
3771 version = 3
3772 type = 5
3773
3774 def __init__(self, xid=None):
3775 if xid != None:
3776 self.xid = xid
3777 else:
3778 self.xid = None
3779 return
3780
3781 def pack(self):
3782 packed = []
3783 packed.append(struct.pack("!B", self.version))
3784 packed.append(struct.pack("!B", self.type))
3785 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3786 packed.append(struct.pack("!L", self.xid))
3787 length = sum([len(x) for x in packed])
3788 packed[2] = struct.pack("!H", length)
3789 return ''.join(packed)
3790
3791 @staticmethod
3792 def unpack(reader):
3793 obj = features_request()
3794 _version = reader.read("!B")[0]
3795 assert(_version == 3)
3796 _type = reader.read("!B")[0]
3797 assert(_type == 5)
3798 _length = reader.read("!H")[0]
3799 orig_reader = reader
3800 reader = orig_reader.slice(_length, 4)
3801 obj.xid = reader.read("!L")[0]
3802 return obj
3803
3804 def __eq__(self, other):
3805 if type(self) != type(other): return False
3806 if self.xid != other.xid: return False
3807 return True
3808
3809 def pretty_print(self, q):
3810 q.text("features_request {")
3811 with q.group():
3812 with q.indent(2):
3813 q.breakable()
3814 q.text("xid = ");
3815 if self.xid != None:
3816 q.text("%#x" % self.xid)
3817 else:
3818 q.text('None')
3819 q.breakable()
3820 q.text('}')
3821
3822message.subtypes[5] = features_request
3823
3824class flow_mod(message):
3825 subtypes = {}
3826
3827 version = 3
3828 type = 14
3829
3830 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):
3831 if xid != None:
3832 self.xid = xid
3833 else:
3834 self.xid = None
3835 if cookie != None:
3836 self.cookie = cookie
3837 else:
3838 self.cookie = 0
3839 if cookie_mask != None:
3840 self.cookie_mask = cookie_mask
3841 else:
3842 self.cookie_mask = 0
3843 if table_id != None:
3844 self.table_id = table_id
3845 else:
3846 self.table_id = 0
3847 if _command != None:
3848 self._command = _command
3849 else:
3850 self._command = 0
3851 if idle_timeout != None:
3852 self.idle_timeout = idle_timeout
3853 else:
3854 self.idle_timeout = 0
3855 if hard_timeout != None:
3856 self.hard_timeout = hard_timeout
3857 else:
3858 self.hard_timeout = 0
3859 if priority != None:
3860 self.priority = priority
3861 else:
3862 self.priority = 0
3863 if buffer_id != None:
3864 self.buffer_id = buffer_id
3865 else:
3866 self.buffer_id = 0
3867 if out_port != None:
3868 self.out_port = out_port
3869 else:
3870 self.out_port = 0
3871 if out_group != None:
3872 self.out_group = out_group
3873 else:
3874 self.out_group = 0
3875 if flags != None:
3876 self.flags = flags
3877 else:
3878 self.flags = 0
3879 if match != None:
3880 self.match = match
3881 else:
3882 self.match = ofp.match()
3883 if instructions != None:
3884 self.instructions = instructions
3885 else:
3886 self.instructions = []
3887 return
3888
3889 def pack(self):
3890 packed = []
3891 packed.append(struct.pack("!B", self.version))
3892 packed.append(struct.pack("!B", self.type))
3893 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3894 packed.append(struct.pack("!L", self.xid))
3895 packed.append(struct.pack("!Q", self.cookie))
3896 packed.append(struct.pack("!Q", self.cookie_mask))
3897 packed.append(struct.pack("!B", self.table_id))
3898 packed.append(util.pack_fm_cmd(self._command))
3899 packed.append(struct.pack("!H", self.idle_timeout))
3900 packed.append(struct.pack("!H", self.hard_timeout))
3901 packed.append(struct.pack("!H", self.priority))
3902 packed.append(struct.pack("!L", self.buffer_id))
3903 packed.append(util.pack_port_no(self.out_port))
3904 packed.append(struct.pack("!L", self.out_group))
3905 packed.append(struct.pack("!H", self.flags))
3906 packed.append('\x00' * 2)
3907 packed.append(self.match.pack())
3908 packed.append(loxi.generic_util.pack_list(self.instructions))
3909 length = sum([len(x) for x in packed])
3910 packed[2] = struct.pack("!H", length)
3911 return ''.join(packed)
3912
3913 @staticmethod
3914 def unpack(reader):
3915 subtype, = reader.peek('B', 25)
3916 subclass = flow_mod.subtypes.get(subtype)
3917 if subclass:
3918 return subclass.unpack(reader)
3919
3920 obj = flow_mod()
3921 _version = reader.read("!B")[0]
3922 assert(_version == 3)
3923 _type = reader.read("!B")[0]
3924 assert(_type == 14)
3925 _length = reader.read("!H")[0]
3926 orig_reader = reader
3927 reader = orig_reader.slice(_length, 4)
3928 obj.xid = reader.read("!L")[0]
3929 obj.cookie = reader.read("!Q")[0]
3930 obj.cookie_mask = reader.read("!Q")[0]
3931 obj.table_id = reader.read("!B")[0]
3932 obj._command = util.unpack_fm_cmd(reader)
3933 obj.idle_timeout = reader.read("!H")[0]
3934 obj.hard_timeout = reader.read("!H")[0]
3935 obj.priority = reader.read("!H")[0]
3936 obj.buffer_id = reader.read("!L")[0]
3937 obj.out_port = util.unpack_port_no(reader)
3938 obj.out_group = reader.read("!L")[0]
3939 obj.flags = reader.read("!H")[0]
3940 reader.skip(2)
3941 obj.match = ofp.match.unpack(reader)
3942 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
3943 return obj
3944
3945 def __eq__(self, other):
3946 if type(self) != type(other): return False
3947 if self.xid != other.xid: return False
3948 if self.cookie != other.cookie: return False
3949 if self.cookie_mask != other.cookie_mask: return False
3950 if self.table_id != other.table_id: return False
3951 if self._command != other._command: return False
3952 if self.idle_timeout != other.idle_timeout: return False
3953 if self.hard_timeout != other.hard_timeout: return False
3954 if self.priority != other.priority: return False
3955 if self.buffer_id != other.buffer_id: return False
3956 if self.out_port != other.out_port: return False
3957 if self.out_group != other.out_group: return False
3958 if self.flags != other.flags: return False
3959 if self.match != other.match: return False
3960 if self.instructions != other.instructions: return False
3961 return True
3962
3963 def pretty_print(self, q):
3964 q.text("flow_mod {")
3965 with q.group():
3966 with q.indent(2):
3967 q.breakable()
3968 q.text("xid = ");
3969 if self.xid != None:
3970 q.text("%#x" % self.xid)
3971 else:
3972 q.text('None')
3973 q.text(","); q.breakable()
3974 q.text("cookie = ");
3975 q.text("%#x" % self.cookie)
3976 q.text(","); q.breakable()
3977 q.text("cookie_mask = ");
3978 q.text("%#x" % self.cookie_mask)
3979 q.text(","); q.breakable()
3980 q.text("table_id = ");
3981 q.text("%#x" % self.table_id)
3982 q.text(","); q.breakable()
3983 q.text("idle_timeout = ");
3984 q.text("%#x" % self.idle_timeout)
3985 q.text(","); q.breakable()
3986 q.text("hard_timeout = ");
3987 q.text("%#x" % self.hard_timeout)
3988 q.text(","); q.breakable()
3989 q.text("priority = ");
3990 q.text("%#x" % self.priority)
3991 q.text(","); q.breakable()
3992 q.text("buffer_id = ");
3993 q.text("%#x" % self.buffer_id)
3994 q.text(","); q.breakable()
3995 q.text("out_port = ");
3996 q.text(util.pretty_port(self.out_port))
3997 q.text(","); q.breakable()
3998 q.text("out_group = ");
3999 q.text("%#x" % self.out_group)
4000 q.text(","); q.breakable()
4001 q.text("flags = ");
4002 q.text("%#x" % self.flags)
4003 q.text(","); q.breakable()
4004 q.text("match = ");
4005 q.pp(self.match)
4006 q.text(","); q.breakable()
4007 q.text("instructions = ");
4008 q.pp(self.instructions)
4009 q.breakable()
4010 q.text('}')
4011
4012message.subtypes[14] = flow_mod
4013
4014class flow_add(flow_mod):
4015 version = 3
4016 type = 14
4017 _command = 0
4018
4019 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, match=None, instructions=None):
4020 if xid != None:
4021 self.xid = xid
4022 else:
4023 self.xid = None
4024 if cookie != None:
4025 self.cookie = cookie
4026 else:
4027 self.cookie = 0
4028 if cookie_mask != None:
4029 self.cookie_mask = cookie_mask
4030 else:
4031 self.cookie_mask = 0
4032 if table_id != None:
4033 self.table_id = table_id
4034 else:
4035 self.table_id = 0
4036 if idle_timeout != None:
4037 self.idle_timeout = idle_timeout
4038 else:
4039 self.idle_timeout = 0
4040 if hard_timeout != None:
4041 self.hard_timeout = hard_timeout
4042 else:
4043 self.hard_timeout = 0
4044 if priority != None:
4045 self.priority = priority
4046 else:
4047 self.priority = 0
4048 if buffer_id != None:
4049 self.buffer_id = buffer_id
4050 else:
4051 self.buffer_id = 0
4052 if out_port != None:
4053 self.out_port = out_port
4054 else:
4055 self.out_port = 0
4056 if out_group != None:
4057 self.out_group = out_group
4058 else:
4059 self.out_group = 0
4060 if flags != None:
4061 self.flags = flags
4062 else:
4063 self.flags = 0
4064 if match != None:
4065 self.match = match
4066 else:
4067 self.match = ofp.match()
4068 if instructions != None:
4069 self.instructions = instructions
4070 else:
4071 self.instructions = []
4072 return
4073
4074 def pack(self):
4075 packed = []
4076 packed.append(struct.pack("!B", self.version))
4077 packed.append(struct.pack("!B", self.type))
4078 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4079 packed.append(struct.pack("!L", self.xid))
4080 packed.append(struct.pack("!Q", self.cookie))
4081 packed.append(struct.pack("!Q", self.cookie_mask))
4082 packed.append(struct.pack("!B", self.table_id))
4083 packed.append(util.pack_fm_cmd(self._command))
4084 packed.append(struct.pack("!H", self.idle_timeout))
4085 packed.append(struct.pack("!H", self.hard_timeout))
4086 packed.append(struct.pack("!H", self.priority))
4087 packed.append(struct.pack("!L", self.buffer_id))
4088 packed.append(util.pack_port_no(self.out_port))
4089 packed.append(struct.pack("!L", self.out_group))
4090 packed.append(struct.pack("!H", self.flags))
4091 packed.append('\x00' * 2)
4092 packed.append(self.match.pack())
4093 packed.append(loxi.generic_util.pack_list(self.instructions))
4094 length = sum([len(x) for x in packed])
4095 packed[2] = struct.pack("!H", length)
4096 return ''.join(packed)
4097
4098 @staticmethod
4099 def unpack(reader):
4100 obj = flow_add()
4101 _version = reader.read("!B")[0]
4102 assert(_version == 3)
4103 _type = reader.read("!B")[0]
4104 assert(_type == 14)
4105 _length = reader.read("!H")[0]
4106 orig_reader = reader
4107 reader = orig_reader.slice(_length, 4)
4108 obj.xid = reader.read("!L")[0]
4109 obj.cookie = reader.read("!Q")[0]
4110 obj.cookie_mask = reader.read("!Q")[0]
4111 obj.table_id = reader.read("!B")[0]
4112 __command = util.unpack_fm_cmd(reader)
4113 assert(__command == 0)
4114 obj.idle_timeout = reader.read("!H")[0]
4115 obj.hard_timeout = reader.read("!H")[0]
4116 obj.priority = reader.read("!H")[0]
4117 obj.buffer_id = reader.read("!L")[0]
4118 obj.out_port = util.unpack_port_no(reader)
4119 obj.out_group = reader.read("!L")[0]
4120 obj.flags = reader.read("!H")[0]
4121 reader.skip(2)
4122 obj.match = ofp.match.unpack(reader)
4123 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
4124 return obj
4125
4126 def __eq__(self, other):
4127 if type(self) != type(other): return False
4128 if self.xid != other.xid: return False
4129 if self.cookie != other.cookie: return False
4130 if self.cookie_mask != other.cookie_mask: return False
4131 if self.table_id != other.table_id: return False
4132 if self.idle_timeout != other.idle_timeout: return False
4133 if self.hard_timeout != other.hard_timeout: return False
4134 if self.priority != other.priority: return False
4135 if self.buffer_id != other.buffer_id: return False
4136 if self.out_port != other.out_port: return False
4137 if self.out_group != other.out_group: return False
4138 if self.flags != other.flags: return False
4139 if self.match != other.match: return False
4140 if self.instructions != other.instructions: return False
4141 return True
4142
4143 def pretty_print(self, q):
4144 q.text("flow_add {")
4145 with q.group():
4146 with q.indent(2):
4147 q.breakable()
4148 q.text("xid = ");
4149 if self.xid != None:
4150 q.text("%#x" % self.xid)
4151 else:
4152 q.text('None')
4153 q.text(","); q.breakable()
4154 q.text("cookie = ");
4155 q.text("%#x" % self.cookie)
4156 q.text(","); q.breakable()
4157 q.text("cookie_mask = ");
4158 q.text("%#x" % self.cookie_mask)
4159 q.text(","); q.breakable()
4160 q.text("table_id = ");
4161 q.text("%#x" % self.table_id)
4162 q.text(","); q.breakable()
4163 q.text("idle_timeout = ");
4164 q.text("%#x" % self.idle_timeout)
4165 q.text(","); q.breakable()
4166 q.text("hard_timeout = ");
4167 q.text("%#x" % self.hard_timeout)
4168 q.text(","); q.breakable()
4169 q.text("priority = ");
4170 q.text("%#x" % self.priority)
4171 q.text(","); q.breakable()
4172 q.text("buffer_id = ");
4173 q.text("%#x" % self.buffer_id)
4174 q.text(","); q.breakable()
4175 q.text("out_port = ");
4176 q.text(util.pretty_port(self.out_port))
4177 q.text(","); q.breakable()
4178 q.text("out_group = ");
4179 q.text("%#x" % self.out_group)
4180 q.text(","); q.breakable()
4181 q.text("flags = ");
4182 q.text("%#x" % self.flags)
4183 q.text(","); q.breakable()
4184 q.text("match = ");
4185 q.pp(self.match)
4186 q.text(","); q.breakable()
4187 q.text("instructions = ");
4188 q.pp(self.instructions)
4189 q.breakable()
4190 q.text('}')
4191
4192flow_mod.subtypes[0] = flow_add
4193
4194class flow_delete(flow_mod):
4195 version = 3
4196 type = 14
4197 _command = 3
4198
4199 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, match=None, instructions=None):
4200 if xid != None:
4201 self.xid = xid
4202 else:
4203 self.xid = None
4204 if cookie != None:
4205 self.cookie = cookie
4206 else:
4207 self.cookie = 0
4208 if cookie_mask != None:
4209 self.cookie_mask = cookie_mask
4210 else:
4211 self.cookie_mask = 0
4212 if table_id != None:
4213 self.table_id = table_id
4214 else:
4215 self.table_id = 0
4216 if idle_timeout != None:
4217 self.idle_timeout = idle_timeout
4218 else:
4219 self.idle_timeout = 0
4220 if hard_timeout != None:
4221 self.hard_timeout = hard_timeout
4222 else:
4223 self.hard_timeout = 0
4224 if priority != None:
4225 self.priority = priority
4226 else:
4227 self.priority = 0
4228 if buffer_id != None:
4229 self.buffer_id = buffer_id
4230 else:
4231 self.buffer_id = 0
4232 if out_port != None:
4233 self.out_port = out_port
4234 else:
4235 self.out_port = 0
4236 if out_group != None:
4237 self.out_group = out_group
4238 else:
4239 self.out_group = 0
4240 if flags != None:
4241 self.flags = flags
4242 else:
4243 self.flags = 0
4244 if match != None:
4245 self.match = match
4246 else:
4247 self.match = ofp.match()
4248 if instructions != None:
4249 self.instructions = instructions
4250 else:
4251 self.instructions = []
4252 return
4253
4254 def pack(self):
4255 packed = []
4256 packed.append(struct.pack("!B", self.version))
4257 packed.append(struct.pack("!B", self.type))
4258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4259 packed.append(struct.pack("!L", self.xid))
4260 packed.append(struct.pack("!Q", self.cookie))
4261 packed.append(struct.pack("!Q", self.cookie_mask))
4262 packed.append(struct.pack("!B", self.table_id))
4263 packed.append(util.pack_fm_cmd(self._command))
4264 packed.append(struct.pack("!H", self.idle_timeout))
4265 packed.append(struct.pack("!H", self.hard_timeout))
4266 packed.append(struct.pack("!H", self.priority))
4267 packed.append(struct.pack("!L", self.buffer_id))
4268 packed.append(util.pack_port_no(self.out_port))
4269 packed.append(struct.pack("!L", self.out_group))
4270 packed.append(struct.pack("!H", self.flags))
4271 packed.append('\x00' * 2)
4272 packed.append(self.match.pack())
4273 packed.append(loxi.generic_util.pack_list(self.instructions))
4274 length = sum([len(x) for x in packed])
4275 packed[2] = struct.pack("!H", length)
4276 return ''.join(packed)
4277
4278 @staticmethod
4279 def unpack(reader):
4280 obj = flow_delete()
4281 _version = reader.read("!B")[0]
4282 assert(_version == 3)
4283 _type = reader.read("!B")[0]
4284 assert(_type == 14)
4285 _length = reader.read("!H")[0]
4286 orig_reader = reader
4287 reader = orig_reader.slice(_length, 4)
4288 obj.xid = reader.read("!L")[0]
4289 obj.cookie = reader.read("!Q")[0]
4290 obj.cookie_mask = reader.read("!Q")[0]
4291 obj.table_id = reader.read("!B")[0]
4292 __command = util.unpack_fm_cmd(reader)
4293 assert(__command == 3)
4294 obj.idle_timeout = reader.read("!H")[0]
4295 obj.hard_timeout = reader.read("!H")[0]
4296 obj.priority = reader.read("!H")[0]
4297 obj.buffer_id = reader.read("!L")[0]
4298 obj.out_port = util.unpack_port_no(reader)
4299 obj.out_group = reader.read("!L")[0]
4300 obj.flags = reader.read("!H")[0]
4301 reader.skip(2)
4302 obj.match = ofp.match.unpack(reader)
4303 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
4304 return obj
4305
4306 def __eq__(self, other):
4307 if type(self) != type(other): return False
4308 if self.xid != other.xid: return False
4309 if self.cookie != other.cookie: return False
4310 if self.cookie_mask != other.cookie_mask: return False
4311 if self.table_id != other.table_id: return False
4312 if self.idle_timeout != other.idle_timeout: return False
4313 if self.hard_timeout != other.hard_timeout: return False
4314 if self.priority != other.priority: return False
4315 if self.buffer_id != other.buffer_id: return False
4316 if self.out_port != other.out_port: return False
4317 if self.out_group != other.out_group: return False
4318 if self.flags != other.flags: return False
4319 if self.match != other.match: return False
4320 if self.instructions != other.instructions: return False
4321 return True
4322
4323 def pretty_print(self, q):
4324 q.text("flow_delete {")
4325 with q.group():
4326 with q.indent(2):
4327 q.breakable()
4328 q.text("xid = ");
4329 if self.xid != None:
4330 q.text("%#x" % self.xid)
4331 else:
4332 q.text('None')
4333 q.text(","); q.breakable()
4334 q.text("cookie = ");
4335 q.text("%#x" % self.cookie)
4336 q.text(","); q.breakable()
4337 q.text("cookie_mask = ");
4338 q.text("%#x" % self.cookie_mask)
4339 q.text(","); q.breakable()
4340 q.text("table_id = ");
4341 q.text("%#x" % self.table_id)
4342 q.text(","); q.breakable()
4343 q.text("idle_timeout = ");
4344 q.text("%#x" % self.idle_timeout)
4345 q.text(","); q.breakable()
4346 q.text("hard_timeout = ");
4347 q.text("%#x" % self.hard_timeout)
4348 q.text(","); q.breakable()
4349 q.text("priority = ");
4350 q.text("%#x" % self.priority)
4351 q.text(","); q.breakable()
4352 q.text("buffer_id = ");
4353 q.text("%#x" % self.buffer_id)
4354 q.text(","); q.breakable()
4355 q.text("out_port = ");
4356 q.text(util.pretty_port(self.out_port))
4357 q.text(","); q.breakable()
4358 q.text("out_group = ");
4359 q.text("%#x" % self.out_group)
4360 q.text(","); q.breakable()
4361 q.text("flags = ");
4362 q.text("%#x" % self.flags)
4363 q.text(","); q.breakable()
4364 q.text("match = ");
4365 q.pp(self.match)
4366 q.text(","); q.breakable()
4367 q.text("instructions = ");
4368 q.pp(self.instructions)
4369 q.breakable()
4370 q.text('}')
4371
4372flow_mod.subtypes[3] = flow_delete
4373
4374class flow_delete_strict(flow_mod):
4375 version = 3
4376 type = 14
4377 _command = 4
4378
4379 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, match=None, instructions=None):
4380 if xid != None:
4381 self.xid = xid
4382 else:
4383 self.xid = None
4384 if cookie != None:
4385 self.cookie = cookie
4386 else:
4387 self.cookie = 0
4388 if cookie_mask != None:
4389 self.cookie_mask = cookie_mask
4390 else:
4391 self.cookie_mask = 0
4392 if table_id != None:
4393 self.table_id = table_id
4394 else:
4395 self.table_id = 0
4396 if idle_timeout != None:
4397 self.idle_timeout = idle_timeout
4398 else:
4399 self.idle_timeout = 0
4400 if hard_timeout != None:
4401 self.hard_timeout = hard_timeout
4402 else:
4403 self.hard_timeout = 0
4404 if priority != None:
4405 self.priority = priority
4406 else:
4407 self.priority = 0
4408 if buffer_id != None:
4409 self.buffer_id = buffer_id
4410 else:
4411 self.buffer_id = 0
4412 if out_port != None:
4413 self.out_port = out_port
4414 else:
4415 self.out_port = 0
4416 if out_group != None:
4417 self.out_group = out_group
4418 else:
4419 self.out_group = 0
4420 if flags != None:
4421 self.flags = flags
4422 else:
4423 self.flags = 0
4424 if match != None:
4425 self.match = match
4426 else:
4427 self.match = ofp.match()
4428 if instructions != None:
4429 self.instructions = instructions
4430 else:
4431 self.instructions = []
4432 return
4433
4434 def pack(self):
4435 packed = []
4436 packed.append(struct.pack("!B", self.version))
4437 packed.append(struct.pack("!B", self.type))
4438 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4439 packed.append(struct.pack("!L", self.xid))
4440 packed.append(struct.pack("!Q", self.cookie))
4441 packed.append(struct.pack("!Q", self.cookie_mask))
4442 packed.append(struct.pack("!B", self.table_id))
4443 packed.append(util.pack_fm_cmd(self._command))
4444 packed.append(struct.pack("!H", self.idle_timeout))
4445 packed.append(struct.pack("!H", self.hard_timeout))
4446 packed.append(struct.pack("!H", self.priority))
4447 packed.append(struct.pack("!L", self.buffer_id))
4448 packed.append(util.pack_port_no(self.out_port))
4449 packed.append(struct.pack("!L", self.out_group))
4450 packed.append(struct.pack("!H", self.flags))
4451 packed.append('\x00' * 2)
4452 packed.append(self.match.pack())
4453 packed.append(loxi.generic_util.pack_list(self.instructions))
4454 length = sum([len(x) for x in packed])
4455 packed[2] = struct.pack("!H", length)
4456 return ''.join(packed)
4457
4458 @staticmethod
4459 def unpack(reader):
4460 obj = flow_delete_strict()
4461 _version = reader.read("!B")[0]
4462 assert(_version == 3)
4463 _type = reader.read("!B")[0]
4464 assert(_type == 14)
4465 _length = reader.read("!H")[0]
4466 orig_reader = reader
4467 reader = orig_reader.slice(_length, 4)
4468 obj.xid = reader.read("!L")[0]
4469 obj.cookie = reader.read("!Q")[0]
4470 obj.cookie_mask = reader.read("!Q")[0]
4471 obj.table_id = reader.read("!B")[0]
4472 __command = util.unpack_fm_cmd(reader)
4473 assert(__command == 4)
4474 obj.idle_timeout = reader.read("!H")[0]
4475 obj.hard_timeout = reader.read("!H")[0]
4476 obj.priority = reader.read("!H")[0]
4477 obj.buffer_id = reader.read("!L")[0]
4478 obj.out_port = util.unpack_port_no(reader)
4479 obj.out_group = reader.read("!L")[0]
4480 obj.flags = reader.read("!H")[0]
4481 reader.skip(2)
4482 obj.match = ofp.match.unpack(reader)
4483 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
4484 return obj
4485
4486 def __eq__(self, other):
4487 if type(self) != type(other): return False
4488 if self.xid != other.xid: return False
4489 if self.cookie != other.cookie: return False
4490 if self.cookie_mask != other.cookie_mask: return False
4491 if self.table_id != other.table_id: return False
4492 if self.idle_timeout != other.idle_timeout: return False
4493 if self.hard_timeout != other.hard_timeout: return False
4494 if self.priority != other.priority: return False
4495 if self.buffer_id != other.buffer_id: return False
4496 if self.out_port != other.out_port: return False
4497 if self.out_group != other.out_group: return False
4498 if self.flags != other.flags: return False
4499 if self.match != other.match: return False
4500 if self.instructions != other.instructions: return False
4501 return True
4502
4503 def pretty_print(self, q):
4504 q.text("flow_delete_strict {")
4505 with q.group():
4506 with q.indent(2):
4507 q.breakable()
4508 q.text("xid = ");
4509 if self.xid != None:
4510 q.text("%#x" % self.xid)
4511 else:
4512 q.text('None')
4513 q.text(","); q.breakable()
4514 q.text("cookie = ");
4515 q.text("%#x" % self.cookie)
4516 q.text(","); q.breakable()
4517 q.text("cookie_mask = ");
4518 q.text("%#x" % self.cookie_mask)
4519 q.text(","); q.breakable()
4520 q.text("table_id = ");
4521 q.text("%#x" % self.table_id)
4522 q.text(","); q.breakable()
4523 q.text("idle_timeout = ");
4524 q.text("%#x" % self.idle_timeout)
4525 q.text(","); q.breakable()
4526 q.text("hard_timeout = ");
4527 q.text("%#x" % self.hard_timeout)
4528 q.text(","); q.breakable()
4529 q.text("priority = ");
4530 q.text("%#x" % self.priority)
4531 q.text(","); q.breakable()
4532 q.text("buffer_id = ");
4533 q.text("%#x" % self.buffer_id)
4534 q.text(","); q.breakable()
4535 q.text("out_port = ");
4536 q.text(util.pretty_port(self.out_port))
4537 q.text(","); q.breakable()
4538 q.text("out_group = ");
4539 q.text("%#x" % self.out_group)
4540 q.text(","); q.breakable()
4541 q.text("flags = ");
4542 q.text("%#x" % self.flags)
4543 q.text(","); q.breakable()
4544 q.text("match = ");
4545 q.pp(self.match)
4546 q.text(","); q.breakable()
4547 q.text("instructions = ");
4548 q.pp(self.instructions)
4549 q.breakable()
4550 q.text('}')
4551
4552flow_mod.subtypes[4] = flow_delete_strict
4553
4554class flow_mod_failed_error_msg(error_msg):
4555 version = 3
4556 type = 1
4557 err_type = 5
4558
4559 def __init__(self, xid=None, code=None, data=None):
4560 if xid != None:
4561 self.xid = xid
4562 else:
4563 self.xid = None
4564 if code != None:
4565 self.code = code
4566 else:
4567 self.code = 0
4568 if data != None:
4569 self.data = data
4570 else:
4571 self.data = ''
4572 return
4573
4574 def pack(self):
4575 packed = []
4576 packed.append(struct.pack("!B", self.version))
4577 packed.append(struct.pack("!B", self.type))
4578 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4579 packed.append(struct.pack("!L", self.xid))
4580 packed.append(struct.pack("!H", self.err_type))
4581 packed.append(struct.pack("!H", self.code))
4582 packed.append(self.data)
4583 length = sum([len(x) for x in packed])
4584 packed[2] = struct.pack("!H", length)
4585 return ''.join(packed)
4586
4587 @staticmethod
4588 def unpack(reader):
4589 obj = flow_mod_failed_error_msg()
4590 _version = reader.read("!B")[0]
4591 assert(_version == 3)
4592 _type = reader.read("!B")[0]
4593 assert(_type == 1)
4594 _length = reader.read("!H")[0]
4595 orig_reader = reader
4596 reader = orig_reader.slice(_length, 4)
4597 obj.xid = reader.read("!L")[0]
4598 _err_type = reader.read("!H")[0]
4599 assert(_err_type == 5)
4600 obj.code = reader.read("!H")[0]
4601 obj.data = str(reader.read_all())
4602 return obj
4603
4604 def __eq__(self, other):
4605 if type(self) != type(other): return False
4606 if self.xid != other.xid: return False
4607 if self.code != other.code: return False
4608 if self.data != other.data: return False
4609 return True
4610
4611 def pretty_print(self, q):
4612 q.text("flow_mod_failed_error_msg {")
4613 with q.group():
4614 with q.indent(2):
4615 q.breakable()
4616 q.text("xid = ");
4617 if self.xid != None:
4618 q.text("%#x" % self.xid)
4619 else:
4620 q.text('None')
4621 q.text(","); q.breakable()
4622 q.text("code = ");
4623 q.text("%#x" % self.code)
4624 q.text(","); q.breakable()
4625 q.text("data = ");
4626 q.pp(self.data)
4627 q.breakable()
4628 q.text('}')
4629
4630error_msg.subtypes[5] = flow_mod_failed_error_msg
4631
4632class flow_modify(flow_mod):
4633 version = 3
4634 type = 14
4635 _command = 1
4636
4637 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, match=None, instructions=None):
4638 if xid != None:
4639 self.xid = xid
4640 else:
4641 self.xid = None
4642 if cookie != None:
4643 self.cookie = cookie
4644 else:
4645 self.cookie = 0
4646 if cookie_mask != None:
4647 self.cookie_mask = cookie_mask
4648 else:
4649 self.cookie_mask = 0
4650 if table_id != None:
4651 self.table_id = table_id
4652 else:
4653 self.table_id = 0
4654 if idle_timeout != None:
4655 self.idle_timeout = idle_timeout
4656 else:
4657 self.idle_timeout = 0
4658 if hard_timeout != None:
4659 self.hard_timeout = hard_timeout
4660 else:
4661 self.hard_timeout = 0
4662 if priority != None:
4663 self.priority = priority
4664 else:
4665 self.priority = 0
4666 if buffer_id != None:
4667 self.buffer_id = buffer_id
4668 else:
4669 self.buffer_id = 0
4670 if out_port != None:
4671 self.out_port = out_port
4672 else:
4673 self.out_port = 0
4674 if out_group != None:
4675 self.out_group = out_group
4676 else:
4677 self.out_group = 0
4678 if flags != None:
4679 self.flags = flags
4680 else:
4681 self.flags = 0
4682 if match != None:
4683 self.match = match
4684 else:
4685 self.match = ofp.match()
4686 if instructions != None:
4687 self.instructions = instructions
4688 else:
4689 self.instructions = []
4690 return
4691
4692 def pack(self):
4693 packed = []
4694 packed.append(struct.pack("!B", self.version))
4695 packed.append(struct.pack("!B", self.type))
4696 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4697 packed.append(struct.pack("!L", self.xid))
4698 packed.append(struct.pack("!Q", self.cookie))
4699 packed.append(struct.pack("!Q", self.cookie_mask))
4700 packed.append(struct.pack("!B", self.table_id))
4701 packed.append(util.pack_fm_cmd(self._command))
4702 packed.append(struct.pack("!H", self.idle_timeout))
4703 packed.append(struct.pack("!H", self.hard_timeout))
4704 packed.append(struct.pack("!H", self.priority))
4705 packed.append(struct.pack("!L", self.buffer_id))
4706 packed.append(util.pack_port_no(self.out_port))
4707 packed.append(struct.pack("!L", self.out_group))
4708 packed.append(struct.pack("!H", self.flags))
4709 packed.append('\x00' * 2)
4710 packed.append(self.match.pack())
4711 packed.append(loxi.generic_util.pack_list(self.instructions))
4712 length = sum([len(x) for x in packed])
4713 packed[2] = struct.pack("!H", length)
4714 return ''.join(packed)
4715
4716 @staticmethod
4717 def unpack(reader):
4718 obj = flow_modify()
4719 _version = reader.read("!B")[0]
4720 assert(_version == 3)
4721 _type = reader.read("!B")[0]
4722 assert(_type == 14)
4723 _length = reader.read("!H")[0]
4724 orig_reader = reader
4725 reader = orig_reader.slice(_length, 4)
4726 obj.xid = reader.read("!L")[0]
4727 obj.cookie = reader.read("!Q")[0]
4728 obj.cookie_mask = reader.read("!Q")[0]
4729 obj.table_id = reader.read("!B")[0]
4730 __command = util.unpack_fm_cmd(reader)
4731 assert(__command == 1)
4732 obj.idle_timeout = reader.read("!H")[0]
4733 obj.hard_timeout = reader.read("!H")[0]
4734 obj.priority = reader.read("!H")[0]
4735 obj.buffer_id = reader.read("!L")[0]
4736 obj.out_port = util.unpack_port_no(reader)
4737 obj.out_group = reader.read("!L")[0]
4738 obj.flags = reader.read("!H")[0]
4739 reader.skip(2)
4740 obj.match = ofp.match.unpack(reader)
4741 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
4742 return obj
4743
4744 def __eq__(self, other):
4745 if type(self) != type(other): return False
4746 if self.xid != other.xid: return False
4747 if self.cookie != other.cookie: return False
4748 if self.cookie_mask != other.cookie_mask: return False
4749 if self.table_id != other.table_id: return False
4750 if self.idle_timeout != other.idle_timeout: return False
4751 if self.hard_timeout != other.hard_timeout: return False
4752 if self.priority != other.priority: return False
4753 if self.buffer_id != other.buffer_id: return False
4754 if self.out_port != other.out_port: return False
4755 if self.out_group != other.out_group: return False
4756 if self.flags != other.flags: return False
4757 if self.match != other.match: return False
4758 if self.instructions != other.instructions: return False
4759 return True
4760
4761 def pretty_print(self, q):
4762 q.text("flow_modify {")
4763 with q.group():
4764 with q.indent(2):
4765 q.breakable()
4766 q.text("xid = ");
4767 if self.xid != None:
4768 q.text("%#x" % self.xid)
4769 else:
4770 q.text('None')
4771 q.text(","); q.breakable()
4772 q.text("cookie = ");
4773 q.text("%#x" % self.cookie)
4774 q.text(","); q.breakable()
4775 q.text("cookie_mask = ");
4776 q.text("%#x" % self.cookie_mask)
4777 q.text(","); q.breakable()
4778 q.text("table_id = ");
4779 q.text("%#x" % self.table_id)
4780 q.text(","); q.breakable()
4781 q.text("idle_timeout = ");
4782 q.text("%#x" % self.idle_timeout)
4783 q.text(","); q.breakable()
4784 q.text("hard_timeout = ");
4785 q.text("%#x" % self.hard_timeout)
4786 q.text(","); q.breakable()
4787 q.text("priority = ");
4788 q.text("%#x" % self.priority)
4789 q.text(","); q.breakable()
4790 q.text("buffer_id = ");
4791 q.text("%#x" % self.buffer_id)
4792 q.text(","); q.breakable()
4793 q.text("out_port = ");
4794 q.text(util.pretty_port(self.out_port))
4795 q.text(","); q.breakable()
4796 q.text("out_group = ");
4797 q.text("%#x" % self.out_group)
4798 q.text(","); q.breakable()
4799 q.text("flags = ");
4800 q.text("%#x" % self.flags)
4801 q.text(","); q.breakable()
4802 q.text("match = ");
4803 q.pp(self.match)
4804 q.text(","); q.breakable()
4805 q.text("instructions = ");
4806 q.pp(self.instructions)
4807 q.breakable()
4808 q.text('}')
4809
4810flow_mod.subtypes[1] = flow_modify
4811
4812class flow_modify_strict(flow_mod):
4813 version = 3
4814 type = 14
4815 _command = 2
4816
4817 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, match=None, instructions=None):
4818 if xid != None:
4819 self.xid = xid
4820 else:
4821 self.xid = None
4822 if cookie != None:
4823 self.cookie = cookie
4824 else:
4825 self.cookie = 0
4826 if cookie_mask != None:
4827 self.cookie_mask = cookie_mask
4828 else:
4829 self.cookie_mask = 0
4830 if table_id != None:
4831 self.table_id = table_id
4832 else:
4833 self.table_id = 0
4834 if idle_timeout != None:
4835 self.idle_timeout = idle_timeout
4836 else:
4837 self.idle_timeout = 0
4838 if hard_timeout != None:
4839 self.hard_timeout = hard_timeout
4840 else:
4841 self.hard_timeout = 0
4842 if priority != None:
4843 self.priority = priority
4844 else:
4845 self.priority = 0
4846 if buffer_id != None:
4847 self.buffer_id = buffer_id
4848 else:
4849 self.buffer_id = 0
4850 if out_port != None:
4851 self.out_port = out_port
4852 else:
4853 self.out_port = 0
4854 if out_group != None:
4855 self.out_group = out_group
4856 else:
4857 self.out_group = 0
4858 if flags != None:
4859 self.flags = flags
4860 else:
4861 self.flags = 0
4862 if match != None:
4863 self.match = match
4864 else:
4865 self.match = ofp.match()
4866 if instructions != None:
4867 self.instructions = instructions
4868 else:
4869 self.instructions = []
4870 return
4871
4872 def pack(self):
4873 packed = []
4874 packed.append(struct.pack("!B", self.version))
4875 packed.append(struct.pack("!B", self.type))
4876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4877 packed.append(struct.pack("!L", self.xid))
4878 packed.append(struct.pack("!Q", self.cookie))
4879 packed.append(struct.pack("!Q", self.cookie_mask))
4880 packed.append(struct.pack("!B", self.table_id))
4881 packed.append(util.pack_fm_cmd(self._command))
4882 packed.append(struct.pack("!H", self.idle_timeout))
4883 packed.append(struct.pack("!H", self.hard_timeout))
4884 packed.append(struct.pack("!H", self.priority))
4885 packed.append(struct.pack("!L", self.buffer_id))
4886 packed.append(util.pack_port_no(self.out_port))
4887 packed.append(struct.pack("!L", self.out_group))
4888 packed.append(struct.pack("!H", self.flags))
4889 packed.append('\x00' * 2)
4890 packed.append(self.match.pack())
4891 packed.append(loxi.generic_util.pack_list(self.instructions))
4892 length = sum([len(x) for x in packed])
4893 packed[2] = struct.pack("!H", length)
4894 return ''.join(packed)
4895
4896 @staticmethod
4897 def unpack(reader):
4898 obj = flow_modify_strict()
4899 _version = reader.read("!B")[0]
4900 assert(_version == 3)
4901 _type = reader.read("!B")[0]
4902 assert(_type == 14)
4903 _length = reader.read("!H")[0]
4904 orig_reader = reader
4905 reader = orig_reader.slice(_length, 4)
4906 obj.xid = reader.read("!L")[0]
4907 obj.cookie = reader.read("!Q")[0]
4908 obj.cookie_mask = reader.read("!Q")[0]
4909 obj.table_id = reader.read("!B")[0]
4910 __command = util.unpack_fm_cmd(reader)
4911 assert(__command == 2)
4912 obj.idle_timeout = reader.read("!H")[0]
4913 obj.hard_timeout = reader.read("!H")[0]
4914 obj.priority = reader.read("!H")[0]
4915 obj.buffer_id = reader.read("!L")[0]
4916 obj.out_port = util.unpack_port_no(reader)
4917 obj.out_group = reader.read("!L")[0]
4918 obj.flags = reader.read("!H")[0]
4919 reader.skip(2)
4920 obj.match = ofp.match.unpack(reader)
4921 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
4922 return obj
4923
4924 def __eq__(self, other):
4925 if type(self) != type(other): return False
4926 if self.xid != other.xid: return False
4927 if self.cookie != other.cookie: return False
4928 if self.cookie_mask != other.cookie_mask: return False
4929 if self.table_id != other.table_id: return False
4930 if self.idle_timeout != other.idle_timeout: return False
4931 if self.hard_timeout != other.hard_timeout: return False
4932 if self.priority != other.priority: return False
4933 if self.buffer_id != other.buffer_id: return False
4934 if self.out_port != other.out_port: return False
4935 if self.out_group != other.out_group: return False
4936 if self.flags != other.flags: return False
4937 if self.match != other.match: return False
4938 if self.instructions != other.instructions: return False
4939 return True
4940
4941 def pretty_print(self, q):
4942 q.text("flow_modify_strict {")
4943 with q.group():
4944 with q.indent(2):
4945 q.breakable()
4946 q.text("xid = ");
4947 if self.xid != None:
4948 q.text("%#x" % self.xid)
4949 else:
4950 q.text('None')
4951 q.text(","); q.breakable()
4952 q.text("cookie = ");
4953 q.text("%#x" % self.cookie)
4954 q.text(","); q.breakable()
4955 q.text("cookie_mask = ");
4956 q.text("%#x" % self.cookie_mask)
4957 q.text(","); q.breakable()
4958 q.text("table_id = ");
4959 q.text("%#x" % self.table_id)
4960 q.text(","); q.breakable()
4961 q.text("idle_timeout = ");
4962 q.text("%#x" % self.idle_timeout)
4963 q.text(","); q.breakable()
4964 q.text("hard_timeout = ");
4965 q.text("%#x" % self.hard_timeout)
4966 q.text(","); q.breakable()
4967 q.text("priority = ");
4968 q.text("%#x" % self.priority)
4969 q.text(","); q.breakable()
4970 q.text("buffer_id = ");
4971 q.text("%#x" % self.buffer_id)
4972 q.text(","); q.breakable()
4973 q.text("out_port = ");
4974 q.text(util.pretty_port(self.out_port))
4975 q.text(","); q.breakable()
4976 q.text("out_group = ");
4977 q.text("%#x" % self.out_group)
4978 q.text(","); q.breakable()
4979 q.text("flags = ");
4980 q.text("%#x" % self.flags)
4981 q.text(","); q.breakable()
4982 q.text("match = ");
4983 q.pp(self.match)
4984 q.text(","); q.breakable()
4985 q.text("instructions = ");
4986 q.pp(self.instructions)
4987 q.breakable()
4988 q.text('}')
4989
4990flow_mod.subtypes[2] = flow_modify_strict
4991
4992class flow_removed(message):
4993 version = 3
4994 type = 11
4995
4996 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):
4997 if xid != None:
4998 self.xid = xid
4999 else:
5000 self.xid = None
5001 if cookie != None:
5002 self.cookie = cookie
5003 else:
5004 self.cookie = 0
5005 if priority != None:
5006 self.priority = priority
5007 else:
5008 self.priority = 0
5009 if reason != None:
5010 self.reason = reason
5011 else:
5012 self.reason = 0
5013 if table_id != None:
5014 self.table_id = table_id
5015 else:
5016 self.table_id = 0
5017 if duration_sec != None:
5018 self.duration_sec = duration_sec
5019 else:
5020 self.duration_sec = 0
5021 if duration_nsec != None:
5022 self.duration_nsec = duration_nsec
5023 else:
5024 self.duration_nsec = 0
5025 if idle_timeout != None:
5026 self.idle_timeout = idle_timeout
5027 else:
5028 self.idle_timeout = 0
5029 if hard_timeout != None:
5030 self.hard_timeout = hard_timeout
5031 else:
5032 self.hard_timeout = 0
5033 if packet_count != None:
5034 self.packet_count = packet_count
5035 else:
5036 self.packet_count = 0
5037 if byte_count != None:
5038 self.byte_count = byte_count
5039 else:
5040 self.byte_count = 0
5041 if match != None:
5042 self.match = match
5043 else:
5044 self.match = ofp.match()
5045 return
5046
5047 def pack(self):
5048 packed = []
5049 packed.append(struct.pack("!B", self.version))
5050 packed.append(struct.pack("!B", self.type))
5051 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5052 packed.append(struct.pack("!L", self.xid))
5053 packed.append(struct.pack("!Q", self.cookie))
5054 packed.append(struct.pack("!H", self.priority))
5055 packed.append(struct.pack("!B", self.reason))
5056 packed.append(struct.pack("!B", self.table_id))
5057 packed.append(struct.pack("!L", self.duration_sec))
5058 packed.append(struct.pack("!L", self.duration_nsec))
5059 packed.append(struct.pack("!H", self.idle_timeout))
5060 packed.append(struct.pack("!H", self.hard_timeout))
5061 packed.append(struct.pack("!Q", self.packet_count))
5062 packed.append(struct.pack("!Q", self.byte_count))
5063 packed.append(self.match.pack())
5064 length = sum([len(x) for x in packed])
5065 packed[2] = struct.pack("!H", length)
5066 return ''.join(packed)
5067
5068 @staticmethod
5069 def unpack(reader):
5070 obj = flow_removed()
5071 _version = reader.read("!B")[0]
5072 assert(_version == 3)
5073 _type = reader.read("!B")[0]
5074 assert(_type == 11)
5075 _length = reader.read("!H")[0]
5076 orig_reader = reader
5077 reader = orig_reader.slice(_length, 4)
5078 obj.xid = reader.read("!L")[0]
5079 obj.cookie = reader.read("!Q")[0]
5080 obj.priority = reader.read("!H")[0]
5081 obj.reason = reader.read("!B")[0]
5082 obj.table_id = reader.read("!B")[0]
5083 obj.duration_sec = reader.read("!L")[0]
5084 obj.duration_nsec = reader.read("!L")[0]
5085 obj.idle_timeout = reader.read("!H")[0]
5086 obj.hard_timeout = reader.read("!H")[0]
5087 obj.packet_count = reader.read("!Q")[0]
5088 obj.byte_count = reader.read("!Q")[0]
5089 obj.match = ofp.match.unpack(reader)
5090 return obj
5091
5092 def __eq__(self, other):
5093 if type(self) != type(other): return False
5094 if self.xid != other.xid: return False
5095 if self.cookie != other.cookie: return False
5096 if self.priority != other.priority: return False
5097 if self.reason != other.reason: return False
5098 if self.table_id != other.table_id: return False
5099 if self.duration_sec != other.duration_sec: return False
5100 if self.duration_nsec != other.duration_nsec: return False
5101 if self.idle_timeout != other.idle_timeout: return False
5102 if self.hard_timeout != other.hard_timeout: return False
5103 if self.packet_count != other.packet_count: return False
5104 if self.byte_count != other.byte_count: return False
5105 if self.match != other.match: return False
5106 return True
5107
5108 def pretty_print(self, q):
5109 q.text("flow_removed {")
5110 with q.group():
5111 with q.indent(2):
5112 q.breakable()
5113 q.text("xid = ");
5114 if self.xid != None:
5115 q.text("%#x" % self.xid)
5116 else:
5117 q.text('None')
5118 q.text(","); q.breakable()
5119 q.text("cookie = ");
5120 q.text("%#x" % self.cookie)
5121 q.text(","); q.breakable()
5122 q.text("priority = ");
5123 q.text("%#x" % self.priority)
5124 q.text(","); q.breakable()
5125 q.text("reason = ");
5126 q.text("%#x" % self.reason)
5127 q.text(","); q.breakable()
5128 q.text("table_id = ");
5129 q.text("%#x" % self.table_id)
5130 q.text(","); q.breakable()
5131 q.text("duration_sec = ");
5132 q.text("%#x" % self.duration_sec)
5133 q.text(","); q.breakable()
5134 q.text("duration_nsec = ");
5135 q.text("%#x" % self.duration_nsec)
5136 q.text(","); q.breakable()
5137 q.text("idle_timeout = ");
5138 q.text("%#x" % self.idle_timeout)
5139 q.text(","); q.breakable()
5140 q.text("hard_timeout = ");
5141 q.text("%#x" % self.hard_timeout)
5142 q.text(","); q.breakable()
5143 q.text("packet_count = ");
5144 q.text("%#x" % self.packet_count)
5145 q.text(","); q.breakable()
5146 q.text("byte_count = ");
5147 q.text("%#x" % self.byte_count)
5148 q.text(","); q.breakable()
5149 q.text("match = ");
5150 q.pp(self.match)
5151 q.breakable()
5152 q.text('}')
5153
5154message.subtypes[11] = flow_removed
5155
5156class flow_stats_reply(stats_reply):
5157 version = 3
5158 type = 19
5159 stats_type = 1
5160
5161 def __init__(self, xid=None, flags=None, entries=None):
5162 if xid != None:
5163 self.xid = xid
5164 else:
5165 self.xid = None
5166 if flags != None:
5167 self.flags = flags
5168 else:
5169 self.flags = 0
5170 if entries != None:
5171 self.entries = entries
5172 else:
5173 self.entries = []
5174 return
5175
5176 def pack(self):
5177 packed = []
5178 packed.append(struct.pack("!B", self.version))
5179 packed.append(struct.pack("!B", self.type))
5180 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5181 packed.append(struct.pack("!L", self.xid))
5182 packed.append(struct.pack("!H", self.stats_type))
5183 packed.append(struct.pack("!H", self.flags))
5184 packed.append('\x00' * 4)
5185 packed.append(loxi.generic_util.pack_list(self.entries))
5186 length = sum([len(x) for x in packed])
5187 packed[2] = struct.pack("!H", length)
5188 return ''.join(packed)
5189
5190 @staticmethod
5191 def unpack(reader):
5192 obj = flow_stats_reply()
5193 _version = reader.read("!B")[0]
5194 assert(_version == 3)
5195 _type = reader.read("!B")[0]
5196 assert(_type == 19)
5197 _length = reader.read("!H")[0]
5198 orig_reader = reader
5199 reader = orig_reader.slice(_length, 4)
5200 obj.xid = reader.read("!L")[0]
5201 _stats_type = reader.read("!H")[0]
5202 assert(_stats_type == 1)
5203 obj.flags = reader.read("!H")[0]
5204 reader.skip(4)
5205 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
5206 return obj
5207
5208 def __eq__(self, other):
5209 if type(self) != type(other): return False
5210 if self.xid != other.xid: return False
5211 if self.flags != other.flags: return False
5212 if self.entries != other.entries: return False
5213 return True
5214
5215 def pretty_print(self, q):
5216 q.text("flow_stats_reply {")
5217 with q.group():
5218 with q.indent(2):
5219 q.breakable()
5220 q.text("xid = ");
5221 if self.xid != None:
5222 q.text("%#x" % self.xid)
5223 else:
5224 q.text('None')
5225 q.text(","); q.breakable()
5226 q.text("flags = ");
5227 q.text("%#x" % self.flags)
5228 q.text(","); q.breakable()
5229 q.text("entries = ");
5230 q.pp(self.entries)
5231 q.breakable()
5232 q.text('}')
5233
5234stats_reply.subtypes[1] = flow_stats_reply
5235
5236class flow_stats_request(stats_request):
5237 version = 3
5238 type = 18
5239 stats_type = 1
5240
5241 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
5242 if xid != None:
5243 self.xid = xid
5244 else:
5245 self.xid = None
5246 if flags != None:
5247 self.flags = flags
5248 else:
5249 self.flags = 0
5250 if table_id != None:
5251 self.table_id = table_id
5252 else:
5253 self.table_id = 0
5254 if out_port != None:
5255 self.out_port = out_port
5256 else:
5257 self.out_port = 0
5258 if out_group != None:
5259 self.out_group = out_group
5260 else:
5261 self.out_group = 0
5262 if cookie != None:
5263 self.cookie = cookie
5264 else:
5265 self.cookie = 0
5266 if cookie_mask != None:
5267 self.cookie_mask = cookie_mask
5268 else:
5269 self.cookie_mask = 0
5270 if match != None:
5271 self.match = match
5272 else:
5273 self.match = ofp.match()
5274 return
5275
5276 def pack(self):
5277 packed = []
5278 packed.append(struct.pack("!B", self.version))
5279 packed.append(struct.pack("!B", self.type))
5280 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5281 packed.append(struct.pack("!L", self.xid))
5282 packed.append(struct.pack("!H", self.stats_type))
5283 packed.append(struct.pack("!H", self.flags))
5284 packed.append('\x00' * 4)
5285 packed.append(struct.pack("!B", self.table_id))
5286 packed.append('\x00' * 3)
5287 packed.append(util.pack_port_no(self.out_port))
5288 packed.append(struct.pack("!L", self.out_group))
5289 packed.append('\x00' * 4)
5290 packed.append(struct.pack("!Q", self.cookie))
5291 packed.append(struct.pack("!Q", self.cookie_mask))
5292 packed.append(self.match.pack())
5293 length = sum([len(x) for x in packed])
5294 packed[2] = struct.pack("!H", length)
5295 return ''.join(packed)
5296
5297 @staticmethod
5298 def unpack(reader):
5299 obj = flow_stats_request()
5300 _version = reader.read("!B")[0]
5301 assert(_version == 3)
5302 _type = reader.read("!B")[0]
5303 assert(_type == 18)
5304 _length = reader.read("!H")[0]
5305 orig_reader = reader
5306 reader = orig_reader.slice(_length, 4)
5307 obj.xid = reader.read("!L")[0]
5308 _stats_type = reader.read("!H")[0]
5309 assert(_stats_type == 1)
5310 obj.flags = reader.read("!H")[0]
5311 reader.skip(4)
5312 obj.table_id = reader.read("!B")[0]
5313 reader.skip(3)
5314 obj.out_port = util.unpack_port_no(reader)
5315 obj.out_group = reader.read("!L")[0]
5316 reader.skip(4)
5317 obj.cookie = reader.read("!Q")[0]
5318 obj.cookie_mask = reader.read("!Q")[0]
5319 obj.match = ofp.match.unpack(reader)
5320 return obj
5321
5322 def __eq__(self, other):
5323 if type(self) != type(other): return False
5324 if self.xid != other.xid: return False
5325 if self.flags != other.flags: return False
5326 if self.table_id != other.table_id: return False
5327 if self.out_port != other.out_port: return False
5328 if self.out_group != other.out_group: return False
5329 if self.cookie != other.cookie: return False
5330 if self.cookie_mask != other.cookie_mask: return False
5331 if self.match != other.match: return False
5332 return True
5333
5334 def pretty_print(self, q):
5335 q.text("flow_stats_request {")
5336 with q.group():
5337 with q.indent(2):
5338 q.breakable()
5339 q.text("xid = ");
5340 if self.xid != None:
5341 q.text("%#x" % self.xid)
5342 else:
5343 q.text('None')
5344 q.text(","); q.breakable()
5345 q.text("flags = ");
5346 q.text("%#x" % self.flags)
5347 q.text(","); q.breakable()
5348 q.text("table_id = ");
5349 q.text("%#x" % self.table_id)
5350 q.text(","); q.breakable()
5351 q.text("out_port = ");
5352 q.text(util.pretty_port(self.out_port))
5353 q.text(","); q.breakable()
5354 q.text("out_group = ");
5355 q.text("%#x" % self.out_group)
5356 q.text(","); q.breakable()
5357 q.text("cookie = ");
5358 q.text("%#x" % self.cookie)
5359 q.text(","); q.breakable()
5360 q.text("cookie_mask = ");
5361 q.text("%#x" % self.cookie_mask)
5362 q.text(","); q.breakable()
5363 q.text("match = ");
5364 q.pp(self.match)
5365 q.breakable()
5366 q.text('}')
5367
5368stats_request.subtypes[1] = flow_stats_request
5369
5370class get_config_reply(message):
5371 version = 3
5372 type = 8
5373
5374 def __init__(self, xid=None, flags=None, miss_send_len=None):
5375 if xid != None:
5376 self.xid = xid
5377 else:
5378 self.xid = None
5379 if flags != None:
5380 self.flags = flags
5381 else:
5382 self.flags = 0
5383 if miss_send_len != None:
5384 self.miss_send_len = miss_send_len
5385 else:
5386 self.miss_send_len = 0
5387 return
5388
5389 def pack(self):
5390 packed = []
5391 packed.append(struct.pack("!B", self.version))
5392 packed.append(struct.pack("!B", self.type))
5393 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5394 packed.append(struct.pack("!L", self.xid))
5395 packed.append(struct.pack("!H", self.flags))
5396 packed.append(struct.pack("!H", self.miss_send_len))
5397 length = sum([len(x) for x in packed])
5398 packed[2] = struct.pack("!H", length)
5399 return ''.join(packed)
5400
5401 @staticmethod
5402 def unpack(reader):
5403 obj = get_config_reply()
5404 _version = reader.read("!B")[0]
5405 assert(_version == 3)
5406 _type = reader.read("!B")[0]
5407 assert(_type == 8)
5408 _length = reader.read("!H")[0]
5409 orig_reader = reader
5410 reader = orig_reader.slice(_length, 4)
5411 obj.xid = reader.read("!L")[0]
5412 obj.flags = reader.read("!H")[0]
5413 obj.miss_send_len = reader.read("!H")[0]
5414 return obj
5415
5416 def __eq__(self, other):
5417 if type(self) != type(other): return False
5418 if self.xid != other.xid: return False
5419 if self.flags != other.flags: return False
5420 if self.miss_send_len != other.miss_send_len: return False
5421 return True
5422
5423 def pretty_print(self, q):
5424 q.text("get_config_reply {")
5425 with q.group():
5426 with q.indent(2):
5427 q.breakable()
5428 q.text("xid = ");
5429 if self.xid != None:
5430 q.text("%#x" % self.xid)
5431 else:
5432 q.text('None')
5433 q.text(","); q.breakable()
5434 q.text("flags = ");
5435 q.text("%#x" % self.flags)
5436 q.text(","); q.breakable()
5437 q.text("miss_send_len = ");
5438 q.text("%#x" % self.miss_send_len)
5439 q.breakable()
5440 q.text('}')
5441
5442message.subtypes[8] = get_config_reply
5443
5444class get_config_request(message):
5445 version = 3
5446 type = 7
5447
5448 def __init__(self, xid=None):
5449 if xid != None:
5450 self.xid = xid
5451 else:
5452 self.xid = None
5453 return
5454
5455 def pack(self):
5456 packed = []
5457 packed.append(struct.pack("!B", self.version))
5458 packed.append(struct.pack("!B", self.type))
5459 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5460 packed.append(struct.pack("!L", self.xid))
5461 length = sum([len(x) for x in packed])
5462 packed[2] = struct.pack("!H", length)
5463 return ''.join(packed)
5464
5465 @staticmethod
5466 def unpack(reader):
5467 obj = get_config_request()
5468 _version = reader.read("!B")[0]
5469 assert(_version == 3)
5470 _type = reader.read("!B")[0]
5471 assert(_type == 7)
5472 _length = reader.read("!H")[0]
5473 orig_reader = reader
5474 reader = orig_reader.slice(_length, 4)
5475 obj.xid = reader.read("!L")[0]
5476 return obj
5477
5478 def __eq__(self, other):
5479 if type(self) != type(other): return False
5480 if self.xid != other.xid: return False
5481 return True
5482
5483 def pretty_print(self, q):
5484 q.text("get_config_request {")
5485 with q.group():
5486 with q.indent(2):
5487 q.breakable()
5488 q.text("xid = ");
5489 if self.xid != None:
5490 q.text("%#x" % self.xid)
5491 else:
5492 q.text('None')
5493 q.breakable()
5494 q.text('}')
5495
5496message.subtypes[7] = get_config_request
5497
5498class group_mod(message):
5499 subtypes = {}
5500
5501 version = 3
5502 type = 15
5503
5504 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
5505 if xid != None:
5506 self.xid = xid
5507 else:
5508 self.xid = None
5509 if command != None:
5510 self.command = command
5511 else:
5512 self.command = 0
5513 if group_type != None:
5514 self.group_type = group_type
5515 else:
5516 self.group_type = 0
5517 if group_id != None:
5518 self.group_id = group_id
5519 else:
5520 self.group_id = 0
5521 if buckets != None:
5522 self.buckets = buckets
5523 else:
5524 self.buckets = []
5525 return
5526
5527 def pack(self):
5528 packed = []
5529 packed.append(struct.pack("!B", self.version))
5530 packed.append(struct.pack("!B", self.type))
5531 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5532 packed.append(struct.pack("!L", self.xid))
5533 packed.append(struct.pack("!H", self.command))
5534 packed.append(struct.pack("!B", self.group_type))
5535 packed.append('\x00' * 1)
5536 packed.append(struct.pack("!L", self.group_id))
5537 packed.append(loxi.generic_util.pack_list(self.buckets))
5538 length = sum([len(x) for x in packed])
5539 packed[2] = struct.pack("!H", length)
5540 return ''.join(packed)
5541
5542 @staticmethod
5543 def unpack(reader):
5544 subtype, = reader.peek('!H', 8)
5545 subclass = group_mod.subtypes.get(subtype)
5546 if subclass:
5547 return subclass.unpack(reader)
5548
5549 obj = group_mod()
5550 _version = reader.read("!B")[0]
5551 assert(_version == 3)
5552 _type = reader.read("!B")[0]
5553 assert(_type == 15)
5554 _length = reader.read("!H")[0]
5555 orig_reader = reader
5556 reader = orig_reader.slice(_length, 4)
5557 obj.xid = reader.read("!L")[0]
5558 obj.command = reader.read("!H")[0]
5559 obj.group_type = reader.read("!B")[0]
5560 reader.skip(1)
5561 obj.group_id = reader.read("!L")[0]
5562 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
5563 return obj
5564
5565 def __eq__(self, other):
5566 if type(self) != type(other): return False
5567 if self.xid != other.xid: return False
5568 if self.command != other.command: return False
5569 if self.group_type != other.group_type: return False
5570 if self.group_id != other.group_id: return False
5571 if self.buckets != other.buckets: return False
5572 return True
5573
5574 def pretty_print(self, q):
5575 q.text("group_mod {")
5576 with q.group():
5577 with q.indent(2):
5578 q.breakable()
5579 q.text("xid = ");
5580 if self.xid != None:
5581 q.text("%#x" % self.xid)
5582 else:
5583 q.text('None')
5584 q.text(","); q.breakable()
5585 q.text("group_type = ");
5586 q.text("%#x" % self.group_type)
5587 q.text(","); q.breakable()
5588 q.text("group_id = ");
5589 q.text("%#x" % self.group_id)
5590 q.text(","); q.breakable()
5591 q.text("buckets = ");
5592 q.pp(self.buckets)
5593 q.breakable()
5594 q.text('}')
5595
5596message.subtypes[15] = group_mod
5597
5598class group_add(group_mod):
5599 version = 3
5600 type = 15
5601 command = 0
5602
5603 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
5604 if xid != None:
5605 self.xid = xid
5606 else:
5607 self.xid = None
5608 if group_type != None:
5609 self.group_type = group_type
5610 else:
5611 self.group_type = 0
5612 if group_id != None:
5613 self.group_id = group_id
5614 else:
5615 self.group_id = 0
5616 if buckets != None:
5617 self.buckets = buckets
5618 else:
5619 self.buckets = []
5620 return
5621
5622 def pack(self):
5623 packed = []
5624 packed.append(struct.pack("!B", self.version))
5625 packed.append(struct.pack("!B", self.type))
5626 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5627 packed.append(struct.pack("!L", self.xid))
5628 packed.append(struct.pack("!H", self.command))
5629 packed.append(struct.pack("!B", self.group_type))
5630 packed.append('\x00' * 1)
5631 packed.append(struct.pack("!L", self.group_id))
5632 packed.append(loxi.generic_util.pack_list(self.buckets))
5633 length = sum([len(x) for x in packed])
5634 packed[2] = struct.pack("!H", length)
5635 return ''.join(packed)
5636
5637 @staticmethod
5638 def unpack(reader):
5639 obj = group_add()
5640 _version = reader.read("!B")[0]
5641 assert(_version == 3)
5642 _type = reader.read("!B")[0]
5643 assert(_type == 15)
5644 _length = reader.read("!H")[0]
5645 orig_reader = reader
5646 reader = orig_reader.slice(_length, 4)
5647 obj.xid = reader.read("!L")[0]
5648 _command = reader.read("!H")[0]
5649 assert(_command == 0)
5650 obj.group_type = reader.read("!B")[0]
5651 reader.skip(1)
5652 obj.group_id = reader.read("!L")[0]
5653 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
5654 return obj
5655
5656 def __eq__(self, other):
5657 if type(self) != type(other): return False
5658 if self.xid != other.xid: return False
5659 if self.group_type != other.group_type: return False
5660 if self.group_id != other.group_id: return False
5661 if self.buckets != other.buckets: return False
5662 return True
5663
5664 def pretty_print(self, q):
5665 q.text("group_add {")
5666 with q.group():
5667 with q.indent(2):
5668 q.breakable()
5669 q.text("xid = ");
5670 if self.xid != None:
5671 q.text("%#x" % self.xid)
5672 else:
5673 q.text('None')
5674 q.text(","); q.breakable()
5675 q.text("group_type = ");
5676 q.text("%#x" % self.group_type)
5677 q.text(","); q.breakable()
5678 q.text("group_id = ");
5679 q.text("%#x" % self.group_id)
5680 q.text(","); q.breakable()
5681 q.text("buckets = ");
5682 q.pp(self.buckets)
5683 q.breakable()
5684 q.text('}')
5685
5686group_mod.subtypes[0] = group_add
5687
5688class group_delete(group_mod):
5689 version = 3
5690 type = 15
5691 command = 2
5692
5693 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
5694 if xid != None:
5695 self.xid = xid
5696 else:
5697 self.xid = None
5698 if group_type != None:
5699 self.group_type = group_type
5700 else:
5701 self.group_type = 0
5702 if group_id != None:
5703 self.group_id = group_id
5704 else:
5705 self.group_id = 0
5706 if buckets != None:
5707 self.buckets = buckets
5708 else:
5709 self.buckets = []
5710 return
5711
5712 def pack(self):
5713 packed = []
5714 packed.append(struct.pack("!B", self.version))
5715 packed.append(struct.pack("!B", self.type))
5716 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5717 packed.append(struct.pack("!L", self.xid))
5718 packed.append(struct.pack("!H", self.command))
5719 packed.append(struct.pack("!B", self.group_type))
5720 packed.append('\x00' * 1)
5721 packed.append(struct.pack("!L", self.group_id))
5722 packed.append(loxi.generic_util.pack_list(self.buckets))
5723 length = sum([len(x) for x in packed])
5724 packed[2] = struct.pack("!H", length)
5725 return ''.join(packed)
5726
5727 @staticmethod
5728 def unpack(reader):
5729 obj = group_delete()
5730 _version = reader.read("!B")[0]
5731 assert(_version == 3)
5732 _type = reader.read("!B")[0]
5733 assert(_type == 15)
5734 _length = reader.read("!H")[0]
5735 orig_reader = reader
5736 reader = orig_reader.slice(_length, 4)
5737 obj.xid = reader.read("!L")[0]
5738 _command = reader.read("!H")[0]
5739 assert(_command == 2)
5740 obj.group_type = reader.read("!B")[0]
5741 reader.skip(1)
5742 obj.group_id = reader.read("!L")[0]
5743 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
5744 return obj
5745
5746 def __eq__(self, other):
5747 if type(self) != type(other): return False
5748 if self.xid != other.xid: return False
5749 if self.group_type != other.group_type: return False
5750 if self.group_id != other.group_id: return False
5751 if self.buckets != other.buckets: return False
5752 return True
5753
5754 def pretty_print(self, q):
5755 q.text("group_delete {")
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.text(","); q.breakable()
5765 q.text("group_type = ");
5766 q.text("%#x" % self.group_type)
5767 q.text(","); q.breakable()
5768 q.text("group_id = ");
5769 q.text("%#x" % self.group_id)
5770 q.text(","); q.breakable()
5771 q.text("buckets = ");
5772 q.pp(self.buckets)
5773 q.breakable()
5774 q.text('}')
5775
5776group_mod.subtypes[2] = group_delete
5777
5778class group_desc_stats_reply(stats_reply):
5779 version = 3
5780 type = 19
5781 stats_type = 7
5782
5783 def __init__(self, xid=None, flags=None, entries=None):
5784 if xid != None:
5785 self.xid = xid
5786 else:
5787 self.xid = None
5788 if flags != None:
5789 self.flags = flags
5790 else:
5791 self.flags = 0
5792 if entries != None:
5793 self.entries = entries
5794 else:
5795 self.entries = []
5796 return
5797
5798 def pack(self):
5799 packed = []
5800 packed.append(struct.pack("!B", self.version))
5801 packed.append(struct.pack("!B", self.type))
5802 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5803 packed.append(struct.pack("!L", self.xid))
5804 packed.append(struct.pack("!H", self.stats_type))
5805 packed.append(struct.pack("!H", self.flags))
5806 packed.append('\x00' * 4)
5807 packed.append(loxi.generic_util.pack_list(self.entries))
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 = group_desc_stats_reply()
5815 _version = reader.read("!B")[0]
5816 assert(_version == 3)
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 == 7)
5825 obj.flags = reader.read("!H")[0]
5826 reader.skip(4)
5827 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
5828 return obj
5829
5830 def __eq__(self, other):
5831 if type(self) != type(other): return False
5832 if self.xid != other.xid: return False
5833 if self.flags != other.flags: return False
5834 if self.entries != other.entries: return False
5835 return True
5836
5837 def pretty_print(self, q):
5838 q.text("group_desc_stats_reply {")
5839 with q.group():
5840 with q.indent(2):
5841 q.breakable()
5842 q.text("xid = ");
5843 if self.xid != None:
5844 q.text("%#x" % self.xid)
5845 else:
5846 q.text('None')
5847 q.text(","); q.breakable()
5848 q.text("flags = ");
5849 q.text("%#x" % self.flags)
5850 q.text(","); q.breakable()
5851 q.text("entries = ");
5852 q.pp(self.entries)
5853 q.breakable()
5854 q.text('}')
5855
5856stats_reply.subtypes[7] = group_desc_stats_reply
5857
5858class group_desc_stats_request(stats_request):
5859 version = 3
5860 type = 18
5861 stats_type = 7
5862
5863 def __init__(self, xid=None, flags=None):
5864 if xid != None:
5865 self.xid = xid
5866 else:
5867 self.xid = None
5868 if flags != None:
5869 self.flags = flags
5870 else:
5871 self.flags = 0
5872 return
5873
5874 def pack(self):
5875 packed = []
5876 packed.append(struct.pack("!B", self.version))
5877 packed.append(struct.pack("!B", self.type))
5878 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5879 packed.append(struct.pack("!L", self.xid))
5880 packed.append(struct.pack("!H", self.stats_type))
5881 packed.append(struct.pack("!H", self.flags))
5882 packed.append('\x00' * 4)
5883 length = sum([len(x) for x in packed])
5884 packed[2] = struct.pack("!H", length)
5885 return ''.join(packed)
5886
5887 @staticmethod
5888 def unpack(reader):
5889 obj = group_desc_stats_request()
5890 _version = reader.read("!B")[0]
5891 assert(_version == 3)
5892 _type = reader.read("!B")[0]
5893 assert(_type == 18)
5894 _length = reader.read("!H")[0]
5895 orig_reader = reader
5896 reader = orig_reader.slice(_length, 4)
5897 obj.xid = reader.read("!L")[0]
5898 _stats_type = reader.read("!H")[0]
5899 assert(_stats_type == 7)
5900 obj.flags = reader.read("!H")[0]
5901 reader.skip(4)
5902 return obj
5903
5904 def __eq__(self, other):
5905 if type(self) != type(other): return False
5906 if self.xid != other.xid: return False
5907 if self.flags != other.flags: return False
5908 return True
5909
5910 def pretty_print(self, q):
5911 q.text("group_desc_stats_request {")
5912 with q.group():
5913 with q.indent(2):
5914 q.breakable()
5915 q.text("xid = ");
5916 if self.xid != None:
5917 q.text("%#x" % self.xid)
5918 else:
5919 q.text('None')
5920 q.text(","); q.breakable()
5921 q.text("flags = ");
5922 q.text("%#x" % self.flags)
5923 q.breakable()
5924 q.text('}')
5925
5926stats_request.subtypes[7] = group_desc_stats_request
5927
5928class group_features_stats_reply(stats_reply):
5929 version = 3
5930 type = 19
5931 stats_type = 8
5932
5933 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):
5934 if xid != None:
5935 self.xid = xid
5936 else:
5937 self.xid = None
5938 if flags != None:
5939 self.flags = flags
5940 else:
5941 self.flags = 0
5942 if types != None:
5943 self.types = types
5944 else:
5945 self.types = 0
5946 if capabilities != None:
5947 self.capabilities = capabilities
5948 else:
5949 self.capabilities = 0
5950 if max_groups_all != None:
5951 self.max_groups_all = max_groups_all
5952 else:
5953 self.max_groups_all = 0
5954 if max_groups_select != None:
5955 self.max_groups_select = max_groups_select
5956 else:
5957 self.max_groups_select = 0
5958 if max_groups_indirect != None:
5959 self.max_groups_indirect = max_groups_indirect
5960 else:
5961 self.max_groups_indirect = 0
5962 if max_groups_ff != None:
5963 self.max_groups_ff = max_groups_ff
5964 else:
5965 self.max_groups_ff = 0
5966 if actions_all != None:
5967 self.actions_all = actions_all
5968 else:
5969 self.actions_all = 0
5970 if actions_select != None:
5971 self.actions_select = actions_select
5972 else:
5973 self.actions_select = 0
5974 if actions_indirect != None:
5975 self.actions_indirect = actions_indirect
5976 else:
5977 self.actions_indirect = 0
5978 if actions_ff != None:
5979 self.actions_ff = actions_ff
5980 else:
5981 self.actions_ff = 0
5982 return
5983
5984 def pack(self):
5985 packed = []
5986 packed.append(struct.pack("!B", self.version))
5987 packed.append(struct.pack("!B", self.type))
5988 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5989 packed.append(struct.pack("!L", self.xid))
5990 packed.append(struct.pack("!H", self.stats_type))
5991 packed.append(struct.pack("!H", self.flags))
5992 packed.append('\x00' * 4)
5993 packed.append(struct.pack("!L", self.types))
5994 packed.append(struct.pack("!L", self.capabilities))
5995 packed.append(struct.pack("!L", self.max_groups_all))
5996 packed.append(struct.pack("!L", self.max_groups_select))
5997 packed.append(struct.pack("!L", self.max_groups_indirect))
5998 packed.append(struct.pack("!L", self.max_groups_ff))
5999 packed.append(struct.pack("!L", self.actions_all))
6000 packed.append(struct.pack("!L", self.actions_select))
6001 packed.append(struct.pack("!L", self.actions_indirect))
6002 packed.append(struct.pack("!L", self.actions_ff))
6003 length = sum([len(x) for x in packed])
6004 packed[2] = struct.pack("!H", length)
6005 return ''.join(packed)
6006
6007 @staticmethod
6008 def unpack(reader):
6009 obj = group_features_stats_reply()
6010 _version = reader.read("!B")[0]
6011 assert(_version == 3)
6012 _type = reader.read("!B")[0]
6013 assert(_type == 19)
6014 _length = reader.read("!H")[0]
6015 orig_reader = reader
6016 reader = orig_reader.slice(_length, 4)
6017 obj.xid = reader.read("!L")[0]
6018 _stats_type = reader.read("!H")[0]
6019 assert(_stats_type == 8)
6020 obj.flags = reader.read("!H")[0]
6021 reader.skip(4)
6022 obj.types = reader.read("!L")[0]
6023 obj.capabilities = reader.read("!L")[0]
6024 obj.max_groups_all = reader.read("!L")[0]
6025 obj.max_groups_select = reader.read("!L")[0]
6026 obj.max_groups_indirect = reader.read("!L")[0]
6027 obj.max_groups_ff = reader.read("!L")[0]
6028 obj.actions_all = reader.read("!L")[0]
6029 obj.actions_select = reader.read("!L")[0]
6030 obj.actions_indirect = reader.read("!L")[0]
6031 obj.actions_ff = reader.read("!L")[0]
6032 return obj
6033
6034 def __eq__(self, other):
6035 if type(self) != type(other): return False
6036 if self.xid != other.xid: return False
6037 if self.flags != other.flags: return False
6038 if self.types != other.types: return False
6039 if self.capabilities != other.capabilities: return False
6040 if self.max_groups_all != other.max_groups_all: return False
6041 if self.max_groups_select != other.max_groups_select: return False
6042 if self.max_groups_indirect != other.max_groups_indirect: return False
6043 if self.max_groups_ff != other.max_groups_ff: return False
6044 if self.actions_all != other.actions_all: return False
6045 if self.actions_select != other.actions_select: return False
6046 if self.actions_indirect != other.actions_indirect: return False
6047 if self.actions_ff != other.actions_ff: return False
6048 return True
6049
6050 def pretty_print(self, q):
6051 q.text("group_features_stats_reply {")
6052 with q.group():
6053 with q.indent(2):
6054 q.breakable()
6055 q.text("xid = ");
6056 if self.xid != None:
6057 q.text("%#x" % self.xid)
6058 else:
6059 q.text('None')
6060 q.text(","); q.breakable()
6061 q.text("flags = ");
6062 q.text("%#x" % self.flags)
6063 q.text(","); q.breakable()
6064 q.text("types = ");
6065 q.text("%#x" % self.types)
6066 q.text(","); q.breakable()
6067 q.text("capabilities = ");
6068 q.text("%#x" % self.capabilities)
6069 q.text(","); q.breakable()
6070 q.text("max_groups_all = ");
6071 q.text("%#x" % self.max_groups_all)
6072 q.text(","); q.breakable()
6073 q.text("max_groups_select = ");
6074 q.text("%#x" % self.max_groups_select)
6075 q.text(","); q.breakable()
6076 q.text("max_groups_indirect = ");
6077 q.text("%#x" % self.max_groups_indirect)
6078 q.text(","); q.breakable()
6079 q.text("max_groups_ff = ");
6080 q.text("%#x" % self.max_groups_ff)
6081 q.text(","); q.breakable()
6082 q.text("actions_all = ");
6083 q.text("%#x" % self.actions_all)
6084 q.text(","); q.breakable()
6085 q.text("actions_select = ");
6086 q.text("%#x" % self.actions_select)
6087 q.text(","); q.breakable()
6088 q.text("actions_indirect = ");
6089 q.text("%#x" % self.actions_indirect)
6090 q.text(","); q.breakable()
6091 q.text("actions_ff = ");
6092 q.text("%#x" % self.actions_ff)
6093 q.breakable()
6094 q.text('}')
6095
6096stats_reply.subtypes[8] = group_features_stats_reply
6097
6098class group_features_stats_request(stats_request):
6099 version = 3
6100 type = 18
6101 stats_type = 8
6102
6103 def __init__(self, xid=None, flags=None):
6104 if xid != None:
6105 self.xid = xid
6106 else:
6107 self.xid = None
6108 if flags != None:
6109 self.flags = flags
6110 else:
6111 self.flags = 0
6112 return
6113
6114 def pack(self):
6115 packed = []
6116 packed.append(struct.pack("!B", self.version))
6117 packed.append(struct.pack("!B", self.type))
6118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6119 packed.append(struct.pack("!L", self.xid))
6120 packed.append(struct.pack("!H", self.stats_type))
6121 packed.append(struct.pack("!H", self.flags))
6122 packed.append('\x00' * 4)
6123 length = sum([len(x) for x in packed])
6124 packed[2] = struct.pack("!H", length)
6125 return ''.join(packed)
6126
6127 @staticmethod
6128 def unpack(reader):
6129 obj = group_features_stats_request()
6130 _version = reader.read("!B")[0]
6131 assert(_version == 3)
6132 _type = reader.read("!B")[0]
6133 assert(_type == 18)
6134 _length = reader.read("!H")[0]
6135 orig_reader = reader
6136 reader = orig_reader.slice(_length, 4)
6137 obj.xid = reader.read("!L")[0]
6138 _stats_type = reader.read("!H")[0]
6139 assert(_stats_type == 8)
6140 obj.flags = reader.read("!H")[0]
6141 reader.skip(4)
6142 return obj
6143
6144 def __eq__(self, other):
6145 if type(self) != type(other): return False
6146 if self.xid != other.xid: return False
6147 if self.flags != other.flags: return False
6148 return True
6149
6150 def pretty_print(self, q):
6151 q.text("group_features_stats_request {")
6152 with q.group():
6153 with q.indent(2):
6154 q.breakable()
6155 q.text("xid = ");
6156 if self.xid != None:
6157 q.text("%#x" % self.xid)
6158 else:
6159 q.text('None')
6160 q.text(","); q.breakable()
6161 q.text("flags = ");
6162 q.text("%#x" % self.flags)
6163 q.breakable()
6164 q.text('}')
6165
6166stats_request.subtypes[8] = group_features_stats_request
6167
6168class group_mod_failed_error_msg(error_msg):
6169 version = 3
6170 type = 1
6171 err_type = 6
6172
6173 def __init__(self, xid=None, code=None, data=None):
6174 if xid != None:
6175 self.xid = xid
6176 else:
6177 self.xid = None
6178 if code != None:
6179 self.code = code
6180 else:
6181 self.code = 0
6182 if data != None:
6183 self.data = data
6184 else:
6185 self.data = ''
6186 return
6187
6188 def pack(self):
6189 packed = []
6190 packed.append(struct.pack("!B", self.version))
6191 packed.append(struct.pack("!B", self.type))
6192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6193 packed.append(struct.pack("!L", self.xid))
6194 packed.append(struct.pack("!H", self.err_type))
6195 packed.append(struct.pack("!H", self.code))
6196 packed.append(self.data)
6197 length = sum([len(x) for x in packed])
6198 packed[2] = struct.pack("!H", length)
6199 return ''.join(packed)
6200
6201 @staticmethod
6202 def unpack(reader):
6203 obj = group_mod_failed_error_msg()
6204 _version = reader.read("!B")[0]
6205 assert(_version == 3)
6206 _type = reader.read("!B")[0]
6207 assert(_type == 1)
6208 _length = reader.read("!H")[0]
6209 orig_reader = reader
6210 reader = orig_reader.slice(_length, 4)
6211 obj.xid = reader.read("!L")[0]
6212 _err_type = reader.read("!H")[0]
6213 assert(_err_type == 6)
6214 obj.code = reader.read("!H")[0]
6215 obj.data = str(reader.read_all())
6216 return obj
6217
6218 def __eq__(self, other):
6219 if type(self) != type(other): return False
6220 if self.xid != other.xid: return False
6221 if self.code != other.code: return False
6222 if self.data != other.data: return False
6223 return True
6224
6225 def pretty_print(self, q):
6226 q.text("group_mod_failed_error_msg {")
6227 with q.group():
6228 with q.indent(2):
6229 q.breakable()
6230 q.text("xid = ");
6231 if self.xid != None:
6232 q.text("%#x" % self.xid)
6233 else:
6234 q.text('None')
6235 q.text(","); q.breakable()
6236 q.text("code = ");
6237 q.text("%#x" % self.code)
6238 q.text(","); q.breakable()
6239 q.text("data = ");
6240 q.pp(self.data)
6241 q.breakable()
6242 q.text('}')
6243
6244error_msg.subtypes[6] = group_mod_failed_error_msg
6245
6246class group_modify(group_mod):
6247 version = 3
6248 type = 15
6249 command = 1
6250
6251 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
6252 if xid != None:
6253 self.xid = xid
6254 else:
6255 self.xid = None
6256 if group_type != None:
6257 self.group_type = group_type
6258 else:
6259 self.group_type = 0
6260 if group_id != None:
6261 self.group_id = group_id
6262 else:
6263 self.group_id = 0
6264 if buckets != None:
6265 self.buckets = buckets
6266 else:
6267 self.buckets = []
6268 return
6269
6270 def pack(self):
6271 packed = []
6272 packed.append(struct.pack("!B", self.version))
6273 packed.append(struct.pack("!B", self.type))
6274 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6275 packed.append(struct.pack("!L", self.xid))
6276 packed.append(struct.pack("!H", self.command))
6277 packed.append(struct.pack("!B", self.group_type))
6278 packed.append('\x00' * 1)
6279 packed.append(struct.pack("!L", self.group_id))
6280 packed.append(loxi.generic_util.pack_list(self.buckets))
6281 length = sum([len(x) for x in packed])
6282 packed[2] = struct.pack("!H", length)
6283 return ''.join(packed)
6284
6285 @staticmethod
6286 def unpack(reader):
6287 obj = group_modify()
6288 _version = reader.read("!B")[0]
6289 assert(_version == 3)
6290 _type = reader.read("!B")[0]
6291 assert(_type == 15)
6292 _length = reader.read("!H")[0]
6293 orig_reader = reader
6294 reader = orig_reader.slice(_length, 4)
6295 obj.xid = reader.read("!L")[0]
6296 _command = reader.read("!H")[0]
6297 assert(_command == 1)
6298 obj.group_type = reader.read("!B")[0]
6299 reader.skip(1)
6300 obj.group_id = reader.read("!L")[0]
6301 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
6302 return obj
6303
6304 def __eq__(self, other):
6305 if type(self) != type(other): return False
6306 if self.xid != other.xid: return False
6307 if self.group_type != other.group_type: return False
6308 if self.group_id != other.group_id: return False
6309 if self.buckets != other.buckets: return False
6310 return True
6311
6312 def pretty_print(self, q):
6313 q.text("group_modify {")
6314 with q.group():
6315 with q.indent(2):
6316 q.breakable()
6317 q.text("xid = ");
6318 if self.xid != None:
6319 q.text("%#x" % self.xid)
6320 else:
6321 q.text('None')
6322 q.text(","); q.breakable()
6323 q.text("group_type = ");
6324 q.text("%#x" % self.group_type)
6325 q.text(","); q.breakable()
6326 q.text("group_id = ");
6327 q.text("%#x" % self.group_id)
6328 q.text(","); q.breakable()
6329 q.text("buckets = ");
6330 q.pp(self.buckets)
6331 q.breakable()
6332 q.text('}')
6333
6334group_mod.subtypes[1] = group_modify
6335
6336class group_stats_reply(stats_reply):
6337 version = 3
6338 type = 19
6339 stats_type = 6
6340
6341 def __init__(self, xid=None, flags=None, entries=None):
6342 if xid != None:
6343 self.xid = xid
6344 else:
6345 self.xid = None
6346 if flags != None:
6347 self.flags = flags
6348 else:
6349 self.flags = 0
6350 if entries != None:
6351 self.entries = entries
6352 else:
6353 self.entries = []
6354 return
6355
6356 def pack(self):
6357 packed = []
6358 packed.append(struct.pack("!B", self.version))
6359 packed.append(struct.pack("!B", self.type))
6360 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6361 packed.append(struct.pack("!L", self.xid))
6362 packed.append(struct.pack("!H", self.stats_type))
6363 packed.append(struct.pack("!H", self.flags))
6364 packed.append('\x00' * 4)
6365 packed.append(loxi.generic_util.pack_list(self.entries))
6366 length = sum([len(x) for x in packed])
6367 packed[2] = struct.pack("!H", length)
6368 return ''.join(packed)
6369
6370 @staticmethod
6371 def unpack(reader):
6372 obj = group_stats_reply()
6373 _version = reader.read("!B")[0]
6374 assert(_version == 3)
6375 _type = reader.read("!B")[0]
6376 assert(_type == 19)
6377 _length = reader.read("!H")[0]
6378 orig_reader = reader
6379 reader = orig_reader.slice(_length, 4)
6380 obj.xid = reader.read("!L")[0]
6381 _stats_type = reader.read("!H")[0]
6382 assert(_stats_type == 6)
6383 obj.flags = reader.read("!H")[0]
6384 reader.skip(4)
6385 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
6386 return obj
6387
6388 def __eq__(self, other):
6389 if type(self) != type(other): return False
6390 if self.xid != other.xid: return False
6391 if self.flags != other.flags: return False
6392 if self.entries != other.entries: return False
6393 return True
6394
6395 def pretty_print(self, q):
6396 q.text("group_stats_reply {")
6397 with q.group():
6398 with q.indent(2):
6399 q.breakable()
6400 q.text("xid = ");
6401 if self.xid != None:
6402 q.text("%#x" % self.xid)
6403 else:
6404 q.text('None')
6405 q.text(","); q.breakable()
6406 q.text("flags = ");
6407 q.text("%#x" % self.flags)
6408 q.text(","); q.breakable()
6409 q.text("entries = ");
6410 q.pp(self.entries)
6411 q.breakable()
6412 q.text('}')
6413
6414stats_reply.subtypes[6] = group_stats_reply
6415
6416class group_stats_request(stats_request):
6417 version = 3
6418 type = 18
6419 stats_type = 6
6420
6421 def __init__(self, xid=None, flags=None, group_id=None):
6422 if xid != None:
6423 self.xid = xid
6424 else:
6425 self.xid = None
6426 if flags != None:
6427 self.flags = flags
6428 else:
6429 self.flags = 0
6430 if group_id != None:
6431 self.group_id = group_id
6432 else:
6433 self.group_id = 0
6434 return
6435
6436 def pack(self):
6437 packed = []
6438 packed.append(struct.pack("!B", self.version))
6439 packed.append(struct.pack("!B", self.type))
6440 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6441 packed.append(struct.pack("!L", self.xid))
6442 packed.append(struct.pack("!H", self.stats_type))
6443 packed.append(struct.pack("!H", self.flags))
6444 packed.append('\x00' * 4)
6445 packed.append(struct.pack("!L", self.group_id))
6446 packed.append('\x00' * 4)
6447 length = sum([len(x) for x in packed])
6448 packed[2] = struct.pack("!H", length)
6449 return ''.join(packed)
6450
6451 @staticmethod
6452 def unpack(reader):
6453 obj = group_stats_request()
6454 _version = reader.read("!B")[0]
6455 assert(_version == 3)
6456 _type = reader.read("!B")[0]
6457 assert(_type == 18)
6458 _length = reader.read("!H")[0]
6459 orig_reader = reader
6460 reader = orig_reader.slice(_length, 4)
6461 obj.xid = reader.read("!L")[0]
6462 _stats_type = reader.read("!H")[0]
6463 assert(_stats_type == 6)
6464 obj.flags = reader.read("!H")[0]
6465 reader.skip(4)
6466 obj.group_id = reader.read("!L")[0]
6467 reader.skip(4)
6468 return obj
6469
6470 def __eq__(self, other):
6471 if type(self) != type(other): return False
6472 if self.xid != other.xid: return False
6473 if self.flags != other.flags: return False
6474 if self.group_id != other.group_id: return False
6475 return True
6476
6477 def pretty_print(self, q):
6478 q.text("group_stats_request {")
6479 with q.group():
6480 with q.indent(2):
6481 q.breakable()
6482 q.text("xid = ");
6483 if self.xid != None:
6484 q.text("%#x" % self.xid)
6485 else:
6486 q.text('None')
6487 q.text(","); q.breakable()
6488 q.text("flags = ");
6489 q.text("%#x" % self.flags)
6490 q.text(","); q.breakable()
6491 q.text("group_id = ");
6492 q.text("%#x" % self.group_id)
6493 q.breakable()
6494 q.text('}')
6495
6496stats_request.subtypes[6] = group_stats_request
6497
6498class hello(message):
6499 version = 3
6500 type = 0
6501
6502 def __init__(self, xid=None):
6503 if xid != None:
6504 self.xid = xid
6505 else:
6506 self.xid = None
6507 return
6508
6509 def pack(self):
6510 packed = []
6511 packed.append(struct.pack("!B", self.version))
6512 packed.append(struct.pack("!B", self.type))
6513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6514 packed.append(struct.pack("!L", self.xid))
6515 length = sum([len(x) for x in packed])
6516 packed[2] = struct.pack("!H", length)
6517 return ''.join(packed)
6518
6519 @staticmethod
6520 def unpack(reader):
6521 obj = hello()
6522 _version = reader.read("!B")[0]
6523 assert(_version == 3)
6524 _type = reader.read("!B")[0]
6525 assert(_type == 0)
6526 _length = reader.read("!H")[0]
6527 orig_reader = reader
6528 reader = orig_reader.slice(_length, 4)
6529 obj.xid = reader.read("!L")[0]
6530 return obj
6531
6532 def __eq__(self, other):
6533 if type(self) != type(other): return False
6534 if self.xid != other.xid: return False
6535 return True
6536
6537 def pretty_print(self, q):
6538 q.text("hello {")
6539 with q.group():
6540 with q.indent(2):
6541 q.breakable()
6542 q.text("xid = ");
6543 if self.xid != None:
6544 q.text("%#x" % self.xid)
6545 else:
6546 q.text('None')
6547 q.breakable()
6548 q.text('}')
6549
6550message.subtypes[0] = hello
6551
6552class hello_failed_error_msg(error_msg):
6553 version = 3
6554 type = 1
6555 err_type = 0
6556
6557 def __init__(self, xid=None, code=None, data=None):
6558 if xid != None:
6559 self.xid = xid
6560 else:
6561 self.xid = None
6562 if code != None:
6563 self.code = code
6564 else:
6565 self.code = 0
6566 if data != None:
6567 self.data = data
6568 else:
6569 self.data = ''
6570 return
6571
6572 def pack(self):
6573 packed = []
6574 packed.append(struct.pack("!B", self.version))
6575 packed.append(struct.pack("!B", self.type))
6576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6577 packed.append(struct.pack("!L", self.xid))
6578 packed.append(struct.pack("!H", self.err_type))
6579 packed.append(struct.pack("!H", self.code))
6580 packed.append(self.data)
6581 length = sum([len(x) for x in packed])
6582 packed[2] = struct.pack("!H", length)
6583 return ''.join(packed)
6584
6585 @staticmethod
6586 def unpack(reader):
6587 obj = hello_failed_error_msg()
6588 _version = reader.read("!B")[0]
6589 assert(_version == 3)
6590 _type = reader.read("!B")[0]
6591 assert(_type == 1)
6592 _length = reader.read("!H")[0]
6593 orig_reader = reader
6594 reader = orig_reader.slice(_length, 4)
6595 obj.xid = reader.read("!L")[0]
6596 _err_type = reader.read("!H")[0]
6597 assert(_err_type == 0)
6598 obj.code = reader.read("!H")[0]
6599 obj.data = str(reader.read_all())
6600 return obj
6601
6602 def __eq__(self, other):
6603 if type(self) != type(other): return False
6604 if self.xid != other.xid: return False
6605 if self.code != other.code: return False
6606 if self.data != other.data: return False
6607 return True
6608
6609 def pretty_print(self, q):
6610 q.text("hello_failed_error_msg {")
6611 with q.group():
6612 with q.indent(2):
6613 q.breakable()
6614 q.text("xid = ");
6615 if self.xid != None:
6616 q.text("%#x" % self.xid)
6617 else:
6618 q.text('None')
6619 q.text(","); q.breakable()
6620 q.text("code = ");
6621 q.text("%#x" % self.code)
6622 q.text(","); q.breakable()
6623 q.text("data = ");
6624 q.pp(self.data)
6625 q.breakable()
6626 q.text('}')
6627
6628error_msg.subtypes[0] = hello_failed_error_msg
6629
6630class nicira_header(experimenter):
6631 subtypes = {}
6632
6633 version = 3
6634 type = 4
6635 experimenter = 8992
6636
6637 def __init__(self, xid=None, subtype=None):
6638 if xid != None:
6639 self.xid = xid
6640 else:
6641 self.xid = None
6642 if subtype != None:
6643 self.subtype = subtype
6644 else:
6645 self.subtype = 0
6646 return
6647
6648 def pack(self):
6649 packed = []
6650 packed.append(struct.pack("!B", self.version))
6651 packed.append(struct.pack("!B", self.type))
6652 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6653 packed.append(struct.pack("!L", self.xid))
6654 packed.append(struct.pack("!L", self.experimenter))
6655 packed.append(struct.pack("!L", self.subtype))
6656 length = sum([len(x) for x in packed])
6657 packed[2] = struct.pack("!H", length)
6658 return ''.join(packed)
6659
6660 @staticmethod
6661 def unpack(reader):
6662 subtype, = reader.peek('!L', 12)
6663 subclass = nicira_header.subtypes.get(subtype)
6664 if subclass:
6665 return subclass.unpack(reader)
6666
6667 obj = nicira_header()
6668 _version = reader.read("!B")[0]
6669 assert(_version == 3)
6670 _type = reader.read("!B")[0]
6671 assert(_type == 4)
6672 _length = reader.read("!H")[0]
6673 orig_reader = reader
6674 reader = orig_reader.slice(_length, 4)
6675 obj.xid = reader.read("!L")[0]
6676 _experimenter = reader.read("!L")[0]
6677 assert(_experimenter == 8992)
6678 obj.subtype = reader.read("!L")[0]
6679 return obj
6680
6681 def __eq__(self, other):
6682 if type(self) != type(other): return False
6683 if self.xid != other.xid: return False
6684 if self.subtype != other.subtype: return False
6685 return True
6686
6687 def pretty_print(self, q):
6688 q.text("nicira_header {")
6689 with q.group():
6690 with q.indent(2):
6691 q.breakable()
6692 q.text("xid = ");
6693 if self.xid != None:
6694 q.text("%#x" % self.xid)
6695 else:
6696 q.text('None')
6697 q.breakable()
6698 q.text('}')
6699
6700experimenter.subtypes[8992] = nicira_header
6701
6702class packet_in(message):
6703 version = 3
6704 type = 10
6705
6706 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None):
6707 if xid != None:
6708 self.xid = xid
6709 else:
6710 self.xid = None
6711 if buffer_id != None:
6712 self.buffer_id = buffer_id
6713 else:
6714 self.buffer_id = 0
6715 if total_len != None:
6716 self.total_len = total_len
6717 else:
6718 self.total_len = 0
6719 if reason != None:
6720 self.reason = reason
6721 else:
6722 self.reason = 0
6723 if table_id != None:
6724 self.table_id = table_id
6725 else:
6726 self.table_id = 0
6727 if match != None:
6728 self.match = match
6729 else:
6730 self.match = ofp.match()
6731 if data != None:
6732 self.data = data
6733 else:
6734 self.data = ''
6735 return
6736
6737 def pack(self):
6738 packed = []
6739 packed.append(struct.pack("!B", self.version))
6740 packed.append(struct.pack("!B", self.type))
6741 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6742 packed.append(struct.pack("!L", self.xid))
6743 packed.append(struct.pack("!L", self.buffer_id))
6744 packed.append(struct.pack("!H", self.total_len))
6745 packed.append(struct.pack("!B", self.reason))
6746 packed.append(struct.pack("!B", self.table_id))
6747 packed.append(self.match.pack())
6748 packed.append('\x00' * 2)
6749 packed.append(self.data)
6750 length = sum([len(x) for x in packed])
6751 packed[2] = struct.pack("!H", length)
6752 return ''.join(packed)
6753
6754 @staticmethod
6755 def unpack(reader):
6756 obj = packet_in()
6757 _version = reader.read("!B")[0]
6758 assert(_version == 3)
6759 _type = reader.read("!B")[0]
6760 assert(_type == 10)
6761 _length = reader.read("!H")[0]
6762 orig_reader = reader
6763 reader = orig_reader.slice(_length, 4)
6764 obj.xid = reader.read("!L")[0]
6765 obj.buffer_id = reader.read("!L")[0]
6766 obj.total_len = reader.read("!H")[0]
6767 obj.reason = reader.read("!B")[0]
6768 obj.table_id = reader.read("!B")[0]
6769 obj.match = ofp.match.unpack(reader)
6770 reader.skip(2)
6771 obj.data = str(reader.read_all())
6772 return obj
6773
6774 def __eq__(self, other):
6775 if type(self) != type(other): return False
6776 if self.xid != other.xid: return False
6777 if self.buffer_id != other.buffer_id: return False
6778 if self.total_len != other.total_len: return False
6779 if self.reason != other.reason: return False
6780 if self.table_id != other.table_id: return False
6781 if self.match != other.match: return False
6782 if self.data != other.data: return False
6783 return True
6784
6785 def pretty_print(self, q):
6786 q.text("packet_in {")
6787 with q.group():
6788 with q.indent(2):
6789 q.breakable()
6790 q.text("xid = ");
6791 if self.xid != None:
6792 q.text("%#x" % self.xid)
6793 else:
6794 q.text('None')
6795 q.text(","); q.breakable()
6796 q.text("buffer_id = ");
6797 q.text("%#x" % self.buffer_id)
6798 q.text(","); q.breakable()
6799 q.text("total_len = ");
6800 q.text("%#x" % self.total_len)
6801 q.text(","); q.breakable()
6802 q.text("reason = ");
6803 q.text("%#x" % self.reason)
6804 q.text(","); q.breakable()
6805 q.text("table_id = ");
6806 q.text("%#x" % self.table_id)
6807 q.text(","); q.breakable()
6808 q.text("match = ");
6809 q.pp(self.match)
6810 q.text(","); q.breakable()
6811 q.text("data = ");
6812 q.pp(self.data)
6813 q.breakable()
6814 q.text('}')
6815
6816message.subtypes[10] = packet_in
6817
6818class packet_out(message):
6819 version = 3
6820 type = 13
6821
6822 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
6823 if xid != None:
6824 self.xid = xid
6825 else:
6826 self.xid = None
6827 if buffer_id != None:
6828 self.buffer_id = buffer_id
6829 else:
6830 self.buffer_id = 0
6831 if in_port != None:
6832 self.in_port = in_port
6833 else:
6834 self.in_port = 0
6835 if actions != None:
6836 self.actions = actions
6837 else:
6838 self.actions = []
6839 if data != None:
6840 self.data = data
6841 else:
6842 self.data = ''
6843 return
6844
6845 def pack(self):
6846 packed = []
6847 packed.append(struct.pack("!B", self.version))
6848 packed.append(struct.pack("!B", self.type))
6849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6850 packed.append(struct.pack("!L", self.xid))
6851 packed.append(struct.pack("!L", self.buffer_id))
6852 packed.append(util.pack_port_no(self.in_port))
6853 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
6854 packed.append('\x00' * 6)
6855 packed.append(loxi.generic_util.pack_list(self.actions))
6856 packed[6] = struct.pack("!H", len(packed[-1]))
6857 packed.append(self.data)
6858 length = sum([len(x) for x in packed])
6859 packed[2] = struct.pack("!H", length)
6860 return ''.join(packed)
6861
6862 @staticmethod
6863 def unpack(reader):
6864 obj = packet_out()
6865 _version = reader.read("!B")[0]
6866 assert(_version == 3)
6867 _type = reader.read("!B")[0]
6868 assert(_type == 13)
6869 _length = reader.read("!H")[0]
6870 orig_reader = reader
6871 reader = orig_reader.slice(_length, 4)
6872 obj.xid = reader.read("!L")[0]
6873 obj.buffer_id = reader.read("!L")[0]
6874 obj.in_port = util.unpack_port_no(reader)
6875 _actions_len = reader.read("!H")[0]
6876 reader.skip(6)
6877 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
6878 obj.data = str(reader.read_all())
6879 return obj
6880
6881 def __eq__(self, other):
6882 if type(self) != type(other): return False
6883 if self.xid != other.xid: return False
6884 if self.buffer_id != other.buffer_id: return False
6885 if self.in_port != other.in_port: return False
6886 if self.actions != other.actions: return False
6887 if self.data != other.data: return False
6888 return True
6889
6890 def pretty_print(self, q):
6891 q.text("packet_out {")
6892 with q.group():
6893 with q.indent(2):
6894 q.breakable()
6895 q.text("xid = ");
6896 if self.xid != None:
6897 q.text("%#x" % self.xid)
6898 else:
6899 q.text('None')
6900 q.text(","); q.breakable()
6901 q.text("buffer_id = ");
6902 q.text("%#x" % self.buffer_id)
6903 q.text(","); q.breakable()
6904 q.text("in_port = ");
6905 q.text(util.pretty_port(self.in_port))
6906 q.text(","); q.breakable()
6907 q.text("actions = ");
6908 q.pp(self.actions)
6909 q.text(","); q.breakable()
6910 q.text("data = ");
6911 q.pp(self.data)
6912 q.breakable()
6913 q.text('}')
6914
6915message.subtypes[13] = packet_out
6916
6917class port_mod(message):
6918 version = 3
6919 type = 16
6920
6921 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
6922 if xid != None:
6923 self.xid = xid
6924 else:
6925 self.xid = None
6926 if port_no != None:
6927 self.port_no = port_no
6928 else:
6929 self.port_no = 0
6930 if hw_addr != None:
6931 self.hw_addr = hw_addr
6932 else:
6933 self.hw_addr = [0,0,0,0,0,0]
6934 if config != None:
6935 self.config = config
6936 else:
6937 self.config = 0
6938 if mask != None:
6939 self.mask = mask
6940 else:
6941 self.mask = 0
6942 if advertise != None:
6943 self.advertise = advertise
6944 else:
6945 self.advertise = 0
6946 return
6947
6948 def pack(self):
6949 packed = []
6950 packed.append(struct.pack("!B", self.version))
6951 packed.append(struct.pack("!B", self.type))
6952 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6953 packed.append(struct.pack("!L", self.xid))
6954 packed.append(util.pack_port_no(self.port_no))
6955 packed.append('\x00' * 4)
6956 packed.append(struct.pack("!6B", *self.hw_addr))
6957 packed.append('\x00' * 2)
6958 packed.append(struct.pack("!L", self.config))
6959 packed.append(struct.pack("!L", self.mask))
6960 packed.append(struct.pack("!L", self.advertise))
6961 packed.append('\x00' * 4)
6962 length = sum([len(x) for x in packed])
6963 packed[2] = struct.pack("!H", length)
6964 return ''.join(packed)
6965
6966 @staticmethod
6967 def unpack(reader):
6968 obj = port_mod()
6969 _version = reader.read("!B")[0]
6970 assert(_version == 3)
6971 _type = reader.read("!B")[0]
6972 assert(_type == 16)
6973 _length = reader.read("!H")[0]
6974 orig_reader = reader
6975 reader = orig_reader.slice(_length, 4)
6976 obj.xid = reader.read("!L")[0]
6977 obj.port_no = util.unpack_port_no(reader)
6978 reader.skip(4)
6979 obj.hw_addr = list(reader.read('!6B'))
6980 reader.skip(2)
6981 obj.config = reader.read("!L")[0]
6982 obj.mask = reader.read("!L")[0]
6983 obj.advertise = reader.read("!L")[0]
6984 reader.skip(4)
6985 return obj
6986
6987 def __eq__(self, other):
6988 if type(self) != type(other): return False
6989 if self.xid != other.xid: return False
6990 if self.port_no != other.port_no: return False
6991 if self.hw_addr != other.hw_addr: return False
6992 if self.config != other.config: return False
6993 if self.mask != other.mask: return False
6994 if self.advertise != other.advertise: return False
6995 return True
6996
6997 def pretty_print(self, q):
6998 q.text("port_mod {")
6999 with q.group():
7000 with q.indent(2):
7001 q.breakable()
7002 q.text("xid = ");
7003 if self.xid != None:
7004 q.text("%#x" % self.xid)
7005 else:
7006 q.text('None')
7007 q.text(","); q.breakable()
7008 q.text("port_no = ");
7009 q.text(util.pretty_port(self.port_no))
7010 q.text(","); q.breakable()
7011 q.text("hw_addr = ");
7012 q.text(util.pretty_mac(self.hw_addr))
7013 q.text(","); q.breakable()
7014 q.text("config = ");
7015 q.text("%#x" % self.config)
7016 q.text(","); q.breakable()
7017 q.text("mask = ");
7018 q.text("%#x" % self.mask)
7019 q.text(","); q.breakable()
7020 q.text("advertise = ");
7021 q.text("%#x" % self.advertise)
7022 q.breakable()
7023 q.text('}')
7024
7025message.subtypes[16] = port_mod
7026
7027class port_mod_failed_error_msg(error_msg):
7028 version = 3
7029 type = 1
7030 err_type = 7
7031
7032 def __init__(self, xid=None, code=None, data=None):
7033 if xid != None:
7034 self.xid = xid
7035 else:
7036 self.xid = None
7037 if code != None:
7038 self.code = code
7039 else:
7040 self.code = 0
7041 if data != None:
7042 self.data = data
7043 else:
7044 self.data = ''
7045 return
7046
7047 def pack(self):
7048 packed = []
7049 packed.append(struct.pack("!B", self.version))
7050 packed.append(struct.pack("!B", self.type))
7051 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7052 packed.append(struct.pack("!L", self.xid))
7053 packed.append(struct.pack("!H", self.err_type))
7054 packed.append(struct.pack("!H", self.code))
7055 packed.append(self.data)
7056 length = sum([len(x) for x in packed])
7057 packed[2] = struct.pack("!H", length)
7058 return ''.join(packed)
7059
7060 @staticmethod
7061 def unpack(reader):
7062 obj = port_mod_failed_error_msg()
7063 _version = reader.read("!B")[0]
7064 assert(_version == 3)
7065 _type = reader.read("!B")[0]
7066 assert(_type == 1)
7067 _length = reader.read("!H")[0]
7068 orig_reader = reader
7069 reader = orig_reader.slice(_length, 4)
7070 obj.xid = reader.read("!L")[0]
7071 _err_type = reader.read("!H")[0]
7072 assert(_err_type == 7)
7073 obj.code = reader.read("!H")[0]
7074 obj.data = str(reader.read_all())
7075 return obj
7076
7077 def __eq__(self, other):
7078 if type(self) != type(other): return False
7079 if self.xid != other.xid: return False
7080 if self.code != other.code: return False
7081 if self.data != other.data: return False
7082 return True
7083
7084 def pretty_print(self, q):
7085 q.text("port_mod_failed_error_msg {")
7086 with q.group():
7087 with q.indent(2):
7088 q.breakable()
7089 q.text("xid = ");
7090 if self.xid != None:
7091 q.text("%#x" % self.xid)
7092 else:
7093 q.text('None')
7094 q.text(","); q.breakable()
7095 q.text("code = ");
7096 q.text("%#x" % self.code)
7097 q.text(","); q.breakable()
7098 q.text("data = ");
7099 q.pp(self.data)
7100 q.breakable()
7101 q.text('}')
7102
7103error_msg.subtypes[7] = port_mod_failed_error_msg
7104
7105class port_stats_reply(stats_reply):
7106 version = 3
7107 type = 19
7108 stats_type = 4
7109
7110 def __init__(self, xid=None, flags=None, entries=None):
7111 if xid != None:
7112 self.xid = xid
7113 else:
7114 self.xid = None
7115 if flags != None:
7116 self.flags = flags
7117 else:
7118 self.flags = 0
7119 if entries != None:
7120 self.entries = entries
7121 else:
7122 self.entries = []
7123 return
7124
7125 def pack(self):
7126 packed = []
7127 packed.append(struct.pack("!B", self.version))
7128 packed.append(struct.pack("!B", self.type))
7129 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7130 packed.append(struct.pack("!L", self.xid))
7131 packed.append(struct.pack("!H", self.stats_type))
7132 packed.append(struct.pack("!H", self.flags))
7133 packed.append('\x00' * 4)
7134 packed.append(loxi.generic_util.pack_list(self.entries))
7135 length = sum([len(x) for x in packed])
7136 packed[2] = struct.pack("!H", length)
7137 return ''.join(packed)
7138
7139 @staticmethod
7140 def unpack(reader):
7141 obj = port_stats_reply()
7142 _version = reader.read("!B")[0]
7143 assert(_version == 3)
7144 _type = reader.read("!B")[0]
7145 assert(_type == 19)
7146 _length = reader.read("!H")[0]
7147 orig_reader = reader
7148 reader = orig_reader.slice(_length, 4)
7149 obj.xid = reader.read("!L")[0]
7150 _stats_type = reader.read("!H")[0]
7151 assert(_stats_type == 4)
7152 obj.flags = reader.read("!H")[0]
7153 reader.skip(4)
7154 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
7155 return obj
7156
7157 def __eq__(self, other):
7158 if type(self) != type(other): return False
7159 if self.xid != other.xid: return False
7160 if self.flags != other.flags: return False
7161 if self.entries != other.entries: return False
7162 return True
7163
7164 def pretty_print(self, q):
7165 q.text("port_stats_reply {")
7166 with q.group():
7167 with q.indent(2):
7168 q.breakable()
7169 q.text("xid = ");
7170 if self.xid != None:
7171 q.text("%#x" % self.xid)
7172 else:
7173 q.text('None')
7174 q.text(","); q.breakable()
7175 q.text("flags = ");
7176 q.text("%#x" % self.flags)
7177 q.text(","); q.breakable()
7178 q.text("entries = ");
7179 q.pp(self.entries)
7180 q.breakable()
7181 q.text('}')
7182
7183stats_reply.subtypes[4] = port_stats_reply
7184
7185class port_stats_request(stats_request):
7186 version = 3
7187 type = 18
7188 stats_type = 4
7189
7190 def __init__(self, xid=None, flags=None, port_no=None):
7191 if xid != None:
7192 self.xid = xid
7193 else:
7194 self.xid = None
7195 if flags != None:
7196 self.flags = flags
7197 else:
7198 self.flags = 0
7199 if port_no != None:
7200 self.port_no = port_no
7201 else:
7202 self.port_no = 0
7203 return
7204
7205 def pack(self):
7206 packed = []
7207 packed.append(struct.pack("!B", self.version))
7208 packed.append(struct.pack("!B", self.type))
7209 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7210 packed.append(struct.pack("!L", self.xid))
7211 packed.append(struct.pack("!H", self.stats_type))
7212 packed.append(struct.pack("!H", self.flags))
7213 packed.append('\x00' * 4)
7214 packed.append(util.pack_port_no(self.port_no))
7215 packed.append('\x00' * 4)
7216 length = sum([len(x) for x in packed])
7217 packed[2] = struct.pack("!H", length)
7218 return ''.join(packed)
7219
7220 @staticmethod
7221 def unpack(reader):
7222 obj = port_stats_request()
7223 _version = reader.read("!B")[0]
7224 assert(_version == 3)
7225 _type = reader.read("!B")[0]
7226 assert(_type == 18)
7227 _length = reader.read("!H")[0]
7228 orig_reader = reader
7229 reader = orig_reader.slice(_length, 4)
7230 obj.xid = reader.read("!L")[0]
7231 _stats_type = reader.read("!H")[0]
7232 assert(_stats_type == 4)
7233 obj.flags = reader.read("!H")[0]
7234 reader.skip(4)
7235 obj.port_no = util.unpack_port_no(reader)
7236 reader.skip(4)
7237 return obj
7238
7239 def __eq__(self, other):
7240 if type(self) != type(other): return False
7241 if self.xid != other.xid: return False
7242 if self.flags != other.flags: return False
7243 if self.port_no != other.port_no: return False
7244 return True
7245
7246 def pretty_print(self, q):
7247 q.text("port_stats_request {")
7248 with q.group():
7249 with q.indent(2):
7250 q.breakable()
7251 q.text("xid = ");
7252 if self.xid != None:
7253 q.text("%#x" % self.xid)
7254 else:
7255 q.text('None')
7256 q.text(","); q.breakable()
7257 q.text("flags = ");
7258 q.text("%#x" % self.flags)
7259 q.text(","); q.breakable()
7260 q.text("port_no = ");
7261 q.text(util.pretty_port(self.port_no))
7262 q.breakable()
7263 q.text('}')
7264
7265stats_request.subtypes[4] = port_stats_request
7266
7267class port_status(message):
7268 version = 3
7269 type = 12
7270
7271 def __init__(self, xid=None, reason=None, desc=None):
7272 if xid != None:
7273 self.xid = xid
7274 else:
7275 self.xid = None
7276 if reason != None:
7277 self.reason = reason
7278 else:
7279 self.reason = 0
7280 if desc != None:
7281 self.desc = desc
7282 else:
7283 self.desc = ofp.port_desc()
7284 return
7285
7286 def pack(self):
7287 packed = []
7288 packed.append(struct.pack("!B", self.version))
7289 packed.append(struct.pack("!B", self.type))
7290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7291 packed.append(struct.pack("!L", self.xid))
7292 packed.append(struct.pack("!B", self.reason))
7293 packed.append('\x00' * 7)
7294 packed.append(self.desc.pack())
7295 length = sum([len(x) for x in packed])
7296 packed[2] = struct.pack("!H", length)
7297 return ''.join(packed)
7298
7299 @staticmethod
7300 def unpack(reader):
7301 obj = port_status()
7302 _version = reader.read("!B")[0]
7303 assert(_version == 3)
7304 _type = reader.read("!B")[0]
7305 assert(_type == 12)
7306 _length = reader.read("!H")[0]
7307 orig_reader = reader
7308 reader = orig_reader.slice(_length, 4)
7309 obj.xid = reader.read("!L")[0]
7310 obj.reason = reader.read("!B")[0]
7311 reader.skip(7)
7312 obj.desc = ofp.port_desc.unpack(reader)
7313 return obj
7314
7315 def __eq__(self, other):
7316 if type(self) != type(other): return False
7317 if self.xid != other.xid: return False
7318 if self.reason != other.reason: return False
7319 if self.desc != other.desc: return False
7320 return True
7321
7322 def pretty_print(self, q):
7323 q.text("port_status {")
7324 with q.group():
7325 with q.indent(2):
7326 q.breakable()
7327 q.text("xid = ");
7328 if self.xid != None:
7329 q.text("%#x" % self.xid)
7330 else:
7331 q.text('None')
7332 q.text(","); q.breakable()
7333 q.text("reason = ");
7334 q.text("%#x" % self.reason)
7335 q.text(","); q.breakable()
7336 q.text("desc = ");
7337 q.pp(self.desc)
7338 q.breakable()
7339 q.text('}')
7340
7341message.subtypes[12] = port_status
7342
7343class queue_get_config_reply(message):
7344 version = 3
7345 type = 23
7346
7347 def __init__(self, xid=None, port=None, queues=None):
7348 if xid != None:
7349 self.xid = xid
7350 else:
7351 self.xid = None
7352 if port != None:
7353 self.port = port
7354 else:
7355 self.port = 0
7356 if queues != None:
7357 self.queues = queues
7358 else:
7359 self.queues = []
7360 return
7361
7362 def pack(self):
7363 packed = []
7364 packed.append(struct.pack("!B", self.version))
7365 packed.append(struct.pack("!B", self.type))
7366 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7367 packed.append(struct.pack("!L", self.xid))
7368 packed.append(util.pack_port_no(self.port))
7369 packed.append('\x00' * 4)
7370 packed.append(loxi.generic_util.pack_list(self.queues))
7371 length = sum([len(x) for x in packed])
7372 packed[2] = struct.pack("!H", length)
7373 return ''.join(packed)
7374
7375 @staticmethod
7376 def unpack(reader):
7377 obj = queue_get_config_reply()
7378 _version = reader.read("!B")[0]
7379 assert(_version == 3)
7380 _type = reader.read("!B")[0]
7381 assert(_type == 23)
7382 _length = reader.read("!H")[0]
7383 orig_reader = reader
7384 reader = orig_reader.slice(_length, 4)
7385 obj.xid = reader.read("!L")[0]
7386 obj.port = util.unpack_port_no(reader)
7387 reader.skip(4)
7388 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
7389 return obj
7390
7391 def __eq__(self, other):
7392 if type(self) != type(other): return False
7393 if self.xid != other.xid: return False
7394 if self.port != other.port: return False
7395 if self.queues != other.queues: return False
7396 return True
7397
7398 def pretty_print(self, q):
7399 q.text("queue_get_config_reply {")
7400 with q.group():
7401 with q.indent(2):
7402 q.breakable()
7403 q.text("xid = ");
7404 if self.xid != None:
7405 q.text("%#x" % self.xid)
7406 else:
7407 q.text('None')
7408 q.text(","); q.breakable()
7409 q.text("port = ");
7410 q.text(util.pretty_port(self.port))
7411 q.text(","); q.breakable()
7412 q.text("queues = ");
7413 q.pp(self.queues)
7414 q.breakable()
7415 q.text('}')
7416
7417message.subtypes[23] = queue_get_config_reply
7418
7419class queue_get_config_request(message):
7420 version = 3
7421 type = 22
7422
7423 def __init__(self, xid=None, port=None):
7424 if xid != None:
7425 self.xid = xid
7426 else:
7427 self.xid = None
7428 if port != None:
7429 self.port = port
7430 else:
7431 self.port = 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(util.pack_port_no(self.port))
7441 packed.append('\x00' * 4)
7442 length = sum([len(x) for x in packed])
7443 packed[2] = struct.pack("!H", length)
7444 return ''.join(packed)
7445
7446 @staticmethod
7447 def unpack(reader):
7448 obj = queue_get_config_request()
7449 _version = reader.read("!B")[0]
7450 assert(_version == 3)
7451 _type = reader.read("!B")[0]
7452 assert(_type == 22)
7453 _length = reader.read("!H")[0]
7454 orig_reader = reader
7455 reader = orig_reader.slice(_length, 4)
7456 obj.xid = reader.read("!L")[0]
7457 obj.port = util.unpack_port_no(reader)
7458 reader.skip(4)
7459 return obj
7460
7461 def __eq__(self, other):
7462 if type(self) != type(other): return False
7463 if self.xid != other.xid: return False
7464 if self.port != other.port: return False
7465 return True
7466
7467 def pretty_print(self, q):
7468 q.text("queue_get_config_request {")
7469 with q.group():
7470 with q.indent(2):
7471 q.breakable()
7472 q.text("xid = ");
7473 if self.xid != None:
7474 q.text("%#x" % self.xid)
7475 else:
7476 q.text('None')
7477 q.text(","); q.breakable()
7478 q.text("port = ");
7479 q.text(util.pretty_port(self.port))
7480 q.breakable()
7481 q.text('}')
7482
7483message.subtypes[22] = queue_get_config_request
7484
7485class queue_op_failed_error_msg(error_msg):
7486 version = 3
7487 type = 1
7488 err_type = 9
7489
7490 def __init__(self, xid=None, code=None, data=None):
7491 if xid != None:
7492 self.xid = xid
7493 else:
7494 self.xid = None
7495 if code != None:
7496 self.code = code
7497 else:
7498 self.code = 0
7499 if data != None:
7500 self.data = data
7501 else:
7502 self.data = ''
7503 return
7504
7505 def pack(self):
7506 packed = []
7507 packed.append(struct.pack("!B", self.version))
7508 packed.append(struct.pack("!B", self.type))
7509 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7510 packed.append(struct.pack("!L", self.xid))
7511 packed.append(struct.pack("!H", self.err_type))
7512 packed.append(struct.pack("!H", self.code))
7513 packed.append(self.data)
7514 length = sum([len(x) for x in packed])
7515 packed[2] = struct.pack("!H", length)
7516 return ''.join(packed)
7517
7518 @staticmethod
7519 def unpack(reader):
7520 obj = queue_op_failed_error_msg()
7521 _version = reader.read("!B")[0]
7522 assert(_version == 3)
7523 _type = reader.read("!B")[0]
7524 assert(_type == 1)
7525 _length = reader.read("!H")[0]
7526 orig_reader = reader
7527 reader = orig_reader.slice(_length, 4)
7528 obj.xid = reader.read("!L")[0]
7529 _err_type = reader.read("!H")[0]
7530 assert(_err_type == 9)
7531 obj.code = reader.read("!H")[0]
7532 obj.data = str(reader.read_all())
7533 return obj
7534
7535 def __eq__(self, other):
7536 if type(self) != type(other): return False
7537 if self.xid != other.xid: return False
7538 if self.code != other.code: return False
7539 if self.data != other.data: return False
7540 return True
7541
7542 def pretty_print(self, q):
7543 q.text("queue_op_failed_error_msg {")
7544 with q.group():
7545 with q.indent(2):
7546 q.breakable()
7547 q.text("xid = ");
7548 if self.xid != None:
7549 q.text("%#x" % self.xid)
7550 else:
7551 q.text('None')
7552 q.text(","); q.breakable()
7553 q.text("code = ");
7554 q.text("%#x" % self.code)
7555 q.text(","); q.breakable()
7556 q.text("data = ");
7557 q.pp(self.data)
7558 q.breakable()
7559 q.text('}')
7560
7561error_msg.subtypes[9] = queue_op_failed_error_msg
7562
7563class queue_stats_reply(stats_reply):
7564 version = 3
7565 type = 19
7566 stats_type = 5
7567
7568 def __init__(self, xid=None, flags=None, entries=None):
7569 if xid != None:
7570 self.xid = xid
7571 else:
7572 self.xid = None
7573 if flags != None:
7574 self.flags = flags
7575 else:
7576 self.flags = 0
7577 if entries != None:
7578 self.entries = entries
7579 else:
7580 self.entries = []
7581 return
7582
7583 def pack(self):
7584 packed = []
7585 packed.append(struct.pack("!B", self.version))
7586 packed.append(struct.pack("!B", self.type))
7587 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7588 packed.append(struct.pack("!L", self.xid))
7589 packed.append(struct.pack("!H", self.stats_type))
7590 packed.append(struct.pack("!H", self.flags))
7591 packed.append('\x00' * 4)
7592 packed.append(loxi.generic_util.pack_list(self.entries))
7593 length = sum([len(x) for x in packed])
7594 packed[2] = struct.pack("!H", length)
7595 return ''.join(packed)
7596
7597 @staticmethod
7598 def unpack(reader):
7599 obj = queue_stats_reply()
7600 _version = reader.read("!B")[0]
7601 assert(_version == 3)
7602 _type = reader.read("!B")[0]
7603 assert(_type == 19)
7604 _length = reader.read("!H")[0]
7605 orig_reader = reader
7606 reader = orig_reader.slice(_length, 4)
7607 obj.xid = reader.read("!L")[0]
7608 _stats_type = reader.read("!H")[0]
7609 assert(_stats_type == 5)
7610 obj.flags = reader.read("!H")[0]
7611 reader.skip(4)
7612 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
7613 return obj
7614
7615 def __eq__(self, other):
7616 if type(self) != type(other): return False
7617 if self.xid != other.xid: return False
7618 if self.flags != other.flags: return False
7619 if self.entries != other.entries: return False
7620 return True
7621
7622 def pretty_print(self, q):
7623 q.text("queue_stats_reply {")
7624 with q.group():
7625 with q.indent(2):
7626 q.breakable()
7627 q.text("xid = ");
7628 if self.xid != None:
7629 q.text("%#x" % self.xid)
7630 else:
7631 q.text('None')
7632 q.text(","); q.breakable()
7633 q.text("flags = ");
7634 q.text("%#x" % self.flags)
7635 q.text(","); q.breakable()
7636 q.text("entries = ");
7637 q.pp(self.entries)
7638 q.breakable()
7639 q.text('}')
7640
7641stats_reply.subtypes[5] = queue_stats_reply
7642
7643class queue_stats_request(stats_request):
7644 version = 3
7645 type = 18
7646 stats_type = 5
7647
7648 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
7649 if xid != None:
7650 self.xid = xid
7651 else:
7652 self.xid = None
7653 if flags != None:
7654 self.flags = flags
7655 else:
7656 self.flags = 0
7657 if port_no != None:
7658 self.port_no = port_no
7659 else:
7660 self.port_no = 0
7661 if queue_id != None:
7662 self.queue_id = queue_id
7663 else:
7664 self.queue_id = 0
7665 return
7666
7667 def pack(self):
7668 packed = []
7669 packed.append(struct.pack("!B", self.version))
7670 packed.append(struct.pack("!B", self.type))
7671 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7672 packed.append(struct.pack("!L", self.xid))
7673 packed.append(struct.pack("!H", self.stats_type))
7674 packed.append(struct.pack("!H", self.flags))
7675 packed.append('\x00' * 4)
7676 packed.append(util.pack_port_no(self.port_no))
7677 packed.append(struct.pack("!L", self.queue_id))
7678 length = sum([len(x) for x in packed])
7679 packed[2] = struct.pack("!H", length)
7680 return ''.join(packed)
7681
7682 @staticmethod
7683 def unpack(reader):
7684 obj = queue_stats_request()
7685 _version = reader.read("!B")[0]
7686 assert(_version == 3)
7687 _type = reader.read("!B")[0]
7688 assert(_type == 18)
7689 _length = reader.read("!H")[0]
7690 orig_reader = reader
7691 reader = orig_reader.slice(_length, 4)
7692 obj.xid = reader.read("!L")[0]
7693 _stats_type = reader.read("!H")[0]
7694 assert(_stats_type == 5)
7695 obj.flags = reader.read("!H")[0]
7696 reader.skip(4)
7697 obj.port_no = util.unpack_port_no(reader)
7698 obj.queue_id = reader.read("!L")[0]
7699 return obj
7700
7701 def __eq__(self, other):
7702 if type(self) != type(other): return False
7703 if self.xid != other.xid: return False
7704 if self.flags != other.flags: return False
7705 if self.port_no != other.port_no: return False
7706 if self.queue_id != other.queue_id: return False
7707 return True
7708
7709 def pretty_print(self, q):
7710 q.text("queue_stats_request {")
7711 with q.group():
7712 with q.indent(2):
7713 q.breakable()
7714 q.text("xid = ");
7715 if self.xid != None:
7716 q.text("%#x" % self.xid)
7717 else:
7718 q.text('None')
7719 q.text(","); q.breakable()
7720 q.text("flags = ");
7721 q.text("%#x" % self.flags)
7722 q.text(","); q.breakable()
7723 q.text("port_no = ");
7724 q.text(util.pretty_port(self.port_no))
7725 q.text(","); q.breakable()
7726 q.text("queue_id = ");
7727 q.text("%#x" % self.queue_id)
7728 q.breakable()
7729 q.text('}')
7730
7731stats_request.subtypes[5] = queue_stats_request
7732
7733class role_reply(message):
7734 version = 3
7735 type = 25
7736
7737 def __init__(self, xid=None, role=None, generation_id=None):
7738 if xid != None:
7739 self.xid = xid
7740 else:
7741 self.xid = None
7742 if role != None:
7743 self.role = role
7744 else:
7745 self.role = 0
7746 if generation_id != None:
7747 self.generation_id = generation_id
7748 else:
7749 self.generation_id = 0
7750 return
7751
7752 def pack(self):
7753 packed = []
7754 packed.append(struct.pack("!B", self.version))
7755 packed.append(struct.pack("!B", self.type))
7756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7757 packed.append(struct.pack("!L", self.xid))
7758 packed.append(struct.pack("!L", self.role))
7759 packed.append('\x00' * 4)
7760 packed.append(struct.pack("!Q", self.generation_id))
7761 length = sum([len(x) for x in packed])
7762 packed[2] = struct.pack("!H", length)
7763 return ''.join(packed)
7764
7765 @staticmethod
7766 def unpack(reader):
7767 obj = role_reply()
7768 _version = reader.read("!B")[0]
7769 assert(_version == 3)
7770 _type = reader.read("!B")[0]
7771 assert(_type == 25)
7772 _length = reader.read("!H")[0]
7773 orig_reader = reader
7774 reader = orig_reader.slice(_length, 4)
7775 obj.xid = reader.read("!L")[0]
7776 obj.role = reader.read("!L")[0]
7777 reader.skip(4)
7778 obj.generation_id = reader.read("!Q")[0]
7779 return obj
7780
7781 def __eq__(self, other):
7782 if type(self) != type(other): return False
7783 if self.xid != other.xid: return False
7784 if self.role != other.role: return False
7785 if self.generation_id != other.generation_id: return False
7786 return True
7787
7788 def pretty_print(self, q):
7789 q.text("role_reply {")
7790 with q.group():
7791 with q.indent(2):
7792 q.breakable()
7793 q.text("xid = ");
7794 if self.xid != None:
7795 q.text("%#x" % self.xid)
7796 else:
7797 q.text('None')
7798 q.text(","); q.breakable()
7799 q.text("role = ");
7800 q.text("%#x" % self.role)
7801 q.text(","); q.breakable()
7802 q.text("generation_id = ");
7803 q.text("%#x" % self.generation_id)
7804 q.breakable()
7805 q.text('}')
7806
7807message.subtypes[25] = role_reply
7808
7809class role_request(message):
7810 version = 3
7811 type = 24
7812
7813 def __init__(self, xid=None, role=None, generation_id=None):
7814 if xid != None:
7815 self.xid = xid
7816 else:
7817 self.xid = None
7818 if role != None:
7819 self.role = role
7820 else:
7821 self.role = 0
7822 if generation_id != None:
7823 self.generation_id = generation_id
7824 else:
7825 self.generation_id = 0
7826 return
7827
7828 def pack(self):
7829 packed = []
7830 packed.append(struct.pack("!B", self.version))
7831 packed.append(struct.pack("!B", self.type))
7832 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7833 packed.append(struct.pack("!L", self.xid))
7834 packed.append(struct.pack("!L", self.role))
7835 packed.append('\x00' * 4)
7836 packed.append(struct.pack("!Q", self.generation_id))
7837 length = sum([len(x) for x in packed])
7838 packed[2] = struct.pack("!H", length)
7839 return ''.join(packed)
7840
7841 @staticmethod
7842 def unpack(reader):
7843 obj = role_request()
7844 _version = reader.read("!B")[0]
7845 assert(_version == 3)
7846 _type = reader.read("!B")[0]
7847 assert(_type == 24)
7848 _length = reader.read("!H")[0]
7849 orig_reader = reader
7850 reader = orig_reader.slice(_length, 4)
7851 obj.xid = reader.read("!L")[0]
7852 obj.role = reader.read("!L")[0]
7853 reader.skip(4)
7854 obj.generation_id = reader.read("!Q")[0]
7855 return obj
7856
7857 def __eq__(self, other):
7858 if type(self) != type(other): return False
7859 if self.xid != other.xid: return False
7860 if self.role != other.role: return False
7861 if self.generation_id != other.generation_id: return False
7862 return True
7863
7864 def pretty_print(self, q):
7865 q.text("role_request {")
7866 with q.group():
7867 with q.indent(2):
7868 q.breakable()
7869 q.text("xid = ");
7870 if self.xid != None:
7871 q.text("%#x" % self.xid)
7872 else:
7873 q.text('None')
7874 q.text(","); q.breakable()
7875 q.text("role = ");
7876 q.text("%#x" % self.role)
7877 q.text(","); q.breakable()
7878 q.text("generation_id = ");
7879 q.text("%#x" % self.generation_id)
7880 q.breakable()
7881 q.text('}')
7882
7883message.subtypes[24] = role_request
7884
7885class role_request_failed_error_msg(error_msg):
7886 version = 3
7887 type = 1
7888 err_type = 11
7889
7890 def __init__(self, xid=None, code=None, data=None):
7891 if xid != None:
7892 self.xid = xid
7893 else:
7894 self.xid = None
7895 if code != None:
7896 self.code = code
7897 else:
7898 self.code = 0
7899 if data != None:
7900 self.data = data
7901 else:
7902 self.data = ''
7903 return
7904
7905 def pack(self):
7906 packed = []
7907 packed.append(struct.pack("!B", self.version))
7908 packed.append(struct.pack("!B", self.type))
7909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7910 packed.append(struct.pack("!L", self.xid))
7911 packed.append(struct.pack("!H", self.err_type))
7912 packed.append(struct.pack("!H", self.code))
7913 packed.append(self.data)
7914 length = sum([len(x) for x in packed])
7915 packed[2] = struct.pack("!H", length)
7916 return ''.join(packed)
7917
7918 @staticmethod
7919 def unpack(reader):
7920 obj = role_request_failed_error_msg()
7921 _version = reader.read("!B")[0]
7922 assert(_version == 3)
7923 _type = reader.read("!B")[0]
7924 assert(_type == 1)
7925 _length = reader.read("!H")[0]
7926 orig_reader = reader
7927 reader = orig_reader.slice(_length, 4)
7928 obj.xid = reader.read("!L")[0]
7929 _err_type = reader.read("!H")[0]
7930 assert(_err_type == 11)
7931 obj.code = reader.read("!H")[0]
7932 obj.data = str(reader.read_all())
7933 return obj
7934
7935 def __eq__(self, other):
7936 if type(self) != type(other): return False
7937 if self.xid != other.xid: return False
7938 if self.code != other.code: return False
7939 if self.data != other.data: return False
7940 return True
7941
7942 def pretty_print(self, q):
7943 q.text("role_request_failed_error_msg {")
7944 with q.group():
7945 with q.indent(2):
7946 q.breakable()
7947 q.text("xid = ");
7948 if self.xid != None:
7949 q.text("%#x" % self.xid)
7950 else:
7951 q.text('None')
7952 q.text(","); q.breakable()
7953 q.text("code = ");
7954 q.text("%#x" % self.code)
7955 q.text(","); q.breakable()
7956 q.text("data = ");
7957 q.pp(self.data)
7958 q.breakable()
7959 q.text('}')
7960
7961error_msg.subtypes[11] = role_request_failed_error_msg
7962
7963class set_config(message):
7964 version = 3
7965 type = 9
7966
7967 def __init__(self, xid=None, flags=None, miss_send_len=None):
7968 if xid != None:
7969 self.xid = xid
7970 else:
7971 self.xid = None
7972 if flags != None:
7973 self.flags = flags
7974 else:
7975 self.flags = 0
7976 if miss_send_len != None:
7977 self.miss_send_len = miss_send_len
7978 else:
7979 self.miss_send_len = 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("!H", self.flags))
7989 packed.append(struct.pack("!H", self.miss_send_len))
7990 length = sum([len(x) for x in packed])
7991 packed[2] = struct.pack("!H", length)
7992 return ''.join(packed)
7993
7994 @staticmethod
7995 def unpack(reader):
7996 obj = set_config()
7997 _version = reader.read("!B")[0]
7998 assert(_version == 3)
7999 _type = reader.read("!B")[0]
8000 assert(_type == 9)
8001 _length = reader.read("!H")[0]
8002 orig_reader = reader
8003 reader = orig_reader.slice(_length, 4)
8004 obj.xid = reader.read("!L")[0]
8005 obj.flags = reader.read("!H")[0]
8006 obj.miss_send_len = reader.read("!H")[0]
8007 return obj
8008
8009 def __eq__(self, other):
8010 if type(self) != type(other): return False
8011 if self.xid != other.xid: return False
8012 if self.flags != other.flags: return False
8013 if self.miss_send_len != other.miss_send_len: return False
8014 return True
8015
8016 def pretty_print(self, q):
8017 q.text("set_config {")
8018 with q.group():
8019 with q.indent(2):
8020 q.breakable()
8021 q.text("xid = ");
8022 if self.xid != None:
8023 q.text("%#x" % self.xid)
8024 else:
8025 q.text('None')
8026 q.text(","); q.breakable()
8027 q.text("flags = ");
8028 q.text("%#x" % self.flags)
8029 q.text(","); q.breakable()
8030 q.text("miss_send_len = ");
8031 q.text("%#x" % self.miss_send_len)
8032 q.breakable()
8033 q.text('}')
8034
8035message.subtypes[9] = set_config
8036
8037class switch_config_failed_error_msg(error_msg):
8038 version = 3
8039 type = 1
8040 err_type = 10
8041
8042 def __init__(self, xid=None, code=None, data=None):
8043 if xid != None:
8044 self.xid = xid
8045 else:
8046 self.xid = None
8047 if code != None:
8048 self.code = code
8049 else:
8050 self.code = 0
8051 if data != None:
8052 self.data = data
8053 else:
8054 self.data = ''
8055 return
8056
8057 def pack(self):
8058 packed = []
8059 packed.append(struct.pack("!B", self.version))
8060 packed.append(struct.pack("!B", self.type))
8061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8062 packed.append(struct.pack("!L", self.xid))
8063 packed.append(struct.pack("!H", self.err_type))
8064 packed.append(struct.pack("!H", self.code))
8065 packed.append(self.data)
8066 length = sum([len(x) for x in packed])
8067 packed[2] = struct.pack("!H", length)
8068 return ''.join(packed)
8069
8070 @staticmethod
8071 def unpack(reader):
8072 obj = switch_config_failed_error_msg()
8073 _version = reader.read("!B")[0]
8074 assert(_version == 3)
8075 _type = reader.read("!B")[0]
8076 assert(_type == 1)
8077 _length = reader.read("!H")[0]
8078 orig_reader = reader
8079 reader = orig_reader.slice(_length, 4)
8080 obj.xid = reader.read("!L")[0]
8081 _err_type = reader.read("!H")[0]
8082 assert(_err_type == 10)
8083 obj.code = reader.read("!H")[0]
8084 obj.data = str(reader.read_all())
8085 return obj
8086
8087 def __eq__(self, other):
8088 if type(self) != type(other): return False
8089 if self.xid != other.xid: return False
8090 if self.code != other.code: return False
8091 if self.data != other.data: return False
8092 return True
8093
8094 def pretty_print(self, q):
8095 q.text("switch_config_failed_error_msg {")
8096 with q.group():
8097 with q.indent(2):
8098 q.breakable()
8099 q.text("xid = ");
8100 if self.xid != None:
8101 q.text("%#x" % self.xid)
8102 else:
8103 q.text('None')
8104 q.text(","); q.breakable()
8105 q.text("code = ");
8106 q.text("%#x" % self.code)
8107 q.text(","); q.breakable()
8108 q.text("data = ");
8109 q.pp(self.data)
8110 q.breakable()
8111 q.text('}')
8112
8113error_msg.subtypes[10] = switch_config_failed_error_msg
8114
8115class table_mod(message):
8116 version = 3
8117 type = 17
8118
8119 def __init__(self, xid=None, table_id=None, config=None):
8120 if xid != None:
8121 self.xid = xid
8122 else:
8123 self.xid = None
8124 if table_id != None:
8125 self.table_id = table_id
8126 else:
8127 self.table_id = 0
8128 if config != None:
8129 self.config = config
8130 else:
8131 self.config = 0
8132 return
8133
8134 def pack(self):
8135 packed = []
8136 packed.append(struct.pack("!B", self.version))
8137 packed.append(struct.pack("!B", self.type))
8138 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8139 packed.append(struct.pack("!L", self.xid))
8140 packed.append(struct.pack("!B", self.table_id))
8141 packed.append('\x00' * 3)
8142 packed.append(struct.pack("!L", self.config))
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 = table_mod()
8150 _version = reader.read("!B")[0]
8151 assert(_version == 3)
8152 _type = reader.read("!B")[0]
8153 assert(_type == 17)
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 obj.table_id = reader.read("!B")[0]
8159 reader.skip(3)
8160 obj.config = reader.read("!L")[0]
8161 return obj
8162
8163 def __eq__(self, other):
8164 if type(self) != type(other): return False
8165 if self.xid != other.xid: return False
8166 if self.table_id != other.table_id: return False
8167 if self.config != other.config: return False
8168 return True
8169
8170 def pretty_print(self, q):
8171 q.text("table_mod {")
8172 with q.group():
8173 with q.indent(2):
8174 q.breakable()
8175 q.text("xid = ");
8176 if self.xid != None:
8177 q.text("%#x" % self.xid)
8178 else:
8179 q.text('None')
8180 q.text(","); q.breakable()
8181 q.text("table_id = ");
8182 q.text("%#x" % self.table_id)
8183 q.text(","); q.breakable()
8184 q.text("config = ");
8185 q.text("%#x" % self.config)
8186 q.breakable()
8187 q.text('}')
8188
8189message.subtypes[17] = table_mod
8190
8191class table_mod_failed_error_msg(error_msg):
8192 version = 3
8193 type = 1
8194 err_type = 8
8195
8196 def __init__(self, xid=None, code=None, data=None):
8197 if xid != None:
8198 self.xid = xid
8199 else:
8200 self.xid = None
8201 if code != None:
8202 self.code = code
8203 else:
8204 self.code = 0
8205 if data != None:
8206 self.data = data
8207 else:
8208 self.data = ''
8209 return
8210
8211 def pack(self):
8212 packed = []
8213 packed.append(struct.pack("!B", self.version))
8214 packed.append(struct.pack("!B", self.type))
8215 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8216 packed.append(struct.pack("!L", self.xid))
8217 packed.append(struct.pack("!H", self.err_type))
8218 packed.append(struct.pack("!H", self.code))
8219 packed.append(self.data)
8220 length = sum([len(x) for x in packed])
8221 packed[2] = struct.pack("!H", length)
8222 return ''.join(packed)
8223
8224 @staticmethod
8225 def unpack(reader):
8226 obj = table_mod_failed_error_msg()
8227 _version = reader.read("!B")[0]
8228 assert(_version == 3)
8229 _type = reader.read("!B")[0]
8230 assert(_type == 1)
8231 _length = reader.read("!H")[0]
8232 orig_reader = reader
8233 reader = orig_reader.slice(_length, 4)
8234 obj.xid = reader.read("!L")[0]
8235 _err_type = reader.read("!H")[0]
8236 assert(_err_type == 8)
8237 obj.code = reader.read("!H")[0]
8238 obj.data = str(reader.read_all())
8239 return obj
8240
8241 def __eq__(self, other):
8242 if type(self) != type(other): return False
8243 if self.xid != other.xid: return False
8244 if self.code != other.code: return False
8245 if self.data != other.data: return False
8246 return True
8247
8248 def pretty_print(self, q):
8249 q.text("table_mod_failed_error_msg {")
8250 with q.group():
8251 with q.indent(2):
8252 q.breakable()
8253 q.text("xid = ");
8254 if self.xid != None:
8255 q.text("%#x" % self.xid)
8256 else:
8257 q.text('None')
8258 q.text(","); q.breakable()
8259 q.text("code = ");
8260 q.text("%#x" % self.code)
8261 q.text(","); q.breakable()
8262 q.text("data = ");
8263 q.pp(self.data)
8264 q.breakable()
8265 q.text('}')
8266
8267error_msg.subtypes[8] = table_mod_failed_error_msg
8268
8269class table_stats_reply(stats_reply):
8270 version = 3
8271 type = 19
8272 stats_type = 3
8273
8274 def __init__(self, xid=None, flags=None, entries=None):
8275 if xid != None:
8276 self.xid = xid
8277 else:
8278 self.xid = None
8279 if flags != None:
8280 self.flags = flags
8281 else:
8282 self.flags = 0
8283 if entries != None:
8284 self.entries = entries
8285 else:
8286 self.entries = []
8287 return
8288
8289 def pack(self):
8290 packed = []
8291 packed.append(struct.pack("!B", self.version))
8292 packed.append(struct.pack("!B", self.type))
8293 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8294 packed.append(struct.pack("!L", self.xid))
8295 packed.append(struct.pack("!H", self.stats_type))
8296 packed.append(struct.pack("!H", self.flags))
8297 packed.append('\x00' * 4)
8298 packed.append(loxi.generic_util.pack_list(self.entries))
8299 length = sum([len(x) for x in packed])
8300 packed[2] = struct.pack("!H", length)
8301 return ''.join(packed)
8302
8303 @staticmethod
8304 def unpack(reader):
8305 obj = table_stats_reply()
8306 _version = reader.read("!B")[0]
8307 assert(_version == 3)
8308 _type = reader.read("!B")[0]
8309 assert(_type == 19)
8310 _length = reader.read("!H")[0]
8311 orig_reader = reader
8312 reader = orig_reader.slice(_length, 4)
8313 obj.xid = reader.read("!L")[0]
8314 _stats_type = reader.read("!H")[0]
8315 assert(_stats_type == 3)
8316 obj.flags = reader.read("!H")[0]
8317 reader.skip(4)
8318 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
8319 return obj
8320
8321 def __eq__(self, other):
8322 if type(self) != type(other): return False
8323 if self.xid != other.xid: return False
8324 if self.flags != other.flags: return False
8325 if self.entries != other.entries: return False
8326 return True
8327
8328 def pretty_print(self, q):
8329 q.text("table_stats_reply {")
8330 with q.group():
8331 with q.indent(2):
8332 q.breakable()
8333 q.text("xid = ");
8334 if self.xid != None:
8335 q.text("%#x" % self.xid)
8336 else:
8337 q.text('None')
8338 q.text(","); q.breakable()
8339 q.text("flags = ");
8340 q.text("%#x" % self.flags)
8341 q.text(","); q.breakable()
8342 q.text("entries = ");
8343 q.pp(self.entries)
8344 q.breakable()
8345 q.text('}')
8346
8347stats_reply.subtypes[3] = table_stats_reply
8348
8349class table_stats_request(stats_request):
8350 version = 3
8351 type = 18
8352 stats_type = 3
8353
8354 def __init__(self, xid=None, flags=None):
8355 if xid != None:
8356 self.xid = xid
8357 else:
8358 self.xid = None
8359 if flags != None:
8360 self.flags = flags
8361 else:
8362 self.flags = 0
8363 return
8364
8365 def pack(self):
8366 packed = []
8367 packed.append(struct.pack("!B", self.version))
8368 packed.append(struct.pack("!B", self.type))
8369 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8370 packed.append(struct.pack("!L", self.xid))
8371 packed.append(struct.pack("!H", self.stats_type))
8372 packed.append(struct.pack("!H", self.flags))
8373 packed.append('\x00' * 4)
8374 length = sum([len(x) for x in packed])
8375 packed[2] = struct.pack("!H", length)
8376 return ''.join(packed)
8377
8378 @staticmethod
8379 def unpack(reader):
8380 obj = table_stats_request()
8381 _version = reader.read("!B")[0]
8382 assert(_version == 3)
8383 _type = reader.read("!B")[0]
8384 assert(_type == 18)
8385 _length = reader.read("!H")[0]
8386 orig_reader = reader
8387 reader = orig_reader.slice(_length, 4)
8388 obj.xid = reader.read("!L")[0]
8389 _stats_type = reader.read("!H")[0]
8390 assert(_stats_type == 3)
8391 obj.flags = reader.read("!H")[0]
8392 reader.skip(4)
8393 return obj
8394
8395 def __eq__(self, other):
8396 if type(self) != type(other): return False
8397 if self.xid != other.xid: return False
8398 if self.flags != other.flags: return False
8399 return True
8400
8401 def pretty_print(self, q):
8402 q.text("table_stats_request {")
8403 with q.group():
8404 with q.indent(2):
8405 q.breakable()
8406 q.text("xid = ");
8407 if self.xid != None:
8408 q.text("%#x" % self.xid)
8409 else:
8410 q.text('None')
8411 q.text(","); q.breakable()
8412 q.text("flags = ");
8413 q.text("%#x" % self.flags)
8414 q.breakable()
8415 q.text('}')
8416
8417stats_request.subtypes[3] = table_stats_request
8418
8419
8420def parse_header(buf):
8421 if len(buf) < 8:
8422 raise loxi.ProtocolError("too short to be an OpenFlow message")
8423 return struct.unpack_from("!BBHL", buf)
8424
8425def parse_message(buf):
8426 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
8427 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
8428 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
8429 if len(buf) != msg_len:
8430 raise loxi.ProtocolError("incorrect message size")
8431 return message.unpack(loxi.generic_util.OFReader(buf))