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