blob: 68dc3ab3b53016d59ccf29776954dc268dc78d49 [file] [log] [blame]
Zack Williams9731cdc2019-11-22 15:42:30 -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.
14# 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.of14']
29
30class message(loxi.OFObject):
31 subtypes = {}
32
33 version = 5
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 == 5)
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 = 5
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 == 5)
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 = 5
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 == 5)
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 = 5
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 == 5)
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 = 5
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 == 5)
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 = 5
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 == 5)
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 async_config_failed_error_msg(error_msg):
558 version = 5
559 type = 1
560 err_type = 15
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 = async_config_failed_error_msg()
593 _version = reader.read("!B")[0]
594 assert(_version == 5)
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 == 15)
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("async_config_failed_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[15] = async_config_failed_error_msg
634
635class async_get_reply(message):
636 version = 5
637 type = 27
638
639 def __init__(self, xid=None, properties=None):
640 if xid != None:
641 self.xid = xid
642 else:
643 self.xid = None
644 if properties != None:
645 self.properties = properties
646 else:
647 self.properties = []
648 return
649
650 def pack(self):
651 packed = []
652 packed.append(struct.pack("!B", self.version))
653 packed.append(struct.pack("!B", self.type))
654 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
655 packed.append(struct.pack("!L", self.xid))
656 packed.append(loxi.generic_util.pack_list(self.properties))
657 length = sum([len(x) for x in packed])
658 packed[2] = struct.pack("!H", length)
659 return ''.join(packed)
660
661 @staticmethod
662 def unpack(reader):
663 obj = async_get_reply()
664 _version = reader.read("!B")[0]
665 assert(_version == 5)
666 _type = reader.read("!B")[0]
667 assert(_type == 27)
668 _length = reader.read("!H")[0]
669 orig_reader = reader
670 reader = orig_reader.slice(_length, 4)
671 obj.xid = reader.read("!L")[0]
672 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
673 return obj
674
675 def __eq__(self, other):
676 if type(self) != type(other): return False
677 if self.xid != other.xid: return False
678 if self.properties != other.properties: return False
679 return True
680
681 def pretty_print(self, q):
682 q.text("async_get_reply {")
683 with q.group():
684 with q.indent(2):
685 q.breakable()
686 q.text("xid = ");
687 if self.xid != None:
688 q.text("%#x" % self.xid)
689 else:
690 q.text('None')
691 q.text(","); q.breakable()
692 q.text("properties = ");
693 q.pp(self.properties)
694 q.breakable()
695 q.text('}')
696
697message.subtypes[27] = async_get_reply
698
699class async_get_request(message):
700 version = 5
701 type = 26
702
703 def __init__(self, xid=None):
704 if xid != None:
705 self.xid = xid
706 else:
707 self.xid = None
708 return
709
710 def pack(self):
711 packed = []
712 packed.append(struct.pack("!B", self.version))
713 packed.append(struct.pack("!B", self.type))
714 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
715 packed.append(struct.pack("!L", self.xid))
716 length = sum([len(x) for x in packed])
717 packed[2] = struct.pack("!H", length)
718 return ''.join(packed)
719
720 @staticmethod
721 def unpack(reader):
722 obj = async_get_request()
723 _version = reader.read("!B")[0]
724 assert(_version == 5)
725 _type = reader.read("!B")[0]
726 assert(_type == 26)
727 _length = reader.read("!H")[0]
728 orig_reader = reader
729 reader = orig_reader.slice(_length, 4)
730 obj.xid = reader.read("!L")[0]
731 return obj
732
733 def __eq__(self, other):
734 if type(self) != type(other): return False
735 if self.xid != other.xid: return False
736 return True
737
738 def pretty_print(self, q):
739 q.text("async_get_request {")
740 with q.group():
741 with q.indent(2):
742 q.breakable()
743 q.text("xid = ");
744 if self.xid != None:
745 q.text("%#x" % self.xid)
746 else:
747 q.text('None')
748 q.breakable()
749 q.text('}')
750
751message.subtypes[26] = async_get_request
752
753class async_set(message):
754 version = 5
755 type = 28
756
757 def __init__(self, xid=None, properties=None):
758 if xid != None:
759 self.xid = xid
760 else:
761 self.xid = None
762 if properties != None:
763 self.properties = properties
764 else:
765 self.properties = []
766 return
767
768 def pack(self):
769 packed = []
770 packed.append(struct.pack("!B", self.version))
771 packed.append(struct.pack("!B", self.type))
772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
773 packed.append(struct.pack("!L", self.xid))
774 packed.append(loxi.generic_util.pack_list(self.properties))
775 length = sum([len(x) for x in packed])
776 packed[2] = struct.pack("!H", length)
777 return ''.join(packed)
778
779 @staticmethod
780 def unpack(reader):
781 obj = async_set()
782 _version = reader.read("!B")[0]
783 assert(_version == 5)
784 _type = reader.read("!B")[0]
785 assert(_type == 28)
786 _length = reader.read("!H")[0]
787 orig_reader = reader
788 reader = orig_reader.slice(_length, 4)
789 obj.xid = reader.read("!L")[0]
790 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
791 return obj
792
793 def __eq__(self, other):
794 if type(self) != type(other): return False
795 if self.xid != other.xid: return False
796 if self.properties != other.properties: return False
797 return True
798
799 def pretty_print(self, q):
800 q.text("async_set {")
801 with q.group():
802 with q.indent(2):
803 q.breakable()
804 q.text("xid = ");
805 if self.xid != None:
806 q.text("%#x" % self.xid)
807 else:
808 q.text('None')
809 q.text(","); q.breakable()
810 q.text("properties = ");
811 q.pp(self.properties)
812 q.breakable()
813 q.text('}')
814
815message.subtypes[28] = async_set
816
817class bad_action_error_msg(error_msg):
818 version = 5
819 type = 1
820 err_type = 2
821
822 def __init__(self, xid=None, code=None, data=None):
823 if xid != None:
824 self.xid = xid
825 else:
826 self.xid = None
827 if code != None:
828 self.code = code
829 else:
830 self.code = 0
831 if data != None:
832 self.data = data
833 else:
834 self.data = ''
835 return
836
837 def pack(self):
838 packed = []
839 packed.append(struct.pack("!B", self.version))
840 packed.append(struct.pack("!B", self.type))
841 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
842 packed.append(struct.pack("!L", self.xid))
843 packed.append(struct.pack("!H", self.err_type))
844 packed.append(struct.pack("!H", self.code))
845 packed.append(self.data)
846 length = sum([len(x) for x in packed])
847 packed[2] = struct.pack("!H", length)
848 return ''.join(packed)
849
850 @staticmethod
851 def unpack(reader):
852 obj = bad_action_error_msg()
853 _version = reader.read("!B")[0]
854 assert(_version == 5)
855 _type = reader.read("!B")[0]
856 assert(_type == 1)
857 _length = reader.read("!H")[0]
858 orig_reader = reader
859 reader = orig_reader.slice(_length, 4)
860 obj.xid = reader.read("!L")[0]
861 _err_type = reader.read("!H")[0]
862 assert(_err_type == 2)
863 obj.code = reader.read("!H")[0]
864 obj.data = str(reader.read_all())
865 return obj
866
867 def __eq__(self, other):
868 if type(self) != type(other): return False
869 if self.xid != other.xid: return False
870 if self.code != other.code: return False
871 if self.data != other.data: return False
872 return True
873
874 def pretty_print(self, q):
875 q.text("bad_action_error_msg {")
876 with q.group():
877 with q.indent(2):
878 q.breakable()
879 q.text("xid = ");
880 if self.xid != None:
881 q.text("%#x" % self.xid)
882 else:
883 q.text('None')
884 q.text(","); q.breakable()
885 q.text("code = ");
886 q.text("%#x" % self.code)
887 q.text(","); q.breakable()
888 q.text("data = ");
889 q.pp(self.data)
890 q.breakable()
891 q.text('}')
892
893error_msg.subtypes[2] = bad_action_error_msg
894
895class bad_instruction_error_msg(error_msg):
896 version = 5
897 type = 1
898 err_type = 3
899
900 def __init__(self, xid=None, code=None, data=None):
901 if xid != None:
902 self.xid = xid
903 else:
904 self.xid = None
905 if code != None:
906 self.code = code
907 else:
908 self.code = 0
909 if data != None:
910 self.data = data
911 else:
912 self.data = ''
913 return
914
915 def pack(self):
916 packed = []
917 packed.append(struct.pack("!B", self.version))
918 packed.append(struct.pack("!B", self.type))
919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
920 packed.append(struct.pack("!L", self.xid))
921 packed.append(struct.pack("!H", self.err_type))
922 packed.append(struct.pack("!H", self.code))
923 packed.append(self.data)
924 length = sum([len(x) for x in packed])
925 packed[2] = struct.pack("!H", length)
926 return ''.join(packed)
927
928 @staticmethod
929 def unpack(reader):
930 obj = bad_instruction_error_msg()
931 _version = reader.read("!B")[0]
932 assert(_version == 5)
933 _type = reader.read("!B")[0]
934 assert(_type == 1)
935 _length = reader.read("!H")[0]
936 orig_reader = reader
937 reader = orig_reader.slice(_length, 4)
938 obj.xid = reader.read("!L")[0]
939 _err_type = reader.read("!H")[0]
940 assert(_err_type == 3)
941 obj.code = reader.read("!H")[0]
942 obj.data = str(reader.read_all())
943 return obj
944
945 def __eq__(self, other):
946 if type(self) != type(other): return False
947 if self.xid != other.xid: return False
948 if self.code != other.code: return False
949 if self.data != other.data: return False
950 return True
951
952 def pretty_print(self, q):
953 q.text("bad_instruction_error_msg {")
954 with q.group():
955 with q.indent(2):
956 q.breakable()
957 q.text("xid = ");
958 if self.xid != None:
959 q.text("%#x" % self.xid)
960 else:
961 q.text('None')
962 q.text(","); q.breakable()
963 q.text("code = ");
964 q.text("%#x" % self.code)
965 q.text(","); q.breakable()
966 q.text("data = ");
967 q.pp(self.data)
968 q.breakable()
969 q.text('}')
970
971error_msg.subtypes[3] = bad_instruction_error_msg
972
973class bad_match_error_msg(error_msg):
974 version = 5
975 type = 1
976 err_type = 4
977
978 def __init__(self, xid=None, code=None, data=None):
979 if xid != None:
980 self.xid = xid
981 else:
982 self.xid = None
983 if code != None:
984 self.code = code
985 else:
986 self.code = 0
987 if data != None:
988 self.data = data
989 else:
990 self.data = ''
991 return
992
993 def pack(self):
994 packed = []
995 packed.append(struct.pack("!B", self.version))
996 packed.append(struct.pack("!B", self.type))
997 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
998 packed.append(struct.pack("!L", self.xid))
999 packed.append(struct.pack("!H", self.err_type))
1000 packed.append(struct.pack("!H", self.code))
1001 packed.append(self.data)
1002 length = sum([len(x) for x in packed])
1003 packed[2] = struct.pack("!H", length)
1004 return ''.join(packed)
1005
1006 @staticmethod
1007 def unpack(reader):
1008 obj = bad_match_error_msg()
1009 _version = reader.read("!B")[0]
1010 assert(_version == 5)
1011 _type = reader.read("!B")[0]
1012 assert(_type == 1)
1013 _length = reader.read("!H")[0]
1014 orig_reader = reader
1015 reader = orig_reader.slice(_length, 4)
1016 obj.xid = reader.read("!L")[0]
1017 _err_type = reader.read("!H")[0]
1018 assert(_err_type == 4)
1019 obj.code = reader.read("!H")[0]
1020 obj.data = str(reader.read_all())
1021 return obj
1022
1023 def __eq__(self, other):
1024 if type(self) != type(other): return False
1025 if self.xid != other.xid: return False
1026 if self.code != other.code: return False
1027 if self.data != other.data: return False
1028 return True
1029
1030 def pretty_print(self, q):
1031 q.text("bad_match_error_msg {")
1032 with q.group():
1033 with q.indent(2):
1034 q.breakable()
1035 q.text("xid = ");
1036 if self.xid != None:
1037 q.text("%#x" % self.xid)
1038 else:
1039 q.text('None')
1040 q.text(","); q.breakable()
1041 q.text("code = ");
1042 q.text("%#x" % self.code)
1043 q.text(","); q.breakable()
1044 q.text("data = ");
1045 q.pp(self.data)
1046 q.breakable()
1047 q.text('}')
1048
1049error_msg.subtypes[4] = bad_match_error_msg
1050
1051class bad_property_error_msg(error_msg):
1052 version = 5
1053 type = 1
1054 err_type = 14
1055
1056 def __init__(self, xid=None, code=None, data=None):
1057 if xid != None:
1058 self.xid = xid
1059 else:
1060 self.xid = None
1061 if code != None:
1062 self.code = code
1063 else:
1064 self.code = 0
1065 if data != None:
1066 self.data = data
1067 else:
1068 self.data = ''
1069 return
1070
1071 def pack(self):
1072 packed = []
1073 packed.append(struct.pack("!B", self.version))
1074 packed.append(struct.pack("!B", self.type))
1075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1076 packed.append(struct.pack("!L", self.xid))
1077 packed.append(struct.pack("!H", self.err_type))
1078 packed.append(struct.pack("!H", self.code))
1079 packed.append(self.data)
1080 length = sum([len(x) for x in packed])
1081 packed[2] = struct.pack("!H", length)
1082 return ''.join(packed)
1083
1084 @staticmethod
1085 def unpack(reader):
1086 obj = bad_property_error_msg()
1087 _version = reader.read("!B")[0]
1088 assert(_version == 5)
1089 _type = reader.read("!B")[0]
1090 assert(_type == 1)
1091 _length = reader.read("!H")[0]
1092 orig_reader = reader
1093 reader = orig_reader.slice(_length, 4)
1094 obj.xid = reader.read("!L")[0]
1095 _err_type = reader.read("!H")[0]
1096 assert(_err_type == 14)
1097 obj.code = reader.read("!H")[0]
1098 obj.data = str(reader.read_all())
1099 return obj
1100
1101 def __eq__(self, other):
1102 if type(self) != type(other): return False
1103 if self.xid != other.xid: return False
1104 if self.code != other.code: return False
1105 if self.data != other.data: return False
1106 return True
1107
1108 def pretty_print(self, q):
1109 q.text("bad_property_error_msg {")
1110 with q.group():
1111 with q.indent(2):
1112 q.breakable()
1113 q.text("xid = ");
1114 if self.xid != None:
1115 q.text("%#x" % self.xid)
1116 else:
1117 q.text('None')
1118 q.text(","); q.breakable()
1119 q.text("code = ");
1120 q.text("%#x" % self.code)
1121 q.text(","); q.breakable()
1122 q.text("data = ");
1123 q.pp(self.data)
1124 q.breakable()
1125 q.text('}')
1126
1127error_msg.subtypes[14] = bad_property_error_msg
1128
1129class bad_request_error_msg(error_msg):
1130 version = 5
1131 type = 1
1132 err_type = 1
1133
1134 def __init__(self, xid=None, code=None, data=None):
1135 if xid != None:
1136 self.xid = xid
1137 else:
1138 self.xid = None
1139 if code != None:
1140 self.code = code
1141 else:
1142 self.code = 0
1143 if data != None:
1144 self.data = data
1145 else:
1146 self.data = ''
1147 return
1148
1149 def pack(self):
1150 packed = []
1151 packed.append(struct.pack("!B", self.version))
1152 packed.append(struct.pack("!B", self.type))
1153 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1154 packed.append(struct.pack("!L", self.xid))
1155 packed.append(struct.pack("!H", self.err_type))
1156 packed.append(struct.pack("!H", self.code))
1157 packed.append(self.data)
1158 length = sum([len(x) for x in packed])
1159 packed[2] = struct.pack("!H", length)
1160 return ''.join(packed)
1161
1162 @staticmethod
1163 def unpack(reader):
1164 obj = bad_request_error_msg()
1165 _version = reader.read("!B")[0]
1166 assert(_version == 5)
1167 _type = reader.read("!B")[0]
1168 assert(_type == 1)
1169 _length = reader.read("!H")[0]
1170 orig_reader = reader
1171 reader = orig_reader.slice(_length, 4)
1172 obj.xid = reader.read("!L")[0]
1173 _err_type = reader.read("!H")[0]
1174 assert(_err_type == 1)
1175 obj.code = reader.read("!H")[0]
1176 obj.data = str(reader.read_all())
1177 return obj
1178
1179 def __eq__(self, other):
1180 if type(self) != type(other): return False
1181 if self.xid != other.xid: return False
1182 if self.code != other.code: return False
1183 if self.data != other.data: return False
1184 return True
1185
1186 def pretty_print(self, q):
1187 q.text("bad_request_error_msg {")
1188 with q.group():
1189 with q.indent(2):
1190 q.breakable()
1191 q.text("xid = ");
1192 if self.xid != None:
1193 q.text("%#x" % self.xid)
1194 else:
1195 q.text('None')
1196 q.text(","); q.breakable()
1197 q.text("code = ");
1198 q.text("%#x" % self.code)
1199 q.text(","); q.breakable()
1200 q.text("data = ");
1201 q.pp(self.data)
1202 q.breakable()
1203 q.text('}')
1204
1205error_msg.subtypes[1] = bad_request_error_msg
1206
1207class barrier_reply(message):
1208 version = 5
1209 type = 21
1210
1211 def __init__(self, xid=None):
1212 if xid != None:
1213 self.xid = xid
1214 else:
1215 self.xid = None
1216 return
1217
1218 def pack(self):
1219 packed = []
1220 packed.append(struct.pack("!B", self.version))
1221 packed.append(struct.pack("!B", self.type))
1222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1223 packed.append(struct.pack("!L", self.xid))
1224 length = sum([len(x) for x in packed])
1225 packed[2] = struct.pack("!H", length)
1226 return ''.join(packed)
1227
1228 @staticmethod
1229 def unpack(reader):
1230 obj = barrier_reply()
1231 _version = reader.read("!B")[0]
1232 assert(_version == 5)
1233 _type = reader.read("!B")[0]
1234 assert(_type == 21)
1235 _length = reader.read("!H")[0]
1236 orig_reader = reader
1237 reader = orig_reader.slice(_length, 4)
1238 obj.xid = reader.read("!L")[0]
1239 return obj
1240
1241 def __eq__(self, other):
1242 if type(self) != type(other): return False
1243 if self.xid != other.xid: return False
1244 return True
1245
1246 def pretty_print(self, q):
1247 q.text("barrier_reply {")
1248 with q.group():
1249 with q.indent(2):
1250 q.breakable()
1251 q.text("xid = ");
1252 if self.xid != None:
1253 q.text("%#x" % self.xid)
1254 else:
1255 q.text('None')
1256 q.breakable()
1257 q.text('}')
1258
1259message.subtypes[21] = barrier_reply
1260
1261class barrier_request(message):
1262 version = 5
1263 type = 20
1264
1265 def __init__(self, xid=None):
1266 if xid != None:
1267 self.xid = xid
1268 else:
1269 self.xid = None
1270 return
1271
1272 def pack(self):
1273 packed = []
1274 packed.append(struct.pack("!B", self.version))
1275 packed.append(struct.pack("!B", self.type))
1276 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1277 packed.append(struct.pack("!L", self.xid))
1278 length = sum([len(x) for x in packed])
1279 packed[2] = struct.pack("!H", length)
1280 return ''.join(packed)
1281
1282 @staticmethod
1283 def unpack(reader):
1284 obj = barrier_request()
1285 _version = reader.read("!B")[0]
1286 assert(_version == 5)
1287 _type = reader.read("!B")[0]
1288 assert(_type == 20)
1289 _length = reader.read("!H")[0]
1290 orig_reader = reader
1291 reader = orig_reader.slice(_length, 4)
1292 obj.xid = reader.read("!L")[0]
1293 return obj
1294
1295 def __eq__(self, other):
1296 if type(self) != type(other): return False
1297 if self.xid != other.xid: return False
1298 return True
1299
1300 def pretty_print(self, q):
1301 q.text("barrier_request {")
1302 with q.group():
1303 with q.indent(2):
1304 q.breakable()
1305 q.text("xid = ");
1306 if self.xid != None:
1307 q.text("%#x" % self.xid)
1308 else:
1309 q.text('None')
1310 q.breakable()
1311 q.text('}')
1312
1313message.subtypes[20] = barrier_request
1314
1315class experimenter(message):
1316 subtypes = {}
1317
1318 version = 5
1319 type = 4
1320
1321 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1322 if xid != None:
1323 self.xid = xid
1324 else:
1325 self.xid = None
1326 if experimenter != None:
1327 self.experimenter = experimenter
1328 else:
1329 self.experimenter = 0
1330 if subtype != None:
1331 self.subtype = subtype
1332 else:
1333 self.subtype = 0
1334 if data != None:
1335 self.data = data
1336 else:
1337 self.data = ''
1338 return
1339
1340 def pack(self):
1341 packed = []
1342 packed.append(struct.pack("!B", self.version))
1343 packed.append(struct.pack("!B", self.type))
1344 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1345 packed.append(struct.pack("!L", self.xid))
1346 packed.append(struct.pack("!L", self.experimenter))
1347 packed.append(struct.pack("!L", self.subtype))
1348 packed.append(self.data)
1349 length = sum([len(x) for x in packed])
1350 packed[2] = struct.pack("!H", length)
1351 return ''.join(packed)
1352
1353 @staticmethod
1354 def unpack(reader):
1355 subtype, = reader.peek('!L', 8)
1356 subclass = experimenter.subtypes.get(subtype)
1357 if subclass:
1358 return subclass.unpack(reader)
1359
1360 obj = experimenter()
1361 _version = reader.read("!B")[0]
1362 assert(_version == 5)
1363 _type = reader.read("!B")[0]
1364 assert(_type == 4)
1365 _length = reader.read("!H")[0]
1366 orig_reader = reader
1367 reader = orig_reader.slice(_length, 4)
1368 obj.xid = reader.read("!L")[0]
1369 obj.experimenter = reader.read("!L")[0]
1370 obj.subtype = reader.read("!L")[0]
1371 obj.data = str(reader.read_all())
1372 return obj
1373
1374 def __eq__(self, other):
1375 if type(self) != type(other): return False
1376 if self.xid != other.xid: return False
1377 if self.experimenter != other.experimenter: return False
1378 if self.subtype != other.subtype: return False
1379 if self.data != other.data: return False
1380 return True
1381
1382 def pretty_print(self, q):
1383 q.text("experimenter {")
1384 with q.group():
1385 with q.indent(2):
1386 q.breakable()
1387 q.text("xid = ");
1388 if self.xid != None:
1389 q.text("%#x" % self.xid)
1390 else:
1391 q.text('None')
1392 q.text(","); q.breakable()
1393 q.text("subtype = ");
1394 q.text("%#x" % self.subtype)
1395 q.text(","); q.breakable()
1396 q.text("data = ");
1397 q.pp(self.data)
1398 q.breakable()
1399 q.text('}')
1400
1401message.subtypes[4] = experimenter
1402
1403class bsn_header(experimenter):
1404 subtypes = {}
1405
1406 version = 5
1407 type = 4
1408 experimenter = 6035143
1409
1410 def __init__(self, xid=None, subtype=None):
1411 if xid != None:
1412 self.xid = xid
1413 else:
1414 self.xid = None
1415 if subtype != None:
1416 self.subtype = subtype
1417 else:
1418 self.subtype = 0
1419 return
1420
1421 def pack(self):
1422 packed = []
1423 packed.append(struct.pack("!B", self.version))
1424 packed.append(struct.pack("!B", self.type))
1425 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1426 packed.append(struct.pack("!L", self.xid))
1427 packed.append(struct.pack("!L", self.experimenter))
1428 packed.append(struct.pack("!L", self.subtype))
1429 length = sum([len(x) for x in packed])
1430 packed[2] = struct.pack("!H", length)
1431 return ''.join(packed)
1432
1433 @staticmethod
1434 def unpack(reader):
1435 subtype, = reader.peek('!L', 12)
1436 subclass = bsn_header.subtypes.get(subtype)
1437 if subclass:
1438 return subclass.unpack(reader)
1439
1440 obj = bsn_header()
1441 _version = reader.read("!B")[0]
1442 assert(_version == 5)
1443 _type = reader.read("!B")[0]
1444 assert(_type == 4)
1445 _length = reader.read("!H")[0]
1446 orig_reader = reader
1447 reader = orig_reader.slice(_length, 4)
1448 obj.xid = reader.read("!L")[0]
1449 _experimenter = reader.read("!L")[0]
1450 assert(_experimenter == 6035143)
1451 obj.subtype = reader.read("!L")[0]
1452 return obj
1453
1454 def __eq__(self, other):
1455 if type(self) != type(other): return False
1456 if self.xid != other.xid: return False
1457 if self.subtype != other.subtype: return False
1458 return True
1459
1460 def pretty_print(self, q):
1461 q.text("bsn_header {")
1462 with q.group():
1463 with q.indent(2):
1464 q.breakable()
1465 q.text("xid = ");
1466 if self.xid != None:
1467 q.text("%#x" % self.xid)
1468 else:
1469 q.text('None')
1470 q.breakable()
1471 q.text('}')
1472
1473experimenter.subtypes[6035143] = bsn_header
1474
1475class bsn_arp_idle(bsn_header):
1476 version = 5
1477 type = 4
1478 experimenter = 6035143
1479 subtype = 60
1480
1481 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1482 if xid != None:
1483 self.xid = xid
1484 else:
1485 self.xid = None
1486 if vlan_vid != None:
1487 self.vlan_vid = vlan_vid
1488 else:
1489 self.vlan_vid = 0
1490 if ipv4_addr != None:
1491 self.ipv4_addr = ipv4_addr
1492 else:
1493 self.ipv4_addr = 0
1494 return
1495
1496 def pack(self):
1497 packed = []
1498 packed.append(struct.pack("!B", self.version))
1499 packed.append(struct.pack("!B", self.type))
1500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1501 packed.append(struct.pack("!L", self.xid))
1502 packed.append(struct.pack("!L", self.experimenter))
1503 packed.append(struct.pack("!L", self.subtype))
1504 packed.append(struct.pack("!H", self.vlan_vid))
1505 packed.append('\x00' * 2)
1506 packed.append(struct.pack("!L", self.ipv4_addr))
1507 length = sum([len(x) for x in packed])
1508 packed[2] = struct.pack("!H", length)
1509 return ''.join(packed)
1510
1511 @staticmethod
1512 def unpack(reader):
1513 obj = bsn_arp_idle()
1514 _version = reader.read("!B")[0]
1515 assert(_version == 5)
1516 _type = reader.read("!B")[0]
1517 assert(_type == 4)
1518 _length = reader.read("!H")[0]
1519 orig_reader = reader
1520 reader = orig_reader.slice(_length, 4)
1521 obj.xid = reader.read("!L")[0]
1522 _experimenter = reader.read("!L")[0]
1523 assert(_experimenter == 6035143)
1524 _subtype = reader.read("!L")[0]
1525 assert(_subtype == 60)
1526 obj.vlan_vid = reader.read("!H")[0]
1527 reader.skip(2)
1528 obj.ipv4_addr = reader.read("!L")[0]
1529 return obj
1530
1531 def __eq__(self, other):
1532 if type(self) != type(other): return False
1533 if self.xid != other.xid: return False
1534 if self.vlan_vid != other.vlan_vid: return False
1535 if self.ipv4_addr != other.ipv4_addr: return False
1536 return True
1537
1538 def pretty_print(self, q):
1539 q.text("bsn_arp_idle {")
1540 with q.group():
1541 with q.indent(2):
1542 q.breakable()
1543 q.text("xid = ");
1544 if self.xid != None:
1545 q.text("%#x" % self.xid)
1546 else:
1547 q.text('None')
1548 q.text(","); q.breakable()
1549 q.text("vlan_vid = ");
1550 q.text("%#x" % self.vlan_vid)
1551 q.text(","); q.breakable()
1552 q.text("ipv4_addr = ");
1553 q.text(util.pretty_ipv4(self.ipv4_addr))
1554 q.breakable()
1555 q.text('}')
1556
1557bsn_header.subtypes[60] = bsn_arp_idle
1558
1559class experimenter_error_msg(error_msg):
1560 subtypes = {}
1561
1562 version = 5
1563 type = 1
1564 err_type = 65535
1565
1566 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
1567 if xid != None:
1568 self.xid = xid
1569 else:
1570 self.xid = None
1571 if subtype != None:
1572 self.subtype = subtype
1573 else:
1574 self.subtype = 0
1575 if experimenter != None:
1576 self.experimenter = experimenter
1577 else:
1578 self.experimenter = 0
1579 if data != None:
1580 self.data = data
1581 else:
1582 self.data = ''
1583 return
1584
1585 def pack(self):
1586 packed = []
1587 packed.append(struct.pack("!B", self.version))
1588 packed.append(struct.pack("!B", self.type))
1589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1590 packed.append(struct.pack("!L", self.xid))
1591 packed.append(struct.pack("!H", self.err_type))
1592 packed.append(struct.pack("!H", self.subtype))
1593 packed.append(struct.pack("!L", self.experimenter))
1594 packed.append(self.data)
1595 length = sum([len(x) for x in packed])
1596 packed[2] = struct.pack("!H", length)
1597 return ''.join(packed)
1598
1599 @staticmethod
1600 def unpack(reader):
1601 subtype, = reader.peek('!L', 12)
1602 subclass = experimenter_error_msg.subtypes.get(subtype)
1603 if subclass:
1604 return subclass.unpack(reader)
1605
1606 obj = experimenter_error_msg()
1607 _version = reader.read("!B")[0]
1608 assert(_version == 5)
1609 _type = reader.read("!B")[0]
1610 assert(_type == 1)
1611 _length = reader.read("!H")[0]
1612 orig_reader = reader
1613 reader = orig_reader.slice(_length, 4)
1614 obj.xid = reader.read("!L")[0]
1615 _err_type = reader.read("!H")[0]
1616 assert(_err_type == 65535)
1617 obj.subtype = reader.read("!H")[0]
1618 obj.experimenter = reader.read("!L")[0]
1619 obj.data = str(reader.read_all())
1620 return obj
1621
1622 def __eq__(self, other):
1623 if type(self) != type(other): return False
1624 if self.xid != other.xid: return False
1625 if self.subtype != other.subtype: return False
1626 if self.experimenter != other.experimenter: return False
1627 if self.data != other.data: return False
1628 return True
1629
1630 def pretty_print(self, q):
1631 q.text("experimenter_error_msg {")
1632 with q.group():
1633 with q.indent(2):
1634 q.breakable()
1635 q.text("xid = ");
1636 if self.xid != None:
1637 q.text("%#x" % self.xid)
1638 else:
1639 q.text('None')
1640 q.text(","); q.breakable()
1641 q.text("subtype = ");
1642 q.text("%#x" % self.subtype)
1643 q.text(","); q.breakable()
1644 q.text("data = ");
1645 q.pp(self.data)
1646 q.breakable()
1647 q.text('}')
1648
1649error_msg.subtypes[65535] = experimenter_error_msg
1650
1651class bsn_base_error(experimenter_error_msg):
1652 subtypes = {}
1653
1654 version = 5
1655 type = 1
1656 err_type = 65535
1657 experimenter = 6035143
1658
1659 def __init__(self, xid=None, subtype=None, err_msg=None, data=None):
1660 if xid != None:
1661 self.xid = xid
1662 else:
1663 self.xid = None
1664 if subtype != None:
1665 self.subtype = subtype
1666 else:
1667 self.subtype = 0
1668 if err_msg != None:
1669 self.err_msg = err_msg
1670 else:
1671 self.err_msg = ""
1672 if data != None:
1673 self.data = data
1674 else:
1675 self.data = ''
1676 return
1677
1678 def pack(self):
1679 packed = []
1680 packed.append(struct.pack("!B", self.version))
1681 packed.append(struct.pack("!B", self.type))
1682 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1683 packed.append(struct.pack("!L", self.xid))
1684 packed.append(struct.pack("!H", self.err_type))
1685 packed.append(struct.pack("!H", self.subtype))
1686 packed.append(struct.pack("!L", self.experimenter))
1687 packed.append(struct.pack("!256s", self.err_msg))
1688 packed.append(self.data)
1689 length = sum([len(x) for x in packed])
1690 packed[2] = struct.pack("!H", length)
1691 return ''.join(packed)
1692
1693 @staticmethod
1694 def unpack(reader):
1695 subtype, = reader.peek('!H', 10)
1696 subclass = bsn_base_error.subtypes.get(subtype)
1697 if subclass:
1698 return subclass.unpack(reader)
1699
1700 obj = bsn_base_error()
1701 _version = reader.read("!B")[0]
1702 assert(_version == 5)
1703 _type = reader.read("!B")[0]
1704 assert(_type == 1)
1705 _length = reader.read("!H")[0]
1706 orig_reader = reader
1707 reader = orig_reader.slice(_length, 4)
1708 obj.xid = reader.read("!L")[0]
1709 _err_type = reader.read("!H")[0]
1710 assert(_err_type == 65535)
1711 obj.subtype = reader.read("!H")[0]
1712 _experimenter = reader.read("!L")[0]
1713 assert(_experimenter == 6035143)
1714 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
1715 obj.data = str(reader.read_all())
1716 return obj
1717
1718 def __eq__(self, other):
1719 if type(self) != type(other): return False
1720 if self.xid != other.xid: return False
1721 if self.subtype != other.subtype: return False
1722 if self.err_msg != other.err_msg: return False
1723 if self.data != other.data: return False
1724 return True
1725
1726 def pretty_print(self, q):
1727 q.text("bsn_base_error {")
1728 with q.group():
1729 with q.indent(2):
1730 q.breakable()
1731 q.text("xid = ");
1732 if self.xid != None:
1733 q.text("%#x" % self.xid)
1734 else:
1735 q.text('None')
1736 q.text(","); q.breakable()
1737 q.text("err_msg = ");
1738 q.pp(self.err_msg)
1739 q.text(","); q.breakable()
1740 q.text("data = ");
1741 q.pp(self.data)
1742 q.breakable()
1743 q.text('}')
1744
1745experimenter_error_msg.subtypes[6035143] = bsn_base_error
1746
1747class bsn_bw_clear_data_reply(bsn_header):
1748 version = 5
1749 type = 4
1750 experimenter = 6035143
1751 subtype = 22
1752
1753 def __init__(self, xid=None, status=None):
1754 if xid != None:
1755 self.xid = xid
1756 else:
1757 self.xid = None
1758 if status != None:
1759 self.status = status
1760 else:
1761 self.status = 0
1762 return
1763
1764 def pack(self):
1765 packed = []
1766 packed.append(struct.pack("!B", self.version))
1767 packed.append(struct.pack("!B", self.type))
1768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1769 packed.append(struct.pack("!L", self.xid))
1770 packed.append(struct.pack("!L", self.experimenter))
1771 packed.append(struct.pack("!L", self.subtype))
1772 packed.append(struct.pack("!L", self.status))
1773 length = sum([len(x) for x in packed])
1774 packed[2] = struct.pack("!H", length)
1775 return ''.join(packed)
1776
1777 @staticmethod
1778 def unpack(reader):
1779 obj = bsn_bw_clear_data_reply()
1780 _version = reader.read("!B")[0]
1781 assert(_version == 5)
1782 _type = reader.read("!B")[0]
1783 assert(_type == 4)
1784 _length = reader.read("!H")[0]
1785 orig_reader = reader
1786 reader = orig_reader.slice(_length, 4)
1787 obj.xid = reader.read("!L")[0]
1788 _experimenter = reader.read("!L")[0]
1789 assert(_experimenter == 6035143)
1790 _subtype = reader.read("!L")[0]
1791 assert(_subtype == 22)
1792 obj.status = reader.read("!L")[0]
1793 return obj
1794
1795 def __eq__(self, other):
1796 if type(self) != type(other): return False
1797 if self.xid != other.xid: return False
1798 if self.status != other.status: return False
1799 return True
1800
1801 def pretty_print(self, q):
1802 q.text("bsn_bw_clear_data_reply {")
1803 with q.group():
1804 with q.indent(2):
1805 q.breakable()
1806 q.text("xid = ");
1807 if self.xid != None:
1808 q.text("%#x" % self.xid)
1809 else:
1810 q.text('None')
1811 q.text(","); q.breakable()
1812 q.text("status = ");
1813 q.text("%#x" % self.status)
1814 q.breakable()
1815 q.text('}')
1816
1817bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1818
1819class bsn_bw_clear_data_request(bsn_header):
1820 version = 5
1821 type = 4
1822 experimenter = 6035143
1823 subtype = 21
1824
1825 def __init__(self, xid=None):
1826 if xid != None:
1827 self.xid = xid
1828 else:
1829 self.xid = None
1830 return
1831
1832 def pack(self):
1833 packed = []
1834 packed.append(struct.pack("!B", self.version))
1835 packed.append(struct.pack("!B", self.type))
1836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1837 packed.append(struct.pack("!L", self.xid))
1838 packed.append(struct.pack("!L", self.experimenter))
1839 packed.append(struct.pack("!L", self.subtype))
1840 length = sum([len(x) for x in packed])
1841 packed[2] = struct.pack("!H", length)
1842 return ''.join(packed)
1843
1844 @staticmethod
1845 def unpack(reader):
1846 obj = bsn_bw_clear_data_request()
1847 _version = reader.read("!B")[0]
1848 assert(_version == 5)
1849 _type = reader.read("!B")[0]
1850 assert(_type == 4)
1851 _length = reader.read("!H")[0]
1852 orig_reader = reader
1853 reader = orig_reader.slice(_length, 4)
1854 obj.xid = reader.read("!L")[0]
1855 _experimenter = reader.read("!L")[0]
1856 assert(_experimenter == 6035143)
1857 _subtype = reader.read("!L")[0]
1858 assert(_subtype == 21)
1859 return obj
1860
1861 def __eq__(self, other):
1862 if type(self) != type(other): return False
1863 if self.xid != other.xid: return False
1864 return True
1865
1866 def pretty_print(self, q):
1867 q.text("bsn_bw_clear_data_request {")
1868 with q.group():
1869 with q.indent(2):
1870 q.breakable()
1871 q.text("xid = ");
1872 if self.xid != None:
1873 q.text("%#x" % self.xid)
1874 else:
1875 q.text('None')
1876 q.breakable()
1877 q.text('}')
1878
1879bsn_header.subtypes[21] = bsn_bw_clear_data_request
1880
1881class bsn_bw_enable_get_reply(bsn_header):
1882 version = 5
1883 type = 4
1884 experimenter = 6035143
1885 subtype = 20
1886
1887 def __init__(self, xid=None, enabled=None):
1888 if xid != None:
1889 self.xid = xid
1890 else:
1891 self.xid = None
1892 if enabled != None:
1893 self.enabled = enabled
1894 else:
1895 self.enabled = 0
1896 return
1897
1898 def pack(self):
1899 packed = []
1900 packed.append(struct.pack("!B", self.version))
1901 packed.append(struct.pack("!B", self.type))
1902 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1903 packed.append(struct.pack("!L", self.xid))
1904 packed.append(struct.pack("!L", self.experimenter))
1905 packed.append(struct.pack("!L", self.subtype))
1906 packed.append(struct.pack("!L", self.enabled))
1907 length = sum([len(x) for x in packed])
1908 packed[2] = struct.pack("!H", length)
1909 return ''.join(packed)
1910
1911 @staticmethod
1912 def unpack(reader):
1913 obj = bsn_bw_enable_get_reply()
1914 _version = reader.read("!B")[0]
1915 assert(_version == 5)
1916 _type = reader.read("!B")[0]
1917 assert(_type == 4)
1918 _length = reader.read("!H")[0]
1919 orig_reader = reader
1920 reader = orig_reader.slice(_length, 4)
1921 obj.xid = reader.read("!L")[0]
1922 _experimenter = reader.read("!L")[0]
1923 assert(_experimenter == 6035143)
1924 _subtype = reader.read("!L")[0]
1925 assert(_subtype == 20)
1926 obj.enabled = reader.read("!L")[0]
1927 return obj
1928
1929 def __eq__(self, other):
1930 if type(self) != type(other): return False
1931 if self.xid != other.xid: return False
1932 if self.enabled != other.enabled: return False
1933 return True
1934
1935 def pretty_print(self, q):
1936 q.text("bsn_bw_enable_get_reply {")
1937 with q.group():
1938 with q.indent(2):
1939 q.breakable()
1940 q.text("xid = ");
1941 if self.xid != None:
1942 q.text("%#x" % self.xid)
1943 else:
1944 q.text('None')
1945 q.text(","); q.breakable()
1946 q.text("enabled = ");
1947 q.text("%#x" % self.enabled)
1948 q.breakable()
1949 q.text('}')
1950
1951bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1952
1953class bsn_bw_enable_get_request(bsn_header):
1954 version = 5
1955 type = 4
1956 experimenter = 6035143
1957 subtype = 19
1958
1959 def __init__(self, xid=None):
1960 if xid != None:
1961 self.xid = xid
1962 else:
1963 self.xid = None
1964 return
1965
1966 def pack(self):
1967 packed = []
1968 packed.append(struct.pack("!B", self.version))
1969 packed.append(struct.pack("!B", self.type))
1970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1971 packed.append(struct.pack("!L", self.xid))
1972 packed.append(struct.pack("!L", self.experimenter))
1973 packed.append(struct.pack("!L", self.subtype))
1974 length = sum([len(x) for x in packed])
1975 packed[2] = struct.pack("!H", length)
1976 return ''.join(packed)
1977
1978 @staticmethod
1979 def unpack(reader):
1980 obj = bsn_bw_enable_get_request()
1981 _version = reader.read("!B")[0]
1982 assert(_version == 5)
1983 _type = reader.read("!B")[0]
1984 assert(_type == 4)
1985 _length = reader.read("!H")[0]
1986 orig_reader = reader
1987 reader = orig_reader.slice(_length, 4)
1988 obj.xid = reader.read("!L")[0]
1989 _experimenter = reader.read("!L")[0]
1990 assert(_experimenter == 6035143)
1991 _subtype = reader.read("!L")[0]
1992 assert(_subtype == 19)
1993 return obj
1994
1995 def __eq__(self, other):
1996 if type(self) != type(other): return False
1997 if self.xid != other.xid: return False
1998 return True
1999
2000 def pretty_print(self, q):
2001 q.text("bsn_bw_enable_get_request {")
2002 with q.group():
2003 with q.indent(2):
2004 q.breakable()
2005 q.text("xid = ");
2006 if self.xid != None:
2007 q.text("%#x" % self.xid)
2008 else:
2009 q.text('None')
2010 q.breakable()
2011 q.text('}')
2012
2013bsn_header.subtypes[19] = bsn_bw_enable_get_request
2014
2015class bsn_bw_enable_set_reply(bsn_header):
2016 version = 5
2017 type = 4
2018 experimenter = 6035143
2019 subtype = 23
2020
2021 def __init__(self, xid=None, enable=None, status=None):
2022 if xid != None:
2023 self.xid = xid
2024 else:
2025 self.xid = None
2026 if enable != None:
2027 self.enable = enable
2028 else:
2029 self.enable = 0
2030 if status != None:
2031 self.status = status
2032 else:
2033 self.status = 0
2034 return
2035
2036 def pack(self):
2037 packed = []
2038 packed.append(struct.pack("!B", self.version))
2039 packed.append(struct.pack("!B", self.type))
2040 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2041 packed.append(struct.pack("!L", self.xid))
2042 packed.append(struct.pack("!L", self.experimenter))
2043 packed.append(struct.pack("!L", self.subtype))
2044 packed.append(struct.pack("!L", self.enable))
2045 packed.append(struct.pack("!L", self.status))
2046 length = sum([len(x) for x in packed])
2047 packed[2] = struct.pack("!H", length)
2048 return ''.join(packed)
2049
2050 @staticmethod
2051 def unpack(reader):
2052 obj = bsn_bw_enable_set_reply()
2053 _version = reader.read("!B")[0]
2054 assert(_version == 5)
2055 _type = reader.read("!B")[0]
2056 assert(_type == 4)
2057 _length = reader.read("!H")[0]
2058 orig_reader = reader
2059 reader = orig_reader.slice(_length, 4)
2060 obj.xid = reader.read("!L")[0]
2061 _experimenter = reader.read("!L")[0]
2062 assert(_experimenter == 6035143)
2063 _subtype = reader.read("!L")[0]
2064 assert(_subtype == 23)
2065 obj.enable = reader.read("!L")[0]
2066 obj.status = reader.read("!L")[0]
2067 return obj
2068
2069 def __eq__(self, other):
2070 if type(self) != type(other): return False
2071 if self.xid != other.xid: return False
2072 if self.enable != other.enable: return False
2073 if self.status != other.status: return False
2074 return True
2075
2076 def pretty_print(self, q):
2077 q.text("bsn_bw_enable_set_reply {")
2078 with q.group():
2079 with q.indent(2):
2080 q.breakable()
2081 q.text("xid = ");
2082 if self.xid != None:
2083 q.text("%#x" % self.xid)
2084 else:
2085 q.text('None')
2086 q.text(","); q.breakable()
2087 q.text("enable = ");
2088 q.text("%#x" % self.enable)
2089 q.text(","); q.breakable()
2090 q.text("status = ");
2091 q.text("%#x" % self.status)
2092 q.breakable()
2093 q.text('}')
2094
2095bsn_header.subtypes[23] = bsn_bw_enable_set_reply
2096
2097class bsn_bw_enable_set_request(bsn_header):
2098 version = 5
2099 type = 4
2100 experimenter = 6035143
2101 subtype = 18
2102
2103 def __init__(self, xid=None, enable=None):
2104 if xid != None:
2105 self.xid = xid
2106 else:
2107 self.xid = None
2108 if enable != None:
2109 self.enable = enable
2110 else:
2111 self.enable = 0
2112 return
2113
2114 def pack(self):
2115 packed = []
2116 packed.append(struct.pack("!B", self.version))
2117 packed.append(struct.pack("!B", self.type))
2118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2119 packed.append(struct.pack("!L", self.xid))
2120 packed.append(struct.pack("!L", self.experimenter))
2121 packed.append(struct.pack("!L", self.subtype))
2122 packed.append(struct.pack("!L", self.enable))
2123 length = sum([len(x) for x in packed])
2124 packed[2] = struct.pack("!H", length)
2125 return ''.join(packed)
2126
2127 @staticmethod
2128 def unpack(reader):
2129 obj = bsn_bw_enable_set_request()
2130 _version = reader.read("!B")[0]
2131 assert(_version == 5)
2132 _type = reader.read("!B")[0]
2133 assert(_type == 4)
2134 _length = reader.read("!H")[0]
2135 orig_reader = reader
2136 reader = orig_reader.slice(_length, 4)
2137 obj.xid = reader.read("!L")[0]
2138 _experimenter = reader.read("!L")[0]
2139 assert(_experimenter == 6035143)
2140 _subtype = reader.read("!L")[0]
2141 assert(_subtype == 18)
2142 obj.enable = reader.read("!L")[0]
2143 return obj
2144
2145 def __eq__(self, other):
2146 if type(self) != type(other): return False
2147 if self.xid != other.xid: return False
2148 if self.enable != other.enable: return False
2149 return True
2150
2151 def pretty_print(self, q):
2152 q.text("bsn_bw_enable_set_request {")
2153 with q.group():
2154 with q.indent(2):
2155 q.breakable()
2156 q.text("xid = ");
2157 if self.xid != None:
2158 q.text("%#x" % self.xid)
2159 else:
2160 q.text('None')
2161 q.text(","); q.breakable()
2162 q.text("enable = ");
2163 q.text("%#x" % self.enable)
2164 q.breakable()
2165 q.text('}')
2166
2167bsn_header.subtypes[18] = bsn_bw_enable_set_request
2168
2169class bsn_controller_connections_reply(bsn_header):
2170 version = 5
2171 type = 4
2172 experimenter = 6035143
2173 subtype = 57
2174
2175 def __init__(self, xid=None, connections=None):
2176 if xid != None:
2177 self.xid = xid
2178 else:
2179 self.xid = None
2180 if connections != None:
2181 self.connections = connections
2182 else:
2183 self.connections = []
2184 return
2185
2186 def pack(self):
2187 packed = []
2188 packed.append(struct.pack("!B", self.version))
2189 packed.append(struct.pack("!B", self.type))
2190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2191 packed.append(struct.pack("!L", self.xid))
2192 packed.append(struct.pack("!L", self.experimenter))
2193 packed.append(struct.pack("!L", self.subtype))
2194 packed.append(loxi.generic_util.pack_list(self.connections))
2195 length = sum([len(x) for x in packed])
2196 packed[2] = struct.pack("!H", length)
2197 return ''.join(packed)
2198
2199 @staticmethod
2200 def unpack(reader):
2201 obj = bsn_controller_connections_reply()
2202 _version = reader.read("!B")[0]
2203 assert(_version == 5)
2204 _type = reader.read("!B")[0]
2205 assert(_type == 4)
2206 _length = reader.read("!H")[0]
2207 orig_reader = reader
2208 reader = orig_reader.slice(_length, 4)
2209 obj.xid = reader.read("!L")[0]
2210 _experimenter = reader.read("!L")[0]
2211 assert(_experimenter == 6035143)
2212 _subtype = reader.read("!L")[0]
2213 assert(_subtype == 57)
2214 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
2215 return obj
2216
2217 def __eq__(self, other):
2218 if type(self) != type(other): return False
2219 if self.xid != other.xid: return False
2220 if self.connections != other.connections: return False
2221 return True
2222
2223 def pretty_print(self, q):
2224 q.text("bsn_controller_connections_reply {")
2225 with q.group():
2226 with q.indent(2):
2227 q.breakable()
2228 q.text("xid = ");
2229 if self.xid != None:
2230 q.text("%#x" % self.xid)
2231 else:
2232 q.text('None')
2233 q.text(","); q.breakable()
2234 q.text("connections = ");
2235 q.pp(self.connections)
2236 q.breakable()
2237 q.text('}')
2238
2239bsn_header.subtypes[57] = bsn_controller_connections_reply
2240
2241class bsn_controller_connections_request(bsn_header):
2242 version = 5
2243 type = 4
2244 experimenter = 6035143
2245 subtype = 56
2246
2247 def __init__(self, xid=None):
2248 if xid != None:
2249 self.xid = xid
2250 else:
2251 self.xid = None
2252 return
2253
2254 def pack(self):
2255 packed = []
2256 packed.append(struct.pack("!B", self.version))
2257 packed.append(struct.pack("!B", self.type))
2258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2259 packed.append(struct.pack("!L", self.xid))
2260 packed.append(struct.pack("!L", self.experimenter))
2261 packed.append(struct.pack("!L", self.subtype))
2262 length = sum([len(x) for x in packed])
2263 packed[2] = struct.pack("!H", length)
2264 return ''.join(packed)
2265
2266 @staticmethod
2267 def unpack(reader):
2268 obj = bsn_controller_connections_request()
2269 _version = reader.read("!B")[0]
2270 assert(_version == 5)
2271 _type = reader.read("!B")[0]
2272 assert(_type == 4)
2273 _length = reader.read("!H")[0]
2274 orig_reader = reader
2275 reader = orig_reader.slice(_length, 4)
2276 obj.xid = reader.read("!L")[0]
2277 _experimenter = reader.read("!L")[0]
2278 assert(_experimenter == 6035143)
2279 _subtype = reader.read("!L")[0]
2280 assert(_subtype == 56)
2281 return obj
2282
2283 def __eq__(self, other):
2284 if type(self) != type(other): return False
2285 if self.xid != other.xid: return False
2286 return True
2287
2288 def pretty_print(self, q):
2289 q.text("bsn_controller_connections_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.breakable()
2299 q.text('}')
2300
2301bsn_header.subtypes[56] = bsn_controller_connections_request
2302
2303class experimenter_stats_reply(stats_reply):
2304 subtypes = {}
2305
2306 version = 5
2307 type = 19
2308 stats_type = 65535
2309
2310 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2311 if xid != None:
2312 self.xid = xid
2313 else:
2314 self.xid = None
2315 if flags != None:
2316 self.flags = flags
2317 else:
2318 self.flags = 0
2319 if experimenter != None:
2320 self.experimenter = experimenter
2321 else:
2322 self.experimenter = 0
2323 if subtype != None:
2324 self.subtype = subtype
2325 else:
2326 self.subtype = 0
2327 return
2328
2329 def pack(self):
2330 packed = []
2331 packed.append(struct.pack("!B", self.version))
2332 packed.append(struct.pack("!B", self.type))
2333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2334 packed.append(struct.pack("!L", self.xid))
2335 packed.append(struct.pack("!H", self.stats_type))
2336 packed.append(struct.pack("!H", self.flags))
2337 packed.append('\x00' * 4)
2338 packed.append(struct.pack("!L", self.experimenter))
2339 packed.append(struct.pack("!L", self.subtype))
2340 length = sum([len(x) for x in packed])
2341 packed[2] = struct.pack("!H", length)
2342 return ''.join(packed)
2343
2344 @staticmethod
2345 def unpack(reader):
2346 subtype, = reader.peek('!L', 16)
2347 subclass = experimenter_stats_reply.subtypes.get(subtype)
2348 if subclass:
2349 return subclass.unpack(reader)
2350
2351 obj = experimenter_stats_reply()
2352 _version = reader.read("!B")[0]
2353 assert(_version == 5)
2354 _type = reader.read("!B")[0]
2355 assert(_type == 19)
2356 _length = reader.read("!H")[0]
2357 orig_reader = reader
2358 reader = orig_reader.slice(_length, 4)
2359 obj.xid = reader.read("!L")[0]
2360 _stats_type = reader.read("!H")[0]
2361 assert(_stats_type == 65535)
2362 obj.flags = reader.read("!H")[0]
2363 reader.skip(4)
2364 obj.experimenter = reader.read("!L")[0]
2365 obj.subtype = reader.read("!L")[0]
2366 return obj
2367
2368 def __eq__(self, other):
2369 if type(self) != type(other): return False
2370 if self.xid != other.xid: return False
2371 if self.flags != other.flags: return False
2372 if self.experimenter != other.experimenter: return False
2373 if self.subtype != other.subtype: return False
2374 return True
2375
2376 def pretty_print(self, q):
2377 q.text("experimenter_stats_reply {")
2378 with q.group():
2379 with q.indent(2):
2380 q.breakable()
2381 q.text("xid = ");
2382 if self.xid != None:
2383 q.text("%#x" % self.xid)
2384 else:
2385 q.text('None')
2386 q.text(","); q.breakable()
2387 q.text("flags = ");
2388 q.text("%#x" % self.flags)
2389 q.text(","); q.breakable()
2390 q.text("subtype = ");
2391 q.text("%#x" % self.subtype)
2392 q.breakable()
2393 q.text('}')
2394
2395stats_reply.subtypes[65535] = experimenter_stats_reply
2396
2397class bsn_stats_reply(experimenter_stats_reply):
2398 subtypes = {}
2399
2400 version = 5
2401 type = 19
2402 stats_type = 65535
2403 experimenter = 6035143
2404
2405 def __init__(self, xid=None, flags=None, subtype=None):
2406 if xid != None:
2407 self.xid = xid
2408 else:
2409 self.xid = None
2410 if flags != None:
2411 self.flags = flags
2412 else:
2413 self.flags = 0
2414 if subtype != None:
2415 self.subtype = subtype
2416 else:
2417 self.subtype = 0
2418 return
2419
2420 def pack(self):
2421 packed = []
2422 packed.append(struct.pack("!B", self.version))
2423 packed.append(struct.pack("!B", self.type))
2424 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2425 packed.append(struct.pack("!L", self.xid))
2426 packed.append(struct.pack("!H", self.stats_type))
2427 packed.append(struct.pack("!H", self.flags))
2428 packed.append('\x00' * 4)
2429 packed.append(struct.pack("!L", self.experimenter))
2430 packed.append(struct.pack("!L", self.subtype))
2431 length = sum([len(x) for x in packed])
2432 packed[2] = struct.pack("!H", length)
2433 return ''.join(packed)
2434
2435 @staticmethod
2436 def unpack(reader):
2437 subtype, = reader.peek('!L', 20)
2438 subclass = bsn_stats_reply.subtypes.get(subtype)
2439 if subclass:
2440 return subclass.unpack(reader)
2441
2442 obj = bsn_stats_reply()
2443 _version = reader.read("!B")[0]
2444 assert(_version == 5)
2445 _type = reader.read("!B")[0]
2446 assert(_type == 19)
2447 _length = reader.read("!H")[0]
2448 orig_reader = reader
2449 reader = orig_reader.slice(_length, 4)
2450 obj.xid = reader.read("!L")[0]
2451 _stats_type = reader.read("!H")[0]
2452 assert(_stats_type == 65535)
2453 obj.flags = reader.read("!H")[0]
2454 reader.skip(4)
2455 _experimenter = reader.read("!L")[0]
2456 assert(_experimenter == 6035143)
2457 obj.subtype = reader.read("!L")[0]
2458 return obj
2459
2460 def __eq__(self, other):
2461 if type(self) != type(other): return False
2462 if self.xid != other.xid: return False
2463 if self.flags != other.flags: return False
2464 if self.subtype != other.subtype: return False
2465 return True
2466
2467 def pretty_print(self, q):
2468 q.text("bsn_stats_reply {")
2469 with q.group():
2470 with q.indent(2):
2471 q.breakable()
2472 q.text("xid = ");
2473 if self.xid != None:
2474 q.text("%#x" % self.xid)
2475 else:
2476 q.text('None')
2477 q.text(","); q.breakable()
2478 q.text("flags = ");
2479 q.text("%#x" % self.flags)
2480 q.breakable()
2481 q.text('}')
2482
2483experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2484
2485class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
2486 version = 5
2487 type = 19
2488 stats_type = 65535
2489 experimenter = 6035143
2490 subtype = 13
2491
2492 def __init__(self, xid=None, flags=None, entries=None):
2493 if xid != None:
2494 self.xid = xid
2495 else:
2496 self.xid = None
2497 if flags != None:
2498 self.flags = flags
2499 else:
2500 self.flags = 0
2501 if entries != None:
2502 self.entries = entries
2503 else:
2504 self.entries = []
2505 return
2506
2507 def pack(self):
2508 packed = []
2509 packed.append(struct.pack("!B", self.version))
2510 packed.append(struct.pack("!B", self.type))
2511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2512 packed.append(struct.pack("!L", self.xid))
2513 packed.append(struct.pack("!H", self.stats_type))
2514 packed.append(struct.pack("!H", self.flags))
2515 packed.append('\x00' * 4)
2516 packed.append(struct.pack("!L", self.experimenter))
2517 packed.append(struct.pack("!L", self.subtype))
2518 packed.append(loxi.generic_util.pack_list(self.entries))
2519 length = sum([len(x) for x in packed])
2520 packed[2] = struct.pack("!H", length)
2521 return ''.join(packed)
2522
2523 @staticmethod
2524 def unpack(reader):
2525 obj = bsn_debug_counter_desc_stats_reply()
2526 _version = reader.read("!B")[0]
2527 assert(_version == 5)
2528 _type = reader.read("!B")[0]
2529 assert(_type == 19)
2530 _length = reader.read("!H")[0]
2531 orig_reader = reader
2532 reader = orig_reader.slice(_length, 4)
2533 obj.xid = reader.read("!L")[0]
2534 _stats_type = reader.read("!H")[0]
2535 assert(_stats_type == 65535)
2536 obj.flags = reader.read("!H")[0]
2537 reader.skip(4)
2538 _experimenter = reader.read("!L")[0]
2539 assert(_experimenter == 6035143)
2540 _subtype = reader.read("!L")[0]
2541 assert(_subtype == 13)
2542 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
2543 return obj
2544
2545 def __eq__(self, other):
2546 if type(self) != type(other): return False
2547 if self.xid != other.xid: return False
2548 if self.flags != other.flags: return False
2549 if self.entries != other.entries: return False
2550 return True
2551
2552 def pretty_print(self, q):
2553 q.text("bsn_debug_counter_desc_stats_reply {")
2554 with q.group():
2555 with q.indent(2):
2556 q.breakable()
2557 q.text("xid = ");
2558 if self.xid != None:
2559 q.text("%#x" % self.xid)
2560 else:
2561 q.text('None')
2562 q.text(","); q.breakable()
2563 q.text("flags = ");
2564 q.text("%#x" % self.flags)
2565 q.text(","); q.breakable()
2566 q.text("entries = ");
2567 q.pp(self.entries)
2568 q.breakable()
2569 q.text('}')
2570
2571bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
2572
2573class experimenter_stats_request(stats_request):
2574 subtypes = {}
2575
2576 version = 5
2577 type = 18
2578 stats_type = 65535
2579
2580 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2581 if xid != None:
2582 self.xid = xid
2583 else:
2584 self.xid = None
2585 if flags != None:
2586 self.flags = flags
2587 else:
2588 self.flags = 0
2589 if experimenter != None:
2590 self.experimenter = experimenter
2591 else:
2592 self.experimenter = 0
2593 if subtype != None:
2594 self.subtype = subtype
2595 else:
2596 self.subtype = 0
2597 return
2598
2599 def pack(self):
2600 packed = []
2601 packed.append(struct.pack("!B", self.version))
2602 packed.append(struct.pack("!B", self.type))
2603 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2604 packed.append(struct.pack("!L", self.xid))
2605 packed.append(struct.pack("!H", self.stats_type))
2606 packed.append(struct.pack("!H", self.flags))
2607 packed.append('\x00' * 4)
2608 packed.append(struct.pack("!L", self.experimenter))
2609 packed.append(struct.pack("!L", self.subtype))
2610 length = sum([len(x) for x in packed])
2611 packed[2] = struct.pack("!H", length)
2612 return ''.join(packed)
2613
2614 @staticmethod
2615 def unpack(reader):
2616 subtype, = reader.peek('!L', 16)
2617 subclass = experimenter_stats_request.subtypes.get(subtype)
2618 if subclass:
2619 return subclass.unpack(reader)
2620
2621 obj = experimenter_stats_request()
2622 _version = reader.read("!B")[0]
2623 assert(_version == 5)
2624 _type = reader.read("!B")[0]
2625 assert(_type == 18)
2626 _length = reader.read("!H")[0]
2627 orig_reader = reader
2628 reader = orig_reader.slice(_length, 4)
2629 obj.xid = reader.read("!L")[0]
2630 _stats_type = reader.read("!H")[0]
2631 assert(_stats_type == 65535)
2632 obj.flags = reader.read("!H")[0]
2633 reader.skip(4)
2634 obj.experimenter = reader.read("!L")[0]
2635 obj.subtype = reader.read("!L")[0]
2636 return obj
2637
2638 def __eq__(self, other):
2639 if type(self) != type(other): return False
2640 if self.xid != other.xid: return False
2641 if self.flags != other.flags: return False
2642 if self.experimenter != other.experimenter: return False
2643 if self.subtype != other.subtype: return False
2644 return True
2645
2646 def pretty_print(self, q):
2647 q.text("experimenter_stats_request {")
2648 with q.group():
2649 with q.indent(2):
2650 q.breakable()
2651 q.text("xid = ");
2652 if self.xid != None:
2653 q.text("%#x" % self.xid)
2654 else:
2655 q.text('None')
2656 q.text(","); q.breakable()
2657 q.text("flags = ");
2658 q.text("%#x" % self.flags)
2659 q.text(","); q.breakable()
2660 q.text("subtype = ");
2661 q.text("%#x" % self.subtype)
2662 q.breakable()
2663 q.text('}')
2664
2665stats_request.subtypes[65535] = experimenter_stats_request
2666
2667class bsn_stats_request(experimenter_stats_request):
2668 subtypes = {}
2669
2670 version = 5
2671 type = 18
2672 stats_type = 65535
2673 experimenter = 6035143
2674
2675 def __init__(self, xid=None, flags=None, subtype=None):
2676 if xid != None:
2677 self.xid = xid
2678 else:
2679 self.xid = None
2680 if flags != None:
2681 self.flags = flags
2682 else:
2683 self.flags = 0
2684 if subtype != None:
2685 self.subtype = subtype
2686 else:
2687 self.subtype = 0
2688 return
2689
2690 def pack(self):
2691 packed = []
2692 packed.append(struct.pack("!B", self.version))
2693 packed.append(struct.pack("!B", self.type))
2694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2695 packed.append(struct.pack("!L", self.xid))
2696 packed.append(struct.pack("!H", self.stats_type))
2697 packed.append(struct.pack("!H", self.flags))
2698 packed.append('\x00' * 4)
2699 packed.append(struct.pack("!L", self.experimenter))
2700 packed.append(struct.pack("!L", self.subtype))
2701 length = sum([len(x) for x in packed])
2702 packed[2] = struct.pack("!H", length)
2703 return ''.join(packed)
2704
2705 @staticmethod
2706 def unpack(reader):
2707 subtype, = reader.peek('!L', 20)
2708 subclass = bsn_stats_request.subtypes.get(subtype)
2709 if subclass:
2710 return subclass.unpack(reader)
2711
2712 obj = bsn_stats_request()
2713 _version = reader.read("!B")[0]
2714 assert(_version == 5)
2715 _type = reader.read("!B")[0]
2716 assert(_type == 18)
2717 _length = reader.read("!H")[0]
2718 orig_reader = reader
2719 reader = orig_reader.slice(_length, 4)
2720 obj.xid = reader.read("!L")[0]
2721 _stats_type = reader.read("!H")[0]
2722 assert(_stats_type == 65535)
2723 obj.flags = reader.read("!H")[0]
2724 reader.skip(4)
2725 _experimenter = reader.read("!L")[0]
2726 assert(_experimenter == 6035143)
2727 obj.subtype = reader.read("!L")[0]
2728 return obj
2729
2730 def __eq__(self, other):
2731 if type(self) != type(other): return False
2732 if self.xid != other.xid: return False
2733 if self.flags != other.flags: return False
2734 if self.subtype != other.subtype: return False
2735 return True
2736
2737 def pretty_print(self, q):
2738 q.text("bsn_stats_request {")
2739 with q.group():
2740 with q.indent(2):
2741 q.breakable()
2742 q.text("xid = ");
2743 if self.xid != None:
2744 q.text("%#x" % self.xid)
2745 else:
2746 q.text('None')
2747 q.text(","); q.breakable()
2748 q.text("flags = ");
2749 q.text("%#x" % self.flags)
2750 q.breakable()
2751 q.text('}')
2752
2753experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2754
2755class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2756 version = 5
2757 type = 18
2758 stats_type = 65535
2759 experimenter = 6035143
2760 subtype = 13
2761
2762 def __init__(self, xid=None, flags=None):
2763 if xid != None:
2764 self.xid = xid
2765 else:
2766 self.xid = None
2767 if flags != None:
2768 self.flags = flags
2769 else:
2770 self.flags = 0
2771 return
2772
2773 def pack(self):
2774 packed = []
2775 packed.append(struct.pack("!B", self.version))
2776 packed.append(struct.pack("!B", self.type))
2777 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2778 packed.append(struct.pack("!L", self.xid))
2779 packed.append(struct.pack("!H", self.stats_type))
2780 packed.append(struct.pack("!H", self.flags))
2781 packed.append('\x00' * 4)
2782 packed.append(struct.pack("!L", self.experimenter))
2783 packed.append(struct.pack("!L", self.subtype))
2784 length = sum([len(x) for x in packed])
2785 packed[2] = struct.pack("!H", length)
2786 return ''.join(packed)
2787
2788 @staticmethod
2789 def unpack(reader):
2790 obj = bsn_debug_counter_desc_stats_request()
2791 _version = reader.read("!B")[0]
2792 assert(_version == 5)
2793 _type = reader.read("!B")[0]
2794 assert(_type == 18)
2795 _length = reader.read("!H")[0]
2796 orig_reader = reader
2797 reader = orig_reader.slice(_length, 4)
2798 obj.xid = reader.read("!L")[0]
2799 _stats_type = reader.read("!H")[0]
2800 assert(_stats_type == 65535)
2801 obj.flags = reader.read("!H")[0]
2802 reader.skip(4)
2803 _experimenter = reader.read("!L")[0]
2804 assert(_experimenter == 6035143)
2805 _subtype = reader.read("!L")[0]
2806 assert(_subtype == 13)
2807 return obj
2808
2809 def __eq__(self, other):
2810 if type(self) != type(other): return False
2811 if self.xid != other.xid: return False
2812 if self.flags != other.flags: return False
2813 return True
2814
2815 def pretty_print(self, q):
2816 q.text("bsn_debug_counter_desc_stats_request {")
2817 with q.group():
2818 with q.indent(2):
2819 q.breakable()
2820 q.text("xid = ");
2821 if self.xid != None:
2822 q.text("%#x" % self.xid)
2823 else:
2824 q.text('None')
2825 q.text(","); q.breakable()
2826 q.text("flags = ");
2827 q.text("%#x" % self.flags)
2828 q.breakable()
2829 q.text('}')
2830
2831bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2832
2833class bsn_debug_counter_stats_reply(bsn_stats_reply):
2834 version = 5
2835 type = 19
2836 stats_type = 65535
2837 experimenter = 6035143
2838 subtype = 12
2839
2840 def __init__(self, xid=None, flags=None, entries=None):
2841 if xid != None:
2842 self.xid = xid
2843 else:
2844 self.xid = None
2845 if flags != None:
2846 self.flags = flags
2847 else:
2848 self.flags = 0
2849 if entries != None:
2850 self.entries = entries
2851 else:
2852 self.entries = []
2853 return
2854
2855 def pack(self):
2856 packed = []
2857 packed.append(struct.pack("!B", self.version))
2858 packed.append(struct.pack("!B", self.type))
2859 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2860 packed.append(struct.pack("!L", self.xid))
2861 packed.append(struct.pack("!H", self.stats_type))
2862 packed.append(struct.pack("!H", self.flags))
2863 packed.append('\x00' * 4)
2864 packed.append(struct.pack("!L", self.experimenter))
2865 packed.append(struct.pack("!L", self.subtype))
2866 packed.append(loxi.generic_util.pack_list(self.entries))
2867 length = sum([len(x) for x in packed])
2868 packed[2] = struct.pack("!H", length)
2869 return ''.join(packed)
2870
2871 @staticmethod
2872 def unpack(reader):
2873 obj = bsn_debug_counter_stats_reply()
2874 _version = reader.read("!B")[0]
2875 assert(_version == 5)
2876 _type = reader.read("!B")[0]
2877 assert(_type == 19)
2878 _length = reader.read("!H")[0]
2879 orig_reader = reader
2880 reader = orig_reader.slice(_length, 4)
2881 obj.xid = reader.read("!L")[0]
2882 _stats_type = reader.read("!H")[0]
2883 assert(_stats_type == 65535)
2884 obj.flags = reader.read("!H")[0]
2885 reader.skip(4)
2886 _experimenter = reader.read("!L")[0]
2887 assert(_experimenter == 6035143)
2888 _subtype = reader.read("!L")[0]
2889 assert(_subtype == 12)
2890 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
2891 return obj
2892
2893 def __eq__(self, other):
2894 if type(self) != type(other): return False
2895 if self.xid != other.xid: return False
2896 if self.flags != other.flags: return False
2897 if self.entries != other.entries: return False
2898 return True
2899
2900 def pretty_print(self, q):
2901 q.text("bsn_debug_counter_stats_reply {")
2902 with q.group():
2903 with q.indent(2):
2904 q.breakable()
2905 q.text("xid = ");
2906 if self.xid != None:
2907 q.text("%#x" % self.xid)
2908 else:
2909 q.text('None')
2910 q.text(","); q.breakable()
2911 q.text("flags = ");
2912 q.text("%#x" % self.flags)
2913 q.text(","); q.breakable()
2914 q.text("entries = ");
2915 q.pp(self.entries)
2916 q.breakable()
2917 q.text('}')
2918
2919bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2920
2921class bsn_debug_counter_stats_request(bsn_stats_request):
2922 version = 5
2923 type = 18
2924 stats_type = 65535
2925 experimenter = 6035143
2926 subtype = 12
2927
2928 def __init__(self, xid=None, flags=None):
2929 if xid != None:
2930 self.xid = xid
2931 else:
2932 self.xid = None
2933 if flags != None:
2934 self.flags = flags
2935 else:
2936 self.flags = 0
2937 return
2938
2939 def pack(self):
2940 packed = []
2941 packed.append(struct.pack("!B", self.version))
2942 packed.append(struct.pack("!B", self.type))
2943 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2944 packed.append(struct.pack("!L", self.xid))
2945 packed.append(struct.pack("!H", self.stats_type))
2946 packed.append(struct.pack("!H", self.flags))
2947 packed.append('\x00' * 4)
2948 packed.append(struct.pack("!L", self.experimenter))
2949 packed.append(struct.pack("!L", self.subtype))
2950 length = sum([len(x) for x in packed])
2951 packed[2] = struct.pack("!H", length)
2952 return ''.join(packed)
2953
2954 @staticmethod
2955 def unpack(reader):
2956 obj = bsn_debug_counter_stats_request()
2957 _version = reader.read("!B")[0]
2958 assert(_version == 5)
2959 _type = reader.read("!B")[0]
2960 assert(_type == 18)
2961 _length = reader.read("!H")[0]
2962 orig_reader = reader
2963 reader = orig_reader.slice(_length, 4)
2964 obj.xid = reader.read("!L")[0]
2965 _stats_type = reader.read("!H")[0]
2966 assert(_stats_type == 65535)
2967 obj.flags = reader.read("!H")[0]
2968 reader.skip(4)
2969 _experimenter = reader.read("!L")[0]
2970 assert(_experimenter == 6035143)
2971 _subtype = reader.read("!L")[0]
2972 assert(_subtype == 12)
2973 return obj
2974
2975 def __eq__(self, other):
2976 if type(self) != type(other): return False
2977 if self.xid != other.xid: return False
2978 if self.flags != other.flags: return False
2979 return True
2980
2981 def pretty_print(self, q):
2982 q.text("bsn_debug_counter_stats_request {")
2983 with q.group():
2984 with q.indent(2):
2985 q.breakable()
2986 q.text("xid = ");
2987 if self.xid != None:
2988 q.text("%#x" % self.xid)
2989 else:
2990 q.text('None')
2991 q.text(","); q.breakable()
2992 q.text("flags = ");
2993 q.text("%#x" % self.flags)
2994 q.breakable()
2995 q.text('}')
2996
2997bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2998
2999class bsn_error(bsn_base_error):
3000 version = 5
3001 type = 1
3002 err_type = 65535
3003 subtype = 1
3004 experimenter = 6035143
3005
3006 def __init__(self, xid=None, err_msg=None, data=None):
3007 if xid != None:
3008 self.xid = xid
3009 else:
3010 self.xid = None
3011 if err_msg != None:
3012 self.err_msg = err_msg
3013 else:
3014 self.err_msg = ""
3015 if data != None:
3016 self.data = data
3017 else:
3018 self.data = ''
3019 return
3020
3021 def pack(self):
3022 packed = []
3023 packed.append(struct.pack("!B", self.version))
3024 packed.append(struct.pack("!B", self.type))
3025 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3026 packed.append(struct.pack("!L", self.xid))
3027 packed.append(struct.pack("!H", self.err_type))
3028 packed.append(struct.pack("!H", self.subtype))
3029 packed.append(struct.pack("!L", self.experimenter))
3030 packed.append(struct.pack("!256s", self.err_msg))
3031 packed.append(self.data)
3032 length = sum([len(x) for x in packed])
3033 packed[2] = struct.pack("!H", length)
3034 return ''.join(packed)
3035
3036 @staticmethod
3037 def unpack(reader):
3038 obj = bsn_error()
3039 _version = reader.read("!B")[0]
3040 assert(_version == 5)
3041 _type = reader.read("!B")[0]
3042 assert(_type == 1)
3043 _length = reader.read("!H")[0]
3044 orig_reader = reader
3045 reader = orig_reader.slice(_length, 4)
3046 obj.xid = reader.read("!L")[0]
3047 _err_type = reader.read("!H")[0]
3048 assert(_err_type == 65535)
3049 _subtype = reader.read("!H")[0]
3050 assert(_subtype == 1)
3051 _experimenter = reader.read("!L")[0]
3052 assert(_experimenter == 6035143)
3053 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
3054 obj.data = str(reader.read_all())
3055 return obj
3056
3057 def __eq__(self, other):
3058 if type(self) != type(other): return False
3059 if self.xid != other.xid: return False
3060 if self.err_msg != other.err_msg: return False
3061 if self.data != other.data: return False
3062 return True
3063
3064 def pretty_print(self, q):
3065 q.text("bsn_error {")
3066 with q.group():
3067 with q.indent(2):
3068 q.breakable()
3069 q.text("xid = ");
3070 if self.xid != None:
3071 q.text("%#x" % self.xid)
3072 else:
3073 q.text('None')
3074 q.text(","); q.breakable()
3075 q.text("err_msg = ");
3076 q.pp(self.err_msg)
3077 q.text(","); q.breakable()
3078 q.text("data = ");
3079 q.pp(self.data)
3080 q.breakable()
3081 q.text('}')
3082
3083bsn_base_error.subtypes[1] = bsn_error
3084
3085class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
3086 version = 5
3087 type = 19
3088 stats_type = 65535
3089 experimenter = 6035143
3090 subtype = 10
3091
3092 def __init__(self, xid=None, flags=None, entries=None):
3093 if xid != None:
3094 self.xid = xid
3095 else:
3096 self.xid = None
3097 if flags != None:
3098 self.flags = flags
3099 else:
3100 self.flags = 0
3101 if entries != None:
3102 self.entries = entries
3103 else:
3104 self.entries = []
3105 return
3106
3107 def pack(self):
3108 packed = []
3109 packed.append(struct.pack("!B", self.version))
3110 packed.append(struct.pack("!B", self.type))
3111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3112 packed.append(struct.pack("!L", self.xid))
3113 packed.append(struct.pack("!H", self.stats_type))
3114 packed.append(struct.pack("!H", self.flags))
3115 packed.append('\x00' * 4)
3116 packed.append(struct.pack("!L", self.experimenter))
3117 packed.append(struct.pack("!L", self.subtype))
3118 packed.append(loxi.generic_util.pack_list(self.entries))
3119 length = sum([len(x) for x in packed])
3120 packed[2] = struct.pack("!H", length)
3121 return ''.join(packed)
3122
3123 @staticmethod
3124 def unpack(reader):
3125 obj = bsn_flow_checksum_bucket_stats_reply()
3126 _version = reader.read("!B")[0]
3127 assert(_version == 5)
3128 _type = reader.read("!B")[0]
3129 assert(_type == 19)
3130 _length = reader.read("!H")[0]
3131 orig_reader = reader
3132 reader = orig_reader.slice(_length, 4)
3133 obj.xid = reader.read("!L")[0]
3134 _stats_type = reader.read("!H")[0]
3135 assert(_stats_type == 65535)
3136 obj.flags = reader.read("!H")[0]
3137 reader.skip(4)
3138 _experimenter = reader.read("!L")[0]
3139 assert(_experimenter == 6035143)
3140 _subtype = reader.read("!L")[0]
3141 assert(_subtype == 10)
3142 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
3143 return obj
3144
3145 def __eq__(self, other):
3146 if type(self) != type(other): return False
3147 if self.xid != other.xid: return False
3148 if self.flags != other.flags: return False
3149 if self.entries != other.entries: return False
3150 return True
3151
3152 def pretty_print(self, q):
3153 q.text("bsn_flow_checksum_bucket_stats_reply {")
3154 with q.group():
3155 with q.indent(2):
3156 q.breakable()
3157 q.text("xid = ");
3158 if self.xid != None:
3159 q.text("%#x" % self.xid)
3160 else:
3161 q.text('None')
3162 q.text(","); q.breakable()
3163 q.text("flags = ");
3164 q.text("%#x" % self.flags)
3165 q.text(","); q.breakable()
3166 q.text("entries = ");
3167 q.pp(self.entries)
3168 q.breakable()
3169 q.text('}')
3170
3171bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
3172
3173class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
3174 version = 5
3175 type = 18
3176 stats_type = 65535
3177 experimenter = 6035143
3178 subtype = 10
3179
3180 def __init__(self, xid=None, flags=None, table_id=None):
3181 if xid != None:
3182 self.xid = xid
3183 else:
3184 self.xid = None
3185 if flags != None:
3186 self.flags = flags
3187 else:
3188 self.flags = 0
3189 if table_id != None:
3190 self.table_id = table_id
3191 else:
3192 self.table_id = 0
3193 return
3194
3195 def pack(self):
3196 packed = []
3197 packed.append(struct.pack("!B", self.version))
3198 packed.append(struct.pack("!B", self.type))
3199 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3200 packed.append(struct.pack("!L", self.xid))
3201 packed.append(struct.pack("!H", self.stats_type))
3202 packed.append(struct.pack("!H", self.flags))
3203 packed.append('\x00' * 4)
3204 packed.append(struct.pack("!L", self.experimenter))
3205 packed.append(struct.pack("!L", self.subtype))
3206 packed.append(struct.pack("!B", self.table_id))
3207 length = sum([len(x) for x in packed])
3208 packed[2] = struct.pack("!H", length)
3209 return ''.join(packed)
3210
3211 @staticmethod
3212 def unpack(reader):
3213 obj = bsn_flow_checksum_bucket_stats_request()
3214 _version = reader.read("!B")[0]
3215 assert(_version == 5)
3216 _type = reader.read("!B")[0]
3217 assert(_type == 18)
3218 _length = reader.read("!H")[0]
3219 orig_reader = reader
3220 reader = orig_reader.slice(_length, 4)
3221 obj.xid = reader.read("!L")[0]
3222 _stats_type = reader.read("!H")[0]
3223 assert(_stats_type == 65535)
3224 obj.flags = reader.read("!H")[0]
3225 reader.skip(4)
3226 _experimenter = reader.read("!L")[0]
3227 assert(_experimenter == 6035143)
3228 _subtype = reader.read("!L")[0]
3229 assert(_subtype == 10)
3230 obj.table_id = reader.read("!B")[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.flags != other.flags: return False
3237 if self.table_id != other.table_id: return False
3238 return True
3239
3240 def pretty_print(self, q):
3241 q.text("bsn_flow_checksum_bucket_stats_request {")
3242 with q.group():
3243 with q.indent(2):
3244 q.breakable()
3245 q.text("xid = ");
3246 if self.xid != None:
3247 q.text("%#x" % self.xid)
3248 else:
3249 q.text('None')
3250 q.text(","); q.breakable()
3251 q.text("flags = ");
3252 q.text("%#x" % self.flags)
3253 q.text(","); q.breakable()
3254 q.text("table_id = ");
3255 q.text("%#x" % self.table_id)
3256 q.breakable()
3257 q.text('}')
3258
3259bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
3260
3261class bsn_flow_idle(bsn_header):
3262 version = 5
3263 type = 4
3264 experimenter = 6035143
3265 subtype = 40
3266
3267 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
3268 if xid != None:
3269 self.xid = xid
3270 else:
3271 self.xid = None
3272 if cookie != None:
3273 self.cookie = cookie
3274 else:
3275 self.cookie = 0
3276 if priority != None:
3277 self.priority = priority
3278 else:
3279 self.priority = 0
3280 if table_id != None:
3281 self.table_id = table_id
3282 else:
3283 self.table_id = 0
3284 if match != None:
3285 self.match = match
3286 else:
3287 self.match = ofp.match()
3288 return
3289
3290 def pack(self):
3291 packed = []
3292 packed.append(struct.pack("!B", self.version))
3293 packed.append(struct.pack("!B", self.type))
3294 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3295 packed.append(struct.pack("!L", self.xid))
3296 packed.append(struct.pack("!L", self.experimenter))
3297 packed.append(struct.pack("!L", self.subtype))
3298 packed.append(struct.pack("!Q", self.cookie))
3299 packed.append(struct.pack("!H", self.priority))
3300 packed.append(struct.pack("!B", self.table_id))
3301 packed.append('\x00' * 5)
3302 packed.append(self.match.pack())
3303 length = sum([len(x) for x in packed])
3304 packed[2] = struct.pack("!H", length)
3305 return ''.join(packed)
3306
3307 @staticmethod
3308 def unpack(reader):
3309 obj = bsn_flow_idle()
3310 _version = reader.read("!B")[0]
3311 assert(_version == 5)
3312 _type = reader.read("!B")[0]
3313 assert(_type == 4)
3314 _length = reader.read("!H")[0]
3315 orig_reader = reader
3316 reader = orig_reader.slice(_length, 4)
3317 obj.xid = reader.read("!L")[0]
3318 _experimenter = reader.read("!L")[0]
3319 assert(_experimenter == 6035143)
3320 _subtype = reader.read("!L")[0]
3321 assert(_subtype == 40)
3322 obj.cookie = reader.read("!Q")[0]
3323 obj.priority = reader.read("!H")[0]
3324 obj.table_id = reader.read("!B")[0]
3325 reader.skip(5)
3326 obj.match = ofp.match.unpack(reader)
3327 return obj
3328
3329 def __eq__(self, other):
3330 if type(self) != type(other): return False
3331 if self.xid != other.xid: return False
3332 if self.cookie != other.cookie: return False
3333 if self.priority != other.priority: return False
3334 if self.table_id != other.table_id: return False
3335 if self.match != other.match: return False
3336 return True
3337
3338 def pretty_print(self, q):
3339 q.text("bsn_flow_idle {")
3340 with q.group():
3341 with q.indent(2):
3342 q.breakable()
3343 q.text("xid = ");
3344 if self.xid != None:
3345 q.text("%#x" % self.xid)
3346 else:
3347 q.text('None')
3348 q.text(","); q.breakable()
3349 q.text("cookie = ");
3350 q.text("%#x" % self.cookie)
3351 q.text(","); q.breakable()
3352 q.text("priority = ");
3353 q.text("%#x" % self.priority)
3354 q.text(","); q.breakable()
3355 q.text("table_id = ");
3356 q.text("%#x" % self.table_id)
3357 q.text(","); q.breakable()
3358 q.text("match = ");
3359 q.pp(self.match)
3360 q.breakable()
3361 q.text('}')
3362
3363bsn_header.subtypes[40] = bsn_flow_idle
3364
3365class bsn_flow_idle_enable_get_reply(bsn_header):
3366 version = 5
3367 type = 4
3368 experimenter = 6035143
3369 subtype = 39
3370
3371 def __init__(self, xid=None, enabled=None):
3372 if xid != None:
3373 self.xid = xid
3374 else:
3375 self.xid = None
3376 if enabled != None:
3377 self.enabled = enabled
3378 else:
3379 self.enabled = 0
3380 return
3381
3382 def pack(self):
3383 packed = []
3384 packed.append(struct.pack("!B", self.version))
3385 packed.append(struct.pack("!B", self.type))
3386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3387 packed.append(struct.pack("!L", self.xid))
3388 packed.append(struct.pack("!L", self.experimenter))
3389 packed.append(struct.pack("!L", self.subtype))
3390 packed.append(struct.pack("!L", self.enabled))
3391 length = sum([len(x) for x in packed])
3392 packed[2] = struct.pack("!H", length)
3393 return ''.join(packed)
3394
3395 @staticmethod
3396 def unpack(reader):
3397 obj = bsn_flow_idle_enable_get_reply()
3398 _version = reader.read("!B")[0]
3399 assert(_version == 5)
3400 _type = reader.read("!B")[0]
3401 assert(_type == 4)
3402 _length = reader.read("!H")[0]
3403 orig_reader = reader
3404 reader = orig_reader.slice(_length, 4)
3405 obj.xid = reader.read("!L")[0]
3406 _experimenter = reader.read("!L")[0]
3407 assert(_experimenter == 6035143)
3408 _subtype = reader.read("!L")[0]
3409 assert(_subtype == 39)
3410 obj.enabled = reader.read("!L")[0]
3411 return obj
3412
3413 def __eq__(self, other):
3414 if type(self) != type(other): return False
3415 if self.xid != other.xid: return False
3416 if self.enabled != other.enabled: return False
3417 return True
3418
3419 def pretty_print(self, q):
3420 q.text("bsn_flow_idle_enable_get_reply {")
3421 with q.group():
3422 with q.indent(2):
3423 q.breakable()
3424 q.text("xid = ");
3425 if self.xid != None:
3426 q.text("%#x" % self.xid)
3427 else:
3428 q.text('None')
3429 q.text(","); q.breakable()
3430 q.text("enabled = ");
3431 q.text("%#x" % self.enabled)
3432 q.breakable()
3433 q.text('}')
3434
3435bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3436
3437class bsn_flow_idle_enable_get_request(bsn_header):
3438 version = 5
3439 type = 4
3440 experimenter = 6035143
3441 subtype = 38
3442
3443 def __init__(self, xid=None):
3444 if xid != None:
3445 self.xid = xid
3446 else:
3447 self.xid = None
3448 return
3449
3450 def pack(self):
3451 packed = []
3452 packed.append(struct.pack("!B", self.version))
3453 packed.append(struct.pack("!B", self.type))
3454 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3455 packed.append(struct.pack("!L", self.xid))
3456 packed.append(struct.pack("!L", self.experimenter))
3457 packed.append(struct.pack("!L", self.subtype))
3458 length = sum([len(x) for x in packed])
3459 packed[2] = struct.pack("!H", length)
3460 return ''.join(packed)
3461
3462 @staticmethod
3463 def unpack(reader):
3464 obj = bsn_flow_idle_enable_get_request()
3465 _version = reader.read("!B")[0]
3466 assert(_version == 5)
3467 _type = reader.read("!B")[0]
3468 assert(_type == 4)
3469 _length = reader.read("!H")[0]
3470 orig_reader = reader
3471 reader = orig_reader.slice(_length, 4)
3472 obj.xid = reader.read("!L")[0]
3473 _experimenter = reader.read("!L")[0]
3474 assert(_experimenter == 6035143)
3475 _subtype = reader.read("!L")[0]
3476 assert(_subtype == 38)
3477 return obj
3478
3479 def __eq__(self, other):
3480 if type(self) != type(other): return False
3481 if self.xid != other.xid: return False
3482 return True
3483
3484 def pretty_print(self, q):
3485 q.text("bsn_flow_idle_enable_get_request {")
3486 with q.group():
3487 with q.indent(2):
3488 q.breakable()
3489 q.text("xid = ");
3490 if self.xid != None:
3491 q.text("%#x" % self.xid)
3492 else:
3493 q.text('None')
3494 q.breakable()
3495 q.text('}')
3496
3497bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3498
3499class bsn_flow_idle_enable_set_reply(bsn_header):
3500 version = 5
3501 type = 4
3502 experimenter = 6035143
3503 subtype = 37
3504
3505 def __init__(self, xid=None, enable=None, status=None):
3506 if xid != None:
3507 self.xid = xid
3508 else:
3509 self.xid = None
3510 if enable != None:
3511 self.enable = enable
3512 else:
3513 self.enable = 0
3514 if status != None:
3515 self.status = status
3516 else:
3517 self.status = 0
3518 return
3519
3520 def pack(self):
3521 packed = []
3522 packed.append(struct.pack("!B", self.version))
3523 packed.append(struct.pack("!B", self.type))
3524 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3525 packed.append(struct.pack("!L", self.xid))
3526 packed.append(struct.pack("!L", self.experimenter))
3527 packed.append(struct.pack("!L", self.subtype))
3528 packed.append(struct.pack("!L", self.enable))
3529 packed.append(struct.pack("!L", self.status))
3530 length = sum([len(x) for x in packed])
3531 packed[2] = struct.pack("!H", length)
3532 return ''.join(packed)
3533
3534 @staticmethod
3535 def unpack(reader):
3536 obj = bsn_flow_idle_enable_set_reply()
3537 _version = reader.read("!B")[0]
3538 assert(_version == 5)
3539 _type = reader.read("!B")[0]
3540 assert(_type == 4)
3541 _length = reader.read("!H")[0]
3542 orig_reader = reader
3543 reader = orig_reader.slice(_length, 4)
3544 obj.xid = reader.read("!L")[0]
3545 _experimenter = reader.read("!L")[0]
3546 assert(_experimenter == 6035143)
3547 _subtype = reader.read("!L")[0]
3548 assert(_subtype == 37)
3549 obj.enable = reader.read("!L")[0]
3550 obj.status = reader.read("!L")[0]
3551 return obj
3552
3553 def __eq__(self, other):
3554 if type(self) != type(other): return False
3555 if self.xid != other.xid: return False
3556 if self.enable != other.enable: return False
3557 if self.status != other.status: return False
3558 return True
3559
3560 def pretty_print(self, q):
3561 q.text("bsn_flow_idle_enable_set_reply {")
3562 with q.group():
3563 with q.indent(2):
3564 q.breakable()
3565 q.text("xid = ");
3566 if self.xid != None:
3567 q.text("%#x" % self.xid)
3568 else:
3569 q.text('None')
3570 q.text(","); q.breakable()
3571 q.text("enable = ");
3572 q.text("%#x" % self.enable)
3573 q.text(","); q.breakable()
3574 q.text("status = ");
3575 q.text("%#x" % self.status)
3576 q.breakable()
3577 q.text('}')
3578
3579bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3580
3581class bsn_flow_idle_enable_set_request(bsn_header):
3582 version = 5
3583 type = 4
3584 experimenter = 6035143
3585 subtype = 36
3586
3587 def __init__(self, xid=None, enable=None):
3588 if xid != None:
3589 self.xid = xid
3590 else:
3591 self.xid = None
3592 if enable != None:
3593 self.enable = enable
3594 else:
3595 self.enable = 0
3596 return
3597
3598 def pack(self):
3599 packed = []
3600 packed.append(struct.pack("!B", self.version))
3601 packed.append(struct.pack("!B", self.type))
3602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3603 packed.append(struct.pack("!L", self.xid))
3604 packed.append(struct.pack("!L", self.experimenter))
3605 packed.append(struct.pack("!L", self.subtype))
3606 packed.append(struct.pack("!L", self.enable))
3607 length = sum([len(x) for x in packed])
3608 packed[2] = struct.pack("!H", length)
3609 return ''.join(packed)
3610
3611 @staticmethod
3612 def unpack(reader):
3613 obj = bsn_flow_idle_enable_set_request()
3614 _version = reader.read("!B")[0]
3615 assert(_version == 5)
3616 _type = reader.read("!B")[0]
3617 assert(_type == 4)
3618 _length = reader.read("!H")[0]
3619 orig_reader = reader
3620 reader = orig_reader.slice(_length, 4)
3621 obj.xid = reader.read("!L")[0]
3622 _experimenter = reader.read("!L")[0]
3623 assert(_experimenter == 6035143)
3624 _subtype = reader.read("!L")[0]
3625 assert(_subtype == 36)
3626 obj.enable = reader.read("!L")[0]
3627 return obj
3628
3629 def __eq__(self, other):
3630 if type(self) != type(other): return False
3631 if self.xid != other.xid: return False
3632 if self.enable != other.enable: return False
3633 return True
3634
3635 def pretty_print(self, q):
3636 q.text("bsn_flow_idle_enable_set_request {")
3637 with q.group():
3638 with q.indent(2):
3639 q.breakable()
3640 q.text("xid = ");
3641 if self.xid != None:
3642 q.text("%#x" % self.xid)
3643 else:
3644 q.text('None')
3645 q.text(","); q.breakable()
3646 q.text("enable = ");
3647 q.text("%#x" % self.enable)
3648 q.breakable()
3649 q.text('}')
3650
3651bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3652
3653class bsn_generic_async(bsn_header):
3654 version = 5
3655 type = 4
3656 experimenter = 6035143
3657 subtype = 68
3658
3659 def __init__(self, xid=None, name=None, tlvs=None):
3660 if xid != None:
3661 self.xid = xid
3662 else:
3663 self.xid = None
3664 if name != None:
3665 self.name = name
3666 else:
3667 self.name = ""
3668 if tlvs != None:
3669 self.tlvs = tlvs
3670 else:
3671 self.tlvs = []
3672 return
3673
3674 def pack(self):
3675 packed = []
3676 packed.append(struct.pack("!B", self.version))
3677 packed.append(struct.pack("!B", self.type))
3678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3679 packed.append(struct.pack("!L", self.xid))
3680 packed.append(struct.pack("!L", self.experimenter))
3681 packed.append(struct.pack("!L", self.subtype))
3682 packed.append(struct.pack("!64s", self.name))
3683 packed.append(loxi.generic_util.pack_list(self.tlvs))
3684 length = sum([len(x) for x in packed])
3685 packed[2] = struct.pack("!H", length)
3686 return ''.join(packed)
3687
3688 @staticmethod
3689 def unpack(reader):
3690 obj = bsn_generic_async()
3691 _version = reader.read("!B")[0]
3692 assert(_version == 5)
3693 _type = reader.read("!B")[0]
3694 assert(_type == 4)
3695 _length = reader.read("!H")[0]
3696 orig_reader = reader
3697 reader = orig_reader.slice(_length, 4)
3698 obj.xid = reader.read("!L")[0]
3699 _experimenter = reader.read("!L")[0]
3700 assert(_experimenter == 6035143)
3701 _subtype = reader.read("!L")[0]
3702 assert(_subtype == 68)
3703 obj.name = reader.read("!64s")[0].rstrip("\x00")
3704 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3705 return obj
3706
3707 def __eq__(self, other):
3708 if type(self) != type(other): return False
3709 if self.xid != other.xid: return False
3710 if self.name != other.name: return False
3711 if self.tlvs != other.tlvs: return False
3712 return True
3713
3714 def pretty_print(self, q):
3715 q.text("bsn_generic_async {")
3716 with q.group():
3717 with q.indent(2):
3718 q.breakable()
3719 q.text("xid = ");
3720 if self.xid != None:
3721 q.text("%#x" % self.xid)
3722 else:
3723 q.text('None')
3724 q.text(","); q.breakable()
3725 q.text("name = ");
3726 q.pp(self.name)
3727 q.text(","); q.breakable()
3728 q.text("tlvs = ");
3729 q.pp(self.tlvs)
3730 q.breakable()
3731 q.text('}')
3732
3733bsn_header.subtypes[68] = bsn_generic_async
3734
3735class bsn_generic_command(bsn_header):
3736 version = 5
3737 type = 4
3738 experimenter = 6035143
3739 subtype = 71
3740
3741 def __init__(self, xid=None, name=None, tlvs=None):
3742 if xid != None:
3743 self.xid = xid
3744 else:
3745 self.xid = None
3746 if name != None:
3747 self.name = name
3748 else:
3749 self.name = ""
3750 if tlvs != None:
3751 self.tlvs = tlvs
3752 else:
3753 self.tlvs = []
3754 return
3755
3756 def pack(self):
3757 packed = []
3758 packed.append(struct.pack("!B", self.version))
3759 packed.append(struct.pack("!B", self.type))
3760 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3761 packed.append(struct.pack("!L", self.xid))
3762 packed.append(struct.pack("!L", self.experimenter))
3763 packed.append(struct.pack("!L", self.subtype))
3764 packed.append(struct.pack("!64s", self.name))
3765 packed.append(loxi.generic_util.pack_list(self.tlvs))
3766 length = sum([len(x) for x in packed])
3767 packed[2] = struct.pack("!H", length)
3768 return ''.join(packed)
3769
3770 @staticmethod
3771 def unpack(reader):
3772 obj = bsn_generic_command()
3773 _version = reader.read("!B")[0]
3774 assert(_version == 5)
3775 _type = reader.read("!B")[0]
3776 assert(_type == 4)
3777 _length = reader.read("!H")[0]
3778 orig_reader = reader
3779 reader = orig_reader.slice(_length, 4)
3780 obj.xid = reader.read("!L")[0]
3781 _experimenter = reader.read("!L")[0]
3782 assert(_experimenter == 6035143)
3783 _subtype = reader.read("!L")[0]
3784 assert(_subtype == 71)
3785 obj.name = reader.read("!64s")[0].rstrip("\x00")
3786 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3787 return obj
3788
3789 def __eq__(self, other):
3790 if type(self) != type(other): return False
3791 if self.xid != other.xid: return False
3792 if self.name != other.name: return False
3793 if self.tlvs != other.tlvs: return False
3794 return True
3795
3796 def pretty_print(self, q):
3797 q.text("bsn_generic_command {")
3798 with q.group():
3799 with q.indent(2):
3800 q.breakable()
3801 q.text("xid = ");
3802 if self.xid != None:
3803 q.text("%#x" % self.xid)
3804 else:
3805 q.text('None')
3806 q.text(","); q.breakable()
3807 q.text("name = ");
3808 q.pp(self.name)
3809 q.text(","); q.breakable()
3810 q.text("tlvs = ");
3811 q.pp(self.tlvs)
3812 q.breakable()
3813 q.text('}')
3814
3815bsn_header.subtypes[71] = bsn_generic_command
3816
3817class bsn_generic_stats_reply(bsn_stats_reply):
3818 version = 5
3819 type = 19
3820 stats_type = 65535
3821 experimenter = 6035143
3822 subtype = 16
3823
3824 def __init__(self, xid=None, flags=None, entries=None):
3825 if xid != None:
3826 self.xid = xid
3827 else:
3828 self.xid = None
3829 if flags != None:
3830 self.flags = flags
3831 else:
3832 self.flags = 0
3833 if entries != None:
3834 self.entries = entries
3835 else:
3836 self.entries = []
3837 return
3838
3839 def pack(self):
3840 packed = []
3841 packed.append(struct.pack("!B", self.version))
3842 packed.append(struct.pack("!B", self.type))
3843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3844 packed.append(struct.pack("!L", self.xid))
3845 packed.append(struct.pack("!H", self.stats_type))
3846 packed.append(struct.pack("!H", self.flags))
3847 packed.append('\x00' * 4)
3848 packed.append(struct.pack("!L", self.experimenter))
3849 packed.append(struct.pack("!L", self.subtype))
3850 packed.append(loxi.generic_util.pack_list(self.entries))
3851 length = sum([len(x) for x in packed])
3852 packed[2] = struct.pack("!H", length)
3853 return ''.join(packed)
3854
3855 @staticmethod
3856 def unpack(reader):
3857 obj = bsn_generic_stats_reply()
3858 _version = reader.read("!B")[0]
3859 assert(_version == 5)
3860 _type = reader.read("!B")[0]
3861 assert(_type == 19)
3862 _length = reader.read("!H")[0]
3863 orig_reader = reader
3864 reader = orig_reader.slice(_length, 4)
3865 obj.xid = reader.read("!L")[0]
3866 _stats_type = reader.read("!H")[0]
3867 assert(_stats_type == 65535)
3868 obj.flags = reader.read("!H")[0]
3869 reader.skip(4)
3870 _experimenter = reader.read("!L")[0]
3871 assert(_experimenter == 6035143)
3872 _subtype = reader.read("!L")[0]
3873 assert(_subtype == 16)
3874 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
3875 return obj
3876
3877 def __eq__(self, other):
3878 if type(self) != type(other): return False
3879 if self.xid != other.xid: return False
3880 if self.flags != other.flags: return False
3881 if self.entries != other.entries: return False
3882 return True
3883
3884 def pretty_print(self, q):
3885 q.text("bsn_generic_stats_reply {")
3886 with q.group():
3887 with q.indent(2):
3888 q.breakable()
3889 q.text("xid = ");
3890 if self.xid != None:
3891 q.text("%#x" % self.xid)
3892 else:
3893 q.text('None')
3894 q.text(","); q.breakable()
3895 q.text("flags = ");
3896 q.text("%#x" % self.flags)
3897 q.text(","); q.breakable()
3898 q.text("entries = ");
3899 q.pp(self.entries)
3900 q.breakable()
3901 q.text('}')
3902
3903bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3904
3905class bsn_generic_stats_request(bsn_stats_request):
3906 version = 5
3907 type = 18
3908 stats_type = 65535
3909 experimenter = 6035143
3910 subtype = 16
3911
3912 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3913 if xid != None:
3914 self.xid = xid
3915 else:
3916 self.xid = None
3917 if flags != None:
3918 self.flags = flags
3919 else:
3920 self.flags = 0
3921 if name != None:
3922 self.name = name
3923 else:
3924 self.name = ""
3925 if tlvs != None:
3926 self.tlvs = tlvs
3927 else:
3928 self.tlvs = []
3929 return
3930
3931 def pack(self):
3932 packed = []
3933 packed.append(struct.pack("!B", self.version))
3934 packed.append(struct.pack("!B", self.type))
3935 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3936 packed.append(struct.pack("!L", self.xid))
3937 packed.append(struct.pack("!H", self.stats_type))
3938 packed.append(struct.pack("!H", self.flags))
3939 packed.append('\x00' * 4)
3940 packed.append(struct.pack("!L", self.experimenter))
3941 packed.append(struct.pack("!L", self.subtype))
3942 packed.append(struct.pack("!64s", self.name))
3943 packed.append(loxi.generic_util.pack_list(self.tlvs))
3944 length = sum([len(x) for x in packed])
3945 packed[2] = struct.pack("!H", length)
3946 return ''.join(packed)
3947
3948 @staticmethod
3949 def unpack(reader):
3950 obj = bsn_generic_stats_request()
3951 _version = reader.read("!B")[0]
3952 assert(_version == 5)
3953 _type = reader.read("!B")[0]
3954 assert(_type == 18)
3955 _length = reader.read("!H")[0]
3956 orig_reader = reader
3957 reader = orig_reader.slice(_length, 4)
3958 obj.xid = reader.read("!L")[0]
3959 _stats_type = reader.read("!H")[0]
3960 assert(_stats_type == 65535)
3961 obj.flags = reader.read("!H")[0]
3962 reader.skip(4)
3963 _experimenter = reader.read("!L")[0]
3964 assert(_experimenter == 6035143)
3965 _subtype = reader.read("!L")[0]
3966 assert(_subtype == 16)
3967 obj.name = reader.read("!64s")[0].rstrip("\x00")
3968 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3969 return obj
3970
3971 def __eq__(self, other):
3972 if type(self) != type(other): return False
3973 if self.xid != other.xid: return False
3974 if self.flags != other.flags: return False
3975 if self.name != other.name: return False
3976 if self.tlvs != other.tlvs: return False
3977 return True
3978
3979 def pretty_print(self, q):
3980 q.text("bsn_generic_stats_request {")
3981 with q.group():
3982 with q.indent(2):
3983 q.breakable()
3984 q.text("xid = ");
3985 if self.xid != None:
3986 q.text("%#x" % self.xid)
3987 else:
3988 q.text('None')
3989 q.text(","); q.breakable()
3990 q.text("flags = ");
3991 q.text("%#x" % self.flags)
3992 q.text(","); q.breakable()
3993 q.text("name = ");
3994 q.pp(self.name)
3995 q.text(","); q.breakable()
3996 q.text("tlvs = ");
3997 q.pp(self.tlvs)
3998 q.breakable()
3999 q.text('}')
4000
4001bsn_stats_request.subtypes[16] = bsn_generic_stats_request
4002
4003class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
4004 version = 5
4005 type = 19
4006 stats_type = 65535
4007 experimenter = 6035143
4008 subtype = 5
4009
4010 def __init__(self, xid=None, flags=None, entries=None):
4011 if xid != None:
4012 self.xid = xid
4013 else:
4014 self.xid = None
4015 if flags != None:
4016 self.flags = flags
4017 else:
4018 self.flags = 0
4019 if entries != None:
4020 self.entries = entries
4021 else:
4022 self.entries = []
4023 return
4024
4025 def pack(self):
4026 packed = []
4027 packed.append(struct.pack("!B", self.version))
4028 packed.append(struct.pack("!B", self.type))
4029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4030 packed.append(struct.pack("!L", self.xid))
4031 packed.append(struct.pack("!H", self.stats_type))
4032 packed.append(struct.pack("!H", self.flags))
4033 packed.append('\x00' * 4)
4034 packed.append(struct.pack("!L", self.experimenter))
4035 packed.append(struct.pack("!L", self.subtype))
4036 packed.append(loxi.generic_util.pack_list(self.entries))
4037 length = sum([len(x) for x in packed])
4038 packed[2] = struct.pack("!H", length)
4039 return ''.join(packed)
4040
4041 @staticmethod
4042 def unpack(reader):
4043 obj = bsn_gentable_bucket_stats_reply()
4044 _version = reader.read("!B")[0]
4045 assert(_version == 5)
4046 _type = reader.read("!B")[0]
4047 assert(_type == 19)
4048 _length = reader.read("!H")[0]
4049 orig_reader = reader
4050 reader = orig_reader.slice(_length, 4)
4051 obj.xid = reader.read("!L")[0]
4052 _stats_type = reader.read("!H")[0]
4053 assert(_stats_type == 65535)
4054 obj.flags = reader.read("!H")[0]
4055 reader.skip(4)
4056 _experimenter = reader.read("!L")[0]
4057 assert(_experimenter == 6035143)
4058 _subtype = reader.read("!L")[0]
4059 assert(_subtype == 5)
4060 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
4061 return obj
4062
4063 def __eq__(self, other):
4064 if type(self) != type(other): return False
4065 if self.xid != other.xid: return False
4066 if self.flags != other.flags: return False
4067 if self.entries != other.entries: return False
4068 return True
4069
4070 def pretty_print(self, q):
4071 q.text("bsn_gentable_bucket_stats_reply {")
4072 with q.group():
4073 with q.indent(2):
4074 q.breakable()
4075 q.text("xid = ");
4076 if self.xid != None:
4077 q.text("%#x" % self.xid)
4078 else:
4079 q.text('None')
4080 q.text(","); q.breakable()
4081 q.text("flags = ");
4082 q.text("%#x" % self.flags)
4083 q.text(","); q.breakable()
4084 q.text("entries = ");
4085 q.pp(self.entries)
4086 q.breakable()
4087 q.text('}')
4088
4089bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
4090
4091class bsn_gentable_bucket_stats_request(bsn_stats_request):
4092 version = 5
4093 type = 18
4094 stats_type = 65535
4095 experimenter = 6035143
4096 subtype = 5
4097
4098 def __init__(self, xid=None, flags=None, table_id=None):
4099 if xid != None:
4100 self.xid = xid
4101 else:
4102 self.xid = None
4103 if flags != None:
4104 self.flags = flags
4105 else:
4106 self.flags = 0
4107 if table_id != None:
4108 self.table_id = table_id
4109 else:
4110 self.table_id = 0
4111 return
4112
4113 def pack(self):
4114 packed = []
4115 packed.append(struct.pack("!B", self.version))
4116 packed.append(struct.pack("!B", self.type))
4117 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4118 packed.append(struct.pack("!L", self.xid))
4119 packed.append(struct.pack("!H", self.stats_type))
4120 packed.append(struct.pack("!H", self.flags))
4121 packed.append('\x00' * 4)
4122 packed.append(struct.pack("!L", self.experimenter))
4123 packed.append(struct.pack("!L", self.subtype))
4124 packed.append(struct.pack("!H", self.table_id))
4125 length = sum([len(x) for x in packed])
4126 packed[2] = struct.pack("!H", length)
4127 return ''.join(packed)
4128
4129 @staticmethod
4130 def unpack(reader):
4131 obj = bsn_gentable_bucket_stats_request()
4132 _version = reader.read("!B")[0]
4133 assert(_version == 5)
4134 _type = reader.read("!B")[0]
4135 assert(_type == 18)
4136 _length = reader.read("!H")[0]
4137 orig_reader = reader
4138 reader = orig_reader.slice(_length, 4)
4139 obj.xid = reader.read("!L")[0]
4140 _stats_type = reader.read("!H")[0]
4141 assert(_stats_type == 65535)
4142 obj.flags = reader.read("!H")[0]
4143 reader.skip(4)
4144 _experimenter = reader.read("!L")[0]
4145 assert(_experimenter == 6035143)
4146 _subtype = reader.read("!L")[0]
4147 assert(_subtype == 5)
4148 obj.table_id = reader.read("!H")[0]
4149 return obj
4150
4151 def __eq__(self, other):
4152 if type(self) != type(other): return False
4153 if self.xid != other.xid: return False
4154 if self.flags != other.flags: return False
4155 if self.table_id != other.table_id: return False
4156 return True
4157
4158 def pretty_print(self, q):
4159 q.text("bsn_gentable_bucket_stats_request {")
4160 with q.group():
4161 with q.indent(2):
4162 q.breakable()
4163 q.text("xid = ");
4164 if self.xid != None:
4165 q.text("%#x" % self.xid)
4166 else:
4167 q.text('None')
4168 q.text(","); q.breakable()
4169 q.text("flags = ");
4170 q.text("%#x" % self.flags)
4171 q.text(","); q.breakable()
4172 q.text("table_id = ");
4173 q.text("%#x" % self.table_id)
4174 q.breakable()
4175 q.text('}')
4176
4177bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
4178
4179class bsn_gentable_clear_reply(bsn_header):
4180 version = 5
4181 type = 4
4182 experimenter = 6035143
4183 subtype = 49
4184
4185 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
4186 if xid != None:
4187 self.xid = xid
4188 else:
4189 self.xid = None
4190 if table_id != None:
4191 self.table_id = table_id
4192 else:
4193 self.table_id = 0
4194 if deleted_count != None:
4195 self.deleted_count = deleted_count
4196 else:
4197 self.deleted_count = 0
4198 if error_count != None:
4199 self.error_count = error_count
4200 else:
4201 self.error_count = 0
4202 return
4203
4204 def pack(self):
4205 packed = []
4206 packed.append(struct.pack("!B", self.version))
4207 packed.append(struct.pack("!B", self.type))
4208 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4209 packed.append(struct.pack("!L", self.xid))
4210 packed.append(struct.pack("!L", self.experimenter))
4211 packed.append(struct.pack("!L", self.subtype))
4212 packed.append(struct.pack("!H", self.table_id))
4213 packed.append('\x00' * 2)
4214 packed.append(struct.pack("!L", self.deleted_count))
4215 packed.append(struct.pack("!L", self.error_count))
4216 length = sum([len(x) for x in packed])
4217 packed[2] = struct.pack("!H", length)
4218 return ''.join(packed)
4219
4220 @staticmethod
4221 def unpack(reader):
4222 obj = bsn_gentable_clear_reply()
4223 _version = reader.read("!B")[0]
4224 assert(_version == 5)
4225 _type = reader.read("!B")[0]
4226 assert(_type == 4)
4227 _length = reader.read("!H")[0]
4228 orig_reader = reader
4229 reader = orig_reader.slice(_length, 4)
4230 obj.xid = reader.read("!L")[0]
4231 _experimenter = reader.read("!L")[0]
4232 assert(_experimenter == 6035143)
4233 _subtype = reader.read("!L")[0]
4234 assert(_subtype == 49)
4235 obj.table_id = reader.read("!H")[0]
4236 reader.skip(2)
4237 obj.deleted_count = reader.read("!L")[0]
4238 obj.error_count = reader.read("!L")[0]
4239 return obj
4240
4241 def __eq__(self, other):
4242 if type(self) != type(other): return False
4243 if self.xid != other.xid: return False
4244 if self.table_id != other.table_id: return False
4245 if self.deleted_count != other.deleted_count: return False
4246 if self.error_count != other.error_count: return False
4247 return True
4248
4249 def pretty_print(self, q):
4250 q.text("bsn_gentable_clear_reply {")
4251 with q.group():
4252 with q.indent(2):
4253 q.breakable()
4254 q.text("xid = ");
4255 if self.xid != None:
4256 q.text("%#x" % self.xid)
4257 else:
4258 q.text('None')
4259 q.text(","); q.breakable()
4260 q.text("table_id = ");
4261 q.text("%#x" % self.table_id)
4262 q.text(","); q.breakable()
4263 q.text("deleted_count = ");
4264 q.text("%#x" % self.deleted_count)
4265 q.text(","); q.breakable()
4266 q.text("error_count = ");
4267 q.text("%#x" % self.error_count)
4268 q.breakable()
4269 q.text('}')
4270
4271bsn_header.subtypes[49] = bsn_gentable_clear_reply
4272
4273class bsn_gentable_clear_request(bsn_header):
4274 version = 5
4275 type = 4
4276 experimenter = 6035143
4277 subtype = 48
4278
4279 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
4280 if xid != None:
4281 self.xid = xid
4282 else:
4283 self.xid = None
4284 if table_id != None:
4285 self.table_id = table_id
4286 else:
4287 self.table_id = 0
4288 if checksum != None:
4289 self.checksum = checksum
4290 else:
4291 self.checksum = 0
4292 if checksum_mask != None:
4293 self.checksum_mask = checksum_mask
4294 else:
4295 self.checksum_mask = 0
4296 return
4297
4298 def pack(self):
4299 packed = []
4300 packed.append(struct.pack("!B", self.version))
4301 packed.append(struct.pack("!B", self.type))
4302 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4303 packed.append(struct.pack("!L", self.xid))
4304 packed.append(struct.pack("!L", self.experimenter))
4305 packed.append(struct.pack("!L", self.subtype))
4306 packed.append(struct.pack("!H", self.table_id))
4307 packed.append('\x00' * 2)
4308 packed.append(util.pack_checksum_128(self.checksum))
4309 packed.append(util.pack_checksum_128(self.checksum_mask))
4310 length = sum([len(x) for x in packed])
4311 packed[2] = struct.pack("!H", length)
4312 return ''.join(packed)
4313
4314 @staticmethod
4315 def unpack(reader):
4316 obj = bsn_gentable_clear_request()
4317 _version = reader.read("!B")[0]
4318 assert(_version == 5)
4319 _type = reader.read("!B")[0]
4320 assert(_type == 4)
4321 _length = reader.read("!H")[0]
4322 orig_reader = reader
4323 reader = orig_reader.slice(_length, 4)
4324 obj.xid = reader.read("!L")[0]
4325 _experimenter = reader.read("!L")[0]
4326 assert(_experimenter == 6035143)
4327 _subtype = reader.read("!L")[0]
4328 assert(_subtype == 48)
4329 obj.table_id = reader.read("!H")[0]
4330 reader.skip(2)
4331 obj.checksum = util.unpack_checksum_128(reader)
4332 obj.checksum_mask = util.unpack_checksum_128(reader)
4333 return obj
4334
4335 def __eq__(self, other):
4336 if type(self) != type(other): return False
4337 if self.xid != other.xid: return False
4338 if self.table_id != other.table_id: return False
4339 if self.checksum != other.checksum: return False
4340 if self.checksum_mask != other.checksum_mask: return False
4341 return True
4342
4343 def pretty_print(self, q):
4344 q.text("bsn_gentable_clear_request {")
4345 with q.group():
4346 with q.indent(2):
4347 q.breakable()
4348 q.text("xid = ");
4349 if self.xid != None:
4350 q.text("%#x" % self.xid)
4351 else:
4352 q.text('None')
4353 q.text(","); q.breakable()
4354 q.text("table_id = ");
4355 q.text("%#x" % self.table_id)
4356 q.text(","); q.breakable()
4357 q.text("checksum = ");
4358 q.pp(self.checksum)
4359 q.text(","); q.breakable()
4360 q.text("checksum_mask = ");
4361 q.pp(self.checksum_mask)
4362 q.breakable()
4363 q.text('}')
4364
4365bsn_header.subtypes[48] = bsn_gentable_clear_request
4366
4367class bsn_gentable_desc_stats_reply(bsn_stats_reply):
4368 version = 5
4369 type = 19
4370 stats_type = 65535
4371 experimenter = 6035143
4372 subtype = 4
4373
4374 def __init__(self, xid=None, flags=None, entries=None):
4375 if xid != None:
4376 self.xid = xid
4377 else:
4378 self.xid = None
4379 if flags != None:
4380 self.flags = flags
4381 else:
4382 self.flags = 0
4383 if entries != None:
4384 self.entries = entries
4385 else:
4386 self.entries = []
4387 return
4388
4389 def pack(self):
4390 packed = []
4391 packed.append(struct.pack("!B", self.version))
4392 packed.append(struct.pack("!B", self.type))
4393 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4394 packed.append(struct.pack("!L", self.xid))
4395 packed.append(struct.pack("!H", self.stats_type))
4396 packed.append(struct.pack("!H", self.flags))
4397 packed.append('\x00' * 4)
4398 packed.append(struct.pack("!L", self.experimenter))
4399 packed.append(struct.pack("!L", self.subtype))
4400 packed.append(loxi.generic_util.pack_list(self.entries))
4401 length = sum([len(x) for x in packed])
4402 packed[2] = struct.pack("!H", length)
4403 return ''.join(packed)
4404
4405 @staticmethod
4406 def unpack(reader):
4407 obj = bsn_gentable_desc_stats_reply()
4408 _version = reader.read("!B")[0]
4409 assert(_version == 5)
4410 _type = reader.read("!B")[0]
4411 assert(_type == 19)
4412 _length = reader.read("!H")[0]
4413 orig_reader = reader
4414 reader = orig_reader.slice(_length, 4)
4415 obj.xid = reader.read("!L")[0]
4416 _stats_type = reader.read("!H")[0]
4417 assert(_stats_type == 65535)
4418 obj.flags = reader.read("!H")[0]
4419 reader.skip(4)
4420 _experimenter = reader.read("!L")[0]
4421 assert(_experimenter == 6035143)
4422 _subtype = reader.read("!L")[0]
4423 assert(_subtype == 4)
4424 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
4425 return obj
4426
4427 def __eq__(self, other):
4428 if type(self) != type(other): return False
4429 if self.xid != other.xid: return False
4430 if self.flags != other.flags: return False
4431 if self.entries != other.entries: return False
4432 return True
4433
4434 def pretty_print(self, q):
4435 q.text("bsn_gentable_desc_stats_reply {")
4436 with q.group():
4437 with q.indent(2):
4438 q.breakable()
4439 q.text("xid = ");
4440 if self.xid != None:
4441 q.text("%#x" % self.xid)
4442 else:
4443 q.text('None')
4444 q.text(","); q.breakable()
4445 q.text("flags = ");
4446 q.text("%#x" % self.flags)
4447 q.text(","); q.breakable()
4448 q.text("entries = ");
4449 q.pp(self.entries)
4450 q.breakable()
4451 q.text('}')
4452
4453bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4454
4455class bsn_gentable_desc_stats_request(bsn_stats_request):
4456 version = 5
4457 type = 18
4458 stats_type = 65535
4459 experimenter = 6035143
4460 subtype = 4
4461
4462 def __init__(self, xid=None, flags=None):
4463 if xid != None:
4464 self.xid = xid
4465 else:
4466 self.xid = None
4467 if flags != None:
4468 self.flags = flags
4469 else:
4470 self.flags = 0
4471 return
4472
4473 def pack(self):
4474 packed = []
4475 packed.append(struct.pack("!B", self.version))
4476 packed.append(struct.pack("!B", self.type))
4477 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4478 packed.append(struct.pack("!L", self.xid))
4479 packed.append(struct.pack("!H", self.stats_type))
4480 packed.append(struct.pack("!H", self.flags))
4481 packed.append('\x00' * 4)
4482 packed.append(struct.pack("!L", self.experimenter))
4483 packed.append(struct.pack("!L", self.subtype))
4484 length = sum([len(x) for x in packed])
4485 packed[2] = struct.pack("!H", length)
4486 return ''.join(packed)
4487
4488 @staticmethod
4489 def unpack(reader):
4490 obj = bsn_gentable_desc_stats_request()
4491 _version = reader.read("!B")[0]
4492 assert(_version == 5)
4493 _type = reader.read("!B")[0]
4494 assert(_type == 18)
4495 _length = reader.read("!H")[0]
4496 orig_reader = reader
4497 reader = orig_reader.slice(_length, 4)
4498 obj.xid = reader.read("!L")[0]
4499 _stats_type = reader.read("!H")[0]
4500 assert(_stats_type == 65535)
4501 obj.flags = reader.read("!H")[0]
4502 reader.skip(4)
4503 _experimenter = reader.read("!L")[0]
4504 assert(_experimenter == 6035143)
4505 _subtype = reader.read("!L")[0]
4506 assert(_subtype == 4)
4507 return obj
4508
4509 def __eq__(self, other):
4510 if type(self) != type(other): return False
4511 if self.xid != other.xid: return False
4512 if self.flags != other.flags: return False
4513 return True
4514
4515 def pretty_print(self, q):
4516 q.text("bsn_gentable_desc_stats_request {")
4517 with q.group():
4518 with q.indent(2):
4519 q.breakable()
4520 q.text("xid = ");
4521 if self.xid != None:
4522 q.text("%#x" % self.xid)
4523 else:
4524 q.text('None')
4525 q.text(","); q.breakable()
4526 q.text("flags = ");
4527 q.text("%#x" % self.flags)
4528 q.breakable()
4529 q.text('}')
4530
4531bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4532
4533class bsn_gentable_entry_add(bsn_header):
4534 version = 5
4535 type = 4
4536 experimenter = 6035143
4537 subtype = 46
4538
4539 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4540 if xid != None:
4541 self.xid = xid
4542 else:
4543 self.xid = None
4544 if table_id != None:
4545 self.table_id = table_id
4546 else:
4547 self.table_id = 0
4548 if checksum != None:
4549 self.checksum = checksum
4550 else:
4551 self.checksum = 0
4552 if key != None:
4553 self.key = key
4554 else:
4555 self.key = []
4556 if value != None:
4557 self.value = value
4558 else:
4559 self.value = []
4560 return
4561
4562 def pack(self):
4563 packed = []
4564 packed.append(struct.pack("!B", self.version))
4565 packed.append(struct.pack("!B", self.type))
4566 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4567 packed.append(struct.pack("!L", self.xid))
4568 packed.append(struct.pack("!L", self.experimenter))
4569 packed.append(struct.pack("!L", self.subtype))
4570 packed.append(struct.pack("!H", self.table_id))
4571 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4572 packed.append(util.pack_checksum_128(self.checksum))
4573 packed.append(loxi.generic_util.pack_list(self.key))
4574 packed[7] = struct.pack("!H", len(packed[-1]))
4575 packed.append(loxi.generic_util.pack_list(self.value))
4576 length = sum([len(x) for x in packed])
4577 packed[2] = struct.pack("!H", length)
4578 return ''.join(packed)
4579
4580 @staticmethod
4581 def unpack(reader):
4582 obj = bsn_gentable_entry_add()
4583 _version = reader.read("!B")[0]
4584 assert(_version == 5)
4585 _type = reader.read("!B")[0]
4586 assert(_type == 4)
4587 _length = reader.read("!H")[0]
4588 orig_reader = reader
4589 reader = orig_reader.slice(_length, 4)
4590 obj.xid = reader.read("!L")[0]
4591 _experimenter = reader.read("!L")[0]
4592 assert(_experimenter == 6035143)
4593 _subtype = reader.read("!L")[0]
4594 assert(_subtype == 46)
4595 obj.table_id = reader.read("!H")[0]
4596 _key_length = reader.read("!H")[0]
4597 obj.checksum = util.unpack_checksum_128(reader)
4598 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4599 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4600 return obj
4601
4602 def __eq__(self, other):
4603 if type(self) != type(other): return False
4604 if self.xid != other.xid: return False
4605 if self.table_id != other.table_id: return False
4606 if self.checksum != other.checksum: return False
4607 if self.key != other.key: return False
4608 if self.value != other.value: return False
4609 return True
4610
4611 def pretty_print(self, q):
4612 q.text("bsn_gentable_entry_add {")
4613 with q.group():
4614 with q.indent(2):
4615 q.breakable()
4616 q.text("xid = ");
4617 if self.xid != None:
4618 q.text("%#x" % self.xid)
4619 else:
4620 q.text('None')
4621 q.text(","); q.breakable()
4622 q.text("table_id = ");
4623 q.text("%#x" % self.table_id)
4624 q.text(","); q.breakable()
4625 q.text("checksum = ");
4626 q.pp(self.checksum)
4627 q.text(","); q.breakable()
4628 q.text("key = ");
4629 q.pp(self.key)
4630 q.text(","); q.breakable()
4631 q.text("value = ");
4632 q.pp(self.value)
4633 q.breakable()
4634 q.text('}')
4635
4636bsn_header.subtypes[46] = bsn_gentable_entry_add
4637
4638class bsn_gentable_entry_delete(bsn_header):
4639 version = 5
4640 type = 4
4641 experimenter = 6035143
4642 subtype = 47
4643
4644 def __init__(self, xid=None, table_id=None, key=None):
4645 if xid != None:
4646 self.xid = xid
4647 else:
4648 self.xid = None
4649 if table_id != None:
4650 self.table_id = table_id
4651 else:
4652 self.table_id = 0
4653 if key != None:
4654 self.key = key
4655 else:
4656 self.key = []
4657 return
4658
4659 def pack(self):
4660 packed = []
4661 packed.append(struct.pack("!B", self.version))
4662 packed.append(struct.pack("!B", self.type))
4663 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4664 packed.append(struct.pack("!L", self.xid))
4665 packed.append(struct.pack("!L", self.experimenter))
4666 packed.append(struct.pack("!L", self.subtype))
4667 packed.append(struct.pack("!H", self.table_id))
4668 packed.append(loxi.generic_util.pack_list(self.key))
4669 length = sum([len(x) for x in packed])
4670 packed[2] = struct.pack("!H", length)
4671 return ''.join(packed)
4672
4673 @staticmethod
4674 def unpack(reader):
4675 obj = bsn_gentable_entry_delete()
4676 _version = reader.read("!B")[0]
4677 assert(_version == 5)
4678 _type = reader.read("!B")[0]
4679 assert(_type == 4)
4680 _length = reader.read("!H")[0]
4681 orig_reader = reader
4682 reader = orig_reader.slice(_length, 4)
4683 obj.xid = reader.read("!L")[0]
4684 _experimenter = reader.read("!L")[0]
4685 assert(_experimenter == 6035143)
4686 _subtype = reader.read("!L")[0]
4687 assert(_subtype == 47)
4688 obj.table_id = reader.read("!H")[0]
4689 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4690 return obj
4691
4692 def __eq__(self, other):
4693 if type(self) != type(other): return False
4694 if self.xid != other.xid: return False
4695 if self.table_id != other.table_id: return False
4696 if self.key != other.key: return False
4697 return True
4698
4699 def pretty_print(self, q):
4700 q.text("bsn_gentable_entry_delete {")
4701 with q.group():
4702 with q.indent(2):
4703 q.breakable()
4704 q.text("xid = ");
4705 if self.xid != None:
4706 q.text("%#x" % self.xid)
4707 else:
4708 q.text('None')
4709 q.text(","); q.breakable()
4710 q.text("table_id = ");
4711 q.text("%#x" % self.table_id)
4712 q.text(","); q.breakable()
4713 q.text("key = ");
4714 q.pp(self.key)
4715 q.breakable()
4716 q.text('}')
4717
4718bsn_header.subtypes[47] = bsn_gentable_entry_delete
4719
4720class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4721 version = 5
4722 type = 19
4723 stats_type = 65535
4724 experimenter = 6035143
4725 subtype = 2
4726
4727 def __init__(self, xid=None, flags=None, entries=None):
4728 if xid != None:
4729 self.xid = xid
4730 else:
4731 self.xid = None
4732 if flags != None:
4733 self.flags = flags
4734 else:
4735 self.flags = 0
4736 if entries != None:
4737 self.entries = entries
4738 else:
4739 self.entries = []
4740 return
4741
4742 def pack(self):
4743 packed = []
4744 packed.append(struct.pack("!B", self.version))
4745 packed.append(struct.pack("!B", self.type))
4746 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4747 packed.append(struct.pack("!L", self.xid))
4748 packed.append(struct.pack("!H", self.stats_type))
4749 packed.append(struct.pack("!H", self.flags))
4750 packed.append('\x00' * 4)
4751 packed.append(struct.pack("!L", self.experimenter))
4752 packed.append(struct.pack("!L", self.subtype))
4753 packed.append(loxi.generic_util.pack_list(self.entries))
4754 length = sum([len(x) for x in packed])
4755 packed[2] = struct.pack("!H", length)
4756 return ''.join(packed)
4757
4758 @staticmethod
4759 def unpack(reader):
4760 obj = bsn_gentable_entry_desc_stats_reply()
4761 _version = reader.read("!B")[0]
4762 assert(_version == 5)
4763 _type = reader.read("!B")[0]
4764 assert(_type == 19)
4765 _length = reader.read("!H")[0]
4766 orig_reader = reader
4767 reader = orig_reader.slice(_length, 4)
4768 obj.xid = reader.read("!L")[0]
4769 _stats_type = reader.read("!H")[0]
4770 assert(_stats_type == 65535)
4771 obj.flags = reader.read("!H")[0]
4772 reader.skip(4)
4773 _experimenter = reader.read("!L")[0]
4774 assert(_experimenter == 6035143)
4775 _subtype = reader.read("!L")[0]
4776 assert(_subtype == 2)
4777 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
4778 return obj
4779
4780 def __eq__(self, other):
4781 if type(self) != type(other): return False
4782 if self.xid != other.xid: return False
4783 if self.flags != other.flags: return False
4784 if self.entries != other.entries: return False
4785 return True
4786
4787 def pretty_print(self, q):
4788 q.text("bsn_gentable_entry_desc_stats_reply {")
4789 with q.group():
4790 with q.indent(2):
4791 q.breakable()
4792 q.text("xid = ");
4793 if self.xid != None:
4794 q.text("%#x" % self.xid)
4795 else:
4796 q.text('None')
4797 q.text(","); q.breakable()
4798 q.text("flags = ");
4799 q.text("%#x" % self.flags)
4800 q.text(","); q.breakable()
4801 q.text("entries = ");
4802 q.pp(self.entries)
4803 q.breakable()
4804 q.text('}')
4805
4806bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4807
4808class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4809 version = 5
4810 type = 18
4811 stats_type = 65535
4812 experimenter = 6035143
4813 subtype = 2
4814
4815 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4816 if xid != None:
4817 self.xid = xid
4818 else:
4819 self.xid = None
4820 if flags != None:
4821 self.flags = flags
4822 else:
4823 self.flags = 0
4824 if table_id != None:
4825 self.table_id = table_id
4826 else:
4827 self.table_id = 0
4828 if checksum != None:
4829 self.checksum = checksum
4830 else:
4831 self.checksum = 0
4832 if checksum_mask != None:
4833 self.checksum_mask = checksum_mask
4834 else:
4835 self.checksum_mask = 0
4836 return
4837
4838 def pack(self):
4839 packed = []
4840 packed.append(struct.pack("!B", self.version))
4841 packed.append(struct.pack("!B", self.type))
4842 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4843 packed.append(struct.pack("!L", self.xid))
4844 packed.append(struct.pack("!H", self.stats_type))
4845 packed.append(struct.pack("!H", self.flags))
4846 packed.append('\x00' * 4)
4847 packed.append(struct.pack("!L", self.experimenter))
4848 packed.append(struct.pack("!L", self.subtype))
4849 packed.append(struct.pack("!H", self.table_id))
4850 packed.append('\x00' * 2)
4851 packed.append(util.pack_checksum_128(self.checksum))
4852 packed.append(util.pack_checksum_128(self.checksum_mask))
4853 length = sum([len(x) for x in packed])
4854 packed[2] = struct.pack("!H", length)
4855 return ''.join(packed)
4856
4857 @staticmethod
4858 def unpack(reader):
4859 obj = bsn_gentable_entry_desc_stats_request()
4860 _version = reader.read("!B")[0]
4861 assert(_version == 5)
4862 _type = reader.read("!B")[0]
4863 assert(_type == 18)
4864 _length = reader.read("!H")[0]
4865 orig_reader = reader
4866 reader = orig_reader.slice(_length, 4)
4867 obj.xid = reader.read("!L")[0]
4868 _stats_type = reader.read("!H")[0]
4869 assert(_stats_type == 65535)
4870 obj.flags = reader.read("!H")[0]
4871 reader.skip(4)
4872 _experimenter = reader.read("!L")[0]
4873 assert(_experimenter == 6035143)
4874 _subtype = reader.read("!L")[0]
4875 assert(_subtype == 2)
4876 obj.table_id = reader.read("!H")[0]
4877 reader.skip(2)
4878 obj.checksum = util.unpack_checksum_128(reader)
4879 obj.checksum_mask = util.unpack_checksum_128(reader)
4880 return obj
4881
4882 def __eq__(self, other):
4883 if type(self) != type(other): return False
4884 if self.xid != other.xid: return False
4885 if self.flags != other.flags: return False
4886 if self.table_id != other.table_id: return False
4887 if self.checksum != other.checksum: return False
4888 if self.checksum_mask != other.checksum_mask: return False
4889 return True
4890
4891 def pretty_print(self, q):
4892 q.text("bsn_gentable_entry_desc_stats_request {")
4893 with q.group():
4894 with q.indent(2):
4895 q.breakable()
4896 q.text("xid = ");
4897 if self.xid != None:
4898 q.text("%#x" % self.xid)
4899 else:
4900 q.text('None')
4901 q.text(","); q.breakable()
4902 q.text("flags = ");
4903 q.text("%#x" % self.flags)
4904 q.text(","); q.breakable()
4905 q.text("table_id = ");
4906 q.text("%#x" % self.table_id)
4907 q.text(","); q.breakable()
4908 q.text("checksum = ");
4909 q.pp(self.checksum)
4910 q.text(","); q.breakable()
4911 q.text("checksum_mask = ");
4912 q.pp(self.checksum_mask)
4913 q.breakable()
4914 q.text('}')
4915
4916bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4917
4918class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4919 version = 5
4920 type = 19
4921 stats_type = 65535
4922 experimenter = 6035143
4923 subtype = 3
4924
4925 def __init__(self, xid=None, flags=None, entries=None):
4926 if xid != None:
4927 self.xid = xid
4928 else:
4929 self.xid = None
4930 if flags != None:
4931 self.flags = flags
4932 else:
4933 self.flags = 0
4934 if entries != None:
4935 self.entries = entries
4936 else:
4937 self.entries = []
4938 return
4939
4940 def pack(self):
4941 packed = []
4942 packed.append(struct.pack("!B", self.version))
4943 packed.append(struct.pack("!B", self.type))
4944 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4945 packed.append(struct.pack("!L", self.xid))
4946 packed.append(struct.pack("!H", self.stats_type))
4947 packed.append(struct.pack("!H", self.flags))
4948 packed.append('\x00' * 4)
4949 packed.append(struct.pack("!L", self.experimenter))
4950 packed.append(struct.pack("!L", self.subtype))
4951 packed.append(loxi.generic_util.pack_list(self.entries))
4952 length = sum([len(x) for x in packed])
4953 packed[2] = struct.pack("!H", length)
4954 return ''.join(packed)
4955
4956 @staticmethod
4957 def unpack(reader):
4958 obj = bsn_gentable_entry_stats_reply()
4959 _version = reader.read("!B")[0]
4960 assert(_version == 5)
4961 _type = reader.read("!B")[0]
4962 assert(_type == 19)
4963 _length = reader.read("!H")[0]
4964 orig_reader = reader
4965 reader = orig_reader.slice(_length, 4)
4966 obj.xid = reader.read("!L")[0]
4967 _stats_type = reader.read("!H")[0]
4968 assert(_stats_type == 65535)
4969 obj.flags = reader.read("!H")[0]
4970 reader.skip(4)
4971 _experimenter = reader.read("!L")[0]
4972 assert(_experimenter == 6035143)
4973 _subtype = reader.read("!L")[0]
4974 assert(_subtype == 3)
4975 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
4976 return obj
4977
4978 def __eq__(self, other):
4979 if type(self) != type(other): return False
4980 if self.xid != other.xid: return False
4981 if self.flags != other.flags: return False
4982 if self.entries != other.entries: return False
4983 return True
4984
4985 def pretty_print(self, q):
4986 q.text("bsn_gentable_entry_stats_reply {")
4987 with q.group():
4988 with q.indent(2):
4989 q.breakable()
4990 q.text("xid = ");
4991 if self.xid != None:
4992 q.text("%#x" % self.xid)
4993 else:
4994 q.text('None')
4995 q.text(","); q.breakable()
4996 q.text("flags = ");
4997 q.text("%#x" % self.flags)
4998 q.text(","); q.breakable()
4999 q.text("entries = ");
5000 q.pp(self.entries)
5001 q.breakable()
5002 q.text('}')
5003
5004bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
5005
5006class bsn_gentable_entry_stats_request(bsn_stats_request):
5007 version = 5
5008 type = 18
5009 stats_type = 65535
5010 experimenter = 6035143
5011 subtype = 3
5012
5013 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
5014 if xid != None:
5015 self.xid = xid
5016 else:
5017 self.xid = None
5018 if flags != None:
5019 self.flags = flags
5020 else:
5021 self.flags = 0
5022 if table_id != None:
5023 self.table_id = table_id
5024 else:
5025 self.table_id = 0
5026 if checksum != None:
5027 self.checksum = checksum
5028 else:
5029 self.checksum = 0
5030 if checksum_mask != None:
5031 self.checksum_mask = checksum_mask
5032 else:
5033 self.checksum_mask = 0
5034 return
5035
5036 def pack(self):
5037 packed = []
5038 packed.append(struct.pack("!B", self.version))
5039 packed.append(struct.pack("!B", self.type))
5040 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5041 packed.append(struct.pack("!L", self.xid))
5042 packed.append(struct.pack("!H", self.stats_type))
5043 packed.append(struct.pack("!H", self.flags))
5044 packed.append('\x00' * 4)
5045 packed.append(struct.pack("!L", self.experimenter))
5046 packed.append(struct.pack("!L", self.subtype))
5047 packed.append(struct.pack("!H", self.table_id))
5048 packed.append('\x00' * 2)
5049 packed.append(util.pack_checksum_128(self.checksum))
5050 packed.append(util.pack_checksum_128(self.checksum_mask))
5051 length = sum([len(x) for x in packed])
5052 packed[2] = struct.pack("!H", length)
5053 return ''.join(packed)
5054
5055 @staticmethod
5056 def unpack(reader):
5057 obj = bsn_gentable_entry_stats_request()
5058 _version = reader.read("!B")[0]
5059 assert(_version == 5)
5060 _type = reader.read("!B")[0]
5061 assert(_type == 18)
5062 _length = reader.read("!H")[0]
5063 orig_reader = reader
5064 reader = orig_reader.slice(_length, 4)
5065 obj.xid = reader.read("!L")[0]
5066 _stats_type = reader.read("!H")[0]
5067 assert(_stats_type == 65535)
5068 obj.flags = reader.read("!H")[0]
5069 reader.skip(4)
5070 _experimenter = reader.read("!L")[0]
5071 assert(_experimenter == 6035143)
5072 _subtype = reader.read("!L")[0]
5073 assert(_subtype == 3)
5074 obj.table_id = reader.read("!H")[0]
5075 reader.skip(2)
5076 obj.checksum = util.unpack_checksum_128(reader)
5077 obj.checksum_mask = util.unpack_checksum_128(reader)
5078 return obj
5079
5080 def __eq__(self, other):
5081 if type(self) != type(other): return False
5082 if self.xid != other.xid: return False
5083 if self.flags != other.flags: return False
5084 if self.table_id != other.table_id: return False
5085 if self.checksum != other.checksum: return False
5086 if self.checksum_mask != other.checksum_mask: return False
5087 return True
5088
5089 def pretty_print(self, q):
5090 q.text("bsn_gentable_entry_stats_request {")
5091 with q.group():
5092 with q.indent(2):
5093 q.breakable()
5094 q.text("xid = ");
5095 if self.xid != None:
5096 q.text("%#x" % self.xid)
5097 else:
5098 q.text('None')
5099 q.text(","); q.breakable()
5100 q.text("flags = ");
5101 q.text("%#x" % self.flags)
5102 q.text(","); q.breakable()
5103 q.text("table_id = ");
5104 q.text("%#x" % self.table_id)
5105 q.text(","); q.breakable()
5106 q.text("checksum = ");
5107 q.pp(self.checksum)
5108 q.text(","); q.breakable()
5109 q.text("checksum_mask = ");
5110 q.pp(self.checksum_mask)
5111 q.breakable()
5112 q.text('}')
5113
5114bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
5115
5116class bsn_gentable_set_buckets_size(bsn_header):
5117 version = 5
5118 type = 4
5119 experimenter = 6035143
5120 subtype = 50
5121
5122 def __init__(self, xid=None, table_id=None, buckets_size=None):
5123 if xid != None:
5124 self.xid = xid
5125 else:
5126 self.xid = None
5127 if table_id != None:
5128 self.table_id = table_id
5129 else:
5130 self.table_id = 0
5131 if buckets_size != None:
5132 self.buckets_size = buckets_size
5133 else:
5134 self.buckets_size = 0
5135 return
5136
5137 def pack(self):
5138 packed = []
5139 packed.append(struct.pack("!B", self.version))
5140 packed.append(struct.pack("!B", self.type))
5141 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5142 packed.append(struct.pack("!L", self.xid))
5143 packed.append(struct.pack("!L", self.experimenter))
5144 packed.append(struct.pack("!L", self.subtype))
5145 packed.append(struct.pack("!H", self.table_id))
5146 packed.append('\x00' * 2)
5147 packed.append(struct.pack("!L", self.buckets_size))
5148 length = sum([len(x) for x in packed])
5149 packed[2] = struct.pack("!H", length)
5150 return ''.join(packed)
5151
5152 @staticmethod
5153 def unpack(reader):
5154 obj = bsn_gentable_set_buckets_size()
5155 _version = reader.read("!B")[0]
5156 assert(_version == 5)
5157 _type = reader.read("!B")[0]
5158 assert(_type == 4)
5159 _length = reader.read("!H")[0]
5160 orig_reader = reader
5161 reader = orig_reader.slice(_length, 4)
5162 obj.xid = reader.read("!L")[0]
5163 _experimenter = reader.read("!L")[0]
5164 assert(_experimenter == 6035143)
5165 _subtype = reader.read("!L")[0]
5166 assert(_subtype == 50)
5167 obj.table_id = reader.read("!H")[0]
5168 reader.skip(2)
5169 obj.buckets_size = reader.read("!L")[0]
5170 return obj
5171
5172 def __eq__(self, other):
5173 if type(self) != type(other): return False
5174 if self.xid != other.xid: return False
5175 if self.table_id != other.table_id: return False
5176 if self.buckets_size != other.buckets_size: return False
5177 return True
5178
5179 def pretty_print(self, q):
5180 q.text("bsn_gentable_set_buckets_size {")
5181 with q.group():
5182 with q.indent(2):
5183 q.breakable()
5184 q.text("xid = ");
5185 if self.xid != None:
5186 q.text("%#x" % self.xid)
5187 else:
5188 q.text('None')
5189 q.text(","); q.breakable()
5190 q.text("table_id = ");
5191 q.text("%#x" % self.table_id)
5192 q.text(","); q.breakable()
5193 q.text("buckets_size = ");
5194 q.text("%#x" % self.buckets_size)
5195 q.breakable()
5196 q.text('}')
5197
5198bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
5199
5200class bsn_gentable_stats_reply(bsn_stats_reply):
5201 version = 5
5202 type = 19
5203 stats_type = 65535
5204 experimenter = 6035143
5205 subtype = 7
5206
5207 def __init__(self, xid=None, flags=None, entries=None):
5208 if xid != None:
5209 self.xid = xid
5210 else:
5211 self.xid = None
5212 if flags != None:
5213 self.flags = flags
5214 else:
5215 self.flags = 0
5216 if entries != None:
5217 self.entries = entries
5218 else:
5219 self.entries = []
5220 return
5221
5222 def pack(self):
5223 packed = []
5224 packed.append(struct.pack("!B", self.version))
5225 packed.append(struct.pack("!B", self.type))
5226 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5227 packed.append(struct.pack("!L", self.xid))
5228 packed.append(struct.pack("!H", self.stats_type))
5229 packed.append(struct.pack("!H", self.flags))
5230 packed.append('\x00' * 4)
5231 packed.append(struct.pack("!L", self.experimenter))
5232 packed.append(struct.pack("!L", self.subtype))
5233 packed.append(loxi.generic_util.pack_list(self.entries))
5234 length = sum([len(x) for x in packed])
5235 packed[2] = struct.pack("!H", length)
5236 return ''.join(packed)
5237
5238 @staticmethod
5239 def unpack(reader):
5240 obj = bsn_gentable_stats_reply()
5241 _version = reader.read("!B")[0]
5242 assert(_version == 5)
5243 _type = reader.read("!B")[0]
5244 assert(_type == 19)
5245 _length = reader.read("!H")[0]
5246 orig_reader = reader
5247 reader = orig_reader.slice(_length, 4)
5248 obj.xid = reader.read("!L")[0]
5249 _stats_type = reader.read("!H")[0]
5250 assert(_stats_type == 65535)
5251 obj.flags = reader.read("!H")[0]
5252 reader.skip(4)
5253 _experimenter = reader.read("!L")[0]
5254 assert(_experimenter == 6035143)
5255 _subtype = reader.read("!L")[0]
5256 assert(_subtype == 7)
5257 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
5258 return obj
5259
5260 def __eq__(self, other):
5261 if type(self) != type(other): return False
5262 if self.xid != other.xid: return False
5263 if self.flags != other.flags: return False
5264 if self.entries != other.entries: return False
5265 return True
5266
5267 def pretty_print(self, q):
5268 q.text("bsn_gentable_stats_reply {")
5269 with q.group():
5270 with q.indent(2):
5271 q.breakable()
5272 q.text("xid = ");
5273 if self.xid != None:
5274 q.text("%#x" % self.xid)
5275 else:
5276 q.text('None')
5277 q.text(","); q.breakable()
5278 q.text("flags = ");
5279 q.text("%#x" % self.flags)
5280 q.text(","); q.breakable()
5281 q.text("entries = ");
5282 q.pp(self.entries)
5283 q.breakable()
5284 q.text('}')
5285
5286bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
5287
5288class bsn_gentable_stats_request(bsn_stats_request):
5289 version = 5
5290 type = 18
5291 stats_type = 65535
5292 experimenter = 6035143
5293 subtype = 7
5294
5295 def __init__(self, xid=None, flags=None):
5296 if xid != None:
5297 self.xid = xid
5298 else:
5299 self.xid = None
5300 if flags != None:
5301 self.flags = flags
5302 else:
5303 self.flags = 0
5304 return
5305
5306 def pack(self):
5307 packed = []
5308 packed.append(struct.pack("!B", self.version))
5309 packed.append(struct.pack("!B", self.type))
5310 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5311 packed.append(struct.pack("!L", self.xid))
5312 packed.append(struct.pack("!H", self.stats_type))
5313 packed.append(struct.pack("!H", self.flags))
5314 packed.append('\x00' * 4)
5315 packed.append(struct.pack("!L", self.experimenter))
5316 packed.append(struct.pack("!L", self.subtype))
5317 length = sum([len(x) for x in packed])
5318 packed[2] = struct.pack("!H", length)
5319 return ''.join(packed)
5320
5321 @staticmethod
5322 def unpack(reader):
5323 obj = bsn_gentable_stats_request()
5324 _version = reader.read("!B")[0]
5325 assert(_version == 5)
5326 _type = reader.read("!B")[0]
5327 assert(_type == 18)
5328 _length = reader.read("!H")[0]
5329 orig_reader = reader
5330 reader = orig_reader.slice(_length, 4)
5331 obj.xid = reader.read("!L")[0]
5332 _stats_type = reader.read("!H")[0]
5333 assert(_stats_type == 65535)
5334 obj.flags = reader.read("!H")[0]
5335 reader.skip(4)
5336 _experimenter = reader.read("!L")[0]
5337 assert(_experimenter == 6035143)
5338 _subtype = reader.read("!L")[0]
5339 assert(_subtype == 7)
5340 return obj
5341
5342 def __eq__(self, other):
5343 if type(self) != type(other): return False
5344 if self.xid != other.xid: return False
5345 if self.flags != other.flags: return False
5346 return True
5347
5348 def pretty_print(self, q):
5349 q.text("bsn_gentable_stats_request {")
5350 with q.group():
5351 with q.indent(2):
5352 q.breakable()
5353 q.text("xid = ");
5354 if self.xid != None:
5355 q.text("%#x" % self.xid)
5356 else:
5357 q.text('None')
5358 q.text(","); q.breakable()
5359 q.text("flags = ");
5360 q.text("%#x" % self.flags)
5361 q.breakable()
5362 q.text('}')
5363
5364bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
5365
5366class bsn_get_interfaces_reply(bsn_header):
5367 version = 5
5368 type = 4
5369 experimenter = 6035143
5370 subtype = 10
5371
5372 def __init__(self, xid=None, interfaces=None):
5373 if xid != None:
5374 self.xid = xid
5375 else:
5376 self.xid = None
5377 if interfaces != None:
5378 self.interfaces = interfaces
5379 else:
5380 self.interfaces = []
5381 return
5382
5383 def pack(self):
5384 packed = []
5385 packed.append(struct.pack("!B", self.version))
5386 packed.append(struct.pack("!B", self.type))
5387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5388 packed.append(struct.pack("!L", self.xid))
5389 packed.append(struct.pack("!L", self.experimenter))
5390 packed.append(struct.pack("!L", self.subtype))
5391 packed.append(loxi.generic_util.pack_list(self.interfaces))
5392 length = sum([len(x) for x in packed])
5393 packed[2] = struct.pack("!H", length)
5394 return ''.join(packed)
5395
5396 @staticmethod
5397 def unpack(reader):
5398 obj = bsn_get_interfaces_reply()
5399 _version = reader.read("!B")[0]
5400 assert(_version == 5)
5401 _type = reader.read("!B")[0]
5402 assert(_type == 4)
5403 _length = reader.read("!H")[0]
5404 orig_reader = reader
5405 reader = orig_reader.slice(_length, 4)
5406 obj.xid = reader.read("!L")[0]
5407 _experimenter = reader.read("!L")[0]
5408 assert(_experimenter == 6035143)
5409 _subtype = reader.read("!L")[0]
5410 assert(_subtype == 10)
5411 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
5412 return obj
5413
5414 def __eq__(self, other):
5415 if type(self) != type(other): return False
5416 if self.xid != other.xid: return False
5417 if self.interfaces != other.interfaces: return False
5418 return True
5419
5420 def pretty_print(self, q):
5421 q.text("bsn_get_interfaces_reply {")
5422 with q.group():
5423 with q.indent(2):
5424 q.breakable()
5425 q.text("xid = ");
5426 if self.xid != None:
5427 q.text("%#x" % self.xid)
5428 else:
5429 q.text('None')
5430 q.text(","); q.breakable()
5431 q.text("interfaces = ");
5432 q.pp(self.interfaces)
5433 q.breakable()
5434 q.text('}')
5435
5436bsn_header.subtypes[10] = bsn_get_interfaces_reply
5437
5438class bsn_get_interfaces_request(bsn_header):
5439 version = 5
5440 type = 4
5441 experimenter = 6035143
5442 subtype = 9
5443
5444 def __init__(self, xid=None):
5445 if xid != None:
5446 self.xid = xid
5447 else:
5448 self.xid = None
5449 return
5450
5451 def pack(self):
5452 packed = []
5453 packed.append(struct.pack("!B", self.version))
5454 packed.append(struct.pack("!B", self.type))
5455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5456 packed.append(struct.pack("!L", self.xid))
5457 packed.append(struct.pack("!L", self.experimenter))
5458 packed.append(struct.pack("!L", self.subtype))
5459 length = sum([len(x) for x in packed])
5460 packed[2] = struct.pack("!H", length)
5461 return ''.join(packed)
5462
5463 @staticmethod
5464 def unpack(reader):
5465 obj = bsn_get_interfaces_request()
5466 _version = reader.read("!B")[0]
5467 assert(_version == 5)
5468 _type = reader.read("!B")[0]
5469 assert(_type == 4)
5470 _length = reader.read("!H")[0]
5471 orig_reader = reader
5472 reader = orig_reader.slice(_length, 4)
5473 obj.xid = reader.read("!L")[0]
5474 _experimenter = reader.read("!L")[0]
5475 assert(_experimenter == 6035143)
5476 _subtype = reader.read("!L")[0]
5477 assert(_subtype == 9)
5478 return obj
5479
5480 def __eq__(self, other):
5481 if type(self) != type(other): return False
5482 if self.xid != other.xid: return False
5483 return True
5484
5485 def pretty_print(self, q):
5486 q.text("bsn_get_interfaces_request {")
5487 with q.group():
5488 with q.indent(2):
5489 q.breakable()
5490 q.text("xid = ");
5491 if self.xid != None:
5492 q.text("%#x" % self.xid)
5493 else:
5494 q.text('None')
5495 q.breakable()
5496 q.text('}')
5497
5498bsn_header.subtypes[9] = bsn_get_interfaces_request
5499
5500class bsn_get_mirroring_reply(bsn_header):
5501 version = 5
5502 type = 4
5503 experimenter = 6035143
5504 subtype = 5
5505
5506 def __init__(self, xid=None, report_mirror_ports=None):
5507 if xid != None:
5508 self.xid = xid
5509 else:
5510 self.xid = None
5511 if report_mirror_ports != None:
5512 self.report_mirror_ports = report_mirror_ports
5513 else:
5514 self.report_mirror_ports = 0
5515 return
5516
5517 def pack(self):
5518 packed = []
5519 packed.append(struct.pack("!B", self.version))
5520 packed.append(struct.pack("!B", self.type))
5521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5522 packed.append(struct.pack("!L", self.xid))
5523 packed.append(struct.pack("!L", self.experimenter))
5524 packed.append(struct.pack("!L", self.subtype))
5525 packed.append(struct.pack("!B", self.report_mirror_ports))
5526 packed.append('\x00' * 3)
5527 length = sum([len(x) for x in packed])
5528 packed[2] = struct.pack("!H", length)
5529 return ''.join(packed)
5530
5531 @staticmethod
5532 def unpack(reader):
5533 obj = bsn_get_mirroring_reply()
5534 _version = reader.read("!B")[0]
5535 assert(_version == 5)
5536 _type = reader.read("!B")[0]
5537 assert(_type == 4)
5538 _length = reader.read("!H")[0]
5539 orig_reader = reader
5540 reader = orig_reader.slice(_length, 4)
5541 obj.xid = reader.read("!L")[0]
5542 _experimenter = reader.read("!L")[0]
5543 assert(_experimenter == 6035143)
5544 _subtype = reader.read("!L")[0]
5545 assert(_subtype == 5)
5546 obj.report_mirror_ports = reader.read("!B")[0]
5547 reader.skip(3)
5548 return obj
5549
5550 def __eq__(self, other):
5551 if type(self) != type(other): return False
5552 if self.xid != other.xid: return False
5553 if self.report_mirror_ports != other.report_mirror_ports: return False
5554 return True
5555
5556 def pretty_print(self, q):
5557 q.text("bsn_get_mirroring_reply {")
5558 with q.group():
5559 with q.indent(2):
5560 q.breakable()
5561 q.text("xid = ");
5562 if self.xid != None:
5563 q.text("%#x" % self.xid)
5564 else:
5565 q.text('None')
5566 q.text(","); q.breakable()
5567 q.text("report_mirror_ports = ");
5568 q.text("%#x" % self.report_mirror_ports)
5569 q.breakable()
5570 q.text('}')
5571
5572bsn_header.subtypes[5] = bsn_get_mirroring_reply
5573
5574class bsn_get_mirroring_request(bsn_header):
5575 version = 5
5576 type = 4
5577 experimenter = 6035143
5578 subtype = 4
5579
5580 def __init__(self, xid=None, report_mirror_ports=None):
5581 if xid != None:
5582 self.xid = xid
5583 else:
5584 self.xid = None
5585 if report_mirror_ports != None:
5586 self.report_mirror_ports = report_mirror_ports
5587 else:
5588 self.report_mirror_ports = 0
5589 return
5590
5591 def pack(self):
5592 packed = []
5593 packed.append(struct.pack("!B", self.version))
5594 packed.append(struct.pack("!B", self.type))
5595 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5596 packed.append(struct.pack("!L", self.xid))
5597 packed.append(struct.pack("!L", self.experimenter))
5598 packed.append(struct.pack("!L", self.subtype))
5599 packed.append(struct.pack("!B", self.report_mirror_ports))
5600 packed.append('\x00' * 3)
5601 length = sum([len(x) for x in packed])
5602 packed[2] = struct.pack("!H", length)
5603 return ''.join(packed)
5604
5605 @staticmethod
5606 def unpack(reader):
5607 obj = bsn_get_mirroring_request()
5608 _version = reader.read("!B")[0]
5609 assert(_version == 5)
5610 _type = reader.read("!B")[0]
5611 assert(_type == 4)
5612 _length = reader.read("!H")[0]
5613 orig_reader = reader
5614 reader = orig_reader.slice(_length, 4)
5615 obj.xid = reader.read("!L")[0]
5616 _experimenter = reader.read("!L")[0]
5617 assert(_experimenter == 6035143)
5618 _subtype = reader.read("!L")[0]
5619 assert(_subtype == 4)
5620 obj.report_mirror_ports = reader.read("!B")[0]
5621 reader.skip(3)
5622 return obj
5623
5624 def __eq__(self, other):
5625 if type(self) != type(other): return False
5626 if self.xid != other.xid: return False
5627 if self.report_mirror_ports != other.report_mirror_ports: return False
5628 return True
5629
5630 def pretty_print(self, q):
5631 q.text("bsn_get_mirroring_request {")
5632 with q.group():
5633 with q.indent(2):
5634 q.breakable()
5635 q.text("xid = ");
5636 if self.xid != None:
5637 q.text("%#x" % self.xid)
5638 else:
5639 q.text('None')
5640 q.text(","); q.breakable()
5641 q.text("report_mirror_ports = ");
5642 q.text("%#x" % self.report_mirror_ports)
5643 q.breakable()
5644 q.text('}')
5645
5646bsn_header.subtypes[4] = bsn_get_mirroring_request
5647
5648class bsn_get_switch_pipeline_reply(bsn_header):
5649 version = 5
5650 type = 4
5651 experimenter = 6035143
5652 subtype = 52
5653
5654 def __init__(self, xid=None, pipeline=None):
5655 if xid != None:
5656 self.xid = xid
5657 else:
5658 self.xid = None
5659 if pipeline != None:
5660 self.pipeline = pipeline
5661 else:
5662 self.pipeline = ""
5663 return
5664
5665 def pack(self):
5666 packed = []
5667 packed.append(struct.pack("!B", self.version))
5668 packed.append(struct.pack("!B", self.type))
5669 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5670 packed.append(struct.pack("!L", self.xid))
5671 packed.append(struct.pack("!L", self.experimenter))
5672 packed.append(struct.pack("!L", self.subtype))
5673 packed.append(struct.pack("!256s", self.pipeline))
5674 length = sum([len(x) for x in packed])
5675 packed[2] = struct.pack("!H", length)
5676 return ''.join(packed)
5677
5678 @staticmethod
5679 def unpack(reader):
5680 obj = bsn_get_switch_pipeline_reply()
5681 _version = reader.read("!B")[0]
5682 assert(_version == 5)
5683 _type = reader.read("!B")[0]
5684 assert(_type == 4)
5685 _length = reader.read("!H")[0]
5686 orig_reader = reader
5687 reader = orig_reader.slice(_length, 4)
5688 obj.xid = reader.read("!L")[0]
5689 _experimenter = reader.read("!L")[0]
5690 assert(_experimenter == 6035143)
5691 _subtype = reader.read("!L")[0]
5692 assert(_subtype == 52)
5693 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5694 return obj
5695
5696 def __eq__(self, other):
5697 if type(self) != type(other): return False
5698 if self.xid != other.xid: return False
5699 if self.pipeline != other.pipeline: return False
5700 return True
5701
5702 def pretty_print(self, q):
5703 q.text("bsn_get_switch_pipeline_reply {")
5704 with q.group():
5705 with q.indent(2):
5706 q.breakable()
5707 q.text("xid = ");
5708 if self.xid != None:
5709 q.text("%#x" % self.xid)
5710 else:
5711 q.text('None')
5712 q.text(","); q.breakable()
5713 q.text("pipeline = ");
5714 q.pp(self.pipeline)
5715 q.breakable()
5716 q.text('}')
5717
5718bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5719
5720class bsn_get_switch_pipeline_request(bsn_header):
5721 version = 5
5722 type = 4
5723 experimenter = 6035143
5724 subtype = 51
5725
5726 def __init__(self, xid=None):
5727 if xid != None:
5728 self.xid = xid
5729 else:
5730 self.xid = None
5731 return
5732
5733 def pack(self):
5734 packed = []
5735 packed.append(struct.pack("!B", self.version))
5736 packed.append(struct.pack("!B", self.type))
5737 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5738 packed.append(struct.pack("!L", self.xid))
5739 packed.append(struct.pack("!L", self.experimenter))
5740 packed.append(struct.pack("!L", self.subtype))
5741 length = sum([len(x) for x in packed])
5742 packed[2] = struct.pack("!H", length)
5743 return ''.join(packed)
5744
5745 @staticmethod
5746 def unpack(reader):
5747 obj = bsn_get_switch_pipeline_request()
5748 _version = reader.read("!B")[0]
5749 assert(_version == 5)
5750 _type = reader.read("!B")[0]
5751 assert(_type == 4)
5752 _length = reader.read("!H")[0]
5753 orig_reader = reader
5754 reader = orig_reader.slice(_length, 4)
5755 obj.xid = reader.read("!L")[0]
5756 _experimenter = reader.read("!L")[0]
5757 assert(_experimenter == 6035143)
5758 _subtype = reader.read("!L")[0]
5759 assert(_subtype == 51)
5760 return obj
5761
5762 def __eq__(self, other):
5763 if type(self) != type(other): return False
5764 if self.xid != other.xid: return False
5765 return True
5766
5767 def pretty_print(self, q):
5768 q.text("bsn_get_switch_pipeline_request {")
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.breakable()
5778 q.text('}')
5779
5780bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5781
5782class bsn_image_desc_stats_reply(bsn_stats_reply):
5783 version = 5
5784 type = 19
5785 stats_type = 65535
5786 experimenter = 6035143
5787 subtype = 14
5788
5789 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5790 if xid != None:
5791 self.xid = xid
5792 else:
5793 self.xid = None
5794 if flags != None:
5795 self.flags = flags
5796 else:
5797 self.flags = 0
5798 if image_checksum != None:
5799 self.image_checksum = image_checksum
5800 else:
5801 self.image_checksum = ""
5802 if startup_config_checksum != None:
5803 self.startup_config_checksum = startup_config_checksum
5804 else:
5805 self.startup_config_checksum = ""
5806 return
5807
5808 def pack(self):
5809 packed = []
5810 packed.append(struct.pack("!B", self.version))
5811 packed.append(struct.pack("!B", self.type))
5812 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5813 packed.append(struct.pack("!L", self.xid))
5814 packed.append(struct.pack("!H", self.stats_type))
5815 packed.append(struct.pack("!H", self.flags))
5816 packed.append('\x00' * 4)
5817 packed.append(struct.pack("!L", self.experimenter))
5818 packed.append(struct.pack("!L", self.subtype))
5819 packed.append(struct.pack("!256s", self.image_checksum))
5820 packed.append(struct.pack("!256s", self.startup_config_checksum))
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 = bsn_image_desc_stats_reply()
5828 _version = reader.read("!B")[0]
5829 assert(_version == 5)
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 == 65535)
5838 obj.flags = reader.read("!H")[0]
5839 reader.skip(4)
5840 _experimenter = reader.read("!L")[0]
5841 assert(_experimenter == 6035143)
5842 _subtype = reader.read("!L")[0]
5843 assert(_subtype == 14)
5844 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5845 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5846 return obj
5847
5848 def __eq__(self, other):
5849 if type(self) != type(other): return False
5850 if self.xid != other.xid: return False
5851 if self.flags != other.flags: return False
5852 if self.image_checksum != other.image_checksum: return False
5853 if self.startup_config_checksum != other.startup_config_checksum: return False
5854 return True
5855
5856 def pretty_print(self, q):
5857 q.text("bsn_image_desc_stats_reply {")
5858 with q.group():
5859 with q.indent(2):
5860 q.breakable()
5861 q.text("xid = ");
5862 if self.xid != None:
5863 q.text("%#x" % self.xid)
5864 else:
5865 q.text('None')
5866 q.text(","); q.breakable()
5867 q.text("flags = ");
5868 q.text("%#x" % self.flags)
5869 q.text(","); q.breakable()
5870 q.text("image_checksum = ");
5871 q.pp(self.image_checksum)
5872 q.text(","); q.breakable()
5873 q.text("startup_config_checksum = ");
5874 q.pp(self.startup_config_checksum)
5875 q.breakable()
5876 q.text('}')
5877
5878bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5879
5880class bsn_image_desc_stats_request(bsn_stats_request):
5881 version = 5
5882 type = 18
5883 stats_type = 65535
5884 experimenter = 6035143
5885 subtype = 14
5886
5887 def __init__(self, xid=None, flags=None):
5888 if xid != None:
5889 self.xid = xid
5890 else:
5891 self.xid = None
5892 if flags != None:
5893 self.flags = flags
5894 else:
5895 self.flags = 0
5896 return
5897
5898 def pack(self):
5899 packed = []
5900 packed.append(struct.pack("!B", self.version))
5901 packed.append(struct.pack("!B", self.type))
5902 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5903 packed.append(struct.pack("!L", self.xid))
5904 packed.append(struct.pack("!H", self.stats_type))
5905 packed.append(struct.pack("!H", self.flags))
5906 packed.append('\x00' * 4)
5907 packed.append(struct.pack("!L", self.experimenter))
5908 packed.append(struct.pack("!L", self.subtype))
5909 length = sum([len(x) for x in packed])
5910 packed[2] = struct.pack("!H", length)
5911 return ''.join(packed)
5912
5913 @staticmethod
5914 def unpack(reader):
5915 obj = bsn_image_desc_stats_request()
5916 _version = reader.read("!B")[0]
5917 assert(_version == 5)
5918 _type = reader.read("!B")[0]
5919 assert(_type == 18)
5920 _length = reader.read("!H")[0]
5921 orig_reader = reader
5922 reader = orig_reader.slice(_length, 4)
5923 obj.xid = reader.read("!L")[0]
5924 _stats_type = reader.read("!H")[0]
5925 assert(_stats_type == 65535)
5926 obj.flags = reader.read("!H")[0]
5927 reader.skip(4)
5928 _experimenter = reader.read("!L")[0]
5929 assert(_experimenter == 6035143)
5930 _subtype = reader.read("!L")[0]
5931 assert(_subtype == 14)
5932 return obj
5933
5934 def __eq__(self, other):
5935 if type(self) != type(other): return False
5936 if self.xid != other.xid: return False
5937 if self.flags != other.flags: return False
5938 return True
5939
5940 def pretty_print(self, q):
5941 q.text("bsn_image_desc_stats_request {")
5942 with q.group():
5943 with q.indent(2):
5944 q.breakable()
5945 q.text("xid = ");
5946 if self.xid != None:
5947 q.text("%#x" % self.xid)
5948 else:
5949 q.text('None')
5950 q.text(","); q.breakable()
5951 q.text("flags = ");
5952 q.text("%#x" % self.flags)
5953 q.breakable()
5954 q.text('}')
5955
5956bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5957
5958class bsn_lacp_convergence_notif(bsn_header):
5959 version = 5
5960 type = 4
5961 experimenter = 6035143
5962 subtype = 43
5963
5964 def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
5965 if xid != None:
5966 self.xid = xid
5967 else:
5968 self.xid = None
5969 if convergence_status != None:
5970 self.convergence_status = convergence_status
5971 else:
5972 self.convergence_status = 0
5973 if port_no != None:
5974 self.port_no = port_no
5975 else:
5976 self.port_no = 0
5977 if actor_sys_priority != None:
5978 self.actor_sys_priority = actor_sys_priority
5979 else:
5980 self.actor_sys_priority = 0
5981 if actor_sys_mac != None:
5982 self.actor_sys_mac = actor_sys_mac
5983 else:
5984 self.actor_sys_mac = [0,0,0,0,0,0]
5985 if actor_port_priority != None:
5986 self.actor_port_priority = actor_port_priority
5987 else:
5988 self.actor_port_priority = 0
5989 if actor_port_num != None:
5990 self.actor_port_num = actor_port_num
5991 else:
5992 self.actor_port_num = 0
5993 if actor_key != None:
5994 self.actor_key = actor_key
5995 else:
5996 self.actor_key = 0
5997 if partner_sys_priority != None:
5998 self.partner_sys_priority = partner_sys_priority
5999 else:
6000 self.partner_sys_priority = 0
6001 if partner_sys_mac != None:
6002 self.partner_sys_mac = partner_sys_mac
6003 else:
6004 self.partner_sys_mac = [0,0,0,0,0,0]
6005 if partner_port_priority != None:
6006 self.partner_port_priority = partner_port_priority
6007 else:
6008 self.partner_port_priority = 0
6009 if partner_port_num != None:
6010 self.partner_port_num = partner_port_num
6011 else:
6012 self.partner_port_num = 0
6013 if partner_key != None:
6014 self.partner_key = partner_key
6015 else:
6016 self.partner_key = 0
6017 return
6018
6019 def pack(self):
6020 packed = []
6021 packed.append(struct.pack("!B", self.version))
6022 packed.append(struct.pack("!B", self.type))
6023 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6024 packed.append(struct.pack("!L", self.xid))
6025 packed.append(struct.pack("!L", self.experimenter))
6026 packed.append(struct.pack("!L", self.subtype))
6027 packed.append(struct.pack("!B", self.convergence_status))
6028 packed.append('\x00' * 3)
6029 packed.append(util.pack_port_no(self.port_no))
6030 packed.append(struct.pack("!H", self.actor_sys_priority))
6031 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6032 packed.append(struct.pack("!H", self.actor_port_priority))
6033 packed.append(struct.pack("!H", self.actor_port_num))
6034 packed.append(struct.pack("!H", self.actor_key))
6035 packed.append(struct.pack("!H", self.partner_sys_priority))
6036 packed.append(struct.pack("!6B", *self.partner_sys_mac))
6037 packed.append(struct.pack("!H", self.partner_port_priority))
6038 packed.append(struct.pack("!H", self.partner_port_num))
6039 packed.append(struct.pack("!H", self.partner_key))
6040 length = sum([len(x) for x in packed])
6041 packed[2] = struct.pack("!H", length)
6042 return ''.join(packed)
6043
6044 @staticmethod
6045 def unpack(reader):
6046 obj = bsn_lacp_convergence_notif()
6047 _version = reader.read("!B")[0]
6048 assert(_version == 5)
6049 _type = reader.read("!B")[0]
6050 assert(_type == 4)
6051 _length = reader.read("!H")[0]
6052 orig_reader = reader
6053 reader = orig_reader.slice(_length, 4)
6054 obj.xid = reader.read("!L")[0]
6055 _experimenter = reader.read("!L")[0]
6056 assert(_experimenter == 6035143)
6057 _subtype = reader.read("!L")[0]
6058 assert(_subtype == 43)
6059 obj.convergence_status = reader.read("!B")[0]
6060 reader.skip(3)
6061 obj.port_no = util.unpack_port_no(reader)
6062 obj.actor_sys_priority = reader.read("!H")[0]
6063 obj.actor_sys_mac = list(reader.read('!6B'))
6064 obj.actor_port_priority = reader.read("!H")[0]
6065 obj.actor_port_num = reader.read("!H")[0]
6066 obj.actor_key = reader.read("!H")[0]
6067 obj.partner_sys_priority = reader.read("!H")[0]
6068 obj.partner_sys_mac = list(reader.read('!6B'))
6069 obj.partner_port_priority = reader.read("!H")[0]
6070 obj.partner_port_num = reader.read("!H")[0]
6071 obj.partner_key = reader.read("!H")[0]
6072 return obj
6073
6074 def __eq__(self, other):
6075 if type(self) != type(other): return False
6076 if self.xid != other.xid: return False
6077 if self.convergence_status != other.convergence_status: return False
6078 if self.port_no != other.port_no: return False
6079 if self.actor_sys_priority != other.actor_sys_priority: return False
6080 if self.actor_sys_mac != other.actor_sys_mac: return False
6081 if self.actor_port_priority != other.actor_port_priority: return False
6082 if self.actor_port_num != other.actor_port_num: return False
6083 if self.actor_key != other.actor_key: return False
6084 if self.partner_sys_priority != other.partner_sys_priority: return False
6085 if self.partner_sys_mac != other.partner_sys_mac: return False
6086 if self.partner_port_priority != other.partner_port_priority: return False
6087 if self.partner_port_num != other.partner_port_num: return False
6088 if self.partner_key != other.partner_key: return False
6089 return True
6090
6091 def pretty_print(self, q):
6092 q.text("bsn_lacp_convergence_notif {")
6093 with q.group():
6094 with q.indent(2):
6095 q.breakable()
6096 q.text("xid = ");
6097 if self.xid != None:
6098 q.text("%#x" % self.xid)
6099 else:
6100 q.text('None')
6101 q.text(","); q.breakable()
6102 q.text("convergence_status = ");
6103 q.text("%#x" % self.convergence_status)
6104 q.text(","); q.breakable()
6105 q.text("port_no = ");
6106 q.text(util.pretty_port(self.port_no))
6107 q.text(","); q.breakable()
6108 q.text("actor_sys_priority = ");
6109 q.text("%#x" % self.actor_sys_priority)
6110 q.text(","); q.breakable()
6111 q.text("actor_sys_mac = ");
6112 q.text(util.pretty_mac(self.actor_sys_mac))
6113 q.text(","); q.breakable()
6114 q.text("actor_port_priority = ");
6115 q.text("%#x" % self.actor_port_priority)
6116 q.text(","); q.breakable()
6117 q.text("actor_port_num = ");
6118 q.text("%#x" % self.actor_port_num)
6119 q.text(","); q.breakable()
6120 q.text("actor_key = ");
6121 q.text("%#x" % self.actor_key)
6122 q.text(","); q.breakable()
6123 q.text("partner_sys_priority = ");
6124 q.text("%#x" % self.partner_sys_priority)
6125 q.text(","); q.breakable()
6126 q.text("partner_sys_mac = ");
6127 q.text(util.pretty_mac(self.partner_sys_mac))
6128 q.text(","); q.breakable()
6129 q.text("partner_port_priority = ");
6130 q.text("%#x" % self.partner_port_priority)
6131 q.text(","); q.breakable()
6132 q.text("partner_port_num = ");
6133 q.text("%#x" % self.partner_port_num)
6134 q.text(","); q.breakable()
6135 q.text("partner_key = ");
6136 q.text("%#x" % self.partner_key)
6137 q.breakable()
6138 q.text('}')
6139
6140bsn_header.subtypes[43] = bsn_lacp_convergence_notif
6141
6142class bsn_lacp_stats_reply(bsn_stats_reply):
6143 version = 5
6144 type = 19
6145 stats_type = 65535
6146 experimenter = 6035143
6147 subtype = 1
6148
6149 def __init__(self, xid=None, flags=None, entries=None):
6150 if xid != None:
6151 self.xid = xid
6152 else:
6153 self.xid = None
6154 if flags != None:
6155 self.flags = flags
6156 else:
6157 self.flags = 0
6158 if entries != None:
6159 self.entries = entries
6160 else:
6161 self.entries = []
6162 return
6163
6164 def pack(self):
6165 packed = []
6166 packed.append(struct.pack("!B", self.version))
6167 packed.append(struct.pack("!B", self.type))
6168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6169 packed.append(struct.pack("!L", self.xid))
6170 packed.append(struct.pack("!H", self.stats_type))
6171 packed.append(struct.pack("!H", self.flags))
6172 packed.append('\x00' * 4)
6173 packed.append(struct.pack("!L", self.experimenter))
6174 packed.append(struct.pack("!L", self.subtype))
6175 packed.append(loxi.generic_util.pack_list(self.entries))
6176 length = sum([len(x) for x in packed])
6177 packed[2] = struct.pack("!H", length)
6178 return ''.join(packed)
6179
6180 @staticmethod
6181 def unpack(reader):
6182 obj = bsn_lacp_stats_reply()
6183 _version = reader.read("!B")[0]
6184 assert(_version == 5)
6185 _type = reader.read("!B")[0]
6186 assert(_type == 19)
6187 _length = reader.read("!H")[0]
6188 orig_reader = reader
6189 reader = orig_reader.slice(_length, 4)
6190 obj.xid = reader.read("!L")[0]
6191 _stats_type = reader.read("!H")[0]
6192 assert(_stats_type == 65535)
6193 obj.flags = reader.read("!H")[0]
6194 reader.skip(4)
6195 _experimenter = reader.read("!L")[0]
6196 assert(_experimenter == 6035143)
6197 _subtype = reader.read("!L")[0]
6198 assert(_subtype == 1)
6199 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
6200 return obj
6201
6202 def __eq__(self, other):
6203 if type(self) != type(other): return False
6204 if self.xid != other.xid: return False
6205 if self.flags != other.flags: return False
6206 if self.entries != other.entries: return False
6207 return True
6208
6209 def pretty_print(self, q):
6210 q.text("bsn_lacp_stats_reply {")
6211 with q.group():
6212 with q.indent(2):
6213 q.breakable()
6214 q.text("xid = ");
6215 if self.xid != None:
6216 q.text("%#x" % self.xid)
6217 else:
6218 q.text('None')
6219 q.text(","); q.breakable()
6220 q.text("flags = ");
6221 q.text("%#x" % self.flags)
6222 q.text(","); q.breakable()
6223 q.text("entries = ");
6224 q.pp(self.entries)
6225 q.breakable()
6226 q.text('}')
6227
6228bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
6229
6230class bsn_lacp_stats_request(bsn_stats_request):
6231 version = 5
6232 type = 18
6233 stats_type = 65535
6234 experimenter = 6035143
6235 subtype = 1
6236
6237 def __init__(self, xid=None, flags=None):
6238 if xid != None:
6239 self.xid = xid
6240 else:
6241 self.xid = None
6242 if flags != None:
6243 self.flags = flags
6244 else:
6245 self.flags = 0
6246 return
6247
6248 def pack(self):
6249 packed = []
6250 packed.append(struct.pack("!B", self.version))
6251 packed.append(struct.pack("!B", self.type))
6252 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6253 packed.append(struct.pack("!L", self.xid))
6254 packed.append(struct.pack("!H", self.stats_type))
6255 packed.append(struct.pack("!H", self.flags))
6256 packed.append('\x00' * 4)
6257 packed.append(struct.pack("!L", self.experimenter))
6258 packed.append(struct.pack("!L", self.subtype))
6259 length = sum([len(x) for x in packed])
6260 packed[2] = struct.pack("!H", length)
6261 return ''.join(packed)
6262
6263 @staticmethod
6264 def unpack(reader):
6265 obj = bsn_lacp_stats_request()
6266 _version = reader.read("!B")[0]
6267 assert(_version == 5)
6268 _type = reader.read("!B")[0]
6269 assert(_type == 18)
6270 _length = reader.read("!H")[0]
6271 orig_reader = reader
6272 reader = orig_reader.slice(_length, 4)
6273 obj.xid = reader.read("!L")[0]
6274 _stats_type = reader.read("!H")[0]
6275 assert(_stats_type == 65535)
6276 obj.flags = reader.read("!H")[0]
6277 reader.skip(4)
6278 _experimenter = reader.read("!L")[0]
6279 assert(_experimenter == 6035143)
6280 _subtype = reader.read("!L")[0]
6281 assert(_subtype == 1)
6282 return obj
6283
6284 def __eq__(self, other):
6285 if type(self) != type(other): return False
6286 if self.xid != other.xid: return False
6287 if self.flags != other.flags: return False
6288 return True
6289
6290 def pretty_print(self, q):
6291 q.text("bsn_lacp_stats_request {")
6292 with q.group():
6293 with q.indent(2):
6294 q.breakable()
6295 q.text("xid = ");
6296 if self.xid != None:
6297 q.text("%#x" % self.xid)
6298 else:
6299 q.text('None')
6300 q.text(","); q.breakable()
6301 q.text("flags = ");
6302 q.text("%#x" % self.flags)
6303 q.breakable()
6304 q.text('}')
6305
6306bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
6307
6308class bsn_log(bsn_header):
6309 version = 5
6310 type = 4
6311 experimenter = 6035143
6312 subtype = 63
6313
6314 def __init__(self, xid=None, loglevel=None, data=None):
6315 if xid != None:
6316 self.xid = xid
6317 else:
6318 self.xid = None
6319 if loglevel != None:
6320 self.loglevel = loglevel
6321 else:
6322 self.loglevel = 0
6323 if data != None:
6324 self.data = data
6325 else:
6326 self.data = ''
6327 return
6328
6329 def pack(self):
6330 packed = []
6331 packed.append(struct.pack("!B", self.version))
6332 packed.append(struct.pack("!B", self.type))
6333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6334 packed.append(struct.pack("!L", self.xid))
6335 packed.append(struct.pack("!L", self.experimenter))
6336 packed.append(struct.pack("!L", self.subtype))
6337 packed.append(struct.pack("!B", self.loglevel))
6338 packed.append(self.data)
6339 length = sum([len(x) for x in packed])
6340 packed[2] = struct.pack("!H", length)
6341 return ''.join(packed)
6342
6343 @staticmethod
6344 def unpack(reader):
6345 obj = bsn_log()
6346 _version = reader.read("!B")[0]
6347 assert(_version == 5)
6348 _type = reader.read("!B")[0]
6349 assert(_type == 4)
6350 _length = reader.read("!H")[0]
6351 orig_reader = reader
6352 reader = orig_reader.slice(_length, 4)
6353 obj.xid = reader.read("!L")[0]
6354 _experimenter = reader.read("!L")[0]
6355 assert(_experimenter == 6035143)
6356 _subtype = reader.read("!L")[0]
6357 assert(_subtype == 63)
6358 obj.loglevel = reader.read("!B")[0]
6359 obj.data = str(reader.read_all())
6360 return obj
6361
6362 def __eq__(self, other):
6363 if type(self) != type(other): return False
6364 if self.xid != other.xid: return False
6365 if self.loglevel != other.loglevel: return False
6366 if self.data != other.data: return False
6367 return True
6368
6369 def pretty_print(self, q):
6370 q.text("bsn_log {")
6371 with q.group():
6372 with q.indent(2):
6373 q.breakable()
6374 q.text("xid = ");
6375 if self.xid != None:
6376 q.text("%#x" % self.xid)
6377 else:
6378 q.text('None')
6379 q.text(","); q.breakable()
6380 q.text("loglevel = ");
6381 q.text("%#x" % self.loglevel)
6382 q.text(","); q.breakable()
6383 q.text("data = ");
6384 q.pp(self.data)
6385 q.breakable()
6386 q.text('}')
6387
6388bsn_header.subtypes[63] = bsn_log
6389
6390class bsn_lua_command_reply(bsn_header):
6391 version = 5
6392 type = 4
6393 experimenter = 6035143
6394 subtype = 66
6395
6396 def __init__(self, xid=None, data=None):
6397 if xid != None:
6398 self.xid = xid
6399 else:
6400 self.xid = None
6401 if data != None:
6402 self.data = data
6403 else:
6404 self.data = ''
6405 return
6406
6407 def pack(self):
6408 packed = []
6409 packed.append(struct.pack("!B", self.version))
6410 packed.append(struct.pack("!B", self.type))
6411 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6412 packed.append(struct.pack("!L", self.xid))
6413 packed.append(struct.pack("!L", self.experimenter))
6414 packed.append(struct.pack("!L", self.subtype))
6415 packed.append(self.data)
6416 length = sum([len(x) for x in packed])
6417 packed[2] = struct.pack("!H", length)
6418 return ''.join(packed)
6419
6420 @staticmethod
6421 def unpack(reader):
6422 obj = bsn_lua_command_reply()
6423 _version = reader.read("!B")[0]
6424 assert(_version == 5)
6425 _type = reader.read("!B")[0]
6426 assert(_type == 4)
6427 _length = reader.read("!H")[0]
6428 orig_reader = reader
6429 reader = orig_reader.slice(_length, 4)
6430 obj.xid = reader.read("!L")[0]
6431 _experimenter = reader.read("!L")[0]
6432 assert(_experimenter == 6035143)
6433 _subtype = reader.read("!L")[0]
6434 assert(_subtype == 66)
6435 obj.data = str(reader.read_all())
6436 return obj
6437
6438 def __eq__(self, other):
6439 if type(self) != type(other): return False
6440 if self.xid != other.xid: return False
6441 if self.data != other.data: return False
6442 return True
6443
6444 def pretty_print(self, q):
6445 q.text("bsn_lua_command_reply {")
6446 with q.group():
6447 with q.indent(2):
6448 q.breakable()
6449 q.text("xid = ");
6450 if self.xid != None:
6451 q.text("%#x" % self.xid)
6452 else:
6453 q.text('None')
6454 q.text(","); q.breakable()
6455 q.text("data = ");
6456 q.pp(self.data)
6457 q.breakable()
6458 q.text('}')
6459
6460bsn_header.subtypes[66] = bsn_lua_command_reply
6461
6462class bsn_lua_command_request(bsn_header):
6463 version = 5
6464 type = 4
6465 experimenter = 6035143
6466 subtype = 65
6467
6468 def __init__(self, xid=None, data=None):
6469 if xid != None:
6470 self.xid = xid
6471 else:
6472 self.xid = None
6473 if data != None:
6474 self.data = data
6475 else:
6476 self.data = ''
6477 return
6478
6479 def pack(self):
6480 packed = []
6481 packed.append(struct.pack("!B", self.version))
6482 packed.append(struct.pack("!B", self.type))
6483 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6484 packed.append(struct.pack("!L", self.xid))
6485 packed.append(struct.pack("!L", self.experimenter))
6486 packed.append(struct.pack("!L", self.subtype))
6487 packed.append(self.data)
6488 length = sum([len(x) for x in packed])
6489 packed[2] = struct.pack("!H", length)
6490 return ''.join(packed)
6491
6492 @staticmethod
6493 def unpack(reader):
6494 obj = bsn_lua_command_request()
6495 _version = reader.read("!B")[0]
6496 assert(_version == 5)
6497 _type = reader.read("!B")[0]
6498 assert(_type == 4)
6499 _length = reader.read("!H")[0]
6500 orig_reader = reader
6501 reader = orig_reader.slice(_length, 4)
6502 obj.xid = reader.read("!L")[0]
6503 _experimenter = reader.read("!L")[0]
6504 assert(_experimenter == 6035143)
6505 _subtype = reader.read("!L")[0]
6506 assert(_subtype == 65)
6507 obj.data = str(reader.read_all())
6508 return obj
6509
6510 def __eq__(self, other):
6511 if type(self) != type(other): return False
6512 if self.xid != other.xid: return False
6513 if self.data != other.data: return False
6514 return True
6515
6516 def pretty_print(self, q):
6517 q.text("bsn_lua_command_request {")
6518 with q.group():
6519 with q.indent(2):
6520 q.breakable()
6521 q.text("xid = ");
6522 if self.xid != None:
6523 q.text("%#x" % self.xid)
6524 else:
6525 q.text('None')
6526 q.text(","); q.breakable()
6527 q.text("data = ");
6528 q.pp(self.data)
6529 q.breakable()
6530 q.text('}')
6531
6532bsn_header.subtypes[65] = bsn_lua_command_request
6533
6534class bsn_lua_notification(bsn_header):
6535 version = 5
6536 type = 4
6537 experimenter = 6035143
6538 subtype = 67
6539
6540 def __init__(self, xid=None, data=None):
6541 if xid != None:
6542 self.xid = xid
6543 else:
6544 self.xid = None
6545 if data != None:
6546 self.data = data
6547 else:
6548 self.data = ''
6549 return
6550
6551 def pack(self):
6552 packed = []
6553 packed.append(struct.pack("!B", self.version))
6554 packed.append(struct.pack("!B", self.type))
6555 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6556 packed.append(struct.pack("!L", self.xid))
6557 packed.append(struct.pack("!L", self.experimenter))
6558 packed.append(struct.pack("!L", self.subtype))
6559 packed.append(self.data)
6560 length = sum([len(x) for x in packed])
6561 packed[2] = struct.pack("!H", length)
6562 return ''.join(packed)
6563
6564 @staticmethod
6565 def unpack(reader):
6566 obj = bsn_lua_notification()
6567 _version = reader.read("!B")[0]
6568 assert(_version == 5)
6569 _type = reader.read("!B")[0]
6570 assert(_type == 4)
6571 _length = reader.read("!H")[0]
6572 orig_reader = reader
6573 reader = orig_reader.slice(_length, 4)
6574 obj.xid = reader.read("!L")[0]
6575 _experimenter = reader.read("!L")[0]
6576 assert(_experimenter == 6035143)
6577 _subtype = reader.read("!L")[0]
6578 assert(_subtype == 67)
6579 obj.data = str(reader.read_all())
6580 return obj
6581
6582 def __eq__(self, other):
6583 if type(self) != type(other): return False
6584 if self.xid != other.xid: return False
6585 if self.data != other.data: return False
6586 return True
6587
6588 def pretty_print(self, q):
6589 q.text("bsn_lua_notification {")
6590 with q.group():
6591 with q.indent(2):
6592 q.breakable()
6593 q.text("xid = ");
6594 if self.xid != None:
6595 q.text("%#x" % self.xid)
6596 else:
6597 q.text('None')
6598 q.text(","); q.breakable()
6599 q.text("data = ");
6600 q.pp(self.data)
6601 q.breakable()
6602 q.text('}')
6603
6604bsn_header.subtypes[67] = bsn_lua_notification
6605
6606class bsn_lua_upload(bsn_header):
6607 version = 5
6608 type = 4
6609 experimenter = 6035143
6610 subtype = 64
6611
6612 def __init__(self, xid=None, flags=None, filename=None, data=None):
6613 if xid != None:
6614 self.xid = xid
6615 else:
6616 self.xid = None
6617 if flags != None:
6618 self.flags = flags
6619 else:
6620 self.flags = 0
6621 if filename != None:
6622 self.filename = filename
6623 else:
6624 self.filename = ""
6625 if data != None:
6626 self.data = data
6627 else:
6628 self.data = ''
6629 return
6630
6631 def pack(self):
6632 packed = []
6633 packed.append(struct.pack("!B", self.version))
6634 packed.append(struct.pack("!B", self.type))
6635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6636 packed.append(struct.pack("!L", self.xid))
6637 packed.append(struct.pack("!L", self.experimenter))
6638 packed.append(struct.pack("!L", self.subtype))
6639 packed.append(struct.pack("!H", self.flags))
6640 packed.append(struct.pack("!64s", self.filename))
6641 packed.append(self.data)
6642 length = sum([len(x) for x in packed])
6643 packed[2] = struct.pack("!H", length)
6644 return ''.join(packed)
6645
6646 @staticmethod
6647 def unpack(reader):
6648 obj = bsn_lua_upload()
6649 _version = reader.read("!B")[0]
6650 assert(_version == 5)
6651 _type = reader.read("!B")[0]
6652 assert(_type == 4)
6653 _length = reader.read("!H")[0]
6654 orig_reader = reader
6655 reader = orig_reader.slice(_length, 4)
6656 obj.xid = reader.read("!L")[0]
6657 _experimenter = reader.read("!L")[0]
6658 assert(_experimenter == 6035143)
6659 _subtype = reader.read("!L")[0]
6660 assert(_subtype == 64)
6661 obj.flags = reader.read("!H")[0]
6662 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6663 obj.data = str(reader.read_all())
6664 return obj
6665
6666 def __eq__(self, other):
6667 if type(self) != type(other): return False
6668 if self.xid != other.xid: return False
6669 if self.flags != other.flags: return False
6670 if self.filename != other.filename: return False
6671 if self.data != other.data: return False
6672 return True
6673
6674 def pretty_print(self, q):
6675 q.text("bsn_lua_upload {")
6676 with q.group():
6677 with q.indent(2):
6678 q.breakable()
6679 q.text("xid = ");
6680 if self.xid != None:
6681 q.text("%#x" % self.xid)
6682 else:
6683 q.text('None')
6684 q.text(","); q.breakable()
6685 q.text("flags = ");
6686 q.text("%#x" % self.flags)
6687 q.text(","); q.breakable()
6688 q.text("filename = ");
6689 q.pp(self.filename)
6690 q.text(","); q.breakable()
6691 q.text("data = ");
6692 q.pp(self.data)
6693 q.breakable()
6694 q.text('}')
6695
6696bsn_header.subtypes[64] = bsn_lua_upload
6697
6698class bsn_pdu_rx_reply(bsn_header):
6699 version = 5
6700 type = 4
6701 experimenter = 6035143
6702 subtype = 34
6703
6704 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6705 if xid != None:
6706 self.xid = xid
6707 else:
6708 self.xid = None
6709 if status != None:
6710 self.status = status
6711 else:
6712 self.status = 0
6713 if port_no != None:
6714 self.port_no = port_no
6715 else:
6716 self.port_no = 0
6717 if slot_num != None:
6718 self.slot_num = slot_num
6719 else:
6720 self.slot_num = 0
6721 return
6722
6723 def pack(self):
6724 packed = []
6725 packed.append(struct.pack("!B", self.version))
6726 packed.append(struct.pack("!B", self.type))
6727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6728 packed.append(struct.pack("!L", self.xid))
6729 packed.append(struct.pack("!L", self.experimenter))
6730 packed.append(struct.pack("!L", self.subtype))
6731 packed.append(struct.pack("!L", self.status))
6732 packed.append(util.pack_port_no(self.port_no))
6733 packed.append(struct.pack("!B", self.slot_num))
6734 length = sum([len(x) for x in packed])
6735 packed[2] = struct.pack("!H", length)
6736 return ''.join(packed)
6737
6738 @staticmethod
6739 def unpack(reader):
6740 obj = bsn_pdu_rx_reply()
6741 _version = reader.read("!B")[0]
6742 assert(_version == 5)
6743 _type = reader.read("!B")[0]
6744 assert(_type == 4)
6745 _length = reader.read("!H")[0]
6746 orig_reader = reader
6747 reader = orig_reader.slice(_length, 4)
6748 obj.xid = reader.read("!L")[0]
6749 _experimenter = reader.read("!L")[0]
6750 assert(_experimenter == 6035143)
6751 _subtype = reader.read("!L")[0]
6752 assert(_subtype == 34)
6753 obj.status = reader.read("!L")[0]
6754 obj.port_no = util.unpack_port_no(reader)
6755 obj.slot_num = reader.read("!B")[0]
6756 return obj
6757
6758 def __eq__(self, other):
6759 if type(self) != type(other): return False
6760 if self.xid != other.xid: return False
6761 if self.status != other.status: return False
6762 if self.port_no != other.port_no: return False
6763 if self.slot_num != other.slot_num: return False
6764 return True
6765
6766 def pretty_print(self, q):
6767 q.text("bsn_pdu_rx_reply {")
6768 with q.group():
6769 with q.indent(2):
6770 q.breakable()
6771 q.text("xid = ");
6772 if self.xid != None:
6773 q.text("%#x" % self.xid)
6774 else:
6775 q.text('None')
6776 q.text(","); q.breakable()
6777 q.text("status = ");
6778 q.text("%#x" % self.status)
6779 q.text(","); q.breakable()
6780 q.text("port_no = ");
6781 q.text(util.pretty_port(self.port_no))
6782 q.text(","); q.breakable()
6783 q.text("slot_num = ");
6784 q.text("%#x" % self.slot_num)
6785 q.breakable()
6786 q.text('}')
6787
6788bsn_header.subtypes[34] = bsn_pdu_rx_reply
6789
6790class bsn_pdu_rx_request(bsn_header):
6791 version = 5
6792 type = 4
6793 experimenter = 6035143
6794 subtype = 33
6795
6796 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6797 if xid != None:
6798 self.xid = xid
6799 else:
6800 self.xid = None
6801 if timeout_ms != None:
6802 self.timeout_ms = timeout_ms
6803 else:
6804 self.timeout_ms = 0
6805 if port_no != None:
6806 self.port_no = port_no
6807 else:
6808 self.port_no = 0
6809 if slot_num != None:
6810 self.slot_num = slot_num
6811 else:
6812 self.slot_num = 0
6813 if data != None:
6814 self.data = data
6815 else:
6816 self.data = ''
6817 return
6818
6819 def pack(self):
6820 packed = []
6821 packed.append(struct.pack("!B", self.version))
6822 packed.append(struct.pack("!B", self.type))
6823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6824 packed.append(struct.pack("!L", self.xid))
6825 packed.append(struct.pack("!L", self.experimenter))
6826 packed.append(struct.pack("!L", self.subtype))
6827 packed.append(struct.pack("!L", self.timeout_ms))
6828 packed.append(util.pack_port_no(self.port_no))
6829 packed.append(struct.pack("!B", self.slot_num))
6830 packed.append('\x00' * 3)
6831 packed.append(self.data)
6832 length = sum([len(x) for x in packed])
6833 packed[2] = struct.pack("!H", length)
6834 return ''.join(packed)
6835
6836 @staticmethod
6837 def unpack(reader):
6838 obj = bsn_pdu_rx_request()
6839 _version = reader.read("!B")[0]
6840 assert(_version == 5)
6841 _type = reader.read("!B")[0]
6842 assert(_type == 4)
6843 _length = reader.read("!H")[0]
6844 orig_reader = reader
6845 reader = orig_reader.slice(_length, 4)
6846 obj.xid = reader.read("!L")[0]
6847 _experimenter = reader.read("!L")[0]
6848 assert(_experimenter == 6035143)
6849 _subtype = reader.read("!L")[0]
6850 assert(_subtype == 33)
6851 obj.timeout_ms = reader.read("!L")[0]
6852 obj.port_no = util.unpack_port_no(reader)
6853 obj.slot_num = reader.read("!B")[0]
6854 reader.skip(3)
6855 obj.data = str(reader.read_all())
6856 return obj
6857
6858 def __eq__(self, other):
6859 if type(self) != type(other): return False
6860 if self.xid != other.xid: return False
6861 if self.timeout_ms != other.timeout_ms: return False
6862 if self.port_no != other.port_no: return False
6863 if self.slot_num != other.slot_num: return False
6864 if self.data != other.data: return False
6865 return True
6866
6867 def pretty_print(self, q):
6868 q.text("bsn_pdu_rx_request {")
6869 with q.group():
6870 with q.indent(2):
6871 q.breakable()
6872 q.text("xid = ");
6873 if self.xid != None:
6874 q.text("%#x" % self.xid)
6875 else:
6876 q.text('None')
6877 q.text(","); q.breakable()
6878 q.text("timeout_ms = ");
6879 q.text("%#x" % self.timeout_ms)
6880 q.text(","); q.breakable()
6881 q.text("port_no = ");
6882 q.text(util.pretty_port(self.port_no))
6883 q.text(","); q.breakable()
6884 q.text("slot_num = ");
6885 q.text("%#x" % self.slot_num)
6886 q.text(","); q.breakable()
6887 q.text("data = ");
6888 q.pp(self.data)
6889 q.breakable()
6890 q.text('}')
6891
6892bsn_header.subtypes[33] = bsn_pdu_rx_request
6893
6894class bsn_pdu_rx_timeout(bsn_header):
6895 version = 5
6896 type = 4
6897 experimenter = 6035143
6898 subtype = 35
6899
6900 def __init__(self, xid=None, port_no=None, slot_num=None):
6901 if xid != None:
6902 self.xid = xid
6903 else:
6904 self.xid = None
6905 if port_no != None:
6906 self.port_no = port_no
6907 else:
6908 self.port_no = 0
6909 if slot_num != None:
6910 self.slot_num = slot_num
6911 else:
6912 self.slot_num = 0
6913 return
6914
6915 def pack(self):
6916 packed = []
6917 packed.append(struct.pack("!B", self.version))
6918 packed.append(struct.pack("!B", self.type))
6919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6920 packed.append(struct.pack("!L", self.xid))
6921 packed.append(struct.pack("!L", self.experimenter))
6922 packed.append(struct.pack("!L", self.subtype))
6923 packed.append(util.pack_port_no(self.port_no))
6924 packed.append(struct.pack("!B", self.slot_num))
6925 length = sum([len(x) for x in packed])
6926 packed[2] = struct.pack("!H", length)
6927 return ''.join(packed)
6928
6929 @staticmethod
6930 def unpack(reader):
6931 obj = bsn_pdu_rx_timeout()
6932 _version = reader.read("!B")[0]
6933 assert(_version == 5)
6934 _type = reader.read("!B")[0]
6935 assert(_type == 4)
6936 _length = reader.read("!H")[0]
6937 orig_reader = reader
6938 reader = orig_reader.slice(_length, 4)
6939 obj.xid = reader.read("!L")[0]
6940 _experimenter = reader.read("!L")[0]
6941 assert(_experimenter == 6035143)
6942 _subtype = reader.read("!L")[0]
6943 assert(_subtype == 35)
6944 obj.port_no = util.unpack_port_no(reader)
6945 obj.slot_num = reader.read("!B")[0]
6946 return obj
6947
6948 def __eq__(self, other):
6949 if type(self) != type(other): return False
6950 if self.xid != other.xid: return False
6951 if self.port_no != other.port_no: return False
6952 if self.slot_num != other.slot_num: return False
6953 return True
6954
6955 def pretty_print(self, q):
6956 q.text("bsn_pdu_rx_timeout {")
6957 with q.group():
6958 with q.indent(2):
6959 q.breakable()
6960 q.text("xid = ");
6961 if self.xid != None:
6962 q.text("%#x" % self.xid)
6963 else:
6964 q.text('None')
6965 q.text(","); q.breakable()
6966 q.text("port_no = ");
6967 q.text(util.pretty_port(self.port_no))
6968 q.text(","); q.breakable()
6969 q.text("slot_num = ");
6970 q.text("%#x" % self.slot_num)
6971 q.breakable()
6972 q.text('}')
6973
6974bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6975
6976class bsn_pdu_tx_reply(bsn_header):
6977 version = 5
6978 type = 4
6979 experimenter = 6035143
6980 subtype = 32
6981
6982 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6983 if xid != None:
6984 self.xid = xid
6985 else:
6986 self.xid = None
6987 if status != None:
6988 self.status = status
6989 else:
6990 self.status = 0
6991 if port_no != None:
6992 self.port_no = port_no
6993 else:
6994 self.port_no = 0
6995 if slot_num != None:
6996 self.slot_num = slot_num
6997 else:
6998 self.slot_num = 0
6999 return
7000
7001 def pack(self):
7002 packed = []
7003 packed.append(struct.pack("!B", self.version))
7004 packed.append(struct.pack("!B", self.type))
7005 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7006 packed.append(struct.pack("!L", self.xid))
7007 packed.append(struct.pack("!L", self.experimenter))
7008 packed.append(struct.pack("!L", self.subtype))
7009 packed.append(struct.pack("!L", self.status))
7010 packed.append(util.pack_port_no(self.port_no))
7011 packed.append(struct.pack("!B", self.slot_num))
7012 length = sum([len(x) for x in packed])
7013 packed[2] = struct.pack("!H", length)
7014 return ''.join(packed)
7015
7016 @staticmethod
7017 def unpack(reader):
7018 obj = bsn_pdu_tx_reply()
7019 _version = reader.read("!B")[0]
7020 assert(_version == 5)
7021 _type = reader.read("!B")[0]
7022 assert(_type == 4)
7023 _length = reader.read("!H")[0]
7024 orig_reader = reader
7025 reader = orig_reader.slice(_length, 4)
7026 obj.xid = reader.read("!L")[0]
7027 _experimenter = reader.read("!L")[0]
7028 assert(_experimenter == 6035143)
7029 _subtype = reader.read("!L")[0]
7030 assert(_subtype == 32)
7031 obj.status = reader.read("!L")[0]
7032 obj.port_no = util.unpack_port_no(reader)
7033 obj.slot_num = reader.read("!B")[0]
7034 return obj
7035
7036 def __eq__(self, other):
7037 if type(self) != type(other): return False
7038 if self.xid != other.xid: return False
7039 if self.status != other.status: return False
7040 if self.port_no != other.port_no: return False
7041 if self.slot_num != other.slot_num: return False
7042 return True
7043
7044 def pretty_print(self, q):
7045 q.text("bsn_pdu_tx_reply {")
7046 with q.group():
7047 with q.indent(2):
7048 q.breakable()
7049 q.text("xid = ");
7050 if self.xid != None:
7051 q.text("%#x" % self.xid)
7052 else:
7053 q.text('None')
7054 q.text(","); q.breakable()
7055 q.text("status = ");
7056 q.text("%#x" % self.status)
7057 q.text(","); q.breakable()
7058 q.text("port_no = ");
7059 q.text(util.pretty_port(self.port_no))
7060 q.text(","); q.breakable()
7061 q.text("slot_num = ");
7062 q.text("%#x" % self.slot_num)
7063 q.breakable()
7064 q.text('}')
7065
7066bsn_header.subtypes[32] = bsn_pdu_tx_reply
7067
7068class bsn_pdu_tx_request(bsn_header):
7069 version = 5
7070 type = 4
7071 experimenter = 6035143
7072 subtype = 31
7073
7074 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
7075 if xid != None:
7076 self.xid = xid
7077 else:
7078 self.xid = None
7079 if tx_interval_ms != None:
7080 self.tx_interval_ms = tx_interval_ms
7081 else:
7082 self.tx_interval_ms = 0
7083 if port_no != None:
7084 self.port_no = port_no
7085 else:
7086 self.port_no = 0
7087 if slot_num != None:
7088 self.slot_num = slot_num
7089 else:
7090 self.slot_num = 0
7091 if data != None:
7092 self.data = data
7093 else:
7094 self.data = ''
7095 return
7096
7097 def pack(self):
7098 packed = []
7099 packed.append(struct.pack("!B", self.version))
7100 packed.append(struct.pack("!B", self.type))
7101 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7102 packed.append(struct.pack("!L", self.xid))
7103 packed.append(struct.pack("!L", self.experimenter))
7104 packed.append(struct.pack("!L", self.subtype))
7105 packed.append(struct.pack("!L", self.tx_interval_ms))
7106 packed.append(util.pack_port_no(self.port_no))
7107 packed.append(struct.pack("!B", self.slot_num))
7108 packed.append('\x00' * 3)
7109 packed.append(self.data)
7110 length = sum([len(x) for x in packed])
7111 packed[2] = struct.pack("!H", length)
7112 return ''.join(packed)
7113
7114 @staticmethod
7115 def unpack(reader):
7116 obj = bsn_pdu_tx_request()
7117 _version = reader.read("!B")[0]
7118 assert(_version == 5)
7119 _type = reader.read("!B")[0]
7120 assert(_type == 4)
7121 _length = reader.read("!H")[0]
7122 orig_reader = reader
7123 reader = orig_reader.slice(_length, 4)
7124 obj.xid = reader.read("!L")[0]
7125 _experimenter = reader.read("!L")[0]
7126 assert(_experimenter == 6035143)
7127 _subtype = reader.read("!L")[0]
7128 assert(_subtype == 31)
7129 obj.tx_interval_ms = reader.read("!L")[0]
7130 obj.port_no = util.unpack_port_no(reader)
7131 obj.slot_num = reader.read("!B")[0]
7132 reader.skip(3)
7133 obj.data = str(reader.read_all())
7134 return obj
7135
7136 def __eq__(self, other):
7137 if type(self) != type(other): return False
7138 if self.xid != other.xid: return False
7139 if self.tx_interval_ms != other.tx_interval_ms: return False
7140 if self.port_no != other.port_no: return False
7141 if self.slot_num != other.slot_num: return False
7142 if self.data != other.data: return False
7143 return True
7144
7145 def pretty_print(self, q):
7146 q.text("bsn_pdu_tx_request {")
7147 with q.group():
7148 with q.indent(2):
7149 q.breakable()
7150 q.text("xid = ");
7151 if self.xid != None:
7152 q.text("%#x" % self.xid)
7153 else:
7154 q.text('None')
7155 q.text(","); q.breakable()
7156 q.text("tx_interval_ms = ");
7157 q.text("%#x" % self.tx_interval_ms)
7158 q.text(","); q.breakable()
7159 q.text("port_no = ");
7160 q.text(util.pretty_port(self.port_no))
7161 q.text(","); q.breakable()
7162 q.text("slot_num = ");
7163 q.text("%#x" % self.slot_num)
7164 q.text(","); q.breakable()
7165 q.text("data = ");
7166 q.pp(self.data)
7167 q.breakable()
7168 q.text('}')
7169
7170bsn_header.subtypes[31] = bsn_pdu_tx_request
7171
7172class bsn_port_counter_stats_reply(bsn_stats_reply):
7173 version = 5
7174 type = 19
7175 stats_type = 65535
7176 experimenter = 6035143
7177 subtype = 8
7178
7179 def __init__(self, xid=None, flags=None, entries=None):
7180 if xid != None:
7181 self.xid = xid
7182 else:
7183 self.xid = None
7184 if flags != None:
7185 self.flags = flags
7186 else:
7187 self.flags = 0
7188 if entries != None:
7189 self.entries = entries
7190 else:
7191 self.entries = []
7192 return
7193
7194 def pack(self):
7195 packed = []
7196 packed.append(struct.pack("!B", self.version))
7197 packed.append(struct.pack("!B", self.type))
7198 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7199 packed.append(struct.pack("!L", self.xid))
7200 packed.append(struct.pack("!H", self.stats_type))
7201 packed.append(struct.pack("!H", self.flags))
7202 packed.append('\x00' * 4)
7203 packed.append(struct.pack("!L", self.experimenter))
7204 packed.append(struct.pack("!L", self.subtype))
7205 packed.append(loxi.generic_util.pack_list(self.entries))
7206 length = sum([len(x) for x in packed])
7207 packed[2] = struct.pack("!H", length)
7208 return ''.join(packed)
7209
7210 @staticmethod
7211 def unpack(reader):
7212 obj = bsn_port_counter_stats_reply()
7213 _version = reader.read("!B")[0]
7214 assert(_version == 5)
7215 _type = reader.read("!B")[0]
7216 assert(_type == 19)
7217 _length = reader.read("!H")[0]
7218 orig_reader = reader
7219 reader = orig_reader.slice(_length, 4)
7220 obj.xid = reader.read("!L")[0]
7221 _stats_type = reader.read("!H")[0]
7222 assert(_stats_type == 65535)
7223 obj.flags = reader.read("!H")[0]
7224 reader.skip(4)
7225 _experimenter = reader.read("!L")[0]
7226 assert(_experimenter == 6035143)
7227 _subtype = reader.read("!L")[0]
7228 assert(_subtype == 8)
7229 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
7230 return obj
7231
7232 def __eq__(self, other):
7233 if type(self) != type(other): return False
7234 if self.xid != other.xid: return False
7235 if self.flags != other.flags: return False
7236 if self.entries != other.entries: return False
7237 return True
7238
7239 def pretty_print(self, q):
7240 q.text("bsn_port_counter_stats_reply {")
7241 with q.group():
7242 with q.indent(2):
7243 q.breakable()
7244 q.text("xid = ");
7245 if self.xid != None:
7246 q.text("%#x" % self.xid)
7247 else:
7248 q.text('None')
7249 q.text(","); q.breakable()
7250 q.text("flags = ");
7251 q.text("%#x" % self.flags)
7252 q.text(","); q.breakable()
7253 q.text("entries = ");
7254 q.pp(self.entries)
7255 q.breakable()
7256 q.text('}')
7257
7258bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
7259
7260class bsn_port_counter_stats_request(bsn_stats_request):
7261 version = 5
7262 type = 18
7263 stats_type = 65535
7264 experimenter = 6035143
7265 subtype = 8
7266
7267 def __init__(self, xid=None, flags=None, port_no=None):
7268 if xid != None:
7269 self.xid = xid
7270 else:
7271 self.xid = None
7272 if flags != None:
7273 self.flags = flags
7274 else:
7275 self.flags = 0
7276 if port_no != None:
7277 self.port_no = port_no
7278 else:
7279 self.port_no = 0
7280 return
7281
7282 def pack(self):
7283 packed = []
7284 packed.append(struct.pack("!B", self.version))
7285 packed.append(struct.pack("!B", self.type))
7286 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7287 packed.append(struct.pack("!L", self.xid))
7288 packed.append(struct.pack("!H", self.stats_type))
7289 packed.append(struct.pack("!H", self.flags))
7290 packed.append('\x00' * 4)
7291 packed.append(struct.pack("!L", self.experimenter))
7292 packed.append(struct.pack("!L", self.subtype))
7293 packed.append(util.pack_port_no(self.port_no))
7294 length = sum([len(x) for x in packed])
7295 packed[2] = struct.pack("!H", length)
7296 return ''.join(packed)
7297
7298 @staticmethod
7299 def unpack(reader):
7300 obj = bsn_port_counter_stats_request()
7301 _version = reader.read("!B")[0]
7302 assert(_version == 5)
7303 _type = reader.read("!B")[0]
7304 assert(_type == 18)
7305 _length = reader.read("!H")[0]
7306 orig_reader = reader
7307 reader = orig_reader.slice(_length, 4)
7308 obj.xid = reader.read("!L")[0]
7309 _stats_type = reader.read("!H")[0]
7310 assert(_stats_type == 65535)
7311 obj.flags = reader.read("!H")[0]
7312 reader.skip(4)
7313 _experimenter = reader.read("!L")[0]
7314 assert(_experimenter == 6035143)
7315 _subtype = reader.read("!L")[0]
7316 assert(_subtype == 8)
7317 obj.port_no = util.unpack_port_no(reader)
7318 return obj
7319
7320 def __eq__(self, other):
7321 if type(self) != type(other): return False
7322 if self.xid != other.xid: return False
7323 if self.flags != other.flags: return False
7324 if self.port_no != other.port_no: return False
7325 return True
7326
7327 def pretty_print(self, q):
7328 q.text("bsn_port_counter_stats_request {")
7329 with q.group():
7330 with q.indent(2):
7331 q.breakable()
7332 q.text("xid = ");
7333 if self.xid != None:
7334 q.text("%#x" % self.xid)
7335 else:
7336 q.text('None')
7337 q.text(","); q.breakable()
7338 q.text("flags = ");
7339 q.text("%#x" % self.flags)
7340 q.text(","); q.breakable()
7341 q.text("port_no = ");
7342 q.text(util.pretty_port(self.port_no))
7343 q.breakable()
7344 q.text('}')
7345
7346bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
7347
7348class bsn_set_aux_cxns_reply(bsn_header):
7349 version = 5
7350 type = 4
7351 experimenter = 6035143
7352 subtype = 59
7353
7354 def __init__(self, xid=None, num_aux=None, status=None):
7355 if xid != None:
7356 self.xid = xid
7357 else:
7358 self.xid = None
7359 if num_aux != None:
7360 self.num_aux = num_aux
7361 else:
7362 self.num_aux = 0
7363 if status != None:
7364 self.status = status
7365 else:
7366 self.status = 0
7367 return
7368
7369 def pack(self):
7370 packed = []
7371 packed.append(struct.pack("!B", self.version))
7372 packed.append(struct.pack("!B", self.type))
7373 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7374 packed.append(struct.pack("!L", self.xid))
7375 packed.append(struct.pack("!L", self.experimenter))
7376 packed.append(struct.pack("!L", self.subtype))
7377 packed.append(struct.pack("!L", self.num_aux))
7378 packed.append(struct.pack("!L", self.status))
7379 length = sum([len(x) for x in packed])
7380 packed[2] = struct.pack("!H", length)
7381 return ''.join(packed)
7382
7383 @staticmethod
7384 def unpack(reader):
7385 obj = bsn_set_aux_cxns_reply()
7386 _version = reader.read("!B")[0]
7387 assert(_version == 5)
7388 _type = reader.read("!B")[0]
7389 assert(_type == 4)
7390 _length = reader.read("!H")[0]
7391 orig_reader = reader
7392 reader = orig_reader.slice(_length, 4)
7393 obj.xid = reader.read("!L")[0]
7394 _experimenter = reader.read("!L")[0]
7395 assert(_experimenter == 6035143)
7396 _subtype = reader.read("!L")[0]
7397 assert(_subtype == 59)
7398 obj.num_aux = reader.read("!L")[0]
7399 obj.status = reader.read("!L")[0]
7400 return obj
7401
7402 def __eq__(self, other):
7403 if type(self) != type(other): return False
7404 if self.xid != other.xid: return False
7405 if self.num_aux != other.num_aux: return False
7406 if self.status != other.status: return False
7407 return True
7408
7409 def pretty_print(self, q):
7410 q.text("bsn_set_aux_cxns_reply {")
7411 with q.group():
7412 with q.indent(2):
7413 q.breakable()
7414 q.text("xid = ");
7415 if self.xid != None:
7416 q.text("%#x" % self.xid)
7417 else:
7418 q.text('None')
7419 q.text(","); q.breakable()
7420 q.text("num_aux = ");
7421 q.text("%#x" % self.num_aux)
7422 q.text(","); q.breakable()
7423 q.text("status = ");
7424 q.text("%#x" % self.status)
7425 q.breakable()
7426 q.text('}')
7427
7428bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7429
7430class bsn_set_aux_cxns_request(bsn_header):
7431 version = 5
7432 type = 4
7433 experimenter = 6035143
7434 subtype = 58
7435
7436 def __init__(self, xid=None, num_aux=None):
7437 if xid != None:
7438 self.xid = xid
7439 else:
7440 self.xid = None
7441 if num_aux != None:
7442 self.num_aux = num_aux
7443 else:
7444 self.num_aux = 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(struct.pack("!L", self.experimenter))
7454 packed.append(struct.pack("!L", self.subtype))
7455 packed.append(struct.pack("!L", self.num_aux))
7456 length = sum([len(x) for x in packed])
7457 packed[2] = struct.pack("!H", length)
7458 return ''.join(packed)
7459
7460 @staticmethod
7461 def unpack(reader):
7462 obj = bsn_set_aux_cxns_request()
7463 _version = reader.read("!B")[0]
7464 assert(_version == 5)
7465 _type = reader.read("!B")[0]
7466 assert(_type == 4)
7467 _length = reader.read("!H")[0]
7468 orig_reader = reader
7469 reader = orig_reader.slice(_length, 4)
7470 obj.xid = reader.read("!L")[0]
7471 _experimenter = reader.read("!L")[0]
7472 assert(_experimenter == 6035143)
7473 _subtype = reader.read("!L")[0]
7474 assert(_subtype == 58)
7475 obj.num_aux = reader.read("!L")[0]
7476 return obj
7477
7478 def __eq__(self, other):
7479 if type(self) != type(other): return False
7480 if self.xid != other.xid: return False
7481 if self.num_aux != other.num_aux: return False
7482 return True
7483
7484 def pretty_print(self, q):
7485 q.text("bsn_set_aux_cxns_request {")
7486 with q.group():
7487 with q.indent(2):
7488 q.breakable()
7489 q.text("xid = ");
7490 if self.xid != None:
7491 q.text("%#x" % self.xid)
7492 else:
7493 q.text('None')
7494 q.text(","); q.breakable()
7495 q.text("num_aux = ");
7496 q.text("%#x" % self.num_aux)
7497 q.breakable()
7498 q.text('}')
7499
7500bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7501
7502class bsn_set_lacp_reply(bsn_header):
7503 version = 5
7504 type = 4
7505 experimenter = 6035143
7506 subtype = 42
7507
7508 def __init__(self, xid=None, status=None, port_no=None):
7509 if xid != None:
7510 self.xid = xid
7511 else:
7512 self.xid = None
7513 if status != None:
7514 self.status = status
7515 else:
7516 self.status = 0
7517 if port_no != None:
7518 self.port_no = port_no
7519 else:
7520 self.port_no = 0
7521 return
7522
7523 def pack(self):
7524 packed = []
7525 packed.append(struct.pack("!B", self.version))
7526 packed.append(struct.pack("!B", self.type))
7527 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7528 packed.append(struct.pack("!L", self.xid))
7529 packed.append(struct.pack("!L", self.experimenter))
7530 packed.append(struct.pack("!L", self.subtype))
7531 packed.append(struct.pack("!L", self.status))
7532 packed.append(util.pack_port_no(self.port_no))
7533 length = sum([len(x) for x in packed])
7534 packed[2] = struct.pack("!H", length)
7535 return ''.join(packed)
7536
7537 @staticmethod
7538 def unpack(reader):
7539 obj = bsn_set_lacp_reply()
7540 _version = reader.read("!B")[0]
7541 assert(_version == 5)
7542 _type = reader.read("!B")[0]
7543 assert(_type == 4)
7544 _length = reader.read("!H")[0]
7545 orig_reader = reader
7546 reader = orig_reader.slice(_length, 4)
7547 obj.xid = reader.read("!L")[0]
7548 _experimenter = reader.read("!L")[0]
7549 assert(_experimenter == 6035143)
7550 _subtype = reader.read("!L")[0]
7551 assert(_subtype == 42)
7552 obj.status = reader.read("!L")[0]
7553 obj.port_no = util.unpack_port_no(reader)
7554 return obj
7555
7556 def __eq__(self, other):
7557 if type(self) != type(other): return False
7558 if self.xid != other.xid: return False
7559 if self.status != other.status: return False
7560 if self.port_no != other.port_no: return False
7561 return True
7562
7563 def pretty_print(self, q):
7564 q.text("bsn_set_lacp_reply {")
7565 with q.group():
7566 with q.indent(2):
7567 q.breakable()
7568 q.text("xid = ");
7569 if self.xid != None:
7570 q.text("%#x" % self.xid)
7571 else:
7572 q.text('None')
7573 q.text(","); q.breakable()
7574 q.text("status = ");
7575 q.text("%#x" % self.status)
7576 q.text(","); q.breakable()
7577 q.text("port_no = ");
7578 q.text(util.pretty_port(self.port_no))
7579 q.breakable()
7580 q.text('}')
7581
7582bsn_header.subtypes[42] = bsn_set_lacp_reply
7583
7584class bsn_set_lacp_request(bsn_header):
7585 version = 5
7586 type = 4
7587 experimenter = 6035143
7588 subtype = 41
7589
7590 def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None):
7591 if xid != None:
7592 self.xid = xid
7593 else:
7594 self.xid = None
7595 if enabled != None:
7596 self.enabled = enabled
7597 else:
7598 self.enabled = 0
7599 if port_no != None:
7600 self.port_no = port_no
7601 else:
7602 self.port_no = 0
7603 if actor_sys_priority != None:
7604 self.actor_sys_priority = actor_sys_priority
7605 else:
7606 self.actor_sys_priority = 0
7607 if actor_sys_mac != None:
7608 self.actor_sys_mac = actor_sys_mac
7609 else:
7610 self.actor_sys_mac = [0,0,0,0,0,0]
7611 if actor_port_priority != None:
7612 self.actor_port_priority = actor_port_priority
7613 else:
7614 self.actor_port_priority = 0
7615 if actor_port_num != None:
7616 self.actor_port_num = actor_port_num
7617 else:
7618 self.actor_port_num = 0
7619 if actor_key != None:
7620 self.actor_key = actor_key
7621 else:
7622 self.actor_key = 0
7623 return
7624
7625 def pack(self):
7626 packed = []
7627 packed.append(struct.pack("!B", self.version))
7628 packed.append(struct.pack("!B", self.type))
7629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7630 packed.append(struct.pack("!L", self.xid))
7631 packed.append(struct.pack("!L", self.experimenter))
7632 packed.append(struct.pack("!L", self.subtype))
7633 packed.append(struct.pack("!B", self.enabled))
7634 packed.append('\x00' * 3)
7635 packed.append(util.pack_port_no(self.port_no))
7636 packed.append(struct.pack("!H", self.actor_sys_priority))
7637 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7638 packed.append(struct.pack("!H", self.actor_port_priority))
7639 packed.append(struct.pack("!H", self.actor_port_num))
7640 packed.append(struct.pack("!H", self.actor_key))
7641 length = sum([len(x) for x in packed])
7642 packed[2] = struct.pack("!H", length)
7643 return ''.join(packed)
7644
7645 @staticmethod
7646 def unpack(reader):
7647 obj = bsn_set_lacp_request()
7648 _version = reader.read("!B")[0]
7649 assert(_version == 5)
7650 _type = reader.read("!B")[0]
7651 assert(_type == 4)
7652 _length = reader.read("!H")[0]
7653 orig_reader = reader
7654 reader = orig_reader.slice(_length, 4)
7655 obj.xid = reader.read("!L")[0]
7656 _experimenter = reader.read("!L")[0]
7657 assert(_experimenter == 6035143)
7658 _subtype = reader.read("!L")[0]
7659 assert(_subtype == 41)
7660 obj.enabled = reader.read("!B")[0]
7661 reader.skip(3)
7662 obj.port_no = util.unpack_port_no(reader)
7663 obj.actor_sys_priority = reader.read("!H")[0]
7664 obj.actor_sys_mac = list(reader.read('!6B'))
7665 obj.actor_port_priority = reader.read("!H")[0]
7666 obj.actor_port_num = reader.read("!H")[0]
7667 obj.actor_key = reader.read("!H")[0]
7668 return obj
7669
7670 def __eq__(self, other):
7671 if type(self) != type(other): return False
7672 if self.xid != other.xid: return False
7673 if self.enabled != other.enabled: return False
7674 if self.port_no != other.port_no: return False
7675 if self.actor_sys_priority != other.actor_sys_priority: return False
7676 if self.actor_sys_mac != other.actor_sys_mac: return False
7677 if self.actor_port_priority != other.actor_port_priority: return False
7678 if self.actor_port_num != other.actor_port_num: return False
7679 if self.actor_key != other.actor_key: return False
7680 return True
7681
7682 def pretty_print(self, q):
7683 q.text("bsn_set_lacp_request {")
7684 with q.group():
7685 with q.indent(2):
7686 q.breakable()
7687 q.text("xid = ");
7688 if self.xid != None:
7689 q.text("%#x" % self.xid)
7690 else:
7691 q.text('None')
7692 q.text(","); q.breakable()
7693 q.text("enabled = ");
7694 q.text("%#x" % self.enabled)
7695 q.text(","); q.breakable()
7696 q.text("port_no = ");
7697 q.text(util.pretty_port(self.port_no))
7698 q.text(","); q.breakable()
7699 q.text("actor_sys_priority = ");
7700 q.text("%#x" % self.actor_sys_priority)
7701 q.text(","); q.breakable()
7702 q.text("actor_sys_mac = ");
7703 q.text(util.pretty_mac(self.actor_sys_mac))
7704 q.text(","); q.breakable()
7705 q.text("actor_port_priority = ");
7706 q.text("%#x" % self.actor_port_priority)
7707 q.text(","); q.breakable()
7708 q.text("actor_port_num = ");
7709 q.text("%#x" % self.actor_port_num)
7710 q.text(","); q.breakable()
7711 q.text("actor_key = ");
7712 q.text("%#x" % self.actor_key)
7713 q.breakable()
7714 q.text('}')
7715
7716bsn_header.subtypes[41] = bsn_set_lacp_request
7717
7718class bsn_set_mirroring(bsn_header):
7719 version = 5
7720 type = 4
7721 experimenter = 6035143
7722 subtype = 3
7723
7724 def __init__(self, xid=None, report_mirror_ports=None):
7725 if xid != None:
7726 self.xid = xid
7727 else:
7728 self.xid = None
7729 if report_mirror_ports != None:
7730 self.report_mirror_ports = report_mirror_ports
7731 else:
7732 self.report_mirror_ports = 0
7733 return
7734
7735 def pack(self):
7736 packed = []
7737 packed.append(struct.pack("!B", self.version))
7738 packed.append(struct.pack("!B", self.type))
7739 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7740 packed.append(struct.pack("!L", self.xid))
7741 packed.append(struct.pack("!L", self.experimenter))
7742 packed.append(struct.pack("!L", self.subtype))
7743 packed.append(struct.pack("!B", self.report_mirror_ports))
7744 packed.append('\x00' * 3)
7745 length = sum([len(x) for x in packed])
7746 packed[2] = struct.pack("!H", length)
7747 return ''.join(packed)
7748
7749 @staticmethod
7750 def unpack(reader):
7751 obj = bsn_set_mirroring()
7752 _version = reader.read("!B")[0]
7753 assert(_version == 5)
7754 _type = reader.read("!B")[0]
7755 assert(_type == 4)
7756 _length = reader.read("!H")[0]
7757 orig_reader = reader
7758 reader = orig_reader.slice(_length, 4)
7759 obj.xid = reader.read("!L")[0]
7760 _experimenter = reader.read("!L")[0]
7761 assert(_experimenter == 6035143)
7762 _subtype = reader.read("!L")[0]
7763 assert(_subtype == 3)
7764 obj.report_mirror_ports = reader.read("!B")[0]
7765 reader.skip(3)
7766 return obj
7767
7768 def __eq__(self, other):
7769 if type(self) != type(other): return False
7770 if self.xid != other.xid: return False
7771 if self.report_mirror_ports != other.report_mirror_ports: return False
7772 return True
7773
7774 def pretty_print(self, q):
7775 q.text("bsn_set_mirroring {")
7776 with q.group():
7777 with q.indent(2):
7778 q.breakable()
7779 q.text("xid = ");
7780 if self.xid != None:
7781 q.text("%#x" % self.xid)
7782 else:
7783 q.text('None')
7784 q.text(","); q.breakable()
7785 q.text("report_mirror_ports = ");
7786 q.text("%#x" % self.report_mirror_ports)
7787 q.breakable()
7788 q.text('}')
7789
7790bsn_header.subtypes[3] = bsn_set_mirroring
7791
7792class bsn_set_pktin_suppression_reply(bsn_header):
7793 version = 5
7794 type = 4
7795 experimenter = 6035143
7796 subtype = 25
7797
7798 def __init__(self, xid=None, status=None):
7799 if xid != None:
7800 self.xid = xid
7801 else:
7802 self.xid = None
7803 if status != None:
7804 self.status = status
7805 else:
7806 self.status = 0
7807 return
7808
7809 def pack(self):
7810 packed = []
7811 packed.append(struct.pack("!B", self.version))
7812 packed.append(struct.pack("!B", self.type))
7813 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7814 packed.append(struct.pack("!L", self.xid))
7815 packed.append(struct.pack("!L", self.experimenter))
7816 packed.append(struct.pack("!L", self.subtype))
7817 packed.append(struct.pack("!L", self.status))
7818 length = sum([len(x) for x in packed])
7819 packed[2] = struct.pack("!H", length)
7820 return ''.join(packed)
7821
7822 @staticmethod
7823 def unpack(reader):
7824 obj = bsn_set_pktin_suppression_reply()
7825 _version = reader.read("!B")[0]
7826 assert(_version == 5)
7827 _type = reader.read("!B")[0]
7828 assert(_type == 4)
7829 _length = reader.read("!H")[0]
7830 orig_reader = reader
7831 reader = orig_reader.slice(_length, 4)
7832 obj.xid = reader.read("!L")[0]
7833 _experimenter = reader.read("!L")[0]
7834 assert(_experimenter == 6035143)
7835 _subtype = reader.read("!L")[0]
7836 assert(_subtype == 25)
7837 obj.status = reader.read("!L")[0]
7838 return obj
7839
7840 def __eq__(self, other):
7841 if type(self) != type(other): return False
7842 if self.xid != other.xid: return False
7843 if self.status != other.status: return False
7844 return True
7845
7846 def pretty_print(self, q):
7847 q.text("bsn_set_pktin_suppression_reply {")
7848 with q.group():
7849 with q.indent(2):
7850 q.breakable()
7851 q.text("xid = ");
7852 if self.xid != None:
7853 q.text("%#x" % self.xid)
7854 else:
7855 q.text('None')
7856 q.text(","); q.breakable()
7857 q.text("status = ");
7858 q.text("%#x" % self.status)
7859 q.breakable()
7860 q.text('}')
7861
7862bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7863
7864class bsn_set_pktin_suppression_request(bsn_header):
7865 version = 5
7866 type = 4
7867 experimenter = 6035143
7868 subtype = 11
7869
7870 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7871 if xid != None:
7872 self.xid = xid
7873 else:
7874 self.xid = None
7875 if enabled != None:
7876 self.enabled = enabled
7877 else:
7878 self.enabled = 0
7879 if idle_timeout != None:
7880 self.idle_timeout = idle_timeout
7881 else:
7882 self.idle_timeout = 0
7883 if hard_timeout != None:
7884 self.hard_timeout = hard_timeout
7885 else:
7886 self.hard_timeout = 0
7887 if priority != None:
7888 self.priority = priority
7889 else:
7890 self.priority = 0
7891 if cookie != None:
7892 self.cookie = cookie
7893 else:
7894 self.cookie = 0
7895 return
7896
7897 def pack(self):
7898 packed = []
7899 packed.append(struct.pack("!B", self.version))
7900 packed.append(struct.pack("!B", self.type))
7901 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7902 packed.append(struct.pack("!L", self.xid))
7903 packed.append(struct.pack("!L", self.experimenter))
7904 packed.append(struct.pack("!L", self.subtype))
7905 packed.append(struct.pack("!B", self.enabled))
7906 packed.append('\x00' * 1)
7907 packed.append(struct.pack("!H", self.idle_timeout))
7908 packed.append(struct.pack("!H", self.hard_timeout))
7909 packed.append(struct.pack("!H", self.priority))
7910 packed.append(struct.pack("!Q", self.cookie))
7911 length = sum([len(x) for x in packed])
7912 packed[2] = struct.pack("!H", length)
7913 return ''.join(packed)
7914
7915 @staticmethod
7916 def unpack(reader):
7917 obj = bsn_set_pktin_suppression_request()
7918 _version = reader.read("!B")[0]
7919 assert(_version == 5)
7920 _type = reader.read("!B")[0]
7921 assert(_type == 4)
7922 _length = reader.read("!H")[0]
7923 orig_reader = reader
7924 reader = orig_reader.slice(_length, 4)
7925 obj.xid = reader.read("!L")[0]
7926 _experimenter = reader.read("!L")[0]
7927 assert(_experimenter == 6035143)
7928 _subtype = reader.read("!L")[0]
7929 assert(_subtype == 11)
7930 obj.enabled = reader.read("!B")[0]
7931 reader.skip(1)
7932 obj.idle_timeout = reader.read("!H")[0]
7933 obj.hard_timeout = reader.read("!H")[0]
7934 obj.priority = reader.read("!H")[0]
7935 obj.cookie = reader.read("!Q")[0]
7936 return obj
7937
7938 def __eq__(self, other):
7939 if type(self) != type(other): return False
7940 if self.xid != other.xid: return False
7941 if self.enabled != other.enabled: return False
7942 if self.idle_timeout != other.idle_timeout: return False
7943 if self.hard_timeout != other.hard_timeout: return False
7944 if self.priority != other.priority: return False
7945 if self.cookie != other.cookie: return False
7946 return True
7947
7948 def pretty_print(self, q):
7949 q.text("bsn_set_pktin_suppression_request {")
7950 with q.group():
7951 with q.indent(2):
7952 q.breakable()
7953 q.text("xid = ");
7954 if self.xid != None:
7955 q.text("%#x" % self.xid)
7956 else:
7957 q.text('None')
7958 q.text(","); q.breakable()
7959 q.text("enabled = ");
7960 q.text("%#x" % self.enabled)
7961 q.text(","); q.breakable()
7962 q.text("idle_timeout = ");
7963 q.text("%#x" % self.idle_timeout)
7964 q.text(","); q.breakable()
7965 q.text("hard_timeout = ");
7966 q.text("%#x" % self.hard_timeout)
7967 q.text(","); q.breakable()
7968 q.text("priority = ");
7969 q.text("%#x" % self.priority)
7970 q.text(","); q.breakable()
7971 q.text("cookie = ");
7972 q.text("%#x" % self.cookie)
7973 q.breakable()
7974 q.text('}')
7975
7976bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7977
7978class bsn_set_switch_pipeline_reply(bsn_header):
7979 version = 5
7980 type = 4
7981 experimenter = 6035143
7982 subtype = 54
7983
7984 def __init__(self, xid=None, status=None):
7985 if xid != None:
7986 self.xid = xid
7987 else:
7988 self.xid = None
7989 if status != None:
7990 self.status = status
7991 else:
7992 self.status = 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("!L", self.experimenter))
8002 packed.append(struct.pack("!L", self.subtype))
8003 packed.append(struct.pack("!L", self.status))
8004 length = sum([len(x) for x in packed])
8005 packed[2] = struct.pack("!H", length)
8006 return ''.join(packed)
8007
8008 @staticmethod
8009 def unpack(reader):
8010 obj = bsn_set_switch_pipeline_reply()
8011 _version = reader.read("!B")[0]
8012 assert(_version == 5)
8013 _type = reader.read("!B")[0]
8014 assert(_type == 4)
8015 _length = reader.read("!H")[0]
8016 orig_reader = reader
8017 reader = orig_reader.slice(_length, 4)
8018 obj.xid = reader.read("!L")[0]
8019 _experimenter = reader.read("!L")[0]
8020 assert(_experimenter == 6035143)
8021 _subtype = reader.read("!L")[0]
8022 assert(_subtype == 54)
8023 obj.status = reader.read("!L")[0]
8024 return obj
8025
8026 def __eq__(self, other):
8027 if type(self) != type(other): return False
8028 if self.xid != other.xid: return False
8029 if self.status != other.status: return False
8030 return True
8031
8032 def pretty_print(self, q):
8033 q.text("bsn_set_switch_pipeline_reply {")
8034 with q.group():
8035 with q.indent(2):
8036 q.breakable()
8037 q.text("xid = ");
8038 if self.xid != None:
8039 q.text("%#x" % self.xid)
8040 else:
8041 q.text('None')
8042 q.text(","); q.breakable()
8043 q.text("status = ");
8044 q.text("%#x" % self.status)
8045 q.breakable()
8046 q.text('}')
8047
8048bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
8049
8050class bsn_set_switch_pipeline_request(bsn_header):
8051 version = 5
8052 type = 4
8053 experimenter = 6035143
8054 subtype = 53
8055
8056 def __init__(self, xid=None, pipeline=None):
8057 if xid != None:
8058 self.xid = xid
8059 else:
8060 self.xid = None
8061 if pipeline != None:
8062 self.pipeline = pipeline
8063 else:
8064 self.pipeline = ""
8065 return
8066
8067 def pack(self):
8068 packed = []
8069 packed.append(struct.pack("!B", self.version))
8070 packed.append(struct.pack("!B", self.type))
8071 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8072 packed.append(struct.pack("!L", self.xid))
8073 packed.append(struct.pack("!L", self.experimenter))
8074 packed.append(struct.pack("!L", self.subtype))
8075 packed.append(struct.pack("!256s", self.pipeline))
8076 length = sum([len(x) for x in packed])
8077 packed[2] = struct.pack("!H", length)
8078 return ''.join(packed)
8079
8080 @staticmethod
8081 def unpack(reader):
8082 obj = bsn_set_switch_pipeline_request()
8083 _version = reader.read("!B")[0]
8084 assert(_version == 5)
8085 _type = reader.read("!B")[0]
8086 assert(_type == 4)
8087 _length = reader.read("!H")[0]
8088 orig_reader = reader
8089 reader = orig_reader.slice(_length, 4)
8090 obj.xid = reader.read("!L")[0]
8091 _experimenter = reader.read("!L")[0]
8092 assert(_experimenter == 6035143)
8093 _subtype = reader.read("!L")[0]
8094 assert(_subtype == 53)
8095 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
8096 return obj
8097
8098 def __eq__(self, other):
8099 if type(self) != type(other): return False
8100 if self.xid != other.xid: return False
8101 if self.pipeline != other.pipeline: return False
8102 return True
8103
8104 def pretty_print(self, q):
8105 q.text("bsn_set_switch_pipeline_request {")
8106 with q.group():
8107 with q.indent(2):
8108 q.breakable()
8109 q.text("xid = ");
8110 if self.xid != None:
8111 q.text("%#x" % self.xid)
8112 else:
8113 q.text('None')
8114 q.text(","); q.breakable()
8115 q.text("pipeline = ");
8116 q.pp(self.pipeline)
8117 q.breakable()
8118 q.text('}')
8119
8120bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
8121
8122class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
8123 version = 5
8124 type = 19
8125 stats_type = 65535
8126 experimenter = 6035143
8127 subtype = 6
8128
8129 def __init__(self, xid=None, flags=None, entries=None):
8130 if xid != None:
8131 self.xid = xid
8132 else:
8133 self.xid = None
8134 if flags != None:
8135 self.flags = flags
8136 else:
8137 self.flags = 0
8138 if entries != None:
8139 self.entries = entries
8140 else:
8141 self.entries = []
8142 return
8143
8144 def pack(self):
8145 packed = []
8146 packed.append(struct.pack("!B", self.version))
8147 packed.append(struct.pack("!B", self.type))
8148 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8149 packed.append(struct.pack("!L", self.xid))
8150 packed.append(struct.pack("!H", self.stats_type))
8151 packed.append(struct.pack("!H", self.flags))
8152 packed.append('\x00' * 4)
8153 packed.append(struct.pack("!L", self.experimenter))
8154 packed.append(struct.pack("!L", self.subtype))
8155 packed.append(loxi.generic_util.pack_list(self.entries))
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 = bsn_switch_pipeline_stats_reply()
8163 _version = reader.read("!B")[0]
8164 assert(_version == 5)
8165 _type = reader.read("!B")[0]
8166 assert(_type == 19)
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 _stats_type = reader.read("!H")[0]
8172 assert(_stats_type == 65535)
8173 obj.flags = reader.read("!H")[0]
8174 reader.skip(4)
8175 _experimenter = reader.read("!L")[0]
8176 assert(_experimenter == 6035143)
8177 _subtype = reader.read("!L")[0]
8178 assert(_subtype == 6)
8179 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
8180 return obj
8181
8182 def __eq__(self, other):
8183 if type(self) != type(other): return False
8184 if self.xid != other.xid: return False
8185 if self.flags != other.flags: return False
8186 if self.entries != other.entries: return False
8187 return True
8188
8189 def pretty_print(self, q):
8190 q.text("bsn_switch_pipeline_stats_reply {")
8191 with q.group():
8192 with q.indent(2):
8193 q.breakable()
8194 q.text("xid = ");
8195 if self.xid != None:
8196 q.text("%#x" % self.xid)
8197 else:
8198 q.text('None')
8199 q.text(","); q.breakable()
8200 q.text("flags = ");
8201 q.text("%#x" % self.flags)
8202 q.text(","); q.breakable()
8203 q.text("entries = ");
8204 q.pp(self.entries)
8205 q.breakable()
8206 q.text('}')
8207
8208bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
8209
8210class bsn_switch_pipeline_stats_request(bsn_stats_request):
8211 version = 5
8212 type = 18
8213 stats_type = 65535
8214 experimenter = 6035143
8215 subtype = 6
8216
8217 def __init__(self, xid=None, flags=None):
8218 if xid != None:
8219 self.xid = xid
8220 else:
8221 self.xid = None
8222 if flags != None:
8223 self.flags = flags
8224 else:
8225 self.flags = 0
8226 return
8227
8228 def pack(self):
8229 packed = []
8230 packed.append(struct.pack("!B", self.version))
8231 packed.append(struct.pack("!B", self.type))
8232 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8233 packed.append(struct.pack("!L", self.xid))
8234 packed.append(struct.pack("!H", self.stats_type))
8235 packed.append(struct.pack("!H", self.flags))
8236 packed.append('\x00' * 4)
8237 packed.append(struct.pack("!L", self.experimenter))
8238 packed.append(struct.pack("!L", self.subtype))
8239 length = sum([len(x) for x in packed])
8240 packed[2] = struct.pack("!H", length)
8241 return ''.join(packed)
8242
8243 @staticmethod
8244 def unpack(reader):
8245 obj = bsn_switch_pipeline_stats_request()
8246 _version = reader.read("!B")[0]
8247 assert(_version == 5)
8248 _type = reader.read("!B")[0]
8249 assert(_type == 18)
8250 _length = reader.read("!H")[0]
8251 orig_reader = reader
8252 reader = orig_reader.slice(_length, 4)
8253 obj.xid = reader.read("!L")[0]
8254 _stats_type = reader.read("!H")[0]
8255 assert(_stats_type == 65535)
8256 obj.flags = reader.read("!H")[0]
8257 reader.skip(4)
8258 _experimenter = reader.read("!L")[0]
8259 assert(_experimenter == 6035143)
8260 _subtype = reader.read("!L")[0]
8261 assert(_subtype == 6)
8262 return obj
8263
8264 def __eq__(self, other):
8265 if type(self) != type(other): return False
8266 if self.xid != other.xid: return False
8267 if self.flags != other.flags: return False
8268 return True
8269
8270 def pretty_print(self, q):
8271 q.text("bsn_switch_pipeline_stats_request {")
8272 with q.group():
8273 with q.indent(2):
8274 q.breakable()
8275 q.text("xid = ");
8276 if self.xid != None:
8277 q.text("%#x" % self.xid)
8278 else:
8279 q.text('None')
8280 q.text(","); q.breakable()
8281 q.text("flags = ");
8282 q.text("%#x" % self.flags)
8283 q.breakable()
8284 q.text('}')
8285
8286bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
8287
8288class bsn_table_checksum_stats_reply(bsn_stats_reply):
8289 version = 5
8290 type = 19
8291 stats_type = 65535
8292 experimenter = 6035143
8293 subtype = 11
8294
8295 def __init__(self, xid=None, flags=None, entries=None):
8296 if xid != None:
8297 self.xid = xid
8298 else:
8299 self.xid = None
8300 if flags != None:
8301 self.flags = flags
8302 else:
8303 self.flags = 0
8304 if entries != None:
8305 self.entries = entries
8306 else:
8307 self.entries = []
8308 return
8309
8310 def pack(self):
8311 packed = []
8312 packed.append(struct.pack("!B", self.version))
8313 packed.append(struct.pack("!B", self.type))
8314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8315 packed.append(struct.pack("!L", self.xid))
8316 packed.append(struct.pack("!H", self.stats_type))
8317 packed.append(struct.pack("!H", self.flags))
8318 packed.append('\x00' * 4)
8319 packed.append(struct.pack("!L", self.experimenter))
8320 packed.append(struct.pack("!L", self.subtype))
8321 packed.append(loxi.generic_util.pack_list(self.entries))
8322 length = sum([len(x) for x in packed])
8323 packed[2] = struct.pack("!H", length)
8324 return ''.join(packed)
8325
8326 @staticmethod
8327 def unpack(reader):
8328 obj = bsn_table_checksum_stats_reply()
8329 _version = reader.read("!B")[0]
8330 assert(_version == 5)
8331 _type = reader.read("!B")[0]
8332 assert(_type == 19)
8333 _length = reader.read("!H")[0]
8334 orig_reader = reader
8335 reader = orig_reader.slice(_length, 4)
8336 obj.xid = reader.read("!L")[0]
8337 _stats_type = reader.read("!H")[0]
8338 assert(_stats_type == 65535)
8339 obj.flags = reader.read("!H")[0]
8340 reader.skip(4)
8341 _experimenter = reader.read("!L")[0]
8342 assert(_experimenter == 6035143)
8343 _subtype = reader.read("!L")[0]
8344 assert(_subtype == 11)
8345 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
8346 return obj
8347
8348 def __eq__(self, other):
8349 if type(self) != type(other): return False
8350 if self.xid != other.xid: return False
8351 if self.flags != other.flags: return False
8352 if self.entries != other.entries: return False
8353 return True
8354
8355 def pretty_print(self, q):
8356 q.text("bsn_table_checksum_stats_reply {")
8357 with q.group():
8358 with q.indent(2):
8359 q.breakable()
8360 q.text("xid = ");
8361 if self.xid != None:
8362 q.text("%#x" % self.xid)
8363 else:
8364 q.text('None')
8365 q.text(","); q.breakable()
8366 q.text("flags = ");
8367 q.text("%#x" % self.flags)
8368 q.text(","); q.breakable()
8369 q.text("entries = ");
8370 q.pp(self.entries)
8371 q.breakable()
8372 q.text('}')
8373
8374bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8375
8376class bsn_table_checksum_stats_request(bsn_stats_request):
8377 version = 5
8378 type = 18
8379 stats_type = 65535
8380 experimenter = 6035143
8381 subtype = 11
8382
8383 def __init__(self, xid=None, flags=None):
8384 if xid != None:
8385 self.xid = xid
8386 else:
8387 self.xid = None
8388 if flags != None:
8389 self.flags = flags
8390 else:
8391 self.flags = 0
8392 return
8393
8394 def pack(self):
8395 packed = []
8396 packed.append(struct.pack("!B", self.version))
8397 packed.append(struct.pack("!B", self.type))
8398 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8399 packed.append(struct.pack("!L", self.xid))
8400 packed.append(struct.pack("!H", self.stats_type))
8401 packed.append(struct.pack("!H", self.flags))
8402 packed.append('\x00' * 4)
8403 packed.append(struct.pack("!L", self.experimenter))
8404 packed.append(struct.pack("!L", self.subtype))
8405 length = sum([len(x) for x in packed])
8406 packed[2] = struct.pack("!H", length)
8407 return ''.join(packed)
8408
8409 @staticmethod
8410 def unpack(reader):
8411 obj = bsn_table_checksum_stats_request()
8412 _version = reader.read("!B")[0]
8413 assert(_version == 5)
8414 _type = reader.read("!B")[0]
8415 assert(_type == 18)
8416 _length = reader.read("!H")[0]
8417 orig_reader = reader
8418 reader = orig_reader.slice(_length, 4)
8419 obj.xid = reader.read("!L")[0]
8420 _stats_type = reader.read("!H")[0]
8421 assert(_stats_type == 65535)
8422 obj.flags = reader.read("!H")[0]
8423 reader.skip(4)
8424 _experimenter = reader.read("!L")[0]
8425 assert(_experimenter == 6035143)
8426 _subtype = reader.read("!L")[0]
8427 assert(_subtype == 11)
8428 return obj
8429
8430 def __eq__(self, other):
8431 if type(self) != type(other): return False
8432 if self.xid != other.xid: return False
8433 if self.flags != other.flags: return False
8434 return True
8435
8436 def pretty_print(self, q):
8437 q.text("bsn_table_checksum_stats_request {")
8438 with q.group():
8439 with q.indent(2):
8440 q.breakable()
8441 q.text("xid = ");
8442 if self.xid != None:
8443 q.text("%#x" % self.xid)
8444 else:
8445 q.text('None')
8446 q.text(","); q.breakable()
8447 q.text("flags = ");
8448 q.text("%#x" % self.flags)
8449 q.breakable()
8450 q.text('}')
8451
8452bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8453
8454class bsn_table_set_buckets_size(bsn_header):
8455 version = 5
8456 type = 4
8457 experimenter = 6035143
8458 subtype = 61
8459
8460 def __init__(self, xid=None, table_id=None, buckets_size=None):
8461 if xid != None:
8462 self.xid = xid
8463 else:
8464 self.xid = None
8465 if table_id != None:
8466 self.table_id = table_id
8467 else:
8468 self.table_id = 0
8469 if buckets_size != None:
8470 self.buckets_size = buckets_size
8471 else:
8472 self.buckets_size = 0
8473 return
8474
8475 def pack(self):
8476 packed = []
8477 packed.append(struct.pack("!B", self.version))
8478 packed.append(struct.pack("!B", self.type))
8479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8480 packed.append(struct.pack("!L", self.xid))
8481 packed.append(struct.pack("!L", self.experimenter))
8482 packed.append(struct.pack("!L", self.subtype))
8483 packed.append('\x00' * 1)
8484 packed.append(struct.pack("!B", self.table_id))
8485 packed.append('\x00' * 2)
8486 packed.append(struct.pack("!L", self.buckets_size))
8487 length = sum([len(x) for x in packed])
8488 packed[2] = struct.pack("!H", length)
8489 return ''.join(packed)
8490
8491 @staticmethod
8492 def unpack(reader):
8493 obj = bsn_table_set_buckets_size()
8494 _version = reader.read("!B")[0]
8495 assert(_version == 5)
8496 _type = reader.read("!B")[0]
8497 assert(_type == 4)
8498 _length = reader.read("!H")[0]
8499 orig_reader = reader
8500 reader = orig_reader.slice(_length, 4)
8501 obj.xid = reader.read("!L")[0]
8502 _experimenter = reader.read("!L")[0]
8503 assert(_experimenter == 6035143)
8504 _subtype = reader.read("!L")[0]
8505 assert(_subtype == 61)
8506 reader.skip(1)
8507 obj.table_id = reader.read("!B")[0]
8508 reader.skip(2)
8509 obj.buckets_size = reader.read("!L")[0]
8510 return obj
8511
8512 def __eq__(self, other):
8513 if type(self) != type(other): return False
8514 if self.xid != other.xid: return False
8515 if self.table_id != other.table_id: return False
8516 if self.buckets_size != other.buckets_size: return False
8517 return True
8518
8519 def pretty_print(self, q):
8520 q.text("bsn_table_set_buckets_size {")
8521 with q.group():
8522 with q.indent(2):
8523 q.breakable()
8524 q.text("xid = ");
8525 if self.xid != None:
8526 q.text("%#x" % self.xid)
8527 else:
8528 q.text('None')
8529 q.text(","); q.breakable()
8530 q.text("table_id = ");
8531 q.text("%#x" % self.table_id)
8532 q.text(","); q.breakable()
8533 q.text("buckets_size = ");
8534 q.text("%#x" % self.buckets_size)
8535 q.breakable()
8536 q.text('}')
8537
8538bsn_header.subtypes[61] = bsn_table_set_buckets_size
8539
8540class bsn_takeover(bsn_header):
8541 version = 5
8542 type = 4
8543 experimenter = 6035143
8544 subtype = 69
8545
8546 def __init__(self, xid=None):
8547 if xid != None:
8548 self.xid = xid
8549 else:
8550 self.xid = None
8551 return
8552
8553 def pack(self):
8554 packed = []
8555 packed.append(struct.pack("!B", self.version))
8556 packed.append(struct.pack("!B", self.type))
8557 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8558 packed.append(struct.pack("!L", self.xid))
8559 packed.append(struct.pack("!L", self.experimenter))
8560 packed.append(struct.pack("!L", self.subtype))
8561 length = sum([len(x) for x in packed])
8562 packed[2] = struct.pack("!H", length)
8563 return ''.join(packed)
8564
8565 @staticmethod
8566 def unpack(reader):
8567 obj = bsn_takeover()
8568 _version = reader.read("!B")[0]
8569 assert(_version == 5)
8570 _type = reader.read("!B")[0]
8571 assert(_type == 4)
8572 _length = reader.read("!H")[0]
8573 orig_reader = reader
8574 reader = orig_reader.slice(_length, 4)
8575 obj.xid = reader.read("!L")[0]
8576 _experimenter = reader.read("!L")[0]
8577 assert(_experimenter == 6035143)
8578 _subtype = reader.read("!L")[0]
8579 assert(_subtype == 69)
8580 return obj
8581
8582 def __eq__(self, other):
8583 if type(self) != type(other): return False
8584 if self.xid != other.xid: return False
8585 return True
8586
8587 def pretty_print(self, q):
8588 q.text("bsn_takeover {")
8589 with q.group():
8590 with q.indent(2):
8591 q.breakable()
8592 q.text("xid = ");
8593 if self.xid != None:
8594 q.text("%#x" % self.xid)
8595 else:
8596 q.text('None')
8597 q.breakable()
8598 q.text('}')
8599
8600bsn_header.subtypes[69] = bsn_takeover
8601
8602class bsn_time_reply(bsn_header):
8603 version = 5
8604 type = 4
8605 experimenter = 6035143
8606 subtype = 45
8607
8608 def __init__(self, xid=None, time_ms=None):
8609 if xid != None:
8610 self.xid = xid
8611 else:
8612 self.xid = None
8613 if time_ms != None:
8614 self.time_ms = time_ms
8615 else:
8616 self.time_ms = 0
8617 return
8618
8619 def pack(self):
8620 packed = []
8621 packed.append(struct.pack("!B", self.version))
8622 packed.append(struct.pack("!B", self.type))
8623 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8624 packed.append(struct.pack("!L", self.xid))
8625 packed.append(struct.pack("!L", self.experimenter))
8626 packed.append(struct.pack("!L", self.subtype))
8627 packed.append(struct.pack("!Q", self.time_ms))
8628 length = sum([len(x) for x in packed])
8629 packed[2] = struct.pack("!H", length)
8630 return ''.join(packed)
8631
8632 @staticmethod
8633 def unpack(reader):
8634 obj = bsn_time_reply()
8635 _version = reader.read("!B")[0]
8636 assert(_version == 5)
8637 _type = reader.read("!B")[0]
8638 assert(_type == 4)
8639 _length = reader.read("!H")[0]
8640 orig_reader = reader
8641 reader = orig_reader.slice(_length, 4)
8642 obj.xid = reader.read("!L")[0]
8643 _experimenter = reader.read("!L")[0]
8644 assert(_experimenter == 6035143)
8645 _subtype = reader.read("!L")[0]
8646 assert(_subtype == 45)
8647 obj.time_ms = reader.read("!Q")[0]
8648 return obj
8649
8650 def __eq__(self, other):
8651 if type(self) != type(other): return False
8652 if self.xid != other.xid: return False
8653 if self.time_ms != other.time_ms: return False
8654 return True
8655
8656 def pretty_print(self, q):
8657 q.text("bsn_time_reply {")
8658 with q.group():
8659 with q.indent(2):
8660 q.breakable()
8661 q.text("xid = ");
8662 if self.xid != None:
8663 q.text("%#x" % self.xid)
8664 else:
8665 q.text('None')
8666 q.text(","); q.breakable()
8667 q.text("time_ms = ");
8668 q.text("%#x" % self.time_ms)
8669 q.breakable()
8670 q.text('}')
8671
8672bsn_header.subtypes[45] = bsn_time_reply
8673
8674class bsn_time_request(bsn_header):
8675 version = 5
8676 type = 4
8677 experimenter = 6035143
8678 subtype = 44
8679
8680 def __init__(self, xid=None):
8681 if xid != None:
8682 self.xid = xid
8683 else:
8684 self.xid = None
8685 return
8686
8687 def pack(self):
8688 packed = []
8689 packed.append(struct.pack("!B", self.version))
8690 packed.append(struct.pack("!B", self.type))
8691 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8692 packed.append(struct.pack("!L", self.xid))
8693 packed.append(struct.pack("!L", self.experimenter))
8694 packed.append(struct.pack("!L", self.subtype))
8695 length = sum([len(x) for x in packed])
8696 packed[2] = struct.pack("!H", length)
8697 return ''.join(packed)
8698
8699 @staticmethod
8700 def unpack(reader):
8701 obj = bsn_time_request()
8702 _version = reader.read("!B")[0]
8703 assert(_version == 5)
8704 _type = reader.read("!B")[0]
8705 assert(_type == 4)
8706 _length = reader.read("!H")[0]
8707 orig_reader = reader
8708 reader = orig_reader.slice(_length, 4)
8709 obj.xid = reader.read("!L")[0]
8710 _experimenter = reader.read("!L")[0]
8711 assert(_experimenter == 6035143)
8712 _subtype = reader.read("!L")[0]
8713 assert(_subtype == 44)
8714 return obj
8715
8716 def __eq__(self, other):
8717 if type(self) != type(other): return False
8718 if self.xid != other.xid: return False
8719 return True
8720
8721 def pretty_print(self, q):
8722 q.text("bsn_time_request {")
8723 with q.group():
8724 with q.indent(2):
8725 q.breakable()
8726 q.text("xid = ");
8727 if self.xid != None:
8728 q.text("%#x" % self.xid)
8729 else:
8730 q.text('None')
8731 q.breakable()
8732 q.text('}')
8733
8734bsn_header.subtypes[44] = bsn_time_request
8735
8736class bsn_virtual_port_create_reply(bsn_header):
8737 version = 5
8738 type = 4
8739 experimenter = 6035143
8740 subtype = 16
8741
8742 def __init__(self, xid=None, status=None, vport_no=None):
8743 if xid != None:
8744 self.xid = xid
8745 else:
8746 self.xid = None
8747 if status != None:
8748 self.status = status
8749 else:
8750 self.status = 0
8751 if vport_no != None:
8752 self.vport_no = vport_no
8753 else:
8754 self.vport_no = 0
8755 return
8756
8757 def pack(self):
8758 packed = []
8759 packed.append(struct.pack("!B", self.version))
8760 packed.append(struct.pack("!B", self.type))
8761 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8762 packed.append(struct.pack("!L", self.xid))
8763 packed.append(struct.pack("!L", self.experimenter))
8764 packed.append(struct.pack("!L", self.subtype))
8765 packed.append(struct.pack("!L", self.status))
8766 packed.append(struct.pack("!L", self.vport_no))
8767 length = sum([len(x) for x in packed])
8768 packed[2] = struct.pack("!H", length)
8769 return ''.join(packed)
8770
8771 @staticmethod
8772 def unpack(reader):
8773 obj = bsn_virtual_port_create_reply()
8774 _version = reader.read("!B")[0]
8775 assert(_version == 5)
8776 _type = reader.read("!B")[0]
8777 assert(_type == 4)
8778 _length = reader.read("!H")[0]
8779 orig_reader = reader
8780 reader = orig_reader.slice(_length, 4)
8781 obj.xid = reader.read("!L")[0]
8782 _experimenter = reader.read("!L")[0]
8783 assert(_experimenter == 6035143)
8784 _subtype = reader.read("!L")[0]
8785 assert(_subtype == 16)
8786 obj.status = reader.read("!L")[0]
8787 obj.vport_no = reader.read("!L")[0]
8788 return obj
8789
8790 def __eq__(self, other):
8791 if type(self) != type(other): return False
8792 if self.xid != other.xid: return False
8793 if self.status != other.status: return False
8794 if self.vport_no != other.vport_no: return False
8795 return True
8796
8797 def pretty_print(self, q):
8798 q.text("bsn_virtual_port_create_reply {")
8799 with q.group():
8800 with q.indent(2):
8801 q.breakable()
8802 q.text("xid = ");
8803 if self.xid != None:
8804 q.text("%#x" % self.xid)
8805 else:
8806 q.text('None')
8807 q.text(","); q.breakable()
8808 q.text("status = ");
8809 q.text("%#x" % self.status)
8810 q.text(","); q.breakable()
8811 q.text("vport_no = ");
8812 q.text("%#x" % self.vport_no)
8813 q.breakable()
8814 q.text('}')
8815
8816bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8817
8818class bsn_virtual_port_create_request(bsn_header):
8819 version = 5
8820 type = 4
8821 experimenter = 6035143
8822 subtype = 15
8823
8824 def __init__(self, xid=None, vport=None):
8825 if xid != None:
8826 self.xid = xid
8827 else:
8828 self.xid = None
8829 if vport != None:
8830 self.vport = vport
8831 else:
8832 self.vport = ofp.bsn_vport()
8833 return
8834
8835 def pack(self):
8836 packed = []
8837 packed.append(struct.pack("!B", self.version))
8838 packed.append(struct.pack("!B", self.type))
8839 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8840 packed.append(struct.pack("!L", self.xid))
8841 packed.append(struct.pack("!L", self.experimenter))
8842 packed.append(struct.pack("!L", self.subtype))
8843 packed.append(self.vport.pack())
8844 length = sum([len(x) for x in packed])
8845 packed[2] = struct.pack("!H", length)
8846 return ''.join(packed)
8847
8848 @staticmethod
8849 def unpack(reader):
8850 obj = bsn_virtual_port_create_request()
8851 _version = reader.read("!B")[0]
8852 assert(_version == 5)
8853 _type = reader.read("!B")[0]
8854 assert(_type == 4)
8855 _length = reader.read("!H")[0]
8856 orig_reader = reader
8857 reader = orig_reader.slice(_length, 4)
8858 obj.xid = reader.read("!L")[0]
8859 _experimenter = reader.read("!L")[0]
8860 assert(_experimenter == 6035143)
8861 _subtype = reader.read("!L")[0]
8862 assert(_subtype == 15)
8863 obj.vport = ofp.bsn_vport.unpack(reader)
8864 return obj
8865
8866 def __eq__(self, other):
8867 if type(self) != type(other): return False
8868 if self.xid != other.xid: return False
8869 if self.vport != other.vport: return False
8870 return True
8871
8872 def pretty_print(self, q):
8873 q.text("bsn_virtual_port_create_request {")
8874 with q.group():
8875 with q.indent(2):
8876 q.breakable()
8877 q.text("xid = ");
8878 if self.xid != None:
8879 q.text("%#x" % self.xid)
8880 else:
8881 q.text('None')
8882 q.text(","); q.breakable()
8883 q.text("vport = ");
8884 q.pp(self.vport)
8885 q.breakable()
8886 q.text('}')
8887
8888bsn_header.subtypes[15] = bsn_virtual_port_create_request
8889
8890class bsn_virtual_port_remove_reply(bsn_header):
8891 version = 5
8892 type = 4
8893 experimenter = 6035143
8894 subtype = 26
8895
8896 def __init__(self, xid=None, status=None):
8897 if xid != None:
8898 self.xid = xid
8899 else:
8900 self.xid = None
8901 if status != None:
8902 self.status = status
8903 else:
8904 self.status = 0
8905 return
8906
8907 def pack(self):
8908 packed = []
8909 packed.append(struct.pack("!B", self.version))
8910 packed.append(struct.pack("!B", self.type))
8911 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8912 packed.append(struct.pack("!L", self.xid))
8913 packed.append(struct.pack("!L", self.experimenter))
8914 packed.append(struct.pack("!L", self.subtype))
8915 packed.append(struct.pack("!L", self.status))
8916 length = sum([len(x) for x in packed])
8917 packed[2] = struct.pack("!H", length)
8918 return ''.join(packed)
8919
8920 @staticmethod
8921 def unpack(reader):
8922 obj = bsn_virtual_port_remove_reply()
8923 _version = reader.read("!B")[0]
8924 assert(_version == 5)
8925 _type = reader.read("!B")[0]
8926 assert(_type == 4)
8927 _length = reader.read("!H")[0]
8928 orig_reader = reader
8929 reader = orig_reader.slice(_length, 4)
8930 obj.xid = reader.read("!L")[0]
8931 _experimenter = reader.read("!L")[0]
8932 assert(_experimenter == 6035143)
8933 _subtype = reader.read("!L")[0]
8934 assert(_subtype == 26)
8935 obj.status = reader.read("!L")[0]
8936 return obj
8937
8938 def __eq__(self, other):
8939 if type(self) != type(other): return False
8940 if self.xid != other.xid: return False
8941 if self.status != other.status: return False
8942 return True
8943
8944 def pretty_print(self, q):
8945 q.text("bsn_virtual_port_remove_reply {")
8946 with q.group():
8947 with q.indent(2):
8948 q.breakable()
8949 q.text("xid = ");
8950 if self.xid != None:
8951 q.text("%#x" % self.xid)
8952 else:
8953 q.text('None')
8954 q.text(","); q.breakable()
8955 q.text("status = ");
8956 q.text("%#x" % self.status)
8957 q.breakable()
8958 q.text('}')
8959
8960bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8961
8962class bsn_virtual_port_remove_request(bsn_header):
8963 version = 5
8964 type = 4
8965 experimenter = 6035143
8966 subtype = 17
8967
8968 def __init__(self, xid=None, vport_no=None):
8969 if xid != None:
8970 self.xid = xid
8971 else:
8972 self.xid = None
8973 if vport_no != None:
8974 self.vport_no = vport_no
8975 else:
8976 self.vport_no = 0
8977 return
8978
8979 def pack(self):
8980 packed = []
8981 packed.append(struct.pack("!B", self.version))
8982 packed.append(struct.pack("!B", self.type))
8983 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8984 packed.append(struct.pack("!L", self.xid))
8985 packed.append(struct.pack("!L", self.experimenter))
8986 packed.append(struct.pack("!L", self.subtype))
8987 packed.append(struct.pack("!L", self.vport_no))
8988 length = sum([len(x) for x in packed])
8989 packed[2] = struct.pack("!H", length)
8990 return ''.join(packed)
8991
8992 @staticmethod
8993 def unpack(reader):
8994 obj = bsn_virtual_port_remove_request()
8995 _version = reader.read("!B")[0]
8996 assert(_version == 5)
8997 _type = reader.read("!B")[0]
8998 assert(_type == 4)
8999 _length = reader.read("!H")[0]
9000 orig_reader = reader
9001 reader = orig_reader.slice(_length, 4)
9002 obj.xid = reader.read("!L")[0]
9003 _experimenter = reader.read("!L")[0]
9004 assert(_experimenter == 6035143)
9005 _subtype = reader.read("!L")[0]
9006 assert(_subtype == 17)
9007 obj.vport_no = reader.read("!L")[0]
9008 return obj
9009
9010 def __eq__(self, other):
9011 if type(self) != type(other): return False
9012 if self.xid != other.xid: return False
9013 if self.vport_no != other.vport_no: return False
9014 return True
9015
9016 def pretty_print(self, q):
9017 q.text("bsn_virtual_port_remove_request {")
9018 with q.group():
9019 with q.indent(2):
9020 q.breakable()
9021 q.text("xid = ");
9022 if self.xid != None:
9023 q.text("%#x" % self.xid)
9024 else:
9025 q.text('None')
9026 q.text(","); q.breakable()
9027 q.text("vport_no = ");
9028 q.text("%#x" % self.vport_no)
9029 q.breakable()
9030 q.text('}')
9031
9032bsn_header.subtypes[17] = bsn_virtual_port_remove_request
9033
9034class bsn_vlan_counter_clear(bsn_header):
9035 version = 5
9036 type = 4
9037 experimenter = 6035143
9038 subtype = 70
9039
9040 def __init__(self, xid=None, vlan_vid=None):
9041 if xid != None:
9042 self.xid = xid
9043 else:
9044 self.xid = None
9045 if vlan_vid != None:
9046 self.vlan_vid = vlan_vid
9047 else:
9048 self.vlan_vid = 0
9049 return
9050
9051 def pack(self):
9052 packed = []
9053 packed.append(struct.pack("!B", self.version))
9054 packed.append(struct.pack("!B", self.type))
9055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9056 packed.append(struct.pack("!L", self.xid))
9057 packed.append(struct.pack("!L", self.experimenter))
9058 packed.append(struct.pack("!L", self.subtype))
9059 packed.append(struct.pack("!H", self.vlan_vid))
9060 length = sum([len(x) for x in packed])
9061 packed[2] = struct.pack("!H", length)
9062 return ''.join(packed)
9063
9064 @staticmethod
9065 def unpack(reader):
9066 obj = bsn_vlan_counter_clear()
9067 _version = reader.read("!B")[0]
9068 assert(_version == 5)
9069 _type = reader.read("!B")[0]
9070 assert(_type == 4)
9071 _length = reader.read("!H")[0]
9072 orig_reader = reader
9073 reader = orig_reader.slice(_length, 4)
9074 obj.xid = reader.read("!L")[0]
9075 _experimenter = reader.read("!L")[0]
9076 assert(_experimenter == 6035143)
9077 _subtype = reader.read("!L")[0]
9078 assert(_subtype == 70)
9079 obj.vlan_vid = reader.read("!H")[0]
9080 return obj
9081
9082 def __eq__(self, other):
9083 if type(self) != type(other): return False
9084 if self.xid != other.xid: return False
9085 if self.vlan_vid != other.vlan_vid: return False
9086 return True
9087
9088 def pretty_print(self, q):
9089 q.text("bsn_vlan_counter_clear {")
9090 with q.group():
9091 with q.indent(2):
9092 q.breakable()
9093 q.text("xid = ");
9094 if self.xid != None:
9095 q.text("%#x" % self.xid)
9096 else:
9097 q.text('None')
9098 q.text(","); q.breakable()
9099 q.text("vlan_vid = ");
9100 q.text("%#x" % self.vlan_vid)
9101 q.breakable()
9102 q.text('}')
9103
9104bsn_header.subtypes[70] = bsn_vlan_counter_clear
9105
9106class bsn_vlan_counter_stats_reply(bsn_stats_reply):
9107 version = 5
9108 type = 19
9109 stats_type = 65535
9110 experimenter = 6035143
9111 subtype = 9
9112
9113 def __init__(self, xid=None, flags=None, entries=None):
9114 if xid != None:
9115 self.xid = xid
9116 else:
9117 self.xid = None
9118 if flags != None:
9119 self.flags = flags
9120 else:
9121 self.flags = 0
9122 if entries != None:
9123 self.entries = entries
9124 else:
9125 self.entries = []
9126 return
9127
9128 def pack(self):
9129 packed = []
9130 packed.append(struct.pack("!B", self.version))
9131 packed.append(struct.pack("!B", self.type))
9132 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9133 packed.append(struct.pack("!L", self.xid))
9134 packed.append(struct.pack("!H", self.stats_type))
9135 packed.append(struct.pack("!H", self.flags))
9136 packed.append('\x00' * 4)
9137 packed.append(struct.pack("!L", self.experimenter))
9138 packed.append(struct.pack("!L", self.subtype))
9139 packed.append(loxi.generic_util.pack_list(self.entries))
9140 length = sum([len(x) for x in packed])
9141 packed[2] = struct.pack("!H", length)
9142 return ''.join(packed)
9143
9144 @staticmethod
9145 def unpack(reader):
9146 obj = bsn_vlan_counter_stats_reply()
9147 _version = reader.read("!B")[0]
9148 assert(_version == 5)
9149 _type = reader.read("!B")[0]
9150 assert(_type == 19)
9151 _length = reader.read("!H")[0]
9152 orig_reader = reader
9153 reader = orig_reader.slice(_length, 4)
9154 obj.xid = reader.read("!L")[0]
9155 _stats_type = reader.read("!H")[0]
9156 assert(_stats_type == 65535)
9157 obj.flags = reader.read("!H")[0]
9158 reader.skip(4)
9159 _experimenter = reader.read("!L")[0]
9160 assert(_experimenter == 6035143)
9161 _subtype = reader.read("!L")[0]
9162 assert(_subtype == 9)
9163 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
9164 return obj
9165
9166 def __eq__(self, other):
9167 if type(self) != type(other): return False
9168 if self.xid != other.xid: return False
9169 if self.flags != other.flags: return False
9170 if self.entries != other.entries: return False
9171 return True
9172
9173 def pretty_print(self, q):
9174 q.text("bsn_vlan_counter_stats_reply {")
9175 with q.group():
9176 with q.indent(2):
9177 q.breakable()
9178 q.text("xid = ");
9179 if self.xid != None:
9180 q.text("%#x" % self.xid)
9181 else:
9182 q.text('None')
9183 q.text(","); q.breakable()
9184 q.text("flags = ");
9185 q.text("%#x" % self.flags)
9186 q.text(","); q.breakable()
9187 q.text("entries = ");
9188 q.pp(self.entries)
9189 q.breakable()
9190 q.text('}')
9191
9192bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
9193
9194class bsn_vlan_counter_stats_request(bsn_stats_request):
9195 version = 5
9196 type = 18
9197 stats_type = 65535
9198 experimenter = 6035143
9199 subtype = 9
9200
9201 def __init__(self, xid=None, flags=None, vlan_vid=None):
9202 if xid != None:
9203 self.xid = xid
9204 else:
9205 self.xid = None
9206 if flags != None:
9207 self.flags = flags
9208 else:
9209 self.flags = 0
9210 if vlan_vid != None:
9211 self.vlan_vid = vlan_vid
9212 else:
9213 self.vlan_vid = 0
9214 return
9215
9216 def pack(self):
9217 packed = []
9218 packed.append(struct.pack("!B", self.version))
9219 packed.append(struct.pack("!B", self.type))
9220 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9221 packed.append(struct.pack("!L", self.xid))
9222 packed.append(struct.pack("!H", self.stats_type))
9223 packed.append(struct.pack("!H", self.flags))
9224 packed.append('\x00' * 4)
9225 packed.append(struct.pack("!L", self.experimenter))
9226 packed.append(struct.pack("!L", self.subtype))
9227 packed.append(struct.pack("!H", self.vlan_vid))
9228 length = sum([len(x) for x in packed])
9229 packed[2] = struct.pack("!H", length)
9230 return ''.join(packed)
9231
9232 @staticmethod
9233 def unpack(reader):
9234 obj = bsn_vlan_counter_stats_request()
9235 _version = reader.read("!B")[0]
9236 assert(_version == 5)
9237 _type = reader.read("!B")[0]
9238 assert(_type == 18)
9239 _length = reader.read("!H")[0]
9240 orig_reader = reader
9241 reader = orig_reader.slice(_length, 4)
9242 obj.xid = reader.read("!L")[0]
9243 _stats_type = reader.read("!H")[0]
9244 assert(_stats_type == 65535)
9245 obj.flags = reader.read("!H")[0]
9246 reader.skip(4)
9247 _experimenter = reader.read("!L")[0]
9248 assert(_experimenter == 6035143)
9249 _subtype = reader.read("!L")[0]
9250 assert(_subtype == 9)
9251 obj.vlan_vid = reader.read("!H")[0]
9252 return obj
9253
9254 def __eq__(self, other):
9255 if type(self) != type(other): return False
9256 if self.xid != other.xid: return False
9257 if self.flags != other.flags: return False
9258 if self.vlan_vid != other.vlan_vid: return False
9259 return True
9260
9261 def pretty_print(self, q):
9262 q.text("bsn_vlan_counter_stats_request {")
9263 with q.group():
9264 with q.indent(2):
9265 q.breakable()
9266 q.text("xid = ");
9267 if self.xid != None:
9268 q.text("%#x" % self.xid)
9269 else:
9270 q.text('None')
9271 q.text(","); q.breakable()
9272 q.text("flags = ");
9273 q.text("%#x" % self.flags)
9274 q.text(","); q.breakable()
9275 q.text("vlan_vid = ");
9276 q.text("%#x" % self.vlan_vid)
9277 q.breakable()
9278 q.text('}')
9279
9280bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
9281
9282class bsn_vrf_counter_stats_reply(bsn_stats_reply):
9283 version = 5
9284 type = 19
9285 stats_type = 65535
9286 experimenter = 6035143
9287 subtype = 15
9288
9289 def __init__(self, xid=None, flags=None, entries=None):
9290 if xid != None:
9291 self.xid = xid
9292 else:
9293 self.xid = None
9294 if flags != None:
9295 self.flags = flags
9296 else:
9297 self.flags = 0
9298 if entries != None:
9299 self.entries = entries
9300 else:
9301 self.entries = []
9302 return
9303
9304 def pack(self):
9305 packed = []
9306 packed.append(struct.pack("!B", self.version))
9307 packed.append(struct.pack("!B", self.type))
9308 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9309 packed.append(struct.pack("!L", self.xid))
9310 packed.append(struct.pack("!H", self.stats_type))
9311 packed.append(struct.pack("!H", self.flags))
9312 packed.append('\x00' * 4)
9313 packed.append(struct.pack("!L", self.experimenter))
9314 packed.append(struct.pack("!L", self.subtype))
9315 packed.append(loxi.generic_util.pack_list(self.entries))
9316 length = sum([len(x) for x in packed])
9317 packed[2] = struct.pack("!H", length)
9318 return ''.join(packed)
9319
9320 @staticmethod
9321 def unpack(reader):
9322 obj = bsn_vrf_counter_stats_reply()
9323 _version = reader.read("!B")[0]
9324 assert(_version == 5)
9325 _type = reader.read("!B")[0]
9326 assert(_type == 19)
9327 _length = reader.read("!H")[0]
9328 orig_reader = reader
9329 reader = orig_reader.slice(_length, 4)
9330 obj.xid = reader.read("!L")[0]
9331 _stats_type = reader.read("!H")[0]
9332 assert(_stats_type == 65535)
9333 obj.flags = reader.read("!H")[0]
9334 reader.skip(4)
9335 _experimenter = reader.read("!L")[0]
9336 assert(_experimenter == 6035143)
9337 _subtype = reader.read("!L")[0]
9338 assert(_subtype == 15)
9339 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
9340 return obj
9341
9342 def __eq__(self, other):
9343 if type(self) != type(other): return False
9344 if self.xid != other.xid: return False
9345 if self.flags != other.flags: return False
9346 if self.entries != other.entries: return False
9347 return True
9348
9349 def pretty_print(self, q):
9350 q.text("bsn_vrf_counter_stats_reply {")
9351 with q.group():
9352 with q.indent(2):
9353 q.breakable()
9354 q.text("xid = ");
9355 if self.xid != None:
9356 q.text("%#x" % self.xid)
9357 else:
9358 q.text('None')
9359 q.text(","); q.breakable()
9360 q.text("flags = ");
9361 q.text("%#x" % self.flags)
9362 q.text(","); q.breakable()
9363 q.text("entries = ");
9364 q.pp(self.entries)
9365 q.breakable()
9366 q.text('}')
9367
9368bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
9369
9370class bsn_vrf_counter_stats_request(bsn_stats_request):
9371 version = 5
9372 type = 18
9373 stats_type = 65535
9374 experimenter = 6035143
9375 subtype = 15
9376
9377 def __init__(self, xid=None, flags=None, vrf=None):
9378 if xid != None:
9379 self.xid = xid
9380 else:
9381 self.xid = None
9382 if flags != None:
9383 self.flags = flags
9384 else:
9385 self.flags = 0
9386 if vrf != None:
9387 self.vrf = vrf
9388 else:
9389 self.vrf = 0
9390 return
9391
9392 def pack(self):
9393 packed = []
9394 packed.append(struct.pack("!B", self.version))
9395 packed.append(struct.pack("!B", self.type))
9396 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9397 packed.append(struct.pack("!L", self.xid))
9398 packed.append(struct.pack("!H", self.stats_type))
9399 packed.append(struct.pack("!H", self.flags))
9400 packed.append('\x00' * 4)
9401 packed.append(struct.pack("!L", self.experimenter))
9402 packed.append(struct.pack("!L", self.subtype))
9403 packed.append(struct.pack("!L", self.vrf))
9404 length = sum([len(x) for x in packed])
9405 packed[2] = struct.pack("!H", length)
9406 return ''.join(packed)
9407
9408 @staticmethod
9409 def unpack(reader):
9410 obj = bsn_vrf_counter_stats_request()
9411 _version = reader.read("!B")[0]
9412 assert(_version == 5)
9413 _type = reader.read("!B")[0]
9414 assert(_type == 18)
9415 _length = reader.read("!H")[0]
9416 orig_reader = reader
9417 reader = orig_reader.slice(_length, 4)
9418 obj.xid = reader.read("!L")[0]
9419 _stats_type = reader.read("!H")[0]
9420 assert(_stats_type == 65535)
9421 obj.flags = reader.read("!H")[0]
9422 reader.skip(4)
9423 _experimenter = reader.read("!L")[0]
9424 assert(_experimenter == 6035143)
9425 _subtype = reader.read("!L")[0]
9426 assert(_subtype == 15)
9427 obj.vrf = reader.read("!L")[0]
9428 return obj
9429
9430 def __eq__(self, other):
9431 if type(self) != type(other): return False
9432 if self.xid != other.xid: return False
9433 if self.flags != other.flags: return False
9434 if self.vrf != other.vrf: return False
9435 return True
9436
9437 def pretty_print(self, q):
9438 q.text("bsn_vrf_counter_stats_request {")
9439 with q.group():
9440 with q.indent(2):
9441 q.breakable()
9442 q.text("xid = ");
9443 if self.xid != None:
9444 q.text("%#x" % self.xid)
9445 else:
9446 q.text('None')
9447 q.text(","); q.breakable()
9448 q.text("flags = ");
9449 q.text("%#x" % self.flags)
9450 q.text(","); q.breakable()
9451 q.text("vrf = ");
9452 q.text("%#x" % self.vrf)
9453 q.breakable()
9454 q.text('}')
9455
9456bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
9457
9458class bundle_add_msg(message):
9459 version = 5
9460 type = 34
9461
9462 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
9463 if xid != None:
9464 self.xid = xid
9465 else:
9466 self.xid = None
9467 if bundle_id != None:
9468 self.bundle_id = bundle_id
9469 else:
9470 self.bundle_id = 0
9471 if flags != None:
9472 self.flags = flags
9473 else:
9474 self.flags = 0
9475 if data != None:
9476 self.data = data
9477 else:
9478 self.data = ''
9479 return
9480
9481 def pack(self):
9482 packed = []
9483 packed.append(struct.pack("!B", self.version))
9484 packed.append(struct.pack("!B", self.type))
9485 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9486 packed.append(struct.pack("!L", self.xid))
9487 packed.append(struct.pack("!L", self.bundle_id))
9488 packed.append('\x00' * 2)
9489 packed.append(struct.pack("!H", self.flags))
9490 packed.append(self.data)
9491 length = sum([len(x) for x in packed])
9492 packed[2] = struct.pack("!H", length)
9493 return ''.join(packed)
9494
9495 @staticmethod
9496 def unpack(reader):
9497 obj = bundle_add_msg()
9498 _version = reader.read("!B")[0]
9499 assert(_version == 5)
9500 _type = reader.read("!B")[0]
9501 assert(_type == 34)
9502 _length = reader.read("!H")[0]
9503 orig_reader = reader
9504 reader = orig_reader.slice(_length, 4)
9505 obj.xid = reader.read("!L")[0]
9506 obj.bundle_id = reader.read("!L")[0]
9507 reader.skip(2)
9508 obj.flags = reader.read("!H")[0]
9509 obj.data = str(reader.read_all())
9510 return obj
9511
9512 def __eq__(self, other):
9513 if type(self) != type(other): return False
9514 if self.xid != other.xid: return False
9515 if self.bundle_id != other.bundle_id: return False
9516 if self.flags != other.flags: return False
9517 if self.data != other.data: return False
9518 return True
9519
9520 def pretty_print(self, q):
9521 q.text("bundle_add_msg {")
9522 with q.group():
9523 with q.indent(2):
9524 q.breakable()
9525 q.text("xid = ");
9526 if self.xid != None:
9527 q.text("%#x" % self.xid)
9528 else:
9529 q.text('None')
9530 q.text(","); q.breakable()
9531 q.text("bundle_id = ");
9532 q.text("%#x" % self.bundle_id)
9533 q.text(","); q.breakable()
9534 q.text("flags = ");
9535 q.text("%#x" % self.flags)
9536 q.text(","); q.breakable()
9537 q.text("data = ");
9538 q.pp(self.data)
9539 q.breakable()
9540 q.text('}')
9541
9542message.subtypes[34] = bundle_add_msg
9543
9544class bundle_ctrl_msg(message):
9545 version = 5
9546 type = 33
9547
9548 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
9549 if xid != None:
9550 self.xid = xid
9551 else:
9552 self.xid = None
9553 if bundle_id != None:
9554 self.bundle_id = bundle_id
9555 else:
9556 self.bundle_id = 0
9557 if bundle_ctrl_type != None:
9558 self.bundle_ctrl_type = bundle_ctrl_type
9559 else:
9560 self.bundle_ctrl_type = 0
9561 if flags != None:
9562 self.flags = flags
9563 else:
9564 self.flags = 0
9565 if properties != None:
9566 self.properties = properties
9567 else:
9568 self.properties = []
9569 return
9570
9571 def pack(self):
9572 packed = []
9573 packed.append(struct.pack("!B", self.version))
9574 packed.append(struct.pack("!B", self.type))
9575 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9576 packed.append(struct.pack("!L", self.xid))
9577 packed.append(struct.pack("!L", self.bundle_id))
9578 packed.append(struct.pack("!H", self.bundle_ctrl_type))
9579 packed.append(struct.pack("!H", self.flags))
9580 packed.append(loxi.generic_util.pack_list(self.properties))
9581 length = sum([len(x) for x in packed])
9582 packed[2] = struct.pack("!H", length)
9583 return ''.join(packed)
9584
9585 @staticmethod
9586 def unpack(reader):
9587 obj = bundle_ctrl_msg()
9588 _version = reader.read("!B")[0]
9589 assert(_version == 5)
9590 _type = reader.read("!B")[0]
9591 assert(_type == 33)
9592 _length = reader.read("!H")[0]
9593 orig_reader = reader
9594 reader = orig_reader.slice(_length, 4)
9595 obj.xid = reader.read("!L")[0]
9596 obj.bundle_id = reader.read("!L")[0]
9597 obj.bundle_ctrl_type = reader.read("!H")[0]
9598 obj.flags = reader.read("!H")[0]
9599 obj.properties = loxi.generic_util.unpack_list(reader, ofp.bundle_prop.bundle_prop.unpack)
9600 return obj
9601
9602 def __eq__(self, other):
9603 if type(self) != type(other): return False
9604 if self.xid != other.xid: return False
9605 if self.bundle_id != other.bundle_id: return False
9606 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
9607 if self.flags != other.flags: return False
9608 if self.properties != other.properties: return False
9609 return True
9610
9611 def pretty_print(self, q):
9612 q.text("bundle_ctrl_msg {")
9613 with q.group():
9614 with q.indent(2):
9615 q.breakable()
9616 q.text("xid = ");
9617 if self.xid != None:
9618 q.text("%#x" % self.xid)
9619 else:
9620 q.text('None')
9621 q.text(","); q.breakable()
9622 q.text("bundle_id = ");
9623 q.text("%#x" % self.bundle_id)
9624 q.text(","); q.breakable()
9625 q.text("bundle_ctrl_type = ");
9626 q.text("%#x" % self.bundle_ctrl_type)
9627 q.text(","); q.breakable()
9628 q.text("flags = ");
9629 q.text("%#x" % self.flags)
9630 q.text(","); q.breakable()
9631 q.text("properties = ");
9632 q.pp(self.properties)
9633 q.breakable()
9634 q.text('}')
9635
9636message.subtypes[33] = bundle_ctrl_msg
9637
9638class bundle_failed_error_msg(error_msg):
9639 version = 5
9640 type = 1
9641 err_type = 17
9642
9643 def __init__(self, xid=None, code=None, data=None):
9644 if xid != None:
9645 self.xid = xid
9646 else:
9647 self.xid = None
9648 if code != None:
9649 self.code = code
9650 else:
9651 self.code = 0
9652 if data != None:
9653 self.data = data
9654 else:
9655 self.data = ''
9656 return
9657
9658 def pack(self):
9659 packed = []
9660 packed.append(struct.pack("!B", self.version))
9661 packed.append(struct.pack("!B", self.type))
9662 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9663 packed.append(struct.pack("!L", self.xid))
9664 packed.append(struct.pack("!H", self.err_type))
9665 packed.append(struct.pack("!H", self.code))
9666 packed.append(self.data)
9667 length = sum([len(x) for x in packed])
9668 packed[2] = struct.pack("!H", length)
9669 return ''.join(packed)
9670
9671 @staticmethod
9672 def unpack(reader):
9673 obj = bundle_failed_error_msg()
9674 _version = reader.read("!B")[0]
9675 assert(_version == 5)
9676 _type = reader.read("!B")[0]
9677 assert(_type == 1)
9678 _length = reader.read("!H")[0]
9679 orig_reader = reader
9680 reader = orig_reader.slice(_length, 4)
9681 obj.xid = reader.read("!L")[0]
9682 _err_type = reader.read("!H")[0]
9683 assert(_err_type == 17)
9684 obj.code = reader.read("!H")[0]
9685 obj.data = str(reader.read_all())
9686 return obj
9687
9688 def __eq__(self, other):
9689 if type(self) != type(other): return False
9690 if self.xid != other.xid: return False
9691 if self.code != other.code: return False
9692 if self.data != other.data: return False
9693 return True
9694
9695 def pretty_print(self, q):
9696 q.text("bundle_failed_error_msg {")
9697 with q.group():
9698 with q.indent(2):
9699 q.breakable()
9700 q.text("xid = ");
9701 if self.xid != None:
9702 q.text("%#x" % self.xid)
9703 else:
9704 q.text('None')
9705 q.text(","); q.breakable()
9706 q.text("code = ");
9707 q.text("%#x" % self.code)
9708 q.text(","); q.breakable()
9709 q.text("data = ");
9710 q.pp(self.data)
9711 q.breakable()
9712 q.text('}')
9713
9714error_msg.subtypes[17] = bundle_failed_error_msg
9715
9716class desc_stats_reply(stats_reply):
9717 version = 5
9718 type = 19
9719 stats_type = 0
9720
9721 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
9722 if xid != None:
9723 self.xid = xid
9724 else:
9725 self.xid = None
9726 if flags != None:
9727 self.flags = flags
9728 else:
9729 self.flags = 0
9730 if mfr_desc != None:
9731 self.mfr_desc = mfr_desc
9732 else:
9733 self.mfr_desc = ""
9734 if hw_desc != None:
9735 self.hw_desc = hw_desc
9736 else:
9737 self.hw_desc = ""
9738 if sw_desc != None:
9739 self.sw_desc = sw_desc
9740 else:
9741 self.sw_desc = ""
9742 if serial_num != None:
9743 self.serial_num = serial_num
9744 else:
9745 self.serial_num = ""
9746 if dp_desc != None:
9747 self.dp_desc = dp_desc
9748 else:
9749 self.dp_desc = ""
9750 return
9751
9752 def pack(self):
9753 packed = []
9754 packed.append(struct.pack("!B", self.version))
9755 packed.append(struct.pack("!B", self.type))
9756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9757 packed.append(struct.pack("!L", self.xid))
9758 packed.append(struct.pack("!H", self.stats_type))
9759 packed.append(struct.pack("!H", self.flags))
9760 packed.append('\x00' * 4)
9761 packed.append(struct.pack("!256s", self.mfr_desc))
9762 packed.append(struct.pack("!256s", self.hw_desc))
9763 packed.append(struct.pack("!256s", self.sw_desc))
9764 packed.append(struct.pack("!32s", self.serial_num))
9765 packed.append(struct.pack("!256s", self.dp_desc))
9766 length = sum([len(x) for x in packed])
9767 packed[2] = struct.pack("!H", length)
9768 return ''.join(packed)
9769
9770 @staticmethod
9771 def unpack(reader):
9772 obj = desc_stats_reply()
9773 _version = reader.read("!B")[0]
9774 assert(_version == 5)
9775 _type = reader.read("!B")[0]
9776 assert(_type == 19)
9777 _length = reader.read("!H")[0]
9778 orig_reader = reader
9779 reader = orig_reader.slice(_length, 4)
9780 obj.xid = reader.read("!L")[0]
9781 _stats_type = reader.read("!H")[0]
9782 assert(_stats_type == 0)
9783 obj.flags = reader.read("!H")[0]
9784 reader.skip(4)
9785 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9786 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9787 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9788 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9789 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9790 return obj
9791
9792 def __eq__(self, other):
9793 if type(self) != type(other): return False
9794 if self.xid != other.xid: return False
9795 if self.flags != other.flags: return False
9796 if self.mfr_desc != other.mfr_desc: return False
9797 if self.hw_desc != other.hw_desc: return False
9798 if self.sw_desc != other.sw_desc: return False
9799 if self.serial_num != other.serial_num: return False
9800 if self.dp_desc != other.dp_desc: return False
9801 return True
9802
9803 def pretty_print(self, q):
9804 q.text("desc_stats_reply {")
9805 with q.group():
9806 with q.indent(2):
9807 q.breakable()
9808 q.text("xid = ");
9809 if self.xid != None:
9810 q.text("%#x" % self.xid)
9811 else:
9812 q.text('None')
9813 q.text(","); q.breakable()
9814 q.text("flags = ");
9815 q.text("%#x" % self.flags)
9816 q.text(","); q.breakable()
9817 q.text("mfr_desc = ");
9818 q.pp(self.mfr_desc)
9819 q.text(","); q.breakable()
9820 q.text("hw_desc = ");
9821 q.pp(self.hw_desc)
9822 q.text(","); q.breakable()
9823 q.text("sw_desc = ");
9824 q.pp(self.sw_desc)
9825 q.text(","); q.breakable()
9826 q.text("serial_num = ");
9827 q.pp(self.serial_num)
9828 q.text(","); q.breakable()
9829 q.text("dp_desc = ");
9830 q.pp(self.dp_desc)
9831 q.breakable()
9832 q.text('}')
9833
9834stats_reply.subtypes[0] = desc_stats_reply
9835
9836class desc_stats_request(stats_request):
9837 version = 5
9838 type = 18
9839 stats_type = 0
9840
9841 def __init__(self, xid=None, flags=None):
9842 if xid != None:
9843 self.xid = xid
9844 else:
9845 self.xid = None
9846 if flags != None:
9847 self.flags = flags
9848 else:
9849 self.flags = 0
9850 return
9851
9852 def pack(self):
9853 packed = []
9854 packed.append(struct.pack("!B", self.version))
9855 packed.append(struct.pack("!B", self.type))
9856 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9857 packed.append(struct.pack("!L", self.xid))
9858 packed.append(struct.pack("!H", self.stats_type))
9859 packed.append(struct.pack("!H", self.flags))
9860 packed.append('\x00' * 4)
9861 length = sum([len(x) for x in packed])
9862 packed[2] = struct.pack("!H", length)
9863 return ''.join(packed)
9864
9865 @staticmethod
9866 def unpack(reader):
9867 obj = desc_stats_request()
9868 _version = reader.read("!B")[0]
9869 assert(_version == 5)
9870 _type = reader.read("!B")[0]
9871 assert(_type == 18)
9872 _length = reader.read("!H")[0]
9873 orig_reader = reader
9874 reader = orig_reader.slice(_length, 4)
9875 obj.xid = reader.read("!L")[0]
9876 _stats_type = reader.read("!H")[0]
9877 assert(_stats_type == 0)
9878 obj.flags = reader.read("!H")[0]
9879 reader.skip(4)
9880 return obj
9881
9882 def __eq__(self, other):
9883 if type(self) != type(other): return False
9884 if self.xid != other.xid: return False
9885 if self.flags != other.flags: return False
9886 return True
9887
9888 def pretty_print(self, q):
9889 q.text("desc_stats_request {")
9890 with q.group():
9891 with q.indent(2):
9892 q.breakable()
9893 q.text("xid = ");
9894 if self.xid != None:
9895 q.text("%#x" % self.xid)
9896 else:
9897 q.text('None')
9898 q.text(","); q.breakable()
9899 q.text("flags = ");
9900 q.text("%#x" % self.flags)
9901 q.breakable()
9902 q.text('}')
9903
9904stats_request.subtypes[0] = desc_stats_request
9905
9906class echo_reply(message):
9907 version = 5
9908 type = 3
9909
9910 def __init__(self, xid=None, data=None):
9911 if xid != None:
9912 self.xid = xid
9913 else:
9914 self.xid = None
9915 if data != None:
9916 self.data = data
9917 else:
9918 self.data = ''
9919 return
9920
9921 def pack(self):
9922 packed = []
9923 packed.append(struct.pack("!B", self.version))
9924 packed.append(struct.pack("!B", self.type))
9925 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9926 packed.append(struct.pack("!L", self.xid))
9927 packed.append(self.data)
9928 length = sum([len(x) for x in packed])
9929 packed[2] = struct.pack("!H", length)
9930 return ''.join(packed)
9931
9932 @staticmethod
9933 def unpack(reader):
9934 obj = echo_reply()
9935 _version = reader.read("!B")[0]
9936 assert(_version == 5)
9937 _type = reader.read("!B")[0]
9938 assert(_type == 3)
9939 _length = reader.read("!H")[0]
9940 orig_reader = reader
9941 reader = orig_reader.slice(_length, 4)
9942 obj.xid = reader.read("!L")[0]
9943 obj.data = str(reader.read_all())
9944 return obj
9945
9946 def __eq__(self, other):
9947 if type(self) != type(other): return False
9948 if self.xid != other.xid: return False
9949 if self.data != other.data: return False
9950 return True
9951
9952 def pretty_print(self, q):
9953 q.text("echo_reply {")
9954 with q.group():
9955 with q.indent(2):
9956 q.breakable()
9957 q.text("xid = ");
9958 if self.xid != None:
9959 q.text("%#x" % self.xid)
9960 else:
9961 q.text('None')
9962 q.text(","); q.breakable()
9963 q.text("data = ");
9964 q.pp(self.data)
9965 q.breakable()
9966 q.text('}')
9967
9968message.subtypes[3] = echo_reply
9969
9970class echo_request(message):
9971 version = 5
9972 type = 2
9973
9974 def __init__(self, xid=None, data=None):
9975 if xid != None:
9976 self.xid = xid
9977 else:
9978 self.xid = None
9979 if data != None:
9980 self.data = data
9981 else:
9982 self.data = ''
9983 return
9984
9985 def pack(self):
9986 packed = []
9987 packed.append(struct.pack("!B", self.version))
9988 packed.append(struct.pack("!B", self.type))
9989 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9990 packed.append(struct.pack("!L", self.xid))
9991 packed.append(self.data)
9992 length = sum([len(x) for x in packed])
9993 packed[2] = struct.pack("!H", length)
9994 return ''.join(packed)
9995
9996 @staticmethod
9997 def unpack(reader):
9998 obj = echo_request()
9999 _version = reader.read("!B")[0]
10000 assert(_version == 5)
10001 _type = reader.read("!B")[0]
10002 assert(_type == 2)
10003 _length = reader.read("!H")[0]
10004 orig_reader = reader
10005 reader = orig_reader.slice(_length, 4)
10006 obj.xid = reader.read("!L")[0]
10007 obj.data = str(reader.read_all())
10008 return obj
10009
10010 def __eq__(self, other):
10011 if type(self) != type(other): return False
10012 if self.xid != other.xid: return False
10013 if self.data != other.data: return False
10014 return True
10015
10016 def pretty_print(self, q):
10017 q.text("echo_request {")
10018 with q.group():
10019 with q.indent(2):
10020 q.breakable()
10021 q.text("xid = ");
10022 if self.xid != None:
10023 q.text("%#x" % self.xid)
10024 else:
10025 q.text('None')
10026 q.text(","); q.breakable()
10027 q.text("data = ");
10028 q.pp(self.data)
10029 q.breakable()
10030 q.text('}')
10031
10032message.subtypes[2] = echo_request
10033
10034class features_reply(message):
10035 version = 5
10036 type = 6
10037
10038 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
10039 if xid != None:
10040 self.xid = xid
10041 else:
10042 self.xid = None
10043 if datapath_id != None:
10044 self.datapath_id = datapath_id
10045 else:
10046 self.datapath_id = 0
10047 if n_buffers != None:
10048 self.n_buffers = n_buffers
10049 else:
10050 self.n_buffers = 0
10051 if n_tables != None:
10052 self.n_tables = n_tables
10053 else:
10054 self.n_tables = 0
10055 if auxiliary_id != None:
10056 self.auxiliary_id = auxiliary_id
10057 else:
10058 self.auxiliary_id = 0
10059 if capabilities != None:
10060 self.capabilities = capabilities
10061 else:
10062 self.capabilities = 0
10063 if reserved != None:
10064 self.reserved = reserved
10065 else:
10066 self.reserved = 0
10067 return
10068
10069 def pack(self):
10070 packed = []
10071 packed.append(struct.pack("!B", self.version))
10072 packed.append(struct.pack("!B", self.type))
10073 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10074 packed.append(struct.pack("!L", self.xid))
10075 packed.append(struct.pack("!Q", self.datapath_id))
10076 packed.append(struct.pack("!L", self.n_buffers))
10077 packed.append(struct.pack("!B", self.n_tables))
10078 packed.append(struct.pack("!B", self.auxiliary_id))
10079 packed.append('\x00' * 2)
10080 packed.append(struct.pack("!L", self.capabilities))
10081 packed.append(struct.pack("!L", self.reserved))
10082 length = sum([len(x) for x in packed])
10083 packed[2] = struct.pack("!H", length)
10084 return ''.join(packed)
10085
10086 @staticmethod
10087 def unpack(reader):
10088 obj = features_reply()
10089 _version = reader.read("!B")[0]
10090 assert(_version == 5)
10091 _type = reader.read("!B")[0]
10092 assert(_type == 6)
10093 _length = reader.read("!H")[0]
10094 orig_reader = reader
10095 reader = orig_reader.slice(_length, 4)
10096 obj.xid = reader.read("!L")[0]
10097 obj.datapath_id = reader.read("!Q")[0]
10098 obj.n_buffers = reader.read("!L")[0]
10099 obj.n_tables = reader.read("!B")[0]
10100 obj.auxiliary_id = reader.read("!B")[0]
10101 reader.skip(2)
10102 obj.capabilities = reader.read("!L")[0]
10103 obj.reserved = reader.read("!L")[0]
10104 return obj
10105
10106 def __eq__(self, other):
10107 if type(self) != type(other): return False
10108 if self.xid != other.xid: return False
10109 if self.datapath_id != other.datapath_id: return False
10110 if self.n_buffers != other.n_buffers: return False
10111 if self.n_tables != other.n_tables: return False
10112 if self.auxiliary_id != other.auxiliary_id: return False
10113 if self.capabilities != other.capabilities: return False
10114 if self.reserved != other.reserved: return False
10115 return True
10116
10117 def pretty_print(self, q):
10118 q.text("features_reply {")
10119 with q.group():
10120 with q.indent(2):
10121 q.breakable()
10122 q.text("xid = ");
10123 if self.xid != None:
10124 q.text("%#x" % self.xid)
10125 else:
10126 q.text('None')
10127 q.text(","); q.breakable()
10128 q.text("datapath_id = ");
10129 q.text("%#x" % self.datapath_id)
10130 q.text(","); q.breakable()
10131 q.text("n_buffers = ");
10132 q.text("%#x" % self.n_buffers)
10133 q.text(","); q.breakable()
10134 q.text("n_tables = ");
10135 q.text("%#x" % self.n_tables)
10136 q.text(","); q.breakable()
10137 q.text("auxiliary_id = ");
10138 q.text("%#x" % self.auxiliary_id)
10139 q.text(","); q.breakable()
10140 q.text("capabilities = ");
10141 q.text("%#x" % self.capabilities)
10142 q.text(","); q.breakable()
10143 q.text("reserved = ");
10144 q.text("%#x" % self.reserved)
10145 q.breakable()
10146 q.text('}')
10147
10148message.subtypes[6] = features_reply
10149
10150class features_request(message):
10151 version = 5
10152 type = 5
10153
10154 def __init__(self, xid=None):
10155 if xid != None:
10156 self.xid = xid
10157 else:
10158 self.xid = None
10159 return
10160
10161 def pack(self):
10162 packed = []
10163 packed.append(struct.pack("!B", self.version))
10164 packed.append(struct.pack("!B", self.type))
10165 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10166 packed.append(struct.pack("!L", self.xid))
10167 length = sum([len(x) for x in packed])
10168 packed[2] = struct.pack("!H", length)
10169 return ''.join(packed)
10170
10171 @staticmethod
10172 def unpack(reader):
10173 obj = features_request()
10174 _version = reader.read("!B")[0]
10175 assert(_version == 5)
10176 _type = reader.read("!B")[0]
10177 assert(_type == 5)
10178 _length = reader.read("!H")[0]
10179 orig_reader = reader
10180 reader = orig_reader.slice(_length, 4)
10181 obj.xid = reader.read("!L")[0]
10182 return obj
10183
10184 def __eq__(self, other):
10185 if type(self) != type(other): return False
10186 if self.xid != other.xid: return False
10187 return True
10188
10189 def pretty_print(self, q):
10190 q.text("features_request {")
10191 with q.group():
10192 with q.indent(2):
10193 q.breakable()
10194 q.text("xid = ");
10195 if self.xid != None:
10196 q.text("%#x" % self.xid)
10197 else:
10198 q.text('None')
10199 q.breakable()
10200 q.text('}')
10201
10202message.subtypes[5] = features_request
10203
10204class flow_mod(message):
10205 subtypes = {}
10206
10207 version = 5
10208 type = 14
10209
10210 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):
10211 if xid != None:
10212 self.xid = xid
10213 else:
10214 self.xid = None
10215 if cookie != None:
10216 self.cookie = cookie
10217 else:
10218 self.cookie = 0
10219 if cookie_mask != None:
10220 self.cookie_mask = cookie_mask
10221 else:
10222 self.cookie_mask = 0
10223 if table_id != None:
10224 self.table_id = table_id
10225 else:
10226 self.table_id = 0
10227 if _command != None:
10228 self._command = _command
10229 else:
10230 self._command = 0
10231 if idle_timeout != None:
10232 self.idle_timeout = idle_timeout
10233 else:
10234 self.idle_timeout = 0
10235 if hard_timeout != None:
10236 self.hard_timeout = hard_timeout
10237 else:
10238 self.hard_timeout = 0
10239 if priority != None:
10240 self.priority = priority
10241 else:
10242 self.priority = 0
10243 if buffer_id != None:
10244 self.buffer_id = buffer_id
10245 else:
10246 self.buffer_id = 0
10247 if out_port != None:
10248 self.out_port = out_port
10249 else:
10250 self.out_port = 0
10251 if out_group != None:
10252 self.out_group = out_group
10253 else:
10254 self.out_group = 0
10255 if flags != None:
10256 self.flags = flags
10257 else:
10258 self.flags = 0
10259 if match != None:
10260 self.match = match
10261 else:
10262 self.match = ofp.match()
10263 if instructions != None:
10264 self.instructions = instructions
10265 else:
10266 self.instructions = []
10267 return
10268
10269 def pack(self):
10270 packed = []
10271 packed.append(struct.pack("!B", self.version))
10272 packed.append(struct.pack("!B", self.type))
10273 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10274 packed.append(struct.pack("!L", self.xid))
10275 packed.append(struct.pack("!Q", self.cookie))
10276 packed.append(struct.pack("!Q", self.cookie_mask))
10277 packed.append(struct.pack("!B", self.table_id))
10278 packed.append(util.pack_fm_cmd(self._command))
10279 packed.append(struct.pack("!H", self.idle_timeout))
10280 packed.append(struct.pack("!H", self.hard_timeout))
10281 packed.append(struct.pack("!H", self.priority))
10282 packed.append(struct.pack("!L", self.buffer_id))
10283 packed.append(util.pack_port_no(self.out_port))
10284 packed.append(struct.pack("!L", self.out_group))
10285 packed.append(struct.pack("!H", self.flags))
10286 packed.append('\x00' * 2)
10287 packed.append(self.match.pack())
10288 packed.append(loxi.generic_util.pack_list(self.instructions))
10289 length = sum([len(x) for x in packed])
10290 packed[2] = struct.pack("!H", length)
10291 return ''.join(packed)
10292
10293 @staticmethod
10294 def unpack(reader):
10295 subtype, = reader.peek('B', 25)
10296 subclass = flow_mod.subtypes.get(subtype)
10297 if subclass:
10298 return subclass.unpack(reader)
10299
10300 obj = flow_mod()
10301 _version = reader.read("!B")[0]
10302 assert(_version == 5)
10303 _type = reader.read("!B")[0]
10304 assert(_type == 14)
10305 _length = reader.read("!H")[0]
10306 orig_reader = reader
10307 reader = orig_reader.slice(_length, 4)
10308 obj.xid = reader.read("!L")[0]
10309 obj.cookie = reader.read("!Q")[0]
10310 obj.cookie_mask = reader.read("!Q")[0]
10311 obj.table_id = reader.read("!B")[0]
10312 obj._command = util.unpack_fm_cmd(reader)
10313 obj.idle_timeout = reader.read("!H")[0]
10314 obj.hard_timeout = reader.read("!H")[0]
10315 obj.priority = reader.read("!H")[0]
10316 obj.buffer_id = reader.read("!L")[0]
10317 obj.out_port = util.unpack_port_no(reader)
10318 obj.out_group = reader.read("!L")[0]
10319 obj.flags = reader.read("!H")[0]
10320 reader.skip(2)
10321 obj.match = ofp.match.unpack(reader)
10322 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10323 return obj
10324
10325 def __eq__(self, other):
10326 if type(self) != type(other): return False
10327 if self.xid != other.xid: return False
10328 if self.cookie != other.cookie: return False
10329 if self.cookie_mask != other.cookie_mask: return False
10330 if self.table_id != other.table_id: return False
10331 if self._command != other._command: return False
10332 if self.idle_timeout != other.idle_timeout: return False
10333 if self.hard_timeout != other.hard_timeout: return False
10334 if self.priority != other.priority: return False
10335 if self.buffer_id != other.buffer_id: return False
10336 if self.out_port != other.out_port: return False
10337 if self.out_group != other.out_group: return False
10338 if self.flags != other.flags: return False
10339 if self.match != other.match: return False
10340 if self.instructions != other.instructions: return False
10341 return True
10342
10343 def pretty_print(self, q):
10344 q.text("flow_mod {")
10345 with q.group():
10346 with q.indent(2):
10347 q.breakable()
10348 q.text("xid = ");
10349 if self.xid != None:
10350 q.text("%#x" % self.xid)
10351 else:
10352 q.text('None')
10353 q.text(","); q.breakable()
10354 q.text("cookie = ");
10355 q.text("%#x" % self.cookie)
10356 q.text(","); q.breakable()
10357 q.text("cookie_mask = ");
10358 q.text("%#x" % self.cookie_mask)
10359 q.text(","); q.breakable()
10360 q.text("table_id = ");
10361 q.text("%#x" % self.table_id)
10362 q.text(","); q.breakable()
10363 q.text("idle_timeout = ");
10364 q.text("%#x" % self.idle_timeout)
10365 q.text(","); q.breakable()
10366 q.text("hard_timeout = ");
10367 q.text("%#x" % self.hard_timeout)
10368 q.text(","); q.breakable()
10369 q.text("priority = ");
10370 q.text("%#x" % self.priority)
10371 q.text(","); q.breakable()
10372 q.text("buffer_id = ");
10373 q.text("%#x" % self.buffer_id)
10374 q.text(","); q.breakable()
10375 q.text("out_port = ");
10376 q.text(util.pretty_port(self.out_port))
10377 q.text(","); q.breakable()
10378 q.text("out_group = ");
10379 q.text("%#x" % self.out_group)
10380 q.text(","); q.breakable()
10381 q.text("flags = ");
10382 q.text("%#x" % self.flags)
10383 q.text(","); q.breakable()
10384 q.text("match = ");
10385 q.pp(self.match)
10386 q.text(","); q.breakable()
10387 q.text("instructions = ");
10388 q.pp(self.instructions)
10389 q.breakable()
10390 q.text('}')
10391
10392message.subtypes[14] = flow_mod
10393
10394class flow_add(flow_mod):
10395 version = 5
10396 type = 14
10397 _command = 0
10398
10399 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10400 if xid != None:
10401 self.xid = xid
10402 else:
10403 self.xid = None
10404 if cookie != None:
10405 self.cookie = cookie
10406 else:
10407 self.cookie = 0
10408 if cookie_mask != None:
10409 self.cookie_mask = cookie_mask
10410 else:
10411 self.cookie_mask = 0
10412 if table_id != None:
10413 self.table_id = table_id
10414 else:
10415 self.table_id = 0
10416 if idle_timeout != None:
10417 self.idle_timeout = idle_timeout
10418 else:
10419 self.idle_timeout = 0
10420 if hard_timeout != None:
10421 self.hard_timeout = hard_timeout
10422 else:
10423 self.hard_timeout = 0
10424 if priority != None:
10425 self.priority = priority
10426 else:
10427 self.priority = 0
10428 if buffer_id != None:
10429 self.buffer_id = buffer_id
10430 else:
10431 self.buffer_id = 0
10432 if out_port != None:
10433 self.out_port = out_port
10434 else:
10435 self.out_port = 0
10436 if out_group != None:
10437 self.out_group = out_group
10438 else:
10439 self.out_group = 0
10440 if flags != None:
10441 self.flags = flags
10442 else:
10443 self.flags = 0
10444 if importance != None:
10445 self.importance = importance
10446 else:
10447 self.importance = 0
10448 if match != None:
10449 self.match = match
10450 else:
10451 self.match = ofp.match()
10452 if instructions != None:
10453 self.instructions = instructions
10454 else:
10455 self.instructions = []
10456 return
10457
10458 def pack(self):
10459 packed = []
10460 packed.append(struct.pack("!B", self.version))
10461 packed.append(struct.pack("!B", self.type))
10462 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10463 packed.append(struct.pack("!L", self.xid))
10464 packed.append(struct.pack("!Q", self.cookie))
10465 packed.append(struct.pack("!Q", self.cookie_mask))
10466 packed.append(struct.pack("!B", self.table_id))
10467 packed.append(util.pack_fm_cmd(self._command))
10468 packed.append(struct.pack("!H", self.idle_timeout))
10469 packed.append(struct.pack("!H", self.hard_timeout))
10470 packed.append(struct.pack("!H", self.priority))
10471 packed.append(struct.pack("!L", self.buffer_id))
10472 packed.append(util.pack_port_no(self.out_port))
10473 packed.append(struct.pack("!L", self.out_group))
10474 packed.append(struct.pack("!H", self.flags))
10475 packed.append(struct.pack("!H", self.importance))
10476 packed.append(self.match.pack())
10477 packed.append(loxi.generic_util.pack_list(self.instructions))
10478 length = sum([len(x) for x in packed])
10479 packed[2] = struct.pack("!H", length)
10480 return ''.join(packed)
10481
10482 @staticmethod
10483 def unpack(reader):
10484 obj = flow_add()
10485 _version = reader.read("!B")[0]
10486 assert(_version == 5)
10487 _type = reader.read("!B")[0]
10488 assert(_type == 14)
10489 _length = reader.read("!H")[0]
10490 orig_reader = reader
10491 reader = orig_reader.slice(_length, 4)
10492 obj.xid = reader.read("!L")[0]
10493 obj.cookie = reader.read("!Q")[0]
10494 obj.cookie_mask = reader.read("!Q")[0]
10495 obj.table_id = reader.read("!B")[0]
10496 __command = util.unpack_fm_cmd(reader)
10497 assert(__command == 0)
10498 obj.idle_timeout = reader.read("!H")[0]
10499 obj.hard_timeout = reader.read("!H")[0]
10500 obj.priority = reader.read("!H")[0]
10501 obj.buffer_id = reader.read("!L")[0]
10502 obj.out_port = util.unpack_port_no(reader)
10503 obj.out_group = reader.read("!L")[0]
10504 obj.flags = reader.read("!H")[0]
10505 obj.importance = reader.read("!H")[0]
10506 obj.match = ofp.match.unpack(reader)
10507 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10508 return obj
10509
10510 def __eq__(self, other):
10511 if type(self) != type(other): return False
10512 if self.xid != other.xid: return False
10513 if self.cookie != other.cookie: return False
10514 if self.cookie_mask != other.cookie_mask: return False
10515 if self.table_id != other.table_id: return False
10516 if self.idle_timeout != other.idle_timeout: return False
10517 if self.hard_timeout != other.hard_timeout: return False
10518 if self.priority != other.priority: return False
10519 if self.buffer_id != other.buffer_id: return False
10520 if self.out_port != other.out_port: return False
10521 if self.out_group != other.out_group: return False
10522 if self.flags != other.flags: return False
10523 if self.importance != other.importance: return False
10524 if self.match != other.match: return False
10525 if self.instructions != other.instructions: return False
10526 return True
10527
10528 def pretty_print(self, q):
10529 q.text("flow_add {")
10530 with q.group():
10531 with q.indent(2):
10532 q.breakable()
10533 q.text("xid = ");
10534 if self.xid != None:
10535 q.text("%#x" % self.xid)
10536 else:
10537 q.text('None')
10538 q.text(","); q.breakable()
10539 q.text("cookie = ");
10540 q.text("%#x" % self.cookie)
10541 q.text(","); q.breakable()
10542 q.text("cookie_mask = ");
10543 q.text("%#x" % self.cookie_mask)
10544 q.text(","); q.breakable()
10545 q.text("table_id = ");
10546 q.text("%#x" % self.table_id)
10547 q.text(","); q.breakable()
10548 q.text("idle_timeout = ");
10549 q.text("%#x" % self.idle_timeout)
10550 q.text(","); q.breakable()
10551 q.text("hard_timeout = ");
10552 q.text("%#x" % self.hard_timeout)
10553 q.text(","); q.breakable()
10554 q.text("priority = ");
10555 q.text("%#x" % self.priority)
10556 q.text(","); q.breakable()
10557 q.text("buffer_id = ");
10558 q.text("%#x" % self.buffer_id)
10559 q.text(","); q.breakable()
10560 q.text("out_port = ");
10561 q.text(util.pretty_port(self.out_port))
10562 q.text(","); q.breakable()
10563 q.text("out_group = ");
10564 q.text("%#x" % self.out_group)
10565 q.text(","); q.breakable()
10566 q.text("flags = ");
10567 q.text("%#x" % self.flags)
10568 q.text(","); q.breakable()
10569 q.text("importance = ");
10570 q.text("%#x" % self.importance)
10571 q.text(","); q.breakable()
10572 q.text("match = ");
10573 q.pp(self.match)
10574 q.text(","); q.breakable()
10575 q.text("instructions = ");
10576 q.pp(self.instructions)
10577 q.breakable()
10578 q.text('}')
10579
10580flow_mod.subtypes[0] = flow_add
10581
10582class flow_delete(flow_mod):
10583 version = 5
10584 type = 14
10585 _command = 3
10586
10587 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10588 if xid != None:
10589 self.xid = xid
10590 else:
10591 self.xid = None
10592 if cookie != None:
10593 self.cookie = cookie
10594 else:
10595 self.cookie = 0
10596 if cookie_mask != None:
10597 self.cookie_mask = cookie_mask
10598 else:
10599 self.cookie_mask = 0
10600 if table_id != None:
10601 self.table_id = table_id
10602 else:
10603 self.table_id = 0
10604 if idle_timeout != None:
10605 self.idle_timeout = idle_timeout
10606 else:
10607 self.idle_timeout = 0
10608 if hard_timeout != None:
10609 self.hard_timeout = hard_timeout
10610 else:
10611 self.hard_timeout = 0
10612 if priority != None:
10613 self.priority = priority
10614 else:
10615 self.priority = 0
10616 if buffer_id != None:
10617 self.buffer_id = buffer_id
10618 else:
10619 self.buffer_id = 0
10620 if out_port != None:
10621 self.out_port = out_port
10622 else:
10623 self.out_port = 0
10624 if out_group != None:
10625 self.out_group = out_group
10626 else:
10627 self.out_group = 0
10628 if flags != None:
10629 self.flags = flags
10630 else:
10631 self.flags = 0
10632 if importance != None:
10633 self.importance = importance
10634 else:
10635 self.importance = 0
10636 if match != None:
10637 self.match = match
10638 else:
10639 self.match = ofp.match()
10640 if instructions != None:
10641 self.instructions = instructions
10642 else:
10643 self.instructions = []
10644 return
10645
10646 def pack(self):
10647 packed = []
10648 packed.append(struct.pack("!B", self.version))
10649 packed.append(struct.pack("!B", self.type))
10650 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10651 packed.append(struct.pack("!L", self.xid))
10652 packed.append(struct.pack("!Q", self.cookie))
10653 packed.append(struct.pack("!Q", self.cookie_mask))
10654 packed.append(struct.pack("!B", self.table_id))
10655 packed.append(util.pack_fm_cmd(self._command))
10656 packed.append(struct.pack("!H", self.idle_timeout))
10657 packed.append(struct.pack("!H", self.hard_timeout))
10658 packed.append(struct.pack("!H", self.priority))
10659 packed.append(struct.pack("!L", self.buffer_id))
10660 packed.append(util.pack_port_no(self.out_port))
10661 packed.append(struct.pack("!L", self.out_group))
10662 packed.append(struct.pack("!H", self.flags))
10663 packed.append(struct.pack("!H", self.importance))
10664 packed.append(self.match.pack())
10665 packed.append(loxi.generic_util.pack_list(self.instructions))
10666 length = sum([len(x) for x in packed])
10667 packed[2] = struct.pack("!H", length)
10668 return ''.join(packed)
10669
10670 @staticmethod
10671 def unpack(reader):
10672 obj = flow_delete()
10673 _version = reader.read("!B")[0]
10674 assert(_version == 5)
10675 _type = reader.read("!B")[0]
10676 assert(_type == 14)
10677 _length = reader.read("!H")[0]
10678 orig_reader = reader
10679 reader = orig_reader.slice(_length, 4)
10680 obj.xid = reader.read("!L")[0]
10681 obj.cookie = reader.read("!Q")[0]
10682 obj.cookie_mask = reader.read("!Q")[0]
10683 obj.table_id = reader.read("!B")[0]
10684 __command = util.unpack_fm_cmd(reader)
10685 assert(__command == 3)
10686 obj.idle_timeout = reader.read("!H")[0]
10687 obj.hard_timeout = reader.read("!H")[0]
10688 obj.priority = reader.read("!H")[0]
10689 obj.buffer_id = reader.read("!L")[0]
10690 obj.out_port = util.unpack_port_no(reader)
10691 obj.out_group = reader.read("!L")[0]
10692 obj.flags = reader.read("!H")[0]
10693 obj.importance = reader.read("!H")[0]
10694 obj.match = ofp.match.unpack(reader)
10695 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10696 return obj
10697
10698 def __eq__(self, other):
10699 if type(self) != type(other): return False
10700 if self.xid != other.xid: return False
10701 if self.cookie != other.cookie: return False
10702 if self.cookie_mask != other.cookie_mask: return False
10703 if self.table_id != other.table_id: return False
10704 if self.idle_timeout != other.idle_timeout: return False
10705 if self.hard_timeout != other.hard_timeout: return False
10706 if self.priority != other.priority: return False
10707 if self.buffer_id != other.buffer_id: return False
10708 if self.out_port != other.out_port: return False
10709 if self.out_group != other.out_group: return False
10710 if self.flags != other.flags: return False
10711 if self.importance != other.importance: return False
10712 if self.match != other.match: return False
10713 if self.instructions != other.instructions: return False
10714 return True
10715
10716 def pretty_print(self, q):
10717 q.text("flow_delete {")
10718 with q.group():
10719 with q.indent(2):
10720 q.breakable()
10721 q.text("xid = ");
10722 if self.xid != None:
10723 q.text("%#x" % self.xid)
10724 else:
10725 q.text('None')
10726 q.text(","); q.breakable()
10727 q.text("cookie = ");
10728 q.text("%#x" % self.cookie)
10729 q.text(","); q.breakable()
10730 q.text("cookie_mask = ");
10731 q.text("%#x" % self.cookie_mask)
10732 q.text(","); q.breakable()
10733 q.text("table_id = ");
10734 q.text("%#x" % self.table_id)
10735 q.text(","); q.breakable()
10736 q.text("idle_timeout = ");
10737 q.text("%#x" % self.idle_timeout)
10738 q.text(","); q.breakable()
10739 q.text("hard_timeout = ");
10740 q.text("%#x" % self.hard_timeout)
10741 q.text(","); q.breakable()
10742 q.text("priority = ");
10743 q.text("%#x" % self.priority)
10744 q.text(","); q.breakable()
10745 q.text("buffer_id = ");
10746 q.text("%#x" % self.buffer_id)
10747 q.text(","); q.breakable()
10748 q.text("out_port = ");
10749 q.text(util.pretty_port(self.out_port))
10750 q.text(","); q.breakable()
10751 q.text("out_group = ");
10752 q.text("%#x" % self.out_group)
10753 q.text(","); q.breakable()
10754 q.text("flags = ");
10755 q.text("%#x" % self.flags)
10756 q.text(","); q.breakable()
10757 q.text("importance = ");
10758 q.text("%#x" % self.importance)
10759 q.text(","); q.breakable()
10760 q.text("match = ");
10761 q.pp(self.match)
10762 q.text(","); q.breakable()
10763 q.text("instructions = ");
10764 q.pp(self.instructions)
10765 q.breakable()
10766 q.text('}')
10767
10768flow_mod.subtypes[3] = flow_delete
10769
10770class flow_delete_strict(flow_mod):
10771 version = 5
10772 type = 14
10773 _command = 4
10774
10775 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10776 if xid != None:
10777 self.xid = xid
10778 else:
10779 self.xid = None
10780 if cookie != None:
10781 self.cookie = cookie
10782 else:
10783 self.cookie = 0
10784 if cookie_mask != None:
10785 self.cookie_mask = cookie_mask
10786 else:
10787 self.cookie_mask = 0
10788 if table_id != None:
10789 self.table_id = table_id
10790 else:
10791 self.table_id = 0
10792 if idle_timeout != None:
10793 self.idle_timeout = idle_timeout
10794 else:
10795 self.idle_timeout = 0
10796 if hard_timeout != None:
10797 self.hard_timeout = hard_timeout
10798 else:
10799 self.hard_timeout = 0
10800 if priority != None:
10801 self.priority = priority
10802 else:
10803 self.priority = 0
10804 if buffer_id != None:
10805 self.buffer_id = buffer_id
10806 else:
10807 self.buffer_id = 0
10808 if out_port != None:
10809 self.out_port = out_port
10810 else:
10811 self.out_port = 0
10812 if out_group != None:
10813 self.out_group = out_group
10814 else:
10815 self.out_group = 0
10816 if flags != None:
10817 self.flags = flags
10818 else:
10819 self.flags = 0
10820 if importance != None:
10821 self.importance = importance
10822 else:
10823 self.importance = 0
10824 if match != None:
10825 self.match = match
10826 else:
10827 self.match = ofp.match()
10828 if instructions != None:
10829 self.instructions = instructions
10830 else:
10831 self.instructions = []
10832 return
10833
10834 def pack(self):
10835 packed = []
10836 packed.append(struct.pack("!B", self.version))
10837 packed.append(struct.pack("!B", self.type))
10838 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10839 packed.append(struct.pack("!L", self.xid))
10840 packed.append(struct.pack("!Q", self.cookie))
10841 packed.append(struct.pack("!Q", self.cookie_mask))
10842 packed.append(struct.pack("!B", self.table_id))
10843 packed.append(util.pack_fm_cmd(self._command))
10844 packed.append(struct.pack("!H", self.idle_timeout))
10845 packed.append(struct.pack("!H", self.hard_timeout))
10846 packed.append(struct.pack("!H", self.priority))
10847 packed.append(struct.pack("!L", self.buffer_id))
10848 packed.append(util.pack_port_no(self.out_port))
10849 packed.append(struct.pack("!L", self.out_group))
10850 packed.append(struct.pack("!H", self.flags))
10851 packed.append(struct.pack("!H", self.importance))
10852 packed.append(self.match.pack())
10853 packed.append(loxi.generic_util.pack_list(self.instructions))
10854 length = sum([len(x) for x in packed])
10855 packed[2] = struct.pack("!H", length)
10856 return ''.join(packed)
10857
10858 @staticmethod
10859 def unpack(reader):
10860 obj = flow_delete_strict()
10861 _version = reader.read("!B")[0]
10862 assert(_version == 5)
10863 _type = reader.read("!B")[0]
10864 assert(_type == 14)
10865 _length = reader.read("!H")[0]
10866 orig_reader = reader
10867 reader = orig_reader.slice(_length, 4)
10868 obj.xid = reader.read("!L")[0]
10869 obj.cookie = reader.read("!Q")[0]
10870 obj.cookie_mask = reader.read("!Q")[0]
10871 obj.table_id = reader.read("!B")[0]
10872 __command = util.unpack_fm_cmd(reader)
10873 assert(__command == 4)
10874 obj.idle_timeout = reader.read("!H")[0]
10875 obj.hard_timeout = reader.read("!H")[0]
10876 obj.priority = reader.read("!H")[0]
10877 obj.buffer_id = reader.read("!L")[0]
10878 obj.out_port = util.unpack_port_no(reader)
10879 obj.out_group = reader.read("!L")[0]
10880 obj.flags = reader.read("!H")[0]
10881 obj.importance = reader.read("!H")[0]
10882 obj.match = ofp.match.unpack(reader)
10883 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10884 return obj
10885
10886 def __eq__(self, other):
10887 if type(self) != type(other): return False
10888 if self.xid != other.xid: return False
10889 if self.cookie != other.cookie: return False
10890 if self.cookie_mask != other.cookie_mask: return False
10891 if self.table_id != other.table_id: return False
10892 if self.idle_timeout != other.idle_timeout: return False
10893 if self.hard_timeout != other.hard_timeout: return False
10894 if self.priority != other.priority: return False
10895 if self.buffer_id != other.buffer_id: return False
10896 if self.out_port != other.out_port: return False
10897 if self.out_group != other.out_group: return False
10898 if self.flags != other.flags: return False
10899 if self.importance != other.importance: return False
10900 if self.match != other.match: return False
10901 if self.instructions != other.instructions: return False
10902 return True
10903
10904 def pretty_print(self, q):
10905 q.text("flow_delete_strict {")
10906 with q.group():
10907 with q.indent(2):
10908 q.breakable()
10909 q.text("xid = ");
10910 if self.xid != None:
10911 q.text("%#x" % self.xid)
10912 else:
10913 q.text('None')
10914 q.text(","); q.breakable()
10915 q.text("cookie = ");
10916 q.text("%#x" % self.cookie)
10917 q.text(","); q.breakable()
10918 q.text("cookie_mask = ");
10919 q.text("%#x" % self.cookie_mask)
10920 q.text(","); q.breakable()
10921 q.text("table_id = ");
10922 q.text("%#x" % self.table_id)
10923 q.text(","); q.breakable()
10924 q.text("idle_timeout = ");
10925 q.text("%#x" % self.idle_timeout)
10926 q.text(","); q.breakable()
10927 q.text("hard_timeout = ");
10928 q.text("%#x" % self.hard_timeout)
10929 q.text(","); q.breakable()
10930 q.text("priority = ");
10931 q.text("%#x" % self.priority)
10932 q.text(","); q.breakable()
10933 q.text("buffer_id = ");
10934 q.text("%#x" % self.buffer_id)
10935 q.text(","); q.breakable()
10936 q.text("out_port = ");
10937 q.text(util.pretty_port(self.out_port))
10938 q.text(","); q.breakable()
10939 q.text("out_group = ");
10940 q.text("%#x" % self.out_group)
10941 q.text(","); q.breakable()
10942 q.text("flags = ");
10943 q.text("%#x" % self.flags)
10944 q.text(","); q.breakable()
10945 q.text("importance = ");
10946 q.text("%#x" % self.importance)
10947 q.text(","); q.breakable()
10948 q.text("match = ");
10949 q.pp(self.match)
10950 q.text(","); q.breakable()
10951 q.text("instructions = ");
10952 q.pp(self.instructions)
10953 q.breakable()
10954 q.text('}')
10955
10956flow_mod.subtypes[4] = flow_delete_strict
10957
10958class flow_mod_failed_error_msg(error_msg):
10959 version = 5
10960 type = 1
10961 err_type = 5
10962
10963 def __init__(self, xid=None, code=None, data=None):
10964 if xid != None:
10965 self.xid = xid
10966 else:
10967 self.xid = None
10968 if code != None:
10969 self.code = code
10970 else:
10971 self.code = 0
10972 if data != None:
10973 self.data = data
10974 else:
10975 self.data = ''
10976 return
10977
10978 def pack(self):
10979 packed = []
10980 packed.append(struct.pack("!B", self.version))
10981 packed.append(struct.pack("!B", self.type))
10982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10983 packed.append(struct.pack("!L", self.xid))
10984 packed.append(struct.pack("!H", self.err_type))
10985 packed.append(struct.pack("!H", self.code))
10986 packed.append(self.data)
10987 length = sum([len(x) for x in packed])
10988 packed[2] = struct.pack("!H", length)
10989 return ''.join(packed)
10990
10991 @staticmethod
10992 def unpack(reader):
10993 obj = flow_mod_failed_error_msg()
10994 _version = reader.read("!B")[0]
10995 assert(_version == 5)
10996 _type = reader.read("!B")[0]
10997 assert(_type == 1)
10998 _length = reader.read("!H")[0]
10999 orig_reader = reader
11000 reader = orig_reader.slice(_length, 4)
11001 obj.xid = reader.read("!L")[0]
11002 _err_type = reader.read("!H")[0]
11003 assert(_err_type == 5)
11004 obj.code = reader.read("!H")[0]
11005 obj.data = str(reader.read_all())
11006 return obj
11007
11008 def __eq__(self, other):
11009 if type(self) != type(other): return False
11010 if self.xid != other.xid: return False
11011 if self.code != other.code: return False
11012 if self.data != other.data: return False
11013 return True
11014
11015 def pretty_print(self, q):
11016 q.text("flow_mod_failed_error_msg {")
11017 with q.group():
11018 with q.indent(2):
11019 q.breakable()
11020 q.text("xid = ");
11021 if self.xid != None:
11022 q.text("%#x" % self.xid)
11023 else:
11024 q.text('None')
11025 q.text(","); q.breakable()
11026 q.text("code = ");
11027 q.text("%#x" % self.code)
11028 q.text(","); q.breakable()
11029 q.text("data = ");
11030 q.pp(self.data)
11031 q.breakable()
11032 q.text('}')
11033
11034error_msg.subtypes[5] = flow_mod_failed_error_msg
11035
11036class flow_modify(flow_mod):
11037 version = 5
11038 type = 14
11039 _command = 1
11040
11041 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
11042 if xid != None:
11043 self.xid = xid
11044 else:
11045 self.xid = None
11046 if cookie != None:
11047 self.cookie = cookie
11048 else:
11049 self.cookie = 0
11050 if cookie_mask != None:
11051 self.cookie_mask = cookie_mask
11052 else:
11053 self.cookie_mask = 0
11054 if table_id != None:
11055 self.table_id = table_id
11056 else:
11057 self.table_id = 0
11058 if idle_timeout != None:
11059 self.idle_timeout = idle_timeout
11060 else:
11061 self.idle_timeout = 0
11062 if hard_timeout != None:
11063 self.hard_timeout = hard_timeout
11064 else:
11065 self.hard_timeout = 0
11066 if priority != None:
11067 self.priority = priority
11068 else:
11069 self.priority = 0
11070 if buffer_id != None:
11071 self.buffer_id = buffer_id
11072 else:
11073 self.buffer_id = 0
11074 if out_port != None:
11075 self.out_port = out_port
11076 else:
11077 self.out_port = 0
11078 if out_group != None:
11079 self.out_group = out_group
11080 else:
11081 self.out_group = 0
11082 if flags != None:
11083 self.flags = flags
11084 else:
11085 self.flags = 0
11086 if importance != None:
11087 self.importance = importance
11088 else:
11089 self.importance = 0
11090 if match != None:
11091 self.match = match
11092 else:
11093 self.match = ofp.match()
11094 if instructions != None:
11095 self.instructions = instructions
11096 else:
11097 self.instructions = []
11098 return
11099
11100 def pack(self):
11101 packed = []
11102 packed.append(struct.pack("!B", self.version))
11103 packed.append(struct.pack("!B", self.type))
11104 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11105 packed.append(struct.pack("!L", self.xid))
11106 packed.append(struct.pack("!Q", self.cookie))
11107 packed.append(struct.pack("!Q", self.cookie_mask))
11108 packed.append(struct.pack("!B", self.table_id))
11109 packed.append(util.pack_fm_cmd(self._command))
11110 packed.append(struct.pack("!H", self.idle_timeout))
11111 packed.append(struct.pack("!H", self.hard_timeout))
11112 packed.append(struct.pack("!H", self.priority))
11113 packed.append(struct.pack("!L", self.buffer_id))
11114 packed.append(util.pack_port_no(self.out_port))
11115 packed.append(struct.pack("!L", self.out_group))
11116 packed.append(struct.pack("!H", self.flags))
11117 packed.append(struct.pack("!H", self.importance))
11118 packed.append(self.match.pack())
11119 packed.append(loxi.generic_util.pack_list(self.instructions))
11120 length = sum([len(x) for x in packed])
11121 packed[2] = struct.pack("!H", length)
11122 return ''.join(packed)
11123
11124 @staticmethod
11125 def unpack(reader):
11126 obj = flow_modify()
11127 _version = reader.read("!B")[0]
11128 assert(_version == 5)
11129 _type = reader.read("!B")[0]
11130 assert(_type == 14)
11131 _length = reader.read("!H")[0]
11132 orig_reader = reader
11133 reader = orig_reader.slice(_length, 4)
11134 obj.xid = reader.read("!L")[0]
11135 obj.cookie = reader.read("!Q")[0]
11136 obj.cookie_mask = reader.read("!Q")[0]
11137 obj.table_id = reader.read("!B")[0]
11138 __command = util.unpack_fm_cmd(reader)
11139 assert(__command == 1)
11140 obj.idle_timeout = reader.read("!H")[0]
11141 obj.hard_timeout = reader.read("!H")[0]
11142 obj.priority = reader.read("!H")[0]
11143 obj.buffer_id = reader.read("!L")[0]
11144 obj.out_port = util.unpack_port_no(reader)
11145 obj.out_group = reader.read("!L")[0]
11146 obj.flags = reader.read("!H")[0]
11147 obj.importance = reader.read("!H")[0]
11148 obj.match = ofp.match.unpack(reader)
11149 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
11150 return obj
11151
11152 def __eq__(self, other):
11153 if type(self) != type(other): return False
11154 if self.xid != other.xid: return False
11155 if self.cookie != other.cookie: return False
11156 if self.cookie_mask != other.cookie_mask: return False
11157 if self.table_id != other.table_id: return False
11158 if self.idle_timeout != other.idle_timeout: return False
11159 if self.hard_timeout != other.hard_timeout: return False
11160 if self.priority != other.priority: return False
11161 if self.buffer_id != other.buffer_id: return False
11162 if self.out_port != other.out_port: return False
11163 if self.out_group != other.out_group: return False
11164 if self.flags != other.flags: return False
11165 if self.importance != other.importance: return False
11166 if self.match != other.match: return False
11167 if self.instructions != other.instructions: return False
11168 return True
11169
11170 def pretty_print(self, q):
11171 q.text("flow_modify {")
11172 with q.group():
11173 with q.indent(2):
11174 q.breakable()
11175 q.text("xid = ");
11176 if self.xid != None:
11177 q.text("%#x" % self.xid)
11178 else:
11179 q.text('None')
11180 q.text(","); q.breakable()
11181 q.text("cookie = ");
11182 q.text("%#x" % self.cookie)
11183 q.text(","); q.breakable()
11184 q.text("cookie_mask = ");
11185 q.text("%#x" % self.cookie_mask)
11186 q.text(","); q.breakable()
11187 q.text("table_id = ");
11188 q.text("%#x" % self.table_id)
11189 q.text(","); q.breakable()
11190 q.text("idle_timeout = ");
11191 q.text("%#x" % self.idle_timeout)
11192 q.text(","); q.breakable()
11193 q.text("hard_timeout = ");
11194 q.text("%#x" % self.hard_timeout)
11195 q.text(","); q.breakable()
11196 q.text("priority = ");
11197 q.text("%#x" % self.priority)
11198 q.text(","); q.breakable()
11199 q.text("buffer_id = ");
11200 q.text("%#x" % self.buffer_id)
11201 q.text(","); q.breakable()
11202 q.text("out_port = ");
11203 q.text(util.pretty_port(self.out_port))
11204 q.text(","); q.breakable()
11205 q.text("out_group = ");
11206 q.text("%#x" % self.out_group)
11207 q.text(","); q.breakable()
11208 q.text("flags = ");
11209 q.text("%#x" % self.flags)
11210 q.text(","); q.breakable()
11211 q.text("importance = ");
11212 q.text("%#x" % self.importance)
11213 q.text(","); q.breakable()
11214 q.text("match = ");
11215 q.pp(self.match)
11216 q.text(","); q.breakable()
11217 q.text("instructions = ");
11218 q.pp(self.instructions)
11219 q.breakable()
11220 q.text('}')
11221
11222flow_mod.subtypes[1] = flow_modify
11223
11224class flow_modify_strict(flow_mod):
11225 version = 5
11226 type = 14
11227 _command = 2
11228
11229 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
11230 if xid != None:
11231 self.xid = xid
11232 else:
11233 self.xid = None
11234 if cookie != None:
11235 self.cookie = cookie
11236 else:
11237 self.cookie = 0
11238 if cookie_mask != None:
11239 self.cookie_mask = cookie_mask
11240 else:
11241 self.cookie_mask = 0
11242 if table_id != None:
11243 self.table_id = table_id
11244 else:
11245 self.table_id = 0
11246 if idle_timeout != None:
11247 self.idle_timeout = idle_timeout
11248 else:
11249 self.idle_timeout = 0
11250 if hard_timeout != None:
11251 self.hard_timeout = hard_timeout
11252 else:
11253 self.hard_timeout = 0
11254 if priority != None:
11255 self.priority = priority
11256 else:
11257 self.priority = 0
11258 if buffer_id != None:
11259 self.buffer_id = buffer_id
11260 else:
11261 self.buffer_id = 0
11262 if out_port != None:
11263 self.out_port = out_port
11264 else:
11265 self.out_port = 0
11266 if out_group != None:
11267 self.out_group = out_group
11268 else:
11269 self.out_group = 0
11270 if flags != None:
11271 self.flags = flags
11272 else:
11273 self.flags = 0
11274 if importance != None:
11275 self.importance = importance
11276 else:
11277 self.importance = 0
11278 if match != None:
11279 self.match = match
11280 else:
11281 self.match = ofp.match()
11282 if instructions != None:
11283 self.instructions = instructions
11284 else:
11285 self.instructions = []
11286 return
11287
11288 def pack(self):
11289 packed = []
11290 packed.append(struct.pack("!B", self.version))
11291 packed.append(struct.pack("!B", self.type))
11292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11293 packed.append(struct.pack("!L", self.xid))
11294 packed.append(struct.pack("!Q", self.cookie))
11295 packed.append(struct.pack("!Q", self.cookie_mask))
11296 packed.append(struct.pack("!B", self.table_id))
11297 packed.append(util.pack_fm_cmd(self._command))
11298 packed.append(struct.pack("!H", self.idle_timeout))
11299 packed.append(struct.pack("!H", self.hard_timeout))
11300 packed.append(struct.pack("!H", self.priority))
11301 packed.append(struct.pack("!L", self.buffer_id))
11302 packed.append(util.pack_port_no(self.out_port))
11303 packed.append(struct.pack("!L", self.out_group))
11304 packed.append(struct.pack("!H", self.flags))
11305 packed.append(struct.pack("!H", self.importance))
11306 packed.append(self.match.pack())
11307 packed.append(loxi.generic_util.pack_list(self.instructions))
11308 length = sum([len(x) for x in packed])
11309 packed[2] = struct.pack("!H", length)
11310 return ''.join(packed)
11311
11312 @staticmethod
11313 def unpack(reader):
11314 obj = flow_modify_strict()
11315 _version = reader.read("!B")[0]
11316 assert(_version == 5)
11317 _type = reader.read("!B")[0]
11318 assert(_type == 14)
11319 _length = reader.read("!H")[0]
11320 orig_reader = reader
11321 reader = orig_reader.slice(_length, 4)
11322 obj.xid = reader.read("!L")[0]
11323 obj.cookie = reader.read("!Q")[0]
11324 obj.cookie_mask = reader.read("!Q")[0]
11325 obj.table_id = reader.read("!B")[0]
11326 __command = util.unpack_fm_cmd(reader)
11327 assert(__command == 2)
11328 obj.idle_timeout = reader.read("!H")[0]
11329 obj.hard_timeout = reader.read("!H")[0]
11330 obj.priority = reader.read("!H")[0]
11331 obj.buffer_id = reader.read("!L")[0]
11332 obj.out_port = util.unpack_port_no(reader)
11333 obj.out_group = reader.read("!L")[0]
11334 obj.flags = reader.read("!H")[0]
11335 obj.importance = reader.read("!H")[0]
11336 obj.match = ofp.match.unpack(reader)
11337 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
11338 return obj
11339
11340 def __eq__(self, other):
11341 if type(self) != type(other): return False
11342 if self.xid != other.xid: return False
11343 if self.cookie != other.cookie: return False
11344 if self.cookie_mask != other.cookie_mask: return False
11345 if self.table_id != other.table_id: return False
11346 if self.idle_timeout != other.idle_timeout: return False
11347 if self.hard_timeout != other.hard_timeout: return False
11348 if self.priority != other.priority: return False
11349 if self.buffer_id != other.buffer_id: return False
11350 if self.out_port != other.out_port: return False
11351 if self.out_group != other.out_group: return False
11352 if self.flags != other.flags: return False
11353 if self.importance != other.importance: return False
11354 if self.match != other.match: return False
11355 if self.instructions != other.instructions: return False
11356 return True
11357
11358 def pretty_print(self, q):
11359 q.text("flow_modify_strict {")
11360 with q.group():
11361 with q.indent(2):
11362 q.breakable()
11363 q.text("xid = ");
11364 if self.xid != None:
11365 q.text("%#x" % self.xid)
11366 else:
11367 q.text('None')
11368 q.text(","); q.breakable()
11369 q.text("cookie = ");
11370 q.text("%#x" % self.cookie)
11371 q.text(","); q.breakable()
11372 q.text("cookie_mask = ");
11373 q.text("%#x" % self.cookie_mask)
11374 q.text(","); q.breakable()
11375 q.text("table_id = ");
11376 q.text("%#x" % self.table_id)
11377 q.text(","); q.breakable()
11378 q.text("idle_timeout = ");
11379 q.text("%#x" % self.idle_timeout)
11380 q.text(","); q.breakable()
11381 q.text("hard_timeout = ");
11382 q.text("%#x" % self.hard_timeout)
11383 q.text(","); q.breakable()
11384 q.text("priority = ");
11385 q.text("%#x" % self.priority)
11386 q.text(","); q.breakable()
11387 q.text("buffer_id = ");
11388 q.text("%#x" % self.buffer_id)
11389 q.text(","); q.breakable()
11390 q.text("out_port = ");
11391 q.text(util.pretty_port(self.out_port))
11392 q.text(","); q.breakable()
11393 q.text("out_group = ");
11394 q.text("%#x" % self.out_group)
11395 q.text(","); q.breakable()
11396 q.text("flags = ");
11397 q.text("%#x" % self.flags)
11398 q.text(","); q.breakable()
11399 q.text("importance = ");
11400 q.text("%#x" % self.importance)
11401 q.text(","); q.breakable()
11402 q.text("match = ");
11403 q.pp(self.match)
11404 q.text(","); q.breakable()
11405 q.text("instructions = ");
11406 q.pp(self.instructions)
11407 q.breakable()
11408 q.text('}')
11409
11410flow_mod.subtypes[2] = flow_modify_strict
11411
11412class flow_monitor_failed_error_msg(error_msg):
11413 version = 5
11414 type = 1
11415 err_type = 16
11416
11417 def __init__(self, xid=None, code=None, data=None):
11418 if xid != None:
11419 self.xid = xid
11420 else:
11421 self.xid = None
11422 if code != None:
11423 self.code = code
11424 else:
11425 self.code = 0
11426 if data != None:
11427 self.data = data
11428 else:
11429 self.data = ''
11430 return
11431
11432 def pack(self):
11433 packed = []
11434 packed.append(struct.pack("!B", self.version))
11435 packed.append(struct.pack("!B", self.type))
11436 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11437 packed.append(struct.pack("!L", self.xid))
11438 packed.append(struct.pack("!H", self.err_type))
11439 packed.append(struct.pack("!H", self.code))
11440 packed.append(self.data)
11441 length = sum([len(x) for x in packed])
11442 packed[2] = struct.pack("!H", length)
11443 return ''.join(packed)
11444
11445 @staticmethod
11446 def unpack(reader):
11447 obj = flow_monitor_failed_error_msg()
11448 _version = reader.read("!B")[0]
11449 assert(_version == 5)
11450 _type = reader.read("!B")[0]
11451 assert(_type == 1)
11452 _length = reader.read("!H")[0]
11453 orig_reader = reader
11454 reader = orig_reader.slice(_length, 4)
11455 obj.xid = reader.read("!L")[0]
11456 _err_type = reader.read("!H")[0]
11457 assert(_err_type == 16)
11458 obj.code = reader.read("!H")[0]
11459 obj.data = str(reader.read_all())
11460 return obj
11461
11462 def __eq__(self, other):
11463 if type(self) != type(other): return False
11464 if self.xid != other.xid: return False
11465 if self.code != other.code: return False
11466 if self.data != other.data: return False
11467 return True
11468
11469 def pretty_print(self, q):
11470 q.text("flow_monitor_failed_error_msg {")
11471 with q.group():
11472 with q.indent(2):
11473 q.breakable()
11474 q.text("xid = ");
11475 if self.xid != None:
11476 q.text("%#x" % self.xid)
11477 else:
11478 q.text('None')
11479 q.text(","); q.breakable()
11480 q.text("code = ");
11481 q.text("%#x" % self.code)
11482 q.text(","); q.breakable()
11483 q.text("data = ");
11484 q.pp(self.data)
11485 q.breakable()
11486 q.text('}')
11487
11488error_msg.subtypes[16] = flow_monitor_failed_error_msg
11489
11490class flow_removed(message):
11491 version = 5
11492 type = 11
11493
11494 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):
11495 if xid != None:
11496 self.xid = xid
11497 else:
11498 self.xid = None
11499 if cookie != None:
11500 self.cookie = cookie
11501 else:
11502 self.cookie = 0
11503 if priority != None:
11504 self.priority = priority
11505 else:
11506 self.priority = 0
11507 if reason != None:
11508 self.reason = reason
11509 else:
11510 self.reason = 0
11511 if table_id != None:
11512 self.table_id = table_id
11513 else:
11514 self.table_id = 0
11515 if duration_sec != None:
11516 self.duration_sec = duration_sec
11517 else:
11518 self.duration_sec = 0
11519 if duration_nsec != None:
11520 self.duration_nsec = duration_nsec
11521 else:
11522 self.duration_nsec = 0
11523 if idle_timeout != None:
11524 self.idle_timeout = idle_timeout
11525 else:
11526 self.idle_timeout = 0
11527 if hard_timeout != None:
11528 self.hard_timeout = hard_timeout
11529 else:
11530 self.hard_timeout = 0
11531 if packet_count != None:
11532 self.packet_count = packet_count
11533 else:
11534 self.packet_count = 0
11535 if byte_count != None:
11536 self.byte_count = byte_count
11537 else:
11538 self.byte_count = 0
11539 if match != None:
11540 self.match = match
11541 else:
11542 self.match = ofp.match()
11543 return
11544
11545 def pack(self):
11546 packed = []
11547 packed.append(struct.pack("!B", self.version))
11548 packed.append(struct.pack("!B", self.type))
11549 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11550 packed.append(struct.pack("!L", self.xid))
11551 packed.append(struct.pack("!Q", self.cookie))
11552 packed.append(struct.pack("!H", self.priority))
11553 packed.append(struct.pack("!B", self.reason))
11554 packed.append(struct.pack("!B", self.table_id))
11555 packed.append(struct.pack("!L", self.duration_sec))
11556 packed.append(struct.pack("!L", self.duration_nsec))
11557 packed.append(struct.pack("!H", self.idle_timeout))
11558 packed.append(struct.pack("!H", self.hard_timeout))
11559 packed.append(struct.pack("!Q", self.packet_count))
11560 packed.append(struct.pack("!Q", self.byte_count))
11561 packed.append(self.match.pack())
11562 length = sum([len(x) for x in packed])
11563 packed[2] = struct.pack("!H", length)
11564 return ''.join(packed)
11565
11566 @staticmethod
11567 def unpack(reader):
11568 obj = flow_removed()
11569 _version = reader.read("!B")[0]
11570 assert(_version == 5)
11571 _type = reader.read("!B")[0]
11572 assert(_type == 11)
11573 _length = reader.read("!H")[0]
11574 orig_reader = reader
11575 reader = orig_reader.slice(_length, 4)
11576 obj.xid = reader.read("!L")[0]
11577 obj.cookie = reader.read("!Q")[0]
11578 obj.priority = reader.read("!H")[0]
11579 obj.reason = reader.read("!B")[0]
11580 obj.table_id = reader.read("!B")[0]
11581 obj.duration_sec = reader.read("!L")[0]
11582 obj.duration_nsec = reader.read("!L")[0]
11583 obj.idle_timeout = reader.read("!H")[0]
11584 obj.hard_timeout = reader.read("!H")[0]
11585 obj.packet_count = reader.read("!Q")[0]
11586 obj.byte_count = reader.read("!Q")[0]
11587 obj.match = ofp.match.unpack(reader)
11588 return obj
11589
11590 def __eq__(self, other):
11591 if type(self) != type(other): return False
11592 if self.xid != other.xid: return False
11593 if self.cookie != other.cookie: return False
11594 if self.priority != other.priority: return False
11595 if self.reason != other.reason: return False
11596 if self.table_id != other.table_id: return False
11597 if self.duration_sec != other.duration_sec: return False
11598 if self.duration_nsec != other.duration_nsec: return False
11599 if self.idle_timeout != other.idle_timeout: return False
11600 if self.hard_timeout != other.hard_timeout: return False
11601 if self.packet_count != other.packet_count: return False
11602 if self.byte_count != other.byte_count: return False
11603 if self.match != other.match: return False
11604 return True
11605
11606 def pretty_print(self, q):
11607 q.text("flow_removed {")
11608 with q.group():
11609 with q.indent(2):
11610 q.breakable()
11611 q.text("xid = ");
11612 if self.xid != None:
11613 q.text("%#x" % self.xid)
11614 else:
11615 q.text('None')
11616 q.text(","); q.breakable()
11617 q.text("cookie = ");
11618 q.text("%#x" % self.cookie)
11619 q.text(","); q.breakable()
11620 q.text("priority = ");
11621 q.text("%#x" % self.priority)
11622 q.text(","); q.breakable()
11623 q.text("reason = ");
11624 q.text("%#x" % self.reason)
11625 q.text(","); q.breakable()
11626 q.text("table_id = ");
11627 q.text("%#x" % self.table_id)
11628 q.text(","); q.breakable()
11629 q.text("duration_sec = ");
11630 q.text("%#x" % self.duration_sec)
11631 q.text(","); q.breakable()
11632 q.text("duration_nsec = ");
11633 q.text("%#x" % self.duration_nsec)
11634 q.text(","); q.breakable()
11635 q.text("idle_timeout = ");
11636 q.text("%#x" % self.idle_timeout)
11637 q.text(","); q.breakable()
11638 q.text("hard_timeout = ");
11639 q.text("%#x" % self.hard_timeout)
11640 q.text(","); q.breakable()
11641 q.text("packet_count = ");
11642 q.text("%#x" % self.packet_count)
11643 q.text(","); q.breakable()
11644 q.text("byte_count = ");
11645 q.text("%#x" % self.byte_count)
11646 q.text(","); q.breakable()
11647 q.text("match = ");
11648 q.pp(self.match)
11649 q.breakable()
11650 q.text('}')
11651
11652message.subtypes[11] = flow_removed
11653
11654class flow_stats_reply(stats_reply):
11655 version = 5
11656 type = 19
11657 stats_type = 1
11658
11659 def __init__(self, xid=None, flags=None, entries=None):
11660 if xid != None:
11661 self.xid = xid
11662 else:
11663 self.xid = None
11664 if flags != None:
11665 self.flags = flags
11666 else:
11667 self.flags = 0
11668 if entries != None:
11669 self.entries = entries
11670 else:
11671 self.entries = []
11672 return
11673
11674 def pack(self):
11675 packed = []
11676 packed.append(struct.pack("!B", self.version))
11677 packed.append(struct.pack("!B", self.type))
11678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11679 packed.append(struct.pack("!L", self.xid))
11680 packed.append(struct.pack("!H", self.stats_type))
11681 packed.append(struct.pack("!H", self.flags))
11682 packed.append('\x00' * 4)
11683 packed.append(loxi.generic_util.pack_list(self.entries))
11684 length = sum([len(x) for x in packed])
11685 packed[2] = struct.pack("!H", length)
11686 return ''.join(packed)
11687
11688 @staticmethod
11689 def unpack(reader):
11690 obj = flow_stats_reply()
11691 _version = reader.read("!B")[0]
11692 assert(_version == 5)
11693 _type = reader.read("!B")[0]
11694 assert(_type == 19)
11695 _length = reader.read("!H")[0]
11696 orig_reader = reader
11697 reader = orig_reader.slice(_length, 4)
11698 obj.xid = reader.read("!L")[0]
11699 _stats_type = reader.read("!H")[0]
11700 assert(_stats_type == 1)
11701 obj.flags = reader.read("!H")[0]
11702 reader.skip(4)
11703 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
11704 return obj
11705
11706 def __eq__(self, other):
11707 if type(self) != type(other): return False
11708 if self.xid != other.xid: return False
11709 if self.flags != other.flags: return False
11710 if self.entries != other.entries: return False
11711 return True
11712
11713 def pretty_print(self, q):
11714 q.text("flow_stats_reply {")
11715 with q.group():
11716 with q.indent(2):
11717 q.breakable()
11718 q.text("xid = ");
11719 if self.xid != None:
11720 q.text("%#x" % self.xid)
11721 else:
11722 q.text('None')
11723 q.text(","); q.breakable()
11724 q.text("flags = ");
11725 q.text("%#x" % self.flags)
11726 q.text(","); q.breakable()
11727 q.text("entries = ");
11728 q.pp(self.entries)
11729 q.breakable()
11730 q.text('}')
11731
11732stats_reply.subtypes[1] = flow_stats_reply
11733
11734class flow_stats_request(stats_request):
11735 version = 5
11736 type = 18
11737 stats_type = 1
11738
11739 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
11740 if xid != None:
11741 self.xid = xid
11742 else:
11743 self.xid = None
11744 if flags != None:
11745 self.flags = flags
11746 else:
11747 self.flags = 0
11748 if table_id != None:
11749 self.table_id = table_id
11750 else:
11751 self.table_id = 0
11752 if out_port != None:
11753 self.out_port = out_port
11754 else:
11755 self.out_port = 0
11756 if out_group != None:
11757 self.out_group = out_group
11758 else:
11759 self.out_group = 0
11760 if cookie != None:
11761 self.cookie = cookie
11762 else:
11763 self.cookie = 0
11764 if cookie_mask != None:
11765 self.cookie_mask = cookie_mask
11766 else:
11767 self.cookie_mask = 0
11768 if match != None:
11769 self.match = match
11770 else:
11771 self.match = ofp.match()
11772 return
11773
11774 def pack(self):
11775 packed = []
11776 packed.append(struct.pack("!B", self.version))
11777 packed.append(struct.pack("!B", self.type))
11778 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11779 packed.append(struct.pack("!L", self.xid))
11780 packed.append(struct.pack("!H", self.stats_type))
11781 packed.append(struct.pack("!H", self.flags))
11782 packed.append('\x00' * 4)
11783 packed.append(struct.pack("!B", self.table_id))
11784 packed.append('\x00' * 3)
11785 packed.append(util.pack_port_no(self.out_port))
11786 packed.append(struct.pack("!L", self.out_group))
11787 packed.append('\x00' * 4)
11788 packed.append(struct.pack("!Q", self.cookie))
11789 packed.append(struct.pack("!Q", self.cookie_mask))
11790 packed.append(self.match.pack())
11791 length = sum([len(x) for x in packed])
11792 packed[2] = struct.pack("!H", length)
11793 return ''.join(packed)
11794
11795 @staticmethod
11796 def unpack(reader):
11797 obj = flow_stats_request()
11798 _version = reader.read("!B")[0]
11799 assert(_version == 5)
11800 _type = reader.read("!B")[0]
11801 assert(_type == 18)
11802 _length = reader.read("!H")[0]
11803 orig_reader = reader
11804 reader = orig_reader.slice(_length, 4)
11805 obj.xid = reader.read("!L")[0]
11806 _stats_type = reader.read("!H")[0]
11807 assert(_stats_type == 1)
11808 obj.flags = reader.read("!H")[0]
11809 reader.skip(4)
11810 obj.table_id = reader.read("!B")[0]
11811 reader.skip(3)
11812 obj.out_port = util.unpack_port_no(reader)
11813 obj.out_group = reader.read("!L")[0]
11814 reader.skip(4)
11815 obj.cookie = reader.read("!Q")[0]
11816 obj.cookie_mask = reader.read("!Q")[0]
11817 obj.match = ofp.match.unpack(reader)
11818 return obj
11819
11820 def __eq__(self, other):
11821 if type(self) != type(other): return False
11822 if self.xid != other.xid: return False
11823 if self.flags != other.flags: return False
11824 if self.table_id != other.table_id: return False
11825 if self.out_port != other.out_port: return False
11826 if self.out_group != other.out_group: return False
11827 if self.cookie != other.cookie: return False
11828 if self.cookie_mask != other.cookie_mask: return False
11829 if self.match != other.match: return False
11830 return True
11831
11832 def pretty_print(self, q):
11833 q.text("flow_stats_request {")
11834 with q.group():
11835 with q.indent(2):
11836 q.breakable()
11837 q.text("xid = ");
11838 if self.xid != None:
11839 q.text("%#x" % self.xid)
11840 else:
11841 q.text('None')
11842 q.text(","); q.breakable()
11843 q.text("flags = ");
11844 q.text("%#x" % self.flags)
11845 q.text(","); q.breakable()
11846 q.text("table_id = ");
11847 q.text("%#x" % self.table_id)
11848 q.text(","); q.breakable()
11849 q.text("out_port = ");
11850 q.text(util.pretty_port(self.out_port))
11851 q.text(","); q.breakable()
11852 q.text("out_group = ");
11853 q.text("%#x" % self.out_group)
11854 q.text(","); q.breakable()
11855 q.text("cookie = ");
11856 q.text("%#x" % self.cookie)
11857 q.text(","); q.breakable()
11858 q.text("cookie_mask = ");
11859 q.text("%#x" % self.cookie_mask)
11860 q.text(","); q.breakable()
11861 q.text("match = ");
11862 q.pp(self.match)
11863 q.breakable()
11864 q.text('}')
11865
11866stats_request.subtypes[1] = flow_stats_request
11867
11868class get_config_reply(message):
11869 version = 5
11870 type = 8
11871
11872 def __init__(self, xid=None, flags=None, miss_send_len=None):
11873 if xid != None:
11874 self.xid = xid
11875 else:
11876 self.xid = None
11877 if flags != None:
11878 self.flags = flags
11879 else:
11880 self.flags = 0
11881 if miss_send_len != None:
11882 self.miss_send_len = miss_send_len
11883 else:
11884 self.miss_send_len = 0
11885 return
11886
11887 def pack(self):
11888 packed = []
11889 packed.append(struct.pack("!B", self.version))
11890 packed.append(struct.pack("!B", self.type))
11891 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11892 packed.append(struct.pack("!L", self.xid))
11893 packed.append(struct.pack("!H", self.flags))
11894 packed.append(struct.pack("!H", self.miss_send_len))
11895 length = sum([len(x) for x in packed])
11896 packed[2] = struct.pack("!H", length)
11897 return ''.join(packed)
11898
11899 @staticmethod
11900 def unpack(reader):
11901 obj = get_config_reply()
11902 _version = reader.read("!B")[0]
11903 assert(_version == 5)
11904 _type = reader.read("!B")[0]
11905 assert(_type == 8)
11906 _length = reader.read("!H")[0]
11907 orig_reader = reader
11908 reader = orig_reader.slice(_length, 4)
11909 obj.xid = reader.read("!L")[0]
11910 obj.flags = reader.read("!H")[0]
11911 obj.miss_send_len = reader.read("!H")[0]
11912 return obj
11913
11914 def __eq__(self, other):
11915 if type(self) != type(other): return False
11916 if self.xid != other.xid: return False
11917 if self.flags != other.flags: return False
11918 if self.miss_send_len != other.miss_send_len: return False
11919 return True
11920
11921 def pretty_print(self, q):
11922 q.text("get_config_reply {")
11923 with q.group():
11924 with q.indent(2):
11925 q.breakable()
11926 q.text("xid = ");
11927 if self.xid != None:
11928 q.text("%#x" % self.xid)
11929 else:
11930 q.text('None')
11931 q.text(","); q.breakable()
11932 q.text("flags = ");
11933 q.text("%#x" % self.flags)
11934 q.text(","); q.breakable()
11935 q.text("miss_send_len = ");
11936 q.text("%#x" % self.miss_send_len)
11937 q.breakable()
11938 q.text('}')
11939
11940message.subtypes[8] = get_config_reply
11941
11942class get_config_request(message):
11943 version = 5
11944 type = 7
11945
11946 def __init__(self, xid=None):
11947 if xid != None:
11948 self.xid = xid
11949 else:
11950 self.xid = None
11951 return
11952
11953 def pack(self):
11954 packed = []
11955 packed.append(struct.pack("!B", self.version))
11956 packed.append(struct.pack("!B", self.type))
11957 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11958 packed.append(struct.pack("!L", self.xid))
11959 length = sum([len(x) for x in packed])
11960 packed[2] = struct.pack("!H", length)
11961 return ''.join(packed)
11962
11963 @staticmethod
11964 def unpack(reader):
11965 obj = get_config_request()
11966 _version = reader.read("!B")[0]
11967 assert(_version == 5)
11968 _type = reader.read("!B")[0]
11969 assert(_type == 7)
11970 _length = reader.read("!H")[0]
11971 orig_reader = reader
11972 reader = orig_reader.slice(_length, 4)
11973 obj.xid = reader.read("!L")[0]
11974 return obj
11975
11976 def __eq__(self, other):
11977 if type(self) != type(other): return False
11978 if self.xid != other.xid: return False
11979 return True
11980
11981 def pretty_print(self, q):
11982 q.text("get_config_request {")
11983 with q.group():
11984 with q.indent(2):
11985 q.breakable()
11986 q.text("xid = ");
11987 if self.xid != None:
11988 q.text("%#x" % self.xid)
11989 else:
11990 q.text('None')
11991 q.breakable()
11992 q.text('}')
11993
11994message.subtypes[7] = get_config_request
11995
11996class group_mod(message):
11997 subtypes = {}
11998
11999 version = 5
12000 type = 15
12001
12002 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
12003 if xid != None:
12004 self.xid = xid
12005 else:
12006 self.xid = None
12007 if command != None:
12008 self.command = command
12009 else:
12010 self.command = 0
12011 if group_type != None:
12012 self.group_type = group_type
12013 else:
12014 self.group_type = 0
12015 if group_id != None:
12016 self.group_id = group_id
12017 else:
12018 self.group_id = 0
12019 if buckets != None:
12020 self.buckets = buckets
12021 else:
12022 self.buckets = []
12023 return
12024
12025 def pack(self):
12026 packed = []
12027 packed.append(struct.pack("!B", self.version))
12028 packed.append(struct.pack("!B", self.type))
12029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12030 packed.append(struct.pack("!L", self.xid))
12031 packed.append(struct.pack("!H", self.command))
12032 packed.append(struct.pack("!B", self.group_type))
12033 packed.append('\x00' * 1)
12034 packed.append(struct.pack("!L", self.group_id))
12035 packed.append(loxi.generic_util.pack_list(self.buckets))
12036 length = sum([len(x) for x in packed])
12037 packed[2] = struct.pack("!H", length)
12038 return ''.join(packed)
12039
12040 @staticmethod
12041 def unpack(reader):
12042 subtype, = reader.peek('!H', 8)
12043 subclass = group_mod.subtypes.get(subtype)
12044 if subclass:
12045 return subclass.unpack(reader)
12046
12047 obj = group_mod()
12048 _version = reader.read("!B")[0]
12049 assert(_version == 5)
12050 _type = reader.read("!B")[0]
12051 assert(_type == 15)
12052 _length = reader.read("!H")[0]
12053 orig_reader = reader
12054 reader = orig_reader.slice(_length, 4)
12055 obj.xid = reader.read("!L")[0]
12056 obj.command = reader.read("!H")[0]
12057 obj.group_type = reader.read("!B")[0]
12058 reader.skip(1)
12059 obj.group_id = reader.read("!L")[0]
12060 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12061 return obj
12062
12063 def __eq__(self, other):
12064 if type(self) != type(other): return False
12065 if self.xid != other.xid: return False
12066 if self.command != other.command: return False
12067 if self.group_type != other.group_type: return False
12068 if self.group_id != other.group_id: return False
12069 if self.buckets != other.buckets: return False
12070 return True
12071
12072 def pretty_print(self, q):
12073 q.text("group_mod {")
12074 with q.group():
12075 with q.indent(2):
12076 q.breakable()
12077 q.text("xid = ");
12078 if self.xid != None:
12079 q.text("%#x" % self.xid)
12080 else:
12081 q.text('None')
12082 q.text(","); q.breakable()
12083 q.text("group_type = ");
12084 q.text("%#x" % self.group_type)
12085 q.text(","); q.breakable()
12086 q.text("group_id = ");
12087 q.text("%#x" % self.group_id)
12088 q.text(","); q.breakable()
12089 q.text("buckets = ");
12090 q.pp(self.buckets)
12091 q.breakable()
12092 q.text('}')
12093
12094message.subtypes[15] = group_mod
12095
12096class group_add(group_mod):
12097 version = 5
12098 type = 15
12099 command = 0
12100
12101 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12102 if xid != None:
12103 self.xid = xid
12104 else:
12105 self.xid = None
12106 if group_type != None:
12107 self.group_type = group_type
12108 else:
12109 self.group_type = 0
12110 if group_id != None:
12111 self.group_id = group_id
12112 else:
12113 self.group_id = 0
12114 if buckets != None:
12115 self.buckets = buckets
12116 else:
12117 self.buckets = []
12118 return
12119
12120 def pack(self):
12121 packed = []
12122 packed.append(struct.pack("!B", self.version))
12123 packed.append(struct.pack("!B", self.type))
12124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12125 packed.append(struct.pack("!L", self.xid))
12126 packed.append(struct.pack("!H", self.command))
12127 packed.append(struct.pack("!B", self.group_type))
12128 packed.append('\x00' * 1)
12129 packed.append(struct.pack("!L", self.group_id))
12130 packed.append(loxi.generic_util.pack_list(self.buckets))
12131 length = sum([len(x) for x in packed])
12132 packed[2] = struct.pack("!H", length)
12133 return ''.join(packed)
12134
12135 @staticmethod
12136 def unpack(reader):
12137 obj = group_add()
12138 _version = reader.read("!B")[0]
12139 assert(_version == 5)
12140 _type = reader.read("!B")[0]
12141 assert(_type == 15)
12142 _length = reader.read("!H")[0]
12143 orig_reader = reader
12144 reader = orig_reader.slice(_length, 4)
12145 obj.xid = reader.read("!L")[0]
12146 _command = reader.read("!H")[0]
12147 assert(_command == 0)
12148 obj.group_type = reader.read("!B")[0]
12149 reader.skip(1)
12150 obj.group_id = reader.read("!L")[0]
12151 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12152 return obj
12153
12154 def __eq__(self, other):
12155 if type(self) != type(other): return False
12156 if self.xid != other.xid: return False
12157 if self.group_type != other.group_type: return False
12158 if self.group_id != other.group_id: return False
12159 if self.buckets != other.buckets: return False
12160 return True
12161
12162 def pretty_print(self, q):
12163 q.text("group_add {")
12164 with q.group():
12165 with q.indent(2):
12166 q.breakable()
12167 q.text("xid = ");
12168 if self.xid != None:
12169 q.text("%#x" % self.xid)
12170 else:
12171 q.text('None')
12172 q.text(","); q.breakable()
12173 q.text("group_type = ");
12174 q.text("%#x" % self.group_type)
12175 q.text(","); q.breakable()
12176 q.text("group_id = ");
12177 q.text("%#x" % self.group_id)
12178 q.text(","); q.breakable()
12179 q.text("buckets = ");
12180 q.pp(self.buckets)
12181 q.breakable()
12182 q.text('}')
12183
12184group_mod.subtypes[0] = group_add
12185
12186class group_delete(group_mod):
12187 version = 5
12188 type = 15
12189 command = 2
12190
12191 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12192 if xid != None:
12193 self.xid = xid
12194 else:
12195 self.xid = None
12196 if group_type != None:
12197 self.group_type = group_type
12198 else:
12199 self.group_type = 0
12200 if group_id != None:
12201 self.group_id = group_id
12202 else:
12203 self.group_id = 0
12204 if buckets != None:
12205 self.buckets = buckets
12206 else:
12207 self.buckets = []
12208 return
12209
12210 def pack(self):
12211 packed = []
12212 packed.append(struct.pack("!B", self.version))
12213 packed.append(struct.pack("!B", self.type))
12214 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12215 packed.append(struct.pack("!L", self.xid))
12216 packed.append(struct.pack("!H", self.command))
12217 packed.append(struct.pack("!B", self.group_type))
12218 packed.append('\x00' * 1)
12219 packed.append(struct.pack("!L", self.group_id))
12220 packed.append(loxi.generic_util.pack_list(self.buckets))
12221 length = sum([len(x) for x in packed])
12222 packed[2] = struct.pack("!H", length)
12223 return ''.join(packed)
12224
12225 @staticmethod
12226 def unpack(reader):
12227 obj = group_delete()
12228 _version = reader.read("!B")[0]
12229 assert(_version == 5)
12230 _type = reader.read("!B")[0]
12231 assert(_type == 15)
12232 _length = reader.read("!H")[0]
12233 orig_reader = reader
12234 reader = orig_reader.slice(_length, 4)
12235 obj.xid = reader.read("!L")[0]
12236 _command = reader.read("!H")[0]
12237 assert(_command == 2)
12238 obj.group_type = reader.read("!B")[0]
12239 reader.skip(1)
12240 obj.group_id = reader.read("!L")[0]
12241 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12242 return obj
12243
12244 def __eq__(self, other):
12245 if type(self) != type(other): return False
12246 if self.xid != other.xid: return False
12247 if self.group_type != other.group_type: return False
12248 if self.group_id != other.group_id: return False
12249 if self.buckets != other.buckets: return False
12250 return True
12251
12252 def pretty_print(self, q):
12253 q.text("group_delete {")
12254 with q.group():
12255 with q.indent(2):
12256 q.breakable()
12257 q.text("xid = ");
12258 if self.xid != None:
12259 q.text("%#x" % self.xid)
12260 else:
12261 q.text('None')
12262 q.text(","); q.breakable()
12263 q.text("group_type = ");
12264 q.text("%#x" % self.group_type)
12265 q.text(","); q.breakable()
12266 q.text("group_id = ");
12267 q.text("%#x" % self.group_id)
12268 q.text(","); q.breakable()
12269 q.text("buckets = ");
12270 q.pp(self.buckets)
12271 q.breakable()
12272 q.text('}')
12273
12274group_mod.subtypes[2] = group_delete
12275
12276class group_desc_stats_reply(stats_reply):
12277 version = 5
12278 type = 19
12279 stats_type = 7
12280
12281 def __init__(self, xid=None, flags=None, entries=None):
12282 if xid != None:
12283 self.xid = xid
12284 else:
12285 self.xid = None
12286 if flags != None:
12287 self.flags = flags
12288 else:
12289 self.flags = 0
12290 if entries != None:
12291 self.entries = entries
12292 else:
12293 self.entries = []
12294 return
12295
12296 def pack(self):
12297 packed = []
12298 packed.append(struct.pack("!B", self.version))
12299 packed.append(struct.pack("!B", self.type))
12300 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12301 packed.append(struct.pack("!L", self.xid))
12302 packed.append(struct.pack("!H", self.stats_type))
12303 packed.append(struct.pack("!H", self.flags))
12304 packed.append('\x00' * 4)
12305 packed.append(loxi.generic_util.pack_list(self.entries))
12306 length = sum([len(x) for x in packed])
12307 packed[2] = struct.pack("!H", length)
12308 return ''.join(packed)
12309
12310 @staticmethod
12311 def unpack(reader):
12312 obj = group_desc_stats_reply()
12313 _version = reader.read("!B")[0]
12314 assert(_version == 5)
12315 _type = reader.read("!B")[0]
12316 assert(_type == 19)
12317 _length = reader.read("!H")[0]
12318 orig_reader = reader
12319 reader = orig_reader.slice(_length, 4)
12320 obj.xid = reader.read("!L")[0]
12321 _stats_type = reader.read("!H")[0]
12322 assert(_stats_type == 7)
12323 obj.flags = reader.read("!H")[0]
12324 reader.skip(4)
12325 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
12326 return obj
12327
12328 def __eq__(self, other):
12329 if type(self) != type(other): return False
12330 if self.xid != other.xid: return False
12331 if self.flags != other.flags: return False
12332 if self.entries != other.entries: return False
12333 return True
12334
12335 def pretty_print(self, q):
12336 q.text("group_desc_stats_reply {")
12337 with q.group():
12338 with q.indent(2):
12339 q.breakable()
12340 q.text("xid = ");
12341 if self.xid != None:
12342 q.text("%#x" % self.xid)
12343 else:
12344 q.text('None')
12345 q.text(","); q.breakable()
12346 q.text("flags = ");
12347 q.text("%#x" % self.flags)
12348 q.text(","); q.breakable()
12349 q.text("entries = ");
12350 q.pp(self.entries)
12351 q.breakable()
12352 q.text('}')
12353
12354stats_reply.subtypes[7] = group_desc_stats_reply
12355
12356class group_desc_stats_request(stats_request):
12357 version = 5
12358 type = 18
12359 stats_type = 7
12360
12361 def __init__(self, xid=None, flags=None):
12362 if xid != None:
12363 self.xid = xid
12364 else:
12365 self.xid = None
12366 if flags != None:
12367 self.flags = flags
12368 else:
12369 self.flags = 0
12370 return
12371
12372 def pack(self):
12373 packed = []
12374 packed.append(struct.pack("!B", self.version))
12375 packed.append(struct.pack("!B", self.type))
12376 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12377 packed.append(struct.pack("!L", self.xid))
12378 packed.append(struct.pack("!H", self.stats_type))
12379 packed.append(struct.pack("!H", self.flags))
12380 packed.append('\x00' * 4)
12381 length = sum([len(x) for x in packed])
12382 packed[2] = struct.pack("!H", length)
12383 return ''.join(packed)
12384
12385 @staticmethod
12386 def unpack(reader):
12387 obj = group_desc_stats_request()
12388 _version = reader.read("!B")[0]
12389 assert(_version == 5)
12390 _type = reader.read("!B")[0]
12391 assert(_type == 18)
12392 _length = reader.read("!H")[0]
12393 orig_reader = reader
12394 reader = orig_reader.slice(_length, 4)
12395 obj.xid = reader.read("!L")[0]
12396 _stats_type = reader.read("!H")[0]
12397 assert(_stats_type == 7)
12398 obj.flags = reader.read("!H")[0]
12399 reader.skip(4)
12400 return obj
12401
12402 def __eq__(self, other):
12403 if type(self) != type(other): return False
12404 if self.xid != other.xid: return False
12405 if self.flags != other.flags: return False
12406 return True
12407
12408 def pretty_print(self, q):
12409 q.text("group_desc_stats_request {")
12410 with q.group():
12411 with q.indent(2):
12412 q.breakable()
12413 q.text("xid = ");
12414 if self.xid != None:
12415 q.text("%#x" % self.xid)
12416 else:
12417 q.text('None')
12418 q.text(","); q.breakable()
12419 q.text("flags = ");
12420 q.text("%#x" % self.flags)
12421 q.breakable()
12422 q.text('}')
12423
12424stats_request.subtypes[7] = group_desc_stats_request
12425
12426class group_features_stats_reply(stats_reply):
12427 version = 5
12428 type = 19
12429 stats_type = 8
12430
12431 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):
12432 if xid != None:
12433 self.xid = xid
12434 else:
12435 self.xid = None
12436 if flags != None:
12437 self.flags = flags
12438 else:
12439 self.flags = 0
12440 if types != None:
12441 self.types = types
12442 else:
12443 self.types = 0
12444 if capabilities != None:
12445 self.capabilities = capabilities
12446 else:
12447 self.capabilities = 0
12448 if max_groups_all != None:
12449 self.max_groups_all = max_groups_all
12450 else:
12451 self.max_groups_all = 0
12452 if max_groups_select != None:
12453 self.max_groups_select = max_groups_select
12454 else:
12455 self.max_groups_select = 0
12456 if max_groups_indirect != None:
12457 self.max_groups_indirect = max_groups_indirect
12458 else:
12459 self.max_groups_indirect = 0
12460 if max_groups_ff != None:
12461 self.max_groups_ff = max_groups_ff
12462 else:
12463 self.max_groups_ff = 0
12464 if actions_all != None:
12465 self.actions_all = actions_all
12466 else:
12467 self.actions_all = 0
12468 if actions_select != None:
12469 self.actions_select = actions_select
12470 else:
12471 self.actions_select = 0
12472 if actions_indirect != None:
12473 self.actions_indirect = actions_indirect
12474 else:
12475 self.actions_indirect = 0
12476 if actions_ff != None:
12477 self.actions_ff = actions_ff
12478 else:
12479 self.actions_ff = 0
12480 return
12481
12482 def pack(self):
12483 packed = []
12484 packed.append(struct.pack("!B", self.version))
12485 packed.append(struct.pack("!B", self.type))
12486 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12487 packed.append(struct.pack("!L", self.xid))
12488 packed.append(struct.pack("!H", self.stats_type))
12489 packed.append(struct.pack("!H", self.flags))
12490 packed.append('\x00' * 4)
12491 packed.append(struct.pack("!L", self.types))
12492 packed.append(struct.pack("!L", self.capabilities))
12493 packed.append(struct.pack("!L", self.max_groups_all))
12494 packed.append(struct.pack("!L", self.max_groups_select))
12495 packed.append(struct.pack("!L", self.max_groups_indirect))
12496 packed.append(struct.pack("!L", self.max_groups_ff))
12497 packed.append(struct.pack("!L", self.actions_all))
12498 packed.append(struct.pack("!L", self.actions_select))
12499 packed.append(struct.pack("!L", self.actions_indirect))
12500 packed.append(struct.pack("!L", self.actions_ff))
12501 length = sum([len(x) for x in packed])
12502 packed[2] = struct.pack("!H", length)
12503 return ''.join(packed)
12504
12505 @staticmethod
12506 def unpack(reader):
12507 obj = group_features_stats_reply()
12508 _version = reader.read("!B")[0]
12509 assert(_version == 5)
12510 _type = reader.read("!B")[0]
12511 assert(_type == 19)
12512 _length = reader.read("!H")[0]
12513 orig_reader = reader
12514 reader = orig_reader.slice(_length, 4)
12515 obj.xid = reader.read("!L")[0]
12516 _stats_type = reader.read("!H")[0]
12517 assert(_stats_type == 8)
12518 obj.flags = reader.read("!H")[0]
12519 reader.skip(4)
12520 obj.types = reader.read("!L")[0]
12521 obj.capabilities = reader.read("!L")[0]
12522 obj.max_groups_all = reader.read("!L")[0]
12523 obj.max_groups_select = reader.read("!L")[0]
12524 obj.max_groups_indirect = reader.read("!L")[0]
12525 obj.max_groups_ff = reader.read("!L")[0]
12526 obj.actions_all = reader.read("!L")[0]
12527 obj.actions_select = reader.read("!L")[0]
12528 obj.actions_indirect = reader.read("!L")[0]
12529 obj.actions_ff = reader.read("!L")[0]
12530 return obj
12531
12532 def __eq__(self, other):
12533 if type(self) != type(other): return False
12534 if self.xid != other.xid: return False
12535 if self.flags != other.flags: return False
12536 if self.types != other.types: return False
12537 if self.capabilities != other.capabilities: return False
12538 if self.max_groups_all != other.max_groups_all: return False
12539 if self.max_groups_select != other.max_groups_select: return False
12540 if self.max_groups_indirect != other.max_groups_indirect: return False
12541 if self.max_groups_ff != other.max_groups_ff: return False
12542 if self.actions_all != other.actions_all: return False
12543 if self.actions_select != other.actions_select: return False
12544 if self.actions_indirect != other.actions_indirect: return False
12545 if self.actions_ff != other.actions_ff: return False
12546 return True
12547
12548 def pretty_print(self, q):
12549 q.text("group_features_stats_reply {")
12550 with q.group():
12551 with q.indent(2):
12552 q.breakable()
12553 q.text("xid = ");
12554 if self.xid != None:
12555 q.text("%#x" % self.xid)
12556 else:
12557 q.text('None')
12558 q.text(","); q.breakable()
12559 q.text("flags = ");
12560 q.text("%#x" % self.flags)
12561 q.text(","); q.breakable()
12562 q.text("types = ");
12563 q.text("%#x" % self.types)
12564 q.text(","); q.breakable()
12565 q.text("capabilities = ");
12566 q.text("%#x" % self.capabilities)
12567 q.text(","); q.breakable()
12568 q.text("max_groups_all = ");
12569 q.text("%#x" % self.max_groups_all)
12570 q.text(","); q.breakable()
12571 q.text("max_groups_select = ");
12572 q.text("%#x" % self.max_groups_select)
12573 q.text(","); q.breakable()
12574 q.text("max_groups_indirect = ");
12575 q.text("%#x" % self.max_groups_indirect)
12576 q.text(","); q.breakable()
12577 q.text("max_groups_ff = ");
12578 q.text("%#x" % self.max_groups_ff)
12579 q.text(","); q.breakable()
12580 q.text("actions_all = ");
12581 q.text("%#x" % self.actions_all)
12582 q.text(","); q.breakable()
12583 q.text("actions_select = ");
12584 q.text("%#x" % self.actions_select)
12585 q.text(","); q.breakable()
12586 q.text("actions_indirect = ");
12587 q.text("%#x" % self.actions_indirect)
12588 q.text(","); q.breakable()
12589 q.text("actions_ff = ");
12590 q.text("%#x" % self.actions_ff)
12591 q.breakable()
12592 q.text('}')
12593
12594stats_reply.subtypes[8] = group_features_stats_reply
12595
12596class group_features_stats_request(stats_request):
12597 version = 5
12598 type = 18
12599 stats_type = 8
12600
12601 def __init__(self, xid=None, flags=None):
12602 if xid != None:
12603 self.xid = xid
12604 else:
12605 self.xid = None
12606 if flags != None:
12607 self.flags = flags
12608 else:
12609 self.flags = 0
12610 return
12611
12612 def pack(self):
12613 packed = []
12614 packed.append(struct.pack("!B", self.version))
12615 packed.append(struct.pack("!B", self.type))
12616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12617 packed.append(struct.pack("!L", self.xid))
12618 packed.append(struct.pack("!H", self.stats_type))
12619 packed.append(struct.pack("!H", self.flags))
12620 packed.append('\x00' * 4)
12621 length = sum([len(x) for x in packed])
12622 packed[2] = struct.pack("!H", length)
12623 return ''.join(packed)
12624
12625 @staticmethod
12626 def unpack(reader):
12627 obj = group_features_stats_request()
12628 _version = reader.read("!B")[0]
12629 assert(_version == 5)
12630 _type = reader.read("!B")[0]
12631 assert(_type == 18)
12632 _length = reader.read("!H")[0]
12633 orig_reader = reader
12634 reader = orig_reader.slice(_length, 4)
12635 obj.xid = reader.read("!L")[0]
12636 _stats_type = reader.read("!H")[0]
12637 assert(_stats_type == 8)
12638 obj.flags = reader.read("!H")[0]
12639 reader.skip(4)
12640 return obj
12641
12642 def __eq__(self, other):
12643 if type(self) != type(other): return False
12644 if self.xid != other.xid: return False
12645 if self.flags != other.flags: return False
12646 return True
12647
12648 def pretty_print(self, q):
12649 q.text("group_features_stats_request {")
12650 with q.group():
12651 with q.indent(2):
12652 q.breakable()
12653 q.text("xid = ");
12654 if self.xid != None:
12655 q.text("%#x" % self.xid)
12656 else:
12657 q.text('None')
12658 q.text(","); q.breakable()
12659 q.text("flags = ");
12660 q.text("%#x" % self.flags)
12661 q.breakable()
12662 q.text('}')
12663
12664stats_request.subtypes[8] = group_features_stats_request
12665
12666class group_mod_failed_error_msg(error_msg):
12667 version = 5
12668 type = 1
12669 err_type = 6
12670
12671 def __init__(self, xid=None, code=None, data=None):
12672 if xid != None:
12673 self.xid = xid
12674 else:
12675 self.xid = None
12676 if code != None:
12677 self.code = code
12678 else:
12679 self.code = 0
12680 if data != None:
12681 self.data = data
12682 else:
12683 self.data = ''
12684 return
12685
12686 def pack(self):
12687 packed = []
12688 packed.append(struct.pack("!B", self.version))
12689 packed.append(struct.pack("!B", self.type))
12690 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12691 packed.append(struct.pack("!L", self.xid))
12692 packed.append(struct.pack("!H", self.err_type))
12693 packed.append(struct.pack("!H", self.code))
12694 packed.append(self.data)
12695 length = sum([len(x) for x in packed])
12696 packed[2] = struct.pack("!H", length)
12697 return ''.join(packed)
12698
12699 @staticmethod
12700 def unpack(reader):
12701 obj = group_mod_failed_error_msg()
12702 _version = reader.read("!B")[0]
12703 assert(_version == 5)
12704 _type = reader.read("!B")[0]
12705 assert(_type == 1)
12706 _length = reader.read("!H")[0]
12707 orig_reader = reader
12708 reader = orig_reader.slice(_length, 4)
12709 obj.xid = reader.read("!L")[0]
12710 _err_type = reader.read("!H")[0]
12711 assert(_err_type == 6)
12712 obj.code = reader.read("!H")[0]
12713 obj.data = str(reader.read_all())
12714 return obj
12715
12716 def __eq__(self, other):
12717 if type(self) != type(other): return False
12718 if self.xid != other.xid: return False
12719 if self.code != other.code: return False
12720 if self.data != other.data: return False
12721 return True
12722
12723 def pretty_print(self, q):
12724 q.text("group_mod_failed_error_msg {")
12725 with q.group():
12726 with q.indent(2):
12727 q.breakable()
12728 q.text("xid = ");
12729 if self.xid != None:
12730 q.text("%#x" % self.xid)
12731 else:
12732 q.text('None')
12733 q.text(","); q.breakable()
12734 q.text("code = ");
12735 q.text("%#x" % self.code)
12736 q.text(","); q.breakable()
12737 q.text("data = ");
12738 q.pp(self.data)
12739 q.breakable()
12740 q.text('}')
12741
12742error_msg.subtypes[6] = group_mod_failed_error_msg
12743
12744class group_modify(group_mod):
12745 version = 5
12746 type = 15
12747 command = 1
12748
12749 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12750 if xid != None:
12751 self.xid = xid
12752 else:
12753 self.xid = None
12754 if group_type != None:
12755 self.group_type = group_type
12756 else:
12757 self.group_type = 0
12758 if group_id != None:
12759 self.group_id = group_id
12760 else:
12761 self.group_id = 0
12762 if buckets != None:
12763 self.buckets = buckets
12764 else:
12765 self.buckets = []
12766 return
12767
12768 def pack(self):
12769 packed = []
12770 packed.append(struct.pack("!B", self.version))
12771 packed.append(struct.pack("!B", self.type))
12772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12773 packed.append(struct.pack("!L", self.xid))
12774 packed.append(struct.pack("!H", self.command))
12775 packed.append(struct.pack("!B", self.group_type))
12776 packed.append('\x00' * 1)
12777 packed.append(struct.pack("!L", self.group_id))
12778 packed.append(loxi.generic_util.pack_list(self.buckets))
12779 length = sum([len(x) for x in packed])
12780 packed[2] = struct.pack("!H", length)
12781 return ''.join(packed)
12782
12783 @staticmethod
12784 def unpack(reader):
12785 obj = group_modify()
12786 _version = reader.read("!B")[0]
12787 assert(_version == 5)
12788 _type = reader.read("!B")[0]
12789 assert(_type == 15)
12790 _length = reader.read("!H")[0]
12791 orig_reader = reader
12792 reader = orig_reader.slice(_length, 4)
12793 obj.xid = reader.read("!L")[0]
12794 _command = reader.read("!H")[0]
12795 assert(_command == 1)
12796 obj.group_type = reader.read("!B")[0]
12797 reader.skip(1)
12798 obj.group_id = reader.read("!L")[0]
12799 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12800 return obj
12801
12802 def __eq__(self, other):
12803 if type(self) != type(other): return False
12804 if self.xid != other.xid: return False
12805 if self.group_type != other.group_type: return False
12806 if self.group_id != other.group_id: return False
12807 if self.buckets != other.buckets: return False
12808 return True
12809
12810 def pretty_print(self, q):
12811 q.text("group_modify {")
12812 with q.group():
12813 with q.indent(2):
12814 q.breakable()
12815 q.text("xid = ");
12816 if self.xid != None:
12817 q.text("%#x" % self.xid)
12818 else:
12819 q.text('None')
12820 q.text(","); q.breakable()
12821 q.text("group_type = ");
12822 q.text("%#x" % self.group_type)
12823 q.text(","); q.breakable()
12824 q.text("group_id = ");
12825 q.text("%#x" % self.group_id)
12826 q.text(","); q.breakable()
12827 q.text("buckets = ");
12828 q.pp(self.buckets)
12829 q.breakable()
12830 q.text('}')
12831
12832group_mod.subtypes[1] = group_modify
12833
12834class group_stats_reply(stats_reply):
12835 version = 5
12836 type = 19
12837 stats_type = 6
12838
12839 def __init__(self, xid=None, flags=None, entries=None):
12840 if xid != None:
12841 self.xid = xid
12842 else:
12843 self.xid = None
12844 if flags != None:
12845 self.flags = flags
12846 else:
12847 self.flags = 0
12848 if entries != None:
12849 self.entries = entries
12850 else:
12851 self.entries = []
12852 return
12853
12854 def pack(self):
12855 packed = []
12856 packed.append(struct.pack("!B", self.version))
12857 packed.append(struct.pack("!B", self.type))
12858 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12859 packed.append(struct.pack("!L", self.xid))
12860 packed.append(struct.pack("!H", self.stats_type))
12861 packed.append(struct.pack("!H", self.flags))
12862 packed.append('\x00' * 4)
12863 packed.append(loxi.generic_util.pack_list(self.entries))
12864 length = sum([len(x) for x in packed])
12865 packed[2] = struct.pack("!H", length)
12866 return ''.join(packed)
12867
12868 @staticmethod
12869 def unpack(reader):
12870 obj = group_stats_reply()
12871 _version = reader.read("!B")[0]
12872 assert(_version == 5)
12873 _type = reader.read("!B")[0]
12874 assert(_type == 19)
12875 _length = reader.read("!H")[0]
12876 orig_reader = reader
12877 reader = orig_reader.slice(_length, 4)
12878 obj.xid = reader.read("!L")[0]
12879 _stats_type = reader.read("!H")[0]
12880 assert(_stats_type == 6)
12881 obj.flags = reader.read("!H")[0]
12882 reader.skip(4)
12883 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
12884 return obj
12885
12886 def __eq__(self, other):
12887 if type(self) != type(other): return False
12888 if self.xid != other.xid: return False
12889 if self.flags != other.flags: return False
12890 if self.entries != other.entries: return False
12891 return True
12892
12893 def pretty_print(self, q):
12894 q.text("group_stats_reply {")
12895 with q.group():
12896 with q.indent(2):
12897 q.breakable()
12898 q.text("xid = ");
12899 if self.xid != None:
12900 q.text("%#x" % self.xid)
12901 else:
12902 q.text('None')
12903 q.text(","); q.breakable()
12904 q.text("flags = ");
12905 q.text("%#x" % self.flags)
12906 q.text(","); q.breakable()
12907 q.text("entries = ");
12908 q.pp(self.entries)
12909 q.breakable()
12910 q.text('}')
12911
12912stats_reply.subtypes[6] = group_stats_reply
12913
12914class group_stats_request(stats_request):
12915 version = 5
12916 type = 18
12917 stats_type = 6
12918
12919 def __init__(self, xid=None, flags=None, group_id=None):
12920 if xid != None:
12921 self.xid = xid
12922 else:
12923 self.xid = None
12924 if flags != None:
12925 self.flags = flags
12926 else:
12927 self.flags = 0
12928 if group_id != None:
12929 self.group_id = group_id
12930 else:
12931 self.group_id = 0
12932 return
12933
12934 def pack(self):
12935 packed = []
12936 packed.append(struct.pack("!B", self.version))
12937 packed.append(struct.pack("!B", self.type))
12938 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12939 packed.append(struct.pack("!L", self.xid))
12940 packed.append(struct.pack("!H", self.stats_type))
12941 packed.append(struct.pack("!H", self.flags))
12942 packed.append('\x00' * 4)
12943 packed.append(struct.pack("!L", self.group_id))
12944 packed.append('\x00' * 4)
12945 length = sum([len(x) for x in packed])
12946 packed[2] = struct.pack("!H", length)
12947 return ''.join(packed)
12948
12949 @staticmethod
12950 def unpack(reader):
12951 obj = group_stats_request()
12952 _version = reader.read("!B")[0]
12953 assert(_version == 5)
12954 _type = reader.read("!B")[0]
12955 assert(_type == 18)
12956 _length = reader.read("!H")[0]
12957 orig_reader = reader
12958 reader = orig_reader.slice(_length, 4)
12959 obj.xid = reader.read("!L")[0]
12960 _stats_type = reader.read("!H")[0]
12961 assert(_stats_type == 6)
12962 obj.flags = reader.read("!H")[0]
12963 reader.skip(4)
12964 obj.group_id = reader.read("!L")[0]
12965 reader.skip(4)
12966 return obj
12967
12968 def __eq__(self, other):
12969 if type(self) != type(other): return False
12970 if self.xid != other.xid: return False
12971 if self.flags != other.flags: return False
12972 if self.group_id != other.group_id: return False
12973 return True
12974
12975 def pretty_print(self, q):
12976 q.text("group_stats_request {")
12977 with q.group():
12978 with q.indent(2):
12979 q.breakable()
12980 q.text("xid = ");
12981 if self.xid != None:
12982 q.text("%#x" % self.xid)
12983 else:
12984 q.text('None')
12985 q.text(","); q.breakable()
12986 q.text("flags = ");
12987 q.text("%#x" % self.flags)
12988 q.text(","); q.breakable()
12989 q.text("group_id = ");
12990 q.text("%#x" % self.group_id)
12991 q.breakable()
12992 q.text('}')
12993
12994stats_request.subtypes[6] = group_stats_request
12995
12996class hello(message):
12997 version = 5
12998 type = 0
12999
13000 def __init__(self, xid=None, elements=None):
13001 if xid != None:
13002 self.xid = xid
13003 else:
13004 self.xid = None
13005 if elements != None:
13006 self.elements = elements
13007 else:
13008 self.elements = []
13009 return
13010
13011 def pack(self):
13012 packed = []
13013 packed.append(struct.pack("!B", self.version))
13014 packed.append(struct.pack("!B", self.type))
13015 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13016 packed.append(struct.pack("!L", self.xid))
13017 packed.append(loxi.generic_util.pack_list(self.elements))
13018 length = sum([len(x) for x in packed])
13019 packed[2] = struct.pack("!H", length)
13020 return ''.join(packed)
13021
13022 @staticmethod
13023 def unpack(reader):
13024 obj = hello()
13025 _version = reader.read("!B")[0]
13026 assert(_version == 5)
13027 _type = reader.read("!B")[0]
13028 assert(_type == 0)
13029 _length = reader.read("!H")[0]
13030 orig_reader = reader
13031 reader = orig_reader.slice(_length, 4)
13032 obj.xid = reader.read("!L")[0]
13033 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
13034 return obj
13035
13036 def __eq__(self, other):
13037 if type(self) != type(other): return False
13038 if self.xid != other.xid: return False
13039 if self.elements != other.elements: return False
13040 return True
13041
13042 def pretty_print(self, q):
13043 q.text("hello {")
13044 with q.group():
13045 with q.indent(2):
13046 q.breakable()
13047 q.text("xid = ");
13048 if self.xid != None:
13049 q.text("%#x" % self.xid)
13050 else:
13051 q.text('None')
13052 q.text(","); q.breakable()
13053 q.text("elements = ");
13054 q.pp(self.elements)
13055 q.breakable()
13056 q.text('}')
13057
13058message.subtypes[0] = hello
13059
13060class hello_failed_error_msg(error_msg):
13061 version = 5
13062 type = 1
13063 err_type = 0
13064
13065 def __init__(self, xid=None, code=None, data=None):
13066 if xid != None:
13067 self.xid = xid
13068 else:
13069 self.xid = None
13070 if code != None:
13071 self.code = code
13072 else:
13073 self.code = 0
13074 if data != None:
13075 self.data = data
13076 else:
13077 self.data = ''
13078 return
13079
13080 def pack(self):
13081 packed = []
13082 packed.append(struct.pack("!B", self.version))
13083 packed.append(struct.pack("!B", self.type))
13084 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13085 packed.append(struct.pack("!L", self.xid))
13086 packed.append(struct.pack("!H", self.err_type))
13087 packed.append(struct.pack("!H", self.code))
13088 packed.append(self.data)
13089 length = sum([len(x) for x in packed])
13090 packed[2] = struct.pack("!H", length)
13091 return ''.join(packed)
13092
13093 @staticmethod
13094 def unpack(reader):
13095 obj = hello_failed_error_msg()
13096 _version = reader.read("!B")[0]
13097 assert(_version == 5)
13098 _type = reader.read("!B")[0]
13099 assert(_type == 1)
13100 _length = reader.read("!H")[0]
13101 orig_reader = reader
13102 reader = orig_reader.slice(_length, 4)
13103 obj.xid = reader.read("!L")[0]
13104 _err_type = reader.read("!H")[0]
13105 assert(_err_type == 0)
13106 obj.code = reader.read("!H")[0]
13107 obj.data = str(reader.read_all())
13108 return obj
13109
13110 def __eq__(self, other):
13111 if type(self) != type(other): return False
13112 if self.xid != other.xid: return False
13113 if self.code != other.code: return False
13114 if self.data != other.data: return False
13115 return True
13116
13117 def pretty_print(self, q):
13118 q.text("hello_failed_error_msg {")
13119 with q.group():
13120 with q.indent(2):
13121 q.breakable()
13122 q.text("xid = ");
13123 if self.xid != None:
13124 q.text("%#x" % self.xid)
13125 else:
13126 q.text('None')
13127 q.text(","); q.breakable()
13128 q.text("code = ");
13129 q.text("%#x" % self.code)
13130 q.text(","); q.breakable()
13131 q.text("data = ");
13132 q.pp(self.data)
13133 q.breakable()
13134 q.text('}')
13135
13136error_msg.subtypes[0] = hello_failed_error_msg
13137
13138class meter_config_stats_reply(stats_reply):
13139 version = 5
13140 type = 19
13141 stats_type = 10
13142
13143 def __init__(self, xid=None, flags=None, entries=None):
13144 if xid != None:
13145 self.xid = xid
13146 else:
13147 self.xid = None
13148 if flags != None:
13149 self.flags = flags
13150 else:
13151 self.flags = 0
13152 if entries != None:
13153 self.entries = entries
13154 else:
13155 self.entries = []
13156 return
13157
13158 def pack(self):
13159 packed = []
13160 packed.append(struct.pack("!B", self.version))
13161 packed.append(struct.pack("!B", self.type))
13162 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13163 packed.append(struct.pack("!L", self.xid))
13164 packed.append(struct.pack("!H", self.stats_type))
13165 packed.append(struct.pack("!H", self.flags))
13166 packed.append('\x00' * 4)
13167 packed.append(loxi.generic_util.pack_list(self.entries))
13168 length = sum([len(x) for x in packed])
13169 packed[2] = struct.pack("!H", length)
13170 return ''.join(packed)
13171
13172 @staticmethod
13173 def unpack(reader):
13174 obj = meter_config_stats_reply()
13175 _version = reader.read("!B")[0]
13176 assert(_version == 5)
13177 _type = reader.read("!B")[0]
13178 assert(_type == 19)
13179 _length = reader.read("!H")[0]
13180 orig_reader = reader
13181 reader = orig_reader.slice(_length, 4)
13182 obj.xid = reader.read("!L")[0]
13183 _stats_type = reader.read("!H")[0]
13184 assert(_stats_type == 10)
13185 obj.flags = reader.read("!H")[0]
13186 reader.skip(4)
13187 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_config.unpack)
13188 return obj
13189
13190 def __eq__(self, other):
13191 if type(self) != type(other): return False
13192 if self.xid != other.xid: return False
13193 if self.flags != other.flags: return False
13194 if self.entries != other.entries: return False
13195 return True
13196
13197 def pretty_print(self, q):
13198 q.text("meter_config_stats_reply {")
13199 with q.group():
13200 with q.indent(2):
13201 q.breakable()
13202 q.text("xid = ");
13203 if self.xid != None:
13204 q.text("%#x" % self.xid)
13205 else:
13206 q.text('None')
13207 q.text(","); q.breakable()
13208 q.text("flags = ");
13209 q.text("%#x" % self.flags)
13210 q.text(","); q.breakable()
13211 q.text("entries = ");
13212 q.pp(self.entries)
13213 q.breakable()
13214 q.text('}')
13215
13216stats_reply.subtypes[10] = meter_config_stats_reply
13217
13218class meter_config_stats_request(stats_request):
13219 version = 5
13220 type = 18
13221 stats_type = 10
13222
13223 def __init__(self, xid=None, flags=None, meter_id=None):
13224 if xid != None:
13225 self.xid = xid
13226 else:
13227 self.xid = None
13228 if flags != None:
13229 self.flags = flags
13230 else:
13231 self.flags = 0
13232 if meter_id != None:
13233 self.meter_id = meter_id
13234 else:
13235 self.meter_id = 0
13236 return
13237
13238 def pack(self):
13239 packed = []
13240 packed.append(struct.pack("!B", self.version))
13241 packed.append(struct.pack("!B", self.type))
13242 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13243 packed.append(struct.pack("!L", self.xid))
13244 packed.append(struct.pack("!H", self.stats_type))
13245 packed.append(struct.pack("!H", self.flags))
13246 packed.append('\x00' * 4)
13247 packed.append(struct.pack("!L", self.meter_id))
13248 packed.append('\x00' * 4)
13249 length = sum([len(x) for x in packed])
13250 packed[2] = struct.pack("!H", length)
13251 return ''.join(packed)
13252
13253 @staticmethod
13254 def unpack(reader):
13255 obj = meter_config_stats_request()
13256 _version = reader.read("!B")[0]
13257 assert(_version == 5)
13258 _type = reader.read("!B")[0]
13259 assert(_type == 18)
13260 _length = reader.read("!H")[0]
13261 orig_reader = reader
13262 reader = orig_reader.slice(_length, 4)
13263 obj.xid = reader.read("!L")[0]
13264 _stats_type = reader.read("!H")[0]
13265 assert(_stats_type == 10)
13266 obj.flags = reader.read("!H")[0]
13267 reader.skip(4)
13268 obj.meter_id = reader.read("!L")[0]
13269 reader.skip(4)
13270 return obj
13271
13272 def __eq__(self, other):
13273 if type(self) != type(other): return False
13274 if self.xid != other.xid: return False
13275 if self.flags != other.flags: return False
13276 if self.meter_id != other.meter_id: return False
13277 return True
13278
13279 def pretty_print(self, q):
13280 q.text("meter_config_stats_request {")
13281 with q.group():
13282 with q.indent(2):
13283 q.breakable()
13284 q.text("xid = ");
13285 if self.xid != None:
13286 q.text("%#x" % self.xid)
13287 else:
13288 q.text('None')
13289 q.text(","); q.breakable()
13290 q.text("flags = ");
13291 q.text("%#x" % self.flags)
13292 q.text(","); q.breakable()
13293 q.text("meter_id = ");
13294 q.text("%#x" % self.meter_id)
13295 q.breakable()
13296 q.text('}')
13297
13298stats_request.subtypes[10] = meter_config_stats_request
13299
13300class meter_features_stats_reply(stats_reply):
13301 version = 5
13302 type = 19
13303 stats_type = 11
13304
13305 def __init__(self, xid=None, flags=None, features=None):
13306 if xid != None:
13307 self.xid = xid
13308 else:
13309 self.xid = None
13310 if flags != None:
13311 self.flags = flags
13312 else:
13313 self.flags = 0
13314 if features != None:
13315 self.features = features
13316 else:
13317 self.features = ofp.meter_features()
13318 return
13319
13320 def pack(self):
13321 packed = []
13322 packed.append(struct.pack("!B", self.version))
13323 packed.append(struct.pack("!B", self.type))
13324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13325 packed.append(struct.pack("!L", self.xid))
13326 packed.append(struct.pack("!H", self.stats_type))
13327 packed.append(struct.pack("!H", self.flags))
13328 packed.append('\x00' * 4)
13329 packed.append(self.features.pack())
13330 length = sum([len(x) for x in packed])
13331 packed[2] = struct.pack("!H", length)
13332 return ''.join(packed)
13333
13334 @staticmethod
13335 def unpack(reader):
13336 obj = meter_features_stats_reply()
13337 _version = reader.read("!B")[0]
13338 assert(_version == 5)
13339 _type = reader.read("!B")[0]
13340 assert(_type == 19)
13341 _length = reader.read("!H")[0]
13342 orig_reader = reader
13343 reader = orig_reader.slice(_length, 4)
13344 obj.xid = reader.read("!L")[0]
13345 _stats_type = reader.read("!H")[0]
13346 assert(_stats_type == 11)
13347 obj.flags = reader.read("!H")[0]
13348 reader.skip(4)
13349 obj.features = ofp.meter_features.unpack(reader)
13350 return obj
13351
13352 def __eq__(self, other):
13353 if type(self) != type(other): return False
13354 if self.xid != other.xid: return False
13355 if self.flags != other.flags: return False
13356 if self.features != other.features: return False
13357 return True
13358
13359 def pretty_print(self, q):
13360 q.text("meter_features_stats_reply {")
13361 with q.group():
13362 with q.indent(2):
13363 q.breakable()
13364 q.text("xid = ");
13365 if self.xid != None:
13366 q.text("%#x" % self.xid)
13367 else:
13368 q.text('None')
13369 q.text(","); q.breakable()
13370 q.text("flags = ");
13371 q.text("%#x" % self.flags)
13372 q.text(","); q.breakable()
13373 q.text("features = ");
13374 q.pp(self.features)
13375 q.breakable()
13376 q.text('}')
13377
13378stats_reply.subtypes[11] = meter_features_stats_reply
13379
13380class meter_features_stats_request(stats_request):
13381 version = 5
13382 type = 18
13383 stats_type = 11
13384
13385 def __init__(self, xid=None, flags=None):
13386 if xid != None:
13387 self.xid = xid
13388 else:
13389 self.xid = None
13390 if flags != None:
13391 self.flags = flags
13392 else:
13393 self.flags = 0
13394 return
13395
13396 def pack(self):
13397 packed = []
13398 packed.append(struct.pack("!B", self.version))
13399 packed.append(struct.pack("!B", self.type))
13400 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13401 packed.append(struct.pack("!L", self.xid))
13402 packed.append(struct.pack("!H", self.stats_type))
13403 packed.append(struct.pack("!H", self.flags))
13404 packed.append('\x00' * 4)
13405 length = sum([len(x) for x in packed])
13406 packed[2] = struct.pack("!H", length)
13407 return ''.join(packed)
13408
13409 @staticmethod
13410 def unpack(reader):
13411 obj = meter_features_stats_request()
13412 _version = reader.read("!B")[0]
13413 assert(_version == 5)
13414 _type = reader.read("!B")[0]
13415 assert(_type == 18)
13416 _length = reader.read("!H")[0]
13417 orig_reader = reader
13418 reader = orig_reader.slice(_length, 4)
13419 obj.xid = reader.read("!L")[0]
13420 _stats_type = reader.read("!H")[0]
13421 assert(_stats_type == 11)
13422 obj.flags = reader.read("!H")[0]
13423 reader.skip(4)
13424 return obj
13425
13426 def __eq__(self, other):
13427 if type(self) != type(other): return False
13428 if self.xid != other.xid: return False
13429 if self.flags != other.flags: return False
13430 return True
13431
13432 def pretty_print(self, q):
13433 q.text("meter_features_stats_request {")
13434 with q.group():
13435 with q.indent(2):
13436 q.breakable()
13437 q.text("xid = ");
13438 if self.xid != None:
13439 q.text("%#x" % self.xid)
13440 else:
13441 q.text('None')
13442 q.text(","); q.breakable()
13443 q.text("flags = ");
13444 q.text("%#x" % self.flags)
13445 q.breakable()
13446 q.text('}')
13447
13448stats_request.subtypes[11] = meter_features_stats_request
13449
13450class meter_mod(message):
13451 version = 5
13452 type = 29
13453
13454 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
13455 if xid != None:
13456 self.xid = xid
13457 else:
13458 self.xid = None
13459 if command != None:
13460 self.command = command
13461 else:
13462 self.command = 0
13463 if flags != None:
13464 self.flags = flags
13465 else:
13466 self.flags = 0
13467 if meter_id != None:
13468 self.meter_id = meter_id
13469 else:
13470 self.meter_id = 0
13471 if bands != None:
13472 self.bands = bands
13473 else:
13474 self.bands = []
13475 return
13476
13477 def pack(self):
13478 packed = []
13479 packed.append(struct.pack("!B", self.version))
13480 packed.append(struct.pack("!B", self.type))
13481 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13482 packed.append(struct.pack("!L", self.xid))
13483 packed.append(struct.pack("!H", self.command))
13484 packed.append(struct.pack("!H", self.flags))
13485 packed.append(struct.pack("!L", self.meter_id))
13486 packed.append(loxi.generic_util.pack_list(self.bands))
13487 length = sum([len(x) for x in packed])
13488 packed[2] = struct.pack("!H", length)
13489 return ''.join(packed)
13490
13491 @staticmethod
13492 def unpack(reader):
13493 obj = meter_mod()
13494 _version = reader.read("!B")[0]
13495 assert(_version == 5)
13496 _type = reader.read("!B")[0]
13497 assert(_type == 29)
13498 _length = reader.read("!H")[0]
13499 orig_reader = reader
13500 reader = orig_reader.slice(_length, 4)
13501 obj.xid = reader.read("!L")[0]
13502 obj.command = reader.read("!H")[0]
13503 obj.flags = reader.read("!H")[0]
13504 obj.meter_id = reader.read("!L")[0]
13505 obj.bands = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
13506 return obj
13507
13508 def __eq__(self, other):
13509 if type(self) != type(other): return False
13510 if self.xid != other.xid: return False
13511 if self.command != other.command: return False
13512 if self.flags != other.flags: return False
13513 if self.meter_id != other.meter_id: return False
13514 if self.bands != other.bands: return False
13515 return True
13516
13517 def pretty_print(self, q):
13518 q.text("meter_mod {")
13519 with q.group():
13520 with q.indent(2):
13521 q.breakable()
13522 q.text("xid = ");
13523 if self.xid != None:
13524 q.text("%#x" % self.xid)
13525 else:
13526 q.text('None')
13527 q.text(","); q.breakable()
13528 q.text("command = ");
13529 q.text("%#x" % self.command)
13530 q.text(","); q.breakable()
13531 q.text("flags = ");
13532 q.text("%#x" % self.flags)
13533 q.text(","); q.breakable()
13534 q.text("meter_id = ");
13535 q.text("%#x" % self.meter_id)
13536 q.text(","); q.breakable()
13537 q.text("bands = ");
13538 q.pp(self.bands)
13539 q.breakable()
13540 q.text('}')
13541
13542message.subtypes[29] = meter_mod
13543
13544class meter_mod_failed_error_msg(error_msg):
13545 version = 5
13546 type = 1
13547 err_type = 12
13548
13549 def __init__(self, xid=None, code=None, data=None):
13550 if xid != None:
13551 self.xid = xid
13552 else:
13553 self.xid = None
13554 if code != None:
13555 self.code = code
13556 else:
13557 self.code = 0
13558 if data != None:
13559 self.data = data
13560 else:
13561 self.data = ''
13562 return
13563
13564 def pack(self):
13565 packed = []
13566 packed.append(struct.pack("!B", self.version))
13567 packed.append(struct.pack("!B", self.type))
13568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13569 packed.append(struct.pack("!L", self.xid))
13570 packed.append(struct.pack("!H", self.err_type))
13571 packed.append(struct.pack("!H", self.code))
13572 packed.append(self.data)
13573 length = sum([len(x) for x in packed])
13574 packed[2] = struct.pack("!H", length)
13575 return ''.join(packed)
13576
13577 @staticmethod
13578 def unpack(reader):
13579 obj = meter_mod_failed_error_msg()
13580 _version = reader.read("!B")[0]
13581 assert(_version == 5)
13582 _type = reader.read("!B")[0]
13583 assert(_type == 1)
13584 _length = reader.read("!H")[0]
13585 orig_reader = reader
13586 reader = orig_reader.slice(_length, 4)
13587 obj.xid = reader.read("!L")[0]
13588 _err_type = reader.read("!H")[0]
13589 assert(_err_type == 12)
13590 obj.code = reader.read("!H")[0]
13591 obj.data = str(reader.read_all())
13592 return obj
13593
13594 def __eq__(self, other):
13595 if type(self) != type(other): return False
13596 if self.xid != other.xid: return False
13597 if self.code != other.code: return False
13598 if self.data != other.data: return False
13599 return True
13600
13601 def pretty_print(self, q):
13602 q.text("meter_mod_failed_error_msg {")
13603 with q.group():
13604 with q.indent(2):
13605 q.breakable()
13606 q.text("xid = ");
13607 if self.xid != None:
13608 q.text("%#x" % self.xid)
13609 else:
13610 q.text('None')
13611 q.text(","); q.breakable()
13612 q.text("code = ");
13613 q.text("%#x" % self.code)
13614 q.text(","); q.breakable()
13615 q.text("data = ");
13616 q.pp(self.data)
13617 q.breakable()
13618 q.text('}')
13619
13620error_msg.subtypes[12] = meter_mod_failed_error_msg
13621
13622class meter_stats_reply(stats_reply):
13623 version = 5
13624 type = 19
13625 stats_type = 9
13626
13627 def __init__(self, xid=None, flags=None, entries=None):
13628 if xid != None:
13629 self.xid = xid
13630 else:
13631 self.xid = None
13632 if flags != None:
13633 self.flags = flags
13634 else:
13635 self.flags = 0
13636 if entries != None:
13637 self.entries = entries
13638 else:
13639 self.entries = []
13640 return
13641
13642 def pack(self):
13643 packed = []
13644 packed.append(struct.pack("!B", self.version))
13645 packed.append(struct.pack("!B", self.type))
13646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13647 packed.append(struct.pack("!L", self.xid))
13648 packed.append(struct.pack("!H", self.stats_type))
13649 packed.append(struct.pack("!H", self.flags))
13650 packed.append('\x00' * 4)
13651 packed.append(loxi.generic_util.pack_list(self.entries))
13652 length = sum([len(x) for x in packed])
13653 packed[2] = struct.pack("!H", length)
13654 return ''.join(packed)
13655
13656 @staticmethod
13657 def unpack(reader):
13658 obj = meter_stats_reply()
13659 _version = reader.read("!B")[0]
13660 assert(_version == 5)
13661 _type = reader.read("!B")[0]
13662 assert(_type == 19)
13663 _length = reader.read("!H")[0]
13664 orig_reader = reader
13665 reader = orig_reader.slice(_length, 4)
13666 obj.xid = reader.read("!L")[0]
13667 _stats_type = reader.read("!H")[0]
13668 assert(_stats_type == 9)
13669 obj.flags = reader.read("!H")[0]
13670 reader.skip(4)
13671 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
13672 return obj
13673
13674 def __eq__(self, other):
13675 if type(self) != type(other): return False
13676 if self.xid != other.xid: return False
13677 if self.flags != other.flags: return False
13678 if self.entries != other.entries: return False
13679 return True
13680
13681 def pretty_print(self, q):
13682 q.text("meter_stats_reply {")
13683 with q.group():
13684 with q.indent(2):
13685 q.breakable()
13686 q.text("xid = ");
13687 if self.xid != None:
13688 q.text("%#x" % self.xid)
13689 else:
13690 q.text('None')
13691 q.text(","); q.breakable()
13692 q.text("flags = ");
13693 q.text("%#x" % self.flags)
13694 q.text(","); q.breakable()
13695 q.text("entries = ");
13696 q.pp(self.entries)
13697 q.breakable()
13698 q.text('}')
13699
13700stats_reply.subtypes[9] = meter_stats_reply
13701
13702class meter_stats_request(stats_request):
13703 version = 5
13704 type = 18
13705 stats_type = 9
13706
13707 def __init__(self, xid=None, flags=None, meter_id=None):
13708 if xid != None:
13709 self.xid = xid
13710 else:
13711 self.xid = None
13712 if flags != None:
13713 self.flags = flags
13714 else:
13715 self.flags = 0
13716 if meter_id != None:
13717 self.meter_id = meter_id
13718 else:
13719 self.meter_id = 0
13720 return
13721
13722 def pack(self):
13723 packed = []
13724 packed.append(struct.pack("!B", self.version))
13725 packed.append(struct.pack("!B", self.type))
13726 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13727 packed.append(struct.pack("!L", self.xid))
13728 packed.append(struct.pack("!H", self.stats_type))
13729 packed.append(struct.pack("!H", self.flags))
13730 packed.append('\x00' * 4)
13731 packed.append(struct.pack("!L", self.meter_id))
13732 packed.append('\x00' * 4)
13733 length = sum([len(x) for x in packed])
13734 packed[2] = struct.pack("!H", length)
13735 return ''.join(packed)
13736
13737 @staticmethod
13738 def unpack(reader):
13739 obj = meter_stats_request()
13740 _version = reader.read("!B")[0]
13741 assert(_version == 5)
13742 _type = reader.read("!B")[0]
13743 assert(_type == 18)
13744 _length = reader.read("!H")[0]
13745 orig_reader = reader
13746 reader = orig_reader.slice(_length, 4)
13747 obj.xid = reader.read("!L")[0]
13748 _stats_type = reader.read("!H")[0]
13749 assert(_stats_type == 9)
13750 obj.flags = reader.read("!H")[0]
13751 reader.skip(4)
13752 obj.meter_id = reader.read("!L")[0]
13753 reader.skip(4)
13754 return obj
13755
13756 def __eq__(self, other):
13757 if type(self) != type(other): return False
13758 if self.xid != other.xid: return False
13759 if self.flags != other.flags: return False
13760 if self.meter_id != other.meter_id: return False
13761 return True
13762
13763 def pretty_print(self, q):
13764 q.text("meter_stats_request {")
13765 with q.group():
13766 with q.indent(2):
13767 q.breakable()
13768 q.text("xid = ");
13769 if self.xid != None:
13770 q.text("%#x" % self.xid)
13771 else:
13772 q.text('None')
13773 q.text(","); q.breakable()
13774 q.text("flags = ");
13775 q.text("%#x" % self.flags)
13776 q.text(","); q.breakable()
13777 q.text("meter_id = ");
13778 q.text("%#x" % self.meter_id)
13779 q.breakable()
13780 q.text('}')
13781
13782stats_request.subtypes[9] = meter_stats_request
13783
13784class nicira_header(experimenter):
13785 subtypes = {}
13786
13787 version = 5
13788 type = 4
13789 experimenter = 8992
13790
13791 def __init__(self, xid=None, subtype=None):
13792 if xid != None:
13793 self.xid = xid
13794 else:
13795 self.xid = None
13796 if subtype != None:
13797 self.subtype = subtype
13798 else:
13799 self.subtype = 0
13800 return
13801
13802 def pack(self):
13803 packed = []
13804 packed.append(struct.pack("!B", self.version))
13805 packed.append(struct.pack("!B", self.type))
13806 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13807 packed.append(struct.pack("!L", self.xid))
13808 packed.append(struct.pack("!L", self.experimenter))
13809 packed.append(struct.pack("!L", self.subtype))
13810 length = sum([len(x) for x in packed])
13811 packed[2] = struct.pack("!H", length)
13812 return ''.join(packed)
13813
13814 @staticmethod
13815 def unpack(reader):
13816 subtype, = reader.peek('!L', 12)
13817 subclass = nicira_header.subtypes.get(subtype)
13818 if subclass:
13819 return subclass.unpack(reader)
13820
13821 obj = nicira_header()
13822 _version = reader.read("!B")[0]
13823 assert(_version == 5)
13824 _type = reader.read("!B")[0]
13825 assert(_type == 4)
13826 _length = reader.read("!H")[0]
13827 orig_reader = reader
13828 reader = orig_reader.slice(_length, 4)
13829 obj.xid = reader.read("!L")[0]
13830 _experimenter = reader.read("!L")[0]
13831 assert(_experimenter == 8992)
13832 obj.subtype = reader.read("!L")[0]
13833 return obj
13834
13835 def __eq__(self, other):
13836 if type(self) != type(other): return False
13837 if self.xid != other.xid: return False
13838 if self.subtype != other.subtype: return False
13839 return True
13840
13841 def pretty_print(self, q):
13842 q.text("nicira_header {")
13843 with q.group():
13844 with q.indent(2):
13845 q.breakable()
13846 q.text("xid = ");
13847 if self.xid != None:
13848 q.text("%#x" % self.xid)
13849 else:
13850 q.text('None')
13851 q.breakable()
13852 q.text('}')
13853
13854experimenter.subtypes[8992] = nicira_header
13855
13856class packet_in(message):
13857 version = 5
13858 type = 10
13859
13860 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13861 if xid != None:
13862 self.xid = xid
13863 else:
13864 self.xid = None
13865 if buffer_id != None:
13866 self.buffer_id = buffer_id
13867 else:
13868 self.buffer_id = 0
13869 if total_len != None:
13870 self.total_len = total_len
13871 else:
13872 self.total_len = 0
13873 if reason != None:
13874 self.reason = reason
13875 else:
13876 self.reason = 0
13877 if table_id != None:
13878 self.table_id = table_id
13879 else:
13880 self.table_id = 0
13881 if cookie != None:
13882 self.cookie = cookie
13883 else:
13884 self.cookie = 0
13885 if match != None:
13886 self.match = match
13887 else:
13888 self.match = ofp.match()
13889 if data != None:
13890 self.data = data
13891 else:
13892 self.data = ''
13893 return
13894
13895 def pack(self):
13896 packed = []
13897 packed.append(struct.pack("!B", self.version))
13898 packed.append(struct.pack("!B", self.type))
13899 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13900 packed.append(struct.pack("!L", self.xid))
13901 packed.append(struct.pack("!L", self.buffer_id))
13902 packed.append(struct.pack("!H", self.total_len))
13903 packed.append(struct.pack("!B", self.reason))
13904 packed.append(struct.pack("!B", self.table_id))
13905 packed.append(struct.pack("!Q", self.cookie))
13906 packed.append(self.match.pack())
13907 packed.append('\x00' * 2)
13908 packed.append(self.data)
13909 length = sum([len(x) for x in packed])
13910 packed[2] = struct.pack("!H", length)
13911 return ''.join(packed)
13912
13913 @staticmethod
13914 def unpack(reader):
13915 obj = packet_in()
13916 _version = reader.read("!B")[0]
13917 assert(_version == 5)
13918 _type = reader.read("!B")[0]
13919 assert(_type == 10)
13920 _length = reader.read("!H")[0]
13921 orig_reader = reader
13922 reader = orig_reader.slice(_length, 4)
13923 obj.xid = reader.read("!L")[0]
13924 obj.buffer_id = reader.read("!L")[0]
13925 obj.total_len = reader.read("!H")[0]
13926 obj.reason = reader.read("!B")[0]
13927 obj.table_id = reader.read("!B")[0]
13928 obj.cookie = reader.read("!Q")[0]
13929 obj.match = ofp.match.unpack(reader)
13930 reader.skip(2)
13931 obj.data = str(reader.read_all())
13932 return obj
13933
13934 def __eq__(self, other):
13935 if type(self) != type(other): return False
13936 if self.xid != other.xid: return False
13937 if self.buffer_id != other.buffer_id: return False
13938 if self.total_len != other.total_len: return False
13939 if self.reason != other.reason: return False
13940 if self.table_id != other.table_id: return False
13941 if self.cookie != other.cookie: return False
13942 if self.match != other.match: return False
13943 if self.data != other.data: return False
13944 return True
13945
13946 def pretty_print(self, q):
13947 q.text("packet_in {")
13948 with q.group():
13949 with q.indent(2):
13950 q.breakable()
13951 q.text("xid = ");
13952 if self.xid != None:
13953 q.text("%#x" % self.xid)
13954 else:
13955 q.text('None')
13956 q.text(","); q.breakable()
13957 q.text("buffer_id = ");
13958 q.text("%#x" % self.buffer_id)
13959 q.text(","); q.breakable()
13960 q.text("total_len = ");
13961 q.text("%#x" % self.total_len)
13962 q.text(","); q.breakable()
13963 q.text("reason = ");
13964 q.text("%#x" % self.reason)
13965 q.text(","); q.breakable()
13966 q.text("table_id = ");
13967 q.text("%#x" % self.table_id)
13968 q.text(","); q.breakable()
13969 q.text("cookie = ");
13970 q.text("%#x" % self.cookie)
13971 q.text(","); q.breakable()
13972 q.text("match = ");
13973 q.pp(self.match)
13974 q.text(","); q.breakable()
13975 q.text("data = ");
13976 q.pp(self.data)
13977 q.breakable()
13978 q.text('}')
13979
13980message.subtypes[10] = packet_in
13981
13982class packet_out(message):
13983 version = 5
13984 type = 13
13985
13986 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13987 if xid != None:
13988 self.xid = xid
13989 else:
13990 self.xid = None
13991 if buffer_id != None:
13992 self.buffer_id = buffer_id
13993 else:
13994 self.buffer_id = 0
13995 if in_port != None:
13996 self.in_port = in_port
13997 else:
13998 self.in_port = 0
13999 if actions != None:
14000 self.actions = actions
14001 else:
14002 self.actions = []
14003 if data != None:
14004 self.data = data
14005 else:
14006 self.data = ''
14007 return
14008
14009 def pack(self):
14010 packed = []
14011 packed.append(struct.pack("!B", self.version))
14012 packed.append(struct.pack("!B", self.type))
14013 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14014 packed.append(struct.pack("!L", self.xid))
14015 packed.append(struct.pack("!L", self.buffer_id))
14016 packed.append(util.pack_port_no(self.in_port))
14017 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
14018 packed.append('\x00' * 6)
14019 packed.append(loxi.generic_util.pack_list(self.actions))
14020 packed[6] = struct.pack("!H", len(packed[-1]))
14021 packed.append(self.data)
14022 length = sum([len(x) for x in packed])
14023 packed[2] = struct.pack("!H", length)
14024 return ''.join(packed)
14025
14026 @staticmethod
14027 def unpack(reader):
14028 obj = packet_out()
14029 _version = reader.read("!B")[0]
14030 assert(_version == 5)
14031 _type = reader.read("!B")[0]
14032 assert(_type == 13)
14033 _length = reader.read("!H")[0]
14034 orig_reader = reader
14035 reader = orig_reader.slice(_length, 4)
14036 obj.xid = reader.read("!L")[0]
14037 obj.buffer_id = reader.read("!L")[0]
14038 obj.in_port = util.unpack_port_no(reader)
14039 _actions_len = reader.read("!H")[0]
14040 reader.skip(6)
14041 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
14042 obj.data = str(reader.read_all())
14043 return obj
14044
14045 def __eq__(self, other):
14046 if type(self) != type(other): return False
14047 if self.xid != other.xid: return False
14048 if self.buffer_id != other.buffer_id: return False
14049 if self.in_port != other.in_port: return False
14050 if self.actions != other.actions: return False
14051 if self.data != other.data: return False
14052 return True
14053
14054 def pretty_print(self, q):
14055 q.text("packet_out {")
14056 with q.group():
14057 with q.indent(2):
14058 q.breakable()
14059 q.text("xid = ");
14060 if self.xid != None:
14061 q.text("%#x" % self.xid)
14062 else:
14063 q.text('None')
14064 q.text(","); q.breakable()
14065 q.text("buffer_id = ");
14066 q.text("%#x" % self.buffer_id)
14067 q.text(","); q.breakable()
14068 q.text("in_port = ");
14069 q.text(util.pretty_port(self.in_port))
14070 q.text(","); q.breakable()
14071 q.text("actions = ");
14072 q.pp(self.actions)
14073 q.text(","); q.breakable()
14074 q.text("data = ");
14075 q.pp(self.data)
14076 q.breakable()
14077 q.text('}')
14078
14079message.subtypes[13] = packet_out
14080
14081class port_desc_stats_reply(stats_reply):
14082 version = 5
14083 type = 19
14084 stats_type = 13
14085
14086 def __init__(self, xid=None, flags=None, entries=None):
14087 if xid != None:
14088 self.xid = xid
14089 else:
14090 self.xid = None
14091 if flags != None:
14092 self.flags = flags
14093 else:
14094 self.flags = 0
14095 if entries != None:
14096 self.entries = entries
14097 else:
14098 self.entries = []
14099 return
14100
14101 def pack(self):
14102 packed = []
14103 packed.append(struct.pack("!B", self.version))
14104 packed.append(struct.pack("!B", self.type))
14105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14106 packed.append(struct.pack("!L", self.xid))
14107 packed.append(struct.pack("!H", self.stats_type))
14108 packed.append(struct.pack("!H", self.flags))
14109 packed.append('\x00' * 4)
14110 packed.append(loxi.generic_util.pack_list(self.entries))
14111 length = sum([len(x) for x in packed])
14112 packed[2] = struct.pack("!H", length)
14113 return ''.join(packed)
14114
14115 @staticmethod
14116 def unpack(reader):
14117 obj = port_desc_stats_reply()
14118 _version = reader.read("!B")[0]
14119 assert(_version == 5)
14120 _type = reader.read("!B")[0]
14121 assert(_type == 19)
14122 _length = reader.read("!H")[0]
14123 orig_reader = reader
14124 reader = orig_reader.slice(_length, 4)
14125 obj.xid = reader.read("!L")[0]
14126 _stats_type = reader.read("!H")[0]
14127 assert(_stats_type == 13)
14128 obj.flags = reader.read("!H")[0]
14129 reader.skip(4)
14130 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
14131 return obj
14132
14133 def __eq__(self, other):
14134 if type(self) != type(other): return False
14135 if self.xid != other.xid: return False
14136 if self.flags != other.flags: return False
14137 if self.entries != other.entries: return False
14138 return True
14139
14140 def pretty_print(self, q):
14141 q.text("port_desc_stats_reply {")
14142 with q.group():
14143 with q.indent(2):
14144 q.breakable()
14145 q.text("xid = ");
14146 if self.xid != None:
14147 q.text("%#x" % self.xid)
14148 else:
14149 q.text('None')
14150 q.text(","); q.breakable()
14151 q.text("flags = ");
14152 q.text("%#x" % self.flags)
14153 q.text(","); q.breakable()
14154 q.text("entries = ");
14155 q.pp(self.entries)
14156 q.breakable()
14157 q.text('}')
14158
14159stats_reply.subtypes[13] = port_desc_stats_reply
14160
14161class port_desc_stats_request(stats_request):
14162 version = 5
14163 type = 18
14164 stats_type = 13
14165
14166 def __init__(self, xid=None, flags=None):
14167 if xid != None:
14168 self.xid = xid
14169 else:
14170 self.xid = None
14171 if flags != None:
14172 self.flags = flags
14173 else:
14174 self.flags = 0
14175 return
14176
14177 def pack(self):
14178 packed = []
14179 packed.append(struct.pack("!B", self.version))
14180 packed.append(struct.pack("!B", self.type))
14181 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14182 packed.append(struct.pack("!L", self.xid))
14183 packed.append(struct.pack("!H", self.stats_type))
14184 packed.append(struct.pack("!H", self.flags))
14185 packed.append('\x00' * 4)
14186 length = sum([len(x) for x in packed])
14187 packed[2] = struct.pack("!H", length)
14188 return ''.join(packed)
14189
14190 @staticmethod
14191 def unpack(reader):
14192 obj = port_desc_stats_request()
14193 _version = reader.read("!B")[0]
14194 assert(_version == 5)
14195 _type = reader.read("!B")[0]
14196 assert(_type == 18)
14197 _length = reader.read("!H")[0]
14198 orig_reader = reader
14199 reader = orig_reader.slice(_length, 4)
14200 obj.xid = reader.read("!L")[0]
14201 _stats_type = reader.read("!H")[0]
14202 assert(_stats_type == 13)
14203 obj.flags = reader.read("!H")[0]
14204 reader.skip(4)
14205 return obj
14206
14207 def __eq__(self, other):
14208 if type(self) != type(other): return False
14209 if self.xid != other.xid: return False
14210 if self.flags != other.flags: return False
14211 return True
14212
14213 def pretty_print(self, q):
14214 q.text("port_desc_stats_request {")
14215 with q.group():
14216 with q.indent(2):
14217 q.breakable()
14218 q.text("xid = ");
14219 if self.xid != None:
14220 q.text("%#x" % self.xid)
14221 else:
14222 q.text('None')
14223 q.text(","); q.breakable()
14224 q.text("flags = ");
14225 q.text("%#x" % self.flags)
14226 q.breakable()
14227 q.text('}')
14228
14229stats_request.subtypes[13] = port_desc_stats_request
14230
14231class port_mod(message):
14232 version = 5
14233 type = 16
14234
14235 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
14236 if xid != None:
14237 self.xid = xid
14238 else:
14239 self.xid = None
14240 if port_no != None:
14241 self.port_no = port_no
14242 else:
14243 self.port_no = 0
14244 if hw_addr != None:
14245 self.hw_addr = hw_addr
14246 else:
14247 self.hw_addr = [0,0,0,0,0,0]
14248 if config != None:
14249 self.config = config
14250 else:
14251 self.config = 0
14252 if mask != None:
14253 self.mask = mask
14254 else:
14255 self.mask = 0
14256 if properties != None:
14257 self.properties = properties
14258 else:
14259 self.properties = []
14260 return
14261
14262 def pack(self):
14263 packed = []
14264 packed.append(struct.pack("!B", self.version))
14265 packed.append(struct.pack("!B", self.type))
14266 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14267 packed.append(struct.pack("!L", self.xid))
14268 packed.append(util.pack_port_no(self.port_no))
14269 packed.append('\x00' * 4)
14270 packed.append(struct.pack("!6B", *self.hw_addr))
14271 packed.append('\x00' * 2)
14272 packed.append(struct.pack("!L", self.config))
14273 packed.append(struct.pack("!L", self.mask))
14274 packed.append(loxi.generic_util.pack_list(self.properties))
14275 length = sum([len(x) for x in packed])
14276 packed[2] = struct.pack("!H", length)
14277 return ''.join(packed)
14278
14279 @staticmethod
14280 def unpack(reader):
14281 obj = port_mod()
14282 _version = reader.read("!B")[0]
14283 assert(_version == 5)
14284 _type = reader.read("!B")[0]
14285 assert(_type == 16)
14286 _length = reader.read("!H")[0]
14287 orig_reader = reader
14288 reader = orig_reader.slice(_length, 4)
14289 obj.xid = reader.read("!L")[0]
14290 obj.port_no = util.unpack_port_no(reader)
14291 reader.skip(4)
14292 obj.hw_addr = list(reader.read('!6B'))
14293 reader.skip(2)
14294 obj.config = reader.read("!L")[0]
14295 obj.mask = reader.read("!L")[0]
14296 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_mod_prop.port_mod_prop.unpack)
14297 return obj
14298
14299 def __eq__(self, other):
14300 if type(self) != type(other): return False
14301 if self.xid != other.xid: return False
14302 if self.port_no != other.port_no: return False
14303 if self.hw_addr != other.hw_addr: return False
14304 if self.config != other.config: return False
14305 if self.mask != other.mask: return False
14306 if self.properties != other.properties: return False
14307 return True
14308
14309 def pretty_print(self, q):
14310 q.text("port_mod {")
14311 with q.group():
14312 with q.indent(2):
14313 q.breakable()
14314 q.text("xid = ");
14315 if self.xid != None:
14316 q.text("%#x" % self.xid)
14317 else:
14318 q.text('None')
14319 q.text(","); q.breakable()
14320 q.text("port_no = ");
14321 q.text(util.pretty_port(self.port_no))
14322 q.text(","); q.breakable()
14323 q.text("hw_addr = ");
14324 q.text(util.pretty_mac(self.hw_addr))
14325 q.text(","); q.breakable()
14326 q.text("config = ");
14327 q.text("%#x" % self.config)
14328 q.text(","); q.breakable()
14329 q.text("mask = ");
14330 q.text("%#x" % self.mask)
14331 q.text(","); q.breakable()
14332 q.text("properties = ");
14333 q.pp(self.properties)
14334 q.breakable()
14335 q.text('}')
14336
14337message.subtypes[16] = port_mod
14338
14339class port_mod_failed_error_msg(error_msg):
14340 version = 5
14341 type = 1
14342 err_type = 7
14343
14344 def __init__(self, xid=None, code=None, data=None):
14345 if xid != None:
14346 self.xid = xid
14347 else:
14348 self.xid = None
14349 if code != None:
14350 self.code = code
14351 else:
14352 self.code = 0
14353 if data != None:
14354 self.data = data
14355 else:
14356 self.data = ''
14357 return
14358
14359 def pack(self):
14360 packed = []
14361 packed.append(struct.pack("!B", self.version))
14362 packed.append(struct.pack("!B", self.type))
14363 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14364 packed.append(struct.pack("!L", self.xid))
14365 packed.append(struct.pack("!H", self.err_type))
14366 packed.append(struct.pack("!H", self.code))
14367 packed.append(self.data)
14368 length = sum([len(x) for x in packed])
14369 packed[2] = struct.pack("!H", length)
14370 return ''.join(packed)
14371
14372 @staticmethod
14373 def unpack(reader):
14374 obj = port_mod_failed_error_msg()
14375 _version = reader.read("!B")[0]
14376 assert(_version == 5)
14377 _type = reader.read("!B")[0]
14378 assert(_type == 1)
14379 _length = reader.read("!H")[0]
14380 orig_reader = reader
14381 reader = orig_reader.slice(_length, 4)
14382 obj.xid = reader.read("!L")[0]
14383 _err_type = reader.read("!H")[0]
14384 assert(_err_type == 7)
14385 obj.code = reader.read("!H")[0]
14386 obj.data = str(reader.read_all())
14387 return obj
14388
14389 def __eq__(self, other):
14390 if type(self) != type(other): return False
14391 if self.xid != other.xid: return False
14392 if self.code != other.code: return False
14393 if self.data != other.data: return False
14394 return True
14395
14396 def pretty_print(self, q):
14397 q.text("port_mod_failed_error_msg {")
14398 with q.group():
14399 with q.indent(2):
14400 q.breakable()
14401 q.text("xid = ");
14402 if self.xid != None:
14403 q.text("%#x" % self.xid)
14404 else:
14405 q.text('None')
14406 q.text(","); q.breakable()
14407 q.text("code = ");
14408 q.text("%#x" % self.code)
14409 q.text(","); q.breakable()
14410 q.text("data = ");
14411 q.pp(self.data)
14412 q.breakable()
14413 q.text('}')
14414
14415error_msg.subtypes[7] = port_mod_failed_error_msg
14416
14417class port_stats_reply(stats_reply):
14418 version = 5
14419 type = 19
14420 stats_type = 4
14421
14422 def __init__(self, xid=None, flags=None, entries=None):
14423 if xid != None:
14424 self.xid = xid
14425 else:
14426 self.xid = None
14427 if flags != None:
14428 self.flags = flags
14429 else:
14430 self.flags = 0
14431 if entries != None:
14432 self.entries = entries
14433 else:
14434 self.entries = []
14435 return
14436
14437 def pack(self):
14438 packed = []
14439 packed.append(struct.pack("!B", self.version))
14440 packed.append(struct.pack("!B", self.type))
14441 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14442 packed.append(struct.pack("!L", self.xid))
14443 packed.append(struct.pack("!H", self.stats_type))
14444 packed.append(struct.pack("!H", self.flags))
14445 packed.append('\x00' * 4)
14446 packed.append(loxi.generic_util.pack_list(self.entries))
14447 length = sum([len(x) for x in packed])
14448 packed[2] = struct.pack("!H", length)
14449 return ''.join(packed)
14450
14451 @staticmethod
14452 def unpack(reader):
14453 obj = port_stats_reply()
14454 _version = reader.read("!B")[0]
14455 assert(_version == 5)
14456 _type = reader.read("!B")[0]
14457 assert(_type == 19)
14458 _length = reader.read("!H")[0]
14459 orig_reader = reader
14460 reader = orig_reader.slice(_length, 4)
14461 obj.xid = reader.read("!L")[0]
14462 _stats_type = reader.read("!H")[0]
14463 assert(_stats_type == 4)
14464 obj.flags = reader.read("!H")[0]
14465 reader.skip(4)
14466 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
14467 return obj
14468
14469 def __eq__(self, other):
14470 if type(self) != type(other): return False
14471 if self.xid != other.xid: return False
14472 if self.flags != other.flags: return False
14473 if self.entries != other.entries: return False
14474 return True
14475
14476 def pretty_print(self, q):
14477 q.text("port_stats_reply {")
14478 with q.group():
14479 with q.indent(2):
14480 q.breakable()
14481 q.text("xid = ");
14482 if self.xid != None:
14483 q.text("%#x" % self.xid)
14484 else:
14485 q.text('None')
14486 q.text(","); q.breakable()
14487 q.text("flags = ");
14488 q.text("%#x" % self.flags)
14489 q.text(","); q.breakable()
14490 q.text("entries = ");
14491 q.pp(self.entries)
14492 q.breakable()
14493 q.text('}')
14494
14495stats_reply.subtypes[4] = port_stats_reply
14496
14497class port_stats_request(stats_request):
14498 version = 5
14499 type = 18
14500 stats_type = 4
14501
14502 def __init__(self, xid=None, flags=None, port_no=None):
14503 if xid != None:
14504 self.xid = xid
14505 else:
14506 self.xid = None
14507 if flags != None:
14508 self.flags = flags
14509 else:
14510 self.flags = 0
14511 if port_no != None:
14512 self.port_no = port_no
14513 else:
14514 self.port_no = 0
14515 return
14516
14517 def pack(self):
14518 packed = []
14519 packed.append(struct.pack("!B", self.version))
14520 packed.append(struct.pack("!B", self.type))
14521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14522 packed.append(struct.pack("!L", self.xid))
14523 packed.append(struct.pack("!H", self.stats_type))
14524 packed.append(struct.pack("!H", self.flags))
14525 packed.append('\x00' * 4)
14526 packed.append(util.pack_port_no(self.port_no))
14527 packed.append('\x00' * 4)
14528 length = sum([len(x) for x in packed])
14529 packed[2] = struct.pack("!H", length)
14530 return ''.join(packed)
14531
14532 @staticmethod
14533 def unpack(reader):
14534 obj = port_stats_request()
14535 _version = reader.read("!B")[0]
14536 assert(_version == 5)
14537 _type = reader.read("!B")[0]
14538 assert(_type == 18)
14539 _length = reader.read("!H")[0]
14540 orig_reader = reader
14541 reader = orig_reader.slice(_length, 4)
14542 obj.xid = reader.read("!L")[0]
14543 _stats_type = reader.read("!H")[0]
14544 assert(_stats_type == 4)
14545 obj.flags = reader.read("!H")[0]
14546 reader.skip(4)
14547 obj.port_no = util.unpack_port_no(reader)
14548 reader.skip(4)
14549 return obj
14550
14551 def __eq__(self, other):
14552 if type(self) != type(other): return False
14553 if self.xid != other.xid: return False
14554 if self.flags != other.flags: return False
14555 if self.port_no != other.port_no: return False
14556 return True
14557
14558 def pretty_print(self, q):
14559 q.text("port_stats_request {")
14560 with q.group():
14561 with q.indent(2):
14562 q.breakable()
14563 q.text("xid = ");
14564 if self.xid != None:
14565 q.text("%#x" % self.xid)
14566 else:
14567 q.text('None')
14568 q.text(","); q.breakable()
14569 q.text("flags = ");
14570 q.text("%#x" % self.flags)
14571 q.text(","); q.breakable()
14572 q.text("port_no = ");
14573 q.text(util.pretty_port(self.port_no))
14574 q.breakable()
14575 q.text('}')
14576
14577stats_request.subtypes[4] = port_stats_request
14578
14579class port_status(message):
14580 version = 5
14581 type = 12
14582
14583 def __init__(self, xid=None, reason=None, desc=None):
14584 if xid != None:
14585 self.xid = xid
14586 else:
14587 self.xid = None
14588 if reason != None:
14589 self.reason = reason
14590 else:
14591 self.reason = 0
14592 if desc != None:
14593 self.desc = desc
14594 else:
14595 self.desc = ofp.port_desc()
14596 return
14597
14598 def pack(self):
14599 packed = []
14600 packed.append(struct.pack("!B", self.version))
14601 packed.append(struct.pack("!B", self.type))
14602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14603 packed.append(struct.pack("!L", self.xid))
14604 packed.append(struct.pack("!B", self.reason))
14605 packed.append('\x00' * 7)
14606 packed.append(self.desc.pack())
14607 length = sum([len(x) for x in packed])
14608 packed[2] = struct.pack("!H", length)
14609 return ''.join(packed)
14610
14611 @staticmethod
14612 def unpack(reader):
14613 obj = port_status()
14614 _version = reader.read("!B")[0]
14615 assert(_version == 5)
14616 _type = reader.read("!B")[0]
14617 assert(_type == 12)
14618 _length = reader.read("!H")[0]
14619 orig_reader = reader
14620 reader = orig_reader.slice(_length, 4)
14621 obj.xid = reader.read("!L")[0]
14622 obj.reason = reader.read("!B")[0]
14623 reader.skip(7)
14624 obj.desc = ofp.port_desc.unpack(reader)
14625 return obj
14626
14627 def __eq__(self, other):
14628 if type(self) != type(other): return False
14629 if self.xid != other.xid: return False
14630 if self.reason != other.reason: return False
14631 if self.desc != other.desc: return False
14632 return True
14633
14634 def pretty_print(self, q):
14635 q.text("port_status {")
14636 with q.group():
14637 with q.indent(2):
14638 q.breakable()
14639 q.text("xid = ");
14640 if self.xid != None:
14641 q.text("%#x" % self.xid)
14642 else:
14643 q.text('None')
14644 q.text(","); q.breakable()
14645 q.text("reason = ");
14646 q.text("%#x" % self.reason)
14647 q.text(","); q.breakable()
14648 q.text("desc = ");
14649 q.pp(self.desc)
14650 q.breakable()
14651 q.text('}')
14652
14653message.subtypes[12] = port_status
14654
14655class queue_desc_stats_reply(stats_reply):
14656 version = 5
14657 type = 19
14658 stats_type = 15
14659
14660 def __init__(self, xid=None, flags=None, entries=None):
14661 if xid != None:
14662 self.xid = xid
14663 else:
14664 self.xid = None
14665 if flags != None:
14666 self.flags = flags
14667 else:
14668 self.flags = 0
14669 if entries != None:
14670 self.entries = entries
14671 else:
14672 self.entries = []
14673 return
14674
14675 def pack(self):
14676 packed = []
14677 packed.append(struct.pack("!B", self.version))
14678 packed.append(struct.pack("!B", self.type))
14679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14680 packed.append(struct.pack("!L", self.xid))
14681 packed.append(struct.pack("!H", self.stats_type))
14682 packed.append(struct.pack("!H", self.flags))
14683 packed.append('\x00' * 4)
14684 packed.append(loxi.generic_util.pack_list(self.entries))
14685 length = sum([len(x) for x in packed])
14686 packed[2] = struct.pack("!H", length)
14687 return ''.join(packed)
14688
14689 @staticmethod
14690 def unpack(reader):
14691 obj = queue_desc_stats_reply()
14692 _version = reader.read("!B")[0]
14693 assert(_version == 5)
14694 _type = reader.read("!B")[0]
14695 assert(_type == 19)
14696 _length = reader.read("!H")[0]
14697 orig_reader = reader
14698 reader = orig_reader.slice(_length, 4)
14699 obj.xid = reader.read("!L")[0]
14700 _stats_type = reader.read("!H")[0]
14701 assert(_stats_type == 15)
14702 obj.flags = reader.read("!H")[0]
14703 reader.skip(4)
14704 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_desc.unpack)
14705 return obj
14706
14707 def __eq__(self, other):
14708 if type(self) != type(other): return False
14709 if self.xid != other.xid: return False
14710 if self.flags != other.flags: return False
14711 if self.entries != other.entries: return False
14712 return True
14713
14714 def pretty_print(self, q):
14715 q.text("queue_desc_stats_reply {")
14716 with q.group():
14717 with q.indent(2):
14718 q.breakable()
14719 q.text("xid = ");
14720 if self.xid != None:
14721 q.text("%#x" % self.xid)
14722 else:
14723 q.text('None')
14724 q.text(","); q.breakable()
14725 q.text("flags = ");
14726 q.text("%#x" % self.flags)
14727 q.text(","); q.breakable()
14728 q.text("entries = ");
14729 q.pp(self.entries)
14730 q.breakable()
14731 q.text('}')
14732
14733stats_reply.subtypes[15] = queue_desc_stats_reply
14734
14735class queue_desc_stats_request(stats_request):
14736 version = 5
14737 type = 18
14738 stats_type = 15
14739
14740 def __init__(self, xid=None, flags=None):
14741 if xid != None:
14742 self.xid = xid
14743 else:
14744 self.xid = None
14745 if flags != None:
14746 self.flags = flags
14747 else:
14748 self.flags = 0
14749 return
14750
14751 def pack(self):
14752 packed = []
14753 packed.append(struct.pack("!B", self.version))
14754 packed.append(struct.pack("!B", self.type))
14755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14756 packed.append(struct.pack("!L", self.xid))
14757 packed.append(struct.pack("!H", self.stats_type))
14758 packed.append(struct.pack("!H", self.flags))
14759 packed.append('\x00' * 4)
14760 length = sum([len(x) for x in packed])
14761 packed[2] = struct.pack("!H", length)
14762 return ''.join(packed)
14763
14764 @staticmethod
14765 def unpack(reader):
14766 obj = queue_desc_stats_request()
14767 _version = reader.read("!B")[0]
14768 assert(_version == 5)
14769 _type = reader.read("!B")[0]
14770 assert(_type == 18)
14771 _length = reader.read("!H")[0]
14772 orig_reader = reader
14773 reader = orig_reader.slice(_length, 4)
14774 obj.xid = reader.read("!L")[0]
14775 _stats_type = reader.read("!H")[0]
14776 assert(_stats_type == 15)
14777 obj.flags = reader.read("!H")[0]
14778 reader.skip(4)
14779 return obj
14780
14781 def __eq__(self, other):
14782 if type(self) != type(other): return False
14783 if self.xid != other.xid: return False
14784 if self.flags != other.flags: return False
14785 return True
14786
14787 def pretty_print(self, q):
14788 q.text("queue_desc_stats_request {")
14789 with q.group():
14790 with q.indent(2):
14791 q.breakable()
14792 q.text("xid = ");
14793 if self.xid != None:
14794 q.text("%#x" % self.xid)
14795 else:
14796 q.text('None')
14797 q.text(","); q.breakable()
14798 q.text("flags = ");
14799 q.text("%#x" % self.flags)
14800 q.breakable()
14801 q.text('}')
14802
14803stats_request.subtypes[15] = queue_desc_stats_request
14804
14805class queue_op_failed_error_msg(error_msg):
14806 version = 5
14807 type = 1
14808 err_type = 9
14809
14810 def __init__(self, xid=None, code=None, data=None):
14811 if xid != None:
14812 self.xid = xid
14813 else:
14814 self.xid = None
14815 if code != None:
14816 self.code = code
14817 else:
14818 self.code = 0
14819 if data != None:
14820 self.data = data
14821 else:
14822 self.data = ''
14823 return
14824
14825 def pack(self):
14826 packed = []
14827 packed.append(struct.pack("!B", self.version))
14828 packed.append(struct.pack("!B", self.type))
14829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14830 packed.append(struct.pack("!L", self.xid))
14831 packed.append(struct.pack("!H", self.err_type))
14832 packed.append(struct.pack("!H", self.code))
14833 packed.append(self.data)
14834 length = sum([len(x) for x in packed])
14835 packed[2] = struct.pack("!H", length)
14836 return ''.join(packed)
14837
14838 @staticmethod
14839 def unpack(reader):
14840 obj = queue_op_failed_error_msg()
14841 _version = reader.read("!B")[0]
14842 assert(_version == 5)
14843 _type = reader.read("!B")[0]
14844 assert(_type == 1)
14845 _length = reader.read("!H")[0]
14846 orig_reader = reader
14847 reader = orig_reader.slice(_length, 4)
14848 obj.xid = reader.read("!L")[0]
14849 _err_type = reader.read("!H")[0]
14850 assert(_err_type == 9)
14851 obj.code = reader.read("!H")[0]
14852 obj.data = str(reader.read_all())
14853 return obj
14854
14855 def __eq__(self, other):
14856 if type(self) != type(other): return False
14857 if self.xid != other.xid: return False
14858 if self.code != other.code: return False
14859 if self.data != other.data: return False
14860 return True
14861
14862 def pretty_print(self, q):
14863 q.text("queue_op_failed_error_msg {")
14864 with q.group():
14865 with q.indent(2):
14866 q.breakable()
14867 q.text("xid = ");
14868 if self.xid != None:
14869 q.text("%#x" % self.xid)
14870 else:
14871 q.text('None')
14872 q.text(","); q.breakable()
14873 q.text("code = ");
14874 q.text("%#x" % self.code)
14875 q.text(","); q.breakable()
14876 q.text("data = ");
14877 q.pp(self.data)
14878 q.breakable()
14879 q.text('}')
14880
14881error_msg.subtypes[9] = queue_op_failed_error_msg
14882
14883class queue_stats_reply(stats_reply):
14884 version = 5
14885 type = 19
14886 stats_type = 5
14887
14888 def __init__(self, xid=None, flags=None, entries=None):
14889 if xid != None:
14890 self.xid = xid
14891 else:
14892 self.xid = None
14893 if flags != None:
14894 self.flags = flags
14895 else:
14896 self.flags = 0
14897 if entries != None:
14898 self.entries = entries
14899 else:
14900 self.entries = []
14901 return
14902
14903 def pack(self):
14904 packed = []
14905 packed.append(struct.pack("!B", self.version))
14906 packed.append(struct.pack("!B", self.type))
14907 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14908 packed.append(struct.pack("!L", self.xid))
14909 packed.append(struct.pack("!H", self.stats_type))
14910 packed.append(struct.pack("!H", self.flags))
14911 packed.append('\x00' * 4)
14912 packed.append(loxi.generic_util.pack_list(self.entries))
14913 length = sum([len(x) for x in packed])
14914 packed[2] = struct.pack("!H", length)
14915 return ''.join(packed)
14916
14917 @staticmethod
14918 def unpack(reader):
14919 obj = queue_stats_reply()
14920 _version = reader.read("!B")[0]
14921 assert(_version == 5)
14922 _type = reader.read("!B")[0]
14923 assert(_type == 19)
14924 _length = reader.read("!H")[0]
14925 orig_reader = reader
14926 reader = orig_reader.slice(_length, 4)
14927 obj.xid = reader.read("!L")[0]
14928 _stats_type = reader.read("!H")[0]
14929 assert(_stats_type == 5)
14930 obj.flags = reader.read("!H")[0]
14931 reader.skip(4)
14932 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
14933 return obj
14934
14935 def __eq__(self, other):
14936 if type(self) != type(other): return False
14937 if self.xid != other.xid: return False
14938 if self.flags != other.flags: return False
14939 if self.entries != other.entries: return False
14940 return True
14941
14942 def pretty_print(self, q):
14943 q.text("queue_stats_reply {")
14944 with q.group():
14945 with q.indent(2):
14946 q.breakable()
14947 q.text("xid = ");
14948 if self.xid != None:
14949 q.text("%#x" % self.xid)
14950 else:
14951 q.text('None')
14952 q.text(","); q.breakable()
14953 q.text("flags = ");
14954 q.text("%#x" % self.flags)
14955 q.text(","); q.breakable()
14956 q.text("entries = ");
14957 q.pp(self.entries)
14958 q.breakable()
14959 q.text('}')
14960
14961stats_reply.subtypes[5] = queue_stats_reply
14962
14963class queue_stats_request(stats_request):
14964 version = 5
14965 type = 18
14966 stats_type = 5
14967
14968 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14969 if xid != None:
14970 self.xid = xid
14971 else:
14972 self.xid = None
14973 if flags != None:
14974 self.flags = flags
14975 else:
14976 self.flags = 0
14977 if port_no != None:
14978 self.port_no = port_no
14979 else:
14980 self.port_no = 0
14981 if queue_id != None:
14982 self.queue_id = queue_id
14983 else:
14984 self.queue_id = 0
14985 return
14986
14987 def pack(self):
14988 packed = []
14989 packed.append(struct.pack("!B", self.version))
14990 packed.append(struct.pack("!B", self.type))
14991 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14992 packed.append(struct.pack("!L", self.xid))
14993 packed.append(struct.pack("!H", self.stats_type))
14994 packed.append(struct.pack("!H", self.flags))
14995 packed.append('\x00' * 4)
14996 packed.append(util.pack_port_no(self.port_no))
14997 packed.append(struct.pack("!L", self.queue_id))
14998 length = sum([len(x) for x in packed])
14999 packed[2] = struct.pack("!H", length)
15000 return ''.join(packed)
15001
15002 @staticmethod
15003 def unpack(reader):
15004 obj = queue_stats_request()
15005 _version = reader.read("!B")[0]
15006 assert(_version == 5)
15007 _type = reader.read("!B")[0]
15008 assert(_type == 18)
15009 _length = reader.read("!H")[0]
15010 orig_reader = reader
15011 reader = orig_reader.slice(_length, 4)
15012 obj.xid = reader.read("!L")[0]
15013 _stats_type = reader.read("!H")[0]
15014 assert(_stats_type == 5)
15015 obj.flags = reader.read("!H")[0]
15016 reader.skip(4)
15017 obj.port_no = util.unpack_port_no(reader)
15018 obj.queue_id = reader.read("!L")[0]
15019 return obj
15020
15021 def __eq__(self, other):
15022 if type(self) != type(other): return False
15023 if self.xid != other.xid: return False
15024 if self.flags != other.flags: return False
15025 if self.port_no != other.port_no: return False
15026 if self.queue_id != other.queue_id: return False
15027 return True
15028
15029 def pretty_print(self, q):
15030 q.text("queue_stats_request {")
15031 with q.group():
15032 with q.indent(2):
15033 q.breakable()
15034 q.text("xid = ");
15035 if self.xid != None:
15036 q.text("%#x" % self.xid)
15037 else:
15038 q.text('None')
15039 q.text(","); q.breakable()
15040 q.text("flags = ");
15041 q.text("%#x" % self.flags)
15042 q.text(","); q.breakable()
15043 q.text("port_no = ");
15044 q.text(util.pretty_port(self.port_no))
15045 q.text(","); q.breakable()
15046 q.text("queue_id = ");
15047 q.text("%#x" % self.queue_id)
15048 q.breakable()
15049 q.text('}')
15050
15051stats_request.subtypes[5] = queue_stats_request
15052
15053class requestforward(message):
15054 version = 5
15055 type = 32
15056
15057 def __init__(self, xid=None, role=None, data=None):
15058 if xid != None:
15059 self.xid = xid
15060 else:
15061 self.xid = None
15062 if role != None:
15063 self.role = role
15064 else:
15065 self.role = 0
15066 if data != None:
15067 self.data = data
15068 else:
15069 self.data = ''
15070 return
15071
15072 def pack(self):
15073 packed = []
15074 packed.append(struct.pack("!B", self.version))
15075 packed.append(struct.pack("!B", self.type))
15076 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15077 packed.append(struct.pack("!L", self.xid))
15078 packed.append(struct.pack("!L", self.role))
15079 packed.append(self.data)
15080 length = sum([len(x) for x in packed])
15081 packed[2] = struct.pack("!H", length)
15082 return ''.join(packed)
15083
15084 @staticmethod
15085 def unpack(reader):
15086 obj = requestforward()
15087 _version = reader.read("!B")[0]
15088 assert(_version == 5)
15089 _type = reader.read("!B")[0]
15090 assert(_type == 32)
15091 _length = reader.read("!H")[0]
15092 orig_reader = reader
15093 reader = orig_reader.slice(_length, 4)
15094 obj.xid = reader.read("!L")[0]
15095 obj.role = reader.read("!L")[0]
15096 obj.data = str(reader.read_all())
15097 return obj
15098
15099 def __eq__(self, other):
15100 if type(self) != type(other): return False
15101 if self.xid != other.xid: return False
15102 if self.role != other.role: return False
15103 if self.data != other.data: return False
15104 return True
15105
15106 def pretty_print(self, q):
15107 q.text("requestforward {")
15108 with q.group():
15109 with q.indent(2):
15110 q.breakable()
15111 q.text("xid = ");
15112 if self.xid != None:
15113 q.text("%#x" % self.xid)
15114 else:
15115 q.text('None')
15116 q.text(","); q.breakable()
15117 q.text("role = ");
15118 q.text("%#x" % self.role)
15119 q.text(","); q.breakable()
15120 q.text("data = ");
15121 q.pp(self.data)
15122 q.breakable()
15123 q.text('}')
15124
15125message.subtypes[32] = requestforward
15126
15127class role_reply(message):
15128 version = 5
15129 type = 25
15130
15131 def __init__(self, xid=None, role=None, generation_id=None):
15132 if xid != None:
15133 self.xid = xid
15134 else:
15135 self.xid = None
15136 if role != None:
15137 self.role = role
15138 else:
15139 self.role = 0
15140 if generation_id != None:
15141 self.generation_id = generation_id
15142 else:
15143 self.generation_id = 0
15144 return
15145
15146 def pack(self):
15147 packed = []
15148 packed.append(struct.pack("!B", self.version))
15149 packed.append(struct.pack("!B", self.type))
15150 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15151 packed.append(struct.pack("!L", self.xid))
15152 packed.append(struct.pack("!L", self.role))
15153 packed.append('\x00' * 4)
15154 packed.append(struct.pack("!Q", self.generation_id))
15155 length = sum([len(x) for x in packed])
15156 packed[2] = struct.pack("!H", length)
15157 return ''.join(packed)
15158
15159 @staticmethod
15160 def unpack(reader):
15161 obj = role_reply()
15162 _version = reader.read("!B")[0]
15163 assert(_version == 5)
15164 _type = reader.read("!B")[0]
15165 assert(_type == 25)
15166 _length = reader.read("!H")[0]
15167 orig_reader = reader
15168 reader = orig_reader.slice(_length, 4)
15169 obj.xid = reader.read("!L")[0]
15170 obj.role = reader.read("!L")[0]
15171 reader.skip(4)
15172 obj.generation_id = reader.read("!Q")[0]
15173 return obj
15174
15175 def __eq__(self, other):
15176 if type(self) != type(other): return False
15177 if self.xid != other.xid: return False
15178 if self.role != other.role: return False
15179 if self.generation_id != other.generation_id: return False
15180 return True
15181
15182 def pretty_print(self, q):
15183 q.text("role_reply {")
15184 with q.group():
15185 with q.indent(2):
15186 q.breakable()
15187 q.text("xid = ");
15188 if self.xid != None:
15189 q.text("%#x" % self.xid)
15190 else:
15191 q.text('None')
15192 q.text(","); q.breakable()
15193 q.text("role = ");
15194 q.text("%#x" % self.role)
15195 q.text(","); q.breakable()
15196 q.text("generation_id = ");
15197 q.text("%#x" % self.generation_id)
15198 q.breakable()
15199 q.text('}')
15200
15201message.subtypes[25] = role_reply
15202
15203class role_request(message):
15204 version = 5
15205 type = 24
15206
15207 def __init__(self, xid=None, role=None, generation_id=None):
15208 if xid != None:
15209 self.xid = xid
15210 else:
15211 self.xid = None
15212 if role != None:
15213 self.role = role
15214 else:
15215 self.role = 0
15216 if generation_id != None:
15217 self.generation_id = generation_id
15218 else:
15219 self.generation_id = 0
15220 return
15221
15222 def pack(self):
15223 packed = []
15224 packed.append(struct.pack("!B", self.version))
15225 packed.append(struct.pack("!B", self.type))
15226 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15227 packed.append(struct.pack("!L", self.xid))
15228 packed.append(struct.pack("!L", self.role))
15229 packed.append('\x00' * 4)
15230 packed.append(struct.pack("!Q", self.generation_id))
15231 length = sum([len(x) for x in packed])
15232 packed[2] = struct.pack("!H", length)
15233 return ''.join(packed)
15234
15235 @staticmethod
15236 def unpack(reader):
15237 obj = role_request()
15238 _version = reader.read("!B")[0]
15239 assert(_version == 5)
15240 _type = reader.read("!B")[0]
15241 assert(_type == 24)
15242 _length = reader.read("!H")[0]
15243 orig_reader = reader
15244 reader = orig_reader.slice(_length, 4)
15245 obj.xid = reader.read("!L")[0]
15246 obj.role = reader.read("!L")[0]
15247 reader.skip(4)
15248 obj.generation_id = reader.read("!Q")[0]
15249 return obj
15250
15251 def __eq__(self, other):
15252 if type(self) != type(other): return False
15253 if self.xid != other.xid: return False
15254 if self.role != other.role: return False
15255 if self.generation_id != other.generation_id: return False
15256 return True
15257
15258 def pretty_print(self, q):
15259 q.text("role_request {")
15260 with q.group():
15261 with q.indent(2):
15262 q.breakable()
15263 q.text("xid = ");
15264 if self.xid != None:
15265 q.text("%#x" % self.xid)
15266 else:
15267 q.text('None')
15268 q.text(","); q.breakable()
15269 q.text("role = ");
15270 q.text("%#x" % self.role)
15271 q.text(","); q.breakable()
15272 q.text("generation_id = ");
15273 q.text("%#x" % self.generation_id)
15274 q.breakable()
15275 q.text('}')
15276
15277message.subtypes[24] = role_request
15278
15279class role_request_failed_error_msg(error_msg):
15280 version = 5
15281 type = 1
15282 err_type = 11
15283
15284 def __init__(self, xid=None, code=None, data=None):
15285 if xid != None:
15286 self.xid = xid
15287 else:
15288 self.xid = None
15289 if code != None:
15290 self.code = code
15291 else:
15292 self.code = 0
15293 if data != None:
15294 self.data = data
15295 else:
15296 self.data = ''
15297 return
15298
15299 def pack(self):
15300 packed = []
15301 packed.append(struct.pack("!B", self.version))
15302 packed.append(struct.pack("!B", self.type))
15303 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15304 packed.append(struct.pack("!L", self.xid))
15305 packed.append(struct.pack("!H", self.err_type))
15306 packed.append(struct.pack("!H", self.code))
15307 packed.append(self.data)
15308 length = sum([len(x) for x in packed])
15309 packed[2] = struct.pack("!H", length)
15310 return ''.join(packed)
15311
15312 @staticmethod
15313 def unpack(reader):
15314 obj = role_request_failed_error_msg()
15315 _version = reader.read("!B")[0]
15316 assert(_version == 5)
15317 _type = reader.read("!B")[0]
15318 assert(_type == 1)
15319 _length = reader.read("!H")[0]
15320 orig_reader = reader
15321 reader = orig_reader.slice(_length, 4)
15322 obj.xid = reader.read("!L")[0]
15323 _err_type = reader.read("!H")[0]
15324 assert(_err_type == 11)
15325 obj.code = reader.read("!H")[0]
15326 obj.data = str(reader.read_all())
15327 return obj
15328
15329 def __eq__(self, other):
15330 if type(self) != type(other): return False
15331 if self.xid != other.xid: return False
15332 if self.code != other.code: return False
15333 if self.data != other.data: return False
15334 return True
15335
15336 def pretty_print(self, q):
15337 q.text("role_request_failed_error_msg {")
15338 with q.group():
15339 with q.indent(2):
15340 q.breakable()
15341 q.text("xid = ");
15342 if self.xid != None:
15343 q.text("%#x" % self.xid)
15344 else:
15345 q.text('None')
15346 q.text(","); q.breakable()
15347 q.text("code = ");
15348 q.text("%#x" % self.code)
15349 q.text(","); q.breakable()
15350 q.text("data = ");
15351 q.pp(self.data)
15352 q.breakable()
15353 q.text('}')
15354
15355error_msg.subtypes[11] = role_request_failed_error_msg
15356
15357class role_status(message):
15358 version = 5
15359 type = 30
15360
15361 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
15362 if xid != None:
15363 self.xid = xid
15364 else:
15365 self.xid = None
15366 if role != None:
15367 self.role = role
15368 else:
15369 self.role = 0
15370 if reason != None:
15371 self.reason = reason
15372 else:
15373 self.reason = 0
15374 if generation_id != None:
15375 self.generation_id = generation_id
15376 else:
15377 self.generation_id = 0
15378 if properties != None:
15379 self.properties = properties
15380 else:
15381 self.properties = []
15382 return
15383
15384 def pack(self):
15385 packed = []
15386 packed.append(struct.pack("!B", self.version))
15387 packed.append(struct.pack("!B", self.type))
15388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15389 packed.append(struct.pack("!L", self.xid))
15390 packed.append(struct.pack("!L", self.role))
15391 packed.append(struct.pack("!B", self.reason))
15392 packed.append('\x00' * 3)
15393 packed.append(struct.pack("!Q", self.generation_id))
15394 packed.append(loxi.generic_util.pack_list(self.properties))
15395 length = sum([len(x) for x in packed])
15396 packed[2] = struct.pack("!H", length)
15397 return ''.join(packed)
15398
15399 @staticmethod
15400 def unpack(reader):
15401 obj = role_status()
15402 _version = reader.read("!B")[0]
15403 assert(_version == 5)
15404 _type = reader.read("!B")[0]
15405 assert(_type == 30)
15406 _length = reader.read("!H")[0]
15407 orig_reader = reader
15408 reader = orig_reader.slice(_length, 4)
15409 obj.xid = reader.read("!L")[0]
15410 obj.role = reader.read("!L")[0]
15411 obj.reason = reader.read("!B")[0]
15412 reader.skip(3)
15413 obj.generation_id = reader.read("!Q")[0]
15414 obj.properties = loxi.generic_util.unpack_list(reader, ofp.role_prop.role_prop.unpack)
15415 return obj
15416
15417 def __eq__(self, other):
15418 if type(self) != type(other): return False
15419 if self.xid != other.xid: return False
15420 if self.role != other.role: return False
15421 if self.reason != other.reason: return False
15422 if self.generation_id != other.generation_id: return False
15423 if self.properties != other.properties: return False
15424 return True
15425
15426 def pretty_print(self, q):
15427 q.text("role_status {")
15428 with q.group():
15429 with q.indent(2):
15430 q.breakable()
15431 q.text("xid = ");
15432 if self.xid != None:
15433 q.text("%#x" % self.xid)
15434 else:
15435 q.text('None')
15436 q.text(","); q.breakable()
15437 q.text("role = ");
15438 q.text("%#x" % self.role)
15439 q.text(","); q.breakable()
15440 q.text("reason = ");
15441 q.text("%#x" % self.reason)
15442 q.text(","); q.breakable()
15443 q.text("generation_id = ");
15444 q.text("%#x" % self.generation_id)
15445 q.text(","); q.breakable()
15446 q.text("properties = ");
15447 q.pp(self.properties)
15448 q.breakable()
15449 q.text('}')
15450
15451message.subtypes[30] = role_status
15452
15453class set_config(message):
15454 version = 5
15455 type = 9
15456
15457 def __init__(self, xid=None, flags=None, miss_send_len=None):
15458 if xid != None:
15459 self.xid = xid
15460 else:
15461 self.xid = None
15462 if flags != None:
15463 self.flags = flags
15464 else:
15465 self.flags = 0
15466 if miss_send_len != None:
15467 self.miss_send_len = miss_send_len
15468 else:
15469 self.miss_send_len = 0
15470 return
15471
15472 def pack(self):
15473 packed = []
15474 packed.append(struct.pack("!B", self.version))
15475 packed.append(struct.pack("!B", self.type))
15476 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15477 packed.append(struct.pack("!L", self.xid))
15478 packed.append(struct.pack("!H", self.flags))
15479 packed.append(struct.pack("!H", self.miss_send_len))
15480 length = sum([len(x) for x in packed])
15481 packed[2] = struct.pack("!H", length)
15482 return ''.join(packed)
15483
15484 @staticmethod
15485 def unpack(reader):
15486 obj = set_config()
15487 _version = reader.read("!B")[0]
15488 assert(_version == 5)
15489 _type = reader.read("!B")[0]
15490 assert(_type == 9)
15491 _length = reader.read("!H")[0]
15492 orig_reader = reader
15493 reader = orig_reader.slice(_length, 4)
15494 obj.xid = reader.read("!L")[0]
15495 obj.flags = reader.read("!H")[0]
15496 obj.miss_send_len = reader.read("!H")[0]
15497 return obj
15498
15499 def __eq__(self, other):
15500 if type(self) != type(other): return False
15501 if self.xid != other.xid: return False
15502 if self.flags != other.flags: return False
15503 if self.miss_send_len != other.miss_send_len: return False
15504 return True
15505
15506 def pretty_print(self, q):
15507 q.text("set_config {")
15508 with q.group():
15509 with q.indent(2):
15510 q.breakable()
15511 q.text("xid = ");
15512 if self.xid != None:
15513 q.text("%#x" % self.xid)
15514 else:
15515 q.text('None')
15516 q.text(","); q.breakable()
15517 q.text("flags = ");
15518 q.text("%#x" % self.flags)
15519 q.text(","); q.breakable()
15520 q.text("miss_send_len = ");
15521 q.text("%#x" % self.miss_send_len)
15522 q.breakable()
15523 q.text('}')
15524
15525message.subtypes[9] = set_config
15526
15527class switch_config_failed_error_msg(error_msg):
15528 version = 5
15529 type = 1
15530 err_type = 10
15531
15532 def __init__(self, xid=None, code=None, data=None):
15533 if xid != None:
15534 self.xid = xid
15535 else:
15536 self.xid = None
15537 if code != None:
15538 self.code = code
15539 else:
15540 self.code = 0
15541 if data != None:
15542 self.data = data
15543 else:
15544 self.data = ''
15545 return
15546
15547 def pack(self):
15548 packed = []
15549 packed.append(struct.pack("!B", self.version))
15550 packed.append(struct.pack("!B", self.type))
15551 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15552 packed.append(struct.pack("!L", self.xid))
15553 packed.append(struct.pack("!H", self.err_type))
15554 packed.append(struct.pack("!H", self.code))
15555 packed.append(self.data)
15556 length = sum([len(x) for x in packed])
15557 packed[2] = struct.pack("!H", length)
15558 return ''.join(packed)
15559
15560 @staticmethod
15561 def unpack(reader):
15562 obj = switch_config_failed_error_msg()
15563 _version = reader.read("!B")[0]
15564 assert(_version == 5)
15565 _type = reader.read("!B")[0]
15566 assert(_type == 1)
15567 _length = reader.read("!H")[0]
15568 orig_reader = reader
15569 reader = orig_reader.slice(_length, 4)
15570 obj.xid = reader.read("!L")[0]
15571 _err_type = reader.read("!H")[0]
15572 assert(_err_type == 10)
15573 obj.code = reader.read("!H")[0]
15574 obj.data = str(reader.read_all())
15575 return obj
15576
15577 def __eq__(self, other):
15578 if type(self) != type(other): return False
15579 if self.xid != other.xid: return False
15580 if self.code != other.code: return False
15581 if self.data != other.data: return False
15582 return True
15583
15584 def pretty_print(self, q):
15585 q.text("switch_config_failed_error_msg {")
15586 with q.group():
15587 with q.indent(2):
15588 q.breakable()
15589 q.text("xid = ");
15590 if self.xid != None:
15591 q.text("%#x" % self.xid)
15592 else:
15593 q.text('None')
15594 q.text(","); q.breakable()
15595 q.text("code = ");
15596 q.text("%#x" % self.code)
15597 q.text(","); q.breakable()
15598 q.text("data = ");
15599 q.pp(self.data)
15600 q.breakable()
15601 q.text('}')
15602
15603error_msg.subtypes[10] = switch_config_failed_error_msg
15604
15605class table_desc_stats_reply(stats_reply):
15606 version = 5
15607 type = 19
15608 stats_type = 14
15609
15610 def __init__(self, xid=None, flags=None, entries=None):
15611 if xid != None:
15612 self.xid = xid
15613 else:
15614 self.xid = None
15615 if flags != None:
15616 self.flags = flags
15617 else:
15618 self.flags = 0
15619 if entries != None:
15620 self.entries = entries
15621 else:
15622 self.entries = []
15623 return
15624
15625 def pack(self):
15626 packed = []
15627 packed.append(struct.pack("!B", self.version))
15628 packed.append(struct.pack("!B", self.type))
15629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15630 packed.append(struct.pack("!L", self.xid))
15631 packed.append(struct.pack("!H", self.stats_type))
15632 packed.append(struct.pack("!H", self.flags))
15633 packed.append('\x00' * 4)
15634 packed.append(loxi.generic_util.pack_list(self.entries))
15635 length = sum([len(x) for x in packed])
15636 packed[2] = struct.pack("!H", length)
15637 return ''.join(packed)
15638
15639 @staticmethod
15640 def unpack(reader):
15641 obj = table_desc_stats_reply()
15642 _version = reader.read("!B")[0]
15643 assert(_version == 5)
15644 _type = reader.read("!B")[0]
15645 assert(_type == 19)
15646 _length = reader.read("!H")[0]
15647 orig_reader = reader
15648 reader = orig_reader.slice(_length, 4)
15649 obj.xid = reader.read("!L")[0]
15650 _stats_type = reader.read("!H")[0]
15651 assert(_stats_type == 14)
15652 obj.flags = reader.read("!H")[0]
15653 reader.skip(4)
15654 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_desc.unpack)
15655 return obj
15656
15657 def __eq__(self, other):
15658 if type(self) != type(other): return False
15659 if self.xid != other.xid: return False
15660 if self.flags != other.flags: return False
15661 if self.entries != other.entries: return False
15662 return True
15663
15664 def pretty_print(self, q):
15665 q.text("table_desc_stats_reply {")
15666 with q.group():
15667 with q.indent(2):
15668 q.breakable()
15669 q.text("xid = ");
15670 if self.xid != None:
15671 q.text("%#x" % self.xid)
15672 else:
15673 q.text('None')
15674 q.text(","); q.breakable()
15675 q.text("flags = ");
15676 q.text("%#x" % self.flags)
15677 q.text(","); q.breakable()
15678 q.text("entries = ");
15679 q.pp(self.entries)
15680 q.breakable()
15681 q.text('}')
15682
15683stats_reply.subtypes[14] = table_desc_stats_reply
15684
15685class table_desc_stats_request(stats_request):
15686 version = 5
15687 type = 18
15688 stats_type = 14
15689
15690 def __init__(self, xid=None, flags=None):
15691 if xid != None:
15692 self.xid = xid
15693 else:
15694 self.xid = None
15695 if flags != None:
15696 self.flags = flags
15697 else:
15698 self.flags = 0
15699 return
15700
15701 def pack(self):
15702 packed = []
15703 packed.append(struct.pack("!B", self.version))
15704 packed.append(struct.pack("!B", self.type))
15705 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15706 packed.append(struct.pack("!L", self.xid))
15707 packed.append(struct.pack("!H", self.stats_type))
15708 packed.append(struct.pack("!H", self.flags))
15709 packed.append('\x00' * 4)
15710 length = sum([len(x) for x in packed])
15711 packed[2] = struct.pack("!H", length)
15712 return ''.join(packed)
15713
15714 @staticmethod
15715 def unpack(reader):
15716 obj = table_desc_stats_request()
15717 _version = reader.read("!B")[0]
15718 assert(_version == 5)
15719 _type = reader.read("!B")[0]
15720 assert(_type == 18)
15721 _length = reader.read("!H")[0]
15722 orig_reader = reader
15723 reader = orig_reader.slice(_length, 4)
15724 obj.xid = reader.read("!L")[0]
15725 _stats_type = reader.read("!H")[0]
15726 assert(_stats_type == 14)
15727 obj.flags = reader.read("!H")[0]
15728 reader.skip(4)
15729 return obj
15730
15731 def __eq__(self, other):
15732 if type(self) != type(other): return False
15733 if self.xid != other.xid: return False
15734 if self.flags != other.flags: return False
15735 return True
15736
15737 def pretty_print(self, q):
15738 q.text("table_desc_stats_request {")
15739 with q.group():
15740 with q.indent(2):
15741 q.breakable()
15742 q.text("xid = ");
15743 if self.xid != None:
15744 q.text("%#x" % self.xid)
15745 else:
15746 q.text('None')
15747 q.text(","); q.breakable()
15748 q.text("flags = ");
15749 q.text("%#x" % self.flags)
15750 q.breakable()
15751 q.text('}')
15752
15753stats_request.subtypes[14] = table_desc_stats_request
15754
15755class table_features_failed_error_msg(error_msg):
15756 version = 5
15757 type = 1
15758 err_type = 13
15759
15760 def __init__(self, xid=None, code=None, data=None):
15761 if xid != None:
15762 self.xid = xid
15763 else:
15764 self.xid = None
15765 if code != None:
15766 self.code = code
15767 else:
15768 self.code = 0
15769 if data != None:
15770 self.data = data
15771 else:
15772 self.data = ''
15773 return
15774
15775 def pack(self):
15776 packed = []
15777 packed.append(struct.pack("!B", self.version))
15778 packed.append(struct.pack("!B", self.type))
15779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15780 packed.append(struct.pack("!L", self.xid))
15781 packed.append(struct.pack("!H", self.err_type))
15782 packed.append(struct.pack("!H", self.code))
15783 packed.append(self.data)
15784 length = sum([len(x) for x in packed])
15785 packed[2] = struct.pack("!H", length)
15786 return ''.join(packed)
15787
15788 @staticmethod
15789 def unpack(reader):
15790 obj = table_features_failed_error_msg()
15791 _version = reader.read("!B")[0]
15792 assert(_version == 5)
15793 _type = reader.read("!B")[0]
15794 assert(_type == 1)
15795 _length = reader.read("!H")[0]
15796 orig_reader = reader
15797 reader = orig_reader.slice(_length, 4)
15798 obj.xid = reader.read("!L")[0]
15799 _err_type = reader.read("!H")[0]
15800 assert(_err_type == 13)
15801 obj.code = reader.read("!H")[0]
15802 obj.data = str(reader.read_all())
15803 return obj
15804
15805 def __eq__(self, other):
15806 if type(self) != type(other): return False
15807 if self.xid != other.xid: return False
15808 if self.code != other.code: return False
15809 if self.data != other.data: return False
15810 return True
15811
15812 def pretty_print(self, q):
15813 q.text("table_features_failed_error_msg {")
15814 with q.group():
15815 with q.indent(2):
15816 q.breakable()
15817 q.text("xid = ");
15818 if self.xid != None:
15819 q.text("%#x" % self.xid)
15820 else:
15821 q.text('None')
15822 q.text(","); q.breakable()
15823 q.text("code = ");
15824 q.text("%#x" % self.code)
15825 q.text(","); q.breakable()
15826 q.text("data = ");
15827 q.pp(self.data)
15828 q.breakable()
15829 q.text('}')
15830
15831error_msg.subtypes[13] = table_features_failed_error_msg
15832
15833class table_features_stats_reply(stats_reply):
15834 version = 5
15835 type = 19
15836 stats_type = 12
15837
15838 def __init__(self, xid=None, flags=None, entries=None):
15839 if xid != None:
15840 self.xid = xid
15841 else:
15842 self.xid = None
15843 if flags != None:
15844 self.flags = flags
15845 else:
15846 self.flags = 0
15847 if entries != None:
15848 self.entries = entries
15849 else:
15850 self.entries = []
15851 return
15852
15853 def pack(self):
15854 packed = []
15855 packed.append(struct.pack("!B", self.version))
15856 packed.append(struct.pack("!B", self.type))
15857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15858 packed.append(struct.pack("!L", self.xid))
15859 packed.append(struct.pack("!H", self.stats_type))
15860 packed.append(struct.pack("!H", self.flags))
15861 packed.append('\x00' * 4)
15862 packed.append(loxi.generic_util.pack_list(self.entries))
15863 length = sum([len(x) for x in packed])
15864 packed[2] = struct.pack("!H", length)
15865 return ''.join(packed)
15866
15867 @staticmethod
15868 def unpack(reader):
15869 obj = table_features_stats_reply()
15870 _version = reader.read("!B")[0]
15871 assert(_version == 5)
15872 _type = reader.read("!B")[0]
15873 assert(_type == 19)
15874 _length = reader.read("!H")[0]
15875 orig_reader = reader
15876 reader = orig_reader.slice(_length, 4)
15877 obj.xid = reader.read("!L")[0]
15878 _stats_type = reader.read("!H")[0]
15879 assert(_stats_type == 12)
15880 obj.flags = reader.read("!H")[0]
15881 reader.skip(4)
15882 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
15883 return obj
15884
15885 def __eq__(self, other):
15886 if type(self) != type(other): return False
15887 if self.xid != other.xid: return False
15888 if self.flags != other.flags: return False
15889 if self.entries != other.entries: return False
15890 return True
15891
15892 def pretty_print(self, q):
15893 q.text("table_features_stats_reply {")
15894 with q.group():
15895 with q.indent(2):
15896 q.breakable()
15897 q.text("xid = ");
15898 if self.xid != None:
15899 q.text("%#x" % self.xid)
15900 else:
15901 q.text('None')
15902 q.text(","); q.breakable()
15903 q.text("flags = ");
15904 q.text("%#x" % self.flags)
15905 q.text(","); q.breakable()
15906 q.text("entries = ");
15907 q.pp(self.entries)
15908 q.breakable()
15909 q.text('}')
15910
15911stats_reply.subtypes[12] = table_features_stats_reply
15912
15913class table_features_stats_request(stats_request):
15914 version = 5
15915 type = 18
15916 stats_type = 12
15917
15918 def __init__(self, xid=None, flags=None, entries=None):
15919 if xid != None:
15920 self.xid = xid
15921 else:
15922 self.xid = None
15923 if flags != None:
15924 self.flags = flags
15925 else:
15926 self.flags = 0
15927 if entries != None:
15928 self.entries = entries
15929 else:
15930 self.entries = []
15931 return
15932
15933 def pack(self):
15934 packed = []
15935 packed.append(struct.pack("!B", self.version))
15936 packed.append(struct.pack("!B", self.type))
15937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15938 packed.append(struct.pack("!L", self.xid))
15939 packed.append(struct.pack("!H", self.stats_type))
15940 packed.append(struct.pack("!H", self.flags))
15941 packed.append('\x00' * 4)
15942 packed.append(loxi.generic_util.pack_list(self.entries))
15943 length = sum([len(x) for x in packed])
15944 packed[2] = struct.pack("!H", length)
15945 return ''.join(packed)
15946
15947 @staticmethod
15948 def unpack(reader):
15949 obj = table_features_stats_request()
15950 _version = reader.read("!B")[0]
15951 assert(_version == 5)
15952 _type = reader.read("!B")[0]
15953 assert(_type == 18)
15954 _length = reader.read("!H")[0]
15955 orig_reader = reader
15956 reader = orig_reader.slice(_length, 4)
15957 obj.xid = reader.read("!L")[0]
15958 _stats_type = reader.read("!H")[0]
15959 assert(_stats_type == 12)
15960 obj.flags = reader.read("!H")[0]
15961 reader.skip(4)
15962 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
15963 return obj
15964
15965 def __eq__(self, other):
15966 if type(self) != type(other): return False
15967 if self.xid != other.xid: return False
15968 if self.flags != other.flags: return False
15969 if self.entries != other.entries: return False
15970 return True
15971
15972 def pretty_print(self, q):
15973 q.text("table_features_stats_request {")
15974 with q.group():
15975 with q.indent(2):
15976 q.breakable()
15977 q.text("xid = ");
15978 if self.xid != None:
15979 q.text("%#x" % self.xid)
15980 else:
15981 q.text('None')
15982 q.text(","); q.breakable()
15983 q.text("flags = ");
15984 q.text("%#x" % self.flags)
15985 q.text(","); q.breakable()
15986 q.text("entries = ");
15987 q.pp(self.entries)
15988 q.breakable()
15989 q.text('}')
15990
15991stats_request.subtypes[12] = table_features_stats_request
15992
15993class table_mod(message):
15994 version = 5
15995 type = 17
15996
15997 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15998 if xid != None:
15999 self.xid = xid
16000 else:
16001 self.xid = None
16002 if table_id != None:
16003 self.table_id = table_id
16004 else:
16005 self.table_id = 0
16006 if config != None:
16007 self.config = config
16008 else:
16009 self.config = 0
16010 if properties != None:
16011 self.properties = properties
16012 else:
16013 self.properties = []
16014 return
16015
16016 def pack(self):
16017 packed = []
16018 packed.append(struct.pack("!B", self.version))
16019 packed.append(struct.pack("!B", self.type))
16020 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16021 packed.append(struct.pack("!L", self.xid))
16022 packed.append(struct.pack("!B", self.table_id))
16023 packed.append('\x00' * 3)
16024 packed.append(struct.pack("!L", self.config))
16025 packed.append(loxi.generic_util.pack_list(self.properties))
16026 length = sum([len(x) for x in packed])
16027 packed[2] = struct.pack("!H", length)
16028 return ''.join(packed)
16029
16030 @staticmethod
16031 def unpack(reader):
16032 obj = table_mod()
16033 _version = reader.read("!B")[0]
16034 assert(_version == 5)
16035 _type = reader.read("!B")[0]
16036 assert(_type == 17)
16037 _length = reader.read("!H")[0]
16038 orig_reader = reader
16039 reader = orig_reader.slice(_length, 4)
16040 obj.xid = reader.read("!L")[0]
16041 obj.table_id = reader.read("!B")[0]
16042 reader.skip(3)
16043 obj.config = reader.read("!L")[0]
16044 obj.properties = loxi.generic_util.unpack_list(reader, ofp.table_mod_prop.table_mod_prop.unpack)
16045 return obj
16046
16047 def __eq__(self, other):
16048 if type(self) != type(other): return False
16049 if self.xid != other.xid: return False
16050 if self.table_id != other.table_id: return False
16051 if self.config != other.config: return False
16052 if self.properties != other.properties: return False
16053 return True
16054
16055 def pretty_print(self, q):
16056 q.text("table_mod {")
16057 with q.group():
16058 with q.indent(2):
16059 q.breakable()
16060 q.text("xid = ");
16061 if self.xid != None:
16062 q.text("%#x" % self.xid)
16063 else:
16064 q.text('None')
16065 q.text(","); q.breakable()
16066 q.text("table_id = ");
16067 q.text("%#x" % self.table_id)
16068 q.text(","); q.breakable()
16069 q.text("config = ");
16070 q.text("%#x" % self.config)
16071 q.text(","); q.breakable()
16072 q.text("properties = ");
16073 q.pp(self.properties)
16074 q.breakable()
16075 q.text('}')
16076
16077message.subtypes[17] = table_mod
16078
16079class table_mod_failed_error_msg(error_msg):
16080 version = 5
16081 type = 1
16082 err_type = 8
16083
16084 def __init__(self, xid=None, code=None, data=None):
16085 if xid != None:
16086 self.xid = xid
16087 else:
16088 self.xid = None
16089 if code != None:
16090 self.code = code
16091 else:
16092 self.code = 0
16093 if data != None:
16094 self.data = data
16095 else:
16096 self.data = ''
16097 return
16098
16099 def pack(self):
16100 packed = []
16101 packed.append(struct.pack("!B", self.version))
16102 packed.append(struct.pack("!B", self.type))
16103 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16104 packed.append(struct.pack("!L", self.xid))
16105 packed.append(struct.pack("!H", self.err_type))
16106 packed.append(struct.pack("!H", self.code))
16107 packed.append(self.data)
16108 length = sum([len(x) for x in packed])
16109 packed[2] = struct.pack("!H", length)
16110 return ''.join(packed)
16111
16112 @staticmethod
16113 def unpack(reader):
16114 obj = table_mod_failed_error_msg()
16115 _version = reader.read("!B")[0]
16116 assert(_version == 5)
16117 _type = reader.read("!B")[0]
16118 assert(_type == 1)
16119 _length = reader.read("!H")[0]
16120 orig_reader = reader
16121 reader = orig_reader.slice(_length, 4)
16122 obj.xid = reader.read("!L")[0]
16123 _err_type = reader.read("!H")[0]
16124 assert(_err_type == 8)
16125 obj.code = reader.read("!H")[0]
16126 obj.data = str(reader.read_all())
16127 return obj
16128
16129 def __eq__(self, other):
16130 if type(self) != type(other): return False
16131 if self.xid != other.xid: return False
16132 if self.code != other.code: return False
16133 if self.data != other.data: return False
16134 return True
16135
16136 def pretty_print(self, q):
16137 q.text("table_mod_failed_error_msg {")
16138 with q.group():
16139 with q.indent(2):
16140 q.breakable()
16141 q.text("xid = ");
16142 if self.xid != None:
16143 q.text("%#x" % self.xid)
16144 else:
16145 q.text('None')
16146 q.text(","); q.breakable()
16147 q.text("code = ");
16148 q.text("%#x" % self.code)
16149 q.text(","); q.breakable()
16150 q.text("data = ");
16151 q.pp(self.data)
16152 q.breakable()
16153 q.text('}')
16154
16155error_msg.subtypes[8] = table_mod_failed_error_msg
16156
16157class table_stats_reply(stats_reply):
16158 version = 5
16159 type = 19
16160 stats_type = 3
16161
16162 def __init__(self, xid=None, flags=None, entries=None):
16163 if xid != None:
16164 self.xid = xid
16165 else:
16166 self.xid = None
16167 if flags != None:
16168 self.flags = flags
16169 else:
16170 self.flags = 0
16171 if entries != None:
16172 self.entries = entries
16173 else:
16174 self.entries = []
16175 return
16176
16177 def pack(self):
16178 packed = []
16179 packed.append(struct.pack("!B", self.version))
16180 packed.append(struct.pack("!B", self.type))
16181 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16182 packed.append(struct.pack("!L", self.xid))
16183 packed.append(struct.pack("!H", self.stats_type))
16184 packed.append(struct.pack("!H", self.flags))
16185 packed.append('\x00' * 4)
16186 packed.append(loxi.generic_util.pack_list(self.entries))
16187 length = sum([len(x) for x in packed])
16188 packed[2] = struct.pack("!H", length)
16189 return ''.join(packed)
16190
16191 @staticmethod
16192 def unpack(reader):
16193 obj = table_stats_reply()
16194 _version = reader.read("!B")[0]
16195 assert(_version == 5)
16196 _type = reader.read("!B")[0]
16197 assert(_type == 19)
16198 _length = reader.read("!H")[0]
16199 orig_reader = reader
16200 reader = orig_reader.slice(_length, 4)
16201 obj.xid = reader.read("!L")[0]
16202 _stats_type = reader.read("!H")[0]
16203 assert(_stats_type == 3)
16204 obj.flags = reader.read("!H")[0]
16205 reader.skip(4)
16206 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
16207 return obj
16208
16209 def __eq__(self, other):
16210 if type(self) != type(other): return False
16211 if self.xid != other.xid: return False
16212 if self.flags != other.flags: return False
16213 if self.entries != other.entries: return False
16214 return True
16215
16216 def pretty_print(self, q):
16217 q.text("table_stats_reply {")
16218 with q.group():
16219 with q.indent(2):
16220 q.breakable()
16221 q.text("xid = ");
16222 if self.xid != None:
16223 q.text("%#x" % self.xid)
16224 else:
16225 q.text('None')
16226 q.text(","); q.breakable()
16227 q.text("flags = ");
16228 q.text("%#x" % self.flags)
16229 q.text(","); q.breakable()
16230 q.text("entries = ");
16231 q.pp(self.entries)
16232 q.breakable()
16233 q.text('}')
16234
16235stats_reply.subtypes[3] = table_stats_reply
16236
16237class table_stats_request(stats_request):
16238 version = 5
16239 type = 18
16240 stats_type = 3
16241
16242 def __init__(self, xid=None, flags=None):
16243 if xid != None:
16244 self.xid = xid
16245 else:
16246 self.xid = None
16247 if flags != None:
16248 self.flags = flags
16249 else:
16250 self.flags = 0
16251 return
16252
16253 def pack(self):
16254 packed = []
16255 packed.append(struct.pack("!B", self.version))
16256 packed.append(struct.pack("!B", self.type))
16257 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16258 packed.append(struct.pack("!L", self.xid))
16259 packed.append(struct.pack("!H", self.stats_type))
16260 packed.append(struct.pack("!H", self.flags))
16261 packed.append('\x00' * 4)
16262 length = sum([len(x) for x in packed])
16263 packed[2] = struct.pack("!H", length)
16264 return ''.join(packed)
16265
16266 @staticmethod
16267 def unpack(reader):
16268 obj = table_stats_request()
16269 _version = reader.read("!B")[0]
16270 assert(_version == 5)
16271 _type = reader.read("!B")[0]
16272 assert(_type == 18)
16273 _length = reader.read("!H")[0]
16274 orig_reader = reader
16275 reader = orig_reader.slice(_length, 4)
16276 obj.xid = reader.read("!L")[0]
16277 _stats_type = reader.read("!H")[0]
16278 assert(_stats_type == 3)
16279 obj.flags = reader.read("!H")[0]
16280 reader.skip(4)
16281 return obj
16282
16283 def __eq__(self, other):
16284 if type(self) != type(other): return False
16285 if self.xid != other.xid: return False
16286 if self.flags != other.flags: return False
16287 return True
16288
16289 def pretty_print(self, q):
16290 q.text("table_stats_request {")
16291 with q.group():
16292 with q.indent(2):
16293 q.breakable()
16294 q.text("xid = ");
16295 if self.xid != None:
16296 q.text("%#x" % self.xid)
16297 else:
16298 q.text('None')
16299 q.text(","); q.breakable()
16300 q.text("flags = ");
16301 q.text("%#x" % self.flags)
16302 q.breakable()
16303 q.text('}')
16304
16305stats_request.subtypes[3] = table_stats_request
16306
16307class table_status(message):
16308 version = 5
16309 type = 31
16310
16311 def __init__(self, xid=None, role=None, reason=None, table=None):
16312 if xid != None:
16313 self.xid = xid
16314 else:
16315 self.xid = None
16316 if role != None:
16317 self.role = role
16318 else:
16319 self.role = 0
16320 if reason != None:
16321 self.reason = reason
16322 else:
16323 self.reason = 0
16324 if table != None:
16325 self.table = table
16326 else:
16327 self.table = ofp.table_desc()
16328 return
16329
16330 def pack(self):
16331 packed = []
16332 packed.append(struct.pack("!B", self.version))
16333 packed.append(struct.pack("!B", self.type))
16334 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
16335 packed.append(struct.pack("!L", self.xid))
16336 packed.append(struct.pack("!L", self.role))
16337 packed.append(struct.pack("!B", self.reason))
16338 packed.append('\x00' * 7)
16339 packed.append(self.table.pack())
16340 length = sum([len(x) for x in packed])
16341 packed[2] = struct.pack("!H", length)
16342 return ''.join(packed)
16343
16344 @staticmethod
16345 def unpack(reader):
16346 obj = table_status()
16347 _version = reader.read("!B")[0]
16348 assert(_version == 5)
16349 _type = reader.read("!B")[0]
16350 assert(_type == 31)
16351 _length = reader.read("!H")[0]
16352 orig_reader = reader
16353 reader = orig_reader.slice(_length, 4)
16354 obj.xid = reader.read("!L")[0]
16355 obj.role = reader.read("!L")[0]
16356 obj.reason = reader.read("!B")[0]
16357 reader.skip(7)
16358 obj.table = ofp.table_desc.unpack(reader)
16359 return obj
16360
16361 def __eq__(self, other):
16362 if type(self) != type(other): return False
16363 if self.xid != other.xid: return False
16364 if self.role != other.role: return False
16365 if self.reason != other.reason: return False
16366 if self.table != other.table: return False
16367 return True
16368
16369 def pretty_print(self, q):
16370 q.text("table_status {")
16371 with q.group():
16372 with q.indent(2):
16373 q.breakable()
16374 q.text("xid = ");
16375 if self.xid != None:
16376 q.text("%#x" % self.xid)
16377 else:
16378 q.text('None')
16379 q.text(","); q.breakable()
16380 q.text("role = ");
16381 q.text("%#x" % self.role)
16382 q.text(","); q.breakable()
16383 q.text("reason = ");
16384 q.text("%#x" % self.reason)
16385 q.text(","); q.breakable()
16386 q.text("table = ");
16387 q.pp(self.table)
16388 q.breakable()
16389 q.text('}')
16390
16391message.subtypes[31] = table_status
16392
16393
16394def parse_header(buf):
16395 if len(buf) < 8:
16396 raise loxi.ProtocolError("too short to be an OpenFlow message")
16397 return struct.unpack_from("!BBHL", buf)
16398
16399def parse_message(buf):
16400 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
16401 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
16402 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
16403 if len(buf) != msg_len:
16404 raise loxi.ProtocolError("incorrect message size")
16405 return message.unpack(loxi.generic_util.OFReader(buf))