blob: f0143c163ac9ebea9c50699ad5170236921f9fab [file] [log] [blame]
Nathan Knuth418fdc82016-09-16 22:51:15 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import util
12import loxi.generic_util
13
14import sys
15ofp = sys.modules['loxi.of13']
16
17class message(loxi.OFObject):
18 subtypes = {}
19
20 version = 4
21
22 def __init__(self, type=None, xid=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 if xid != None:
28 self.xid = xid
29 else:
30 self.xid = None
31 return
32
33 def pack(self):
34 packed = []
35 packed.append(struct.pack("!B", self.version))
36 packed.append(struct.pack("!B", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
38 packed.append(struct.pack("!L", self.xid))
39 length = sum([len(x) for x in packed])
40 packed[2] = struct.pack("!H", length)
41 return ''.join(packed)
42
43 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('B', 1)
46 subclass = message.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = message()
51 _version = reader.read("!B")[0]
52 assert(_version == 4)
53 obj.type = reader.read("!B")[0]
54 _length = reader.read("!H")[0]
55 orig_reader = reader
56 reader = orig_reader.slice(_length, 4)
57 obj.xid = reader.read("!L")[0]
58 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.type != other.type: return False
63 if self.xid != other.xid: return False
64 return True
65
66 def pretty_print(self, q):
67 q.text("message {")
68 with q.group():
69 with q.indent(2):
70 q.breakable()
71 q.text("xid = ");
72 if self.xid != None:
73 q.text("%#x" % self.xid)
74 else:
75 q.text('None')
76 q.breakable()
77 q.text('}')
78
79
80class stats_reply(message):
81 subtypes = {}
82
83 version = 4
84 type = 19
85
86 def __init__(self, xid=None, stats_type=None, flags=None):
87 if xid != None:
88 self.xid = xid
89 else:
90 self.xid = None
91 if stats_type != None:
92 self.stats_type = stats_type
93 else:
94 self.stats_type = 0
95 if flags != None:
96 self.flags = flags
97 else:
98 self.flags = 0
99 return
100
101 def pack(self):
102 packed = []
103 packed.append(struct.pack("!B", self.version))
104 packed.append(struct.pack("!B", self.type))
105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
106 packed.append(struct.pack("!L", self.xid))
107 packed.append(struct.pack("!H", self.stats_type))
108 packed.append(struct.pack("!H", self.flags))
109 packed.append('\x00' * 4)
110 length = sum([len(x) for x in packed])
111 packed[2] = struct.pack("!H", length)
112 return ''.join(packed)
113
114 @staticmethod
115 def unpack(reader):
116 subtype, = reader.peek('!H', 8)
117 subclass = stats_reply.subtypes.get(subtype)
118 if subclass:
119 return subclass.unpack(reader)
120
121 obj = stats_reply()
122 _version = reader.read("!B")[0]
123 assert(_version == 4)
124 _type = reader.read("!B")[0]
125 assert(_type == 19)
126 _length = reader.read("!H")[0]
127 orig_reader = reader
128 reader = orig_reader.slice(_length, 4)
129 obj.xid = reader.read("!L")[0]
130 obj.stats_type = reader.read("!H")[0]
131 obj.flags = reader.read("!H")[0]
132 reader.skip(4)
133 return obj
134
135 def __eq__(self, other):
136 if type(self) != type(other): return False
137 if self.xid != other.xid: return False
138 if self.stats_type != other.stats_type: return False
139 if self.flags != other.flags: return False
140 return True
141
142 def pretty_print(self, q):
143 q.text("stats_reply {")
144 with q.group():
145 with q.indent(2):
146 q.breakable()
147 q.text("xid = ");
148 if self.xid != None:
149 q.text("%#x" % self.xid)
150 else:
151 q.text('None')
152 q.text(","); q.breakable()
153 q.text("flags = ");
154 q.text("%#x" % self.flags)
155 q.breakable()
156 q.text('}')
157
158message.subtypes[19] = stats_reply
159
160class aggregate_stats_reply(stats_reply):
161 version = 4
162 type = 19
163 stats_type = 2
164
165 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
166 if xid != None:
167 self.xid = xid
168 else:
169 self.xid = None
170 if flags != None:
171 self.flags = flags
172 else:
173 self.flags = 0
174 if packet_count != None:
175 self.packet_count = packet_count
176 else:
177 self.packet_count = 0
178 if byte_count != None:
179 self.byte_count = byte_count
180 else:
181 self.byte_count = 0
182 if flow_count != None:
183 self.flow_count = flow_count
184 else:
185 self.flow_count = 0
186 return
187
188 def pack(self):
189 packed = []
190 packed.append(struct.pack("!B", self.version))
191 packed.append(struct.pack("!B", self.type))
192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
193 packed.append(struct.pack("!L", self.xid))
194 packed.append(struct.pack("!H", self.stats_type))
195 packed.append(struct.pack("!H", self.flags))
196 packed.append('\x00' * 4)
197 packed.append(struct.pack("!Q", self.packet_count))
198 packed.append(struct.pack("!Q", self.byte_count))
199 packed.append(struct.pack("!L", self.flow_count))
200 packed.append('\x00' * 4)
201 length = sum([len(x) for x in packed])
202 packed[2] = struct.pack("!H", length)
203 return ''.join(packed)
204
205 @staticmethod
206 def unpack(reader):
207 obj = aggregate_stats_reply()
208 _version = reader.read("!B")[0]
209 assert(_version == 4)
210 _type = reader.read("!B")[0]
211 assert(_type == 19)
212 _length = reader.read("!H")[0]
213 orig_reader = reader
214 reader = orig_reader.slice(_length, 4)
215 obj.xid = reader.read("!L")[0]
216 _stats_type = reader.read("!H")[0]
217 assert(_stats_type == 2)
218 obj.flags = reader.read("!H")[0]
219 reader.skip(4)
220 obj.packet_count = reader.read("!Q")[0]
221 obj.byte_count = reader.read("!Q")[0]
222 obj.flow_count = reader.read("!L")[0]
223 reader.skip(4)
224 return obj
225
226 def __eq__(self, other):
227 if type(self) != type(other): return False
228 if self.xid != other.xid: return False
229 if self.flags != other.flags: return False
230 if self.packet_count != other.packet_count: return False
231 if self.byte_count != other.byte_count: return False
232 if self.flow_count != other.flow_count: return False
233 return True
234
235 def pretty_print(self, q):
236 q.text("aggregate_stats_reply {")
237 with q.group():
238 with q.indent(2):
239 q.breakable()
240 q.text("xid = ");
241 if self.xid != None:
242 q.text("%#x" % self.xid)
243 else:
244 q.text('None')
245 q.text(","); q.breakable()
246 q.text("flags = ");
247 q.text("%#x" % self.flags)
248 q.text(","); q.breakable()
249 q.text("packet_count = ");
250 q.text("%#x" % self.packet_count)
251 q.text(","); q.breakable()
252 q.text("byte_count = ");
253 q.text("%#x" % self.byte_count)
254 q.text(","); q.breakable()
255 q.text("flow_count = ");
256 q.text("%#x" % self.flow_count)
257 q.breakable()
258 q.text('}')
259
260stats_reply.subtypes[2] = aggregate_stats_reply
261
262class stats_request(message):
263 subtypes = {}
264
265 version = 4
266 type = 18
267
268 def __init__(self, xid=None, stats_type=None, flags=None):
269 if xid != None:
270 self.xid = xid
271 else:
272 self.xid = None
273 if stats_type != None:
274 self.stats_type = stats_type
275 else:
276 self.stats_type = 0
277 if flags != None:
278 self.flags = flags
279 else:
280 self.flags = 0
281 return
282
283 def pack(self):
284 packed = []
285 packed.append(struct.pack("!B", self.version))
286 packed.append(struct.pack("!B", self.type))
287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
288 packed.append(struct.pack("!L", self.xid))
289 packed.append(struct.pack("!H", self.stats_type))
290 packed.append(struct.pack("!H", self.flags))
291 packed.append('\x00' * 4)
292 length = sum([len(x) for x in packed])
293 packed[2] = struct.pack("!H", length)
294 return ''.join(packed)
295
296 @staticmethod
297 def unpack(reader):
298 subtype, = reader.peek('!H', 8)
299 subclass = stats_request.subtypes.get(subtype)
300 if subclass:
301 return subclass.unpack(reader)
302
303 obj = stats_request()
304 _version = reader.read("!B")[0]
305 assert(_version == 4)
306 _type = reader.read("!B")[0]
307 assert(_type == 18)
308 _length = reader.read("!H")[0]
309 orig_reader = reader
310 reader = orig_reader.slice(_length, 4)
311 obj.xid = reader.read("!L")[0]
312 obj.stats_type = reader.read("!H")[0]
313 obj.flags = reader.read("!H")[0]
314 reader.skip(4)
315 return obj
316
317 def __eq__(self, other):
318 if type(self) != type(other): return False
319 if self.xid != other.xid: return False
320 if self.stats_type != other.stats_type: return False
321 if self.flags != other.flags: return False
322 return True
323
324 def pretty_print(self, q):
325 q.text("stats_request {")
326 with q.group():
327 with q.indent(2):
328 q.breakable()
329 q.text("xid = ");
330 if self.xid != None:
331 q.text("%#x" % self.xid)
332 else:
333 q.text('None')
334 q.text(","); q.breakable()
335 q.text("flags = ");
336 q.text("%#x" % self.flags)
337 q.breakable()
338 q.text('}')
339
340message.subtypes[18] = stats_request
341
342class aggregate_stats_request(stats_request):
343 version = 4
344 type = 18
345 stats_type = 2
346
347 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
348 if xid != None:
349 self.xid = xid
350 else:
351 self.xid = None
352 if flags != None:
353 self.flags = flags
354 else:
355 self.flags = 0
356 if table_id != None:
357 self.table_id = table_id
358 else:
359 self.table_id = 0
360 if out_port != None:
361 self.out_port = out_port
362 else:
363 self.out_port = 0
364 if out_group != None:
365 self.out_group = out_group
366 else:
367 self.out_group = 0
368 if cookie != None:
369 self.cookie = cookie
370 else:
371 self.cookie = 0
372 if cookie_mask != None:
373 self.cookie_mask = cookie_mask
374 else:
375 self.cookie_mask = 0
376 if match != None:
377 self.match = match
378 else:
379 self.match = ofp.match()
380 return
381
382 def pack(self):
383 packed = []
384 packed.append(struct.pack("!B", self.version))
385 packed.append(struct.pack("!B", self.type))
386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
387 packed.append(struct.pack("!L", self.xid))
388 packed.append(struct.pack("!H", self.stats_type))
389 packed.append(struct.pack("!H", self.flags))
390 packed.append('\x00' * 4)
391 packed.append(struct.pack("!B", self.table_id))
392 packed.append('\x00' * 3)
393 packed.append(util.pack_port_no(self.out_port))
394 packed.append(struct.pack("!L", self.out_group))
395 packed.append('\x00' * 4)
396 packed.append(struct.pack("!Q", self.cookie))
397 packed.append(struct.pack("!Q", self.cookie_mask))
398 packed.append(self.match.pack())
399 length = sum([len(x) for x in packed])
400 packed[2] = struct.pack("!H", length)
401 return ''.join(packed)
402
403 @staticmethod
404 def unpack(reader):
405 obj = aggregate_stats_request()
406 _version = reader.read("!B")[0]
407 assert(_version == 4)
408 _type = reader.read("!B")[0]
409 assert(_type == 18)
410 _length = reader.read("!H")[0]
411 orig_reader = reader
412 reader = orig_reader.slice(_length, 4)
413 obj.xid = reader.read("!L")[0]
414 _stats_type = reader.read("!H")[0]
415 assert(_stats_type == 2)
416 obj.flags = reader.read("!H")[0]
417 reader.skip(4)
418 obj.table_id = reader.read("!B")[0]
419 reader.skip(3)
420 obj.out_port = util.unpack_port_no(reader)
421 obj.out_group = reader.read("!L")[0]
422 reader.skip(4)
423 obj.cookie = reader.read("!Q")[0]
424 obj.cookie_mask = reader.read("!Q")[0]
425 obj.match = ofp.match.unpack(reader)
426 return obj
427
428 def __eq__(self, other):
429 if type(self) != type(other): return False
430 if self.xid != other.xid: return False
431 if self.flags != other.flags: return False
432 if self.table_id != other.table_id: return False
433 if self.out_port != other.out_port: return False
434 if self.out_group != other.out_group: return False
435 if self.cookie != other.cookie: return False
436 if self.cookie_mask != other.cookie_mask: return False
437 if self.match != other.match: return False
438 return True
439
440 def pretty_print(self, q):
441 q.text("aggregate_stats_request {")
442 with q.group():
443 with q.indent(2):
444 q.breakable()
445 q.text("xid = ");
446 if self.xid != None:
447 q.text("%#x" % self.xid)
448 else:
449 q.text('None')
450 q.text(","); q.breakable()
451 q.text("flags = ");
452 q.text("%#x" % self.flags)
453 q.text(","); q.breakable()
454 q.text("table_id = ");
455 q.text("%#x" % self.table_id)
456 q.text(","); q.breakable()
457 q.text("out_port = ");
458 q.text(util.pretty_port(self.out_port))
459 q.text(","); q.breakable()
460 q.text("out_group = ");
461 q.text("%#x" % self.out_group)
462 q.text(","); q.breakable()
463 q.text("cookie = ");
464 q.text("%#x" % self.cookie)
465 q.text(","); q.breakable()
466 q.text("cookie_mask = ");
467 q.text("%#x" % self.cookie_mask)
468 q.text(","); q.breakable()
469 q.text("match = ");
470 q.pp(self.match)
471 q.breakable()
472 q.text('}')
473
474stats_request.subtypes[2] = aggregate_stats_request
475
476class async_get_reply(message):
477 version = 4
478 type = 27
479
480 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
481 if xid != None:
482 self.xid = xid
483 else:
484 self.xid = None
485 if packet_in_mask_equal_master != None:
486 self.packet_in_mask_equal_master = packet_in_mask_equal_master
487 else:
488 self.packet_in_mask_equal_master = 0
489 if packet_in_mask_slave != None:
490 self.packet_in_mask_slave = packet_in_mask_slave
491 else:
492 self.packet_in_mask_slave = 0
493 if port_status_mask_equal_master != None:
494 self.port_status_mask_equal_master = port_status_mask_equal_master
495 else:
496 self.port_status_mask_equal_master = 0
497 if port_status_mask_slave != None:
498 self.port_status_mask_slave = port_status_mask_slave
499 else:
500 self.port_status_mask_slave = 0
501 if flow_removed_mask_equal_master != None:
502 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
503 else:
504 self.flow_removed_mask_equal_master = 0
505 if flow_removed_mask_slave != None:
506 self.flow_removed_mask_slave = flow_removed_mask_slave
507 else:
508 self.flow_removed_mask_slave = 0
509 return
510
511 def pack(self):
512 packed = []
513 packed.append(struct.pack("!B", self.version))
514 packed.append(struct.pack("!B", self.type))
515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
516 packed.append(struct.pack("!L", self.xid))
517 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
518 packed.append(struct.pack("!L", self.packet_in_mask_slave))
519 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
520 packed.append(struct.pack("!L", self.port_status_mask_slave))
521 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
522 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
523 length = sum([len(x) for x in packed])
524 packed[2] = struct.pack("!H", length)
525 return ''.join(packed)
526
527 @staticmethod
528 def unpack(reader):
529 obj = async_get_reply()
530 _version = reader.read("!B")[0]
531 assert(_version == 4)
532 _type = reader.read("!B")[0]
533 assert(_type == 27)
534 _length = reader.read("!H")[0]
535 orig_reader = reader
536 reader = orig_reader.slice(_length, 4)
537 obj.xid = reader.read("!L")[0]
538 obj.packet_in_mask_equal_master = reader.read("!L")[0]
539 obj.packet_in_mask_slave = reader.read("!L")[0]
540 obj.port_status_mask_equal_master = reader.read("!L")[0]
541 obj.port_status_mask_slave = reader.read("!L")[0]
542 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
543 obj.flow_removed_mask_slave = reader.read("!L")[0]
544 return obj
545
546 def __eq__(self, other):
547 if type(self) != type(other): return False
548 if self.xid != other.xid: return False
549 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
550 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
551 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
552 if self.port_status_mask_slave != other.port_status_mask_slave: return False
553 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
554 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
555 return True
556
557 def pretty_print(self, q):
558 q.text("async_get_reply {")
559 with q.group():
560 with q.indent(2):
561 q.breakable()
562 q.text("xid = ");
563 if self.xid != None:
564 q.text("%#x" % self.xid)
565 else:
566 q.text('None')
567 q.text(","); q.breakable()
568 q.text("packet_in_mask_equal_master = ");
569 q.text("%#x" % self.packet_in_mask_equal_master)
570 q.text(","); q.breakable()
571 q.text("packet_in_mask_slave = ");
572 q.text("%#x" % self.packet_in_mask_slave)
573 q.text(","); q.breakable()
574 q.text("port_status_mask_equal_master = ");
575 q.text("%#x" % self.port_status_mask_equal_master)
576 q.text(","); q.breakable()
577 q.text("port_status_mask_slave = ");
578 q.text("%#x" % self.port_status_mask_slave)
579 q.text(","); q.breakable()
580 q.text("flow_removed_mask_equal_master = ");
581 q.text("%#x" % self.flow_removed_mask_equal_master)
582 q.text(","); q.breakable()
583 q.text("flow_removed_mask_slave = ");
584 q.text("%#x" % self.flow_removed_mask_slave)
585 q.breakable()
586 q.text('}')
587
588message.subtypes[27] = async_get_reply
589
590class async_get_request(message):
591 version = 4
592 type = 26
593
594 def __init__(self, xid=None):
595 if xid != None:
596 self.xid = xid
597 else:
598 self.xid = None
599 return
600
601 def pack(self):
602 packed = []
603 packed.append(struct.pack("!B", self.version))
604 packed.append(struct.pack("!B", self.type))
605 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
606 packed.append(struct.pack("!L", self.xid))
607 length = sum([len(x) for x in packed])
608 packed[2] = struct.pack("!H", length)
609 return ''.join(packed)
610
611 @staticmethod
612 def unpack(reader):
613 obj = async_get_request()
614 _version = reader.read("!B")[0]
615 assert(_version == 4)
616 _type = reader.read("!B")[0]
617 assert(_type == 26)
618 _length = reader.read("!H")[0]
619 orig_reader = reader
620 reader = orig_reader.slice(_length, 4)
621 obj.xid = reader.read("!L")[0]
622 return obj
623
624 def __eq__(self, other):
625 if type(self) != type(other): return False
626 if self.xid != other.xid: return False
627 return True
628
629 def pretty_print(self, q):
630 q.text("async_get_request {")
631 with q.group():
632 with q.indent(2):
633 q.breakable()
634 q.text("xid = ");
635 if self.xid != None:
636 q.text("%#x" % self.xid)
637 else:
638 q.text('None')
639 q.breakable()
640 q.text('}')
641
642message.subtypes[26] = async_get_request
643
644class async_set(message):
645 version = 4
646 type = 28
647
648 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
649 if xid != None:
650 self.xid = xid
651 else:
652 self.xid = None
653 if packet_in_mask_equal_master != None:
654 self.packet_in_mask_equal_master = packet_in_mask_equal_master
655 else:
656 self.packet_in_mask_equal_master = 0
657 if packet_in_mask_slave != None:
658 self.packet_in_mask_slave = packet_in_mask_slave
659 else:
660 self.packet_in_mask_slave = 0
661 if port_status_mask_equal_master != None:
662 self.port_status_mask_equal_master = port_status_mask_equal_master
663 else:
664 self.port_status_mask_equal_master = 0
665 if port_status_mask_slave != None:
666 self.port_status_mask_slave = port_status_mask_slave
667 else:
668 self.port_status_mask_slave = 0
669 if flow_removed_mask_equal_master != None:
670 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
671 else:
672 self.flow_removed_mask_equal_master = 0
673 if flow_removed_mask_slave != None:
674 self.flow_removed_mask_slave = flow_removed_mask_slave
675 else:
676 self.flow_removed_mask_slave = 0
677 return
678
679 def pack(self):
680 packed = []
681 packed.append(struct.pack("!B", self.version))
682 packed.append(struct.pack("!B", self.type))
683 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
684 packed.append(struct.pack("!L", self.xid))
685 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
686 packed.append(struct.pack("!L", self.packet_in_mask_slave))
687 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
688 packed.append(struct.pack("!L", self.port_status_mask_slave))
689 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
690 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
691 length = sum([len(x) for x in packed])
692 packed[2] = struct.pack("!H", length)
693 return ''.join(packed)
694
695 @staticmethod
696 def unpack(reader):
697 obj = async_set()
698 _version = reader.read("!B")[0]
699 assert(_version == 4)
700 _type = reader.read("!B")[0]
701 assert(_type == 28)
702 _length = reader.read("!H")[0]
703 orig_reader = reader
704 reader = orig_reader.slice(_length, 4)
705 obj.xid = reader.read("!L")[0]
706 obj.packet_in_mask_equal_master = reader.read("!L")[0]
707 obj.packet_in_mask_slave = reader.read("!L")[0]
708 obj.port_status_mask_equal_master = reader.read("!L")[0]
709 obj.port_status_mask_slave = reader.read("!L")[0]
710 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
711 obj.flow_removed_mask_slave = reader.read("!L")[0]
712 return obj
713
714 def __eq__(self, other):
715 if type(self) != type(other): return False
716 if self.xid != other.xid: return False
717 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
718 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
719 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
720 if self.port_status_mask_slave != other.port_status_mask_slave: return False
721 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
722 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
723 return True
724
725 def pretty_print(self, q):
726 q.text("async_set {")
727 with q.group():
728 with q.indent(2):
729 q.breakable()
730 q.text("xid = ");
731 if self.xid != None:
732 q.text("%#x" % self.xid)
733 else:
734 q.text('None')
735 q.text(","); q.breakable()
736 q.text("packet_in_mask_equal_master = ");
737 q.text("%#x" % self.packet_in_mask_equal_master)
738 q.text(","); q.breakable()
739 q.text("packet_in_mask_slave = ");
740 q.text("%#x" % self.packet_in_mask_slave)
741 q.text(","); q.breakable()
742 q.text("port_status_mask_equal_master = ");
743 q.text("%#x" % self.port_status_mask_equal_master)
744 q.text(","); q.breakable()
745 q.text("port_status_mask_slave = ");
746 q.text("%#x" % self.port_status_mask_slave)
747 q.text(","); q.breakable()
748 q.text("flow_removed_mask_equal_master = ");
749 q.text("%#x" % self.flow_removed_mask_equal_master)
750 q.text(","); q.breakable()
751 q.text("flow_removed_mask_slave = ");
752 q.text("%#x" % self.flow_removed_mask_slave)
753 q.breakable()
754 q.text('}')
755
756message.subtypes[28] = async_set
757
758class error_msg(message):
759 subtypes = {}
760
761 version = 4
762 type = 1
763
764 def __init__(self, xid=None, err_type=None):
765 if xid != None:
766 self.xid = xid
767 else:
768 self.xid = None
769 if err_type != None:
770 self.err_type = err_type
771 else:
772 self.err_type = 0
773 return
774
775 def pack(self):
776 packed = []
777 packed.append(struct.pack("!B", self.version))
778 packed.append(struct.pack("!B", self.type))
779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
780 packed.append(struct.pack("!L", self.xid))
781 packed.append(struct.pack("!H", self.err_type))
782 length = sum([len(x) for x in packed])
783 packed[2] = struct.pack("!H", length)
784 return ''.join(packed)
785
786 @staticmethod
787 def unpack(reader):
788 subtype, = reader.peek('!H', 8)
789 subclass = error_msg.subtypes.get(subtype)
790 if subclass:
791 return subclass.unpack(reader)
792
793 obj = error_msg()
794 _version = reader.read("!B")[0]
795 assert(_version == 4)
796 _type = reader.read("!B")[0]
797 assert(_type == 1)
798 _length = reader.read("!H")[0]
799 orig_reader = reader
800 reader = orig_reader.slice(_length, 4)
801 obj.xid = reader.read("!L")[0]
802 obj.err_type = reader.read("!H")[0]
803 return obj
804
805 def __eq__(self, other):
806 if type(self) != type(other): return False
807 if self.xid != other.xid: return False
808 if self.err_type != other.err_type: return False
809 return True
810
811 def pretty_print(self, q):
812 q.text("error_msg {")
813 with q.group():
814 with q.indent(2):
815 q.breakable()
816 q.text("xid = ");
817 if self.xid != None:
818 q.text("%#x" % self.xid)
819 else:
820 q.text('None')
821 q.breakable()
822 q.text('}')
823
824message.subtypes[1] = error_msg
825
826class bad_action_error_msg(error_msg):
827 version = 4
828 type = 1
829 err_type = 2
830
831 def __init__(self, xid=None, code=None, data=None):
832 if xid != None:
833 self.xid = xid
834 else:
835 self.xid = None
836 if code != None:
837 self.code = code
838 else:
839 self.code = 0
840 if data != None:
841 self.data = data
842 else:
843 self.data = ''
844 return
845
846 def pack(self):
847 packed = []
848 packed.append(struct.pack("!B", self.version))
849 packed.append(struct.pack("!B", self.type))
850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
851 packed.append(struct.pack("!L", self.xid))
852 packed.append(struct.pack("!H", self.err_type))
853 packed.append(struct.pack("!H", self.code))
854 packed.append(self.data)
855 length = sum([len(x) for x in packed])
856 packed[2] = struct.pack("!H", length)
857 return ''.join(packed)
858
859 @staticmethod
860 def unpack(reader):
861 obj = bad_action_error_msg()
862 _version = reader.read("!B")[0]
863 assert(_version == 4)
864 _type = reader.read("!B")[0]
865 assert(_type == 1)
866 _length = reader.read("!H")[0]
867 orig_reader = reader
868 reader = orig_reader.slice(_length, 4)
869 obj.xid = reader.read("!L")[0]
870 _err_type = reader.read("!H")[0]
871 assert(_err_type == 2)
872 obj.code = reader.read("!H")[0]
873 obj.data = str(reader.read_all())
874 return obj
875
876 def __eq__(self, other):
877 if type(self) != type(other): return False
878 if self.xid != other.xid: return False
879 if self.code != other.code: return False
880 if self.data != other.data: return False
881 return True
882
883 def pretty_print(self, q):
884 q.text("bad_action_error_msg {")
885 with q.group():
886 with q.indent(2):
887 q.breakable()
888 q.text("xid = ");
889 if self.xid != None:
890 q.text("%#x" % self.xid)
891 else:
892 q.text('None')
893 q.text(","); q.breakable()
894 q.text("code = ");
895 q.text("%#x" % self.code)
896 q.text(","); q.breakable()
897 q.text("data = ");
898 q.pp(self.data)
899 q.breakable()
900 q.text('}')
901
902error_msg.subtypes[2] = bad_action_error_msg
903
904class bad_instruction_error_msg(error_msg):
905 version = 4
906 type = 1
907 err_type = 3
908
909 def __init__(self, xid=None, code=None, data=None):
910 if xid != None:
911 self.xid = xid
912 else:
913 self.xid = None
914 if code != None:
915 self.code = code
916 else:
917 self.code = 0
918 if data != None:
919 self.data = data
920 else:
921 self.data = ''
922 return
923
924 def pack(self):
925 packed = []
926 packed.append(struct.pack("!B", self.version))
927 packed.append(struct.pack("!B", self.type))
928 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
929 packed.append(struct.pack("!L", self.xid))
930 packed.append(struct.pack("!H", self.err_type))
931 packed.append(struct.pack("!H", self.code))
932 packed.append(self.data)
933 length = sum([len(x) for x in packed])
934 packed[2] = struct.pack("!H", length)
935 return ''.join(packed)
936
937 @staticmethod
938 def unpack(reader):
939 obj = bad_instruction_error_msg()
940 _version = reader.read("!B")[0]
941 assert(_version == 4)
942 _type = reader.read("!B")[0]
943 assert(_type == 1)
944 _length = reader.read("!H")[0]
945 orig_reader = reader
946 reader = orig_reader.slice(_length, 4)
947 obj.xid = reader.read("!L")[0]
948 _err_type = reader.read("!H")[0]
949 assert(_err_type == 3)
950 obj.code = reader.read("!H")[0]
951 obj.data = str(reader.read_all())
952 return obj
953
954 def __eq__(self, other):
955 if type(self) != type(other): return False
956 if self.xid != other.xid: return False
957 if self.code != other.code: return False
958 if self.data != other.data: return False
959 return True
960
961 def pretty_print(self, q):
962 q.text("bad_instruction_error_msg {")
963 with q.group():
964 with q.indent(2):
965 q.breakable()
966 q.text("xid = ");
967 if self.xid != None:
968 q.text("%#x" % self.xid)
969 else:
970 q.text('None')
971 q.text(","); q.breakable()
972 q.text("code = ");
973 q.text("%#x" % self.code)
974 q.text(","); q.breakable()
975 q.text("data = ");
976 q.pp(self.data)
977 q.breakable()
978 q.text('}')
979
980error_msg.subtypes[3] = bad_instruction_error_msg
981
982class bad_match_error_msg(error_msg):
983 version = 4
984 type = 1
985 err_type = 4
986
987 def __init__(self, xid=None, code=None, data=None):
988 if xid != None:
989 self.xid = xid
990 else:
991 self.xid = None
992 if code != None:
993 self.code = code
994 else:
995 self.code = 0
996 if data != None:
997 self.data = data
998 else:
999 self.data = ''
1000 return
1001
1002 def pack(self):
1003 packed = []
1004 packed.append(struct.pack("!B", self.version))
1005 packed.append(struct.pack("!B", self.type))
1006 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1007 packed.append(struct.pack("!L", self.xid))
1008 packed.append(struct.pack("!H", self.err_type))
1009 packed.append(struct.pack("!H", self.code))
1010 packed.append(self.data)
1011 length = sum([len(x) for x in packed])
1012 packed[2] = struct.pack("!H", length)
1013 return ''.join(packed)
1014
1015 @staticmethod
1016 def unpack(reader):
1017 obj = bad_match_error_msg()
1018 _version = reader.read("!B")[0]
1019 assert(_version == 4)
1020 _type = reader.read("!B")[0]
1021 assert(_type == 1)
1022 _length = reader.read("!H")[0]
1023 orig_reader = reader
1024 reader = orig_reader.slice(_length, 4)
1025 obj.xid = reader.read("!L")[0]
1026 _err_type = reader.read("!H")[0]
1027 assert(_err_type == 4)
1028 obj.code = reader.read("!H")[0]
1029 obj.data = str(reader.read_all())
1030 return obj
1031
1032 def __eq__(self, other):
1033 if type(self) != type(other): return False
1034 if self.xid != other.xid: return False
1035 if self.code != other.code: return False
1036 if self.data != other.data: return False
1037 return True
1038
1039 def pretty_print(self, q):
1040 q.text("bad_match_error_msg {")
1041 with q.group():
1042 with q.indent(2):
1043 q.breakable()
1044 q.text("xid = ");
1045 if self.xid != None:
1046 q.text("%#x" % self.xid)
1047 else:
1048 q.text('None')
1049 q.text(","); q.breakable()
1050 q.text("code = ");
1051 q.text("%#x" % self.code)
1052 q.text(","); q.breakable()
1053 q.text("data = ");
1054 q.pp(self.data)
1055 q.breakable()
1056 q.text('}')
1057
1058error_msg.subtypes[4] = bad_match_error_msg
1059
1060class bad_request_error_msg(error_msg):
1061 version = 4
1062 type = 1
1063 err_type = 1
1064
1065 def __init__(self, xid=None, code=None, data=None):
1066 if xid != None:
1067 self.xid = xid
1068 else:
1069 self.xid = None
1070 if code != None:
1071 self.code = code
1072 else:
1073 self.code = 0
1074 if data != None:
1075 self.data = data
1076 else:
1077 self.data = ''
1078 return
1079
1080 def pack(self):
1081 packed = []
1082 packed.append(struct.pack("!B", self.version))
1083 packed.append(struct.pack("!B", self.type))
1084 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1085 packed.append(struct.pack("!L", self.xid))
1086 packed.append(struct.pack("!H", self.err_type))
1087 packed.append(struct.pack("!H", self.code))
1088 packed.append(self.data)
1089 length = sum([len(x) for x in packed])
1090 packed[2] = struct.pack("!H", length)
1091 return ''.join(packed)
1092
1093 @staticmethod
1094 def unpack(reader):
1095 obj = bad_request_error_msg()
1096 _version = reader.read("!B")[0]
1097 assert(_version == 4)
1098 _type = reader.read("!B")[0]
1099 assert(_type == 1)
1100 _length = reader.read("!H")[0]
1101 orig_reader = reader
1102 reader = orig_reader.slice(_length, 4)
1103 obj.xid = reader.read("!L")[0]
1104 _err_type = reader.read("!H")[0]
1105 assert(_err_type == 1)
1106 obj.code = reader.read("!H")[0]
1107 obj.data = str(reader.read_all())
1108 return obj
1109
1110 def __eq__(self, other):
1111 if type(self) != type(other): return False
1112 if self.xid != other.xid: return False
1113 if self.code != other.code: return False
1114 if self.data != other.data: return False
1115 return True
1116
1117 def pretty_print(self, q):
1118 q.text("bad_request_error_msg {")
1119 with q.group():
1120 with q.indent(2):
1121 q.breakable()
1122 q.text("xid = ");
1123 if self.xid != None:
1124 q.text("%#x" % self.xid)
1125 else:
1126 q.text('None')
1127 q.text(","); q.breakable()
1128 q.text("code = ");
1129 q.text("%#x" % self.code)
1130 q.text(","); q.breakable()
1131 q.text("data = ");
1132 q.pp(self.data)
1133 q.breakable()
1134 q.text('}')
1135
1136error_msg.subtypes[1] = bad_request_error_msg
1137
1138class barrier_reply(message):
1139 version = 4
1140 type = 21
1141
1142 def __init__(self, xid=None):
1143 if xid != None:
1144 self.xid = xid
1145 else:
1146 self.xid = None
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 length = sum([len(x) for x in packed])
1156 packed[2] = struct.pack("!H", length)
1157 return ''.join(packed)
1158
1159 @staticmethod
1160 def unpack(reader):
1161 obj = barrier_reply()
1162 _version = reader.read("!B")[0]
1163 assert(_version == 4)
1164 _type = reader.read("!B")[0]
1165 assert(_type == 21)
1166 _length = reader.read("!H")[0]
1167 orig_reader = reader
1168 reader = orig_reader.slice(_length, 4)
1169 obj.xid = reader.read("!L")[0]
1170 return obj
1171
1172 def __eq__(self, other):
1173 if type(self) != type(other): return False
1174 if self.xid != other.xid: return False
1175 return True
1176
1177 def pretty_print(self, q):
1178 q.text("barrier_reply {")
1179 with q.group():
1180 with q.indent(2):
1181 q.breakable()
1182 q.text("xid = ");
1183 if self.xid != None:
1184 q.text("%#x" % self.xid)
1185 else:
1186 q.text('None')
1187 q.breakable()
1188 q.text('}')
1189
1190message.subtypes[21] = barrier_reply
1191
1192class barrier_request(message):
1193 version = 4
1194 type = 20
1195
1196 def __init__(self, xid=None):
1197 if xid != None:
1198 self.xid = xid
1199 else:
1200 self.xid = None
1201 return
1202
1203 def pack(self):
1204 packed = []
1205 packed.append(struct.pack("!B", self.version))
1206 packed.append(struct.pack("!B", self.type))
1207 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1208 packed.append(struct.pack("!L", self.xid))
1209 length = sum([len(x) for x in packed])
1210 packed[2] = struct.pack("!H", length)
1211 return ''.join(packed)
1212
1213 @staticmethod
1214 def unpack(reader):
1215 obj = barrier_request()
1216 _version = reader.read("!B")[0]
1217 assert(_version == 4)
1218 _type = reader.read("!B")[0]
1219 assert(_type == 20)
1220 _length = reader.read("!H")[0]
1221 orig_reader = reader
1222 reader = orig_reader.slice(_length, 4)
1223 obj.xid = reader.read("!L")[0]
1224 return obj
1225
1226 def __eq__(self, other):
1227 if type(self) != type(other): return False
1228 if self.xid != other.xid: return False
1229 return True
1230
1231 def pretty_print(self, q):
1232 q.text("barrier_request {")
1233 with q.group():
1234 with q.indent(2):
1235 q.breakable()
1236 q.text("xid = ");
1237 if self.xid != None:
1238 q.text("%#x" % self.xid)
1239 else:
1240 q.text('None')
1241 q.breakable()
1242 q.text('}')
1243
1244message.subtypes[20] = barrier_request
1245
1246class experimenter(message):
1247 subtypes = {}
1248
1249 version = 4
1250 type = 4
1251
1252 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1253 if xid != None:
1254 self.xid = xid
1255 else:
1256 self.xid = None
1257 if experimenter != None:
1258 self.experimenter = experimenter
1259 else:
1260 self.experimenter = 0
1261 if subtype != None:
1262 self.subtype = subtype
1263 else:
1264 self.subtype = 0
1265 if data != None:
1266 self.data = data
1267 else:
1268 self.data = ''
1269 return
1270
1271 def pack(self):
1272 packed = []
1273 packed.append(struct.pack("!B", self.version))
1274 packed.append(struct.pack("!B", self.type))
1275 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1276 packed.append(struct.pack("!L", self.xid))
1277 packed.append(struct.pack("!L", self.experimenter))
1278 packed.append(struct.pack("!L", self.subtype))
1279 packed.append(self.data)
1280 length = sum([len(x) for x in packed])
1281 packed[2] = struct.pack("!H", length)
1282 return ''.join(packed)
1283
1284 @staticmethod
1285 def unpack(reader):
1286 subtype, = reader.peek('!L', 8)
1287 subclass = experimenter.subtypes.get(subtype)
1288 if subclass:
1289 return subclass.unpack(reader)
1290
1291 obj = experimenter()
1292 _version = reader.read("!B")[0]
1293 assert(_version == 4)
1294 _type = reader.read("!B")[0]
1295 assert(_type == 4)
1296 _length = reader.read("!H")[0]
1297 orig_reader = reader
1298 reader = orig_reader.slice(_length, 4)
1299 obj.xid = reader.read("!L")[0]
1300 obj.experimenter = reader.read("!L")[0]
1301 obj.subtype = reader.read("!L")[0]
1302 obj.data = str(reader.read_all())
1303 return obj
1304
1305 def __eq__(self, other):
1306 if type(self) != type(other): return False
1307 if self.xid != other.xid: return False
1308 if self.experimenter != other.experimenter: return False
1309 if self.subtype != other.subtype: return False
1310 if self.data != other.data: return False
1311 return True
1312
1313 def pretty_print(self, q):
1314 q.text("experimenter {")
1315 with q.group():
1316 with q.indent(2):
1317 q.breakable()
1318 q.text("xid = ");
1319 if self.xid != None:
1320 q.text("%#x" % self.xid)
1321 else:
1322 q.text('None')
1323 q.text(","); q.breakable()
1324 q.text("subtype = ");
1325 q.text("%#x" % self.subtype)
1326 q.text(","); q.breakable()
1327 q.text("data = ");
1328 q.pp(self.data)
1329 q.breakable()
1330 q.text('}')
1331
1332message.subtypes[4] = experimenter
1333
1334class bsn_header(experimenter):
1335 subtypes = {}
1336
1337 version = 4
1338 type = 4
1339 experimenter = 6035143
1340
1341 def __init__(self, xid=None, subtype=None):
1342 if xid != None:
1343 self.xid = xid
1344 else:
1345 self.xid = None
1346 if subtype != None:
1347 self.subtype = subtype
1348 else:
1349 self.subtype = 0
1350 return
1351
1352 def pack(self):
1353 packed = []
1354 packed.append(struct.pack("!B", self.version))
1355 packed.append(struct.pack("!B", self.type))
1356 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1357 packed.append(struct.pack("!L", self.xid))
1358 packed.append(struct.pack("!L", self.experimenter))
1359 packed.append(struct.pack("!L", self.subtype))
1360 length = sum([len(x) for x in packed])
1361 packed[2] = struct.pack("!H", length)
1362 return ''.join(packed)
1363
1364 @staticmethod
1365 def unpack(reader):
1366 subtype, = reader.peek('!L', 12)
1367 subclass = bsn_header.subtypes.get(subtype)
1368 if subclass:
1369 return subclass.unpack(reader)
1370
1371 obj = bsn_header()
1372 _version = reader.read("!B")[0]
1373 assert(_version == 4)
1374 _type = reader.read("!B")[0]
1375 assert(_type == 4)
1376 _length = reader.read("!H")[0]
1377 orig_reader = reader
1378 reader = orig_reader.slice(_length, 4)
1379 obj.xid = reader.read("!L")[0]
1380 _experimenter = reader.read("!L")[0]
1381 assert(_experimenter == 6035143)
1382 obj.subtype = reader.read("!L")[0]
1383 return obj
1384
1385 def __eq__(self, other):
1386 if type(self) != type(other): return False
1387 if self.xid != other.xid: return False
1388 if self.subtype != other.subtype: return False
1389 return True
1390
1391 def pretty_print(self, q):
1392 q.text("bsn_header {")
1393 with q.group():
1394 with q.indent(2):
1395 q.breakable()
1396 q.text("xid = ");
1397 if self.xid != None:
1398 q.text("%#x" % self.xid)
1399 else:
1400 q.text('None')
1401 q.breakable()
1402 q.text('}')
1403
1404experimenter.subtypes[6035143] = bsn_header
1405
1406class bsn_arp_idle(bsn_header):
1407 version = 4
1408 type = 4
1409 experimenter = 6035143
1410 subtype = 60
1411
1412 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1413 if xid != None:
1414 self.xid = xid
1415 else:
1416 self.xid = None
1417 if vlan_vid != None:
1418 self.vlan_vid = vlan_vid
1419 else:
1420 self.vlan_vid = 0
1421 if ipv4_addr != None:
1422 self.ipv4_addr = ipv4_addr
1423 else:
1424 self.ipv4_addr = 0
1425 return
1426
1427 def pack(self):
1428 packed = []
1429 packed.append(struct.pack("!B", self.version))
1430 packed.append(struct.pack("!B", self.type))
1431 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1432 packed.append(struct.pack("!L", self.xid))
1433 packed.append(struct.pack("!L", self.experimenter))
1434 packed.append(struct.pack("!L", self.subtype))
1435 packed.append(struct.pack("!H", self.vlan_vid))
1436 packed.append('\x00' * 2)
1437 packed.append(struct.pack("!L", self.ipv4_addr))
1438 length = sum([len(x) for x in packed])
1439 packed[2] = struct.pack("!H", length)
1440 return ''.join(packed)
1441
1442 @staticmethod
1443 def unpack(reader):
1444 obj = bsn_arp_idle()
1445 _version = reader.read("!B")[0]
1446 assert(_version == 4)
1447 _type = reader.read("!B")[0]
1448 assert(_type == 4)
1449 _length = reader.read("!H")[0]
1450 orig_reader = reader
1451 reader = orig_reader.slice(_length, 4)
1452 obj.xid = reader.read("!L")[0]
1453 _experimenter = reader.read("!L")[0]
1454 assert(_experimenter == 6035143)
1455 _subtype = reader.read("!L")[0]
1456 assert(_subtype == 60)
1457 obj.vlan_vid = reader.read("!H")[0]
1458 reader.skip(2)
1459 obj.ipv4_addr = reader.read("!L")[0]
1460 return obj
1461
1462 def __eq__(self, other):
1463 if type(self) != type(other): return False
1464 if self.xid != other.xid: return False
1465 if self.vlan_vid != other.vlan_vid: return False
1466 if self.ipv4_addr != other.ipv4_addr: return False
1467 return True
1468
1469 def pretty_print(self, q):
1470 q.text("bsn_arp_idle {")
1471 with q.group():
1472 with q.indent(2):
1473 q.breakable()
1474 q.text("xid = ");
1475 if self.xid != None:
1476 q.text("%#x" % self.xid)
1477 else:
1478 q.text('None')
1479 q.text(","); q.breakable()
1480 q.text("vlan_vid = ");
1481 q.text("%#x" % self.vlan_vid)
1482 q.text(","); q.breakable()
1483 q.text("ipv4_addr = ");
1484 q.text(util.pretty_ipv4(self.ipv4_addr))
1485 q.breakable()
1486 q.text('}')
1487
1488bsn_header.subtypes[60] = bsn_arp_idle
1489
1490class experimenter_error_msg(error_msg):
1491 subtypes = {}
1492
1493 version = 4
1494 type = 1
1495 err_type = 65535
1496
1497 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
1498 if xid != None:
1499 self.xid = xid
1500 else:
1501 self.xid = None
1502 if subtype != None:
1503 self.subtype = subtype
1504 else:
1505 self.subtype = 0
1506 if experimenter != None:
1507 self.experimenter = experimenter
1508 else:
1509 self.experimenter = 0
1510 if data != None:
1511 self.data = data
1512 else:
1513 self.data = ''
1514 return
1515
1516 def pack(self):
1517 packed = []
1518 packed.append(struct.pack("!B", self.version))
1519 packed.append(struct.pack("!B", self.type))
1520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1521 packed.append(struct.pack("!L", self.xid))
1522 packed.append(struct.pack("!H", self.err_type))
1523 packed.append(struct.pack("!H", self.subtype))
1524 packed.append(struct.pack("!L", self.experimenter))
1525 packed.append(self.data)
1526 length = sum([len(x) for x in packed])
1527 packed[2] = struct.pack("!H", length)
1528 return ''.join(packed)
1529
1530 @staticmethod
1531 def unpack(reader):
1532 subtype, = reader.peek('!L', 12)
1533 subclass = experimenter_error_msg.subtypes.get(subtype)
1534 if subclass:
1535 return subclass.unpack(reader)
1536
1537 obj = experimenter_error_msg()
1538 _version = reader.read("!B")[0]
1539 assert(_version == 4)
1540 _type = reader.read("!B")[0]
1541 assert(_type == 1)
1542 _length = reader.read("!H")[0]
1543 orig_reader = reader
1544 reader = orig_reader.slice(_length, 4)
1545 obj.xid = reader.read("!L")[0]
1546 _err_type = reader.read("!H")[0]
1547 assert(_err_type == 65535)
1548 obj.subtype = reader.read("!H")[0]
1549 obj.experimenter = reader.read("!L")[0]
1550 obj.data = str(reader.read_all())
1551 return obj
1552
1553 def __eq__(self, other):
1554 if type(self) != type(other): return False
1555 if self.xid != other.xid: return False
1556 if self.subtype != other.subtype: return False
1557 if self.experimenter != other.experimenter: return False
1558 if self.data != other.data: return False
1559 return True
1560
1561 def pretty_print(self, q):
1562 q.text("experimenter_error_msg {")
1563 with q.group():
1564 with q.indent(2):
1565 q.breakable()
1566 q.text("xid = ");
1567 if self.xid != None:
1568 q.text("%#x" % self.xid)
1569 else:
1570 q.text('None')
1571 q.text(","); q.breakable()
1572 q.text("subtype = ");
1573 q.text("%#x" % self.subtype)
1574 q.text(","); q.breakable()
1575 q.text("data = ");
1576 q.pp(self.data)
1577 q.breakable()
1578 q.text('}')
1579
1580error_msg.subtypes[65535] = experimenter_error_msg
1581
1582class bsn_base_error(experimenter_error_msg):
1583 subtypes = {}
1584
1585 version = 4
1586 type = 1
1587 err_type = 65535
1588 experimenter = 6035143
1589
1590 def __init__(self, xid=None, subtype=None, err_msg=None, data=None):
1591 if xid != None:
1592 self.xid = xid
1593 else:
1594 self.xid = None
1595 if subtype != None:
1596 self.subtype = subtype
1597 else:
1598 self.subtype = 0
1599 if err_msg != None:
1600 self.err_msg = err_msg
1601 else:
1602 self.err_msg = ""
1603 if data != None:
1604 self.data = data
1605 else:
1606 self.data = ''
1607 return
1608
1609 def pack(self):
1610 packed = []
1611 packed.append(struct.pack("!B", self.version))
1612 packed.append(struct.pack("!B", self.type))
1613 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1614 packed.append(struct.pack("!L", self.xid))
1615 packed.append(struct.pack("!H", self.err_type))
1616 packed.append(struct.pack("!H", self.subtype))
1617 packed.append(struct.pack("!L", self.experimenter))
1618 packed.append(struct.pack("!256s", self.err_msg))
1619 packed.append(self.data)
1620 length = sum([len(x) for x in packed])
1621 packed[2] = struct.pack("!H", length)
1622 return ''.join(packed)
1623
1624 @staticmethod
1625 def unpack(reader):
1626 subtype, = reader.peek('!H', 10)
1627 subclass = bsn_base_error.subtypes.get(subtype)
1628 if subclass:
1629 return subclass.unpack(reader)
1630
1631 obj = bsn_base_error()
1632 _version = reader.read("!B")[0]
1633 assert(_version == 4)
1634 _type = reader.read("!B")[0]
1635 assert(_type == 1)
1636 _length = reader.read("!H")[0]
1637 orig_reader = reader
1638 reader = orig_reader.slice(_length, 4)
1639 obj.xid = reader.read("!L")[0]
1640 _err_type = reader.read("!H")[0]
1641 assert(_err_type == 65535)
1642 obj.subtype = reader.read("!H")[0]
1643 _experimenter = reader.read("!L")[0]
1644 assert(_experimenter == 6035143)
1645 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
1646 obj.data = str(reader.read_all())
1647 return obj
1648
1649 def __eq__(self, other):
1650 if type(self) != type(other): return False
1651 if self.xid != other.xid: return False
1652 if self.subtype != other.subtype: return False
1653 if self.err_msg != other.err_msg: return False
1654 if self.data != other.data: return False
1655 return True
1656
1657 def pretty_print(self, q):
1658 q.text("bsn_base_error {")
1659 with q.group():
1660 with q.indent(2):
1661 q.breakable()
1662 q.text("xid = ");
1663 if self.xid != None:
1664 q.text("%#x" % self.xid)
1665 else:
1666 q.text('None')
1667 q.text(","); q.breakable()
1668 q.text("err_msg = ");
1669 q.pp(self.err_msg)
1670 q.text(","); q.breakable()
1671 q.text("data = ");
1672 q.pp(self.data)
1673 q.breakable()
1674 q.text('}')
1675
1676experimenter_error_msg.subtypes[6035143] = bsn_base_error
1677
1678class bsn_bw_clear_data_reply(bsn_header):
1679 version = 4
1680 type = 4
1681 experimenter = 6035143
1682 subtype = 22
1683
1684 def __init__(self, xid=None, status=None):
1685 if xid != None:
1686 self.xid = xid
1687 else:
1688 self.xid = None
1689 if status != None:
1690 self.status = status
1691 else:
1692 self.status = 0
1693 return
1694
1695 def pack(self):
1696 packed = []
1697 packed.append(struct.pack("!B", self.version))
1698 packed.append(struct.pack("!B", self.type))
1699 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1700 packed.append(struct.pack("!L", self.xid))
1701 packed.append(struct.pack("!L", self.experimenter))
1702 packed.append(struct.pack("!L", self.subtype))
1703 packed.append(struct.pack("!L", self.status))
1704 length = sum([len(x) for x in packed])
1705 packed[2] = struct.pack("!H", length)
1706 return ''.join(packed)
1707
1708 @staticmethod
1709 def unpack(reader):
1710 obj = bsn_bw_clear_data_reply()
1711 _version = reader.read("!B")[0]
1712 assert(_version == 4)
1713 _type = reader.read("!B")[0]
1714 assert(_type == 4)
1715 _length = reader.read("!H")[0]
1716 orig_reader = reader
1717 reader = orig_reader.slice(_length, 4)
1718 obj.xid = reader.read("!L")[0]
1719 _experimenter = reader.read("!L")[0]
1720 assert(_experimenter == 6035143)
1721 _subtype = reader.read("!L")[0]
1722 assert(_subtype == 22)
1723 obj.status = reader.read("!L")[0]
1724 return obj
1725
1726 def __eq__(self, other):
1727 if type(self) != type(other): return False
1728 if self.xid != other.xid: return False
1729 if self.status != other.status: return False
1730 return True
1731
1732 def pretty_print(self, q):
1733 q.text("bsn_bw_clear_data_reply {")
1734 with q.group():
1735 with q.indent(2):
1736 q.breakable()
1737 q.text("xid = ");
1738 if self.xid != None:
1739 q.text("%#x" % self.xid)
1740 else:
1741 q.text('None')
1742 q.text(","); q.breakable()
1743 q.text("status = ");
1744 q.text("%#x" % self.status)
1745 q.breakable()
1746 q.text('}')
1747
1748bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1749
1750class bsn_bw_clear_data_request(bsn_header):
1751 version = 4
1752 type = 4
1753 experimenter = 6035143
1754 subtype = 21
1755
1756 def __init__(self, xid=None):
1757 if xid != None:
1758 self.xid = xid
1759 else:
1760 self.xid = None
1761 return
1762
1763 def pack(self):
1764 packed = []
1765 packed.append(struct.pack("!B", self.version))
1766 packed.append(struct.pack("!B", self.type))
1767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1768 packed.append(struct.pack("!L", self.xid))
1769 packed.append(struct.pack("!L", self.experimenter))
1770 packed.append(struct.pack("!L", self.subtype))
1771 length = sum([len(x) for x in packed])
1772 packed[2] = struct.pack("!H", length)
1773 return ''.join(packed)
1774
1775 @staticmethod
1776 def unpack(reader):
1777 obj = bsn_bw_clear_data_request()
1778 _version = reader.read("!B")[0]
1779 assert(_version == 4)
1780 _type = reader.read("!B")[0]
1781 assert(_type == 4)
1782 _length = reader.read("!H")[0]
1783 orig_reader = reader
1784 reader = orig_reader.slice(_length, 4)
1785 obj.xid = reader.read("!L")[0]
1786 _experimenter = reader.read("!L")[0]
1787 assert(_experimenter == 6035143)
1788 _subtype = reader.read("!L")[0]
1789 assert(_subtype == 21)
1790 return obj
1791
1792 def __eq__(self, other):
1793 if type(self) != type(other): return False
1794 if self.xid != other.xid: return False
1795 return True
1796
1797 def pretty_print(self, q):
1798 q.text("bsn_bw_clear_data_request {")
1799 with q.group():
1800 with q.indent(2):
1801 q.breakable()
1802 q.text("xid = ");
1803 if self.xid != None:
1804 q.text("%#x" % self.xid)
1805 else:
1806 q.text('None')
1807 q.breakable()
1808 q.text('}')
1809
1810bsn_header.subtypes[21] = bsn_bw_clear_data_request
1811
1812class bsn_bw_enable_get_reply(bsn_header):
1813 version = 4
1814 type = 4
1815 experimenter = 6035143
1816 subtype = 20
1817
1818 def __init__(self, xid=None, enabled=None):
1819 if xid != None:
1820 self.xid = xid
1821 else:
1822 self.xid = None
1823 if enabled != None:
1824 self.enabled = enabled
1825 else:
1826 self.enabled = 0
1827 return
1828
1829 def pack(self):
1830 packed = []
1831 packed.append(struct.pack("!B", self.version))
1832 packed.append(struct.pack("!B", self.type))
1833 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1834 packed.append(struct.pack("!L", self.xid))
1835 packed.append(struct.pack("!L", self.experimenter))
1836 packed.append(struct.pack("!L", self.subtype))
1837 packed.append(struct.pack("!L", self.enabled))
1838 length = sum([len(x) for x in packed])
1839 packed[2] = struct.pack("!H", length)
1840 return ''.join(packed)
1841
1842 @staticmethod
1843 def unpack(reader):
1844 obj = bsn_bw_enable_get_reply()
1845 _version = reader.read("!B")[0]
1846 assert(_version == 4)
1847 _type = reader.read("!B")[0]
1848 assert(_type == 4)
1849 _length = reader.read("!H")[0]
1850 orig_reader = reader
1851 reader = orig_reader.slice(_length, 4)
1852 obj.xid = reader.read("!L")[0]
1853 _experimenter = reader.read("!L")[0]
1854 assert(_experimenter == 6035143)
1855 _subtype = reader.read("!L")[0]
1856 assert(_subtype == 20)
1857 obj.enabled = reader.read("!L")[0]
1858 return obj
1859
1860 def __eq__(self, other):
1861 if type(self) != type(other): return False
1862 if self.xid != other.xid: return False
1863 if self.enabled != other.enabled: return False
1864 return True
1865
1866 def pretty_print(self, q):
1867 q.text("bsn_bw_enable_get_reply {")
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.text(","); q.breakable()
1877 q.text("enabled = ");
1878 q.text("%#x" % self.enabled)
1879 q.breakable()
1880 q.text('}')
1881
1882bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1883
1884class bsn_bw_enable_get_request(bsn_header):
1885 version = 4
1886 type = 4
1887 experimenter = 6035143
1888 subtype = 19
1889
1890 def __init__(self, xid=None):
1891 if xid != None:
1892 self.xid = xid
1893 else:
1894 self.xid = None
1895 return
1896
1897 def pack(self):
1898 packed = []
1899 packed.append(struct.pack("!B", self.version))
1900 packed.append(struct.pack("!B", self.type))
1901 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1902 packed.append(struct.pack("!L", self.xid))
1903 packed.append(struct.pack("!L", self.experimenter))
1904 packed.append(struct.pack("!L", self.subtype))
1905 length = sum([len(x) for x in packed])
1906 packed[2] = struct.pack("!H", length)
1907 return ''.join(packed)
1908
1909 @staticmethod
1910 def unpack(reader):
1911 obj = bsn_bw_enable_get_request()
1912 _version = reader.read("!B")[0]
1913 assert(_version == 4)
1914 _type = reader.read("!B")[0]
1915 assert(_type == 4)
1916 _length = reader.read("!H")[0]
1917 orig_reader = reader
1918 reader = orig_reader.slice(_length, 4)
1919 obj.xid = reader.read("!L")[0]
1920 _experimenter = reader.read("!L")[0]
1921 assert(_experimenter == 6035143)
1922 _subtype = reader.read("!L")[0]
1923 assert(_subtype == 19)
1924 return obj
1925
1926 def __eq__(self, other):
1927 if type(self) != type(other): return False
1928 if self.xid != other.xid: return False
1929 return True
1930
1931 def pretty_print(self, q):
1932 q.text("bsn_bw_enable_get_request {")
1933 with q.group():
1934 with q.indent(2):
1935 q.breakable()
1936 q.text("xid = ");
1937 if self.xid != None:
1938 q.text("%#x" % self.xid)
1939 else:
1940 q.text('None')
1941 q.breakable()
1942 q.text('}')
1943
1944bsn_header.subtypes[19] = bsn_bw_enable_get_request
1945
1946class bsn_bw_enable_set_reply(bsn_header):
1947 version = 4
1948 type = 4
1949 experimenter = 6035143
1950 subtype = 23
1951
1952 def __init__(self, xid=None, enable=None, status=None):
1953 if xid != None:
1954 self.xid = xid
1955 else:
1956 self.xid = None
1957 if enable != None:
1958 self.enable = enable
1959 else:
1960 self.enable = 0
1961 if status != None:
1962 self.status = status
1963 else:
1964 self.status = 0
1965 return
1966
1967 def pack(self):
1968 packed = []
1969 packed.append(struct.pack("!B", self.version))
1970 packed.append(struct.pack("!B", self.type))
1971 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1972 packed.append(struct.pack("!L", self.xid))
1973 packed.append(struct.pack("!L", self.experimenter))
1974 packed.append(struct.pack("!L", self.subtype))
1975 packed.append(struct.pack("!L", self.enable))
1976 packed.append(struct.pack("!L", self.status))
1977 length = sum([len(x) for x in packed])
1978 packed[2] = struct.pack("!H", length)
1979 return ''.join(packed)
1980
1981 @staticmethod
1982 def unpack(reader):
1983 obj = bsn_bw_enable_set_reply()
1984 _version = reader.read("!B")[0]
1985 assert(_version == 4)
1986 _type = reader.read("!B")[0]
1987 assert(_type == 4)
1988 _length = reader.read("!H")[0]
1989 orig_reader = reader
1990 reader = orig_reader.slice(_length, 4)
1991 obj.xid = reader.read("!L")[0]
1992 _experimenter = reader.read("!L")[0]
1993 assert(_experimenter == 6035143)
1994 _subtype = reader.read("!L")[0]
1995 assert(_subtype == 23)
1996 obj.enable = reader.read("!L")[0]
1997 obj.status = reader.read("!L")[0]
1998 return obj
1999
2000 def __eq__(self, other):
2001 if type(self) != type(other): return False
2002 if self.xid != other.xid: return False
2003 if self.enable != other.enable: return False
2004 if self.status != other.status: return False
2005 return True
2006
2007 def pretty_print(self, q):
2008 q.text("bsn_bw_enable_set_reply {")
2009 with q.group():
2010 with q.indent(2):
2011 q.breakable()
2012 q.text("xid = ");
2013 if self.xid != None:
2014 q.text("%#x" % self.xid)
2015 else:
2016 q.text('None')
2017 q.text(","); q.breakable()
2018 q.text("enable = ");
2019 q.text("%#x" % self.enable)
2020 q.text(","); q.breakable()
2021 q.text("status = ");
2022 q.text("%#x" % self.status)
2023 q.breakable()
2024 q.text('}')
2025
2026bsn_header.subtypes[23] = bsn_bw_enable_set_reply
2027
2028class bsn_bw_enable_set_request(bsn_header):
2029 version = 4
2030 type = 4
2031 experimenter = 6035143
2032 subtype = 18
2033
2034 def __init__(self, xid=None, enable=None):
2035 if xid != None:
2036 self.xid = xid
2037 else:
2038 self.xid = None
2039 if enable != None:
2040 self.enable = enable
2041 else:
2042 self.enable = 0
2043 return
2044
2045 def pack(self):
2046 packed = []
2047 packed.append(struct.pack("!B", self.version))
2048 packed.append(struct.pack("!B", self.type))
2049 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2050 packed.append(struct.pack("!L", self.xid))
2051 packed.append(struct.pack("!L", self.experimenter))
2052 packed.append(struct.pack("!L", self.subtype))
2053 packed.append(struct.pack("!L", self.enable))
2054 length = sum([len(x) for x in packed])
2055 packed[2] = struct.pack("!H", length)
2056 return ''.join(packed)
2057
2058 @staticmethod
2059 def unpack(reader):
2060 obj = bsn_bw_enable_set_request()
2061 _version = reader.read("!B")[0]
2062 assert(_version == 4)
2063 _type = reader.read("!B")[0]
2064 assert(_type == 4)
2065 _length = reader.read("!H")[0]
2066 orig_reader = reader
2067 reader = orig_reader.slice(_length, 4)
2068 obj.xid = reader.read("!L")[0]
2069 _experimenter = reader.read("!L")[0]
2070 assert(_experimenter == 6035143)
2071 _subtype = reader.read("!L")[0]
2072 assert(_subtype == 18)
2073 obj.enable = reader.read("!L")[0]
2074 return obj
2075
2076 def __eq__(self, other):
2077 if type(self) != type(other): return False
2078 if self.xid != other.xid: return False
2079 if self.enable != other.enable: return False
2080 return True
2081
2082 def pretty_print(self, q):
2083 q.text("bsn_bw_enable_set_request {")
2084 with q.group():
2085 with q.indent(2):
2086 q.breakable()
2087 q.text("xid = ");
2088 if self.xid != None:
2089 q.text("%#x" % self.xid)
2090 else:
2091 q.text('None')
2092 q.text(","); q.breakable()
2093 q.text("enable = ");
2094 q.text("%#x" % self.enable)
2095 q.breakable()
2096 q.text('}')
2097
2098bsn_header.subtypes[18] = bsn_bw_enable_set_request
2099
2100class bsn_controller_connections_reply(bsn_header):
2101 version = 4
2102 type = 4
2103 experimenter = 6035143
2104 subtype = 57
2105
2106 def __init__(self, xid=None, connections=None):
2107 if xid != None:
2108 self.xid = xid
2109 else:
2110 self.xid = None
2111 if connections != None:
2112 self.connections = connections
2113 else:
2114 self.connections = []
2115 return
2116
2117 def pack(self):
2118 packed = []
2119 packed.append(struct.pack("!B", self.version))
2120 packed.append(struct.pack("!B", self.type))
2121 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2122 packed.append(struct.pack("!L", self.xid))
2123 packed.append(struct.pack("!L", self.experimenter))
2124 packed.append(struct.pack("!L", self.subtype))
2125 packed.append(loxi.generic_util.pack_list(self.connections))
2126 length = sum([len(x) for x in packed])
2127 packed[2] = struct.pack("!H", length)
2128 return ''.join(packed)
2129
2130 @staticmethod
2131 def unpack(reader):
2132 obj = bsn_controller_connections_reply()
2133 _version = reader.read("!B")[0]
2134 assert(_version == 4)
2135 _type = reader.read("!B")[0]
2136 assert(_type == 4)
2137 _length = reader.read("!H")[0]
2138 orig_reader = reader
2139 reader = orig_reader.slice(_length, 4)
2140 obj.xid = reader.read("!L")[0]
2141 _experimenter = reader.read("!L")[0]
2142 assert(_experimenter == 6035143)
2143 _subtype = reader.read("!L")[0]
2144 assert(_subtype == 57)
2145 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
2146 return obj
2147
2148 def __eq__(self, other):
2149 if type(self) != type(other): return False
2150 if self.xid != other.xid: return False
2151 if self.connections != other.connections: return False
2152 return True
2153
2154 def pretty_print(self, q):
2155 q.text("bsn_controller_connections_reply {")
2156 with q.group():
2157 with q.indent(2):
2158 q.breakable()
2159 q.text("xid = ");
2160 if self.xid != None:
2161 q.text("%#x" % self.xid)
2162 else:
2163 q.text('None')
2164 q.text(","); q.breakable()
2165 q.text("connections = ");
2166 q.pp(self.connections)
2167 q.breakable()
2168 q.text('}')
2169
2170bsn_header.subtypes[57] = bsn_controller_connections_reply
2171
2172class bsn_controller_connections_request(bsn_header):
2173 version = 4
2174 type = 4
2175 experimenter = 6035143
2176 subtype = 56
2177
2178 def __init__(self, xid=None):
2179 if xid != None:
2180 self.xid = xid
2181 else:
2182 self.xid = None
2183 return
2184
2185 def pack(self):
2186 packed = []
2187 packed.append(struct.pack("!B", self.version))
2188 packed.append(struct.pack("!B", self.type))
2189 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2190 packed.append(struct.pack("!L", self.xid))
2191 packed.append(struct.pack("!L", self.experimenter))
2192 packed.append(struct.pack("!L", self.subtype))
2193 length = sum([len(x) for x in packed])
2194 packed[2] = struct.pack("!H", length)
2195 return ''.join(packed)
2196
2197 @staticmethod
2198 def unpack(reader):
2199 obj = bsn_controller_connections_request()
2200 _version = reader.read("!B")[0]
2201 assert(_version == 4)
2202 _type = reader.read("!B")[0]
2203 assert(_type == 4)
2204 _length = reader.read("!H")[0]
2205 orig_reader = reader
2206 reader = orig_reader.slice(_length, 4)
2207 obj.xid = reader.read("!L")[0]
2208 _experimenter = reader.read("!L")[0]
2209 assert(_experimenter == 6035143)
2210 _subtype = reader.read("!L")[0]
2211 assert(_subtype == 56)
2212 return obj
2213
2214 def __eq__(self, other):
2215 if type(self) != type(other): return False
2216 if self.xid != other.xid: return False
2217 return True
2218
2219 def pretty_print(self, q):
2220 q.text("bsn_controller_connections_request {")
2221 with q.group():
2222 with q.indent(2):
2223 q.breakable()
2224 q.text("xid = ");
2225 if self.xid != None:
2226 q.text("%#x" % self.xid)
2227 else:
2228 q.text('None')
2229 q.breakable()
2230 q.text('}')
2231
2232bsn_header.subtypes[56] = bsn_controller_connections_request
2233
2234class experimenter_stats_reply(stats_reply):
2235 subtypes = {}
2236
2237 version = 4
2238 type = 19
2239 stats_type = 65535
2240
2241 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2242 if xid != None:
2243 self.xid = xid
2244 else:
2245 self.xid = None
2246 if flags != None:
2247 self.flags = flags
2248 else:
2249 self.flags = 0
2250 if experimenter != None:
2251 self.experimenter = experimenter
2252 else:
2253 self.experimenter = 0
2254 if subtype != None:
2255 self.subtype = subtype
2256 else:
2257 self.subtype = 0
2258 return
2259
2260 def pack(self):
2261 packed = []
2262 packed.append(struct.pack("!B", self.version))
2263 packed.append(struct.pack("!B", self.type))
2264 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2265 packed.append(struct.pack("!L", self.xid))
2266 packed.append(struct.pack("!H", self.stats_type))
2267 packed.append(struct.pack("!H", self.flags))
2268 packed.append('\x00' * 4)
2269 packed.append(struct.pack("!L", self.experimenter))
2270 packed.append(struct.pack("!L", self.subtype))
2271 length = sum([len(x) for x in packed])
2272 packed[2] = struct.pack("!H", length)
2273 return ''.join(packed)
2274
2275 @staticmethod
2276 def unpack(reader):
2277 subtype, = reader.peek('!L', 16)
2278 subclass = experimenter_stats_reply.subtypes.get(subtype)
2279 if subclass:
2280 return subclass.unpack(reader)
2281
2282 obj = experimenter_stats_reply()
2283 _version = reader.read("!B")[0]
2284 assert(_version == 4)
2285 _type = reader.read("!B")[0]
2286 assert(_type == 19)
2287 _length = reader.read("!H")[0]
2288 orig_reader = reader
2289 reader = orig_reader.slice(_length, 4)
2290 obj.xid = reader.read("!L")[0]
2291 _stats_type = reader.read("!H")[0]
2292 assert(_stats_type == 65535)
2293 obj.flags = reader.read("!H")[0]
2294 reader.skip(4)
2295 obj.experimenter = reader.read("!L")[0]
2296 obj.subtype = reader.read("!L")[0]
2297 return obj
2298
2299 def __eq__(self, other):
2300 if type(self) != type(other): return False
2301 if self.xid != other.xid: return False
2302 if self.flags != other.flags: return False
2303 if self.experimenter != other.experimenter: return False
2304 if self.subtype != other.subtype: return False
2305 return True
2306
2307 def pretty_print(self, q):
2308 q.text("experimenter_stats_reply {")
2309 with q.group():
2310 with q.indent(2):
2311 q.breakable()
2312 q.text("xid = ");
2313 if self.xid != None:
2314 q.text("%#x" % self.xid)
2315 else:
2316 q.text('None')
2317 q.text(","); q.breakable()
2318 q.text("flags = ");
2319 q.text("%#x" % self.flags)
2320 q.text(","); q.breakable()
2321 q.text("subtype = ");
2322 q.text("%#x" % self.subtype)
2323 q.breakable()
2324 q.text('}')
2325
2326stats_reply.subtypes[65535] = experimenter_stats_reply
2327
2328class bsn_stats_reply(experimenter_stats_reply):
2329 subtypes = {}
2330
2331 version = 4
2332 type = 19
2333 stats_type = 65535
2334 experimenter = 6035143
2335
2336 def __init__(self, xid=None, flags=None, subtype=None):
2337 if xid != None:
2338 self.xid = xid
2339 else:
2340 self.xid = None
2341 if flags != None:
2342 self.flags = flags
2343 else:
2344 self.flags = 0
2345 if subtype != None:
2346 self.subtype = subtype
2347 else:
2348 self.subtype = 0
2349 return
2350
2351 def pack(self):
2352 packed = []
2353 packed.append(struct.pack("!B", self.version))
2354 packed.append(struct.pack("!B", self.type))
2355 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2356 packed.append(struct.pack("!L", self.xid))
2357 packed.append(struct.pack("!H", self.stats_type))
2358 packed.append(struct.pack("!H", self.flags))
2359 packed.append('\x00' * 4)
2360 packed.append(struct.pack("!L", self.experimenter))
2361 packed.append(struct.pack("!L", self.subtype))
2362 length = sum([len(x) for x in packed])
2363 packed[2] = struct.pack("!H", length)
2364 return ''.join(packed)
2365
2366 @staticmethod
2367 def unpack(reader):
2368 subtype, = reader.peek('!L', 20)
2369 subclass = bsn_stats_reply.subtypes.get(subtype)
2370 if subclass:
2371 return subclass.unpack(reader)
2372
2373 obj = bsn_stats_reply()
2374 _version = reader.read("!B")[0]
2375 assert(_version == 4)
2376 _type = reader.read("!B")[0]
2377 assert(_type == 19)
2378 _length = reader.read("!H")[0]
2379 orig_reader = reader
2380 reader = orig_reader.slice(_length, 4)
2381 obj.xid = reader.read("!L")[0]
2382 _stats_type = reader.read("!H")[0]
2383 assert(_stats_type == 65535)
2384 obj.flags = reader.read("!H")[0]
2385 reader.skip(4)
2386 _experimenter = reader.read("!L")[0]
2387 assert(_experimenter == 6035143)
2388 obj.subtype = reader.read("!L")[0]
2389 return obj
2390
2391 def __eq__(self, other):
2392 if type(self) != type(other): return False
2393 if self.xid != other.xid: return False
2394 if self.flags != other.flags: return False
2395 if self.subtype != other.subtype: return False
2396 return True
2397
2398 def pretty_print(self, q):
2399 q.text("bsn_stats_reply {")
2400 with q.group():
2401 with q.indent(2):
2402 q.breakable()
2403 q.text("xid = ");
2404 if self.xid != None:
2405 q.text("%#x" % self.xid)
2406 else:
2407 q.text('None')
2408 q.text(","); q.breakable()
2409 q.text("flags = ");
2410 q.text("%#x" % self.flags)
2411 q.breakable()
2412 q.text('}')
2413
2414experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2415
2416class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
2417 version = 4
2418 type = 19
2419 stats_type = 65535
2420 experimenter = 6035143
2421 subtype = 13
2422
2423 def __init__(self, xid=None, flags=None, entries=None):
2424 if xid != None:
2425 self.xid = xid
2426 else:
2427 self.xid = None
2428 if flags != None:
2429 self.flags = flags
2430 else:
2431 self.flags = 0
2432 if entries != None:
2433 self.entries = entries
2434 else:
2435 self.entries = []
2436 return
2437
2438 def pack(self):
2439 packed = []
2440 packed.append(struct.pack("!B", self.version))
2441 packed.append(struct.pack("!B", self.type))
2442 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2443 packed.append(struct.pack("!L", self.xid))
2444 packed.append(struct.pack("!H", self.stats_type))
2445 packed.append(struct.pack("!H", self.flags))
2446 packed.append('\x00' * 4)
2447 packed.append(struct.pack("!L", self.experimenter))
2448 packed.append(struct.pack("!L", self.subtype))
2449 packed.append(loxi.generic_util.pack_list(self.entries))
2450 length = sum([len(x) for x in packed])
2451 packed[2] = struct.pack("!H", length)
2452 return ''.join(packed)
2453
2454 @staticmethod
2455 def unpack(reader):
2456 obj = bsn_debug_counter_desc_stats_reply()
2457 _version = reader.read("!B")[0]
2458 assert(_version == 4)
2459 _type = reader.read("!B")[0]
2460 assert(_type == 19)
2461 _length = reader.read("!H")[0]
2462 orig_reader = reader
2463 reader = orig_reader.slice(_length, 4)
2464 obj.xid = reader.read("!L")[0]
2465 _stats_type = reader.read("!H")[0]
2466 assert(_stats_type == 65535)
2467 obj.flags = reader.read("!H")[0]
2468 reader.skip(4)
2469 _experimenter = reader.read("!L")[0]
2470 assert(_experimenter == 6035143)
2471 _subtype = reader.read("!L")[0]
2472 assert(_subtype == 13)
2473 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
2474 return obj
2475
2476 def __eq__(self, other):
2477 if type(self) != type(other): return False
2478 if self.xid != other.xid: return False
2479 if self.flags != other.flags: return False
2480 if self.entries != other.entries: return False
2481 return True
2482
2483 def pretty_print(self, q):
2484 q.text("bsn_debug_counter_desc_stats_reply {")
2485 with q.group():
2486 with q.indent(2):
2487 q.breakable()
2488 q.text("xid = ");
2489 if self.xid != None:
2490 q.text("%#x" % self.xid)
2491 else:
2492 q.text('None')
2493 q.text(","); q.breakable()
2494 q.text("flags = ");
2495 q.text("%#x" % self.flags)
2496 q.text(","); q.breakable()
2497 q.text("entries = ");
2498 q.pp(self.entries)
2499 q.breakable()
2500 q.text('}')
2501
2502bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
2503
2504class experimenter_stats_request(stats_request):
2505 subtypes = {}
2506
2507 version = 4
2508 type = 18
2509 stats_type = 65535
2510
2511 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2512 if xid != None:
2513 self.xid = xid
2514 else:
2515 self.xid = None
2516 if flags != None:
2517 self.flags = flags
2518 else:
2519 self.flags = 0
2520 if experimenter != None:
2521 self.experimenter = experimenter
2522 else:
2523 self.experimenter = 0
2524 if subtype != None:
2525 self.subtype = subtype
2526 else:
2527 self.subtype = 0
2528 return
2529
2530 def pack(self):
2531 packed = []
2532 packed.append(struct.pack("!B", self.version))
2533 packed.append(struct.pack("!B", self.type))
2534 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2535 packed.append(struct.pack("!L", self.xid))
2536 packed.append(struct.pack("!H", self.stats_type))
2537 packed.append(struct.pack("!H", self.flags))
2538 packed.append('\x00' * 4)
2539 packed.append(struct.pack("!L", self.experimenter))
2540 packed.append(struct.pack("!L", self.subtype))
2541 length = sum([len(x) for x in packed])
2542 packed[2] = struct.pack("!H", length)
2543 return ''.join(packed)
2544
2545 @staticmethod
2546 def unpack(reader):
2547 subtype, = reader.peek('!L', 16)
2548 subclass = experimenter_stats_request.subtypes.get(subtype)
2549 if subclass:
2550 return subclass.unpack(reader)
2551
2552 obj = experimenter_stats_request()
2553 _version = reader.read("!B")[0]
2554 assert(_version == 4)
2555 _type = reader.read("!B")[0]
2556 assert(_type == 18)
2557 _length = reader.read("!H")[0]
2558 orig_reader = reader
2559 reader = orig_reader.slice(_length, 4)
2560 obj.xid = reader.read("!L")[0]
2561 _stats_type = reader.read("!H")[0]
2562 assert(_stats_type == 65535)
2563 obj.flags = reader.read("!H")[0]
2564 reader.skip(4)
2565 obj.experimenter = reader.read("!L")[0]
2566 obj.subtype = reader.read("!L")[0]
2567 return obj
2568
2569 def __eq__(self, other):
2570 if type(self) != type(other): return False
2571 if self.xid != other.xid: return False
2572 if self.flags != other.flags: return False
2573 if self.experimenter != other.experimenter: return False
2574 if self.subtype != other.subtype: return False
2575 return True
2576
2577 def pretty_print(self, q):
2578 q.text("experimenter_stats_request {")
2579 with q.group():
2580 with q.indent(2):
2581 q.breakable()
2582 q.text("xid = ");
2583 if self.xid != None:
2584 q.text("%#x" % self.xid)
2585 else:
2586 q.text('None')
2587 q.text(","); q.breakable()
2588 q.text("flags = ");
2589 q.text("%#x" % self.flags)
2590 q.text(","); q.breakable()
2591 q.text("subtype = ");
2592 q.text("%#x" % self.subtype)
2593 q.breakable()
2594 q.text('}')
2595
2596stats_request.subtypes[65535] = experimenter_stats_request
2597
2598class bsn_stats_request(experimenter_stats_request):
2599 subtypes = {}
2600
2601 version = 4
2602 type = 18
2603 stats_type = 65535
2604 experimenter = 6035143
2605
2606 def __init__(self, xid=None, flags=None, subtype=None):
2607 if xid != None:
2608 self.xid = xid
2609 else:
2610 self.xid = None
2611 if flags != None:
2612 self.flags = flags
2613 else:
2614 self.flags = 0
2615 if subtype != None:
2616 self.subtype = subtype
2617 else:
2618 self.subtype = 0
2619 return
2620
2621 def pack(self):
2622 packed = []
2623 packed.append(struct.pack("!B", self.version))
2624 packed.append(struct.pack("!B", self.type))
2625 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2626 packed.append(struct.pack("!L", self.xid))
2627 packed.append(struct.pack("!H", self.stats_type))
2628 packed.append(struct.pack("!H", self.flags))
2629 packed.append('\x00' * 4)
2630 packed.append(struct.pack("!L", self.experimenter))
2631 packed.append(struct.pack("!L", self.subtype))
2632 length = sum([len(x) for x in packed])
2633 packed[2] = struct.pack("!H", length)
2634 return ''.join(packed)
2635
2636 @staticmethod
2637 def unpack(reader):
2638 subtype, = reader.peek('!L', 20)
2639 subclass = bsn_stats_request.subtypes.get(subtype)
2640 if subclass:
2641 return subclass.unpack(reader)
2642
2643 obj = bsn_stats_request()
2644 _version = reader.read("!B")[0]
2645 assert(_version == 4)
2646 _type = reader.read("!B")[0]
2647 assert(_type == 18)
2648 _length = reader.read("!H")[0]
2649 orig_reader = reader
2650 reader = orig_reader.slice(_length, 4)
2651 obj.xid = reader.read("!L")[0]
2652 _stats_type = reader.read("!H")[0]
2653 assert(_stats_type == 65535)
2654 obj.flags = reader.read("!H")[0]
2655 reader.skip(4)
2656 _experimenter = reader.read("!L")[0]
2657 assert(_experimenter == 6035143)
2658 obj.subtype = reader.read("!L")[0]
2659 return obj
2660
2661 def __eq__(self, other):
2662 if type(self) != type(other): return False
2663 if self.xid != other.xid: return False
2664 if self.flags != other.flags: return False
2665 if self.subtype != other.subtype: return False
2666 return True
2667
2668 def pretty_print(self, q):
2669 q.text("bsn_stats_request {")
2670 with q.group():
2671 with q.indent(2):
2672 q.breakable()
2673 q.text("xid = ");
2674 if self.xid != None:
2675 q.text("%#x" % self.xid)
2676 else:
2677 q.text('None')
2678 q.text(","); q.breakable()
2679 q.text("flags = ");
2680 q.text("%#x" % self.flags)
2681 q.breakable()
2682 q.text('}')
2683
2684experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2685
2686class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2687 version = 4
2688 type = 18
2689 stats_type = 65535
2690 experimenter = 6035143
2691 subtype = 13
2692
2693 def __init__(self, xid=None, flags=None):
2694 if xid != None:
2695 self.xid = xid
2696 else:
2697 self.xid = None
2698 if flags != None:
2699 self.flags = flags
2700 else:
2701 self.flags = 0
2702 return
2703
2704 def pack(self):
2705 packed = []
2706 packed.append(struct.pack("!B", self.version))
2707 packed.append(struct.pack("!B", self.type))
2708 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2709 packed.append(struct.pack("!L", self.xid))
2710 packed.append(struct.pack("!H", self.stats_type))
2711 packed.append(struct.pack("!H", self.flags))
2712 packed.append('\x00' * 4)
2713 packed.append(struct.pack("!L", self.experimenter))
2714 packed.append(struct.pack("!L", self.subtype))
2715 length = sum([len(x) for x in packed])
2716 packed[2] = struct.pack("!H", length)
2717 return ''.join(packed)
2718
2719 @staticmethod
2720 def unpack(reader):
2721 obj = bsn_debug_counter_desc_stats_request()
2722 _version = reader.read("!B")[0]
2723 assert(_version == 4)
2724 _type = reader.read("!B")[0]
2725 assert(_type == 18)
2726 _length = reader.read("!H")[0]
2727 orig_reader = reader
2728 reader = orig_reader.slice(_length, 4)
2729 obj.xid = reader.read("!L")[0]
2730 _stats_type = reader.read("!H")[0]
2731 assert(_stats_type == 65535)
2732 obj.flags = reader.read("!H")[0]
2733 reader.skip(4)
2734 _experimenter = reader.read("!L")[0]
2735 assert(_experimenter == 6035143)
2736 _subtype = reader.read("!L")[0]
2737 assert(_subtype == 13)
2738 return obj
2739
2740 def __eq__(self, other):
2741 if type(self) != type(other): return False
2742 if self.xid != other.xid: return False
2743 if self.flags != other.flags: return False
2744 return True
2745
2746 def pretty_print(self, q):
2747 q.text("bsn_debug_counter_desc_stats_request {")
2748 with q.group():
2749 with q.indent(2):
2750 q.breakable()
2751 q.text("xid = ");
2752 if self.xid != None:
2753 q.text("%#x" % self.xid)
2754 else:
2755 q.text('None')
2756 q.text(","); q.breakable()
2757 q.text("flags = ");
2758 q.text("%#x" % self.flags)
2759 q.breakable()
2760 q.text('}')
2761
2762bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2763
2764class bsn_debug_counter_stats_reply(bsn_stats_reply):
2765 version = 4
2766 type = 19
2767 stats_type = 65535
2768 experimenter = 6035143
2769 subtype = 12
2770
2771 def __init__(self, xid=None, flags=None, entries=None):
2772 if xid != None:
2773 self.xid = xid
2774 else:
2775 self.xid = None
2776 if flags != None:
2777 self.flags = flags
2778 else:
2779 self.flags = 0
2780 if entries != None:
2781 self.entries = entries
2782 else:
2783 self.entries = []
2784 return
2785
2786 def pack(self):
2787 packed = []
2788 packed.append(struct.pack("!B", self.version))
2789 packed.append(struct.pack("!B", self.type))
2790 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2791 packed.append(struct.pack("!L", self.xid))
2792 packed.append(struct.pack("!H", self.stats_type))
2793 packed.append(struct.pack("!H", self.flags))
2794 packed.append('\x00' * 4)
2795 packed.append(struct.pack("!L", self.experimenter))
2796 packed.append(struct.pack("!L", self.subtype))
2797 packed.append(loxi.generic_util.pack_list(self.entries))
2798 length = sum([len(x) for x in packed])
2799 packed[2] = struct.pack("!H", length)
2800 return ''.join(packed)
2801
2802 @staticmethod
2803 def unpack(reader):
2804 obj = bsn_debug_counter_stats_reply()
2805 _version = reader.read("!B")[0]
2806 assert(_version == 4)
2807 _type = reader.read("!B")[0]
2808 assert(_type == 19)
2809 _length = reader.read("!H")[0]
2810 orig_reader = reader
2811 reader = orig_reader.slice(_length, 4)
2812 obj.xid = reader.read("!L")[0]
2813 _stats_type = reader.read("!H")[0]
2814 assert(_stats_type == 65535)
2815 obj.flags = reader.read("!H")[0]
2816 reader.skip(4)
2817 _experimenter = reader.read("!L")[0]
2818 assert(_experimenter == 6035143)
2819 _subtype = reader.read("!L")[0]
2820 assert(_subtype == 12)
2821 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
2822 return obj
2823
2824 def __eq__(self, other):
2825 if type(self) != type(other): return False
2826 if self.xid != other.xid: return False
2827 if self.flags != other.flags: return False
2828 if self.entries != other.entries: return False
2829 return True
2830
2831 def pretty_print(self, q):
2832 q.text("bsn_debug_counter_stats_reply {")
2833 with q.group():
2834 with q.indent(2):
2835 q.breakable()
2836 q.text("xid = ");
2837 if self.xid != None:
2838 q.text("%#x" % self.xid)
2839 else:
2840 q.text('None')
2841 q.text(","); q.breakable()
2842 q.text("flags = ");
2843 q.text("%#x" % self.flags)
2844 q.text(","); q.breakable()
2845 q.text("entries = ");
2846 q.pp(self.entries)
2847 q.breakable()
2848 q.text('}')
2849
2850bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2851
2852class bsn_debug_counter_stats_request(bsn_stats_request):
2853 version = 4
2854 type = 18
2855 stats_type = 65535
2856 experimenter = 6035143
2857 subtype = 12
2858
2859 def __init__(self, xid=None, flags=None):
2860 if xid != None:
2861 self.xid = xid
2862 else:
2863 self.xid = None
2864 if flags != None:
2865 self.flags = flags
2866 else:
2867 self.flags = 0
2868 return
2869
2870 def pack(self):
2871 packed = []
2872 packed.append(struct.pack("!B", self.version))
2873 packed.append(struct.pack("!B", self.type))
2874 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2875 packed.append(struct.pack("!L", self.xid))
2876 packed.append(struct.pack("!H", self.stats_type))
2877 packed.append(struct.pack("!H", self.flags))
2878 packed.append('\x00' * 4)
2879 packed.append(struct.pack("!L", self.experimenter))
2880 packed.append(struct.pack("!L", self.subtype))
2881 length = sum([len(x) for x in packed])
2882 packed[2] = struct.pack("!H", length)
2883 return ''.join(packed)
2884
2885 @staticmethod
2886 def unpack(reader):
2887 obj = bsn_debug_counter_stats_request()
2888 _version = reader.read("!B")[0]
2889 assert(_version == 4)
2890 _type = reader.read("!B")[0]
2891 assert(_type == 18)
2892 _length = reader.read("!H")[0]
2893 orig_reader = reader
2894 reader = orig_reader.slice(_length, 4)
2895 obj.xid = reader.read("!L")[0]
2896 _stats_type = reader.read("!H")[0]
2897 assert(_stats_type == 65535)
2898 obj.flags = reader.read("!H")[0]
2899 reader.skip(4)
2900 _experimenter = reader.read("!L")[0]
2901 assert(_experimenter == 6035143)
2902 _subtype = reader.read("!L")[0]
2903 assert(_subtype == 12)
2904 return obj
2905
2906 def __eq__(self, other):
2907 if type(self) != type(other): return False
2908 if self.xid != other.xid: return False
2909 if self.flags != other.flags: return False
2910 return True
2911
2912 def pretty_print(self, q):
2913 q.text("bsn_debug_counter_stats_request {")
2914 with q.group():
2915 with q.indent(2):
2916 q.breakable()
2917 q.text("xid = ");
2918 if self.xid != None:
2919 q.text("%#x" % self.xid)
2920 else:
2921 q.text('None')
2922 q.text(","); q.breakable()
2923 q.text("flags = ");
2924 q.text("%#x" % self.flags)
2925 q.breakable()
2926 q.text('}')
2927
2928bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2929
2930class bsn_error(bsn_base_error):
2931 version = 4
2932 type = 1
2933 err_type = 65535
2934 subtype = 1
2935 experimenter = 6035143
2936
2937 def __init__(self, xid=None, err_msg=None, data=None):
2938 if xid != None:
2939 self.xid = xid
2940 else:
2941 self.xid = None
2942 if err_msg != None:
2943 self.err_msg = err_msg
2944 else:
2945 self.err_msg = ""
2946 if data != None:
2947 self.data = data
2948 else:
2949 self.data = ''
2950 return
2951
2952 def pack(self):
2953 packed = []
2954 packed.append(struct.pack("!B", self.version))
2955 packed.append(struct.pack("!B", self.type))
2956 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2957 packed.append(struct.pack("!L", self.xid))
2958 packed.append(struct.pack("!H", self.err_type))
2959 packed.append(struct.pack("!H", self.subtype))
2960 packed.append(struct.pack("!L", self.experimenter))
2961 packed.append(struct.pack("!256s", self.err_msg))
2962 packed.append(self.data)
2963 length = sum([len(x) for x in packed])
2964 packed[2] = struct.pack("!H", length)
2965 return ''.join(packed)
2966
2967 @staticmethod
2968 def unpack(reader):
2969 obj = bsn_error()
2970 _version = reader.read("!B")[0]
2971 assert(_version == 4)
2972 _type = reader.read("!B")[0]
2973 assert(_type == 1)
2974 _length = reader.read("!H")[0]
2975 orig_reader = reader
2976 reader = orig_reader.slice(_length, 4)
2977 obj.xid = reader.read("!L")[0]
2978 _err_type = reader.read("!H")[0]
2979 assert(_err_type == 65535)
2980 _subtype = reader.read("!H")[0]
2981 assert(_subtype == 1)
2982 _experimenter = reader.read("!L")[0]
2983 assert(_experimenter == 6035143)
2984 obj.err_msg = reader.read("!256s")[0].rstrip("\x00")
2985 obj.data = str(reader.read_all())
2986 return obj
2987
2988 def __eq__(self, other):
2989 if type(self) != type(other): return False
2990 if self.xid != other.xid: return False
2991 if self.err_msg != other.err_msg: return False
2992 if self.data != other.data: return False
2993 return True
2994
2995 def pretty_print(self, q):
2996 q.text("bsn_error {")
2997 with q.group():
2998 with q.indent(2):
2999 q.breakable()
3000 q.text("xid = ");
3001 if self.xid != None:
3002 q.text("%#x" % self.xid)
3003 else:
3004 q.text('None')
3005 q.text(","); q.breakable()
3006 q.text("err_msg = ");
3007 q.pp(self.err_msg)
3008 q.text(","); q.breakable()
3009 q.text("data = ");
3010 q.pp(self.data)
3011 q.breakable()
3012 q.text('}')
3013
3014bsn_base_error.subtypes[1] = bsn_error
3015
3016class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
3017 version = 4
3018 type = 19
3019 stats_type = 65535
3020 experimenter = 6035143
3021 subtype = 10
3022
3023 def __init__(self, xid=None, flags=None, entries=None):
3024 if xid != None:
3025 self.xid = xid
3026 else:
3027 self.xid = None
3028 if flags != None:
3029 self.flags = flags
3030 else:
3031 self.flags = 0
3032 if entries != None:
3033 self.entries = entries
3034 else:
3035 self.entries = []
3036 return
3037
3038 def pack(self):
3039 packed = []
3040 packed.append(struct.pack("!B", self.version))
3041 packed.append(struct.pack("!B", self.type))
3042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3043 packed.append(struct.pack("!L", self.xid))
3044 packed.append(struct.pack("!H", self.stats_type))
3045 packed.append(struct.pack("!H", self.flags))
3046 packed.append('\x00' * 4)
3047 packed.append(struct.pack("!L", self.experimenter))
3048 packed.append(struct.pack("!L", self.subtype))
3049 packed.append(loxi.generic_util.pack_list(self.entries))
3050 length = sum([len(x) for x in packed])
3051 packed[2] = struct.pack("!H", length)
3052 return ''.join(packed)
3053
3054 @staticmethod
3055 def unpack(reader):
3056 obj = bsn_flow_checksum_bucket_stats_reply()
3057 _version = reader.read("!B")[0]
3058 assert(_version == 4)
3059 _type = reader.read("!B")[0]
3060 assert(_type == 19)
3061 _length = reader.read("!H")[0]
3062 orig_reader = reader
3063 reader = orig_reader.slice(_length, 4)
3064 obj.xid = reader.read("!L")[0]
3065 _stats_type = reader.read("!H")[0]
3066 assert(_stats_type == 65535)
3067 obj.flags = reader.read("!H")[0]
3068 reader.skip(4)
3069 _experimenter = reader.read("!L")[0]
3070 assert(_experimenter == 6035143)
3071 _subtype = reader.read("!L")[0]
3072 assert(_subtype == 10)
3073 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
3074 return obj
3075
3076 def __eq__(self, other):
3077 if type(self) != type(other): return False
3078 if self.xid != other.xid: return False
3079 if self.flags != other.flags: return False
3080 if self.entries != other.entries: return False
3081 return True
3082
3083 def pretty_print(self, q):
3084 q.text("bsn_flow_checksum_bucket_stats_reply {")
3085 with q.group():
3086 with q.indent(2):
3087 q.breakable()
3088 q.text("xid = ");
3089 if self.xid != None:
3090 q.text("%#x" % self.xid)
3091 else:
3092 q.text('None')
3093 q.text(","); q.breakable()
3094 q.text("flags = ");
3095 q.text("%#x" % self.flags)
3096 q.text(","); q.breakable()
3097 q.text("entries = ");
3098 q.pp(self.entries)
3099 q.breakable()
3100 q.text('}')
3101
3102bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
3103
3104class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
3105 version = 4
3106 type = 18
3107 stats_type = 65535
3108 experimenter = 6035143
3109 subtype = 10
3110
3111 def __init__(self, xid=None, flags=None, table_id=None):
3112 if xid != None:
3113 self.xid = xid
3114 else:
3115 self.xid = None
3116 if flags != None:
3117 self.flags = flags
3118 else:
3119 self.flags = 0
3120 if table_id != None:
3121 self.table_id = table_id
3122 else:
3123 self.table_id = 0
3124 return
3125
3126 def pack(self):
3127 packed = []
3128 packed.append(struct.pack("!B", self.version))
3129 packed.append(struct.pack("!B", self.type))
3130 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3131 packed.append(struct.pack("!L", self.xid))
3132 packed.append(struct.pack("!H", self.stats_type))
3133 packed.append(struct.pack("!H", self.flags))
3134 packed.append('\x00' * 4)
3135 packed.append(struct.pack("!L", self.experimenter))
3136 packed.append(struct.pack("!L", self.subtype))
3137 packed.append(struct.pack("!B", self.table_id))
3138 length = sum([len(x) for x in packed])
3139 packed[2] = struct.pack("!H", length)
3140 return ''.join(packed)
3141
3142 @staticmethod
3143 def unpack(reader):
3144 obj = bsn_flow_checksum_bucket_stats_request()
3145 _version = reader.read("!B")[0]
3146 assert(_version == 4)
3147 _type = reader.read("!B")[0]
3148 assert(_type == 18)
3149 _length = reader.read("!H")[0]
3150 orig_reader = reader
3151 reader = orig_reader.slice(_length, 4)
3152 obj.xid = reader.read("!L")[0]
3153 _stats_type = reader.read("!H")[0]
3154 assert(_stats_type == 65535)
3155 obj.flags = reader.read("!H")[0]
3156 reader.skip(4)
3157 _experimenter = reader.read("!L")[0]
3158 assert(_experimenter == 6035143)
3159 _subtype = reader.read("!L")[0]
3160 assert(_subtype == 10)
3161 obj.table_id = reader.read("!B")[0]
3162 return obj
3163
3164 def __eq__(self, other):
3165 if type(self) != type(other): return False
3166 if self.xid != other.xid: return False
3167 if self.flags != other.flags: return False
3168 if self.table_id != other.table_id: return False
3169 return True
3170
3171 def pretty_print(self, q):
3172 q.text("bsn_flow_checksum_bucket_stats_request {")
3173 with q.group():
3174 with q.indent(2):
3175 q.breakable()
3176 q.text("xid = ");
3177 if self.xid != None:
3178 q.text("%#x" % self.xid)
3179 else:
3180 q.text('None')
3181 q.text(","); q.breakable()
3182 q.text("flags = ");
3183 q.text("%#x" % self.flags)
3184 q.text(","); q.breakable()
3185 q.text("table_id = ");
3186 q.text("%#x" % self.table_id)
3187 q.breakable()
3188 q.text('}')
3189
3190bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
3191
3192class bsn_flow_idle(bsn_header):
3193 version = 4
3194 type = 4
3195 experimenter = 6035143
3196 subtype = 40
3197
3198 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
3199 if xid != None:
3200 self.xid = xid
3201 else:
3202 self.xid = None
3203 if cookie != None:
3204 self.cookie = cookie
3205 else:
3206 self.cookie = 0
3207 if priority != None:
3208 self.priority = priority
3209 else:
3210 self.priority = 0
3211 if table_id != None:
3212 self.table_id = table_id
3213 else:
3214 self.table_id = 0
3215 if match != None:
3216 self.match = match
3217 else:
3218 self.match = ofp.match()
3219 return
3220
3221 def pack(self):
3222 packed = []
3223 packed.append(struct.pack("!B", self.version))
3224 packed.append(struct.pack("!B", self.type))
3225 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3226 packed.append(struct.pack("!L", self.xid))
3227 packed.append(struct.pack("!L", self.experimenter))
3228 packed.append(struct.pack("!L", self.subtype))
3229 packed.append(struct.pack("!Q", self.cookie))
3230 packed.append(struct.pack("!H", self.priority))
3231 packed.append(struct.pack("!B", self.table_id))
3232 packed.append('\x00' * 5)
3233 packed.append(self.match.pack())
3234 length = sum([len(x) for x in packed])
3235 packed[2] = struct.pack("!H", length)
3236 return ''.join(packed)
3237
3238 @staticmethod
3239 def unpack(reader):
3240 obj = bsn_flow_idle()
3241 _version = reader.read("!B")[0]
3242 assert(_version == 4)
3243 _type = reader.read("!B")[0]
3244 assert(_type == 4)
3245 _length = reader.read("!H")[0]
3246 orig_reader = reader
3247 reader = orig_reader.slice(_length, 4)
3248 obj.xid = reader.read("!L")[0]
3249 _experimenter = reader.read("!L")[0]
3250 assert(_experimenter == 6035143)
3251 _subtype = reader.read("!L")[0]
3252 assert(_subtype == 40)
3253 obj.cookie = reader.read("!Q")[0]
3254 obj.priority = reader.read("!H")[0]
3255 obj.table_id = reader.read("!B")[0]
3256 reader.skip(5)
3257 obj.match = ofp.match.unpack(reader)
3258 return obj
3259
3260 def __eq__(self, other):
3261 if type(self) != type(other): return False
3262 if self.xid != other.xid: return False
3263 if self.cookie != other.cookie: return False
3264 if self.priority != other.priority: return False
3265 if self.table_id != other.table_id: return False
3266 if self.match != other.match: return False
3267 return True
3268
3269 def pretty_print(self, q):
3270 q.text("bsn_flow_idle {")
3271 with q.group():
3272 with q.indent(2):
3273 q.breakable()
3274 q.text("xid = ");
3275 if self.xid != None:
3276 q.text("%#x" % self.xid)
3277 else:
3278 q.text('None')
3279 q.text(","); q.breakable()
3280 q.text("cookie = ");
3281 q.text("%#x" % self.cookie)
3282 q.text(","); q.breakable()
3283 q.text("priority = ");
3284 q.text("%#x" % self.priority)
3285 q.text(","); q.breakable()
3286 q.text("table_id = ");
3287 q.text("%#x" % self.table_id)
3288 q.text(","); q.breakable()
3289 q.text("match = ");
3290 q.pp(self.match)
3291 q.breakable()
3292 q.text('}')
3293
3294bsn_header.subtypes[40] = bsn_flow_idle
3295
3296class bsn_flow_idle_enable_get_reply(bsn_header):
3297 version = 4
3298 type = 4
3299 experimenter = 6035143
3300 subtype = 39
3301
3302 def __init__(self, xid=None, enabled=None):
3303 if xid != None:
3304 self.xid = xid
3305 else:
3306 self.xid = None
3307 if enabled != None:
3308 self.enabled = enabled
3309 else:
3310 self.enabled = 0
3311 return
3312
3313 def pack(self):
3314 packed = []
3315 packed.append(struct.pack("!B", self.version))
3316 packed.append(struct.pack("!B", self.type))
3317 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3318 packed.append(struct.pack("!L", self.xid))
3319 packed.append(struct.pack("!L", self.experimenter))
3320 packed.append(struct.pack("!L", self.subtype))
3321 packed.append(struct.pack("!L", self.enabled))
3322 length = sum([len(x) for x in packed])
3323 packed[2] = struct.pack("!H", length)
3324 return ''.join(packed)
3325
3326 @staticmethod
3327 def unpack(reader):
3328 obj = bsn_flow_idle_enable_get_reply()
3329 _version = reader.read("!B")[0]
3330 assert(_version == 4)
3331 _type = reader.read("!B")[0]
3332 assert(_type == 4)
3333 _length = reader.read("!H")[0]
3334 orig_reader = reader
3335 reader = orig_reader.slice(_length, 4)
3336 obj.xid = reader.read("!L")[0]
3337 _experimenter = reader.read("!L")[0]
3338 assert(_experimenter == 6035143)
3339 _subtype = reader.read("!L")[0]
3340 assert(_subtype == 39)
3341 obj.enabled = reader.read("!L")[0]
3342 return obj
3343
3344 def __eq__(self, other):
3345 if type(self) != type(other): return False
3346 if self.xid != other.xid: return False
3347 if self.enabled != other.enabled: return False
3348 return True
3349
3350 def pretty_print(self, q):
3351 q.text("bsn_flow_idle_enable_get_reply {")
3352 with q.group():
3353 with q.indent(2):
3354 q.breakable()
3355 q.text("xid = ");
3356 if self.xid != None:
3357 q.text("%#x" % self.xid)
3358 else:
3359 q.text('None')
3360 q.text(","); q.breakable()
3361 q.text("enabled = ");
3362 q.text("%#x" % self.enabled)
3363 q.breakable()
3364 q.text('}')
3365
3366bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3367
3368class bsn_flow_idle_enable_get_request(bsn_header):
3369 version = 4
3370 type = 4
3371 experimenter = 6035143
3372 subtype = 38
3373
3374 def __init__(self, xid=None):
3375 if xid != None:
3376 self.xid = xid
3377 else:
3378 self.xid = None
3379 return
3380
3381 def pack(self):
3382 packed = []
3383 packed.append(struct.pack("!B", self.version))
3384 packed.append(struct.pack("!B", self.type))
3385 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3386 packed.append(struct.pack("!L", self.xid))
3387 packed.append(struct.pack("!L", self.experimenter))
3388 packed.append(struct.pack("!L", self.subtype))
3389 length = sum([len(x) for x in packed])
3390 packed[2] = struct.pack("!H", length)
3391 return ''.join(packed)
3392
3393 @staticmethod
3394 def unpack(reader):
3395 obj = bsn_flow_idle_enable_get_request()
3396 _version = reader.read("!B")[0]
3397 assert(_version == 4)
3398 _type = reader.read("!B")[0]
3399 assert(_type == 4)
3400 _length = reader.read("!H")[0]
3401 orig_reader = reader
3402 reader = orig_reader.slice(_length, 4)
3403 obj.xid = reader.read("!L")[0]
3404 _experimenter = reader.read("!L")[0]
3405 assert(_experimenter == 6035143)
3406 _subtype = reader.read("!L")[0]
3407 assert(_subtype == 38)
3408 return obj
3409
3410 def __eq__(self, other):
3411 if type(self) != type(other): return False
3412 if self.xid != other.xid: return False
3413 return True
3414
3415 def pretty_print(self, q):
3416 q.text("bsn_flow_idle_enable_get_request {")
3417 with q.group():
3418 with q.indent(2):
3419 q.breakable()
3420 q.text("xid = ");
3421 if self.xid != None:
3422 q.text("%#x" % self.xid)
3423 else:
3424 q.text('None')
3425 q.breakable()
3426 q.text('}')
3427
3428bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3429
3430class bsn_flow_idle_enable_set_reply(bsn_header):
3431 version = 4
3432 type = 4
3433 experimenter = 6035143
3434 subtype = 37
3435
3436 def __init__(self, xid=None, enable=None, status=None):
3437 if xid != None:
3438 self.xid = xid
3439 else:
3440 self.xid = None
3441 if enable != None:
3442 self.enable = enable
3443 else:
3444 self.enable = 0
3445 if status != None:
3446 self.status = status
3447 else:
3448 self.status = 0
3449 return
3450
3451 def pack(self):
3452 packed = []
3453 packed.append(struct.pack("!B", self.version))
3454 packed.append(struct.pack("!B", self.type))
3455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3456 packed.append(struct.pack("!L", self.xid))
3457 packed.append(struct.pack("!L", self.experimenter))
3458 packed.append(struct.pack("!L", self.subtype))
3459 packed.append(struct.pack("!L", self.enable))
3460 packed.append(struct.pack("!L", self.status))
3461 length = sum([len(x) for x in packed])
3462 packed[2] = struct.pack("!H", length)
3463 return ''.join(packed)
3464
3465 @staticmethod
3466 def unpack(reader):
3467 obj = bsn_flow_idle_enable_set_reply()
3468 _version = reader.read("!B")[0]
3469 assert(_version == 4)
3470 _type = reader.read("!B")[0]
3471 assert(_type == 4)
3472 _length = reader.read("!H")[0]
3473 orig_reader = reader
3474 reader = orig_reader.slice(_length, 4)
3475 obj.xid = reader.read("!L")[0]
3476 _experimenter = reader.read("!L")[0]
3477 assert(_experimenter == 6035143)
3478 _subtype = reader.read("!L")[0]
3479 assert(_subtype == 37)
3480 obj.enable = reader.read("!L")[0]
3481 obj.status = reader.read("!L")[0]
3482 return obj
3483
3484 def __eq__(self, other):
3485 if type(self) != type(other): return False
3486 if self.xid != other.xid: return False
3487 if self.enable != other.enable: return False
3488 if self.status != other.status: return False
3489 return True
3490
3491 def pretty_print(self, q):
3492 q.text("bsn_flow_idle_enable_set_reply {")
3493 with q.group():
3494 with q.indent(2):
3495 q.breakable()
3496 q.text("xid = ");
3497 if self.xid != None:
3498 q.text("%#x" % self.xid)
3499 else:
3500 q.text('None')
3501 q.text(","); q.breakable()
3502 q.text("enable = ");
3503 q.text("%#x" % self.enable)
3504 q.text(","); q.breakable()
3505 q.text("status = ");
3506 q.text("%#x" % self.status)
3507 q.breakable()
3508 q.text('}')
3509
3510bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3511
3512class bsn_flow_idle_enable_set_request(bsn_header):
3513 version = 4
3514 type = 4
3515 experimenter = 6035143
3516 subtype = 36
3517
3518 def __init__(self, xid=None, enable=None):
3519 if xid != None:
3520 self.xid = xid
3521 else:
3522 self.xid = None
3523 if enable != None:
3524 self.enable = enable
3525 else:
3526 self.enable = 0
3527 return
3528
3529 def pack(self):
3530 packed = []
3531 packed.append(struct.pack("!B", self.version))
3532 packed.append(struct.pack("!B", self.type))
3533 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3534 packed.append(struct.pack("!L", self.xid))
3535 packed.append(struct.pack("!L", self.experimenter))
3536 packed.append(struct.pack("!L", self.subtype))
3537 packed.append(struct.pack("!L", self.enable))
3538 length = sum([len(x) for x in packed])
3539 packed[2] = struct.pack("!H", length)
3540 return ''.join(packed)
3541
3542 @staticmethod
3543 def unpack(reader):
3544 obj = bsn_flow_idle_enable_set_request()
3545 _version = reader.read("!B")[0]
3546 assert(_version == 4)
3547 _type = reader.read("!B")[0]
3548 assert(_type == 4)
3549 _length = reader.read("!H")[0]
3550 orig_reader = reader
3551 reader = orig_reader.slice(_length, 4)
3552 obj.xid = reader.read("!L")[0]
3553 _experimenter = reader.read("!L")[0]
3554 assert(_experimenter == 6035143)
3555 _subtype = reader.read("!L")[0]
3556 assert(_subtype == 36)
3557 obj.enable = reader.read("!L")[0]
3558 return obj
3559
3560 def __eq__(self, other):
3561 if type(self) != type(other): return False
3562 if self.xid != other.xid: return False
3563 if self.enable != other.enable: return False
3564 return True
3565
3566 def pretty_print(self, q):
3567 q.text("bsn_flow_idle_enable_set_request {")
3568 with q.group():
3569 with q.indent(2):
3570 q.breakable()
3571 q.text("xid = ");
3572 if self.xid != None:
3573 q.text("%#x" % self.xid)
3574 else:
3575 q.text('None')
3576 q.text(","); q.breakable()
3577 q.text("enable = ");
3578 q.text("%#x" % self.enable)
3579 q.breakable()
3580 q.text('}')
3581
3582bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3583
3584class bsn_generic_stats_reply(bsn_stats_reply):
3585 version = 4
3586 type = 19
3587 stats_type = 65535
3588 experimenter = 6035143
3589 subtype = 16
3590
3591 def __init__(self, xid=None, flags=None, entries=None):
3592 if xid != None:
3593 self.xid = xid
3594 else:
3595 self.xid = None
3596 if flags != None:
3597 self.flags = flags
3598 else:
3599 self.flags = 0
3600 if entries != None:
3601 self.entries = entries
3602 else:
3603 self.entries = []
3604 return
3605
3606 def pack(self):
3607 packed = []
3608 packed.append(struct.pack("!B", self.version))
3609 packed.append(struct.pack("!B", self.type))
3610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3611 packed.append(struct.pack("!L", self.xid))
3612 packed.append(struct.pack("!H", self.stats_type))
3613 packed.append(struct.pack("!H", self.flags))
3614 packed.append('\x00' * 4)
3615 packed.append(struct.pack("!L", self.experimenter))
3616 packed.append(struct.pack("!L", self.subtype))
3617 packed.append(loxi.generic_util.pack_list(self.entries))
3618 length = sum([len(x) for x in packed])
3619 packed[2] = struct.pack("!H", length)
3620 return ''.join(packed)
3621
3622 @staticmethod
3623 def unpack(reader):
3624 obj = bsn_generic_stats_reply()
3625 _version = reader.read("!B")[0]
3626 assert(_version == 4)
3627 _type = reader.read("!B")[0]
3628 assert(_type == 19)
3629 _length = reader.read("!H")[0]
3630 orig_reader = reader
3631 reader = orig_reader.slice(_length, 4)
3632 obj.xid = reader.read("!L")[0]
3633 _stats_type = reader.read("!H")[0]
3634 assert(_stats_type == 65535)
3635 obj.flags = reader.read("!H")[0]
3636 reader.skip(4)
3637 _experimenter = reader.read("!L")[0]
3638 assert(_experimenter == 6035143)
3639 _subtype = reader.read("!L")[0]
3640 assert(_subtype == 16)
3641 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
3642 return obj
3643
3644 def __eq__(self, other):
3645 if type(self) != type(other): return False
3646 if self.xid != other.xid: return False
3647 if self.flags != other.flags: return False
3648 if self.entries != other.entries: return False
3649 return True
3650
3651 def pretty_print(self, q):
3652 q.text("bsn_generic_stats_reply {")
3653 with q.group():
3654 with q.indent(2):
3655 q.breakable()
3656 q.text("xid = ");
3657 if self.xid != None:
3658 q.text("%#x" % self.xid)
3659 else:
3660 q.text('None')
3661 q.text(","); q.breakable()
3662 q.text("flags = ");
3663 q.text("%#x" % self.flags)
3664 q.text(","); q.breakable()
3665 q.text("entries = ");
3666 q.pp(self.entries)
3667 q.breakable()
3668 q.text('}')
3669
3670bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3671
3672class bsn_generic_stats_request(bsn_stats_request):
3673 version = 4
3674 type = 18
3675 stats_type = 65535
3676 experimenter = 6035143
3677 subtype = 16
3678
3679 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3680 if xid != None:
3681 self.xid = xid
3682 else:
3683 self.xid = None
3684 if flags != None:
3685 self.flags = flags
3686 else:
3687 self.flags = 0
3688 if name != None:
3689 self.name = name
3690 else:
3691 self.name = ""
3692 if tlvs != None:
3693 self.tlvs = tlvs
3694 else:
3695 self.tlvs = []
3696 return
3697
3698 def pack(self):
3699 packed = []
3700 packed.append(struct.pack("!B", self.version))
3701 packed.append(struct.pack("!B", self.type))
3702 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3703 packed.append(struct.pack("!L", self.xid))
3704 packed.append(struct.pack("!H", self.stats_type))
3705 packed.append(struct.pack("!H", self.flags))
3706 packed.append('\x00' * 4)
3707 packed.append(struct.pack("!L", self.experimenter))
3708 packed.append(struct.pack("!L", self.subtype))
3709 packed.append(struct.pack("!64s", self.name))
3710 packed.append(loxi.generic_util.pack_list(self.tlvs))
3711 length = sum([len(x) for x in packed])
3712 packed[2] = struct.pack("!H", length)
3713 return ''.join(packed)
3714
3715 @staticmethod
3716 def unpack(reader):
3717 obj = bsn_generic_stats_request()
3718 _version = reader.read("!B")[0]
3719 assert(_version == 4)
3720 _type = reader.read("!B")[0]
3721 assert(_type == 18)
3722 _length = reader.read("!H")[0]
3723 orig_reader = reader
3724 reader = orig_reader.slice(_length, 4)
3725 obj.xid = reader.read("!L")[0]
3726 _stats_type = reader.read("!H")[0]
3727 assert(_stats_type == 65535)
3728 obj.flags = reader.read("!H")[0]
3729 reader.skip(4)
3730 _experimenter = reader.read("!L")[0]
3731 assert(_experimenter == 6035143)
3732 _subtype = reader.read("!L")[0]
3733 assert(_subtype == 16)
3734 obj.name = reader.read("!64s")[0].rstrip("\x00")
3735 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3736 return obj
3737
3738 def __eq__(self, other):
3739 if type(self) != type(other): return False
3740 if self.xid != other.xid: return False
3741 if self.flags != other.flags: return False
3742 if self.name != other.name: return False
3743 if self.tlvs != other.tlvs: return False
3744 return True
3745
3746 def pretty_print(self, q):
3747 q.text("bsn_generic_stats_request {")
3748 with q.group():
3749 with q.indent(2):
3750 q.breakable()
3751 q.text("xid = ");
3752 if self.xid != None:
3753 q.text("%#x" % self.xid)
3754 else:
3755 q.text('None')
3756 q.text(","); q.breakable()
3757 q.text("flags = ");
3758 q.text("%#x" % self.flags)
3759 q.text(","); q.breakable()
3760 q.text("name = ");
3761 q.pp(self.name)
3762 q.text(","); q.breakable()
3763 q.text("tlvs = ");
3764 q.pp(self.tlvs)
3765 q.breakable()
3766 q.text('}')
3767
3768bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3769
3770class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3771 version = 4
3772 type = 19
3773 stats_type = 65535
3774 experimenter = 6035143
3775 subtype = 5
3776
3777 def __init__(self, xid=None, flags=None, entries=None):
3778 if xid != None:
3779 self.xid = xid
3780 else:
3781 self.xid = None
3782 if flags != None:
3783 self.flags = flags
3784 else:
3785 self.flags = 0
3786 if entries != None:
3787 self.entries = entries
3788 else:
3789 self.entries = []
3790 return
3791
3792 def pack(self):
3793 packed = []
3794 packed.append(struct.pack("!B", self.version))
3795 packed.append(struct.pack("!B", self.type))
3796 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3797 packed.append(struct.pack("!L", self.xid))
3798 packed.append(struct.pack("!H", self.stats_type))
3799 packed.append(struct.pack("!H", self.flags))
3800 packed.append('\x00' * 4)
3801 packed.append(struct.pack("!L", self.experimenter))
3802 packed.append(struct.pack("!L", self.subtype))
3803 packed.append(loxi.generic_util.pack_list(self.entries))
3804 length = sum([len(x) for x in packed])
3805 packed[2] = struct.pack("!H", length)
3806 return ''.join(packed)
3807
3808 @staticmethod
3809 def unpack(reader):
3810 obj = bsn_gentable_bucket_stats_reply()
3811 _version = reader.read("!B")[0]
3812 assert(_version == 4)
3813 _type = reader.read("!B")[0]
3814 assert(_type == 19)
3815 _length = reader.read("!H")[0]
3816 orig_reader = reader
3817 reader = orig_reader.slice(_length, 4)
3818 obj.xid = reader.read("!L")[0]
3819 _stats_type = reader.read("!H")[0]
3820 assert(_stats_type == 65535)
3821 obj.flags = reader.read("!H")[0]
3822 reader.skip(4)
3823 _experimenter = reader.read("!L")[0]
3824 assert(_experimenter == 6035143)
3825 _subtype = reader.read("!L")[0]
3826 assert(_subtype == 5)
3827 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
3828 return obj
3829
3830 def __eq__(self, other):
3831 if type(self) != type(other): return False
3832 if self.xid != other.xid: return False
3833 if self.flags != other.flags: return False
3834 if self.entries != other.entries: return False
3835 return True
3836
3837 def pretty_print(self, q):
3838 q.text("bsn_gentable_bucket_stats_reply {")
3839 with q.group():
3840 with q.indent(2):
3841 q.breakable()
3842 q.text("xid = ");
3843 if self.xid != None:
3844 q.text("%#x" % self.xid)
3845 else:
3846 q.text('None')
3847 q.text(","); q.breakable()
3848 q.text("flags = ");
3849 q.text("%#x" % self.flags)
3850 q.text(","); q.breakable()
3851 q.text("entries = ");
3852 q.pp(self.entries)
3853 q.breakable()
3854 q.text('}')
3855
3856bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3857
3858class bsn_gentable_bucket_stats_request(bsn_stats_request):
3859 version = 4
3860 type = 18
3861 stats_type = 65535
3862 experimenter = 6035143
3863 subtype = 5
3864
3865 def __init__(self, xid=None, flags=None, table_id=None):
3866 if xid != None:
3867 self.xid = xid
3868 else:
3869 self.xid = None
3870 if flags != None:
3871 self.flags = flags
3872 else:
3873 self.flags = 0
3874 if table_id != None:
3875 self.table_id = table_id
3876 else:
3877 self.table_id = 0
3878 return
3879
3880 def pack(self):
3881 packed = []
3882 packed.append(struct.pack("!B", self.version))
3883 packed.append(struct.pack("!B", self.type))
3884 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3885 packed.append(struct.pack("!L", self.xid))
3886 packed.append(struct.pack("!H", self.stats_type))
3887 packed.append(struct.pack("!H", self.flags))
3888 packed.append('\x00' * 4)
3889 packed.append(struct.pack("!L", self.experimenter))
3890 packed.append(struct.pack("!L", self.subtype))
3891 packed.append(struct.pack("!H", self.table_id))
3892 length = sum([len(x) for x in packed])
3893 packed[2] = struct.pack("!H", length)
3894 return ''.join(packed)
3895
3896 @staticmethod
3897 def unpack(reader):
3898 obj = bsn_gentable_bucket_stats_request()
3899 _version = reader.read("!B")[0]
3900 assert(_version == 4)
3901 _type = reader.read("!B")[0]
3902 assert(_type == 18)
3903 _length = reader.read("!H")[0]
3904 orig_reader = reader
3905 reader = orig_reader.slice(_length, 4)
3906 obj.xid = reader.read("!L")[0]
3907 _stats_type = reader.read("!H")[0]
3908 assert(_stats_type == 65535)
3909 obj.flags = reader.read("!H")[0]
3910 reader.skip(4)
3911 _experimenter = reader.read("!L")[0]
3912 assert(_experimenter == 6035143)
3913 _subtype = reader.read("!L")[0]
3914 assert(_subtype == 5)
3915 obj.table_id = reader.read("!H")[0]
3916 return obj
3917
3918 def __eq__(self, other):
3919 if type(self) != type(other): return False
3920 if self.xid != other.xid: return False
3921 if self.flags != other.flags: return False
3922 if self.table_id != other.table_id: return False
3923 return True
3924
3925 def pretty_print(self, q):
3926 q.text("bsn_gentable_bucket_stats_request {")
3927 with q.group():
3928 with q.indent(2):
3929 q.breakable()
3930 q.text("xid = ");
3931 if self.xid != None:
3932 q.text("%#x" % self.xid)
3933 else:
3934 q.text('None')
3935 q.text(","); q.breakable()
3936 q.text("flags = ");
3937 q.text("%#x" % self.flags)
3938 q.text(","); q.breakable()
3939 q.text("table_id = ");
3940 q.text("%#x" % self.table_id)
3941 q.breakable()
3942 q.text('}')
3943
3944bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3945
3946class bsn_gentable_clear_reply(bsn_header):
3947 version = 4
3948 type = 4
3949 experimenter = 6035143
3950 subtype = 49
3951
3952 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3953 if xid != None:
3954 self.xid = xid
3955 else:
3956 self.xid = None
3957 if table_id != None:
3958 self.table_id = table_id
3959 else:
3960 self.table_id = 0
3961 if deleted_count != None:
3962 self.deleted_count = deleted_count
3963 else:
3964 self.deleted_count = 0
3965 if error_count != None:
3966 self.error_count = error_count
3967 else:
3968 self.error_count = 0
3969 return
3970
3971 def pack(self):
3972 packed = []
3973 packed.append(struct.pack("!B", self.version))
3974 packed.append(struct.pack("!B", self.type))
3975 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3976 packed.append(struct.pack("!L", self.xid))
3977 packed.append(struct.pack("!L", self.experimenter))
3978 packed.append(struct.pack("!L", self.subtype))
3979 packed.append(struct.pack("!H", self.table_id))
3980 packed.append('\x00' * 2)
3981 packed.append(struct.pack("!L", self.deleted_count))
3982 packed.append(struct.pack("!L", self.error_count))
3983 length = sum([len(x) for x in packed])
3984 packed[2] = struct.pack("!H", length)
3985 return ''.join(packed)
3986
3987 @staticmethod
3988 def unpack(reader):
3989 obj = bsn_gentable_clear_reply()
3990 _version = reader.read("!B")[0]
3991 assert(_version == 4)
3992 _type = reader.read("!B")[0]
3993 assert(_type == 4)
3994 _length = reader.read("!H")[0]
3995 orig_reader = reader
3996 reader = orig_reader.slice(_length, 4)
3997 obj.xid = reader.read("!L")[0]
3998 _experimenter = reader.read("!L")[0]
3999 assert(_experimenter == 6035143)
4000 _subtype = reader.read("!L")[0]
4001 assert(_subtype == 49)
4002 obj.table_id = reader.read("!H")[0]
4003 reader.skip(2)
4004 obj.deleted_count = reader.read("!L")[0]
4005 obj.error_count = reader.read("!L")[0]
4006 return obj
4007
4008 def __eq__(self, other):
4009 if type(self) != type(other): return False
4010 if self.xid != other.xid: return False
4011 if self.table_id != other.table_id: return False
4012 if self.deleted_count != other.deleted_count: return False
4013 if self.error_count != other.error_count: return False
4014 return True
4015
4016 def pretty_print(self, q):
4017 q.text("bsn_gentable_clear_reply {")
4018 with q.group():
4019 with q.indent(2):
4020 q.breakable()
4021 q.text("xid = ");
4022 if self.xid != None:
4023 q.text("%#x" % self.xid)
4024 else:
4025 q.text('None')
4026 q.text(","); q.breakable()
4027 q.text("table_id = ");
4028 q.text("%#x" % self.table_id)
4029 q.text(","); q.breakable()
4030 q.text("deleted_count = ");
4031 q.text("%#x" % self.deleted_count)
4032 q.text(","); q.breakable()
4033 q.text("error_count = ");
4034 q.text("%#x" % self.error_count)
4035 q.breakable()
4036 q.text('}')
4037
4038bsn_header.subtypes[49] = bsn_gentable_clear_reply
4039
4040class bsn_gentable_clear_request(bsn_header):
4041 version = 4
4042 type = 4
4043 experimenter = 6035143
4044 subtype = 48
4045
4046 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
4047 if xid != None:
4048 self.xid = xid
4049 else:
4050 self.xid = None
4051 if table_id != None:
4052 self.table_id = table_id
4053 else:
4054 self.table_id = 0
4055 if checksum != None:
4056 self.checksum = checksum
4057 else:
4058 self.checksum = 0
4059 if checksum_mask != None:
4060 self.checksum_mask = checksum_mask
4061 else:
4062 self.checksum_mask = 0
4063 return
4064
4065 def pack(self):
4066 packed = []
4067 packed.append(struct.pack("!B", self.version))
4068 packed.append(struct.pack("!B", self.type))
4069 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4070 packed.append(struct.pack("!L", self.xid))
4071 packed.append(struct.pack("!L", self.experimenter))
4072 packed.append(struct.pack("!L", self.subtype))
4073 packed.append(struct.pack("!H", self.table_id))
4074 packed.append('\x00' * 2)
4075 packed.append(util.pack_checksum_128(self.checksum))
4076 packed.append(util.pack_checksum_128(self.checksum_mask))
4077 length = sum([len(x) for x in packed])
4078 packed[2] = struct.pack("!H", length)
4079 return ''.join(packed)
4080
4081 @staticmethod
4082 def unpack(reader):
4083 obj = bsn_gentable_clear_request()
4084 _version = reader.read("!B")[0]
4085 assert(_version == 4)
4086 _type = reader.read("!B")[0]
4087 assert(_type == 4)
4088 _length = reader.read("!H")[0]
4089 orig_reader = reader
4090 reader = orig_reader.slice(_length, 4)
4091 obj.xid = reader.read("!L")[0]
4092 _experimenter = reader.read("!L")[0]
4093 assert(_experimenter == 6035143)
4094 _subtype = reader.read("!L")[0]
4095 assert(_subtype == 48)
4096 obj.table_id = reader.read("!H")[0]
4097 reader.skip(2)
4098 obj.checksum = util.unpack_checksum_128(reader)
4099 obj.checksum_mask = util.unpack_checksum_128(reader)
4100 return obj
4101
4102 def __eq__(self, other):
4103 if type(self) != type(other): return False
4104 if self.xid != other.xid: return False
4105 if self.table_id != other.table_id: return False
4106 if self.checksum != other.checksum: return False
4107 if self.checksum_mask != other.checksum_mask: return False
4108 return True
4109
4110 def pretty_print(self, q):
4111 q.text("bsn_gentable_clear_request {")
4112 with q.group():
4113 with q.indent(2):
4114 q.breakable()
4115 q.text("xid = ");
4116 if self.xid != None:
4117 q.text("%#x" % self.xid)
4118 else:
4119 q.text('None')
4120 q.text(","); q.breakable()
4121 q.text("table_id = ");
4122 q.text("%#x" % self.table_id)
4123 q.text(","); q.breakable()
4124 q.text("checksum = ");
4125 q.pp(self.checksum)
4126 q.text(","); q.breakable()
4127 q.text("checksum_mask = ");
4128 q.pp(self.checksum_mask)
4129 q.breakable()
4130 q.text('}')
4131
4132bsn_header.subtypes[48] = bsn_gentable_clear_request
4133
4134class bsn_gentable_desc_stats_reply(bsn_stats_reply):
4135 version = 4
4136 type = 19
4137 stats_type = 65535
4138 experimenter = 6035143
4139 subtype = 4
4140
4141 def __init__(self, xid=None, flags=None, entries=None):
4142 if xid != None:
4143 self.xid = xid
4144 else:
4145 self.xid = None
4146 if flags != None:
4147 self.flags = flags
4148 else:
4149 self.flags = 0
4150 if entries != None:
4151 self.entries = entries
4152 else:
4153 self.entries = []
4154 return
4155
4156 def pack(self):
4157 packed = []
4158 packed.append(struct.pack("!B", self.version))
4159 packed.append(struct.pack("!B", self.type))
4160 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4161 packed.append(struct.pack("!L", self.xid))
4162 packed.append(struct.pack("!H", self.stats_type))
4163 packed.append(struct.pack("!H", self.flags))
4164 packed.append('\x00' * 4)
4165 packed.append(struct.pack("!L", self.experimenter))
4166 packed.append(struct.pack("!L", self.subtype))
4167 packed.append(loxi.generic_util.pack_list(self.entries))
4168 length = sum([len(x) for x in packed])
4169 packed[2] = struct.pack("!H", length)
4170 return ''.join(packed)
4171
4172 @staticmethod
4173 def unpack(reader):
4174 obj = bsn_gentable_desc_stats_reply()
4175 _version = reader.read("!B")[0]
4176 assert(_version == 4)
4177 _type = reader.read("!B")[0]
4178 assert(_type == 19)
4179 _length = reader.read("!H")[0]
4180 orig_reader = reader
4181 reader = orig_reader.slice(_length, 4)
4182 obj.xid = reader.read("!L")[0]
4183 _stats_type = reader.read("!H")[0]
4184 assert(_stats_type == 65535)
4185 obj.flags = reader.read("!H")[0]
4186 reader.skip(4)
4187 _experimenter = reader.read("!L")[0]
4188 assert(_experimenter == 6035143)
4189 _subtype = reader.read("!L")[0]
4190 assert(_subtype == 4)
4191 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
4192 return obj
4193
4194 def __eq__(self, other):
4195 if type(self) != type(other): return False
4196 if self.xid != other.xid: return False
4197 if self.flags != other.flags: return False
4198 if self.entries != other.entries: return False
4199 return True
4200
4201 def pretty_print(self, q):
4202 q.text("bsn_gentable_desc_stats_reply {")
4203 with q.group():
4204 with q.indent(2):
4205 q.breakable()
4206 q.text("xid = ");
4207 if self.xid != None:
4208 q.text("%#x" % self.xid)
4209 else:
4210 q.text('None')
4211 q.text(","); q.breakable()
4212 q.text("flags = ");
4213 q.text("%#x" % self.flags)
4214 q.text(","); q.breakable()
4215 q.text("entries = ");
4216 q.pp(self.entries)
4217 q.breakable()
4218 q.text('}')
4219
4220bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4221
4222class bsn_gentable_desc_stats_request(bsn_stats_request):
4223 version = 4
4224 type = 18
4225 stats_type = 65535
4226 experimenter = 6035143
4227 subtype = 4
4228
4229 def __init__(self, xid=None, flags=None):
4230 if xid != None:
4231 self.xid = xid
4232 else:
4233 self.xid = None
4234 if flags != None:
4235 self.flags = flags
4236 else:
4237 self.flags = 0
4238 return
4239
4240 def pack(self):
4241 packed = []
4242 packed.append(struct.pack("!B", self.version))
4243 packed.append(struct.pack("!B", self.type))
4244 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4245 packed.append(struct.pack("!L", self.xid))
4246 packed.append(struct.pack("!H", self.stats_type))
4247 packed.append(struct.pack("!H", self.flags))
4248 packed.append('\x00' * 4)
4249 packed.append(struct.pack("!L", self.experimenter))
4250 packed.append(struct.pack("!L", self.subtype))
4251 length = sum([len(x) for x in packed])
4252 packed[2] = struct.pack("!H", length)
4253 return ''.join(packed)
4254
4255 @staticmethod
4256 def unpack(reader):
4257 obj = bsn_gentable_desc_stats_request()
4258 _version = reader.read("!B")[0]
4259 assert(_version == 4)
4260 _type = reader.read("!B")[0]
4261 assert(_type == 18)
4262 _length = reader.read("!H")[0]
4263 orig_reader = reader
4264 reader = orig_reader.slice(_length, 4)
4265 obj.xid = reader.read("!L")[0]
4266 _stats_type = reader.read("!H")[0]
4267 assert(_stats_type == 65535)
4268 obj.flags = reader.read("!H")[0]
4269 reader.skip(4)
4270 _experimenter = reader.read("!L")[0]
4271 assert(_experimenter == 6035143)
4272 _subtype = reader.read("!L")[0]
4273 assert(_subtype == 4)
4274 return obj
4275
4276 def __eq__(self, other):
4277 if type(self) != type(other): return False
4278 if self.xid != other.xid: return False
4279 if self.flags != other.flags: return False
4280 return True
4281
4282 def pretty_print(self, q):
4283 q.text("bsn_gentable_desc_stats_request {")
4284 with q.group():
4285 with q.indent(2):
4286 q.breakable()
4287 q.text("xid = ");
4288 if self.xid != None:
4289 q.text("%#x" % self.xid)
4290 else:
4291 q.text('None')
4292 q.text(","); q.breakable()
4293 q.text("flags = ");
4294 q.text("%#x" % self.flags)
4295 q.breakable()
4296 q.text('}')
4297
4298bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4299
4300class bsn_gentable_entry_add(bsn_header):
4301 version = 4
4302 type = 4
4303 experimenter = 6035143
4304 subtype = 46
4305
4306 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4307 if xid != None:
4308 self.xid = xid
4309 else:
4310 self.xid = None
4311 if table_id != None:
4312 self.table_id = table_id
4313 else:
4314 self.table_id = 0
4315 if checksum != None:
4316 self.checksum = checksum
4317 else:
4318 self.checksum = 0
4319 if key != None:
4320 self.key = key
4321 else:
4322 self.key = []
4323 if value != None:
4324 self.value = value
4325 else:
4326 self.value = []
4327 return
4328
4329 def pack(self):
4330 packed = []
4331 packed.append(struct.pack("!B", self.version))
4332 packed.append(struct.pack("!B", self.type))
4333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4334 packed.append(struct.pack("!L", self.xid))
4335 packed.append(struct.pack("!L", self.experimenter))
4336 packed.append(struct.pack("!L", self.subtype))
4337 packed.append(struct.pack("!H", self.table_id))
4338 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4339 packed.append(util.pack_checksum_128(self.checksum))
4340 packed.append(loxi.generic_util.pack_list(self.key))
4341 packed[7] = struct.pack("!H", len(packed[-1]))
4342 packed.append(loxi.generic_util.pack_list(self.value))
4343 length = sum([len(x) for x in packed])
4344 packed[2] = struct.pack("!H", length)
4345 return ''.join(packed)
4346
4347 @staticmethod
4348 def unpack(reader):
4349 obj = bsn_gentable_entry_add()
4350 _version = reader.read("!B")[0]
4351 assert(_version == 4)
4352 _type = reader.read("!B")[0]
4353 assert(_type == 4)
4354 _length = reader.read("!H")[0]
4355 orig_reader = reader
4356 reader = orig_reader.slice(_length, 4)
4357 obj.xid = reader.read("!L")[0]
4358 _experimenter = reader.read("!L")[0]
4359 assert(_experimenter == 6035143)
4360 _subtype = reader.read("!L")[0]
4361 assert(_subtype == 46)
4362 obj.table_id = reader.read("!H")[0]
4363 _key_length = reader.read("!H")[0]
4364 obj.checksum = util.unpack_checksum_128(reader)
4365 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4366 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4367 return obj
4368
4369 def __eq__(self, other):
4370 if type(self) != type(other): return False
4371 if self.xid != other.xid: return False
4372 if self.table_id != other.table_id: return False
4373 if self.checksum != other.checksum: return False
4374 if self.key != other.key: return False
4375 if self.value != other.value: return False
4376 return True
4377
4378 def pretty_print(self, q):
4379 q.text("bsn_gentable_entry_add {")
4380 with q.group():
4381 with q.indent(2):
4382 q.breakable()
4383 q.text("xid = ");
4384 if self.xid != None:
4385 q.text("%#x" % self.xid)
4386 else:
4387 q.text('None')
4388 q.text(","); q.breakable()
4389 q.text("table_id = ");
4390 q.text("%#x" % self.table_id)
4391 q.text(","); q.breakable()
4392 q.text("checksum = ");
4393 q.pp(self.checksum)
4394 q.text(","); q.breakable()
4395 q.text("key = ");
4396 q.pp(self.key)
4397 q.text(","); q.breakable()
4398 q.text("value = ");
4399 q.pp(self.value)
4400 q.breakable()
4401 q.text('}')
4402
4403bsn_header.subtypes[46] = bsn_gentable_entry_add
4404
4405class bsn_gentable_entry_delete(bsn_header):
4406 version = 4
4407 type = 4
4408 experimenter = 6035143
4409 subtype = 47
4410
4411 def __init__(self, xid=None, table_id=None, key=None):
4412 if xid != None:
4413 self.xid = xid
4414 else:
4415 self.xid = None
4416 if table_id != None:
4417 self.table_id = table_id
4418 else:
4419 self.table_id = 0
4420 if key != None:
4421 self.key = key
4422 else:
4423 self.key = []
4424 return
4425
4426 def pack(self):
4427 packed = []
4428 packed.append(struct.pack("!B", self.version))
4429 packed.append(struct.pack("!B", self.type))
4430 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4431 packed.append(struct.pack("!L", self.xid))
4432 packed.append(struct.pack("!L", self.experimenter))
4433 packed.append(struct.pack("!L", self.subtype))
4434 packed.append(struct.pack("!H", self.table_id))
4435 packed.append(loxi.generic_util.pack_list(self.key))
4436 length = sum([len(x) for x in packed])
4437 packed[2] = struct.pack("!H", length)
4438 return ''.join(packed)
4439
4440 @staticmethod
4441 def unpack(reader):
4442 obj = bsn_gentable_entry_delete()
4443 _version = reader.read("!B")[0]
4444 assert(_version == 4)
4445 _type = reader.read("!B")[0]
4446 assert(_type == 4)
4447 _length = reader.read("!H")[0]
4448 orig_reader = reader
4449 reader = orig_reader.slice(_length, 4)
4450 obj.xid = reader.read("!L")[0]
4451 _experimenter = reader.read("!L")[0]
4452 assert(_experimenter == 6035143)
4453 _subtype = reader.read("!L")[0]
4454 assert(_subtype == 47)
4455 obj.table_id = reader.read("!H")[0]
4456 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
4457 return obj
4458
4459 def __eq__(self, other):
4460 if type(self) != type(other): return False
4461 if self.xid != other.xid: return False
4462 if self.table_id != other.table_id: return False
4463 if self.key != other.key: return False
4464 return True
4465
4466 def pretty_print(self, q):
4467 q.text("bsn_gentable_entry_delete {")
4468 with q.group():
4469 with q.indent(2):
4470 q.breakable()
4471 q.text("xid = ");
4472 if self.xid != None:
4473 q.text("%#x" % self.xid)
4474 else:
4475 q.text('None')
4476 q.text(","); q.breakable()
4477 q.text("table_id = ");
4478 q.text("%#x" % self.table_id)
4479 q.text(","); q.breakable()
4480 q.text("key = ");
4481 q.pp(self.key)
4482 q.breakable()
4483 q.text('}')
4484
4485bsn_header.subtypes[47] = bsn_gentable_entry_delete
4486
4487class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4488 version = 4
4489 type = 19
4490 stats_type = 65535
4491 experimenter = 6035143
4492 subtype = 2
4493
4494 def __init__(self, xid=None, flags=None, entries=None):
4495 if xid != None:
4496 self.xid = xid
4497 else:
4498 self.xid = None
4499 if flags != None:
4500 self.flags = flags
4501 else:
4502 self.flags = 0
4503 if entries != None:
4504 self.entries = entries
4505 else:
4506 self.entries = []
4507 return
4508
4509 def pack(self):
4510 packed = []
4511 packed.append(struct.pack("!B", self.version))
4512 packed.append(struct.pack("!B", self.type))
4513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4514 packed.append(struct.pack("!L", self.xid))
4515 packed.append(struct.pack("!H", self.stats_type))
4516 packed.append(struct.pack("!H", self.flags))
4517 packed.append('\x00' * 4)
4518 packed.append(struct.pack("!L", self.experimenter))
4519 packed.append(struct.pack("!L", self.subtype))
4520 packed.append(loxi.generic_util.pack_list(self.entries))
4521 length = sum([len(x) for x in packed])
4522 packed[2] = struct.pack("!H", length)
4523 return ''.join(packed)
4524
4525 @staticmethod
4526 def unpack(reader):
4527 obj = bsn_gentable_entry_desc_stats_reply()
4528 _version = reader.read("!B")[0]
4529 assert(_version == 4)
4530 _type = reader.read("!B")[0]
4531 assert(_type == 19)
4532 _length = reader.read("!H")[0]
4533 orig_reader = reader
4534 reader = orig_reader.slice(_length, 4)
4535 obj.xid = reader.read("!L")[0]
4536 _stats_type = reader.read("!H")[0]
4537 assert(_stats_type == 65535)
4538 obj.flags = reader.read("!H")[0]
4539 reader.skip(4)
4540 _experimenter = reader.read("!L")[0]
4541 assert(_experimenter == 6035143)
4542 _subtype = reader.read("!L")[0]
4543 assert(_subtype == 2)
4544 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
4545 return obj
4546
4547 def __eq__(self, other):
4548 if type(self) != type(other): return False
4549 if self.xid != other.xid: return False
4550 if self.flags != other.flags: return False
4551 if self.entries != other.entries: return False
4552 return True
4553
4554 def pretty_print(self, q):
4555 q.text("bsn_gentable_entry_desc_stats_reply {")
4556 with q.group():
4557 with q.indent(2):
4558 q.breakable()
4559 q.text("xid = ");
4560 if self.xid != None:
4561 q.text("%#x" % self.xid)
4562 else:
4563 q.text('None')
4564 q.text(","); q.breakable()
4565 q.text("flags = ");
4566 q.text("%#x" % self.flags)
4567 q.text(","); q.breakable()
4568 q.text("entries = ");
4569 q.pp(self.entries)
4570 q.breakable()
4571 q.text('}')
4572
4573bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4574
4575class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4576 version = 4
4577 type = 18
4578 stats_type = 65535
4579 experimenter = 6035143
4580 subtype = 2
4581
4582 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4583 if xid != None:
4584 self.xid = xid
4585 else:
4586 self.xid = None
4587 if flags != None:
4588 self.flags = flags
4589 else:
4590 self.flags = 0
4591 if table_id != None:
4592 self.table_id = table_id
4593 else:
4594 self.table_id = 0
4595 if checksum != None:
4596 self.checksum = checksum
4597 else:
4598 self.checksum = 0
4599 if checksum_mask != None:
4600 self.checksum_mask = checksum_mask
4601 else:
4602 self.checksum_mask = 0
4603 return
4604
4605 def pack(self):
4606 packed = []
4607 packed.append(struct.pack("!B", self.version))
4608 packed.append(struct.pack("!B", self.type))
4609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4610 packed.append(struct.pack("!L", self.xid))
4611 packed.append(struct.pack("!H", self.stats_type))
4612 packed.append(struct.pack("!H", self.flags))
4613 packed.append('\x00' * 4)
4614 packed.append(struct.pack("!L", self.experimenter))
4615 packed.append(struct.pack("!L", self.subtype))
4616 packed.append(struct.pack("!H", self.table_id))
4617 packed.append('\x00' * 2)
4618 packed.append(util.pack_checksum_128(self.checksum))
4619 packed.append(util.pack_checksum_128(self.checksum_mask))
4620 length = sum([len(x) for x in packed])
4621 packed[2] = struct.pack("!H", length)
4622 return ''.join(packed)
4623
4624 @staticmethod
4625 def unpack(reader):
4626 obj = bsn_gentable_entry_desc_stats_request()
4627 _version = reader.read("!B")[0]
4628 assert(_version == 4)
4629 _type = reader.read("!B")[0]
4630 assert(_type == 18)
4631 _length = reader.read("!H")[0]
4632 orig_reader = reader
4633 reader = orig_reader.slice(_length, 4)
4634 obj.xid = reader.read("!L")[0]
4635 _stats_type = reader.read("!H")[0]
4636 assert(_stats_type == 65535)
4637 obj.flags = reader.read("!H")[0]
4638 reader.skip(4)
4639 _experimenter = reader.read("!L")[0]
4640 assert(_experimenter == 6035143)
4641 _subtype = reader.read("!L")[0]
4642 assert(_subtype == 2)
4643 obj.table_id = reader.read("!H")[0]
4644 reader.skip(2)
4645 obj.checksum = util.unpack_checksum_128(reader)
4646 obj.checksum_mask = util.unpack_checksum_128(reader)
4647 return obj
4648
4649 def __eq__(self, other):
4650 if type(self) != type(other): return False
4651 if self.xid != other.xid: return False
4652 if self.flags != other.flags: return False
4653 if self.table_id != other.table_id: return False
4654 if self.checksum != other.checksum: return False
4655 if self.checksum_mask != other.checksum_mask: return False
4656 return True
4657
4658 def pretty_print(self, q):
4659 q.text("bsn_gentable_entry_desc_stats_request {")
4660 with q.group():
4661 with q.indent(2):
4662 q.breakable()
4663 q.text("xid = ");
4664 if self.xid != None:
4665 q.text("%#x" % self.xid)
4666 else:
4667 q.text('None')
4668 q.text(","); q.breakable()
4669 q.text("flags = ");
4670 q.text("%#x" % self.flags)
4671 q.text(","); q.breakable()
4672 q.text("table_id = ");
4673 q.text("%#x" % self.table_id)
4674 q.text(","); q.breakable()
4675 q.text("checksum = ");
4676 q.pp(self.checksum)
4677 q.text(","); q.breakable()
4678 q.text("checksum_mask = ");
4679 q.pp(self.checksum_mask)
4680 q.breakable()
4681 q.text('}')
4682
4683bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4684
4685class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4686 version = 4
4687 type = 19
4688 stats_type = 65535
4689 experimenter = 6035143
4690 subtype = 3
4691
4692 def __init__(self, xid=None, flags=None, entries=None):
4693 if xid != None:
4694 self.xid = xid
4695 else:
4696 self.xid = None
4697 if flags != None:
4698 self.flags = flags
4699 else:
4700 self.flags = 0
4701 if entries != None:
4702 self.entries = entries
4703 else:
4704 self.entries = []
4705 return
4706
4707 def pack(self):
4708 packed = []
4709 packed.append(struct.pack("!B", self.version))
4710 packed.append(struct.pack("!B", self.type))
4711 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4712 packed.append(struct.pack("!L", self.xid))
4713 packed.append(struct.pack("!H", self.stats_type))
4714 packed.append(struct.pack("!H", self.flags))
4715 packed.append('\x00' * 4)
4716 packed.append(struct.pack("!L", self.experimenter))
4717 packed.append(struct.pack("!L", self.subtype))
4718 packed.append(loxi.generic_util.pack_list(self.entries))
4719 length = sum([len(x) for x in packed])
4720 packed[2] = struct.pack("!H", length)
4721 return ''.join(packed)
4722
4723 @staticmethod
4724 def unpack(reader):
4725 obj = bsn_gentable_entry_stats_reply()
4726 _version = reader.read("!B")[0]
4727 assert(_version == 4)
4728 _type = reader.read("!B")[0]
4729 assert(_type == 19)
4730 _length = reader.read("!H")[0]
4731 orig_reader = reader
4732 reader = orig_reader.slice(_length, 4)
4733 obj.xid = reader.read("!L")[0]
4734 _stats_type = reader.read("!H")[0]
4735 assert(_stats_type == 65535)
4736 obj.flags = reader.read("!H")[0]
4737 reader.skip(4)
4738 _experimenter = reader.read("!L")[0]
4739 assert(_experimenter == 6035143)
4740 _subtype = reader.read("!L")[0]
4741 assert(_subtype == 3)
4742 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
4743 return obj
4744
4745 def __eq__(self, other):
4746 if type(self) != type(other): return False
4747 if self.xid != other.xid: return False
4748 if self.flags != other.flags: return False
4749 if self.entries != other.entries: return False
4750 return True
4751
4752 def pretty_print(self, q):
4753 q.text("bsn_gentable_entry_stats_reply {")
4754 with q.group():
4755 with q.indent(2):
4756 q.breakable()
4757 q.text("xid = ");
4758 if self.xid != None:
4759 q.text("%#x" % self.xid)
4760 else:
4761 q.text('None')
4762 q.text(","); q.breakable()
4763 q.text("flags = ");
4764 q.text("%#x" % self.flags)
4765 q.text(","); q.breakable()
4766 q.text("entries = ");
4767 q.pp(self.entries)
4768 q.breakable()
4769 q.text('}')
4770
4771bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4772
4773class bsn_gentable_entry_stats_request(bsn_stats_request):
4774 version = 4
4775 type = 18
4776 stats_type = 65535
4777 experimenter = 6035143
4778 subtype = 3
4779
4780 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4781 if xid != None:
4782 self.xid = xid
4783 else:
4784 self.xid = None
4785 if flags != None:
4786 self.flags = flags
4787 else:
4788 self.flags = 0
4789 if table_id != None:
4790 self.table_id = table_id
4791 else:
4792 self.table_id = 0
4793 if checksum != None:
4794 self.checksum = checksum
4795 else:
4796 self.checksum = 0
4797 if checksum_mask != None:
4798 self.checksum_mask = checksum_mask
4799 else:
4800 self.checksum_mask = 0
4801 return
4802
4803 def pack(self):
4804 packed = []
4805 packed.append(struct.pack("!B", self.version))
4806 packed.append(struct.pack("!B", self.type))
4807 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4808 packed.append(struct.pack("!L", self.xid))
4809 packed.append(struct.pack("!H", self.stats_type))
4810 packed.append(struct.pack("!H", self.flags))
4811 packed.append('\x00' * 4)
4812 packed.append(struct.pack("!L", self.experimenter))
4813 packed.append(struct.pack("!L", self.subtype))
4814 packed.append(struct.pack("!H", self.table_id))
4815 packed.append('\x00' * 2)
4816 packed.append(util.pack_checksum_128(self.checksum))
4817 packed.append(util.pack_checksum_128(self.checksum_mask))
4818 length = sum([len(x) for x in packed])
4819 packed[2] = struct.pack("!H", length)
4820 return ''.join(packed)
4821
4822 @staticmethod
4823 def unpack(reader):
4824 obj = bsn_gentable_entry_stats_request()
4825 _version = reader.read("!B")[0]
4826 assert(_version == 4)
4827 _type = reader.read("!B")[0]
4828 assert(_type == 18)
4829 _length = reader.read("!H")[0]
4830 orig_reader = reader
4831 reader = orig_reader.slice(_length, 4)
4832 obj.xid = reader.read("!L")[0]
4833 _stats_type = reader.read("!H")[0]
4834 assert(_stats_type == 65535)
4835 obj.flags = reader.read("!H")[0]
4836 reader.skip(4)
4837 _experimenter = reader.read("!L")[0]
4838 assert(_experimenter == 6035143)
4839 _subtype = reader.read("!L")[0]
4840 assert(_subtype == 3)
4841 obj.table_id = reader.read("!H")[0]
4842 reader.skip(2)
4843 obj.checksum = util.unpack_checksum_128(reader)
4844 obj.checksum_mask = util.unpack_checksum_128(reader)
4845 return obj
4846
4847 def __eq__(self, other):
4848 if type(self) != type(other): return False
4849 if self.xid != other.xid: return False
4850 if self.flags != other.flags: return False
4851 if self.table_id != other.table_id: return False
4852 if self.checksum != other.checksum: return False
4853 if self.checksum_mask != other.checksum_mask: return False
4854 return True
4855
4856 def pretty_print(self, q):
4857 q.text("bsn_gentable_entry_stats_request {")
4858 with q.group():
4859 with q.indent(2):
4860 q.breakable()
4861 q.text("xid = ");
4862 if self.xid != None:
4863 q.text("%#x" % self.xid)
4864 else:
4865 q.text('None')
4866 q.text(","); q.breakable()
4867 q.text("flags = ");
4868 q.text("%#x" % self.flags)
4869 q.text(","); q.breakable()
4870 q.text("table_id = ");
4871 q.text("%#x" % self.table_id)
4872 q.text(","); q.breakable()
4873 q.text("checksum = ");
4874 q.pp(self.checksum)
4875 q.text(","); q.breakable()
4876 q.text("checksum_mask = ");
4877 q.pp(self.checksum_mask)
4878 q.breakable()
4879 q.text('}')
4880
4881bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4882
4883class bsn_gentable_set_buckets_size(bsn_header):
4884 version = 4
4885 type = 4
4886 experimenter = 6035143
4887 subtype = 50
4888
4889 def __init__(self, xid=None, table_id=None, buckets_size=None):
4890 if xid != None:
4891 self.xid = xid
4892 else:
4893 self.xid = None
4894 if table_id != None:
4895 self.table_id = table_id
4896 else:
4897 self.table_id = 0
4898 if buckets_size != None:
4899 self.buckets_size = buckets_size
4900 else:
4901 self.buckets_size = 0
4902 return
4903
4904 def pack(self):
4905 packed = []
4906 packed.append(struct.pack("!B", self.version))
4907 packed.append(struct.pack("!B", self.type))
4908 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4909 packed.append(struct.pack("!L", self.xid))
4910 packed.append(struct.pack("!L", self.experimenter))
4911 packed.append(struct.pack("!L", self.subtype))
4912 packed.append(struct.pack("!H", self.table_id))
4913 packed.append('\x00' * 2)
4914 packed.append(struct.pack("!L", self.buckets_size))
4915 length = sum([len(x) for x in packed])
4916 packed[2] = struct.pack("!H", length)
4917 return ''.join(packed)
4918
4919 @staticmethod
4920 def unpack(reader):
4921 obj = bsn_gentable_set_buckets_size()
4922 _version = reader.read("!B")[0]
4923 assert(_version == 4)
4924 _type = reader.read("!B")[0]
4925 assert(_type == 4)
4926 _length = reader.read("!H")[0]
4927 orig_reader = reader
4928 reader = orig_reader.slice(_length, 4)
4929 obj.xid = reader.read("!L")[0]
4930 _experimenter = reader.read("!L")[0]
4931 assert(_experimenter == 6035143)
4932 _subtype = reader.read("!L")[0]
4933 assert(_subtype == 50)
4934 obj.table_id = reader.read("!H")[0]
4935 reader.skip(2)
4936 obj.buckets_size = reader.read("!L")[0]
4937 return obj
4938
4939 def __eq__(self, other):
4940 if type(self) != type(other): return False
4941 if self.xid != other.xid: return False
4942 if self.table_id != other.table_id: return False
4943 if self.buckets_size != other.buckets_size: return False
4944 return True
4945
4946 def pretty_print(self, q):
4947 q.text("bsn_gentable_set_buckets_size {")
4948 with q.group():
4949 with q.indent(2):
4950 q.breakable()
4951 q.text("xid = ");
4952 if self.xid != None:
4953 q.text("%#x" % self.xid)
4954 else:
4955 q.text('None')
4956 q.text(","); q.breakable()
4957 q.text("table_id = ");
4958 q.text("%#x" % self.table_id)
4959 q.text(","); q.breakable()
4960 q.text("buckets_size = ");
4961 q.text("%#x" % self.buckets_size)
4962 q.breakable()
4963 q.text('}')
4964
4965bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4966
4967class bsn_gentable_stats_reply(bsn_stats_reply):
4968 version = 4
4969 type = 19
4970 stats_type = 65535
4971 experimenter = 6035143
4972 subtype = 7
4973
4974 def __init__(self, xid=None, flags=None, entries=None):
4975 if xid != None:
4976 self.xid = xid
4977 else:
4978 self.xid = None
4979 if flags != None:
4980 self.flags = flags
4981 else:
4982 self.flags = 0
4983 if entries != None:
4984 self.entries = entries
4985 else:
4986 self.entries = []
4987 return
4988
4989 def pack(self):
4990 packed = []
4991 packed.append(struct.pack("!B", self.version))
4992 packed.append(struct.pack("!B", self.type))
4993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4994 packed.append(struct.pack("!L", self.xid))
4995 packed.append(struct.pack("!H", self.stats_type))
4996 packed.append(struct.pack("!H", self.flags))
4997 packed.append('\x00' * 4)
4998 packed.append(struct.pack("!L", self.experimenter))
4999 packed.append(struct.pack("!L", self.subtype))
5000 packed.append(loxi.generic_util.pack_list(self.entries))
5001 length = sum([len(x) for x in packed])
5002 packed[2] = struct.pack("!H", length)
5003 return ''.join(packed)
5004
5005 @staticmethod
5006 def unpack(reader):
5007 obj = bsn_gentable_stats_reply()
5008 _version = reader.read("!B")[0]
5009 assert(_version == 4)
5010 _type = reader.read("!B")[0]
5011 assert(_type == 19)
5012 _length = reader.read("!H")[0]
5013 orig_reader = reader
5014 reader = orig_reader.slice(_length, 4)
5015 obj.xid = reader.read("!L")[0]
5016 _stats_type = reader.read("!H")[0]
5017 assert(_stats_type == 65535)
5018 obj.flags = reader.read("!H")[0]
5019 reader.skip(4)
5020 _experimenter = reader.read("!L")[0]
5021 assert(_experimenter == 6035143)
5022 _subtype = reader.read("!L")[0]
5023 assert(_subtype == 7)
5024 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
5025 return obj
5026
5027 def __eq__(self, other):
5028 if type(self) != type(other): return False
5029 if self.xid != other.xid: return False
5030 if self.flags != other.flags: return False
5031 if self.entries != other.entries: return False
5032 return True
5033
5034 def pretty_print(self, q):
5035 q.text("bsn_gentable_stats_reply {")
5036 with q.group():
5037 with q.indent(2):
5038 q.breakable()
5039 q.text("xid = ");
5040 if self.xid != None:
5041 q.text("%#x" % self.xid)
5042 else:
5043 q.text('None')
5044 q.text(","); q.breakable()
5045 q.text("flags = ");
5046 q.text("%#x" % self.flags)
5047 q.text(","); q.breakable()
5048 q.text("entries = ");
5049 q.pp(self.entries)
5050 q.breakable()
5051 q.text('}')
5052
5053bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
5054
5055class bsn_gentable_stats_request(bsn_stats_request):
5056 version = 4
5057 type = 18
5058 stats_type = 65535
5059 experimenter = 6035143
5060 subtype = 7
5061
5062 def __init__(self, xid=None, flags=None):
5063 if xid != None:
5064 self.xid = xid
5065 else:
5066 self.xid = None
5067 if flags != None:
5068 self.flags = flags
5069 else:
5070 self.flags = 0
5071 return
5072
5073 def pack(self):
5074 packed = []
5075 packed.append(struct.pack("!B", self.version))
5076 packed.append(struct.pack("!B", self.type))
5077 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5078 packed.append(struct.pack("!L", self.xid))
5079 packed.append(struct.pack("!H", self.stats_type))
5080 packed.append(struct.pack("!H", self.flags))
5081 packed.append('\x00' * 4)
5082 packed.append(struct.pack("!L", self.experimenter))
5083 packed.append(struct.pack("!L", self.subtype))
5084 length = sum([len(x) for x in packed])
5085 packed[2] = struct.pack("!H", length)
5086 return ''.join(packed)
5087
5088 @staticmethod
5089 def unpack(reader):
5090 obj = bsn_gentable_stats_request()
5091 _version = reader.read("!B")[0]
5092 assert(_version == 4)
5093 _type = reader.read("!B")[0]
5094 assert(_type == 18)
5095 _length = reader.read("!H")[0]
5096 orig_reader = reader
5097 reader = orig_reader.slice(_length, 4)
5098 obj.xid = reader.read("!L")[0]
5099 _stats_type = reader.read("!H")[0]
5100 assert(_stats_type == 65535)
5101 obj.flags = reader.read("!H")[0]
5102 reader.skip(4)
5103 _experimenter = reader.read("!L")[0]
5104 assert(_experimenter == 6035143)
5105 _subtype = reader.read("!L")[0]
5106 assert(_subtype == 7)
5107 return obj
5108
5109 def __eq__(self, other):
5110 if type(self) != type(other): return False
5111 if self.xid != other.xid: return False
5112 if self.flags != other.flags: return False
5113 return True
5114
5115 def pretty_print(self, q):
5116 q.text("bsn_gentable_stats_request {")
5117 with q.group():
5118 with q.indent(2):
5119 q.breakable()
5120 q.text("xid = ");
5121 if self.xid != None:
5122 q.text("%#x" % self.xid)
5123 else:
5124 q.text('None')
5125 q.text(","); q.breakable()
5126 q.text("flags = ");
5127 q.text("%#x" % self.flags)
5128 q.breakable()
5129 q.text('}')
5130
5131bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
5132
5133class bsn_get_interfaces_reply(bsn_header):
5134 version = 4
5135 type = 4
5136 experimenter = 6035143
5137 subtype = 10
5138
5139 def __init__(self, xid=None, interfaces=None):
5140 if xid != None:
5141 self.xid = xid
5142 else:
5143 self.xid = None
5144 if interfaces != None:
5145 self.interfaces = interfaces
5146 else:
5147 self.interfaces = []
5148 return
5149
5150 def pack(self):
5151 packed = []
5152 packed.append(struct.pack("!B", self.version))
5153 packed.append(struct.pack("!B", self.type))
5154 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5155 packed.append(struct.pack("!L", self.xid))
5156 packed.append(struct.pack("!L", self.experimenter))
5157 packed.append(struct.pack("!L", self.subtype))
5158 packed.append(loxi.generic_util.pack_list(self.interfaces))
5159 length = sum([len(x) for x in packed])
5160 packed[2] = struct.pack("!H", length)
5161 return ''.join(packed)
5162
5163 @staticmethod
5164 def unpack(reader):
5165 obj = bsn_get_interfaces_reply()
5166 _version = reader.read("!B")[0]
5167 assert(_version == 4)
5168 _type = reader.read("!B")[0]
5169 assert(_type == 4)
5170 _length = reader.read("!H")[0]
5171 orig_reader = reader
5172 reader = orig_reader.slice(_length, 4)
5173 obj.xid = reader.read("!L")[0]
5174 _experimenter = reader.read("!L")[0]
5175 assert(_experimenter == 6035143)
5176 _subtype = reader.read("!L")[0]
5177 assert(_subtype == 10)
5178 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
5179 return obj
5180
5181 def __eq__(self, other):
5182 if type(self) != type(other): return False
5183 if self.xid != other.xid: return False
5184 if self.interfaces != other.interfaces: return False
5185 return True
5186
5187 def pretty_print(self, q):
5188 q.text("bsn_get_interfaces_reply {")
5189 with q.group():
5190 with q.indent(2):
5191 q.breakable()
5192 q.text("xid = ");
5193 if self.xid != None:
5194 q.text("%#x" % self.xid)
5195 else:
5196 q.text('None')
5197 q.text(","); q.breakable()
5198 q.text("interfaces = ");
5199 q.pp(self.interfaces)
5200 q.breakable()
5201 q.text('}')
5202
5203bsn_header.subtypes[10] = bsn_get_interfaces_reply
5204
5205class bsn_get_interfaces_request(bsn_header):
5206 version = 4
5207 type = 4
5208 experimenter = 6035143
5209 subtype = 9
5210
5211 def __init__(self, xid=None):
5212 if xid != None:
5213 self.xid = xid
5214 else:
5215 self.xid = None
5216 return
5217
5218 def pack(self):
5219 packed = []
5220 packed.append(struct.pack("!B", self.version))
5221 packed.append(struct.pack("!B", self.type))
5222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5223 packed.append(struct.pack("!L", self.xid))
5224 packed.append(struct.pack("!L", self.experimenter))
5225 packed.append(struct.pack("!L", self.subtype))
5226 length = sum([len(x) for x in packed])
5227 packed[2] = struct.pack("!H", length)
5228 return ''.join(packed)
5229
5230 @staticmethod
5231 def unpack(reader):
5232 obj = bsn_get_interfaces_request()
5233 _version = reader.read("!B")[0]
5234 assert(_version == 4)
5235 _type = reader.read("!B")[0]
5236 assert(_type == 4)
5237 _length = reader.read("!H")[0]
5238 orig_reader = reader
5239 reader = orig_reader.slice(_length, 4)
5240 obj.xid = reader.read("!L")[0]
5241 _experimenter = reader.read("!L")[0]
5242 assert(_experimenter == 6035143)
5243 _subtype = reader.read("!L")[0]
5244 assert(_subtype == 9)
5245 return obj
5246
5247 def __eq__(self, other):
5248 if type(self) != type(other): return False
5249 if self.xid != other.xid: return False
5250 return True
5251
5252 def pretty_print(self, q):
5253 q.text("bsn_get_interfaces_request {")
5254 with q.group():
5255 with q.indent(2):
5256 q.breakable()
5257 q.text("xid = ");
5258 if self.xid != None:
5259 q.text("%#x" % self.xid)
5260 else:
5261 q.text('None')
5262 q.breakable()
5263 q.text('}')
5264
5265bsn_header.subtypes[9] = bsn_get_interfaces_request
5266
5267class bsn_get_mirroring_reply(bsn_header):
5268 version = 4
5269 type = 4
5270 experimenter = 6035143
5271 subtype = 5
5272
5273 def __init__(self, xid=None, report_mirror_ports=None):
5274 if xid != None:
5275 self.xid = xid
5276 else:
5277 self.xid = None
5278 if report_mirror_ports != None:
5279 self.report_mirror_ports = report_mirror_ports
5280 else:
5281 self.report_mirror_ports = 0
5282 return
5283
5284 def pack(self):
5285 packed = []
5286 packed.append(struct.pack("!B", self.version))
5287 packed.append(struct.pack("!B", self.type))
5288 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5289 packed.append(struct.pack("!L", self.xid))
5290 packed.append(struct.pack("!L", self.experimenter))
5291 packed.append(struct.pack("!L", self.subtype))
5292 packed.append(struct.pack("!B", self.report_mirror_ports))
5293 packed.append('\x00' * 3)
5294 length = sum([len(x) for x in packed])
5295 packed[2] = struct.pack("!H", length)
5296 return ''.join(packed)
5297
5298 @staticmethod
5299 def unpack(reader):
5300 obj = bsn_get_mirroring_reply()
5301 _version = reader.read("!B")[0]
5302 assert(_version == 4)
5303 _type = reader.read("!B")[0]
5304 assert(_type == 4)
5305 _length = reader.read("!H")[0]
5306 orig_reader = reader
5307 reader = orig_reader.slice(_length, 4)
5308 obj.xid = reader.read("!L")[0]
5309 _experimenter = reader.read("!L")[0]
5310 assert(_experimenter == 6035143)
5311 _subtype = reader.read("!L")[0]
5312 assert(_subtype == 5)
5313 obj.report_mirror_ports = reader.read("!B")[0]
5314 reader.skip(3)
5315 return obj
5316
5317 def __eq__(self, other):
5318 if type(self) != type(other): return False
5319 if self.xid != other.xid: return False
5320 if self.report_mirror_ports != other.report_mirror_ports: return False
5321 return True
5322
5323 def pretty_print(self, q):
5324 q.text("bsn_get_mirroring_reply {")
5325 with q.group():
5326 with q.indent(2):
5327 q.breakable()
5328 q.text("xid = ");
5329 if self.xid != None:
5330 q.text("%#x" % self.xid)
5331 else:
5332 q.text('None')
5333 q.text(","); q.breakable()
5334 q.text("report_mirror_ports = ");
5335 q.text("%#x" % self.report_mirror_ports)
5336 q.breakable()
5337 q.text('}')
5338
5339bsn_header.subtypes[5] = bsn_get_mirroring_reply
5340
5341class bsn_get_mirroring_request(bsn_header):
5342 version = 4
5343 type = 4
5344 experimenter = 6035143
5345 subtype = 4
5346
5347 def __init__(self, xid=None, report_mirror_ports=None):
5348 if xid != None:
5349 self.xid = xid
5350 else:
5351 self.xid = None
5352 if report_mirror_ports != None:
5353 self.report_mirror_ports = report_mirror_ports
5354 else:
5355 self.report_mirror_ports = 0
5356 return
5357
5358 def pack(self):
5359 packed = []
5360 packed.append(struct.pack("!B", self.version))
5361 packed.append(struct.pack("!B", self.type))
5362 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5363 packed.append(struct.pack("!L", self.xid))
5364 packed.append(struct.pack("!L", self.experimenter))
5365 packed.append(struct.pack("!L", self.subtype))
5366 packed.append(struct.pack("!B", self.report_mirror_ports))
5367 packed.append('\x00' * 3)
5368 length = sum([len(x) for x in packed])
5369 packed[2] = struct.pack("!H", length)
5370 return ''.join(packed)
5371
5372 @staticmethod
5373 def unpack(reader):
5374 obj = bsn_get_mirroring_request()
5375 _version = reader.read("!B")[0]
5376 assert(_version == 4)
5377 _type = reader.read("!B")[0]
5378 assert(_type == 4)
5379 _length = reader.read("!H")[0]
5380 orig_reader = reader
5381 reader = orig_reader.slice(_length, 4)
5382 obj.xid = reader.read("!L")[0]
5383 _experimenter = reader.read("!L")[0]
5384 assert(_experimenter == 6035143)
5385 _subtype = reader.read("!L")[0]
5386 assert(_subtype == 4)
5387 obj.report_mirror_ports = reader.read("!B")[0]
5388 reader.skip(3)
5389 return obj
5390
5391 def __eq__(self, other):
5392 if type(self) != type(other): return False
5393 if self.xid != other.xid: return False
5394 if self.report_mirror_ports != other.report_mirror_ports: return False
5395 return True
5396
5397 def pretty_print(self, q):
5398 q.text("bsn_get_mirroring_request {")
5399 with q.group():
5400 with q.indent(2):
5401 q.breakable()
5402 q.text("xid = ");
5403 if self.xid != None:
5404 q.text("%#x" % self.xid)
5405 else:
5406 q.text('None')
5407 q.text(","); q.breakable()
5408 q.text("report_mirror_ports = ");
5409 q.text("%#x" % self.report_mirror_ports)
5410 q.breakable()
5411 q.text('}')
5412
5413bsn_header.subtypes[4] = bsn_get_mirroring_request
5414
5415class bsn_get_switch_pipeline_reply(bsn_header):
5416 version = 4
5417 type = 4
5418 experimenter = 6035143
5419 subtype = 52
5420
5421 def __init__(self, xid=None, pipeline=None):
5422 if xid != None:
5423 self.xid = xid
5424 else:
5425 self.xid = None
5426 if pipeline != None:
5427 self.pipeline = pipeline
5428 else:
5429 self.pipeline = ""
5430 return
5431
5432 def pack(self):
5433 packed = []
5434 packed.append(struct.pack("!B", self.version))
5435 packed.append(struct.pack("!B", self.type))
5436 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5437 packed.append(struct.pack("!L", self.xid))
5438 packed.append(struct.pack("!L", self.experimenter))
5439 packed.append(struct.pack("!L", self.subtype))
5440 packed.append(struct.pack("!256s", self.pipeline))
5441 length = sum([len(x) for x in packed])
5442 packed[2] = struct.pack("!H", length)
5443 return ''.join(packed)
5444
5445 @staticmethod
5446 def unpack(reader):
5447 obj = bsn_get_switch_pipeline_reply()
5448 _version = reader.read("!B")[0]
5449 assert(_version == 4)
5450 _type = reader.read("!B")[0]
5451 assert(_type == 4)
5452 _length = reader.read("!H")[0]
5453 orig_reader = reader
5454 reader = orig_reader.slice(_length, 4)
5455 obj.xid = reader.read("!L")[0]
5456 _experimenter = reader.read("!L")[0]
5457 assert(_experimenter == 6035143)
5458 _subtype = reader.read("!L")[0]
5459 assert(_subtype == 52)
5460 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5461 return obj
5462
5463 def __eq__(self, other):
5464 if type(self) != type(other): return False
5465 if self.xid != other.xid: return False
5466 if self.pipeline != other.pipeline: return False
5467 return True
5468
5469 def pretty_print(self, q):
5470 q.text("bsn_get_switch_pipeline_reply {")
5471 with q.group():
5472 with q.indent(2):
5473 q.breakable()
5474 q.text("xid = ");
5475 if self.xid != None:
5476 q.text("%#x" % self.xid)
5477 else:
5478 q.text('None')
5479 q.text(","); q.breakable()
5480 q.text("pipeline = ");
5481 q.pp(self.pipeline)
5482 q.breakable()
5483 q.text('}')
5484
5485bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5486
5487class bsn_get_switch_pipeline_request(bsn_header):
5488 version = 4
5489 type = 4
5490 experimenter = 6035143
5491 subtype = 51
5492
5493 def __init__(self, xid=None):
5494 if xid != None:
5495 self.xid = xid
5496 else:
5497 self.xid = None
5498 return
5499
5500 def pack(self):
5501 packed = []
5502 packed.append(struct.pack("!B", self.version))
5503 packed.append(struct.pack("!B", self.type))
5504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5505 packed.append(struct.pack("!L", self.xid))
5506 packed.append(struct.pack("!L", self.experimenter))
5507 packed.append(struct.pack("!L", self.subtype))
5508 length = sum([len(x) for x in packed])
5509 packed[2] = struct.pack("!H", length)
5510 return ''.join(packed)
5511
5512 @staticmethod
5513 def unpack(reader):
5514 obj = bsn_get_switch_pipeline_request()
5515 _version = reader.read("!B")[0]
5516 assert(_version == 4)
5517 _type = reader.read("!B")[0]
5518 assert(_type == 4)
5519 _length = reader.read("!H")[0]
5520 orig_reader = reader
5521 reader = orig_reader.slice(_length, 4)
5522 obj.xid = reader.read("!L")[0]
5523 _experimenter = reader.read("!L")[0]
5524 assert(_experimenter == 6035143)
5525 _subtype = reader.read("!L")[0]
5526 assert(_subtype == 51)
5527 return obj
5528
5529 def __eq__(self, other):
5530 if type(self) != type(other): return False
5531 if self.xid != other.xid: return False
5532 return True
5533
5534 def pretty_print(self, q):
5535 q.text("bsn_get_switch_pipeline_request {")
5536 with q.group():
5537 with q.indent(2):
5538 q.breakable()
5539 q.text("xid = ");
5540 if self.xid != None:
5541 q.text("%#x" % self.xid)
5542 else:
5543 q.text('None')
5544 q.breakable()
5545 q.text('}')
5546
5547bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5548
5549class bsn_image_desc_stats_reply(bsn_stats_reply):
5550 version = 4
5551 type = 19
5552 stats_type = 65535
5553 experimenter = 6035143
5554 subtype = 14
5555
5556 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5557 if xid != None:
5558 self.xid = xid
5559 else:
5560 self.xid = None
5561 if flags != None:
5562 self.flags = flags
5563 else:
5564 self.flags = 0
5565 if image_checksum != None:
5566 self.image_checksum = image_checksum
5567 else:
5568 self.image_checksum = ""
5569 if startup_config_checksum != None:
5570 self.startup_config_checksum = startup_config_checksum
5571 else:
5572 self.startup_config_checksum = ""
5573 return
5574
5575 def pack(self):
5576 packed = []
5577 packed.append(struct.pack("!B", self.version))
5578 packed.append(struct.pack("!B", self.type))
5579 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5580 packed.append(struct.pack("!L", self.xid))
5581 packed.append(struct.pack("!H", self.stats_type))
5582 packed.append(struct.pack("!H", self.flags))
5583 packed.append('\x00' * 4)
5584 packed.append(struct.pack("!L", self.experimenter))
5585 packed.append(struct.pack("!L", self.subtype))
5586 packed.append(struct.pack("!256s", self.image_checksum))
5587 packed.append(struct.pack("!256s", self.startup_config_checksum))
5588 length = sum([len(x) for x in packed])
5589 packed[2] = struct.pack("!H", length)
5590 return ''.join(packed)
5591
5592 @staticmethod
5593 def unpack(reader):
5594 obj = bsn_image_desc_stats_reply()
5595 _version = reader.read("!B")[0]
5596 assert(_version == 4)
5597 _type = reader.read("!B")[0]
5598 assert(_type == 19)
5599 _length = reader.read("!H")[0]
5600 orig_reader = reader
5601 reader = orig_reader.slice(_length, 4)
5602 obj.xid = reader.read("!L")[0]
5603 _stats_type = reader.read("!H")[0]
5604 assert(_stats_type == 65535)
5605 obj.flags = reader.read("!H")[0]
5606 reader.skip(4)
5607 _experimenter = reader.read("!L")[0]
5608 assert(_experimenter == 6035143)
5609 _subtype = reader.read("!L")[0]
5610 assert(_subtype == 14)
5611 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5612 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5613 return obj
5614
5615 def __eq__(self, other):
5616 if type(self) != type(other): return False
5617 if self.xid != other.xid: return False
5618 if self.flags != other.flags: return False
5619 if self.image_checksum != other.image_checksum: return False
5620 if self.startup_config_checksum != other.startup_config_checksum: return False
5621 return True
5622
5623 def pretty_print(self, q):
5624 q.text("bsn_image_desc_stats_reply {")
5625 with q.group():
5626 with q.indent(2):
5627 q.breakable()
5628 q.text("xid = ");
5629 if self.xid != None:
5630 q.text("%#x" % self.xid)
5631 else:
5632 q.text('None')
5633 q.text(","); q.breakable()
5634 q.text("flags = ");
5635 q.text("%#x" % self.flags)
5636 q.text(","); q.breakable()
5637 q.text("image_checksum = ");
5638 q.pp(self.image_checksum)
5639 q.text(","); q.breakable()
5640 q.text("startup_config_checksum = ");
5641 q.pp(self.startup_config_checksum)
5642 q.breakable()
5643 q.text('}')
5644
5645bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5646
5647class bsn_image_desc_stats_request(bsn_stats_request):
5648 version = 4
5649 type = 18
5650 stats_type = 65535
5651 experimenter = 6035143
5652 subtype = 14
5653
5654 def __init__(self, xid=None, flags=None):
5655 if xid != None:
5656 self.xid = xid
5657 else:
5658 self.xid = None
5659 if flags != None:
5660 self.flags = flags
5661 else:
5662 self.flags = 0
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("!H", self.stats_type))
5672 packed.append(struct.pack("!H", self.flags))
5673 packed.append('\x00' * 4)
5674 packed.append(struct.pack("!L", self.experimenter))
5675 packed.append(struct.pack("!L", self.subtype))
5676 length = sum([len(x) for x in packed])
5677 packed[2] = struct.pack("!H", length)
5678 return ''.join(packed)
5679
5680 @staticmethod
5681 def unpack(reader):
5682 obj = bsn_image_desc_stats_request()
5683 _version = reader.read("!B")[0]
5684 assert(_version == 4)
5685 _type = reader.read("!B")[0]
5686 assert(_type == 18)
5687 _length = reader.read("!H")[0]
5688 orig_reader = reader
5689 reader = orig_reader.slice(_length, 4)
5690 obj.xid = reader.read("!L")[0]
5691 _stats_type = reader.read("!H")[0]
5692 assert(_stats_type == 65535)
5693 obj.flags = reader.read("!H")[0]
5694 reader.skip(4)
5695 _experimenter = reader.read("!L")[0]
5696 assert(_experimenter == 6035143)
5697 _subtype = reader.read("!L")[0]
5698 assert(_subtype == 14)
5699 return obj
5700
5701 def __eq__(self, other):
5702 if type(self) != type(other): return False
5703 if self.xid != other.xid: return False
5704 if self.flags != other.flags: return False
5705 return True
5706
5707 def pretty_print(self, q):
5708 q.text("bsn_image_desc_stats_request {")
5709 with q.group():
5710 with q.indent(2):
5711 q.breakable()
5712 q.text("xid = ");
5713 if self.xid != None:
5714 q.text("%#x" % self.xid)
5715 else:
5716 q.text('None')
5717 q.text(","); q.breakable()
5718 q.text("flags = ");
5719 q.text("%#x" % self.flags)
5720 q.breakable()
5721 q.text('}')
5722
5723bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5724
5725class bsn_lacp_convergence_notif(bsn_header):
5726 version = 4
5727 type = 4
5728 experimenter = 6035143
5729 subtype = 43
5730
5731 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):
5732 if xid != None:
5733 self.xid = xid
5734 else:
5735 self.xid = None
5736 if convergence_status != None:
5737 self.convergence_status = convergence_status
5738 else:
5739 self.convergence_status = 0
5740 if port_no != None:
5741 self.port_no = port_no
5742 else:
5743 self.port_no = 0
5744 if actor_sys_priority != None:
5745 self.actor_sys_priority = actor_sys_priority
5746 else:
5747 self.actor_sys_priority = 0
5748 if actor_sys_mac != None:
5749 self.actor_sys_mac = actor_sys_mac
5750 else:
5751 self.actor_sys_mac = [0,0,0,0,0,0]
5752 if actor_port_priority != None:
5753 self.actor_port_priority = actor_port_priority
5754 else:
5755 self.actor_port_priority = 0
5756 if actor_port_num != None:
5757 self.actor_port_num = actor_port_num
5758 else:
5759 self.actor_port_num = 0
5760 if actor_key != None:
5761 self.actor_key = actor_key
5762 else:
5763 self.actor_key = 0
5764 if partner_sys_priority != None:
5765 self.partner_sys_priority = partner_sys_priority
5766 else:
5767 self.partner_sys_priority = 0
5768 if partner_sys_mac != None:
5769 self.partner_sys_mac = partner_sys_mac
5770 else:
5771 self.partner_sys_mac = [0,0,0,0,0,0]
5772 if partner_port_priority != None:
5773 self.partner_port_priority = partner_port_priority
5774 else:
5775 self.partner_port_priority = 0
5776 if partner_port_num != None:
5777 self.partner_port_num = partner_port_num
5778 else:
5779 self.partner_port_num = 0
5780 if partner_key != None:
5781 self.partner_key = partner_key
5782 else:
5783 self.partner_key = 0
5784 return
5785
5786 def pack(self):
5787 packed = []
5788 packed.append(struct.pack("!B", self.version))
5789 packed.append(struct.pack("!B", self.type))
5790 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5791 packed.append(struct.pack("!L", self.xid))
5792 packed.append(struct.pack("!L", self.experimenter))
5793 packed.append(struct.pack("!L", self.subtype))
5794 packed.append(struct.pack("!B", self.convergence_status))
5795 packed.append('\x00' * 3)
5796 packed.append(util.pack_port_no(self.port_no))
5797 packed.append(struct.pack("!H", self.actor_sys_priority))
5798 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5799 packed.append(struct.pack("!H", self.actor_port_priority))
5800 packed.append(struct.pack("!H", self.actor_port_num))
5801 packed.append(struct.pack("!H", self.actor_key))
5802 packed.append(struct.pack("!H", self.partner_sys_priority))
5803 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5804 packed.append(struct.pack("!H", self.partner_port_priority))
5805 packed.append(struct.pack("!H", self.partner_port_num))
5806 packed.append(struct.pack("!H", self.partner_key))
5807 length = sum([len(x) for x in packed])
5808 packed[2] = struct.pack("!H", length)
5809 return ''.join(packed)
5810
5811 @staticmethod
5812 def unpack(reader):
5813 obj = bsn_lacp_convergence_notif()
5814 _version = reader.read("!B")[0]
5815 assert(_version == 4)
5816 _type = reader.read("!B")[0]
5817 assert(_type == 4)
5818 _length = reader.read("!H")[0]
5819 orig_reader = reader
5820 reader = orig_reader.slice(_length, 4)
5821 obj.xid = reader.read("!L")[0]
5822 _experimenter = reader.read("!L")[0]
5823 assert(_experimenter == 6035143)
5824 _subtype = reader.read("!L")[0]
5825 assert(_subtype == 43)
5826 obj.convergence_status = reader.read("!B")[0]
5827 reader.skip(3)
5828 obj.port_no = util.unpack_port_no(reader)
5829 obj.actor_sys_priority = reader.read("!H")[0]
5830 obj.actor_sys_mac = list(reader.read('!6B'))
5831 obj.actor_port_priority = reader.read("!H")[0]
5832 obj.actor_port_num = reader.read("!H")[0]
5833 obj.actor_key = reader.read("!H")[0]
5834 obj.partner_sys_priority = reader.read("!H")[0]
5835 obj.partner_sys_mac = list(reader.read('!6B'))
5836 obj.partner_port_priority = reader.read("!H")[0]
5837 obj.partner_port_num = reader.read("!H")[0]
5838 obj.partner_key = reader.read("!H")[0]
5839 return obj
5840
5841 def __eq__(self, other):
5842 if type(self) != type(other): return False
5843 if self.xid != other.xid: return False
5844 if self.convergence_status != other.convergence_status: return False
5845 if self.port_no != other.port_no: return False
5846 if self.actor_sys_priority != other.actor_sys_priority: return False
5847 if self.actor_sys_mac != other.actor_sys_mac: return False
5848 if self.actor_port_priority != other.actor_port_priority: return False
5849 if self.actor_port_num != other.actor_port_num: return False
5850 if self.actor_key != other.actor_key: return False
5851 if self.partner_sys_priority != other.partner_sys_priority: return False
5852 if self.partner_sys_mac != other.partner_sys_mac: return False
5853 if self.partner_port_priority != other.partner_port_priority: return False
5854 if self.partner_port_num != other.partner_port_num: return False
5855 if self.partner_key != other.partner_key: return False
5856 return True
5857
5858 def pretty_print(self, q):
5859 q.text("bsn_lacp_convergence_notif {")
5860 with q.group():
5861 with q.indent(2):
5862 q.breakable()
5863 q.text("xid = ");
5864 if self.xid != None:
5865 q.text("%#x" % self.xid)
5866 else:
5867 q.text('None')
5868 q.text(","); q.breakable()
5869 q.text("convergence_status = ");
5870 q.text("%#x" % self.convergence_status)
5871 q.text(","); q.breakable()
5872 q.text("port_no = ");
5873 q.text(util.pretty_port(self.port_no))
5874 q.text(","); q.breakable()
5875 q.text("actor_sys_priority = ");
5876 q.text("%#x" % self.actor_sys_priority)
5877 q.text(","); q.breakable()
5878 q.text("actor_sys_mac = ");
5879 q.text(util.pretty_mac(self.actor_sys_mac))
5880 q.text(","); q.breakable()
5881 q.text("actor_port_priority = ");
5882 q.text("%#x" % self.actor_port_priority)
5883 q.text(","); q.breakable()
5884 q.text("actor_port_num = ");
5885 q.text("%#x" % self.actor_port_num)
5886 q.text(","); q.breakable()
5887 q.text("actor_key = ");
5888 q.text("%#x" % self.actor_key)
5889 q.text(","); q.breakable()
5890 q.text("partner_sys_priority = ");
5891 q.text("%#x" % self.partner_sys_priority)
5892 q.text(","); q.breakable()
5893 q.text("partner_sys_mac = ");
5894 q.text(util.pretty_mac(self.partner_sys_mac))
5895 q.text(","); q.breakable()
5896 q.text("partner_port_priority = ");
5897 q.text("%#x" % self.partner_port_priority)
5898 q.text(","); q.breakable()
5899 q.text("partner_port_num = ");
5900 q.text("%#x" % self.partner_port_num)
5901 q.text(","); q.breakable()
5902 q.text("partner_key = ");
5903 q.text("%#x" % self.partner_key)
5904 q.breakable()
5905 q.text('}')
5906
5907bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5908
5909class bsn_lacp_stats_reply(bsn_stats_reply):
5910 version = 4
5911 type = 19
5912 stats_type = 65535
5913 experimenter = 6035143
5914 subtype = 1
5915
5916 def __init__(self, xid=None, flags=None, entries=None):
5917 if xid != None:
5918 self.xid = xid
5919 else:
5920 self.xid = None
5921 if flags != None:
5922 self.flags = flags
5923 else:
5924 self.flags = 0
5925 if entries != None:
5926 self.entries = entries
5927 else:
5928 self.entries = []
5929 return
5930
5931 def pack(self):
5932 packed = []
5933 packed.append(struct.pack("!B", self.version))
5934 packed.append(struct.pack("!B", self.type))
5935 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5936 packed.append(struct.pack("!L", self.xid))
5937 packed.append(struct.pack("!H", self.stats_type))
5938 packed.append(struct.pack("!H", self.flags))
5939 packed.append('\x00' * 4)
5940 packed.append(struct.pack("!L", self.experimenter))
5941 packed.append(struct.pack("!L", self.subtype))
5942 packed.append(loxi.generic_util.pack_list(self.entries))
5943 length = sum([len(x) for x in packed])
5944 packed[2] = struct.pack("!H", length)
5945 return ''.join(packed)
5946
5947 @staticmethod
5948 def unpack(reader):
5949 obj = bsn_lacp_stats_reply()
5950 _version = reader.read("!B")[0]
5951 assert(_version == 4)
5952 _type = reader.read("!B")[0]
5953 assert(_type == 19)
5954 _length = reader.read("!H")[0]
5955 orig_reader = reader
5956 reader = orig_reader.slice(_length, 4)
5957 obj.xid = reader.read("!L")[0]
5958 _stats_type = reader.read("!H")[0]
5959 assert(_stats_type == 65535)
5960 obj.flags = reader.read("!H")[0]
5961 reader.skip(4)
5962 _experimenter = reader.read("!L")[0]
5963 assert(_experimenter == 6035143)
5964 _subtype = reader.read("!L")[0]
5965 assert(_subtype == 1)
5966 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
5967 return obj
5968
5969 def __eq__(self, other):
5970 if type(self) != type(other): return False
5971 if self.xid != other.xid: return False
5972 if self.flags != other.flags: return False
5973 if self.entries != other.entries: return False
5974 return True
5975
5976 def pretty_print(self, q):
5977 q.text("bsn_lacp_stats_reply {")
5978 with q.group():
5979 with q.indent(2):
5980 q.breakable()
5981 q.text("xid = ");
5982 if self.xid != None:
5983 q.text("%#x" % self.xid)
5984 else:
5985 q.text('None')
5986 q.text(","); q.breakable()
5987 q.text("flags = ");
5988 q.text("%#x" % self.flags)
5989 q.text(","); q.breakable()
5990 q.text("entries = ");
5991 q.pp(self.entries)
5992 q.breakable()
5993 q.text('}')
5994
5995bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5996
5997class bsn_lacp_stats_request(bsn_stats_request):
5998 version = 4
5999 type = 18
6000 stats_type = 65535
6001 experimenter = 6035143
6002 subtype = 1
6003
6004 def __init__(self, xid=None, flags=None):
6005 if xid != None:
6006 self.xid = xid
6007 else:
6008 self.xid = None
6009 if flags != None:
6010 self.flags = flags
6011 else:
6012 self.flags = 0
6013 return
6014
6015 def pack(self):
6016 packed = []
6017 packed.append(struct.pack("!B", self.version))
6018 packed.append(struct.pack("!B", self.type))
6019 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6020 packed.append(struct.pack("!L", self.xid))
6021 packed.append(struct.pack("!H", self.stats_type))
6022 packed.append(struct.pack("!H", self.flags))
6023 packed.append('\x00' * 4)
6024 packed.append(struct.pack("!L", self.experimenter))
6025 packed.append(struct.pack("!L", self.subtype))
6026 length = sum([len(x) for x in packed])
6027 packed[2] = struct.pack("!H", length)
6028 return ''.join(packed)
6029
6030 @staticmethod
6031 def unpack(reader):
6032 obj = bsn_lacp_stats_request()
6033 _version = reader.read("!B")[0]
6034 assert(_version == 4)
6035 _type = reader.read("!B")[0]
6036 assert(_type == 18)
6037 _length = reader.read("!H")[0]
6038 orig_reader = reader
6039 reader = orig_reader.slice(_length, 4)
6040 obj.xid = reader.read("!L")[0]
6041 _stats_type = reader.read("!H")[0]
6042 assert(_stats_type == 65535)
6043 obj.flags = reader.read("!H")[0]
6044 reader.skip(4)
6045 _experimenter = reader.read("!L")[0]
6046 assert(_experimenter == 6035143)
6047 _subtype = reader.read("!L")[0]
6048 assert(_subtype == 1)
6049 return obj
6050
6051 def __eq__(self, other):
6052 if type(self) != type(other): return False
6053 if self.xid != other.xid: return False
6054 if self.flags != other.flags: return False
6055 return True
6056
6057 def pretty_print(self, q):
6058 q.text("bsn_lacp_stats_request {")
6059 with q.group():
6060 with q.indent(2):
6061 q.breakable()
6062 q.text("xid = ");
6063 if self.xid != None:
6064 q.text("%#x" % self.xid)
6065 else:
6066 q.text('None')
6067 q.text(","); q.breakable()
6068 q.text("flags = ");
6069 q.text("%#x" % self.flags)
6070 q.breakable()
6071 q.text('}')
6072
6073bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
6074
6075class bsn_log(bsn_header):
6076 version = 4
6077 type = 4
6078 experimenter = 6035143
6079 subtype = 63
6080
6081 def __init__(self, xid=None, loglevel=None, data=None):
6082 if xid != None:
6083 self.xid = xid
6084 else:
6085 self.xid = None
6086 if loglevel != None:
6087 self.loglevel = loglevel
6088 else:
6089 self.loglevel = 0
6090 if data != None:
6091 self.data = data
6092 else:
6093 self.data = ''
6094 return
6095
6096 def pack(self):
6097 packed = []
6098 packed.append(struct.pack("!B", self.version))
6099 packed.append(struct.pack("!B", self.type))
6100 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6101 packed.append(struct.pack("!L", self.xid))
6102 packed.append(struct.pack("!L", self.experimenter))
6103 packed.append(struct.pack("!L", self.subtype))
6104 packed.append(struct.pack("!B", self.loglevel))
6105 packed.append(self.data)
6106 length = sum([len(x) for x in packed])
6107 packed[2] = struct.pack("!H", length)
6108 return ''.join(packed)
6109
6110 @staticmethod
6111 def unpack(reader):
6112 obj = bsn_log()
6113 _version = reader.read("!B")[0]
6114 assert(_version == 4)
6115 _type = reader.read("!B")[0]
6116 assert(_type == 4)
6117 _length = reader.read("!H")[0]
6118 orig_reader = reader
6119 reader = orig_reader.slice(_length, 4)
6120 obj.xid = reader.read("!L")[0]
6121 _experimenter = reader.read("!L")[0]
6122 assert(_experimenter == 6035143)
6123 _subtype = reader.read("!L")[0]
6124 assert(_subtype == 63)
6125 obj.loglevel = reader.read("!B")[0]
6126 obj.data = str(reader.read_all())
6127 return obj
6128
6129 def __eq__(self, other):
6130 if type(self) != type(other): return False
6131 if self.xid != other.xid: return False
6132 if self.loglevel != other.loglevel: return False
6133 if self.data != other.data: return False
6134 return True
6135
6136 def pretty_print(self, q):
6137 q.text("bsn_log {")
6138 with q.group():
6139 with q.indent(2):
6140 q.breakable()
6141 q.text("xid = ");
6142 if self.xid != None:
6143 q.text("%#x" % self.xid)
6144 else:
6145 q.text('None')
6146 q.text(","); q.breakable()
6147 q.text("loglevel = ");
6148 q.text("%#x" % self.loglevel)
6149 q.text(","); q.breakable()
6150 q.text("data = ");
6151 q.pp(self.data)
6152 q.breakable()
6153 q.text('}')
6154
6155bsn_header.subtypes[63] = bsn_log
6156
6157class bsn_lua_command_reply(bsn_header):
6158 version = 4
6159 type = 4
6160 experimenter = 6035143
6161 subtype = 66
6162
6163 def __init__(self, xid=None, data=None):
6164 if xid != None:
6165 self.xid = xid
6166 else:
6167 self.xid = None
6168 if data != None:
6169 self.data = data
6170 else:
6171 self.data = ''
6172 return
6173
6174 def pack(self):
6175 packed = []
6176 packed.append(struct.pack("!B", self.version))
6177 packed.append(struct.pack("!B", self.type))
6178 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6179 packed.append(struct.pack("!L", self.xid))
6180 packed.append(struct.pack("!L", self.experimenter))
6181 packed.append(struct.pack("!L", self.subtype))
6182 packed.append(self.data)
6183 length = sum([len(x) for x in packed])
6184 packed[2] = struct.pack("!H", length)
6185 return ''.join(packed)
6186
6187 @staticmethod
6188 def unpack(reader):
6189 obj = bsn_lua_command_reply()
6190 _version = reader.read("!B")[0]
6191 assert(_version == 4)
6192 _type = reader.read("!B")[0]
6193 assert(_type == 4)
6194 _length = reader.read("!H")[0]
6195 orig_reader = reader
6196 reader = orig_reader.slice(_length, 4)
6197 obj.xid = reader.read("!L")[0]
6198 _experimenter = reader.read("!L")[0]
6199 assert(_experimenter == 6035143)
6200 _subtype = reader.read("!L")[0]
6201 assert(_subtype == 66)
6202 obj.data = str(reader.read_all())
6203 return obj
6204
6205 def __eq__(self, other):
6206 if type(self) != type(other): return False
6207 if self.xid != other.xid: return False
6208 if self.data != other.data: return False
6209 return True
6210
6211 def pretty_print(self, q):
6212 q.text("bsn_lua_command_reply {")
6213 with q.group():
6214 with q.indent(2):
6215 q.breakable()
6216 q.text("xid = ");
6217 if self.xid != None:
6218 q.text("%#x" % self.xid)
6219 else:
6220 q.text('None')
6221 q.text(","); q.breakable()
6222 q.text("data = ");
6223 q.pp(self.data)
6224 q.breakable()
6225 q.text('}')
6226
6227bsn_header.subtypes[66] = bsn_lua_command_reply
6228
6229class bsn_lua_command_request(bsn_header):
6230 version = 4
6231 type = 4
6232 experimenter = 6035143
6233 subtype = 65
6234
6235 def __init__(self, xid=None, data=None):
6236 if xid != None:
6237 self.xid = xid
6238 else:
6239 self.xid = None
6240 if data != None:
6241 self.data = data
6242 else:
6243 self.data = ''
6244 return
6245
6246 def pack(self):
6247 packed = []
6248 packed.append(struct.pack("!B", self.version))
6249 packed.append(struct.pack("!B", self.type))
6250 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6251 packed.append(struct.pack("!L", self.xid))
6252 packed.append(struct.pack("!L", self.experimenter))
6253 packed.append(struct.pack("!L", self.subtype))
6254 packed.append(self.data)
6255 length = sum([len(x) for x in packed])
6256 packed[2] = struct.pack("!H", length)
6257 return ''.join(packed)
6258
6259 @staticmethod
6260 def unpack(reader):
6261 obj = bsn_lua_command_request()
6262 _version = reader.read("!B")[0]
6263 assert(_version == 4)
6264 _type = reader.read("!B")[0]
6265 assert(_type == 4)
6266 _length = reader.read("!H")[0]
6267 orig_reader = reader
6268 reader = orig_reader.slice(_length, 4)
6269 obj.xid = reader.read("!L")[0]
6270 _experimenter = reader.read("!L")[0]
6271 assert(_experimenter == 6035143)
6272 _subtype = reader.read("!L")[0]
6273 assert(_subtype == 65)
6274 obj.data = str(reader.read_all())
6275 return obj
6276
6277 def __eq__(self, other):
6278 if type(self) != type(other): return False
6279 if self.xid != other.xid: return False
6280 if self.data != other.data: return False
6281 return True
6282
6283 def pretty_print(self, q):
6284 q.text("bsn_lua_command_request {")
6285 with q.group():
6286 with q.indent(2):
6287 q.breakable()
6288 q.text("xid = ");
6289 if self.xid != None:
6290 q.text("%#x" % self.xid)
6291 else:
6292 q.text('None')
6293 q.text(","); q.breakable()
6294 q.text("data = ");
6295 q.pp(self.data)
6296 q.breakable()
6297 q.text('}')
6298
6299bsn_header.subtypes[65] = bsn_lua_command_request
6300
6301class bsn_lua_notification(bsn_header):
6302 version = 4
6303 type = 4
6304 experimenter = 6035143
6305 subtype = 67
6306
6307 def __init__(self, xid=None, data=None):
6308 if xid != None:
6309 self.xid = xid
6310 else:
6311 self.xid = None
6312 if data != None:
6313 self.data = data
6314 else:
6315 self.data = ''
6316 return
6317
6318 def pack(self):
6319 packed = []
6320 packed.append(struct.pack("!B", self.version))
6321 packed.append(struct.pack("!B", self.type))
6322 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6323 packed.append(struct.pack("!L", self.xid))
6324 packed.append(struct.pack("!L", self.experimenter))
6325 packed.append(struct.pack("!L", self.subtype))
6326 packed.append(self.data)
6327 length = sum([len(x) for x in packed])
6328 packed[2] = struct.pack("!H", length)
6329 return ''.join(packed)
6330
6331 @staticmethod
6332 def unpack(reader):
6333 obj = bsn_lua_notification()
6334 _version = reader.read("!B")[0]
6335 assert(_version == 4)
6336 _type = reader.read("!B")[0]
6337 assert(_type == 4)
6338 _length = reader.read("!H")[0]
6339 orig_reader = reader
6340 reader = orig_reader.slice(_length, 4)
6341 obj.xid = reader.read("!L")[0]
6342 _experimenter = reader.read("!L")[0]
6343 assert(_experimenter == 6035143)
6344 _subtype = reader.read("!L")[0]
6345 assert(_subtype == 67)
6346 obj.data = str(reader.read_all())
6347 return obj
6348
6349 def __eq__(self, other):
6350 if type(self) != type(other): return False
6351 if self.xid != other.xid: return False
6352 if self.data != other.data: return False
6353 return True
6354
6355 def pretty_print(self, q):
6356 q.text("bsn_lua_notification {")
6357 with q.group():
6358 with q.indent(2):
6359 q.breakable()
6360 q.text("xid = ");
6361 if self.xid != None:
6362 q.text("%#x" % self.xid)
6363 else:
6364 q.text('None')
6365 q.text(","); q.breakable()
6366 q.text("data = ");
6367 q.pp(self.data)
6368 q.breakable()
6369 q.text('}')
6370
6371bsn_header.subtypes[67] = bsn_lua_notification
6372
6373class bsn_lua_upload(bsn_header):
6374 version = 4
6375 type = 4
6376 experimenter = 6035143
6377 subtype = 64
6378
6379 def __init__(self, xid=None, flags=None, filename=None, data=None):
6380 if xid != None:
6381 self.xid = xid
6382 else:
6383 self.xid = None
6384 if flags != None:
6385 self.flags = flags
6386 else:
6387 self.flags = 0
6388 if filename != None:
6389 self.filename = filename
6390 else:
6391 self.filename = ""
6392 if data != None:
6393 self.data = data
6394 else:
6395 self.data = ''
6396 return
6397
6398 def pack(self):
6399 packed = []
6400 packed.append(struct.pack("!B", self.version))
6401 packed.append(struct.pack("!B", self.type))
6402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6403 packed.append(struct.pack("!L", self.xid))
6404 packed.append(struct.pack("!L", self.experimenter))
6405 packed.append(struct.pack("!L", self.subtype))
6406 packed.append(struct.pack("!H", self.flags))
6407 packed.append(struct.pack("!64s", self.filename))
6408 packed.append(self.data)
6409 length = sum([len(x) for x in packed])
6410 packed[2] = struct.pack("!H", length)
6411 return ''.join(packed)
6412
6413 @staticmethod
6414 def unpack(reader):
6415 obj = bsn_lua_upload()
6416 _version = reader.read("!B")[0]
6417 assert(_version == 4)
6418 _type = reader.read("!B")[0]
6419 assert(_type == 4)
6420 _length = reader.read("!H")[0]
6421 orig_reader = reader
6422 reader = orig_reader.slice(_length, 4)
6423 obj.xid = reader.read("!L")[0]
6424 _experimenter = reader.read("!L")[0]
6425 assert(_experimenter == 6035143)
6426 _subtype = reader.read("!L")[0]
6427 assert(_subtype == 64)
6428 obj.flags = reader.read("!H")[0]
6429 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6430 obj.data = str(reader.read_all())
6431 return obj
6432
6433 def __eq__(self, other):
6434 if type(self) != type(other): return False
6435 if self.xid != other.xid: return False
6436 if self.flags != other.flags: return False
6437 if self.filename != other.filename: return False
6438 if self.data != other.data: return False
6439 return True
6440
6441 def pretty_print(self, q):
6442 q.text("bsn_lua_upload {")
6443 with q.group():
6444 with q.indent(2):
6445 q.breakable()
6446 q.text("xid = ");
6447 if self.xid != None:
6448 q.text("%#x" % self.xid)
6449 else:
6450 q.text('None')
6451 q.text(","); q.breakable()
6452 q.text("flags = ");
6453 q.text("%#x" % self.flags)
6454 q.text(","); q.breakable()
6455 q.text("filename = ");
6456 q.pp(self.filename)
6457 q.text(","); q.breakable()
6458 q.text("data = ");
6459 q.pp(self.data)
6460 q.breakable()
6461 q.text('}')
6462
6463bsn_header.subtypes[64] = bsn_lua_upload
6464
6465class bsn_pdu_rx_reply(bsn_header):
6466 version = 4
6467 type = 4
6468 experimenter = 6035143
6469 subtype = 34
6470
6471 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6472 if xid != None:
6473 self.xid = xid
6474 else:
6475 self.xid = None
6476 if status != None:
6477 self.status = status
6478 else:
6479 self.status = 0
6480 if port_no != None:
6481 self.port_no = port_no
6482 else:
6483 self.port_no = 0
6484 if slot_num != None:
6485 self.slot_num = slot_num
6486 else:
6487 self.slot_num = 0
6488 return
6489
6490 def pack(self):
6491 packed = []
6492 packed.append(struct.pack("!B", self.version))
6493 packed.append(struct.pack("!B", self.type))
6494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6495 packed.append(struct.pack("!L", self.xid))
6496 packed.append(struct.pack("!L", self.experimenter))
6497 packed.append(struct.pack("!L", self.subtype))
6498 packed.append(struct.pack("!L", self.status))
6499 packed.append(util.pack_port_no(self.port_no))
6500 packed.append(struct.pack("!B", self.slot_num))
6501 length = sum([len(x) for x in packed])
6502 packed[2] = struct.pack("!H", length)
6503 return ''.join(packed)
6504
6505 @staticmethod
6506 def unpack(reader):
6507 obj = bsn_pdu_rx_reply()
6508 _version = reader.read("!B")[0]
6509 assert(_version == 4)
6510 _type = reader.read("!B")[0]
6511 assert(_type == 4)
6512 _length = reader.read("!H")[0]
6513 orig_reader = reader
6514 reader = orig_reader.slice(_length, 4)
6515 obj.xid = reader.read("!L")[0]
6516 _experimenter = reader.read("!L")[0]
6517 assert(_experimenter == 6035143)
6518 _subtype = reader.read("!L")[0]
6519 assert(_subtype == 34)
6520 obj.status = reader.read("!L")[0]
6521 obj.port_no = util.unpack_port_no(reader)
6522 obj.slot_num = reader.read("!B")[0]
6523 return obj
6524
6525 def __eq__(self, other):
6526 if type(self) != type(other): return False
6527 if self.xid != other.xid: return False
6528 if self.status != other.status: return False
6529 if self.port_no != other.port_no: return False
6530 if self.slot_num != other.slot_num: return False
6531 return True
6532
6533 def pretty_print(self, q):
6534 q.text("bsn_pdu_rx_reply {")
6535 with q.group():
6536 with q.indent(2):
6537 q.breakable()
6538 q.text("xid = ");
6539 if self.xid != None:
6540 q.text("%#x" % self.xid)
6541 else:
6542 q.text('None')
6543 q.text(","); q.breakable()
6544 q.text("status = ");
6545 q.text("%#x" % self.status)
6546 q.text(","); q.breakable()
6547 q.text("port_no = ");
6548 q.text(util.pretty_port(self.port_no))
6549 q.text(","); q.breakable()
6550 q.text("slot_num = ");
6551 q.text("%#x" % self.slot_num)
6552 q.breakable()
6553 q.text('}')
6554
6555bsn_header.subtypes[34] = bsn_pdu_rx_reply
6556
6557class bsn_pdu_rx_request(bsn_header):
6558 version = 4
6559 type = 4
6560 experimenter = 6035143
6561 subtype = 33
6562
6563 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6564 if xid != None:
6565 self.xid = xid
6566 else:
6567 self.xid = None
6568 if timeout_ms != None:
6569 self.timeout_ms = timeout_ms
6570 else:
6571 self.timeout_ms = 0
6572 if port_no != None:
6573 self.port_no = port_no
6574 else:
6575 self.port_no = 0
6576 if slot_num != None:
6577 self.slot_num = slot_num
6578 else:
6579 self.slot_num = 0
6580 if data != None:
6581 self.data = data
6582 else:
6583 self.data = ''
6584 return
6585
6586 def pack(self):
6587 packed = []
6588 packed.append(struct.pack("!B", self.version))
6589 packed.append(struct.pack("!B", self.type))
6590 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6591 packed.append(struct.pack("!L", self.xid))
6592 packed.append(struct.pack("!L", self.experimenter))
6593 packed.append(struct.pack("!L", self.subtype))
6594 packed.append(struct.pack("!L", self.timeout_ms))
6595 packed.append(util.pack_port_no(self.port_no))
6596 packed.append(struct.pack("!B", self.slot_num))
6597 packed.append('\x00' * 3)
6598 packed.append(self.data)
6599 length = sum([len(x) for x in packed])
6600 packed[2] = struct.pack("!H", length)
6601 return ''.join(packed)
6602
6603 @staticmethod
6604 def unpack(reader):
6605 obj = bsn_pdu_rx_request()
6606 _version = reader.read("!B")[0]
6607 assert(_version == 4)
6608 _type = reader.read("!B")[0]
6609 assert(_type == 4)
6610 _length = reader.read("!H")[0]
6611 orig_reader = reader
6612 reader = orig_reader.slice(_length, 4)
6613 obj.xid = reader.read("!L")[0]
6614 _experimenter = reader.read("!L")[0]
6615 assert(_experimenter == 6035143)
6616 _subtype = reader.read("!L")[0]
6617 assert(_subtype == 33)
6618 obj.timeout_ms = reader.read("!L")[0]
6619 obj.port_no = util.unpack_port_no(reader)
6620 obj.slot_num = reader.read("!B")[0]
6621 reader.skip(3)
6622 obj.data = str(reader.read_all())
6623 return obj
6624
6625 def __eq__(self, other):
6626 if type(self) != type(other): return False
6627 if self.xid != other.xid: return False
6628 if self.timeout_ms != other.timeout_ms: return False
6629 if self.port_no != other.port_no: return False
6630 if self.slot_num != other.slot_num: return False
6631 if self.data != other.data: return False
6632 return True
6633
6634 def pretty_print(self, q):
6635 q.text("bsn_pdu_rx_request {")
6636 with q.group():
6637 with q.indent(2):
6638 q.breakable()
6639 q.text("xid = ");
6640 if self.xid != None:
6641 q.text("%#x" % self.xid)
6642 else:
6643 q.text('None')
6644 q.text(","); q.breakable()
6645 q.text("timeout_ms = ");
6646 q.text("%#x" % self.timeout_ms)
6647 q.text(","); q.breakable()
6648 q.text("port_no = ");
6649 q.text(util.pretty_port(self.port_no))
6650 q.text(","); q.breakable()
6651 q.text("slot_num = ");
6652 q.text("%#x" % self.slot_num)
6653 q.text(","); q.breakable()
6654 q.text("data = ");
6655 q.pp(self.data)
6656 q.breakable()
6657 q.text('}')
6658
6659bsn_header.subtypes[33] = bsn_pdu_rx_request
6660
6661class bsn_pdu_rx_timeout(bsn_header):
6662 version = 4
6663 type = 4
6664 experimenter = 6035143
6665 subtype = 35
6666
6667 def __init__(self, xid=None, port_no=None, slot_num=None):
6668 if xid != None:
6669 self.xid = xid
6670 else:
6671 self.xid = None
6672 if port_no != None:
6673 self.port_no = port_no
6674 else:
6675 self.port_no = 0
6676 if slot_num != None:
6677 self.slot_num = slot_num
6678 else:
6679 self.slot_num = 0
6680 return
6681
6682 def pack(self):
6683 packed = []
6684 packed.append(struct.pack("!B", self.version))
6685 packed.append(struct.pack("!B", self.type))
6686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6687 packed.append(struct.pack("!L", self.xid))
6688 packed.append(struct.pack("!L", self.experimenter))
6689 packed.append(struct.pack("!L", self.subtype))
6690 packed.append(util.pack_port_no(self.port_no))
6691 packed.append(struct.pack("!B", self.slot_num))
6692 length = sum([len(x) for x in packed])
6693 packed[2] = struct.pack("!H", length)
6694 return ''.join(packed)
6695
6696 @staticmethod
6697 def unpack(reader):
6698 obj = bsn_pdu_rx_timeout()
6699 _version = reader.read("!B")[0]
6700 assert(_version == 4)
6701 _type = reader.read("!B")[0]
6702 assert(_type == 4)
6703 _length = reader.read("!H")[0]
6704 orig_reader = reader
6705 reader = orig_reader.slice(_length, 4)
6706 obj.xid = reader.read("!L")[0]
6707 _experimenter = reader.read("!L")[0]
6708 assert(_experimenter == 6035143)
6709 _subtype = reader.read("!L")[0]
6710 assert(_subtype == 35)
6711 obj.port_no = util.unpack_port_no(reader)
6712 obj.slot_num = reader.read("!B")[0]
6713 return obj
6714
6715 def __eq__(self, other):
6716 if type(self) != type(other): return False
6717 if self.xid != other.xid: return False
6718 if self.port_no != other.port_no: return False
6719 if self.slot_num != other.slot_num: return False
6720 return True
6721
6722 def pretty_print(self, q):
6723 q.text("bsn_pdu_rx_timeout {")
6724 with q.group():
6725 with q.indent(2):
6726 q.breakable()
6727 q.text("xid = ");
6728 if self.xid != None:
6729 q.text("%#x" % self.xid)
6730 else:
6731 q.text('None')
6732 q.text(","); q.breakable()
6733 q.text("port_no = ");
6734 q.text(util.pretty_port(self.port_no))
6735 q.text(","); q.breakable()
6736 q.text("slot_num = ");
6737 q.text("%#x" % self.slot_num)
6738 q.breakable()
6739 q.text('}')
6740
6741bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6742
6743class bsn_pdu_tx_reply(bsn_header):
6744 version = 4
6745 type = 4
6746 experimenter = 6035143
6747 subtype = 32
6748
6749 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6750 if xid != None:
6751 self.xid = xid
6752 else:
6753 self.xid = None
6754 if status != None:
6755 self.status = status
6756 else:
6757 self.status = 0
6758 if port_no != None:
6759 self.port_no = port_no
6760 else:
6761 self.port_no = 0
6762 if slot_num != None:
6763 self.slot_num = slot_num
6764 else:
6765 self.slot_num = 0
6766 return
6767
6768 def pack(self):
6769 packed = []
6770 packed.append(struct.pack("!B", self.version))
6771 packed.append(struct.pack("!B", self.type))
6772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6773 packed.append(struct.pack("!L", self.xid))
6774 packed.append(struct.pack("!L", self.experimenter))
6775 packed.append(struct.pack("!L", self.subtype))
6776 packed.append(struct.pack("!L", self.status))
6777 packed.append(util.pack_port_no(self.port_no))
6778 packed.append(struct.pack("!B", self.slot_num))
6779 length = sum([len(x) for x in packed])
6780 packed[2] = struct.pack("!H", length)
6781 return ''.join(packed)
6782
6783 @staticmethod
6784 def unpack(reader):
6785 obj = bsn_pdu_tx_reply()
6786 _version = reader.read("!B")[0]
6787 assert(_version == 4)
6788 _type = reader.read("!B")[0]
6789 assert(_type == 4)
6790 _length = reader.read("!H")[0]
6791 orig_reader = reader
6792 reader = orig_reader.slice(_length, 4)
6793 obj.xid = reader.read("!L")[0]
6794 _experimenter = reader.read("!L")[0]
6795 assert(_experimenter == 6035143)
6796 _subtype = reader.read("!L")[0]
6797 assert(_subtype == 32)
6798 obj.status = reader.read("!L")[0]
6799 obj.port_no = util.unpack_port_no(reader)
6800 obj.slot_num = reader.read("!B")[0]
6801 return obj
6802
6803 def __eq__(self, other):
6804 if type(self) != type(other): return False
6805 if self.xid != other.xid: return False
6806 if self.status != other.status: return False
6807 if self.port_no != other.port_no: return False
6808 if self.slot_num != other.slot_num: return False
6809 return True
6810
6811 def pretty_print(self, q):
6812 q.text("bsn_pdu_tx_reply {")
6813 with q.group():
6814 with q.indent(2):
6815 q.breakable()
6816 q.text("xid = ");
6817 if self.xid != None:
6818 q.text("%#x" % self.xid)
6819 else:
6820 q.text('None')
6821 q.text(","); q.breakable()
6822 q.text("status = ");
6823 q.text("%#x" % self.status)
6824 q.text(","); q.breakable()
6825 q.text("port_no = ");
6826 q.text(util.pretty_port(self.port_no))
6827 q.text(","); q.breakable()
6828 q.text("slot_num = ");
6829 q.text("%#x" % self.slot_num)
6830 q.breakable()
6831 q.text('}')
6832
6833bsn_header.subtypes[32] = bsn_pdu_tx_reply
6834
6835class bsn_pdu_tx_request(bsn_header):
6836 version = 4
6837 type = 4
6838 experimenter = 6035143
6839 subtype = 31
6840
6841 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
6842 if xid != None:
6843 self.xid = xid
6844 else:
6845 self.xid = None
6846 if tx_interval_ms != None:
6847 self.tx_interval_ms = tx_interval_ms
6848 else:
6849 self.tx_interval_ms = 0
6850 if port_no != None:
6851 self.port_no = port_no
6852 else:
6853 self.port_no = 0
6854 if slot_num != None:
6855 self.slot_num = slot_num
6856 else:
6857 self.slot_num = 0
6858 if data != None:
6859 self.data = data
6860 else:
6861 self.data = ''
6862 return
6863
6864 def pack(self):
6865 packed = []
6866 packed.append(struct.pack("!B", self.version))
6867 packed.append(struct.pack("!B", self.type))
6868 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6869 packed.append(struct.pack("!L", self.xid))
6870 packed.append(struct.pack("!L", self.experimenter))
6871 packed.append(struct.pack("!L", self.subtype))
6872 packed.append(struct.pack("!L", self.tx_interval_ms))
6873 packed.append(util.pack_port_no(self.port_no))
6874 packed.append(struct.pack("!B", self.slot_num))
6875 packed.append('\x00' * 3)
6876 packed.append(self.data)
6877 length = sum([len(x) for x in packed])
6878 packed[2] = struct.pack("!H", length)
6879 return ''.join(packed)
6880
6881 @staticmethod
6882 def unpack(reader):
6883 obj = bsn_pdu_tx_request()
6884 _version = reader.read("!B")[0]
6885 assert(_version == 4)
6886 _type = reader.read("!B")[0]
6887 assert(_type == 4)
6888 _length = reader.read("!H")[0]
6889 orig_reader = reader
6890 reader = orig_reader.slice(_length, 4)
6891 obj.xid = reader.read("!L")[0]
6892 _experimenter = reader.read("!L")[0]
6893 assert(_experimenter == 6035143)
6894 _subtype = reader.read("!L")[0]
6895 assert(_subtype == 31)
6896 obj.tx_interval_ms = reader.read("!L")[0]
6897 obj.port_no = util.unpack_port_no(reader)
6898 obj.slot_num = reader.read("!B")[0]
6899 reader.skip(3)
6900 obj.data = str(reader.read_all())
6901 return obj
6902
6903 def __eq__(self, other):
6904 if type(self) != type(other): return False
6905 if self.xid != other.xid: return False
6906 if self.tx_interval_ms != other.tx_interval_ms: return False
6907 if self.port_no != other.port_no: return False
6908 if self.slot_num != other.slot_num: return False
6909 if self.data != other.data: return False
6910 return True
6911
6912 def pretty_print(self, q):
6913 q.text("bsn_pdu_tx_request {")
6914 with q.group():
6915 with q.indent(2):
6916 q.breakable()
6917 q.text("xid = ");
6918 if self.xid != None:
6919 q.text("%#x" % self.xid)
6920 else:
6921 q.text('None')
6922 q.text(","); q.breakable()
6923 q.text("tx_interval_ms = ");
6924 q.text("%#x" % self.tx_interval_ms)
6925 q.text(","); q.breakable()
6926 q.text("port_no = ");
6927 q.text(util.pretty_port(self.port_no))
6928 q.text(","); q.breakable()
6929 q.text("slot_num = ");
6930 q.text("%#x" % self.slot_num)
6931 q.text(","); q.breakable()
6932 q.text("data = ");
6933 q.pp(self.data)
6934 q.breakable()
6935 q.text('}')
6936
6937bsn_header.subtypes[31] = bsn_pdu_tx_request
6938
6939class bsn_port_counter_stats_reply(bsn_stats_reply):
6940 version = 4
6941 type = 19
6942 stats_type = 65535
6943 experimenter = 6035143
6944 subtype = 8
6945
6946 def __init__(self, xid=None, flags=None, entries=None):
6947 if xid != None:
6948 self.xid = xid
6949 else:
6950 self.xid = None
6951 if flags != None:
6952 self.flags = flags
6953 else:
6954 self.flags = 0
6955 if entries != None:
6956 self.entries = entries
6957 else:
6958 self.entries = []
6959 return
6960
6961 def pack(self):
6962 packed = []
6963 packed.append(struct.pack("!B", self.version))
6964 packed.append(struct.pack("!B", self.type))
6965 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6966 packed.append(struct.pack("!L", self.xid))
6967 packed.append(struct.pack("!H", self.stats_type))
6968 packed.append(struct.pack("!H", self.flags))
6969 packed.append('\x00' * 4)
6970 packed.append(struct.pack("!L", self.experimenter))
6971 packed.append(struct.pack("!L", self.subtype))
6972 packed.append(loxi.generic_util.pack_list(self.entries))
6973 length = sum([len(x) for x in packed])
6974 packed[2] = struct.pack("!H", length)
6975 return ''.join(packed)
6976
6977 @staticmethod
6978 def unpack(reader):
6979 obj = bsn_port_counter_stats_reply()
6980 _version = reader.read("!B")[0]
6981 assert(_version == 4)
6982 _type = reader.read("!B")[0]
6983 assert(_type == 19)
6984 _length = reader.read("!H")[0]
6985 orig_reader = reader
6986 reader = orig_reader.slice(_length, 4)
6987 obj.xid = reader.read("!L")[0]
6988 _stats_type = reader.read("!H")[0]
6989 assert(_stats_type == 65535)
6990 obj.flags = reader.read("!H")[0]
6991 reader.skip(4)
6992 _experimenter = reader.read("!L")[0]
6993 assert(_experimenter == 6035143)
6994 _subtype = reader.read("!L")[0]
6995 assert(_subtype == 8)
6996 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
6997 return obj
6998
6999 def __eq__(self, other):
7000 if type(self) != type(other): return False
7001 if self.xid != other.xid: return False
7002 if self.flags != other.flags: return False
7003 if self.entries != other.entries: return False
7004 return True
7005
7006 def pretty_print(self, q):
7007 q.text("bsn_port_counter_stats_reply {")
7008 with q.group():
7009 with q.indent(2):
7010 q.breakable()
7011 q.text("xid = ");
7012 if self.xid != None:
7013 q.text("%#x" % self.xid)
7014 else:
7015 q.text('None')
7016 q.text(","); q.breakable()
7017 q.text("flags = ");
7018 q.text("%#x" % self.flags)
7019 q.text(","); q.breakable()
7020 q.text("entries = ");
7021 q.pp(self.entries)
7022 q.breakable()
7023 q.text('}')
7024
7025bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
7026
7027class bsn_port_counter_stats_request(bsn_stats_request):
7028 version = 4
7029 type = 18
7030 stats_type = 65535
7031 experimenter = 6035143
7032 subtype = 8
7033
7034 def __init__(self, xid=None, flags=None, port_no=None):
7035 if xid != None:
7036 self.xid = xid
7037 else:
7038 self.xid = None
7039 if flags != None:
7040 self.flags = flags
7041 else:
7042 self.flags = 0
7043 if port_no != None:
7044 self.port_no = port_no
7045 else:
7046 self.port_no = 0
7047 return
7048
7049 def pack(self):
7050 packed = []
7051 packed.append(struct.pack("!B", self.version))
7052 packed.append(struct.pack("!B", self.type))
7053 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7054 packed.append(struct.pack("!L", self.xid))
7055 packed.append(struct.pack("!H", self.stats_type))
7056 packed.append(struct.pack("!H", self.flags))
7057 packed.append('\x00' * 4)
7058 packed.append(struct.pack("!L", self.experimenter))
7059 packed.append(struct.pack("!L", self.subtype))
7060 packed.append(util.pack_port_no(self.port_no))
7061 length = sum([len(x) for x in packed])
7062 packed[2] = struct.pack("!H", length)
7063 return ''.join(packed)
7064
7065 @staticmethod
7066 def unpack(reader):
7067 obj = bsn_port_counter_stats_request()
7068 _version = reader.read("!B")[0]
7069 assert(_version == 4)
7070 _type = reader.read("!B")[0]
7071 assert(_type == 18)
7072 _length = reader.read("!H")[0]
7073 orig_reader = reader
7074 reader = orig_reader.slice(_length, 4)
7075 obj.xid = reader.read("!L")[0]
7076 _stats_type = reader.read("!H")[0]
7077 assert(_stats_type == 65535)
7078 obj.flags = reader.read("!H")[0]
7079 reader.skip(4)
7080 _experimenter = reader.read("!L")[0]
7081 assert(_experimenter == 6035143)
7082 _subtype = reader.read("!L")[0]
7083 assert(_subtype == 8)
7084 obj.port_no = util.unpack_port_no(reader)
7085 return obj
7086
7087 def __eq__(self, other):
7088 if type(self) != type(other): return False
7089 if self.xid != other.xid: return False
7090 if self.flags != other.flags: return False
7091 if self.port_no != other.port_no: return False
7092 return True
7093
7094 def pretty_print(self, q):
7095 q.text("bsn_port_counter_stats_request {")
7096 with q.group():
7097 with q.indent(2):
7098 q.breakable()
7099 q.text("xid = ");
7100 if self.xid != None:
7101 q.text("%#x" % self.xid)
7102 else:
7103 q.text('None')
7104 q.text(","); q.breakable()
7105 q.text("flags = ");
7106 q.text("%#x" % self.flags)
7107 q.text(","); q.breakable()
7108 q.text("port_no = ");
7109 q.text(util.pretty_port(self.port_no))
7110 q.breakable()
7111 q.text('}')
7112
7113bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
7114
7115class bsn_role_status(bsn_header):
7116 version = 4
7117 type = 4
7118 experimenter = 6035143
7119 subtype = 55
7120
7121 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
7122 if xid != None:
7123 self.xid = xid
7124 else:
7125 self.xid = None
7126 if role != None:
7127 self.role = role
7128 else:
7129 self.role = 0
7130 if reason != None:
7131 self.reason = reason
7132 else:
7133 self.reason = 0
7134 if generation_id != None:
7135 self.generation_id = generation_id
7136 else:
7137 self.generation_id = 0
7138 return
7139
7140 def pack(self):
7141 packed = []
7142 packed.append(struct.pack("!B", self.version))
7143 packed.append(struct.pack("!B", self.type))
7144 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7145 packed.append(struct.pack("!L", self.xid))
7146 packed.append(struct.pack("!L", self.experimenter))
7147 packed.append(struct.pack("!L", self.subtype))
7148 packed.append(struct.pack("!L", self.role))
7149 packed.append(struct.pack("!B", self.reason))
7150 packed.append('\x00' * 3)
7151 packed.append(struct.pack("!Q", self.generation_id))
7152 length = sum([len(x) for x in packed])
7153 packed[2] = struct.pack("!H", length)
7154 return ''.join(packed)
7155
7156 @staticmethod
7157 def unpack(reader):
7158 obj = bsn_role_status()
7159 _version = reader.read("!B")[0]
7160 assert(_version == 4)
7161 _type = reader.read("!B")[0]
7162 assert(_type == 4)
7163 _length = reader.read("!H")[0]
7164 orig_reader = reader
7165 reader = orig_reader.slice(_length, 4)
7166 obj.xid = reader.read("!L")[0]
7167 _experimenter = reader.read("!L")[0]
7168 assert(_experimenter == 6035143)
7169 _subtype = reader.read("!L")[0]
7170 assert(_subtype == 55)
7171 obj.role = reader.read("!L")[0]
7172 obj.reason = reader.read("!B")[0]
7173 reader.skip(3)
7174 obj.generation_id = reader.read("!Q")[0]
7175 return obj
7176
7177 def __eq__(self, other):
7178 if type(self) != type(other): return False
7179 if self.xid != other.xid: return False
7180 if self.role != other.role: return False
7181 if self.reason != other.reason: return False
7182 if self.generation_id != other.generation_id: return False
7183 return True
7184
7185 def pretty_print(self, q):
7186 q.text("bsn_role_status {")
7187 with q.group():
7188 with q.indent(2):
7189 q.breakable()
7190 q.text("xid = ");
7191 if self.xid != None:
7192 q.text("%#x" % self.xid)
7193 else:
7194 q.text('None')
7195 q.text(","); q.breakable()
7196 q.text("role = ");
7197 q.text("%#x" % self.role)
7198 q.text(","); q.breakable()
7199 q.text("reason = ");
7200 q.text("%#x" % self.reason)
7201 q.text(","); q.breakable()
7202 q.text("generation_id = ");
7203 q.text("%#x" % self.generation_id)
7204 q.breakable()
7205 q.text('}')
7206
7207bsn_header.subtypes[55] = bsn_role_status
7208
7209class bsn_set_aux_cxns_reply(bsn_header):
7210 version = 4
7211 type = 4
7212 experimenter = 6035143
7213 subtype = 59
7214
7215 def __init__(self, xid=None, num_aux=None, status=None):
7216 if xid != None:
7217 self.xid = xid
7218 else:
7219 self.xid = None
7220 if num_aux != None:
7221 self.num_aux = num_aux
7222 else:
7223 self.num_aux = 0
7224 if status != None:
7225 self.status = status
7226 else:
7227 self.status = 0
7228 return
7229
7230 def pack(self):
7231 packed = []
7232 packed.append(struct.pack("!B", self.version))
7233 packed.append(struct.pack("!B", self.type))
7234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7235 packed.append(struct.pack("!L", self.xid))
7236 packed.append(struct.pack("!L", self.experimenter))
7237 packed.append(struct.pack("!L", self.subtype))
7238 packed.append(struct.pack("!L", self.num_aux))
7239 packed.append(struct.pack("!L", self.status))
7240 length = sum([len(x) for x in packed])
7241 packed[2] = struct.pack("!H", length)
7242 return ''.join(packed)
7243
7244 @staticmethod
7245 def unpack(reader):
7246 obj = bsn_set_aux_cxns_reply()
7247 _version = reader.read("!B")[0]
7248 assert(_version == 4)
7249 _type = reader.read("!B")[0]
7250 assert(_type == 4)
7251 _length = reader.read("!H")[0]
7252 orig_reader = reader
7253 reader = orig_reader.slice(_length, 4)
7254 obj.xid = reader.read("!L")[0]
7255 _experimenter = reader.read("!L")[0]
7256 assert(_experimenter == 6035143)
7257 _subtype = reader.read("!L")[0]
7258 assert(_subtype == 59)
7259 obj.num_aux = reader.read("!L")[0]
7260 obj.status = reader.read("!L")[0]
7261 return obj
7262
7263 def __eq__(self, other):
7264 if type(self) != type(other): return False
7265 if self.xid != other.xid: return False
7266 if self.num_aux != other.num_aux: return False
7267 if self.status != other.status: return False
7268 return True
7269
7270 def pretty_print(self, q):
7271 q.text("bsn_set_aux_cxns_reply {")
7272 with q.group():
7273 with q.indent(2):
7274 q.breakable()
7275 q.text("xid = ");
7276 if self.xid != None:
7277 q.text("%#x" % self.xid)
7278 else:
7279 q.text('None')
7280 q.text(","); q.breakable()
7281 q.text("num_aux = ");
7282 q.text("%#x" % self.num_aux)
7283 q.text(","); q.breakable()
7284 q.text("status = ");
7285 q.text("%#x" % self.status)
7286 q.breakable()
7287 q.text('}')
7288
7289bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7290
7291class bsn_set_aux_cxns_request(bsn_header):
7292 version = 4
7293 type = 4
7294 experimenter = 6035143
7295 subtype = 58
7296
7297 def __init__(self, xid=None, num_aux=None):
7298 if xid != None:
7299 self.xid = xid
7300 else:
7301 self.xid = None
7302 if num_aux != None:
7303 self.num_aux = num_aux
7304 else:
7305 self.num_aux = 0
7306 return
7307
7308 def pack(self):
7309 packed = []
7310 packed.append(struct.pack("!B", self.version))
7311 packed.append(struct.pack("!B", self.type))
7312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7313 packed.append(struct.pack("!L", self.xid))
7314 packed.append(struct.pack("!L", self.experimenter))
7315 packed.append(struct.pack("!L", self.subtype))
7316 packed.append(struct.pack("!L", self.num_aux))
7317 length = sum([len(x) for x in packed])
7318 packed[2] = struct.pack("!H", length)
7319 return ''.join(packed)
7320
7321 @staticmethod
7322 def unpack(reader):
7323 obj = bsn_set_aux_cxns_request()
7324 _version = reader.read("!B")[0]
7325 assert(_version == 4)
7326 _type = reader.read("!B")[0]
7327 assert(_type == 4)
7328 _length = reader.read("!H")[0]
7329 orig_reader = reader
7330 reader = orig_reader.slice(_length, 4)
7331 obj.xid = reader.read("!L")[0]
7332 _experimenter = reader.read("!L")[0]
7333 assert(_experimenter == 6035143)
7334 _subtype = reader.read("!L")[0]
7335 assert(_subtype == 58)
7336 obj.num_aux = reader.read("!L")[0]
7337 return obj
7338
7339 def __eq__(self, other):
7340 if type(self) != type(other): return False
7341 if self.xid != other.xid: return False
7342 if self.num_aux != other.num_aux: return False
7343 return True
7344
7345 def pretty_print(self, q):
7346 q.text("bsn_set_aux_cxns_request {")
7347 with q.group():
7348 with q.indent(2):
7349 q.breakable()
7350 q.text("xid = ");
7351 if self.xid != None:
7352 q.text("%#x" % self.xid)
7353 else:
7354 q.text('None')
7355 q.text(","); q.breakable()
7356 q.text("num_aux = ");
7357 q.text("%#x" % self.num_aux)
7358 q.breakable()
7359 q.text('}')
7360
7361bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7362
7363class bsn_set_lacp_reply(bsn_header):
7364 version = 4
7365 type = 4
7366 experimenter = 6035143
7367 subtype = 42
7368
7369 def __init__(self, xid=None, status=None, port_no=None):
7370 if xid != None:
7371 self.xid = xid
7372 else:
7373 self.xid = None
7374 if status != None:
7375 self.status = status
7376 else:
7377 self.status = 0
7378 if port_no != None:
7379 self.port_no = port_no
7380 else:
7381 self.port_no = 0
7382 return
7383
7384 def pack(self):
7385 packed = []
7386 packed.append(struct.pack("!B", self.version))
7387 packed.append(struct.pack("!B", self.type))
7388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7389 packed.append(struct.pack("!L", self.xid))
7390 packed.append(struct.pack("!L", self.experimenter))
7391 packed.append(struct.pack("!L", self.subtype))
7392 packed.append(struct.pack("!L", self.status))
7393 packed.append(util.pack_port_no(self.port_no))
7394 length = sum([len(x) for x in packed])
7395 packed[2] = struct.pack("!H", length)
7396 return ''.join(packed)
7397
7398 @staticmethod
7399 def unpack(reader):
7400 obj = bsn_set_lacp_reply()
7401 _version = reader.read("!B")[0]
7402 assert(_version == 4)
7403 _type = reader.read("!B")[0]
7404 assert(_type == 4)
7405 _length = reader.read("!H")[0]
7406 orig_reader = reader
7407 reader = orig_reader.slice(_length, 4)
7408 obj.xid = reader.read("!L")[0]
7409 _experimenter = reader.read("!L")[0]
7410 assert(_experimenter == 6035143)
7411 _subtype = reader.read("!L")[0]
7412 assert(_subtype == 42)
7413 obj.status = reader.read("!L")[0]
7414 obj.port_no = util.unpack_port_no(reader)
7415 return obj
7416
7417 def __eq__(self, other):
7418 if type(self) != type(other): return False
7419 if self.xid != other.xid: return False
7420 if self.status != other.status: return False
7421 if self.port_no != other.port_no: return False
7422 return True
7423
7424 def pretty_print(self, q):
7425 q.text("bsn_set_lacp_reply {")
7426 with q.group():
7427 with q.indent(2):
7428 q.breakable()
7429 q.text("xid = ");
7430 if self.xid != None:
7431 q.text("%#x" % self.xid)
7432 else:
7433 q.text('None')
7434 q.text(","); q.breakable()
7435 q.text("status = ");
7436 q.text("%#x" % self.status)
7437 q.text(","); q.breakable()
7438 q.text("port_no = ");
7439 q.text(util.pretty_port(self.port_no))
7440 q.breakable()
7441 q.text('}')
7442
7443bsn_header.subtypes[42] = bsn_set_lacp_reply
7444
7445class bsn_set_lacp_request(bsn_header):
7446 version = 4
7447 type = 4
7448 experimenter = 6035143
7449 subtype = 41
7450
7451 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):
7452 if xid != None:
7453 self.xid = xid
7454 else:
7455 self.xid = None
7456 if enabled != None:
7457 self.enabled = enabled
7458 else:
7459 self.enabled = 0
7460 if port_no != None:
7461 self.port_no = port_no
7462 else:
7463 self.port_no = 0
7464 if actor_sys_priority != None:
7465 self.actor_sys_priority = actor_sys_priority
7466 else:
7467 self.actor_sys_priority = 0
7468 if actor_sys_mac != None:
7469 self.actor_sys_mac = actor_sys_mac
7470 else:
7471 self.actor_sys_mac = [0,0,0,0,0,0]
7472 if actor_port_priority != None:
7473 self.actor_port_priority = actor_port_priority
7474 else:
7475 self.actor_port_priority = 0
7476 if actor_port_num != None:
7477 self.actor_port_num = actor_port_num
7478 else:
7479 self.actor_port_num = 0
7480 if actor_key != None:
7481 self.actor_key = actor_key
7482 else:
7483 self.actor_key = 0
7484 return
7485
7486 def pack(self):
7487 packed = []
7488 packed.append(struct.pack("!B", self.version))
7489 packed.append(struct.pack("!B", self.type))
7490 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7491 packed.append(struct.pack("!L", self.xid))
7492 packed.append(struct.pack("!L", self.experimenter))
7493 packed.append(struct.pack("!L", self.subtype))
7494 packed.append(struct.pack("!B", self.enabled))
7495 packed.append('\x00' * 3)
7496 packed.append(util.pack_port_no(self.port_no))
7497 packed.append(struct.pack("!H", self.actor_sys_priority))
7498 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7499 packed.append(struct.pack("!H", self.actor_port_priority))
7500 packed.append(struct.pack("!H", self.actor_port_num))
7501 packed.append(struct.pack("!H", self.actor_key))
7502 length = sum([len(x) for x in packed])
7503 packed[2] = struct.pack("!H", length)
7504 return ''.join(packed)
7505
7506 @staticmethod
7507 def unpack(reader):
7508 obj = bsn_set_lacp_request()
7509 _version = reader.read("!B")[0]
7510 assert(_version == 4)
7511 _type = reader.read("!B")[0]
7512 assert(_type == 4)
7513 _length = reader.read("!H")[0]
7514 orig_reader = reader
7515 reader = orig_reader.slice(_length, 4)
7516 obj.xid = reader.read("!L")[0]
7517 _experimenter = reader.read("!L")[0]
7518 assert(_experimenter == 6035143)
7519 _subtype = reader.read("!L")[0]
7520 assert(_subtype == 41)
7521 obj.enabled = reader.read("!B")[0]
7522 reader.skip(3)
7523 obj.port_no = util.unpack_port_no(reader)
7524 obj.actor_sys_priority = reader.read("!H")[0]
7525 obj.actor_sys_mac = list(reader.read('!6B'))
7526 obj.actor_port_priority = reader.read("!H")[0]
7527 obj.actor_port_num = reader.read("!H")[0]
7528 obj.actor_key = reader.read("!H")[0]
7529 return obj
7530
7531 def __eq__(self, other):
7532 if type(self) != type(other): return False
7533 if self.xid != other.xid: return False
7534 if self.enabled != other.enabled: return False
7535 if self.port_no != other.port_no: return False
7536 if self.actor_sys_priority != other.actor_sys_priority: return False
7537 if self.actor_sys_mac != other.actor_sys_mac: return False
7538 if self.actor_port_priority != other.actor_port_priority: return False
7539 if self.actor_port_num != other.actor_port_num: return False
7540 if self.actor_key != other.actor_key: return False
7541 return True
7542
7543 def pretty_print(self, q):
7544 q.text("bsn_set_lacp_request {")
7545 with q.group():
7546 with q.indent(2):
7547 q.breakable()
7548 q.text("xid = ");
7549 if self.xid != None:
7550 q.text("%#x" % self.xid)
7551 else:
7552 q.text('None')
7553 q.text(","); q.breakable()
7554 q.text("enabled = ");
7555 q.text("%#x" % self.enabled)
7556 q.text(","); q.breakable()
7557 q.text("port_no = ");
7558 q.text(util.pretty_port(self.port_no))
7559 q.text(","); q.breakable()
7560 q.text("actor_sys_priority = ");
7561 q.text("%#x" % self.actor_sys_priority)
7562 q.text(","); q.breakable()
7563 q.text("actor_sys_mac = ");
7564 q.text(util.pretty_mac(self.actor_sys_mac))
7565 q.text(","); q.breakable()
7566 q.text("actor_port_priority = ");
7567 q.text("%#x" % self.actor_port_priority)
7568 q.text(","); q.breakable()
7569 q.text("actor_port_num = ");
7570 q.text("%#x" % self.actor_port_num)
7571 q.text(","); q.breakable()
7572 q.text("actor_key = ");
7573 q.text("%#x" % self.actor_key)
7574 q.breakable()
7575 q.text('}')
7576
7577bsn_header.subtypes[41] = bsn_set_lacp_request
7578
7579class bsn_set_mirroring(bsn_header):
7580 version = 4
7581 type = 4
7582 experimenter = 6035143
7583 subtype = 3
7584
7585 def __init__(self, xid=None, report_mirror_ports=None):
7586 if xid != None:
7587 self.xid = xid
7588 else:
7589 self.xid = None
7590 if report_mirror_ports != None:
7591 self.report_mirror_ports = report_mirror_ports
7592 else:
7593 self.report_mirror_ports = 0
7594 return
7595
7596 def pack(self):
7597 packed = []
7598 packed.append(struct.pack("!B", self.version))
7599 packed.append(struct.pack("!B", self.type))
7600 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7601 packed.append(struct.pack("!L", self.xid))
7602 packed.append(struct.pack("!L", self.experimenter))
7603 packed.append(struct.pack("!L", self.subtype))
7604 packed.append(struct.pack("!B", self.report_mirror_ports))
7605 packed.append('\x00' * 3)
7606 length = sum([len(x) for x in packed])
7607 packed[2] = struct.pack("!H", length)
7608 return ''.join(packed)
7609
7610 @staticmethod
7611 def unpack(reader):
7612 obj = bsn_set_mirroring()
7613 _version = reader.read("!B")[0]
7614 assert(_version == 4)
7615 _type = reader.read("!B")[0]
7616 assert(_type == 4)
7617 _length = reader.read("!H")[0]
7618 orig_reader = reader
7619 reader = orig_reader.slice(_length, 4)
7620 obj.xid = reader.read("!L")[0]
7621 _experimenter = reader.read("!L")[0]
7622 assert(_experimenter == 6035143)
7623 _subtype = reader.read("!L")[0]
7624 assert(_subtype == 3)
7625 obj.report_mirror_ports = reader.read("!B")[0]
7626 reader.skip(3)
7627 return obj
7628
7629 def __eq__(self, other):
7630 if type(self) != type(other): return False
7631 if self.xid != other.xid: return False
7632 if self.report_mirror_ports != other.report_mirror_ports: return False
7633 return True
7634
7635 def pretty_print(self, q):
7636 q.text("bsn_set_mirroring {")
7637 with q.group():
7638 with q.indent(2):
7639 q.breakable()
7640 q.text("xid = ");
7641 if self.xid != None:
7642 q.text("%#x" % self.xid)
7643 else:
7644 q.text('None')
7645 q.text(","); q.breakable()
7646 q.text("report_mirror_ports = ");
7647 q.text("%#x" % self.report_mirror_ports)
7648 q.breakable()
7649 q.text('}')
7650
7651bsn_header.subtypes[3] = bsn_set_mirroring
7652
7653class bsn_set_pktin_suppression_reply(bsn_header):
7654 version = 4
7655 type = 4
7656 experimenter = 6035143
7657 subtype = 25
7658
7659 def __init__(self, xid=None, status=None):
7660 if xid != None:
7661 self.xid = xid
7662 else:
7663 self.xid = None
7664 if status != None:
7665 self.status = status
7666 else:
7667 self.status = 0
7668 return
7669
7670 def pack(self):
7671 packed = []
7672 packed.append(struct.pack("!B", self.version))
7673 packed.append(struct.pack("!B", self.type))
7674 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7675 packed.append(struct.pack("!L", self.xid))
7676 packed.append(struct.pack("!L", self.experimenter))
7677 packed.append(struct.pack("!L", self.subtype))
7678 packed.append(struct.pack("!L", self.status))
7679 length = sum([len(x) for x in packed])
7680 packed[2] = struct.pack("!H", length)
7681 return ''.join(packed)
7682
7683 @staticmethod
7684 def unpack(reader):
7685 obj = bsn_set_pktin_suppression_reply()
7686 _version = reader.read("!B")[0]
7687 assert(_version == 4)
7688 _type = reader.read("!B")[0]
7689 assert(_type == 4)
7690 _length = reader.read("!H")[0]
7691 orig_reader = reader
7692 reader = orig_reader.slice(_length, 4)
7693 obj.xid = reader.read("!L")[0]
7694 _experimenter = reader.read("!L")[0]
7695 assert(_experimenter == 6035143)
7696 _subtype = reader.read("!L")[0]
7697 assert(_subtype == 25)
7698 obj.status = reader.read("!L")[0]
7699 return obj
7700
7701 def __eq__(self, other):
7702 if type(self) != type(other): return False
7703 if self.xid != other.xid: return False
7704 if self.status != other.status: return False
7705 return True
7706
7707 def pretty_print(self, q):
7708 q.text("bsn_set_pktin_suppression_reply {")
7709 with q.group():
7710 with q.indent(2):
7711 q.breakable()
7712 q.text("xid = ");
7713 if self.xid != None:
7714 q.text("%#x" % self.xid)
7715 else:
7716 q.text('None')
7717 q.text(","); q.breakable()
7718 q.text("status = ");
7719 q.text("%#x" % self.status)
7720 q.breakable()
7721 q.text('}')
7722
7723bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7724
7725class bsn_set_pktin_suppression_request(bsn_header):
7726 version = 4
7727 type = 4
7728 experimenter = 6035143
7729 subtype = 11
7730
7731 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7732 if xid != None:
7733 self.xid = xid
7734 else:
7735 self.xid = None
7736 if enabled != None:
7737 self.enabled = enabled
7738 else:
7739 self.enabled = 0
7740 if idle_timeout != None:
7741 self.idle_timeout = idle_timeout
7742 else:
7743 self.idle_timeout = 0
7744 if hard_timeout != None:
7745 self.hard_timeout = hard_timeout
7746 else:
7747 self.hard_timeout = 0
7748 if priority != None:
7749 self.priority = priority
7750 else:
7751 self.priority = 0
7752 if cookie != None:
7753 self.cookie = cookie
7754 else:
7755 self.cookie = 0
7756 return
7757
7758 def pack(self):
7759 packed = []
7760 packed.append(struct.pack("!B", self.version))
7761 packed.append(struct.pack("!B", self.type))
7762 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7763 packed.append(struct.pack("!L", self.xid))
7764 packed.append(struct.pack("!L", self.experimenter))
7765 packed.append(struct.pack("!L", self.subtype))
7766 packed.append(struct.pack("!B", self.enabled))
7767 packed.append('\x00' * 1)
7768 packed.append(struct.pack("!H", self.idle_timeout))
7769 packed.append(struct.pack("!H", self.hard_timeout))
7770 packed.append(struct.pack("!H", self.priority))
7771 packed.append(struct.pack("!Q", self.cookie))
7772 length = sum([len(x) for x in packed])
7773 packed[2] = struct.pack("!H", length)
7774 return ''.join(packed)
7775
7776 @staticmethod
7777 def unpack(reader):
7778 obj = bsn_set_pktin_suppression_request()
7779 _version = reader.read("!B")[0]
7780 assert(_version == 4)
7781 _type = reader.read("!B")[0]
7782 assert(_type == 4)
7783 _length = reader.read("!H")[0]
7784 orig_reader = reader
7785 reader = orig_reader.slice(_length, 4)
7786 obj.xid = reader.read("!L")[0]
7787 _experimenter = reader.read("!L")[0]
7788 assert(_experimenter == 6035143)
7789 _subtype = reader.read("!L")[0]
7790 assert(_subtype == 11)
7791 obj.enabled = reader.read("!B")[0]
7792 reader.skip(1)
7793 obj.idle_timeout = reader.read("!H")[0]
7794 obj.hard_timeout = reader.read("!H")[0]
7795 obj.priority = reader.read("!H")[0]
7796 obj.cookie = reader.read("!Q")[0]
7797 return obj
7798
7799 def __eq__(self, other):
7800 if type(self) != type(other): return False
7801 if self.xid != other.xid: return False
7802 if self.enabled != other.enabled: return False
7803 if self.idle_timeout != other.idle_timeout: return False
7804 if self.hard_timeout != other.hard_timeout: return False
7805 if self.priority != other.priority: return False
7806 if self.cookie != other.cookie: return False
7807 return True
7808
7809 def pretty_print(self, q):
7810 q.text("bsn_set_pktin_suppression_request {")
7811 with q.group():
7812 with q.indent(2):
7813 q.breakable()
7814 q.text("xid = ");
7815 if self.xid != None:
7816 q.text("%#x" % self.xid)
7817 else:
7818 q.text('None')
7819 q.text(","); q.breakable()
7820 q.text("enabled = ");
7821 q.text("%#x" % self.enabled)
7822 q.text(","); q.breakable()
7823 q.text("idle_timeout = ");
7824 q.text("%#x" % self.idle_timeout)
7825 q.text(","); q.breakable()
7826 q.text("hard_timeout = ");
7827 q.text("%#x" % self.hard_timeout)
7828 q.text(","); q.breakable()
7829 q.text("priority = ");
7830 q.text("%#x" % self.priority)
7831 q.text(","); q.breakable()
7832 q.text("cookie = ");
7833 q.text("%#x" % self.cookie)
7834 q.breakable()
7835 q.text('}')
7836
7837bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7838
7839class bsn_set_switch_pipeline_reply(bsn_header):
7840 version = 4
7841 type = 4
7842 experimenter = 6035143
7843 subtype = 54
7844
7845 def __init__(self, xid=None, status=None):
7846 if xid != None:
7847 self.xid = xid
7848 else:
7849 self.xid = None
7850 if status != None:
7851 self.status = status
7852 else:
7853 self.status = 0
7854 return
7855
7856 def pack(self):
7857 packed = []
7858 packed.append(struct.pack("!B", self.version))
7859 packed.append(struct.pack("!B", self.type))
7860 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7861 packed.append(struct.pack("!L", self.xid))
7862 packed.append(struct.pack("!L", self.experimenter))
7863 packed.append(struct.pack("!L", self.subtype))
7864 packed.append(struct.pack("!L", self.status))
7865 length = sum([len(x) for x in packed])
7866 packed[2] = struct.pack("!H", length)
7867 return ''.join(packed)
7868
7869 @staticmethod
7870 def unpack(reader):
7871 obj = bsn_set_switch_pipeline_reply()
7872 _version = reader.read("!B")[0]
7873 assert(_version == 4)
7874 _type = reader.read("!B")[0]
7875 assert(_type == 4)
7876 _length = reader.read("!H")[0]
7877 orig_reader = reader
7878 reader = orig_reader.slice(_length, 4)
7879 obj.xid = reader.read("!L")[0]
7880 _experimenter = reader.read("!L")[0]
7881 assert(_experimenter == 6035143)
7882 _subtype = reader.read("!L")[0]
7883 assert(_subtype == 54)
7884 obj.status = reader.read("!L")[0]
7885 return obj
7886
7887 def __eq__(self, other):
7888 if type(self) != type(other): return False
7889 if self.xid != other.xid: return False
7890 if self.status != other.status: return False
7891 return True
7892
7893 def pretty_print(self, q):
7894 q.text("bsn_set_switch_pipeline_reply {")
7895 with q.group():
7896 with q.indent(2):
7897 q.breakable()
7898 q.text("xid = ");
7899 if self.xid != None:
7900 q.text("%#x" % self.xid)
7901 else:
7902 q.text('None')
7903 q.text(","); q.breakable()
7904 q.text("status = ");
7905 q.text("%#x" % self.status)
7906 q.breakable()
7907 q.text('}')
7908
7909bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7910
7911class bsn_set_switch_pipeline_request(bsn_header):
7912 version = 4
7913 type = 4
7914 experimenter = 6035143
7915 subtype = 53
7916
7917 def __init__(self, xid=None, pipeline=None):
7918 if xid != None:
7919 self.xid = xid
7920 else:
7921 self.xid = None
7922 if pipeline != None:
7923 self.pipeline = pipeline
7924 else:
7925 self.pipeline = ""
7926 return
7927
7928 def pack(self):
7929 packed = []
7930 packed.append(struct.pack("!B", self.version))
7931 packed.append(struct.pack("!B", self.type))
7932 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7933 packed.append(struct.pack("!L", self.xid))
7934 packed.append(struct.pack("!L", self.experimenter))
7935 packed.append(struct.pack("!L", self.subtype))
7936 packed.append(struct.pack("!256s", self.pipeline))
7937 length = sum([len(x) for x in packed])
7938 packed[2] = struct.pack("!H", length)
7939 return ''.join(packed)
7940
7941 @staticmethod
7942 def unpack(reader):
7943 obj = bsn_set_switch_pipeline_request()
7944 _version = reader.read("!B")[0]
7945 assert(_version == 4)
7946 _type = reader.read("!B")[0]
7947 assert(_type == 4)
7948 _length = reader.read("!H")[0]
7949 orig_reader = reader
7950 reader = orig_reader.slice(_length, 4)
7951 obj.xid = reader.read("!L")[0]
7952 _experimenter = reader.read("!L")[0]
7953 assert(_experimenter == 6035143)
7954 _subtype = reader.read("!L")[0]
7955 assert(_subtype == 53)
7956 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7957 return obj
7958
7959 def __eq__(self, other):
7960 if type(self) != type(other): return False
7961 if self.xid != other.xid: return False
7962 if self.pipeline != other.pipeline: return False
7963 return True
7964
7965 def pretty_print(self, q):
7966 q.text("bsn_set_switch_pipeline_request {")
7967 with q.group():
7968 with q.indent(2):
7969 q.breakable()
7970 q.text("xid = ");
7971 if self.xid != None:
7972 q.text("%#x" % self.xid)
7973 else:
7974 q.text('None')
7975 q.text(","); q.breakable()
7976 q.text("pipeline = ");
7977 q.pp(self.pipeline)
7978 q.breakable()
7979 q.text('}')
7980
7981bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7982
7983class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7984 version = 4
7985 type = 19
7986 stats_type = 65535
7987 experimenter = 6035143
7988 subtype = 6
7989
7990 def __init__(self, xid=None, flags=None, entries=None):
7991 if xid != None:
7992 self.xid = xid
7993 else:
7994 self.xid = None
7995 if flags != None:
7996 self.flags = flags
7997 else:
7998 self.flags = 0
7999 if entries != None:
8000 self.entries = entries
8001 else:
8002 self.entries = []
8003 return
8004
8005 def pack(self):
8006 packed = []
8007 packed.append(struct.pack("!B", self.version))
8008 packed.append(struct.pack("!B", self.type))
8009 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8010 packed.append(struct.pack("!L", self.xid))
8011 packed.append(struct.pack("!H", self.stats_type))
8012 packed.append(struct.pack("!H", self.flags))
8013 packed.append('\x00' * 4)
8014 packed.append(struct.pack("!L", self.experimenter))
8015 packed.append(struct.pack("!L", self.subtype))
8016 packed.append(loxi.generic_util.pack_list(self.entries))
8017 length = sum([len(x) for x in packed])
8018 packed[2] = struct.pack("!H", length)
8019 return ''.join(packed)
8020
8021 @staticmethod
8022 def unpack(reader):
8023 obj = bsn_switch_pipeline_stats_reply()
8024 _version = reader.read("!B")[0]
8025 assert(_version == 4)
8026 _type = reader.read("!B")[0]
8027 assert(_type == 19)
8028 _length = reader.read("!H")[0]
8029 orig_reader = reader
8030 reader = orig_reader.slice(_length, 4)
8031 obj.xid = reader.read("!L")[0]
8032 _stats_type = reader.read("!H")[0]
8033 assert(_stats_type == 65535)
8034 obj.flags = reader.read("!H")[0]
8035 reader.skip(4)
8036 _experimenter = reader.read("!L")[0]
8037 assert(_experimenter == 6035143)
8038 _subtype = reader.read("!L")[0]
8039 assert(_subtype == 6)
8040 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
8041 return obj
8042
8043 def __eq__(self, other):
8044 if type(self) != type(other): return False
8045 if self.xid != other.xid: return False
8046 if self.flags != other.flags: return False
8047 if self.entries != other.entries: return False
8048 return True
8049
8050 def pretty_print(self, q):
8051 q.text("bsn_switch_pipeline_stats_reply {")
8052 with q.group():
8053 with q.indent(2):
8054 q.breakable()
8055 q.text("xid = ");
8056 if self.xid != None:
8057 q.text("%#x" % self.xid)
8058 else:
8059 q.text('None')
8060 q.text(","); q.breakable()
8061 q.text("flags = ");
8062 q.text("%#x" % self.flags)
8063 q.text(","); q.breakable()
8064 q.text("entries = ");
8065 q.pp(self.entries)
8066 q.breakable()
8067 q.text('}')
8068
8069bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
8070
8071class bsn_switch_pipeline_stats_request(bsn_stats_request):
8072 version = 4
8073 type = 18
8074 stats_type = 65535
8075 experimenter = 6035143
8076 subtype = 6
8077
8078 def __init__(self, xid=None, flags=None):
8079 if xid != None:
8080 self.xid = xid
8081 else:
8082 self.xid = None
8083 if flags != None:
8084 self.flags = flags
8085 else:
8086 self.flags = 0
8087 return
8088
8089 def pack(self):
8090 packed = []
8091 packed.append(struct.pack("!B", self.version))
8092 packed.append(struct.pack("!B", self.type))
8093 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8094 packed.append(struct.pack("!L", self.xid))
8095 packed.append(struct.pack("!H", self.stats_type))
8096 packed.append(struct.pack("!H", self.flags))
8097 packed.append('\x00' * 4)
8098 packed.append(struct.pack("!L", self.experimenter))
8099 packed.append(struct.pack("!L", self.subtype))
8100 length = sum([len(x) for x in packed])
8101 packed[2] = struct.pack("!H", length)
8102 return ''.join(packed)
8103
8104 @staticmethod
8105 def unpack(reader):
8106 obj = bsn_switch_pipeline_stats_request()
8107 _version = reader.read("!B")[0]
8108 assert(_version == 4)
8109 _type = reader.read("!B")[0]
8110 assert(_type == 18)
8111 _length = reader.read("!H")[0]
8112 orig_reader = reader
8113 reader = orig_reader.slice(_length, 4)
8114 obj.xid = reader.read("!L")[0]
8115 _stats_type = reader.read("!H")[0]
8116 assert(_stats_type == 65535)
8117 obj.flags = reader.read("!H")[0]
8118 reader.skip(4)
8119 _experimenter = reader.read("!L")[0]
8120 assert(_experimenter == 6035143)
8121 _subtype = reader.read("!L")[0]
8122 assert(_subtype == 6)
8123 return obj
8124
8125 def __eq__(self, other):
8126 if type(self) != type(other): return False
8127 if self.xid != other.xid: return False
8128 if self.flags != other.flags: return False
8129 return True
8130
8131 def pretty_print(self, q):
8132 q.text("bsn_switch_pipeline_stats_request {")
8133 with q.group():
8134 with q.indent(2):
8135 q.breakable()
8136 q.text("xid = ");
8137 if self.xid != None:
8138 q.text("%#x" % self.xid)
8139 else:
8140 q.text('None')
8141 q.text(","); q.breakable()
8142 q.text("flags = ");
8143 q.text("%#x" % self.flags)
8144 q.breakable()
8145 q.text('}')
8146
8147bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
8148
8149class bsn_table_checksum_stats_reply(bsn_stats_reply):
8150 version = 4
8151 type = 19
8152 stats_type = 65535
8153 experimenter = 6035143
8154 subtype = 11
8155
8156 def __init__(self, xid=None, flags=None, entries=None):
8157 if xid != None:
8158 self.xid = xid
8159 else:
8160 self.xid = None
8161 if flags != None:
8162 self.flags = flags
8163 else:
8164 self.flags = 0
8165 if entries != None:
8166 self.entries = entries
8167 else:
8168 self.entries = []
8169 return
8170
8171 def pack(self):
8172 packed = []
8173 packed.append(struct.pack("!B", self.version))
8174 packed.append(struct.pack("!B", self.type))
8175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8176 packed.append(struct.pack("!L", self.xid))
8177 packed.append(struct.pack("!H", self.stats_type))
8178 packed.append(struct.pack("!H", self.flags))
8179 packed.append('\x00' * 4)
8180 packed.append(struct.pack("!L", self.experimenter))
8181 packed.append(struct.pack("!L", self.subtype))
8182 packed.append(loxi.generic_util.pack_list(self.entries))
8183 length = sum([len(x) for x in packed])
8184 packed[2] = struct.pack("!H", length)
8185 return ''.join(packed)
8186
8187 @staticmethod
8188 def unpack(reader):
8189 obj = bsn_table_checksum_stats_reply()
8190 _version = reader.read("!B")[0]
8191 assert(_version == 4)
8192 _type = reader.read("!B")[0]
8193 assert(_type == 19)
8194 _length = reader.read("!H")[0]
8195 orig_reader = reader
8196 reader = orig_reader.slice(_length, 4)
8197 obj.xid = reader.read("!L")[0]
8198 _stats_type = reader.read("!H")[0]
8199 assert(_stats_type == 65535)
8200 obj.flags = reader.read("!H")[0]
8201 reader.skip(4)
8202 _experimenter = reader.read("!L")[0]
8203 assert(_experimenter == 6035143)
8204 _subtype = reader.read("!L")[0]
8205 assert(_subtype == 11)
8206 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
8207 return obj
8208
8209 def __eq__(self, other):
8210 if type(self) != type(other): return False
8211 if self.xid != other.xid: return False
8212 if self.flags != other.flags: return False
8213 if self.entries != other.entries: return False
8214 return True
8215
8216 def pretty_print(self, q):
8217 q.text("bsn_table_checksum_stats_reply {")
8218 with q.group():
8219 with q.indent(2):
8220 q.breakable()
8221 q.text("xid = ");
8222 if self.xid != None:
8223 q.text("%#x" % self.xid)
8224 else:
8225 q.text('None')
8226 q.text(","); q.breakable()
8227 q.text("flags = ");
8228 q.text("%#x" % self.flags)
8229 q.text(","); q.breakable()
8230 q.text("entries = ");
8231 q.pp(self.entries)
8232 q.breakable()
8233 q.text('}')
8234
8235bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8236
8237class bsn_table_checksum_stats_request(bsn_stats_request):
8238 version = 4
8239 type = 18
8240 stats_type = 65535
8241 experimenter = 6035143
8242 subtype = 11
8243
8244 def __init__(self, xid=None, flags=None):
8245 if xid != None:
8246 self.xid = xid
8247 else:
8248 self.xid = None
8249 if flags != None:
8250 self.flags = flags
8251 else:
8252 self.flags = 0
8253 return
8254
8255 def pack(self):
8256 packed = []
8257 packed.append(struct.pack("!B", self.version))
8258 packed.append(struct.pack("!B", self.type))
8259 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8260 packed.append(struct.pack("!L", self.xid))
8261 packed.append(struct.pack("!H", self.stats_type))
8262 packed.append(struct.pack("!H", self.flags))
8263 packed.append('\x00' * 4)
8264 packed.append(struct.pack("!L", self.experimenter))
8265 packed.append(struct.pack("!L", self.subtype))
8266 length = sum([len(x) for x in packed])
8267 packed[2] = struct.pack("!H", length)
8268 return ''.join(packed)
8269
8270 @staticmethod
8271 def unpack(reader):
8272 obj = bsn_table_checksum_stats_request()
8273 _version = reader.read("!B")[0]
8274 assert(_version == 4)
8275 _type = reader.read("!B")[0]
8276 assert(_type == 18)
8277 _length = reader.read("!H")[0]
8278 orig_reader = reader
8279 reader = orig_reader.slice(_length, 4)
8280 obj.xid = reader.read("!L")[0]
8281 _stats_type = reader.read("!H")[0]
8282 assert(_stats_type == 65535)
8283 obj.flags = reader.read("!H")[0]
8284 reader.skip(4)
8285 _experimenter = reader.read("!L")[0]
8286 assert(_experimenter == 6035143)
8287 _subtype = reader.read("!L")[0]
8288 assert(_subtype == 11)
8289 return obj
8290
8291 def __eq__(self, other):
8292 if type(self) != type(other): return False
8293 if self.xid != other.xid: return False
8294 if self.flags != other.flags: return False
8295 return True
8296
8297 def pretty_print(self, q):
8298 q.text("bsn_table_checksum_stats_request {")
8299 with q.group():
8300 with q.indent(2):
8301 q.breakable()
8302 q.text("xid = ");
8303 if self.xid != None:
8304 q.text("%#x" % self.xid)
8305 else:
8306 q.text('None')
8307 q.text(","); q.breakable()
8308 q.text("flags = ");
8309 q.text("%#x" % self.flags)
8310 q.breakable()
8311 q.text('}')
8312
8313bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8314
8315class bsn_table_set_buckets_size(bsn_header):
8316 version = 4
8317 type = 4
8318 experimenter = 6035143
8319 subtype = 61
8320
8321 def __init__(self, xid=None, table_id=None, buckets_size=None):
8322 if xid != None:
8323 self.xid = xid
8324 else:
8325 self.xid = None
8326 if table_id != None:
8327 self.table_id = table_id
8328 else:
8329 self.table_id = 0
8330 if buckets_size != None:
8331 self.buckets_size = buckets_size
8332 else:
8333 self.buckets_size = 0
8334 return
8335
8336 def pack(self):
8337 packed = []
8338 packed.append(struct.pack("!B", self.version))
8339 packed.append(struct.pack("!B", self.type))
8340 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8341 packed.append(struct.pack("!L", self.xid))
8342 packed.append(struct.pack("!L", self.experimenter))
8343 packed.append(struct.pack("!L", self.subtype))
8344 packed.append('\x00' * 1)
8345 packed.append(struct.pack("!B", self.table_id))
8346 packed.append('\x00' * 2)
8347 packed.append(struct.pack("!L", self.buckets_size))
8348 length = sum([len(x) for x in packed])
8349 packed[2] = struct.pack("!H", length)
8350 return ''.join(packed)
8351
8352 @staticmethod
8353 def unpack(reader):
8354 obj = bsn_table_set_buckets_size()
8355 _version = reader.read("!B")[0]
8356 assert(_version == 4)
8357 _type = reader.read("!B")[0]
8358 assert(_type == 4)
8359 _length = reader.read("!H")[0]
8360 orig_reader = reader
8361 reader = orig_reader.slice(_length, 4)
8362 obj.xid = reader.read("!L")[0]
8363 _experimenter = reader.read("!L")[0]
8364 assert(_experimenter == 6035143)
8365 _subtype = reader.read("!L")[0]
8366 assert(_subtype == 61)
8367 reader.skip(1)
8368 obj.table_id = reader.read("!B")[0]
8369 reader.skip(2)
8370 obj.buckets_size = reader.read("!L")[0]
8371 return obj
8372
8373 def __eq__(self, other):
8374 if type(self) != type(other): return False
8375 if self.xid != other.xid: return False
8376 if self.table_id != other.table_id: return False
8377 if self.buckets_size != other.buckets_size: return False
8378 return True
8379
8380 def pretty_print(self, q):
8381 q.text("bsn_table_set_buckets_size {")
8382 with q.group():
8383 with q.indent(2):
8384 q.breakable()
8385 q.text("xid = ");
8386 if self.xid != None:
8387 q.text("%#x" % self.xid)
8388 else:
8389 q.text('None')
8390 q.text(","); q.breakable()
8391 q.text("table_id = ");
8392 q.text("%#x" % self.table_id)
8393 q.text(","); q.breakable()
8394 q.text("buckets_size = ");
8395 q.text("%#x" % self.buckets_size)
8396 q.breakable()
8397 q.text('}')
8398
8399bsn_header.subtypes[61] = bsn_table_set_buckets_size
8400
8401class bsn_time_reply(bsn_header):
8402 version = 4
8403 type = 4
8404 experimenter = 6035143
8405 subtype = 45
8406
8407 def __init__(self, xid=None, time_ms=None):
8408 if xid != None:
8409 self.xid = xid
8410 else:
8411 self.xid = None
8412 if time_ms != None:
8413 self.time_ms = time_ms
8414 else:
8415 self.time_ms = 0
8416 return
8417
8418 def pack(self):
8419 packed = []
8420 packed.append(struct.pack("!B", self.version))
8421 packed.append(struct.pack("!B", self.type))
8422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8423 packed.append(struct.pack("!L", self.xid))
8424 packed.append(struct.pack("!L", self.experimenter))
8425 packed.append(struct.pack("!L", self.subtype))
8426 packed.append(struct.pack("!Q", self.time_ms))
8427 length = sum([len(x) for x in packed])
8428 packed[2] = struct.pack("!H", length)
8429 return ''.join(packed)
8430
8431 @staticmethod
8432 def unpack(reader):
8433 obj = bsn_time_reply()
8434 _version = reader.read("!B")[0]
8435 assert(_version == 4)
8436 _type = reader.read("!B")[0]
8437 assert(_type == 4)
8438 _length = reader.read("!H")[0]
8439 orig_reader = reader
8440 reader = orig_reader.slice(_length, 4)
8441 obj.xid = reader.read("!L")[0]
8442 _experimenter = reader.read("!L")[0]
8443 assert(_experimenter == 6035143)
8444 _subtype = reader.read("!L")[0]
8445 assert(_subtype == 45)
8446 obj.time_ms = reader.read("!Q")[0]
8447 return obj
8448
8449 def __eq__(self, other):
8450 if type(self) != type(other): return False
8451 if self.xid != other.xid: return False
8452 if self.time_ms != other.time_ms: return False
8453 return True
8454
8455 def pretty_print(self, q):
8456 q.text("bsn_time_reply {")
8457 with q.group():
8458 with q.indent(2):
8459 q.breakable()
8460 q.text("xid = ");
8461 if self.xid != None:
8462 q.text("%#x" % self.xid)
8463 else:
8464 q.text('None')
8465 q.text(","); q.breakable()
8466 q.text("time_ms = ");
8467 q.text("%#x" % self.time_ms)
8468 q.breakable()
8469 q.text('}')
8470
8471bsn_header.subtypes[45] = bsn_time_reply
8472
8473class bsn_time_request(bsn_header):
8474 version = 4
8475 type = 4
8476 experimenter = 6035143
8477 subtype = 44
8478
8479 def __init__(self, xid=None):
8480 if xid != None:
8481 self.xid = xid
8482 else:
8483 self.xid = None
8484 return
8485
8486 def pack(self):
8487 packed = []
8488 packed.append(struct.pack("!B", self.version))
8489 packed.append(struct.pack("!B", self.type))
8490 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8491 packed.append(struct.pack("!L", self.xid))
8492 packed.append(struct.pack("!L", self.experimenter))
8493 packed.append(struct.pack("!L", self.subtype))
8494 length = sum([len(x) for x in packed])
8495 packed[2] = struct.pack("!H", length)
8496 return ''.join(packed)
8497
8498 @staticmethod
8499 def unpack(reader):
8500 obj = bsn_time_request()
8501 _version = reader.read("!B")[0]
8502 assert(_version == 4)
8503 _type = reader.read("!B")[0]
8504 assert(_type == 4)
8505 _length = reader.read("!H")[0]
8506 orig_reader = reader
8507 reader = orig_reader.slice(_length, 4)
8508 obj.xid = reader.read("!L")[0]
8509 _experimenter = reader.read("!L")[0]
8510 assert(_experimenter == 6035143)
8511 _subtype = reader.read("!L")[0]
8512 assert(_subtype == 44)
8513 return obj
8514
8515 def __eq__(self, other):
8516 if type(self) != type(other): return False
8517 if self.xid != other.xid: return False
8518 return True
8519
8520 def pretty_print(self, q):
8521 q.text("bsn_time_request {")
8522 with q.group():
8523 with q.indent(2):
8524 q.breakable()
8525 q.text("xid = ");
8526 if self.xid != None:
8527 q.text("%#x" % self.xid)
8528 else:
8529 q.text('None')
8530 q.breakable()
8531 q.text('}')
8532
8533bsn_header.subtypes[44] = bsn_time_request
8534
8535class bsn_virtual_port_create_reply(bsn_header):
8536 version = 4
8537 type = 4
8538 experimenter = 6035143
8539 subtype = 16
8540
8541 def __init__(self, xid=None, status=None, vport_no=None):
8542 if xid != None:
8543 self.xid = xid
8544 else:
8545 self.xid = None
8546 if status != None:
8547 self.status = status
8548 else:
8549 self.status = 0
8550 if vport_no != None:
8551 self.vport_no = vport_no
8552 else:
8553 self.vport_no = 0
8554 return
8555
8556 def pack(self):
8557 packed = []
8558 packed.append(struct.pack("!B", self.version))
8559 packed.append(struct.pack("!B", self.type))
8560 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8561 packed.append(struct.pack("!L", self.xid))
8562 packed.append(struct.pack("!L", self.experimenter))
8563 packed.append(struct.pack("!L", self.subtype))
8564 packed.append(struct.pack("!L", self.status))
8565 packed.append(struct.pack("!L", self.vport_no))
8566 length = sum([len(x) for x in packed])
8567 packed[2] = struct.pack("!H", length)
8568 return ''.join(packed)
8569
8570 @staticmethod
8571 def unpack(reader):
8572 obj = bsn_virtual_port_create_reply()
8573 _version = reader.read("!B")[0]
8574 assert(_version == 4)
8575 _type = reader.read("!B")[0]
8576 assert(_type == 4)
8577 _length = reader.read("!H")[0]
8578 orig_reader = reader
8579 reader = orig_reader.slice(_length, 4)
8580 obj.xid = reader.read("!L")[0]
8581 _experimenter = reader.read("!L")[0]
8582 assert(_experimenter == 6035143)
8583 _subtype = reader.read("!L")[0]
8584 assert(_subtype == 16)
8585 obj.status = reader.read("!L")[0]
8586 obj.vport_no = reader.read("!L")[0]
8587 return obj
8588
8589 def __eq__(self, other):
8590 if type(self) != type(other): return False
8591 if self.xid != other.xid: return False
8592 if self.status != other.status: return False
8593 if self.vport_no != other.vport_no: return False
8594 return True
8595
8596 def pretty_print(self, q):
8597 q.text("bsn_virtual_port_create_reply {")
8598 with q.group():
8599 with q.indent(2):
8600 q.breakable()
8601 q.text("xid = ");
8602 if self.xid != None:
8603 q.text("%#x" % self.xid)
8604 else:
8605 q.text('None')
8606 q.text(","); q.breakable()
8607 q.text("status = ");
8608 q.text("%#x" % self.status)
8609 q.text(","); q.breakable()
8610 q.text("vport_no = ");
8611 q.text("%#x" % self.vport_no)
8612 q.breakable()
8613 q.text('}')
8614
8615bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8616
8617class bsn_virtual_port_create_request(bsn_header):
8618 version = 4
8619 type = 4
8620 experimenter = 6035143
8621 subtype = 15
8622
8623 def __init__(self, xid=None, vport=None):
8624 if xid != None:
8625 self.xid = xid
8626 else:
8627 self.xid = None
8628 if vport != None:
8629 self.vport = vport
8630 else:
8631 self.vport = ofp.bsn_vport()
8632 return
8633
8634 def pack(self):
8635 packed = []
8636 packed.append(struct.pack("!B", self.version))
8637 packed.append(struct.pack("!B", self.type))
8638 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8639 packed.append(struct.pack("!L", self.xid))
8640 packed.append(struct.pack("!L", self.experimenter))
8641 packed.append(struct.pack("!L", self.subtype))
8642 packed.append(self.vport.pack())
8643 length = sum([len(x) for x in packed])
8644 packed[2] = struct.pack("!H", length)
8645 return ''.join(packed)
8646
8647 @staticmethod
8648 def unpack(reader):
8649 obj = bsn_virtual_port_create_request()
8650 _version = reader.read("!B")[0]
8651 assert(_version == 4)
8652 _type = reader.read("!B")[0]
8653 assert(_type == 4)
8654 _length = reader.read("!H")[0]
8655 orig_reader = reader
8656 reader = orig_reader.slice(_length, 4)
8657 obj.xid = reader.read("!L")[0]
8658 _experimenter = reader.read("!L")[0]
8659 assert(_experimenter == 6035143)
8660 _subtype = reader.read("!L")[0]
8661 assert(_subtype == 15)
8662 obj.vport = ofp.bsn_vport.unpack(reader)
8663 return obj
8664
8665 def __eq__(self, other):
8666 if type(self) != type(other): return False
8667 if self.xid != other.xid: return False
8668 if self.vport != other.vport: return False
8669 return True
8670
8671 def pretty_print(self, q):
8672 q.text("bsn_virtual_port_create_request {")
8673 with q.group():
8674 with q.indent(2):
8675 q.breakable()
8676 q.text("xid = ");
8677 if self.xid != None:
8678 q.text("%#x" % self.xid)
8679 else:
8680 q.text('None')
8681 q.text(","); q.breakable()
8682 q.text("vport = ");
8683 q.pp(self.vport)
8684 q.breakable()
8685 q.text('}')
8686
8687bsn_header.subtypes[15] = bsn_virtual_port_create_request
8688
8689class bsn_virtual_port_remove_reply(bsn_header):
8690 version = 4
8691 type = 4
8692 experimenter = 6035143
8693 subtype = 26
8694
8695 def __init__(self, xid=None, status=None):
8696 if xid != None:
8697 self.xid = xid
8698 else:
8699 self.xid = None
8700 if status != None:
8701 self.status = status
8702 else:
8703 self.status = 0
8704 return
8705
8706 def pack(self):
8707 packed = []
8708 packed.append(struct.pack("!B", self.version))
8709 packed.append(struct.pack("!B", self.type))
8710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8711 packed.append(struct.pack("!L", self.xid))
8712 packed.append(struct.pack("!L", self.experimenter))
8713 packed.append(struct.pack("!L", self.subtype))
8714 packed.append(struct.pack("!L", self.status))
8715 length = sum([len(x) for x in packed])
8716 packed[2] = struct.pack("!H", length)
8717 return ''.join(packed)
8718
8719 @staticmethod
8720 def unpack(reader):
8721 obj = bsn_virtual_port_remove_reply()
8722 _version = reader.read("!B")[0]
8723 assert(_version == 4)
8724 _type = reader.read("!B")[0]
8725 assert(_type == 4)
8726 _length = reader.read("!H")[0]
8727 orig_reader = reader
8728 reader = orig_reader.slice(_length, 4)
8729 obj.xid = reader.read("!L")[0]
8730 _experimenter = reader.read("!L")[0]
8731 assert(_experimenter == 6035143)
8732 _subtype = reader.read("!L")[0]
8733 assert(_subtype == 26)
8734 obj.status = reader.read("!L")[0]
8735 return obj
8736
8737 def __eq__(self, other):
8738 if type(self) != type(other): return False
8739 if self.xid != other.xid: return False
8740 if self.status != other.status: return False
8741 return True
8742
8743 def pretty_print(self, q):
8744 q.text("bsn_virtual_port_remove_reply {")
8745 with q.group():
8746 with q.indent(2):
8747 q.breakable()
8748 q.text("xid = ");
8749 if self.xid != None:
8750 q.text("%#x" % self.xid)
8751 else:
8752 q.text('None')
8753 q.text(","); q.breakable()
8754 q.text("status = ");
8755 q.text("%#x" % self.status)
8756 q.breakable()
8757 q.text('}')
8758
8759bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8760
8761class bsn_virtual_port_remove_request(bsn_header):
8762 version = 4
8763 type = 4
8764 experimenter = 6035143
8765 subtype = 17
8766
8767 def __init__(self, xid=None, vport_no=None):
8768 if xid != None:
8769 self.xid = xid
8770 else:
8771 self.xid = None
8772 if vport_no != None:
8773 self.vport_no = vport_no
8774 else:
8775 self.vport_no = 0
8776 return
8777
8778 def pack(self):
8779 packed = []
8780 packed.append(struct.pack("!B", self.version))
8781 packed.append(struct.pack("!B", self.type))
8782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8783 packed.append(struct.pack("!L", self.xid))
8784 packed.append(struct.pack("!L", self.experimenter))
8785 packed.append(struct.pack("!L", self.subtype))
8786 packed.append(struct.pack("!L", self.vport_no))
8787 length = sum([len(x) for x in packed])
8788 packed[2] = struct.pack("!H", length)
8789 return ''.join(packed)
8790
8791 @staticmethod
8792 def unpack(reader):
8793 obj = bsn_virtual_port_remove_request()
8794 _version = reader.read("!B")[0]
8795 assert(_version == 4)
8796 _type = reader.read("!B")[0]
8797 assert(_type == 4)
8798 _length = reader.read("!H")[0]
8799 orig_reader = reader
8800 reader = orig_reader.slice(_length, 4)
8801 obj.xid = reader.read("!L")[0]
8802 _experimenter = reader.read("!L")[0]
8803 assert(_experimenter == 6035143)
8804 _subtype = reader.read("!L")[0]
8805 assert(_subtype == 17)
8806 obj.vport_no = reader.read("!L")[0]
8807 return obj
8808
8809 def __eq__(self, other):
8810 if type(self) != type(other): return False
8811 if self.xid != other.xid: return False
8812 if self.vport_no != other.vport_no: return False
8813 return True
8814
8815 def pretty_print(self, q):
8816 q.text("bsn_virtual_port_remove_request {")
8817 with q.group():
8818 with q.indent(2):
8819 q.breakable()
8820 q.text("xid = ");
8821 if self.xid != None:
8822 q.text("%#x" % self.xid)
8823 else:
8824 q.text('None')
8825 q.text(","); q.breakable()
8826 q.text("vport_no = ");
8827 q.text("%#x" % self.vport_no)
8828 q.breakable()
8829 q.text('}')
8830
8831bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8832
8833class bsn_vlan_counter_clear(bsn_header):
8834 version = 4
8835 type = 4
8836 experimenter = 6035143
8837 subtype = 70
8838
8839 def __init__(self, xid=None, vlan_vid=None):
8840 if xid != None:
8841 self.xid = xid
8842 else:
8843 self.xid = None
8844 if vlan_vid != None:
8845 self.vlan_vid = vlan_vid
8846 else:
8847 self.vlan_vid = 0
8848 return
8849
8850 def pack(self):
8851 packed = []
8852 packed.append(struct.pack("!B", self.version))
8853 packed.append(struct.pack("!B", self.type))
8854 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8855 packed.append(struct.pack("!L", self.xid))
8856 packed.append(struct.pack("!L", self.experimenter))
8857 packed.append(struct.pack("!L", self.subtype))
8858 packed.append(struct.pack("!H", self.vlan_vid))
8859 length = sum([len(x) for x in packed])
8860 packed[2] = struct.pack("!H", length)
8861 return ''.join(packed)
8862
8863 @staticmethod
8864 def unpack(reader):
8865 obj = bsn_vlan_counter_clear()
8866 _version = reader.read("!B")[0]
8867 assert(_version == 4)
8868 _type = reader.read("!B")[0]
8869 assert(_type == 4)
8870 _length = reader.read("!H")[0]
8871 orig_reader = reader
8872 reader = orig_reader.slice(_length, 4)
8873 obj.xid = reader.read("!L")[0]
8874 _experimenter = reader.read("!L")[0]
8875 assert(_experimenter == 6035143)
8876 _subtype = reader.read("!L")[0]
8877 assert(_subtype == 70)
8878 obj.vlan_vid = reader.read("!H")[0]
8879 return obj
8880
8881 def __eq__(self, other):
8882 if type(self) != type(other): return False
8883 if self.xid != other.xid: return False
8884 if self.vlan_vid != other.vlan_vid: return False
8885 return True
8886
8887 def pretty_print(self, q):
8888 q.text("bsn_vlan_counter_clear {")
8889 with q.group():
8890 with q.indent(2):
8891 q.breakable()
8892 q.text("xid = ");
8893 if self.xid != None:
8894 q.text("%#x" % self.xid)
8895 else:
8896 q.text('None')
8897 q.text(","); q.breakable()
8898 q.text("vlan_vid = ");
8899 q.text("%#x" % self.vlan_vid)
8900 q.breakable()
8901 q.text('}')
8902
8903bsn_header.subtypes[70] = bsn_vlan_counter_clear
8904
8905class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8906 version = 4
8907 type = 19
8908 stats_type = 65535
8909 experimenter = 6035143
8910 subtype = 9
8911
8912 def __init__(self, xid=None, flags=None, entries=None):
8913 if xid != None:
8914 self.xid = xid
8915 else:
8916 self.xid = None
8917 if flags != None:
8918 self.flags = flags
8919 else:
8920 self.flags = 0
8921 if entries != None:
8922 self.entries = entries
8923 else:
8924 self.entries = []
8925 return
8926
8927 def pack(self):
8928 packed = []
8929 packed.append(struct.pack("!B", self.version))
8930 packed.append(struct.pack("!B", self.type))
8931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8932 packed.append(struct.pack("!L", self.xid))
8933 packed.append(struct.pack("!H", self.stats_type))
8934 packed.append(struct.pack("!H", self.flags))
8935 packed.append('\x00' * 4)
8936 packed.append(struct.pack("!L", self.experimenter))
8937 packed.append(struct.pack("!L", self.subtype))
8938 packed.append(loxi.generic_util.pack_list(self.entries))
8939 length = sum([len(x) for x in packed])
8940 packed[2] = struct.pack("!H", length)
8941 return ''.join(packed)
8942
8943 @staticmethod
8944 def unpack(reader):
8945 obj = bsn_vlan_counter_stats_reply()
8946 _version = reader.read("!B")[0]
8947 assert(_version == 4)
8948 _type = reader.read("!B")[0]
8949 assert(_type == 19)
8950 _length = reader.read("!H")[0]
8951 orig_reader = reader
8952 reader = orig_reader.slice(_length, 4)
8953 obj.xid = reader.read("!L")[0]
8954 _stats_type = reader.read("!H")[0]
8955 assert(_stats_type == 65535)
8956 obj.flags = reader.read("!H")[0]
8957 reader.skip(4)
8958 _experimenter = reader.read("!L")[0]
8959 assert(_experimenter == 6035143)
8960 _subtype = reader.read("!L")[0]
8961 assert(_subtype == 9)
8962 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
8963 return obj
8964
8965 def __eq__(self, other):
8966 if type(self) != type(other): return False
8967 if self.xid != other.xid: return False
8968 if self.flags != other.flags: return False
8969 if self.entries != other.entries: return False
8970 return True
8971
8972 def pretty_print(self, q):
8973 q.text("bsn_vlan_counter_stats_reply {")
8974 with q.group():
8975 with q.indent(2):
8976 q.breakable()
8977 q.text("xid = ");
8978 if self.xid != None:
8979 q.text("%#x" % self.xid)
8980 else:
8981 q.text('None')
8982 q.text(","); q.breakable()
8983 q.text("flags = ");
8984 q.text("%#x" % self.flags)
8985 q.text(","); q.breakable()
8986 q.text("entries = ");
8987 q.pp(self.entries)
8988 q.breakable()
8989 q.text('}')
8990
8991bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8992
8993class bsn_vlan_counter_stats_request(bsn_stats_request):
8994 version = 4
8995 type = 18
8996 stats_type = 65535
8997 experimenter = 6035143
8998 subtype = 9
8999
9000 def __init__(self, xid=None, flags=None, vlan_vid=None):
9001 if xid != None:
9002 self.xid = xid
9003 else:
9004 self.xid = None
9005 if flags != None:
9006 self.flags = flags
9007 else:
9008 self.flags = 0
9009 if vlan_vid != None:
9010 self.vlan_vid = vlan_vid
9011 else:
9012 self.vlan_vid = 0
9013 return
9014
9015 def pack(self):
9016 packed = []
9017 packed.append(struct.pack("!B", self.version))
9018 packed.append(struct.pack("!B", self.type))
9019 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9020 packed.append(struct.pack("!L", self.xid))
9021 packed.append(struct.pack("!H", self.stats_type))
9022 packed.append(struct.pack("!H", self.flags))
9023 packed.append('\x00' * 4)
9024 packed.append(struct.pack("!L", self.experimenter))
9025 packed.append(struct.pack("!L", self.subtype))
9026 packed.append(struct.pack("!H", self.vlan_vid))
9027 length = sum([len(x) for x in packed])
9028 packed[2] = struct.pack("!H", length)
9029 return ''.join(packed)
9030
9031 @staticmethod
9032 def unpack(reader):
9033 obj = bsn_vlan_counter_stats_request()
9034 _version = reader.read("!B")[0]
9035 assert(_version == 4)
9036 _type = reader.read("!B")[0]
9037 assert(_type == 18)
9038 _length = reader.read("!H")[0]
9039 orig_reader = reader
9040 reader = orig_reader.slice(_length, 4)
9041 obj.xid = reader.read("!L")[0]
9042 _stats_type = reader.read("!H")[0]
9043 assert(_stats_type == 65535)
9044 obj.flags = reader.read("!H")[0]
9045 reader.skip(4)
9046 _experimenter = reader.read("!L")[0]
9047 assert(_experimenter == 6035143)
9048 _subtype = reader.read("!L")[0]
9049 assert(_subtype == 9)
9050 obj.vlan_vid = reader.read("!H")[0]
9051 return obj
9052
9053 def __eq__(self, other):
9054 if type(self) != type(other): return False
9055 if self.xid != other.xid: return False
9056 if self.flags != other.flags: return False
9057 if self.vlan_vid != other.vlan_vid: return False
9058 return True
9059
9060 def pretty_print(self, q):
9061 q.text("bsn_vlan_counter_stats_request {")
9062 with q.group():
9063 with q.indent(2):
9064 q.breakable()
9065 q.text("xid = ");
9066 if self.xid != None:
9067 q.text("%#x" % self.xid)
9068 else:
9069 q.text('None')
9070 q.text(","); q.breakable()
9071 q.text("flags = ");
9072 q.text("%#x" % self.flags)
9073 q.text(","); q.breakable()
9074 q.text("vlan_vid = ");
9075 q.text("%#x" % self.vlan_vid)
9076 q.breakable()
9077 q.text('}')
9078
9079bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
9080
9081class bsn_vrf_counter_stats_reply(bsn_stats_reply):
9082 version = 4
9083 type = 19
9084 stats_type = 65535
9085 experimenter = 6035143
9086 subtype = 15
9087
9088 def __init__(self, xid=None, flags=None, entries=None):
9089 if xid != None:
9090 self.xid = xid
9091 else:
9092 self.xid = None
9093 if flags != None:
9094 self.flags = flags
9095 else:
9096 self.flags = 0
9097 if entries != None:
9098 self.entries = entries
9099 else:
9100 self.entries = []
9101 return
9102
9103 def pack(self):
9104 packed = []
9105 packed.append(struct.pack("!B", self.version))
9106 packed.append(struct.pack("!B", self.type))
9107 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9108 packed.append(struct.pack("!L", self.xid))
9109 packed.append(struct.pack("!H", self.stats_type))
9110 packed.append(struct.pack("!H", self.flags))
9111 packed.append('\x00' * 4)
9112 packed.append(struct.pack("!L", self.experimenter))
9113 packed.append(struct.pack("!L", self.subtype))
9114 packed.append(loxi.generic_util.pack_list(self.entries))
9115 length = sum([len(x) for x in packed])
9116 packed[2] = struct.pack("!H", length)
9117 return ''.join(packed)
9118
9119 @staticmethod
9120 def unpack(reader):
9121 obj = bsn_vrf_counter_stats_reply()
9122 _version = reader.read("!B")[0]
9123 assert(_version == 4)
9124 _type = reader.read("!B")[0]
9125 assert(_type == 19)
9126 _length = reader.read("!H")[0]
9127 orig_reader = reader
9128 reader = orig_reader.slice(_length, 4)
9129 obj.xid = reader.read("!L")[0]
9130 _stats_type = reader.read("!H")[0]
9131 assert(_stats_type == 65535)
9132 obj.flags = reader.read("!H")[0]
9133 reader.skip(4)
9134 _experimenter = reader.read("!L")[0]
9135 assert(_experimenter == 6035143)
9136 _subtype = reader.read("!L")[0]
9137 assert(_subtype == 15)
9138 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
9139 return obj
9140
9141 def __eq__(self, other):
9142 if type(self) != type(other): return False
9143 if self.xid != other.xid: return False
9144 if self.flags != other.flags: return False
9145 if self.entries != other.entries: return False
9146 return True
9147
9148 def pretty_print(self, q):
9149 q.text("bsn_vrf_counter_stats_reply {")
9150 with q.group():
9151 with q.indent(2):
9152 q.breakable()
9153 q.text("xid = ");
9154 if self.xid != None:
9155 q.text("%#x" % self.xid)
9156 else:
9157 q.text('None')
9158 q.text(","); q.breakable()
9159 q.text("flags = ");
9160 q.text("%#x" % self.flags)
9161 q.text(","); q.breakable()
9162 q.text("entries = ");
9163 q.pp(self.entries)
9164 q.breakable()
9165 q.text('}')
9166
9167bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
9168
9169class bsn_vrf_counter_stats_request(bsn_stats_request):
9170 version = 4
9171 type = 18
9172 stats_type = 65535
9173 experimenter = 6035143
9174 subtype = 15
9175
9176 def __init__(self, xid=None, flags=None, vrf=None):
9177 if xid != None:
9178 self.xid = xid
9179 else:
9180 self.xid = None
9181 if flags != None:
9182 self.flags = flags
9183 else:
9184 self.flags = 0
9185 if vrf != None:
9186 self.vrf = vrf
9187 else:
9188 self.vrf = 0
9189 return
9190
9191 def pack(self):
9192 packed = []
9193 packed.append(struct.pack("!B", self.version))
9194 packed.append(struct.pack("!B", self.type))
9195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9196 packed.append(struct.pack("!L", self.xid))
9197 packed.append(struct.pack("!H", self.stats_type))
9198 packed.append(struct.pack("!H", self.flags))
9199 packed.append('\x00' * 4)
9200 packed.append(struct.pack("!L", self.experimenter))
9201 packed.append(struct.pack("!L", self.subtype))
9202 packed.append(struct.pack("!L", self.vrf))
9203 length = sum([len(x) for x in packed])
9204 packed[2] = struct.pack("!H", length)
9205 return ''.join(packed)
9206
9207 @staticmethod
9208 def unpack(reader):
9209 obj = bsn_vrf_counter_stats_request()
9210 _version = reader.read("!B")[0]
9211 assert(_version == 4)
9212 _type = reader.read("!B")[0]
9213 assert(_type == 18)
9214 _length = reader.read("!H")[0]
9215 orig_reader = reader
9216 reader = orig_reader.slice(_length, 4)
9217 obj.xid = reader.read("!L")[0]
9218 _stats_type = reader.read("!H")[0]
9219 assert(_stats_type == 65535)
9220 obj.flags = reader.read("!H")[0]
9221 reader.skip(4)
9222 _experimenter = reader.read("!L")[0]
9223 assert(_experimenter == 6035143)
9224 _subtype = reader.read("!L")[0]
9225 assert(_subtype == 15)
9226 obj.vrf = reader.read("!L")[0]
9227 return obj
9228
9229 def __eq__(self, other):
9230 if type(self) != type(other): return False
9231 if self.xid != other.xid: return False
9232 if self.flags != other.flags: return False
9233 if self.vrf != other.vrf: return False
9234 return True
9235
9236 def pretty_print(self, q):
9237 q.text("bsn_vrf_counter_stats_request {")
9238 with q.group():
9239 with q.indent(2):
9240 q.breakable()
9241 q.text("xid = ");
9242 if self.xid != None:
9243 q.text("%#x" % self.xid)
9244 else:
9245 q.text('None')
9246 q.text(","); q.breakable()
9247 q.text("flags = ");
9248 q.text("%#x" % self.flags)
9249 q.text(","); q.breakable()
9250 q.text("vrf = ");
9251 q.text("%#x" % self.vrf)
9252 q.breakable()
9253 q.text('}')
9254
9255bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
9256
9257class desc_stats_reply(stats_reply):
9258 version = 4
9259 type = 19
9260 stats_type = 0
9261
9262 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
9263 if xid != None:
9264 self.xid = xid
9265 else:
9266 self.xid = None
9267 if flags != None:
9268 self.flags = flags
9269 else:
9270 self.flags = 0
9271 if mfr_desc != None:
9272 self.mfr_desc = mfr_desc
9273 else:
9274 self.mfr_desc = ""
9275 if hw_desc != None:
9276 self.hw_desc = hw_desc
9277 else:
9278 self.hw_desc = ""
9279 if sw_desc != None:
9280 self.sw_desc = sw_desc
9281 else:
9282 self.sw_desc = ""
9283 if serial_num != None:
9284 self.serial_num = serial_num
9285 else:
9286 self.serial_num = ""
9287 if dp_desc != None:
9288 self.dp_desc = dp_desc
9289 else:
9290 self.dp_desc = ""
9291 return
9292
9293 def pack(self):
9294 packed = []
9295 packed.append(struct.pack("!B", self.version))
9296 packed.append(struct.pack("!B", self.type))
9297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9298 packed.append(struct.pack("!L", self.xid))
9299 packed.append(struct.pack("!H", self.stats_type))
9300 packed.append(struct.pack("!H", self.flags))
9301 packed.append('\x00' * 4)
9302 packed.append(struct.pack("!256s", self.mfr_desc))
9303 packed.append(struct.pack("!256s", self.hw_desc))
9304 packed.append(struct.pack("!256s", self.sw_desc))
9305 packed.append(struct.pack("!32s", self.serial_num))
9306 packed.append(struct.pack("!256s", self.dp_desc))
9307 length = sum([len(x) for x in packed])
9308 packed[2] = struct.pack("!H", length)
9309 return ''.join(packed)
9310
9311 @staticmethod
9312 def unpack(reader):
9313 obj = desc_stats_reply()
9314 _version = reader.read("!B")[0]
9315 assert(_version == 4)
9316 _type = reader.read("!B")[0]
9317 assert(_type == 19)
9318 _length = reader.read("!H")[0]
9319 orig_reader = reader
9320 reader = orig_reader.slice(_length, 4)
9321 obj.xid = reader.read("!L")[0]
9322 _stats_type = reader.read("!H")[0]
9323 assert(_stats_type == 0)
9324 obj.flags = reader.read("!H")[0]
9325 reader.skip(4)
9326 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9327 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9328 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9329 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9330 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9331 return obj
9332
9333 def __eq__(self, other):
9334 if type(self) != type(other): return False
9335 if self.xid != other.xid: return False
9336 if self.flags != other.flags: return False
9337 if self.mfr_desc != other.mfr_desc: return False
9338 if self.hw_desc != other.hw_desc: return False
9339 if self.sw_desc != other.sw_desc: return False
9340 if self.serial_num != other.serial_num: return False
9341 if self.dp_desc != other.dp_desc: return False
9342 return True
9343
9344 def pretty_print(self, q):
9345 q.text("desc_stats_reply {")
9346 with q.group():
9347 with q.indent(2):
9348 q.breakable()
9349 q.text("xid = ");
9350 if self.xid != None:
9351 q.text("%#x" % self.xid)
9352 else:
9353 q.text('None')
9354 q.text(","); q.breakable()
9355 q.text("flags = ");
9356 q.text("%#x" % self.flags)
9357 q.text(","); q.breakable()
9358 q.text("mfr_desc = ");
9359 q.pp(self.mfr_desc)
9360 q.text(","); q.breakable()
9361 q.text("hw_desc = ");
9362 q.pp(self.hw_desc)
9363 q.text(","); q.breakable()
9364 q.text("sw_desc = ");
9365 q.pp(self.sw_desc)
9366 q.text(","); q.breakable()
9367 q.text("serial_num = ");
9368 q.pp(self.serial_num)
9369 q.text(","); q.breakable()
9370 q.text("dp_desc = ");
9371 q.pp(self.dp_desc)
9372 q.breakable()
9373 q.text('}')
9374
9375stats_reply.subtypes[0] = desc_stats_reply
9376
9377class desc_stats_request(stats_request):
9378 version = 4
9379 type = 18
9380 stats_type = 0
9381
9382 def __init__(self, xid=None, flags=None):
9383 if xid != None:
9384 self.xid = xid
9385 else:
9386 self.xid = None
9387 if flags != None:
9388 self.flags = flags
9389 else:
9390 self.flags = 0
9391 return
9392
9393 def pack(self):
9394 packed = []
9395 packed.append(struct.pack("!B", self.version))
9396 packed.append(struct.pack("!B", self.type))
9397 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9398 packed.append(struct.pack("!L", self.xid))
9399 packed.append(struct.pack("!H", self.stats_type))
9400 packed.append(struct.pack("!H", self.flags))
9401 packed.append('\x00' * 4)
9402 length = sum([len(x) for x in packed])
9403 packed[2] = struct.pack("!H", length)
9404 return ''.join(packed)
9405
9406 @staticmethod
9407 def unpack(reader):
9408 obj = desc_stats_request()
9409 _version = reader.read("!B")[0]
9410 assert(_version == 4)
9411 _type = reader.read("!B")[0]
9412 assert(_type == 18)
9413 _length = reader.read("!H")[0]
9414 orig_reader = reader
9415 reader = orig_reader.slice(_length, 4)
9416 obj.xid = reader.read("!L")[0]
9417 _stats_type = reader.read("!H")[0]
9418 assert(_stats_type == 0)
9419 obj.flags = reader.read("!H")[0]
9420 reader.skip(4)
9421 return obj
9422
9423 def __eq__(self, other):
9424 if type(self) != type(other): return False
9425 if self.xid != other.xid: return False
9426 if self.flags != other.flags: return False
9427 return True
9428
9429 def pretty_print(self, q):
9430 q.text("desc_stats_request {")
9431 with q.group():
9432 with q.indent(2):
9433 q.breakable()
9434 q.text("xid = ");
9435 if self.xid != None:
9436 q.text("%#x" % self.xid)
9437 else:
9438 q.text('None')
9439 q.text(","); q.breakable()
9440 q.text("flags = ");
9441 q.text("%#x" % self.flags)
9442 q.breakable()
9443 q.text('}')
9444
9445stats_request.subtypes[0] = desc_stats_request
9446
9447class echo_reply(message):
9448 version = 4
9449 type = 3
9450
9451 def __init__(self, xid=None, data=None):
9452 if xid != None:
9453 self.xid = xid
9454 else:
9455 self.xid = None
9456 if data != None:
9457 self.data = data
9458 else:
9459 self.data = ''
9460 return
9461
9462 def pack(self):
9463 packed = []
9464 packed.append(struct.pack("!B", self.version))
9465 packed.append(struct.pack("!B", self.type))
9466 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9467 packed.append(struct.pack("!L", self.xid))
9468 packed.append(self.data)
9469 length = sum([len(x) for x in packed])
9470 packed[2] = struct.pack("!H", length)
9471 return ''.join(packed)
9472
9473 @staticmethod
9474 def unpack(reader):
9475 obj = echo_reply()
9476 _version = reader.read("!B")[0]
9477 assert(_version == 4)
9478 _type = reader.read("!B")[0]
9479 assert(_type == 3)
9480 _length = reader.read("!H")[0]
9481 orig_reader = reader
9482 reader = orig_reader.slice(_length, 4)
9483 obj.xid = reader.read("!L")[0]
9484 obj.data = str(reader.read_all())
9485 return obj
9486
9487 def __eq__(self, other):
9488 if type(self) != type(other): return False
9489 if self.xid != other.xid: return False
9490 if self.data != other.data: return False
9491 return True
9492
9493 def pretty_print(self, q):
9494 q.text("echo_reply {")
9495 with q.group():
9496 with q.indent(2):
9497 q.breakable()
9498 q.text("xid = ");
9499 if self.xid != None:
9500 q.text("%#x" % self.xid)
9501 else:
9502 q.text('None')
9503 q.text(","); q.breakable()
9504 q.text("data = ");
9505 q.pp(self.data)
9506 q.breakable()
9507 q.text('}')
9508
9509message.subtypes[3] = echo_reply
9510
9511class echo_request(message):
9512 version = 4
9513 type = 2
9514
9515 def __init__(self, xid=None, data=None):
9516 if xid != None:
9517 self.xid = xid
9518 else:
9519 self.xid = None
9520 if data != None:
9521 self.data = data
9522 else:
9523 self.data = ''
9524 return
9525
9526 def pack(self):
9527 packed = []
9528 packed.append(struct.pack("!B", self.version))
9529 packed.append(struct.pack("!B", self.type))
9530 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9531 packed.append(struct.pack("!L", self.xid))
9532 packed.append(self.data)
9533 length = sum([len(x) for x in packed])
9534 packed[2] = struct.pack("!H", length)
9535 return ''.join(packed)
9536
9537 @staticmethod
9538 def unpack(reader):
9539 obj = echo_request()
9540 _version = reader.read("!B")[0]
9541 assert(_version == 4)
9542 _type = reader.read("!B")[0]
9543 assert(_type == 2)
9544 _length = reader.read("!H")[0]
9545 orig_reader = reader
9546 reader = orig_reader.slice(_length, 4)
9547 obj.xid = reader.read("!L")[0]
9548 obj.data = str(reader.read_all())
9549 return obj
9550
9551 def __eq__(self, other):
9552 if type(self) != type(other): return False
9553 if self.xid != other.xid: return False
9554 if self.data != other.data: return False
9555 return True
9556
9557 def pretty_print(self, q):
9558 q.text("echo_request {")
9559 with q.group():
9560 with q.indent(2):
9561 q.breakable()
9562 q.text("xid = ");
9563 if self.xid != None:
9564 q.text("%#x" % self.xid)
9565 else:
9566 q.text('None')
9567 q.text(","); q.breakable()
9568 q.text("data = ");
9569 q.pp(self.data)
9570 q.breakable()
9571 q.text('}')
9572
9573message.subtypes[2] = echo_request
9574
9575class features_reply(message):
9576 version = 4
9577 type = 6
9578
9579 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
9580 if xid != None:
9581 self.xid = xid
9582 else:
9583 self.xid = None
9584 if datapath_id != None:
9585 self.datapath_id = datapath_id
9586 else:
9587 self.datapath_id = 0
9588 if n_buffers != None:
9589 self.n_buffers = n_buffers
9590 else:
9591 self.n_buffers = 0
9592 if n_tables != None:
9593 self.n_tables = n_tables
9594 else:
9595 self.n_tables = 0
9596 if auxiliary_id != None:
9597 self.auxiliary_id = auxiliary_id
9598 else:
9599 self.auxiliary_id = 0
9600 if capabilities != None:
9601 self.capabilities = capabilities
9602 else:
9603 self.capabilities = 0
9604 if reserved != None:
9605 self.reserved = reserved
9606 else:
9607 self.reserved = 0
9608 return
9609
9610 def pack(self):
9611 packed = []
9612 packed.append(struct.pack("!B", self.version))
9613 packed.append(struct.pack("!B", self.type))
9614 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9615 packed.append(struct.pack("!L", self.xid))
9616 packed.append(struct.pack("!Q", self.datapath_id))
9617 packed.append(struct.pack("!L", self.n_buffers))
9618 packed.append(struct.pack("!B", self.n_tables))
9619 packed.append(struct.pack("!B", self.auxiliary_id))
9620 packed.append('\x00' * 2)
9621 packed.append(struct.pack("!L", self.capabilities))
9622 packed.append(struct.pack("!L", self.reserved))
9623 length = sum([len(x) for x in packed])
9624 packed[2] = struct.pack("!H", length)
9625 return ''.join(packed)
9626
9627 @staticmethod
9628 def unpack(reader):
9629 obj = features_reply()
9630 _version = reader.read("!B")[0]
9631 assert(_version == 4)
9632 _type = reader.read("!B")[0]
9633 assert(_type == 6)
9634 _length = reader.read("!H")[0]
9635 orig_reader = reader
9636 reader = orig_reader.slice(_length, 4)
9637 obj.xid = reader.read("!L")[0]
9638 obj.datapath_id = reader.read("!Q")[0]
9639 obj.n_buffers = reader.read("!L")[0]
9640 obj.n_tables = reader.read("!B")[0]
9641 obj.auxiliary_id = reader.read("!B")[0]
9642 reader.skip(2)
9643 obj.capabilities = reader.read("!L")[0]
9644 obj.reserved = reader.read("!L")[0]
9645 return obj
9646
9647 def __eq__(self, other):
9648 if type(self) != type(other): return False
9649 if self.xid != other.xid: return False
9650 if self.datapath_id != other.datapath_id: return False
9651 if self.n_buffers != other.n_buffers: return False
9652 if self.n_tables != other.n_tables: return False
9653 if self.auxiliary_id != other.auxiliary_id: return False
9654 if self.capabilities != other.capabilities: return False
9655 if self.reserved != other.reserved: return False
9656 return True
9657
9658 def pretty_print(self, q):
9659 q.text("features_reply {")
9660 with q.group():
9661 with q.indent(2):
9662 q.breakable()
9663 q.text("xid = ");
9664 if self.xid != None:
9665 q.text("%#x" % self.xid)
9666 else:
9667 q.text('None')
9668 q.text(","); q.breakable()
9669 q.text("datapath_id = ");
9670 q.text("%#x" % self.datapath_id)
9671 q.text(","); q.breakable()
9672 q.text("n_buffers = ");
9673 q.text("%#x" % self.n_buffers)
9674 q.text(","); q.breakable()
9675 q.text("n_tables = ");
9676 q.text("%#x" % self.n_tables)
9677 q.text(","); q.breakable()
9678 q.text("auxiliary_id = ");
9679 q.text("%#x" % self.auxiliary_id)
9680 q.text(","); q.breakable()
9681 q.text("capabilities = ");
9682 q.text("%#x" % self.capabilities)
9683 q.text(","); q.breakable()
9684 q.text("reserved = ");
9685 q.text("%#x" % self.reserved)
9686 q.breakable()
9687 q.text('}')
9688
9689message.subtypes[6] = features_reply
9690
9691class features_request(message):
9692 version = 4
9693 type = 5
9694
9695 def __init__(self, xid=None):
9696 if xid != None:
9697 self.xid = xid
9698 else:
9699 self.xid = None
9700 return
9701
9702 def pack(self):
9703 packed = []
9704 packed.append(struct.pack("!B", self.version))
9705 packed.append(struct.pack("!B", self.type))
9706 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9707 packed.append(struct.pack("!L", self.xid))
9708 length = sum([len(x) for x in packed])
9709 packed[2] = struct.pack("!H", length)
9710 return ''.join(packed)
9711
9712 @staticmethod
9713 def unpack(reader):
9714 obj = features_request()
9715 _version = reader.read("!B")[0]
9716 assert(_version == 4)
9717 _type = reader.read("!B")[0]
9718 assert(_type == 5)
9719 _length = reader.read("!H")[0]
9720 orig_reader = reader
9721 reader = orig_reader.slice(_length, 4)
9722 obj.xid = reader.read("!L")[0]
9723 return obj
9724
9725 def __eq__(self, other):
9726 if type(self) != type(other): return False
9727 if self.xid != other.xid: return False
9728 return True
9729
9730 def pretty_print(self, q):
9731 q.text("features_request {")
9732 with q.group():
9733 with q.indent(2):
9734 q.breakable()
9735 q.text("xid = ");
9736 if self.xid != None:
9737 q.text("%#x" % self.xid)
9738 else:
9739 q.text('None')
9740 q.breakable()
9741 q.text('}')
9742
9743message.subtypes[5] = features_request
9744
9745class flow_mod(message):
9746 subtypes = {}
9747
9748 version = 4
9749 type = 14
9750
9751 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):
9752 if xid != None:
9753 self.xid = xid
9754 else:
9755 self.xid = None
9756 if cookie != None:
9757 self.cookie = cookie
9758 else:
9759 self.cookie = 0
9760 if cookie_mask != None:
9761 self.cookie_mask = cookie_mask
9762 else:
9763 self.cookie_mask = 0
9764 if table_id != None:
9765 self.table_id = table_id
9766 else:
9767 self.table_id = 0
9768 if _command != None:
9769 self._command = _command
9770 else:
9771 self._command = 0
9772 if idle_timeout != None:
9773 self.idle_timeout = idle_timeout
9774 else:
9775 self.idle_timeout = 0
9776 if hard_timeout != None:
9777 self.hard_timeout = hard_timeout
9778 else:
9779 self.hard_timeout = 0
9780 if priority != None:
9781 self.priority = priority
9782 else:
9783 self.priority = 0
9784 if buffer_id != None:
9785 self.buffer_id = buffer_id
9786 else:
9787 self.buffer_id = 0
9788 if out_port != None:
9789 self.out_port = out_port
9790 else:
9791 self.out_port = 0
9792 if out_group != None:
9793 self.out_group = out_group
9794 else:
9795 self.out_group = 0
9796 if flags != None:
9797 self.flags = flags
9798 else:
9799 self.flags = 0
9800 if match != None:
9801 self.match = match
9802 else:
9803 self.match = ofp.match()
9804 if instructions != None:
9805 self.instructions = instructions
9806 else:
9807 self.instructions = []
9808 return
9809
9810 def pack(self):
9811 packed = []
9812 packed.append(struct.pack("!B", self.version))
9813 packed.append(struct.pack("!B", self.type))
9814 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9815 packed.append(struct.pack("!L", self.xid))
9816 packed.append(struct.pack("!Q", self.cookie))
9817 packed.append(struct.pack("!Q", self.cookie_mask))
9818 packed.append(struct.pack("!B", self.table_id))
9819 packed.append(util.pack_fm_cmd(self._command))
9820 packed.append(struct.pack("!H", self.idle_timeout))
9821 packed.append(struct.pack("!H", self.hard_timeout))
9822 packed.append(struct.pack("!H", self.priority))
9823 packed.append(struct.pack("!L", self.buffer_id))
9824 packed.append(util.pack_port_no(self.out_port))
9825 packed.append(struct.pack("!L", self.out_group))
9826 packed.append(struct.pack("!H", self.flags))
9827 packed.append('\x00' * 2)
9828 packed.append(self.match.pack())
9829 packed.append(loxi.generic_util.pack_list(self.instructions))
9830 length = sum([len(x) for x in packed])
9831 packed[2] = struct.pack("!H", length)
9832 return ''.join(packed)
9833
9834 @staticmethod
9835 def unpack(reader):
9836 subtype, = reader.peek('B', 25)
9837 subclass = flow_mod.subtypes.get(subtype)
9838 if subclass:
9839 return subclass.unpack(reader)
9840
9841 obj = flow_mod()
9842 _version = reader.read("!B")[0]
9843 assert(_version == 4)
9844 _type = reader.read("!B")[0]
9845 assert(_type == 14)
9846 _length = reader.read("!H")[0]
9847 orig_reader = reader
9848 reader = orig_reader.slice(_length, 4)
9849 obj.xid = reader.read("!L")[0]
9850 obj.cookie = reader.read("!Q")[0]
9851 obj.cookie_mask = reader.read("!Q")[0]
9852 obj.table_id = reader.read("!B")[0]
9853 obj._command = util.unpack_fm_cmd(reader)
9854 obj.idle_timeout = reader.read("!H")[0]
9855 obj.hard_timeout = reader.read("!H")[0]
9856 obj.priority = reader.read("!H")[0]
9857 obj.buffer_id = reader.read("!L")[0]
9858 obj.out_port = util.unpack_port_no(reader)
9859 obj.out_group = reader.read("!L")[0]
9860 obj.flags = reader.read("!H")[0]
9861 reader.skip(2)
9862 obj.match = ofp.match.unpack(reader)
9863 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
9864 return obj
9865
9866 def __eq__(self, other):
9867 if type(self) != type(other): return False
9868 if self.xid != other.xid: return False
9869 if self.cookie != other.cookie: return False
9870 if self.cookie_mask != other.cookie_mask: return False
9871 if self.table_id != other.table_id: return False
9872 if self._command != other._command: return False
9873 if self.idle_timeout != other.idle_timeout: return False
9874 if self.hard_timeout != other.hard_timeout: return False
9875 if self.priority != other.priority: return False
9876 if self.buffer_id != other.buffer_id: return False
9877 if self.out_port != other.out_port: return False
9878 if self.out_group != other.out_group: return False
9879 if self.flags != other.flags: return False
9880 if self.match != other.match: return False
9881 if self.instructions != other.instructions: return False
9882 return True
9883
9884 def pretty_print(self, q):
9885 q.text("flow_mod {")
9886 with q.group():
9887 with q.indent(2):
9888 q.breakable()
9889 q.text("xid = ");
9890 if self.xid != None:
9891 q.text("%#x" % self.xid)
9892 else:
9893 q.text('None')
9894 q.text(","); q.breakable()
9895 q.text("cookie = ");
9896 q.text("%#x" % self.cookie)
9897 q.text(","); q.breakable()
9898 q.text("cookie_mask = ");
9899 q.text("%#x" % self.cookie_mask)
9900 q.text(","); q.breakable()
9901 q.text("table_id = ");
9902 q.text("%#x" % self.table_id)
9903 q.text(","); q.breakable()
9904 q.text("idle_timeout = ");
9905 q.text("%#x" % self.idle_timeout)
9906 q.text(","); q.breakable()
9907 q.text("hard_timeout = ");
9908 q.text("%#x" % self.hard_timeout)
9909 q.text(","); q.breakable()
9910 q.text("priority = ");
9911 q.text("%#x" % self.priority)
9912 q.text(","); q.breakable()
9913 q.text("buffer_id = ");
9914 q.text("%#x" % self.buffer_id)
9915 q.text(","); q.breakable()
9916 q.text("out_port = ");
9917 q.text(util.pretty_port(self.out_port))
9918 q.text(","); q.breakable()
9919 q.text("out_group = ");
9920 q.text("%#x" % self.out_group)
9921 q.text(","); q.breakable()
9922 q.text("flags = ");
9923 q.text("%#x" % self.flags)
9924 q.text(","); q.breakable()
9925 q.text("match = ");
9926 q.pp(self.match)
9927 q.text(","); q.breakable()
9928 q.text("instructions = ");
9929 q.pp(self.instructions)
9930 q.breakable()
9931 q.text('}')
9932
9933message.subtypes[14] = flow_mod
9934
9935class flow_add(flow_mod):
9936 version = 4
9937 type = 14
9938 _command = 0
9939
9940 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
9941 if xid != None:
9942 self.xid = xid
9943 else:
9944 self.xid = None
9945 if cookie != None:
9946 self.cookie = cookie
9947 else:
9948 self.cookie = 0
9949 if cookie_mask != None:
9950 self.cookie_mask = cookie_mask
9951 else:
9952 self.cookie_mask = 0
9953 if table_id != None:
9954 self.table_id = table_id
9955 else:
9956 self.table_id = 0
9957 if idle_timeout != None:
9958 self.idle_timeout = idle_timeout
9959 else:
9960 self.idle_timeout = 0
9961 if hard_timeout != None:
9962 self.hard_timeout = hard_timeout
9963 else:
9964 self.hard_timeout = 0
9965 if priority != None:
9966 self.priority = priority
9967 else:
9968 self.priority = 0
9969 if buffer_id != None:
9970 self.buffer_id = buffer_id
9971 else:
9972 self.buffer_id = 0
9973 if out_port != None:
9974 self.out_port = out_port
9975 else:
9976 self.out_port = 0
9977 if out_group != None:
9978 self.out_group = out_group
9979 else:
9980 self.out_group = 0
9981 if flags != None:
9982 self.flags = flags
9983 else:
9984 self.flags = 0
9985 if match != None:
9986 self.match = match
9987 else:
9988 self.match = ofp.match()
9989 if instructions != None:
9990 self.instructions = instructions
9991 else:
9992 self.instructions = []
9993 return
9994
9995 def pack(self):
9996 packed = []
9997 packed.append(struct.pack("!B", self.version))
9998 packed.append(struct.pack("!B", self.type))
9999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10000 packed.append(struct.pack("!L", self.xid))
10001 packed.append(struct.pack("!Q", self.cookie))
10002 packed.append(struct.pack("!Q", self.cookie_mask))
10003 packed.append(struct.pack("!B", self.table_id))
10004 packed.append(util.pack_fm_cmd(self._command))
10005 packed.append(struct.pack("!H", self.idle_timeout))
10006 packed.append(struct.pack("!H", self.hard_timeout))
10007 packed.append(struct.pack("!H", self.priority))
10008 packed.append(struct.pack("!L", self.buffer_id))
10009 packed.append(util.pack_port_no(self.out_port))
10010 packed.append(struct.pack("!L", self.out_group))
10011 packed.append(struct.pack("!H", self.flags))
10012 packed.append('\x00' * 2)
10013 packed.append(self.match.pack())
10014 packed.append(loxi.generic_util.pack_list(self.instructions))
10015 length = sum([len(x) for x in packed])
10016 packed[2] = struct.pack("!H", length)
10017 return ''.join(packed)
10018
10019 @staticmethod
10020 def unpack(reader):
10021 obj = flow_add()
10022 _version = reader.read("!B")[0]
10023 assert(_version == 4)
10024 _type = reader.read("!B")[0]
10025 assert(_type == 14)
10026 _length = reader.read("!H")[0]
10027 orig_reader = reader
10028 reader = orig_reader.slice(_length, 4)
10029 obj.xid = reader.read("!L")[0]
10030 obj.cookie = reader.read("!Q")[0]
10031 obj.cookie_mask = reader.read("!Q")[0]
10032 obj.table_id = reader.read("!B")[0]
10033 __command = util.unpack_fm_cmd(reader)
10034 assert(__command == 0)
10035 obj.idle_timeout = reader.read("!H")[0]
10036 obj.hard_timeout = reader.read("!H")[0]
10037 obj.priority = reader.read("!H")[0]
10038 obj.buffer_id = reader.read("!L")[0]
10039 obj.out_port = util.unpack_port_no(reader)
10040 obj.out_group = reader.read("!L")[0]
10041 obj.flags = reader.read("!H")[0]
10042 reader.skip(2)
10043 obj.match = ofp.match.unpack(reader)
10044 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10045 return obj
10046
10047 def __eq__(self, other):
10048 if type(self) != type(other): return False
10049 if self.xid != other.xid: return False
10050 if self.cookie != other.cookie: return False
10051 if self.cookie_mask != other.cookie_mask: return False
10052 if self.table_id != other.table_id: return False
10053 if self.idle_timeout != other.idle_timeout: return False
10054 if self.hard_timeout != other.hard_timeout: return False
10055 if self.priority != other.priority: return False
10056 if self.buffer_id != other.buffer_id: return False
10057 if self.out_port != other.out_port: return False
10058 if self.out_group != other.out_group: return False
10059 if self.flags != other.flags: return False
10060 if self.match != other.match: return False
10061 if self.instructions != other.instructions: return False
10062 return True
10063
10064 def pretty_print(self, q):
10065 q.text("flow_add {")
10066 with q.group():
10067 with q.indent(2):
10068 q.breakable()
10069 q.text("xid = ");
10070 if self.xid != None:
10071 q.text("%#x" % self.xid)
10072 else:
10073 q.text('None')
10074 q.text(","); q.breakable()
10075 q.text("cookie = ");
10076 q.text("%#x" % self.cookie)
10077 q.text(","); q.breakable()
10078 q.text("cookie_mask = ");
10079 q.text("%#x" % self.cookie_mask)
10080 q.text(","); q.breakable()
10081 q.text("table_id = ");
10082 q.text("%#x" % self.table_id)
10083 q.text(","); q.breakable()
10084 q.text("idle_timeout = ");
10085 q.text("%#x" % self.idle_timeout)
10086 q.text(","); q.breakable()
10087 q.text("hard_timeout = ");
10088 q.text("%#x" % self.hard_timeout)
10089 q.text(","); q.breakable()
10090 q.text("priority = ");
10091 q.text("%#x" % self.priority)
10092 q.text(","); q.breakable()
10093 q.text("buffer_id = ");
10094 q.text("%#x" % self.buffer_id)
10095 q.text(","); q.breakable()
10096 q.text("out_port = ");
10097 q.text(util.pretty_port(self.out_port))
10098 q.text(","); q.breakable()
10099 q.text("out_group = ");
10100 q.text("%#x" % self.out_group)
10101 q.text(","); q.breakable()
10102 q.text("flags = ");
10103 q.text("%#x" % self.flags)
10104 q.text(","); q.breakable()
10105 q.text("match = ");
10106 q.pp(self.match)
10107 q.text(","); q.breakable()
10108 q.text("instructions = ");
10109 q.pp(self.instructions)
10110 q.breakable()
10111 q.text('}')
10112
10113flow_mod.subtypes[0] = flow_add
10114
10115class flow_delete(flow_mod):
10116 version = 4
10117 type = 14
10118 _command = 3
10119
10120 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
10121 if xid != None:
10122 self.xid = xid
10123 else:
10124 self.xid = None
10125 if cookie != None:
10126 self.cookie = cookie
10127 else:
10128 self.cookie = 0
10129 if cookie_mask != None:
10130 self.cookie_mask = cookie_mask
10131 else:
10132 self.cookie_mask = 0
10133 if table_id != None:
10134 self.table_id = table_id
10135 else:
10136 self.table_id = 0
10137 if idle_timeout != None:
10138 self.idle_timeout = idle_timeout
10139 else:
10140 self.idle_timeout = 0
10141 if hard_timeout != None:
10142 self.hard_timeout = hard_timeout
10143 else:
10144 self.hard_timeout = 0
10145 if priority != None:
10146 self.priority = priority
10147 else:
10148 self.priority = 0
10149 if buffer_id != None:
10150 self.buffer_id = buffer_id
10151 else:
10152 self.buffer_id = 0
10153 if out_port != None:
10154 self.out_port = out_port
10155 else:
10156 self.out_port = 0
10157 if out_group != None:
10158 self.out_group = out_group
10159 else:
10160 self.out_group = 0
10161 if flags != None:
10162 self.flags = flags
10163 else:
10164 self.flags = 0
10165 if match != None:
10166 self.match = match
10167 else:
10168 self.match = ofp.match()
10169 if instructions != None:
10170 self.instructions = instructions
10171 else:
10172 self.instructions = []
10173 return
10174
10175 def pack(self):
10176 packed = []
10177 packed.append(struct.pack("!B", self.version))
10178 packed.append(struct.pack("!B", self.type))
10179 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10180 packed.append(struct.pack("!L", self.xid))
10181 packed.append(struct.pack("!Q", self.cookie))
10182 packed.append(struct.pack("!Q", self.cookie_mask))
10183 packed.append(struct.pack("!B", self.table_id))
10184 packed.append(util.pack_fm_cmd(self._command))
10185 packed.append(struct.pack("!H", self.idle_timeout))
10186 packed.append(struct.pack("!H", self.hard_timeout))
10187 packed.append(struct.pack("!H", self.priority))
10188 packed.append(struct.pack("!L", self.buffer_id))
10189 packed.append(util.pack_port_no(self.out_port))
10190 packed.append(struct.pack("!L", self.out_group))
10191 packed.append(struct.pack("!H", self.flags))
10192 packed.append('\x00' * 2)
10193 packed.append(self.match.pack())
10194 packed.append(loxi.generic_util.pack_list(self.instructions))
10195 length = sum([len(x) for x in packed])
10196 packed[2] = struct.pack("!H", length)
10197 return ''.join(packed)
10198
10199 @staticmethod
10200 def unpack(reader):
10201 obj = flow_delete()
10202 _version = reader.read("!B")[0]
10203 assert(_version == 4)
10204 _type = reader.read("!B")[0]
10205 assert(_type == 14)
10206 _length = reader.read("!H")[0]
10207 orig_reader = reader
10208 reader = orig_reader.slice(_length, 4)
10209 obj.xid = reader.read("!L")[0]
10210 obj.cookie = reader.read("!Q")[0]
10211 obj.cookie_mask = reader.read("!Q")[0]
10212 obj.table_id = reader.read("!B")[0]
10213 __command = util.unpack_fm_cmd(reader)
10214 assert(__command == 3)
10215 obj.idle_timeout = reader.read("!H")[0]
10216 obj.hard_timeout = reader.read("!H")[0]
10217 obj.priority = reader.read("!H")[0]
10218 obj.buffer_id = reader.read("!L")[0]
10219 obj.out_port = util.unpack_port_no(reader)
10220 obj.out_group = reader.read("!L")[0]
10221 obj.flags = reader.read("!H")[0]
10222 reader.skip(2)
10223 obj.match = ofp.match.unpack(reader)
10224 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10225 return obj
10226
10227 def __eq__(self, other):
10228 if type(self) != type(other): return False
10229 if self.xid != other.xid: return False
10230 if self.cookie != other.cookie: return False
10231 if self.cookie_mask != other.cookie_mask: return False
10232 if self.table_id != other.table_id: return False
10233 if self.idle_timeout != other.idle_timeout: return False
10234 if self.hard_timeout != other.hard_timeout: return False
10235 if self.priority != other.priority: return False
10236 if self.buffer_id != other.buffer_id: return False
10237 if self.out_port != other.out_port: return False
10238 if self.out_group != other.out_group: return False
10239 if self.flags != other.flags: return False
10240 if self.match != other.match: return False
10241 if self.instructions != other.instructions: return False
10242 return True
10243
10244 def pretty_print(self, q):
10245 q.text("flow_delete {")
10246 with q.group():
10247 with q.indent(2):
10248 q.breakable()
10249 q.text("xid = ");
10250 if self.xid != None:
10251 q.text("%#x" % self.xid)
10252 else:
10253 q.text('None')
10254 q.text(","); q.breakable()
10255 q.text("cookie = ");
10256 q.text("%#x" % self.cookie)
10257 q.text(","); q.breakable()
10258 q.text("cookie_mask = ");
10259 q.text("%#x" % self.cookie_mask)
10260 q.text(","); q.breakable()
10261 q.text("table_id = ");
10262 q.text("%#x" % self.table_id)
10263 q.text(","); q.breakable()
10264 q.text("idle_timeout = ");
10265 q.text("%#x" % self.idle_timeout)
10266 q.text(","); q.breakable()
10267 q.text("hard_timeout = ");
10268 q.text("%#x" % self.hard_timeout)
10269 q.text(","); q.breakable()
10270 q.text("priority = ");
10271 q.text("%#x" % self.priority)
10272 q.text(","); q.breakable()
10273 q.text("buffer_id = ");
10274 q.text("%#x" % self.buffer_id)
10275 q.text(","); q.breakable()
10276 q.text("out_port = ");
10277 q.text(util.pretty_port(self.out_port))
10278 q.text(","); q.breakable()
10279 q.text("out_group = ");
10280 q.text("%#x" % self.out_group)
10281 q.text(","); q.breakable()
10282 q.text("flags = ");
10283 q.text("%#x" % self.flags)
10284 q.text(","); q.breakable()
10285 q.text("match = ");
10286 q.pp(self.match)
10287 q.text(","); q.breakable()
10288 q.text("instructions = ");
10289 q.pp(self.instructions)
10290 q.breakable()
10291 q.text('}')
10292
10293flow_mod.subtypes[3] = flow_delete
10294
10295class flow_delete_strict(flow_mod):
10296 version = 4
10297 type = 14
10298 _command = 4
10299
10300 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
10301 if xid != None:
10302 self.xid = xid
10303 else:
10304 self.xid = None
10305 if cookie != None:
10306 self.cookie = cookie
10307 else:
10308 self.cookie = 0
10309 if cookie_mask != None:
10310 self.cookie_mask = cookie_mask
10311 else:
10312 self.cookie_mask = 0
10313 if table_id != None:
10314 self.table_id = table_id
10315 else:
10316 self.table_id = 0
10317 if idle_timeout != None:
10318 self.idle_timeout = idle_timeout
10319 else:
10320 self.idle_timeout = 0
10321 if hard_timeout != None:
10322 self.hard_timeout = hard_timeout
10323 else:
10324 self.hard_timeout = 0
10325 if priority != None:
10326 self.priority = priority
10327 else:
10328 self.priority = 0
10329 if buffer_id != None:
10330 self.buffer_id = buffer_id
10331 else:
10332 self.buffer_id = 0
10333 if out_port != None:
10334 self.out_port = out_port
10335 else:
10336 self.out_port = 0
10337 if out_group != None:
10338 self.out_group = out_group
10339 else:
10340 self.out_group = 0
10341 if flags != None:
10342 self.flags = flags
10343 else:
10344 self.flags = 0
10345 if match != None:
10346 self.match = match
10347 else:
10348 self.match = ofp.match()
10349 if instructions != None:
10350 self.instructions = instructions
10351 else:
10352 self.instructions = []
10353 return
10354
10355 def pack(self):
10356 packed = []
10357 packed.append(struct.pack("!B", self.version))
10358 packed.append(struct.pack("!B", self.type))
10359 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10360 packed.append(struct.pack("!L", self.xid))
10361 packed.append(struct.pack("!Q", self.cookie))
10362 packed.append(struct.pack("!Q", self.cookie_mask))
10363 packed.append(struct.pack("!B", self.table_id))
10364 packed.append(util.pack_fm_cmd(self._command))
10365 packed.append(struct.pack("!H", self.idle_timeout))
10366 packed.append(struct.pack("!H", self.hard_timeout))
10367 packed.append(struct.pack("!H", self.priority))
10368 packed.append(struct.pack("!L", self.buffer_id))
10369 packed.append(util.pack_port_no(self.out_port))
10370 packed.append(struct.pack("!L", self.out_group))
10371 packed.append(struct.pack("!H", self.flags))
10372 packed.append('\x00' * 2)
10373 packed.append(self.match.pack())
10374 packed.append(loxi.generic_util.pack_list(self.instructions))
10375 length = sum([len(x) for x in packed])
10376 packed[2] = struct.pack("!H", length)
10377 return ''.join(packed)
10378
10379 @staticmethod
10380 def unpack(reader):
10381 obj = flow_delete_strict()
10382 _version = reader.read("!B")[0]
10383 assert(_version == 4)
10384 _type = reader.read("!B")[0]
10385 assert(_type == 14)
10386 _length = reader.read("!H")[0]
10387 orig_reader = reader
10388 reader = orig_reader.slice(_length, 4)
10389 obj.xid = reader.read("!L")[0]
10390 obj.cookie = reader.read("!Q")[0]
10391 obj.cookie_mask = reader.read("!Q")[0]
10392 obj.table_id = reader.read("!B")[0]
10393 __command = util.unpack_fm_cmd(reader)
10394 assert(__command == 4)
10395 obj.idle_timeout = reader.read("!H")[0]
10396 obj.hard_timeout = reader.read("!H")[0]
10397 obj.priority = reader.read("!H")[0]
10398 obj.buffer_id = reader.read("!L")[0]
10399 obj.out_port = util.unpack_port_no(reader)
10400 obj.out_group = reader.read("!L")[0]
10401 obj.flags = reader.read("!H")[0]
10402 reader.skip(2)
10403 obj.match = ofp.match.unpack(reader)
10404 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10405 return obj
10406
10407 def __eq__(self, other):
10408 if type(self) != type(other): return False
10409 if self.xid != other.xid: return False
10410 if self.cookie != other.cookie: return False
10411 if self.cookie_mask != other.cookie_mask: return False
10412 if self.table_id != other.table_id: return False
10413 if self.idle_timeout != other.idle_timeout: return False
10414 if self.hard_timeout != other.hard_timeout: return False
10415 if self.priority != other.priority: return False
10416 if self.buffer_id != other.buffer_id: return False
10417 if self.out_port != other.out_port: return False
10418 if self.out_group != other.out_group: return False
10419 if self.flags != other.flags: return False
10420 if self.match != other.match: return False
10421 if self.instructions != other.instructions: return False
10422 return True
10423
10424 def pretty_print(self, q):
10425 q.text("flow_delete_strict {")
10426 with q.group():
10427 with q.indent(2):
10428 q.breakable()
10429 q.text("xid = ");
10430 if self.xid != None:
10431 q.text("%#x" % self.xid)
10432 else:
10433 q.text('None')
10434 q.text(","); q.breakable()
10435 q.text("cookie = ");
10436 q.text("%#x" % self.cookie)
10437 q.text(","); q.breakable()
10438 q.text("cookie_mask = ");
10439 q.text("%#x" % self.cookie_mask)
10440 q.text(","); q.breakable()
10441 q.text("table_id = ");
10442 q.text("%#x" % self.table_id)
10443 q.text(","); q.breakable()
10444 q.text("idle_timeout = ");
10445 q.text("%#x" % self.idle_timeout)
10446 q.text(","); q.breakable()
10447 q.text("hard_timeout = ");
10448 q.text("%#x" % self.hard_timeout)
10449 q.text(","); q.breakable()
10450 q.text("priority = ");
10451 q.text("%#x" % self.priority)
10452 q.text(","); q.breakable()
10453 q.text("buffer_id = ");
10454 q.text("%#x" % self.buffer_id)
10455 q.text(","); q.breakable()
10456 q.text("out_port = ");
10457 q.text(util.pretty_port(self.out_port))
10458 q.text(","); q.breakable()
10459 q.text("out_group = ");
10460 q.text("%#x" % self.out_group)
10461 q.text(","); q.breakable()
10462 q.text("flags = ");
10463 q.text("%#x" % self.flags)
10464 q.text(","); q.breakable()
10465 q.text("match = ");
10466 q.pp(self.match)
10467 q.text(","); q.breakable()
10468 q.text("instructions = ");
10469 q.pp(self.instructions)
10470 q.breakable()
10471 q.text('}')
10472
10473flow_mod.subtypes[4] = flow_delete_strict
10474
10475class flow_mod_failed_error_msg(error_msg):
10476 version = 4
10477 type = 1
10478 err_type = 5
10479
10480 def __init__(self, xid=None, code=None, data=None):
10481 if xid != None:
10482 self.xid = xid
10483 else:
10484 self.xid = None
10485 if code != None:
10486 self.code = code
10487 else:
10488 self.code = 0
10489 if data != None:
10490 self.data = data
10491 else:
10492 self.data = ''
10493 return
10494
10495 def pack(self):
10496 packed = []
10497 packed.append(struct.pack("!B", self.version))
10498 packed.append(struct.pack("!B", self.type))
10499 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10500 packed.append(struct.pack("!L", self.xid))
10501 packed.append(struct.pack("!H", self.err_type))
10502 packed.append(struct.pack("!H", self.code))
10503 packed.append(self.data)
10504 length = sum([len(x) for x in packed])
10505 packed[2] = struct.pack("!H", length)
10506 return ''.join(packed)
10507
10508 @staticmethod
10509 def unpack(reader):
10510 obj = flow_mod_failed_error_msg()
10511 _version = reader.read("!B")[0]
10512 assert(_version == 4)
10513 _type = reader.read("!B")[0]
10514 assert(_type == 1)
10515 _length = reader.read("!H")[0]
10516 orig_reader = reader
10517 reader = orig_reader.slice(_length, 4)
10518 obj.xid = reader.read("!L")[0]
10519 _err_type = reader.read("!H")[0]
10520 assert(_err_type == 5)
10521 obj.code = reader.read("!H")[0]
10522 obj.data = str(reader.read_all())
10523 return obj
10524
10525 def __eq__(self, other):
10526 if type(self) != type(other): return False
10527 if self.xid != other.xid: return False
10528 if self.code != other.code: return False
10529 if self.data != other.data: return False
10530 return True
10531
10532 def pretty_print(self, q):
10533 q.text("flow_mod_failed_error_msg {")
10534 with q.group():
10535 with q.indent(2):
10536 q.breakable()
10537 q.text("xid = ");
10538 if self.xid != None:
10539 q.text("%#x" % self.xid)
10540 else:
10541 q.text('None')
10542 q.text(","); q.breakable()
10543 q.text("code = ");
10544 q.text("%#x" % self.code)
10545 q.text(","); q.breakable()
10546 q.text("data = ");
10547 q.pp(self.data)
10548 q.breakable()
10549 q.text('}')
10550
10551error_msg.subtypes[5] = flow_mod_failed_error_msg
10552
10553class flow_modify(flow_mod):
10554 version = 4
10555 type = 14
10556 _command = 1
10557
10558 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
10559 if xid != None:
10560 self.xid = xid
10561 else:
10562 self.xid = None
10563 if cookie != None:
10564 self.cookie = cookie
10565 else:
10566 self.cookie = 0
10567 if cookie_mask != None:
10568 self.cookie_mask = cookie_mask
10569 else:
10570 self.cookie_mask = 0
10571 if table_id != None:
10572 self.table_id = table_id
10573 else:
10574 self.table_id = 0
10575 if idle_timeout != None:
10576 self.idle_timeout = idle_timeout
10577 else:
10578 self.idle_timeout = 0
10579 if hard_timeout != None:
10580 self.hard_timeout = hard_timeout
10581 else:
10582 self.hard_timeout = 0
10583 if priority != None:
10584 self.priority = priority
10585 else:
10586 self.priority = 0
10587 if buffer_id != None:
10588 self.buffer_id = buffer_id
10589 else:
10590 self.buffer_id = 0
10591 if out_port != None:
10592 self.out_port = out_port
10593 else:
10594 self.out_port = 0
10595 if out_group != None:
10596 self.out_group = out_group
10597 else:
10598 self.out_group = 0
10599 if flags != None:
10600 self.flags = flags
10601 else:
10602 self.flags = 0
10603 if match != None:
10604 self.match = match
10605 else:
10606 self.match = ofp.match()
10607 if instructions != None:
10608 self.instructions = instructions
10609 else:
10610 self.instructions = []
10611 return
10612
10613 def pack(self):
10614 packed = []
10615 packed.append(struct.pack("!B", self.version))
10616 packed.append(struct.pack("!B", self.type))
10617 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10618 packed.append(struct.pack("!L", self.xid))
10619 packed.append(struct.pack("!Q", self.cookie))
10620 packed.append(struct.pack("!Q", self.cookie_mask))
10621 packed.append(struct.pack("!B", self.table_id))
10622 packed.append(util.pack_fm_cmd(self._command))
10623 packed.append(struct.pack("!H", self.idle_timeout))
10624 packed.append(struct.pack("!H", self.hard_timeout))
10625 packed.append(struct.pack("!H", self.priority))
10626 packed.append(struct.pack("!L", self.buffer_id))
10627 packed.append(util.pack_port_no(self.out_port))
10628 packed.append(struct.pack("!L", self.out_group))
10629 packed.append(struct.pack("!H", self.flags))
10630 packed.append('\x00' * 2)
10631 packed.append(self.match.pack())
10632 packed.append(loxi.generic_util.pack_list(self.instructions))
10633 length = sum([len(x) for x in packed])
10634 packed[2] = struct.pack("!H", length)
10635 return ''.join(packed)
10636
10637 @staticmethod
10638 def unpack(reader):
10639 obj = flow_modify()
10640 _version = reader.read("!B")[0]
10641 assert(_version == 4)
10642 _type = reader.read("!B")[0]
10643 assert(_type == 14)
10644 _length = reader.read("!H")[0]
10645 orig_reader = reader
10646 reader = orig_reader.slice(_length, 4)
10647 obj.xid = reader.read("!L")[0]
10648 obj.cookie = reader.read("!Q")[0]
10649 obj.cookie_mask = reader.read("!Q")[0]
10650 obj.table_id = reader.read("!B")[0]
10651 __command = util.unpack_fm_cmd(reader)
10652 assert(__command == 1)
10653 obj.idle_timeout = reader.read("!H")[0]
10654 obj.hard_timeout = reader.read("!H")[0]
10655 obj.priority = reader.read("!H")[0]
10656 obj.buffer_id = reader.read("!L")[0]
10657 obj.out_port = util.unpack_port_no(reader)
10658 obj.out_group = reader.read("!L")[0]
10659 obj.flags = reader.read("!H")[0]
10660 reader.skip(2)
10661 obj.match = ofp.match.unpack(reader)
10662 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10663 return obj
10664
10665 def __eq__(self, other):
10666 if type(self) != type(other): return False
10667 if self.xid != other.xid: return False
10668 if self.cookie != other.cookie: return False
10669 if self.cookie_mask != other.cookie_mask: return False
10670 if self.table_id != other.table_id: return False
10671 if self.idle_timeout != other.idle_timeout: return False
10672 if self.hard_timeout != other.hard_timeout: return False
10673 if self.priority != other.priority: return False
10674 if self.buffer_id != other.buffer_id: return False
10675 if self.out_port != other.out_port: return False
10676 if self.out_group != other.out_group: return False
10677 if self.flags != other.flags: return False
10678 if self.match != other.match: return False
10679 if self.instructions != other.instructions: return False
10680 return True
10681
10682 def pretty_print(self, q):
10683 q.text("flow_modify {")
10684 with q.group():
10685 with q.indent(2):
10686 q.breakable()
10687 q.text("xid = ");
10688 if self.xid != None:
10689 q.text("%#x" % self.xid)
10690 else:
10691 q.text('None')
10692 q.text(","); q.breakable()
10693 q.text("cookie = ");
10694 q.text("%#x" % self.cookie)
10695 q.text(","); q.breakable()
10696 q.text("cookie_mask = ");
10697 q.text("%#x" % self.cookie_mask)
10698 q.text(","); q.breakable()
10699 q.text("table_id = ");
10700 q.text("%#x" % self.table_id)
10701 q.text(","); q.breakable()
10702 q.text("idle_timeout = ");
10703 q.text("%#x" % self.idle_timeout)
10704 q.text(","); q.breakable()
10705 q.text("hard_timeout = ");
10706 q.text("%#x" % self.hard_timeout)
10707 q.text(","); q.breakable()
10708 q.text("priority = ");
10709 q.text("%#x" % self.priority)
10710 q.text(","); q.breakable()
10711 q.text("buffer_id = ");
10712 q.text("%#x" % self.buffer_id)
10713 q.text(","); q.breakable()
10714 q.text("out_port = ");
10715 q.text(util.pretty_port(self.out_port))
10716 q.text(","); q.breakable()
10717 q.text("out_group = ");
10718 q.text("%#x" % self.out_group)
10719 q.text(","); q.breakable()
10720 q.text("flags = ");
10721 q.text("%#x" % self.flags)
10722 q.text(","); q.breakable()
10723 q.text("match = ");
10724 q.pp(self.match)
10725 q.text(","); q.breakable()
10726 q.text("instructions = ");
10727 q.pp(self.instructions)
10728 q.breakable()
10729 q.text('}')
10730
10731flow_mod.subtypes[1] = flow_modify
10732
10733class flow_modify_strict(flow_mod):
10734 version = 4
10735 type = 14
10736 _command = 2
10737
10738 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
10739 if xid != None:
10740 self.xid = xid
10741 else:
10742 self.xid = None
10743 if cookie != None:
10744 self.cookie = cookie
10745 else:
10746 self.cookie = 0
10747 if cookie_mask != None:
10748 self.cookie_mask = cookie_mask
10749 else:
10750 self.cookie_mask = 0
10751 if table_id != None:
10752 self.table_id = table_id
10753 else:
10754 self.table_id = 0
10755 if idle_timeout != None:
10756 self.idle_timeout = idle_timeout
10757 else:
10758 self.idle_timeout = 0
10759 if hard_timeout != None:
10760 self.hard_timeout = hard_timeout
10761 else:
10762 self.hard_timeout = 0
10763 if priority != None:
10764 self.priority = priority
10765 else:
10766 self.priority = 0
10767 if buffer_id != None:
10768 self.buffer_id = buffer_id
10769 else:
10770 self.buffer_id = 0
10771 if out_port != None:
10772 self.out_port = out_port
10773 else:
10774 self.out_port = 0
10775 if out_group != None:
10776 self.out_group = out_group
10777 else:
10778 self.out_group = 0
10779 if flags != None:
10780 self.flags = flags
10781 else:
10782 self.flags = 0
10783 if match != None:
10784 self.match = match
10785 else:
10786 self.match = ofp.match()
10787 if instructions != None:
10788 self.instructions = instructions
10789 else:
10790 self.instructions = []
10791 return
10792
10793 def pack(self):
10794 packed = []
10795 packed.append(struct.pack("!B", self.version))
10796 packed.append(struct.pack("!B", self.type))
10797 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10798 packed.append(struct.pack("!L", self.xid))
10799 packed.append(struct.pack("!Q", self.cookie))
10800 packed.append(struct.pack("!Q", self.cookie_mask))
10801 packed.append(struct.pack("!B", self.table_id))
10802 packed.append(util.pack_fm_cmd(self._command))
10803 packed.append(struct.pack("!H", self.idle_timeout))
10804 packed.append(struct.pack("!H", self.hard_timeout))
10805 packed.append(struct.pack("!H", self.priority))
10806 packed.append(struct.pack("!L", self.buffer_id))
10807 packed.append(util.pack_port_no(self.out_port))
10808 packed.append(struct.pack("!L", self.out_group))
10809 packed.append(struct.pack("!H", self.flags))
10810 packed.append('\x00' * 2)
10811 packed.append(self.match.pack())
10812 packed.append(loxi.generic_util.pack_list(self.instructions))
10813 length = sum([len(x) for x in packed])
10814 packed[2] = struct.pack("!H", length)
10815 return ''.join(packed)
10816
10817 @staticmethod
10818 def unpack(reader):
10819 obj = flow_modify_strict()
10820 _version = reader.read("!B")[0]
10821 assert(_version == 4)
10822 _type = reader.read("!B")[0]
10823 assert(_type == 14)
10824 _length = reader.read("!H")[0]
10825 orig_reader = reader
10826 reader = orig_reader.slice(_length, 4)
10827 obj.xid = reader.read("!L")[0]
10828 obj.cookie = reader.read("!Q")[0]
10829 obj.cookie_mask = reader.read("!Q")[0]
10830 obj.table_id = reader.read("!B")[0]
10831 __command = util.unpack_fm_cmd(reader)
10832 assert(__command == 2)
10833 obj.idle_timeout = reader.read("!H")[0]
10834 obj.hard_timeout = reader.read("!H")[0]
10835 obj.priority = reader.read("!H")[0]
10836 obj.buffer_id = reader.read("!L")[0]
10837 obj.out_port = util.unpack_port_no(reader)
10838 obj.out_group = reader.read("!L")[0]
10839 obj.flags = reader.read("!H")[0]
10840 reader.skip(2)
10841 obj.match = ofp.match.unpack(reader)
10842 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
10843 return obj
10844
10845 def __eq__(self, other):
10846 if type(self) != type(other): return False
10847 if self.xid != other.xid: return False
10848 if self.cookie != other.cookie: return False
10849 if self.cookie_mask != other.cookie_mask: return False
10850 if self.table_id != other.table_id: return False
10851 if self.idle_timeout != other.idle_timeout: return False
10852 if self.hard_timeout != other.hard_timeout: return False
10853 if self.priority != other.priority: return False
10854 if self.buffer_id != other.buffer_id: return False
10855 if self.out_port != other.out_port: return False
10856 if self.out_group != other.out_group: return False
10857 if self.flags != other.flags: return False
10858 if self.match != other.match: return False
10859 if self.instructions != other.instructions: return False
10860 return True
10861
10862 def pretty_print(self, q):
10863 q.text("flow_modify_strict {")
10864 with q.group():
10865 with q.indent(2):
10866 q.breakable()
10867 q.text("xid = ");
10868 if self.xid != None:
10869 q.text("%#x" % self.xid)
10870 else:
10871 q.text('None')
10872 q.text(","); q.breakable()
10873 q.text("cookie = ");
10874 q.text("%#x" % self.cookie)
10875 q.text(","); q.breakable()
10876 q.text("cookie_mask = ");
10877 q.text("%#x" % self.cookie_mask)
10878 q.text(","); q.breakable()
10879 q.text("table_id = ");
10880 q.text("%#x" % self.table_id)
10881 q.text(","); q.breakable()
10882 q.text("idle_timeout = ");
10883 q.text("%#x" % self.idle_timeout)
10884 q.text(","); q.breakable()
10885 q.text("hard_timeout = ");
10886 q.text("%#x" % self.hard_timeout)
10887 q.text(","); q.breakable()
10888 q.text("priority = ");
10889 q.text("%#x" % self.priority)
10890 q.text(","); q.breakable()
10891 q.text("buffer_id = ");
10892 q.text("%#x" % self.buffer_id)
10893 q.text(","); q.breakable()
10894 q.text("out_port = ");
10895 q.text(util.pretty_port(self.out_port))
10896 q.text(","); q.breakable()
10897 q.text("out_group = ");
10898 q.text("%#x" % self.out_group)
10899 q.text(","); q.breakable()
10900 q.text("flags = ");
10901 q.text("%#x" % self.flags)
10902 q.text(","); q.breakable()
10903 q.text("match = ");
10904 q.pp(self.match)
10905 q.text(","); q.breakable()
10906 q.text("instructions = ");
10907 q.pp(self.instructions)
10908 q.breakable()
10909 q.text('}')
10910
10911flow_mod.subtypes[2] = flow_modify_strict
10912
10913class flow_removed(message):
10914 version = 4
10915 type = 11
10916
10917 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):
10918 if xid != None:
10919 self.xid = xid
10920 else:
10921 self.xid = None
10922 if cookie != None:
10923 self.cookie = cookie
10924 else:
10925 self.cookie = 0
10926 if priority != None:
10927 self.priority = priority
10928 else:
10929 self.priority = 0
10930 if reason != None:
10931 self.reason = reason
10932 else:
10933 self.reason = 0
10934 if table_id != None:
10935 self.table_id = table_id
10936 else:
10937 self.table_id = 0
10938 if duration_sec != None:
10939 self.duration_sec = duration_sec
10940 else:
10941 self.duration_sec = 0
10942 if duration_nsec != None:
10943 self.duration_nsec = duration_nsec
10944 else:
10945 self.duration_nsec = 0
10946 if idle_timeout != None:
10947 self.idle_timeout = idle_timeout
10948 else:
10949 self.idle_timeout = 0
10950 if hard_timeout != None:
10951 self.hard_timeout = hard_timeout
10952 else:
10953 self.hard_timeout = 0
10954 if packet_count != None:
10955 self.packet_count = packet_count
10956 else:
10957 self.packet_count = 0
10958 if byte_count != None:
10959 self.byte_count = byte_count
10960 else:
10961 self.byte_count = 0
10962 if match != None:
10963 self.match = match
10964 else:
10965 self.match = ofp.match()
10966 return
10967
10968 def pack(self):
10969 packed = []
10970 packed.append(struct.pack("!B", self.version))
10971 packed.append(struct.pack("!B", self.type))
10972 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10973 packed.append(struct.pack("!L", self.xid))
10974 packed.append(struct.pack("!Q", self.cookie))
10975 packed.append(struct.pack("!H", self.priority))
10976 packed.append(struct.pack("!B", self.reason))
10977 packed.append(struct.pack("!B", self.table_id))
10978 packed.append(struct.pack("!L", self.duration_sec))
10979 packed.append(struct.pack("!L", self.duration_nsec))
10980 packed.append(struct.pack("!H", self.idle_timeout))
10981 packed.append(struct.pack("!H", self.hard_timeout))
10982 packed.append(struct.pack("!Q", self.packet_count))
10983 packed.append(struct.pack("!Q", self.byte_count))
10984 packed.append(self.match.pack())
10985 length = sum([len(x) for x in packed])
10986 packed[2] = struct.pack("!H", length)
10987 return ''.join(packed)
10988
10989 @staticmethod
10990 def unpack(reader):
10991 obj = flow_removed()
10992 _version = reader.read("!B")[0]
10993 assert(_version == 4)
10994 _type = reader.read("!B")[0]
10995 assert(_type == 11)
10996 _length = reader.read("!H")[0]
10997 orig_reader = reader
10998 reader = orig_reader.slice(_length, 4)
10999 obj.xid = reader.read("!L")[0]
11000 obj.cookie = reader.read("!Q")[0]
11001 obj.priority = reader.read("!H")[0]
11002 obj.reason = reader.read("!B")[0]
11003 obj.table_id = reader.read("!B")[0]
11004 obj.duration_sec = reader.read("!L")[0]
11005 obj.duration_nsec = reader.read("!L")[0]
11006 obj.idle_timeout = reader.read("!H")[0]
11007 obj.hard_timeout = reader.read("!H")[0]
11008 obj.packet_count = reader.read("!Q")[0]
11009 obj.byte_count = reader.read("!Q")[0]
11010 obj.match = ofp.match.unpack(reader)
11011 return obj
11012
11013 def __eq__(self, other):
11014 if type(self) != type(other): return False
11015 if self.xid != other.xid: return False
11016 if self.cookie != other.cookie: return False
11017 if self.priority != other.priority: return False
11018 if self.reason != other.reason: return False
11019 if self.table_id != other.table_id: return False
11020 if self.duration_sec != other.duration_sec: return False
11021 if self.duration_nsec != other.duration_nsec: return False
11022 if self.idle_timeout != other.idle_timeout: return False
11023 if self.hard_timeout != other.hard_timeout: return False
11024 if self.packet_count != other.packet_count: return False
11025 if self.byte_count != other.byte_count: return False
11026 if self.match != other.match: return False
11027 return True
11028
11029 def pretty_print(self, q):
11030 q.text("flow_removed {")
11031 with q.group():
11032 with q.indent(2):
11033 q.breakable()
11034 q.text("xid = ");
11035 if self.xid != None:
11036 q.text("%#x" % self.xid)
11037 else:
11038 q.text('None')
11039 q.text(","); q.breakable()
11040 q.text("cookie = ");
11041 q.text("%#x" % self.cookie)
11042 q.text(","); q.breakable()
11043 q.text("priority = ");
11044 q.text("%#x" % self.priority)
11045 q.text(","); q.breakable()
11046 q.text("reason = ");
11047 q.text("%#x" % self.reason)
11048 q.text(","); q.breakable()
11049 q.text("table_id = ");
11050 q.text("%#x" % self.table_id)
11051 q.text(","); q.breakable()
11052 q.text("duration_sec = ");
11053 q.text("%#x" % self.duration_sec)
11054 q.text(","); q.breakable()
11055 q.text("duration_nsec = ");
11056 q.text("%#x" % self.duration_nsec)
11057 q.text(","); q.breakable()
11058 q.text("idle_timeout = ");
11059 q.text("%#x" % self.idle_timeout)
11060 q.text(","); q.breakable()
11061 q.text("hard_timeout = ");
11062 q.text("%#x" % self.hard_timeout)
11063 q.text(","); q.breakable()
11064 q.text("packet_count = ");
11065 q.text("%#x" % self.packet_count)
11066 q.text(","); q.breakable()
11067 q.text("byte_count = ");
11068 q.text("%#x" % self.byte_count)
11069 q.text(","); q.breakable()
11070 q.text("match = ");
11071 q.pp(self.match)
11072 q.breakable()
11073 q.text('}')
11074
11075message.subtypes[11] = flow_removed
11076
11077class flow_stats_reply(stats_reply):
11078 version = 4
11079 type = 19
11080 stats_type = 1
11081
11082 def __init__(self, xid=None, flags=None, entries=None):
11083 if xid != None:
11084 self.xid = xid
11085 else:
11086 self.xid = None
11087 if flags != None:
11088 self.flags = flags
11089 else:
11090 self.flags = 0
11091 if entries != None:
11092 self.entries = entries
11093 else:
11094 self.entries = []
11095 return
11096
11097 def pack(self):
11098 packed = []
11099 packed.append(struct.pack("!B", self.version))
11100 packed.append(struct.pack("!B", self.type))
11101 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11102 packed.append(struct.pack("!L", self.xid))
11103 packed.append(struct.pack("!H", self.stats_type))
11104 packed.append(struct.pack("!H", self.flags))
11105 packed.append('\x00' * 4)
11106 packed.append(loxi.generic_util.pack_list(self.entries))
11107 length = sum([len(x) for x in packed])
11108 packed[2] = struct.pack("!H", length)
11109 return ''.join(packed)
11110
11111 @staticmethod
11112 def unpack(reader):
11113 obj = flow_stats_reply()
11114 _version = reader.read("!B")[0]
11115 assert(_version == 4)
11116 _type = reader.read("!B")[0]
11117 assert(_type == 19)
11118 _length = reader.read("!H")[0]
11119 orig_reader = reader
11120 reader = orig_reader.slice(_length, 4)
11121 obj.xid = reader.read("!L")[0]
11122 _stats_type = reader.read("!H")[0]
11123 assert(_stats_type == 1)
11124 obj.flags = reader.read("!H")[0]
11125 reader.skip(4)
11126 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
11127 return obj
11128
11129 def __eq__(self, other):
11130 if type(self) != type(other): return False
11131 if self.xid != other.xid: return False
11132 if self.flags != other.flags: return False
11133 if self.entries != other.entries: return False
11134 return True
11135
11136 def pretty_print(self, q):
11137 q.text("flow_stats_reply {")
11138 with q.group():
11139 with q.indent(2):
11140 q.breakable()
11141 q.text("xid = ");
11142 if self.xid != None:
11143 q.text("%#x" % self.xid)
11144 else:
11145 q.text('None')
11146 q.text(","); q.breakable()
11147 q.text("flags = ");
11148 q.text("%#x" % self.flags)
11149 q.text(","); q.breakable()
11150 q.text("entries = ");
11151 q.pp(self.entries)
11152 q.breakable()
11153 q.text('}')
11154
11155stats_reply.subtypes[1] = flow_stats_reply
11156
11157class flow_stats_request(stats_request):
11158 version = 4
11159 type = 18
11160 stats_type = 1
11161
11162 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
11163 if xid != None:
11164 self.xid = xid
11165 else:
11166 self.xid = None
11167 if flags != None:
11168 self.flags = flags
11169 else:
11170 self.flags = 0
11171 if table_id != None:
11172 self.table_id = table_id
11173 else:
11174 self.table_id = 0
11175 if out_port != None:
11176 self.out_port = out_port
11177 else:
11178 self.out_port = 0
11179 if out_group != None:
11180 self.out_group = out_group
11181 else:
11182 self.out_group = 0
11183 if cookie != None:
11184 self.cookie = cookie
11185 else:
11186 self.cookie = 0
11187 if cookie_mask != None:
11188 self.cookie_mask = cookie_mask
11189 else:
11190 self.cookie_mask = 0
11191 if match != None:
11192 self.match = match
11193 else:
11194 self.match = ofp.match()
11195 return
11196
11197 def pack(self):
11198 packed = []
11199 packed.append(struct.pack("!B", self.version))
11200 packed.append(struct.pack("!B", self.type))
11201 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11202 packed.append(struct.pack("!L", self.xid))
11203 packed.append(struct.pack("!H", self.stats_type))
11204 packed.append(struct.pack("!H", self.flags))
11205 packed.append('\x00' * 4)
11206 packed.append(struct.pack("!B", self.table_id))
11207 packed.append('\x00' * 3)
11208 packed.append(util.pack_port_no(self.out_port))
11209 packed.append(struct.pack("!L", self.out_group))
11210 packed.append('\x00' * 4)
11211 packed.append(struct.pack("!Q", self.cookie))
11212 packed.append(struct.pack("!Q", self.cookie_mask))
11213 packed.append(self.match.pack())
11214 length = sum([len(x) for x in packed])
11215 packed[2] = struct.pack("!H", length)
11216 return ''.join(packed)
11217
11218 @staticmethod
11219 def unpack(reader):
11220 obj = flow_stats_request()
11221 _version = reader.read("!B")[0]
11222 assert(_version == 4)
11223 _type = reader.read("!B")[0]
11224 assert(_type == 18)
11225 _length = reader.read("!H")[0]
11226 orig_reader = reader
11227 reader = orig_reader.slice(_length, 4)
11228 obj.xid = reader.read("!L")[0]
11229 _stats_type = reader.read("!H")[0]
11230 assert(_stats_type == 1)
11231 obj.flags = reader.read("!H")[0]
11232 reader.skip(4)
11233 obj.table_id = reader.read("!B")[0]
11234 reader.skip(3)
11235 obj.out_port = util.unpack_port_no(reader)
11236 obj.out_group = reader.read("!L")[0]
11237 reader.skip(4)
11238 obj.cookie = reader.read("!Q")[0]
11239 obj.cookie_mask = reader.read("!Q")[0]
11240 obj.match = ofp.match.unpack(reader)
11241 return obj
11242
11243 def __eq__(self, other):
11244 if type(self) != type(other): return False
11245 if self.xid != other.xid: return False
11246 if self.flags != other.flags: return False
11247 if self.table_id != other.table_id: return False
11248 if self.out_port != other.out_port: return False
11249 if self.out_group != other.out_group: return False
11250 if self.cookie != other.cookie: return False
11251 if self.cookie_mask != other.cookie_mask: return False
11252 if self.match != other.match: return False
11253 return True
11254
11255 def pretty_print(self, q):
11256 q.text("flow_stats_request {")
11257 with q.group():
11258 with q.indent(2):
11259 q.breakable()
11260 q.text("xid = ");
11261 if self.xid != None:
11262 q.text("%#x" % self.xid)
11263 else:
11264 q.text('None')
11265 q.text(","); q.breakable()
11266 q.text("flags = ");
11267 q.text("%#x" % self.flags)
11268 q.text(","); q.breakable()
11269 q.text("table_id = ");
11270 q.text("%#x" % self.table_id)
11271 q.text(","); q.breakable()
11272 q.text("out_port = ");
11273 q.text(util.pretty_port(self.out_port))
11274 q.text(","); q.breakable()
11275 q.text("out_group = ");
11276 q.text("%#x" % self.out_group)
11277 q.text(","); q.breakable()
11278 q.text("cookie = ");
11279 q.text("%#x" % self.cookie)
11280 q.text(","); q.breakable()
11281 q.text("cookie_mask = ");
11282 q.text("%#x" % self.cookie_mask)
11283 q.text(","); q.breakable()
11284 q.text("match = ");
11285 q.pp(self.match)
11286 q.breakable()
11287 q.text('}')
11288
11289stats_request.subtypes[1] = flow_stats_request
11290
11291class get_config_reply(message):
11292 version = 4
11293 type = 8
11294
11295 def __init__(self, xid=None, flags=None, miss_send_len=None):
11296 if xid != None:
11297 self.xid = xid
11298 else:
11299 self.xid = None
11300 if flags != None:
11301 self.flags = flags
11302 else:
11303 self.flags = 0
11304 if miss_send_len != None:
11305 self.miss_send_len = miss_send_len
11306 else:
11307 self.miss_send_len = 0
11308 return
11309
11310 def pack(self):
11311 packed = []
11312 packed.append(struct.pack("!B", self.version))
11313 packed.append(struct.pack("!B", self.type))
11314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11315 packed.append(struct.pack("!L", self.xid))
11316 packed.append(struct.pack("!H", self.flags))
11317 packed.append(struct.pack("!H", self.miss_send_len))
11318 length = sum([len(x) for x in packed])
11319 packed[2] = struct.pack("!H", length)
11320 return ''.join(packed)
11321
11322 @staticmethod
11323 def unpack(reader):
11324 obj = get_config_reply()
11325 _version = reader.read("!B")[0]
11326 assert(_version == 4)
11327 _type = reader.read("!B")[0]
11328 assert(_type == 8)
11329 _length = reader.read("!H")[0]
11330 orig_reader = reader
11331 reader = orig_reader.slice(_length, 4)
11332 obj.xid = reader.read("!L")[0]
11333 obj.flags = reader.read("!H")[0]
11334 obj.miss_send_len = reader.read("!H")[0]
11335 return obj
11336
11337 def __eq__(self, other):
11338 if type(self) != type(other): return False
11339 if self.xid != other.xid: return False
11340 if self.flags != other.flags: return False
11341 if self.miss_send_len != other.miss_send_len: return False
11342 return True
11343
11344 def pretty_print(self, q):
11345 q.text("get_config_reply {")
11346 with q.group():
11347 with q.indent(2):
11348 q.breakable()
11349 q.text("xid = ");
11350 if self.xid != None:
11351 q.text("%#x" % self.xid)
11352 else:
11353 q.text('None')
11354 q.text(","); q.breakable()
11355 q.text("flags = ");
11356 q.text("%#x" % self.flags)
11357 q.text(","); q.breakable()
11358 q.text("miss_send_len = ");
11359 q.text("%#x" % self.miss_send_len)
11360 q.breakable()
11361 q.text('}')
11362
11363message.subtypes[8] = get_config_reply
11364
11365class get_config_request(message):
11366 version = 4
11367 type = 7
11368
11369 def __init__(self, xid=None):
11370 if xid != None:
11371 self.xid = xid
11372 else:
11373 self.xid = None
11374 return
11375
11376 def pack(self):
11377 packed = []
11378 packed.append(struct.pack("!B", self.version))
11379 packed.append(struct.pack("!B", self.type))
11380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11381 packed.append(struct.pack("!L", self.xid))
11382 length = sum([len(x) for x in packed])
11383 packed[2] = struct.pack("!H", length)
11384 return ''.join(packed)
11385
11386 @staticmethod
11387 def unpack(reader):
11388 obj = get_config_request()
11389 _version = reader.read("!B")[0]
11390 assert(_version == 4)
11391 _type = reader.read("!B")[0]
11392 assert(_type == 7)
11393 _length = reader.read("!H")[0]
11394 orig_reader = reader
11395 reader = orig_reader.slice(_length, 4)
11396 obj.xid = reader.read("!L")[0]
11397 return obj
11398
11399 def __eq__(self, other):
11400 if type(self) != type(other): return False
11401 if self.xid != other.xid: return False
11402 return True
11403
11404 def pretty_print(self, q):
11405 q.text("get_config_request {")
11406 with q.group():
11407 with q.indent(2):
11408 q.breakable()
11409 q.text("xid = ");
11410 if self.xid != None:
11411 q.text("%#x" % self.xid)
11412 else:
11413 q.text('None')
11414 q.breakable()
11415 q.text('}')
11416
11417message.subtypes[7] = get_config_request
11418
11419class group_mod(message):
11420 subtypes = {}
11421
11422 version = 4
11423 type = 15
11424
11425 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11426 if xid != None:
11427 self.xid = xid
11428 else:
11429 self.xid = None
11430 if command != None:
11431 self.command = command
11432 else:
11433 self.command = 0
11434 if group_type != None:
11435 self.group_type = group_type
11436 else:
11437 self.group_type = 0
11438 if group_id != None:
11439 self.group_id = group_id
11440 else:
11441 self.group_id = 0
11442 if buckets != None:
11443 self.buckets = buckets
11444 else:
11445 self.buckets = []
11446 return
11447
11448 def pack(self):
11449 packed = []
11450 packed.append(struct.pack("!B", self.version))
11451 packed.append(struct.pack("!B", self.type))
11452 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11453 packed.append(struct.pack("!L", self.xid))
11454 packed.append(struct.pack("!H", self.command))
11455 packed.append(struct.pack("!B", self.group_type))
11456 packed.append('\x00' * 1)
11457 packed.append(struct.pack("!L", self.group_id))
11458 packed.append(loxi.generic_util.pack_list(self.buckets))
11459 length = sum([len(x) for x in packed])
11460 packed[2] = struct.pack("!H", length)
11461 return ''.join(packed)
11462
11463 @staticmethod
11464 def unpack(reader):
11465 subtype, = reader.peek('!H', 8)
11466 subclass = group_mod.subtypes.get(subtype)
11467 if subclass:
11468 return subclass.unpack(reader)
11469
11470 obj = group_mod()
11471 _version = reader.read("!B")[0]
11472 assert(_version == 4)
11473 _type = reader.read("!B")[0]
11474 assert(_type == 15)
11475 _length = reader.read("!H")[0]
11476 orig_reader = reader
11477 reader = orig_reader.slice(_length, 4)
11478 obj.xid = reader.read("!L")[0]
11479 obj.command = reader.read("!H")[0]
11480 obj.group_type = reader.read("!B")[0]
11481 reader.skip(1)
11482 obj.group_id = reader.read("!L")[0]
11483 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
11484 return obj
11485
11486 def __eq__(self, other):
11487 if type(self) != type(other): return False
11488 if self.xid != other.xid: return False
11489 if self.command != other.command: return False
11490 if self.group_type != other.group_type: return False
11491 if self.group_id != other.group_id: return False
11492 if self.buckets != other.buckets: return False
11493 return True
11494
11495 def pretty_print(self, q):
11496 q.text("group_mod {")
11497 with q.group():
11498 with q.indent(2):
11499 q.breakable()
11500 q.text("xid = ");
11501 if self.xid != None:
11502 q.text("%#x" % self.xid)
11503 else:
11504 q.text('None')
11505 q.text(","); q.breakable()
11506 q.text("group_type = ");
11507 q.text("%#x" % self.group_type)
11508 q.text(","); q.breakable()
11509 q.text("group_id = ");
11510 q.text("%#x" % self.group_id)
11511 q.text(","); q.breakable()
11512 q.text("buckets = ");
11513 q.pp(self.buckets)
11514 q.breakable()
11515 q.text('}')
11516
11517message.subtypes[15] = group_mod
11518
11519class group_add(group_mod):
11520 version = 4
11521 type = 15
11522 command = 0
11523
11524 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11525 if xid != None:
11526 self.xid = xid
11527 else:
11528 self.xid = None
11529 if group_type != None:
11530 self.group_type = group_type
11531 else:
11532 self.group_type = 0
11533 if group_id != None:
11534 self.group_id = group_id
11535 else:
11536 self.group_id = 0
11537 if buckets != None:
11538 self.buckets = buckets
11539 else:
11540 self.buckets = []
11541 return
11542
11543 def pack(self):
11544 packed = []
11545 packed.append(struct.pack("!B", self.version))
11546 packed.append(struct.pack("!B", self.type))
11547 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11548 packed.append(struct.pack("!L", self.xid))
11549 packed.append(struct.pack("!H", self.command))
11550 packed.append(struct.pack("!B", self.group_type))
11551 packed.append('\x00' * 1)
11552 packed.append(struct.pack("!L", self.group_id))
11553 packed.append(loxi.generic_util.pack_list(self.buckets))
11554 length = sum([len(x) for x in packed])
11555 packed[2] = struct.pack("!H", length)
11556 return ''.join(packed)
11557
11558 @staticmethod
11559 def unpack(reader):
11560 obj = group_add()
11561 _version = reader.read("!B")[0]
11562 assert(_version == 4)
11563 _type = reader.read("!B")[0]
11564 assert(_type == 15)
11565 _length = reader.read("!H")[0]
11566 orig_reader = reader
11567 reader = orig_reader.slice(_length, 4)
11568 obj.xid = reader.read("!L")[0]
11569 _command = reader.read("!H")[0]
11570 assert(_command == 0)
11571 obj.group_type = reader.read("!B")[0]
11572 reader.skip(1)
11573 obj.group_id = reader.read("!L")[0]
11574 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
11575 return obj
11576
11577 def __eq__(self, other):
11578 if type(self) != type(other): return False
11579 if self.xid != other.xid: return False
11580 if self.group_type != other.group_type: return False
11581 if self.group_id != other.group_id: return False
11582 if self.buckets != other.buckets: return False
11583 return True
11584
11585 def pretty_print(self, q):
11586 q.text("group_add {")
11587 with q.group():
11588 with q.indent(2):
11589 q.breakable()
11590 q.text("xid = ");
11591 if self.xid != None:
11592 q.text("%#x" % self.xid)
11593 else:
11594 q.text('None')
11595 q.text(","); q.breakable()
11596 q.text("group_type = ");
11597 q.text("%#x" % self.group_type)
11598 q.text(","); q.breakable()
11599 q.text("group_id = ");
11600 q.text("%#x" % self.group_id)
11601 q.text(","); q.breakable()
11602 q.text("buckets = ");
11603 q.pp(self.buckets)
11604 q.breakable()
11605 q.text('}')
11606
11607group_mod.subtypes[0] = group_add
11608
11609class group_delete(group_mod):
11610 version = 4
11611 type = 15
11612 command = 2
11613
11614 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11615 if xid != None:
11616 self.xid = xid
11617 else:
11618 self.xid = None
11619 if group_type != None:
11620 self.group_type = group_type
11621 else:
11622 self.group_type = 0
11623 if group_id != None:
11624 self.group_id = group_id
11625 else:
11626 self.group_id = 0
11627 if buckets != None:
11628 self.buckets = buckets
11629 else:
11630 self.buckets = []
11631 return
11632
11633 def pack(self):
11634 packed = []
11635 packed.append(struct.pack("!B", self.version))
11636 packed.append(struct.pack("!B", self.type))
11637 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11638 packed.append(struct.pack("!L", self.xid))
11639 packed.append(struct.pack("!H", self.command))
11640 packed.append(struct.pack("!B", self.group_type))
11641 packed.append('\x00' * 1)
11642 packed.append(struct.pack("!L", self.group_id))
11643 packed.append(loxi.generic_util.pack_list(self.buckets))
11644 length = sum([len(x) for x in packed])
11645 packed[2] = struct.pack("!H", length)
11646 return ''.join(packed)
11647
11648 @staticmethod
11649 def unpack(reader):
11650 obj = group_delete()
11651 _version = reader.read("!B")[0]
11652 assert(_version == 4)
11653 _type = reader.read("!B")[0]
11654 assert(_type == 15)
11655 _length = reader.read("!H")[0]
11656 orig_reader = reader
11657 reader = orig_reader.slice(_length, 4)
11658 obj.xid = reader.read("!L")[0]
11659 _command = reader.read("!H")[0]
11660 assert(_command == 2)
11661 obj.group_type = reader.read("!B")[0]
11662 reader.skip(1)
11663 obj.group_id = reader.read("!L")[0]
11664 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
11665 return obj
11666
11667 def __eq__(self, other):
11668 if type(self) != type(other): return False
11669 if self.xid != other.xid: return False
11670 if self.group_type != other.group_type: return False
11671 if self.group_id != other.group_id: return False
11672 if self.buckets != other.buckets: return False
11673 return True
11674
11675 def pretty_print(self, q):
11676 q.text("group_delete {")
11677 with q.group():
11678 with q.indent(2):
11679 q.breakable()
11680 q.text("xid = ");
11681 if self.xid != None:
11682 q.text("%#x" % self.xid)
11683 else:
11684 q.text('None')
11685 q.text(","); q.breakable()
11686 q.text("group_type = ");
11687 q.text("%#x" % self.group_type)
11688 q.text(","); q.breakable()
11689 q.text("group_id = ");
11690 q.text("%#x" % self.group_id)
11691 q.text(","); q.breakable()
11692 q.text("buckets = ");
11693 q.pp(self.buckets)
11694 q.breakable()
11695 q.text('}')
11696
11697group_mod.subtypes[2] = group_delete
11698
11699class group_desc_stats_reply(stats_reply):
11700 version = 4
11701 type = 19
11702 stats_type = 7
11703
11704 def __init__(self, xid=None, flags=None, entries=None):
11705 if xid != None:
11706 self.xid = xid
11707 else:
11708 self.xid = None
11709 if flags != None:
11710 self.flags = flags
11711 else:
11712 self.flags = 0
11713 if entries != None:
11714 self.entries = entries
11715 else:
11716 self.entries = []
11717 return
11718
11719 def pack(self):
11720 packed = []
11721 packed.append(struct.pack("!B", self.version))
11722 packed.append(struct.pack("!B", self.type))
11723 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11724 packed.append(struct.pack("!L", self.xid))
11725 packed.append(struct.pack("!H", self.stats_type))
11726 packed.append(struct.pack("!H", self.flags))
11727 packed.append('\x00' * 4)
11728 packed.append(loxi.generic_util.pack_list(self.entries))
11729 length = sum([len(x) for x in packed])
11730 packed[2] = struct.pack("!H", length)
11731 return ''.join(packed)
11732
11733 @staticmethod
11734 def unpack(reader):
11735 obj = group_desc_stats_reply()
11736 _version = reader.read("!B")[0]
11737 assert(_version == 4)
11738 _type = reader.read("!B")[0]
11739 assert(_type == 19)
11740 _length = reader.read("!H")[0]
11741 orig_reader = reader
11742 reader = orig_reader.slice(_length, 4)
11743 obj.xid = reader.read("!L")[0]
11744 _stats_type = reader.read("!H")[0]
11745 assert(_stats_type == 7)
11746 obj.flags = reader.read("!H")[0]
11747 reader.skip(4)
11748 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
11749 return obj
11750
11751 def __eq__(self, other):
11752 if type(self) != type(other): return False
11753 if self.xid != other.xid: return False
11754 if self.flags != other.flags: return False
11755 if self.entries != other.entries: return False
11756 return True
11757
11758 def pretty_print(self, q):
11759 q.text("group_desc_stats_reply {")
11760 with q.group():
11761 with q.indent(2):
11762 q.breakable()
11763 q.text("xid = ");
11764 if self.xid != None:
11765 q.text("%#x" % self.xid)
11766 else:
11767 q.text('None')
11768 q.text(","); q.breakable()
11769 q.text("flags = ");
11770 q.text("%#x" % self.flags)
11771 q.text(","); q.breakable()
11772 q.text("entries = ");
11773 q.pp(self.entries)
11774 q.breakable()
11775 q.text('}')
11776
11777stats_reply.subtypes[7] = group_desc_stats_reply
11778
11779class group_desc_stats_request(stats_request):
11780 version = 4
11781 type = 18
11782 stats_type = 7
11783
11784 def __init__(self, xid=None, flags=None):
11785 if xid != None:
11786 self.xid = xid
11787 else:
11788 self.xid = None
11789 if flags != None:
11790 self.flags = flags
11791 else:
11792 self.flags = 0
11793 return
11794
11795 def pack(self):
11796 packed = []
11797 packed.append(struct.pack("!B", self.version))
11798 packed.append(struct.pack("!B", self.type))
11799 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11800 packed.append(struct.pack("!L", self.xid))
11801 packed.append(struct.pack("!H", self.stats_type))
11802 packed.append(struct.pack("!H", self.flags))
11803 packed.append('\x00' * 4)
11804 length = sum([len(x) for x in packed])
11805 packed[2] = struct.pack("!H", length)
11806 return ''.join(packed)
11807
11808 @staticmethod
11809 def unpack(reader):
11810 obj = group_desc_stats_request()
11811 _version = reader.read("!B")[0]
11812 assert(_version == 4)
11813 _type = reader.read("!B")[0]
11814 assert(_type == 18)
11815 _length = reader.read("!H")[0]
11816 orig_reader = reader
11817 reader = orig_reader.slice(_length, 4)
11818 obj.xid = reader.read("!L")[0]
11819 _stats_type = reader.read("!H")[0]
11820 assert(_stats_type == 7)
11821 obj.flags = reader.read("!H")[0]
11822 reader.skip(4)
11823 return obj
11824
11825 def __eq__(self, other):
11826 if type(self) != type(other): return False
11827 if self.xid != other.xid: return False
11828 if self.flags != other.flags: return False
11829 return True
11830
11831 def pretty_print(self, q):
11832 q.text("group_desc_stats_request {")
11833 with q.group():
11834 with q.indent(2):
11835 q.breakable()
11836 q.text("xid = ");
11837 if self.xid != None:
11838 q.text("%#x" % self.xid)
11839 else:
11840 q.text('None')
11841 q.text(","); q.breakable()
11842 q.text("flags = ");
11843 q.text("%#x" % self.flags)
11844 q.breakable()
11845 q.text('}')
11846
11847stats_request.subtypes[7] = group_desc_stats_request
11848
11849class group_features_stats_reply(stats_reply):
11850 version = 4
11851 type = 19
11852 stats_type = 8
11853
11854 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):
11855 if xid != None:
11856 self.xid = xid
11857 else:
11858 self.xid = None
11859 if flags != None:
11860 self.flags = flags
11861 else:
11862 self.flags = 0
11863 if types != None:
11864 self.types = types
11865 else:
11866 self.types = 0
11867 if capabilities != None:
11868 self.capabilities = capabilities
11869 else:
11870 self.capabilities = 0
11871 if max_groups_all != None:
11872 self.max_groups_all = max_groups_all
11873 else:
11874 self.max_groups_all = 0
11875 if max_groups_select != None:
11876 self.max_groups_select = max_groups_select
11877 else:
11878 self.max_groups_select = 0
11879 if max_groups_indirect != None:
11880 self.max_groups_indirect = max_groups_indirect
11881 else:
11882 self.max_groups_indirect = 0
11883 if max_groups_ff != None:
11884 self.max_groups_ff = max_groups_ff
11885 else:
11886 self.max_groups_ff = 0
11887 if actions_all != None:
11888 self.actions_all = actions_all
11889 else:
11890 self.actions_all = 0
11891 if actions_select != None:
11892 self.actions_select = actions_select
11893 else:
11894 self.actions_select = 0
11895 if actions_indirect != None:
11896 self.actions_indirect = actions_indirect
11897 else:
11898 self.actions_indirect = 0
11899 if actions_ff != None:
11900 self.actions_ff = actions_ff
11901 else:
11902 self.actions_ff = 0
11903 return
11904
11905 def pack(self):
11906 packed = []
11907 packed.append(struct.pack("!B", self.version))
11908 packed.append(struct.pack("!B", self.type))
11909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11910 packed.append(struct.pack("!L", self.xid))
11911 packed.append(struct.pack("!H", self.stats_type))
11912 packed.append(struct.pack("!H", self.flags))
11913 packed.append('\x00' * 4)
11914 packed.append(struct.pack("!L", self.types))
11915 packed.append(struct.pack("!L", self.capabilities))
11916 packed.append(struct.pack("!L", self.max_groups_all))
11917 packed.append(struct.pack("!L", self.max_groups_select))
11918 packed.append(struct.pack("!L", self.max_groups_indirect))
11919 packed.append(struct.pack("!L", self.max_groups_ff))
11920 packed.append(struct.pack("!L", self.actions_all))
11921 packed.append(struct.pack("!L", self.actions_select))
11922 packed.append(struct.pack("!L", self.actions_indirect))
11923 packed.append(struct.pack("!L", self.actions_ff))
11924 length = sum([len(x) for x in packed])
11925 packed[2] = struct.pack("!H", length)
11926 return ''.join(packed)
11927
11928 @staticmethod
11929 def unpack(reader):
11930 obj = group_features_stats_reply()
11931 _version = reader.read("!B")[0]
11932 assert(_version == 4)
11933 _type = reader.read("!B")[0]
11934 assert(_type == 19)
11935 _length = reader.read("!H")[0]
11936 orig_reader = reader
11937 reader = orig_reader.slice(_length, 4)
11938 obj.xid = reader.read("!L")[0]
11939 _stats_type = reader.read("!H")[0]
11940 assert(_stats_type == 8)
11941 obj.flags = reader.read("!H")[0]
11942 reader.skip(4)
11943 obj.types = reader.read("!L")[0]
11944 obj.capabilities = reader.read("!L")[0]
11945 obj.max_groups_all = reader.read("!L")[0]
11946 obj.max_groups_select = reader.read("!L")[0]
11947 obj.max_groups_indirect = reader.read("!L")[0]
11948 obj.max_groups_ff = reader.read("!L")[0]
11949 obj.actions_all = reader.read("!L")[0]
11950 obj.actions_select = reader.read("!L")[0]
11951 obj.actions_indirect = reader.read("!L")[0]
11952 obj.actions_ff = reader.read("!L")[0]
11953 return obj
11954
11955 def __eq__(self, other):
11956 if type(self) != type(other): return False
11957 if self.xid != other.xid: return False
11958 if self.flags != other.flags: return False
11959 if self.types != other.types: return False
11960 if self.capabilities != other.capabilities: return False
11961 if self.max_groups_all != other.max_groups_all: return False
11962 if self.max_groups_select != other.max_groups_select: return False
11963 if self.max_groups_indirect != other.max_groups_indirect: return False
11964 if self.max_groups_ff != other.max_groups_ff: return False
11965 if self.actions_all != other.actions_all: return False
11966 if self.actions_select != other.actions_select: return False
11967 if self.actions_indirect != other.actions_indirect: return False
11968 if self.actions_ff != other.actions_ff: return False
11969 return True
11970
11971 def pretty_print(self, q):
11972 q.text("group_features_stats_reply {")
11973 with q.group():
11974 with q.indent(2):
11975 q.breakable()
11976 q.text("xid = ");
11977 if self.xid != None:
11978 q.text("%#x" % self.xid)
11979 else:
11980 q.text('None')
11981 q.text(","); q.breakable()
11982 q.text("flags = ");
11983 q.text("%#x" % self.flags)
11984 q.text(","); q.breakable()
11985 q.text("types = ");
11986 q.text("%#x" % self.types)
11987 q.text(","); q.breakable()
11988 q.text("capabilities = ");
11989 q.text("%#x" % self.capabilities)
11990 q.text(","); q.breakable()
11991 q.text("max_groups_all = ");
11992 q.text("%#x" % self.max_groups_all)
11993 q.text(","); q.breakable()
11994 q.text("max_groups_select = ");
11995 q.text("%#x" % self.max_groups_select)
11996 q.text(","); q.breakable()
11997 q.text("max_groups_indirect = ");
11998 q.text("%#x" % self.max_groups_indirect)
11999 q.text(","); q.breakable()
12000 q.text("max_groups_ff = ");
12001 q.text("%#x" % self.max_groups_ff)
12002 q.text(","); q.breakable()
12003 q.text("actions_all = ");
12004 q.text("%#x" % self.actions_all)
12005 q.text(","); q.breakable()
12006 q.text("actions_select = ");
12007 q.text("%#x" % self.actions_select)
12008 q.text(","); q.breakable()
12009 q.text("actions_indirect = ");
12010 q.text("%#x" % self.actions_indirect)
12011 q.text(","); q.breakable()
12012 q.text("actions_ff = ");
12013 q.text("%#x" % self.actions_ff)
12014 q.breakable()
12015 q.text('}')
12016
12017stats_reply.subtypes[8] = group_features_stats_reply
12018
12019class group_features_stats_request(stats_request):
12020 version = 4
12021 type = 18
12022 stats_type = 8
12023
12024 def __init__(self, xid=None, flags=None):
12025 if xid != None:
12026 self.xid = xid
12027 else:
12028 self.xid = None
12029 if flags != None:
12030 self.flags = flags
12031 else:
12032 self.flags = 0
12033 return
12034
12035 def pack(self):
12036 packed = []
12037 packed.append(struct.pack("!B", self.version))
12038 packed.append(struct.pack("!B", self.type))
12039 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12040 packed.append(struct.pack("!L", self.xid))
12041 packed.append(struct.pack("!H", self.stats_type))
12042 packed.append(struct.pack("!H", self.flags))
12043 packed.append('\x00' * 4)
12044 length = sum([len(x) for x in packed])
12045 packed[2] = struct.pack("!H", length)
12046 return ''.join(packed)
12047
12048 @staticmethod
12049 def unpack(reader):
12050 obj = group_features_stats_request()
12051 _version = reader.read("!B")[0]
12052 assert(_version == 4)
12053 _type = reader.read("!B")[0]
12054 assert(_type == 18)
12055 _length = reader.read("!H")[0]
12056 orig_reader = reader
12057 reader = orig_reader.slice(_length, 4)
12058 obj.xid = reader.read("!L")[0]
12059 _stats_type = reader.read("!H")[0]
12060 assert(_stats_type == 8)
12061 obj.flags = reader.read("!H")[0]
12062 reader.skip(4)
12063 return obj
12064
12065 def __eq__(self, other):
12066 if type(self) != type(other): return False
12067 if self.xid != other.xid: return False
12068 if self.flags != other.flags: return False
12069 return True
12070
12071 def pretty_print(self, q):
12072 q.text("group_features_stats_request {")
12073 with q.group():
12074 with q.indent(2):
12075 q.breakable()
12076 q.text("xid = ");
12077 if self.xid != None:
12078 q.text("%#x" % self.xid)
12079 else:
12080 q.text('None')
12081 q.text(","); q.breakable()
12082 q.text("flags = ");
12083 q.text("%#x" % self.flags)
12084 q.breakable()
12085 q.text('}')
12086
12087stats_request.subtypes[8] = group_features_stats_request
12088
12089class group_mod_failed_error_msg(error_msg):
12090 version = 4
12091 type = 1
12092 err_type = 6
12093
12094 def __init__(self, xid=None, code=None, data=None):
12095 if xid != None:
12096 self.xid = xid
12097 else:
12098 self.xid = None
12099 if code != None:
12100 self.code = code
12101 else:
12102 self.code = 0
12103 if data != None:
12104 self.data = data
12105 else:
12106 self.data = ''
12107 return
12108
12109 def pack(self):
12110 packed = []
12111 packed.append(struct.pack("!B", self.version))
12112 packed.append(struct.pack("!B", self.type))
12113 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12114 packed.append(struct.pack("!L", self.xid))
12115 packed.append(struct.pack("!H", self.err_type))
12116 packed.append(struct.pack("!H", self.code))
12117 packed.append(self.data)
12118 length = sum([len(x) for x in packed])
12119 packed[2] = struct.pack("!H", length)
12120 return ''.join(packed)
12121
12122 @staticmethod
12123 def unpack(reader):
12124 obj = group_mod_failed_error_msg()
12125 _version = reader.read("!B")[0]
12126 assert(_version == 4)
12127 _type = reader.read("!B")[0]
12128 assert(_type == 1)
12129 _length = reader.read("!H")[0]
12130 orig_reader = reader
12131 reader = orig_reader.slice(_length, 4)
12132 obj.xid = reader.read("!L")[0]
12133 _err_type = reader.read("!H")[0]
12134 assert(_err_type == 6)
12135 obj.code = reader.read("!H")[0]
12136 obj.data = str(reader.read_all())
12137 return obj
12138
12139 def __eq__(self, other):
12140 if type(self) != type(other): return False
12141 if self.xid != other.xid: return False
12142 if self.code != other.code: return False
12143 if self.data != other.data: return False
12144 return True
12145
12146 def pretty_print(self, q):
12147 q.text("group_mod_failed_error_msg {")
12148 with q.group():
12149 with q.indent(2):
12150 q.breakable()
12151 q.text("xid = ");
12152 if self.xid != None:
12153 q.text("%#x" % self.xid)
12154 else:
12155 q.text('None')
12156 q.text(","); q.breakable()
12157 q.text("code = ");
12158 q.text("%#x" % self.code)
12159 q.text(","); q.breakable()
12160 q.text("data = ");
12161 q.pp(self.data)
12162 q.breakable()
12163 q.text('}')
12164
12165error_msg.subtypes[6] = group_mod_failed_error_msg
12166
12167class group_modify(group_mod):
12168 version = 4
12169 type = 15
12170 command = 1
12171
12172 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12173 if xid != None:
12174 self.xid = xid
12175 else:
12176 self.xid = None
12177 if group_type != None:
12178 self.group_type = group_type
12179 else:
12180 self.group_type = 0
12181 if group_id != None:
12182 self.group_id = group_id
12183 else:
12184 self.group_id = 0
12185 if buckets != None:
12186 self.buckets = buckets
12187 else:
12188 self.buckets = []
12189 return
12190
12191 def pack(self):
12192 packed = []
12193 packed.append(struct.pack("!B", self.version))
12194 packed.append(struct.pack("!B", self.type))
12195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12196 packed.append(struct.pack("!L", self.xid))
12197 packed.append(struct.pack("!H", self.command))
12198 packed.append(struct.pack("!B", self.group_type))
12199 packed.append('\x00' * 1)
12200 packed.append(struct.pack("!L", self.group_id))
12201 packed.append(loxi.generic_util.pack_list(self.buckets))
12202 length = sum([len(x) for x in packed])
12203 packed[2] = struct.pack("!H", length)
12204 return ''.join(packed)
12205
12206 @staticmethod
12207 def unpack(reader):
12208 obj = group_modify()
12209 _version = reader.read("!B")[0]
12210 assert(_version == 4)
12211 _type = reader.read("!B")[0]
12212 assert(_type == 15)
12213 _length = reader.read("!H")[0]
12214 orig_reader = reader
12215 reader = orig_reader.slice(_length, 4)
12216 obj.xid = reader.read("!L")[0]
12217 _command = reader.read("!H")[0]
12218 assert(_command == 1)
12219 obj.group_type = reader.read("!B")[0]
12220 reader.skip(1)
12221 obj.group_id = reader.read("!L")[0]
12222 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
12223 return obj
12224
12225 def __eq__(self, other):
12226 if type(self) != type(other): return False
12227 if self.xid != other.xid: return False
12228 if self.group_type != other.group_type: return False
12229 if self.group_id != other.group_id: return False
12230 if self.buckets != other.buckets: return False
12231 return True
12232
12233 def pretty_print(self, q):
12234 q.text("group_modify {")
12235 with q.group():
12236 with q.indent(2):
12237 q.breakable()
12238 q.text("xid = ");
12239 if self.xid != None:
12240 q.text("%#x" % self.xid)
12241 else:
12242 q.text('None')
12243 q.text(","); q.breakable()
12244 q.text("group_type = ");
12245 q.text("%#x" % self.group_type)
12246 q.text(","); q.breakable()
12247 q.text("group_id = ");
12248 q.text("%#x" % self.group_id)
12249 q.text(","); q.breakable()
12250 q.text("buckets = ");
12251 q.pp(self.buckets)
12252 q.breakable()
12253 q.text('}')
12254
12255group_mod.subtypes[1] = group_modify
12256
12257class group_stats_reply(stats_reply):
12258 version = 4
12259 type = 19
12260 stats_type = 6
12261
12262 def __init__(self, xid=None, flags=None, entries=None):
12263 if xid != None:
12264 self.xid = xid
12265 else:
12266 self.xid = None
12267 if flags != None:
12268 self.flags = flags
12269 else:
12270 self.flags = 0
12271 if entries != None:
12272 self.entries = entries
12273 else:
12274 self.entries = []
12275 return
12276
12277 def pack(self):
12278 packed = []
12279 packed.append(struct.pack("!B", self.version))
12280 packed.append(struct.pack("!B", self.type))
12281 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12282 packed.append(struct.pack("!L", self.xid))
12283 packed.append(struct.pack("!H", self.stats_type))
12284 packed.append(struct.pack("!H", self.flags))
12285 packed.append('\x00' * 4)
12286 packed.append(loxi.generic_util.pack_list(self.entries))
12287 length = sum([len(x) for x in packed])
12288 packed[2] = struct.pack("!H", length)
12289 return ''.join(packed)
12290
12291 @staticmethod
12292 def unpack(reader):
12293 obj = group_stats_reply()
12294 _version = reader.read("!B")[0]
12295 assert(_version == 4)
12296 _type = reader.read("!B")[0]
12297 assert(_type == 19)
12298 _length = reader.read("!H")[0]
12299 orig_reader = reader
12300 reader = orig_reader.slice(_length, 4)
12301 obj.xid = reader.read("!L")[0]
12302 _stats_type = reader.read("!H")[0]
12303 assert(_stats_type == 6)
12304 obj.flags = reader.read("!H")[0]
12305 reader.skip(4)
12306 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
12307 return obj
12308
12309 def __eq__(self, other):
12310 if type(self) != type(other): return False
12311 if self.xid != other.xid: return False
12312 if self.flags != other.flags: return False
12313 if self.entries != other.entries: return False
12314 return True
12315
12316 def pretty_print(self, q):
12317 q.text("group_stats_reply {")
12318 with q.group():
12319 with q.indent(2):
12320 q.breakable()
12321 q.text("xid = ");
12322 if self.xid != None:
12323 q.text("%#x" % self.xid)
12324 else:
12325 q.text('None')
12326 q.text(","); q.breakable()
12327 q.text("flags = ");
12328 q.text("%#x" % self.flags)
12329 q.text(","); q.breakable()
12330 q.text("entries = ");
12331 q.pp(self.entries)
12332 q.breakable()
12333 q.text('}')
12334
12335stats_reply.subtypes[6] = group_stats_reply
12336
12337class group_stats_request(stats_request):
12338 version = 4
12339 type = 18
12340 stats_type = 6
12341
12342 def __init__(self, xid=None, flags=None, group_id=None):
12343 if xid != None:
12344 self.xid = xid
12345 else:
12346 self.xid = None
12347 if flags != None:
12348 self.flags = flags
12349 else:
12350 self.flags = 0
12351 if group_id != None:
12352 self.group_id = group_id
12353 else:
12354 self.group_id = 0
12355 return
12356
12357 def pack(self):
12358 packed = []
12359 packed.append(struct.pack("!B", self.version))
12360 packed.append(struct.pack("!B", self.type))
12361 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12362 packed.append(struct.pack("!L", self.xid))
12363 packed.append(struct.pack("!H", self.stats_type))
12364 packed.append(struct.pack("!H", self.flags))
12365 packed.append('\x00' * 4)
12366 packed.append(struct.pack("!L", self.group_id))
12367 packed.append('\x00' * 4)
12368 length = sum([len(x) for x in packed])
12369 packed[2] = struct.pack("!H", length)
12370 return ''.join(packed)
12371
12372 @staticmethod
12373 def unpack(reader):
12374 obj = group_stats_request()
12375 _version = reader.read("!B")[0]
12376 assert(_version == 4)
12377 _type = reader.read("!B")[0]
12378 assert(_type == 18)
12379 _length = reader.read("!H")[0]
12380 orig_reader = reader
12381 reader = orig_reader.slice(_length, 4)
12382 obj.xid = reader.read("!L")[0]
12383 _stats_type = reader.read("!H")[0]
12384 assert(_stats_type == 6)
12385 obj.flags = reader.read("!H")[0]
12386 reader.skip(4)
12387 obj.group_id = reader.read("!L")[0]
12388 reader.skip(4)
12389 return obj
12390
12391 def __eq__(self, other):
12392 if type(self) != type(other): return False
12393 if self.xid != other.xid: return False
12394 if self.flags != other.flags: return False
12395 if self.group_id != other.group_id: return False
12396 return True
12397
12398 def pretty_print(self, q):
12399 q.text("group_stats_request {")
12400 with q.group():
12401 with q.indent(2):
12402 q.breakable()
12403 q.text("xid = ");
12404 if self.xid != None:
12405 q.text("%#x" % self.xid)
12406 else:
12407 q.text('None')
12408 q.text(","); q.breakable()
12409 q.text("flags = ");
12410 q.text("%#x" % self.flags)
12411 q.text(","); q.breakable()
12412 q.text("group_id = ");
12413 q.text("%#x" % self.group_id)
12414 q.breakable()
12415 q.text('}')
12416
12417stats_request.subtypes[6] = group_stats_request
12418
12419class hello(message):
12420 version = 4
12421 type = 0
12422
12423 def __init__(self, xid=None, elements=None):
12424 if xid != None:
12425 self.xid = xid
12426 else:
12427 self.xid = None
12428 if elements != None:
12429 self.elements = elements
12430 else:
12431 self.elements = []
12432 return
12433
12434 def pack(self):
12435 packed = []
12436 packed.append(struct.pack("!B", self.version))
12437 packed.append(struct.pack("!B", self.type))
12438 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12439 packed.append(struct.pack("!L", self.xid))
12440 packed.append(loxi.generic_util.pack_list(self.elements))
12441 length = sum([len(x) for x in packed])
12442 packed[2] = struct.pack("!H", length)
12443 return ''.join(packed)
12444
12445 @staticmethod
12446 def unpack(reader):
12447 obj = hello()
12448 _version = reader.read("!B")[0]
12449 assert(_version == 4)
12450 _type = reader.read("!B")[0]
12451 assert(_type == 0)
12452 _length = reader.read("!H")[0]
12453 orig_reader = reader
12454 reader = orig_reader.slice(_length, 4)
12455 obj.xid = reader.read("!L")[0]
12456 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
12457 return obj
12458
12459 def __eq__(self, other):
12460 if type(self) != type(other): return False
12461 if self.xid != other.xid: return False
12462 if self.elements != other.elements: return False
12463 return True
12464
12465 def pretty_print(self, q):
12466 q.text("hello {")
12467 with q.group():
12468 with q.indent(2):
12469 q.breakable()
12470 q.text("xid = ");
12471 if self.xid != None:
12472 q.text("%#x" % self.xid)
12473 else:
12474 q.text('None')
12475 q.text(","); q.breakable()
12476 q.text("elements = ");
12477 q.pp(self.elements)
12478 q.breakable()
12479 q.text('}')
12480
12481message.subtypes[0] = hello
12482
12483class hello_failed_error_msg(error_msg):
12484 version = 4
12485 type = 1
12486 err_type = 0
12487
12488 def __init__(self, xid=None, code=None, data=None):
12489 if xid != None:
12490 self.xid = xid
12491 else:
12492 self.xid = None
12493 if code != None:
12494 self.code = code
12495 else:
12496 self.code = 0
12497 if data != None:
12498 self.data = data
12499 else:
12500 self.data = ''
12501 return
12502
12503 def pack(self):
12504 packed = []
12505 packed.append(struct.pack("!B", self.version))
12506 packed.append(struct.pack("!B", self.type))
12507 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12508 packed.append(struct.pack("!L", self.xid))
12509 packed.append(struct.pack("!H", self.err_type))
12510 packed.append(struct.pack("!H", self.code))
12511 packed.append(self.data)
12512 length = sum([len(x) for x in packed])
12513 packed[2] = struct.pack("!H", length)
12514 return ''.join(packed)
12515
12516 @staticmethod
12517 def unpack(reader):
12518 obj = hello_failed_error_msg()
12519 _version = reader.read("!B")[0]
12520 assert(_version == 4)
12521 _type = reader.read("!B")[0]
12522 assert(_type == 1)
12523 _length = reader.read("!H")[0]
12524 orig_reader = reader
12525 reader = orig_reader.slice(_length, 4)
12526 obj.xid = reader.read("!L")[0]
12527 _err_type = reader.read("!H")[0]
12528 assert(_err_type == 0)
12529 obj.code = reader.read("!H")[0]
12530 obj.data = str(reader.read_all())
12531 return obj
12532
12533 def __eq__(self, other):
12534 if type(self) != type(other): return False
12535 if self.xid != other.xid: return False
12536 if self.code != other.code: return False
12537 if self.data != other.data: return False
12538 return True
12539
12540 def pretty_print(self, q):
12541 q.text("hello_failed_error_msg {")
12542 with q.group():
12543 with q.indent(2):
12544 q.breakable()
12545 q.text("xid = ");
12546 if self.xid != None:
12547 q.text("%#x" % self.xid)
12548 else:
12549 q.text('None')
12550 q.text(","); q.breakable()
12551 q.text("code = ");
12552 q.text("%#x" % self.code)
12553 q.text(","); q.breakable()
12554 q.text("data = ");
12555 q.pp(self.data)
12556 q.breakable()
12557 q.text('}')
12558
12559error_msg.subtypes[0] = hello_failed_error_msg
12560
12561class meter_config_stats_reply(stats_reply):
12562 version = 4
12563 type = 19
12564 stats_type = 10
12565
12566 def __init__(self, xid=None, flags=None, entries=None):
12567 if xid != None:
12568 self.xid = xid
12569 else:
12570 self.xid = None
12571 if flags != None:
12572 self.flags = flags
12573 else:
12574 self.flags = 0
12575 if entries != None:
12576 self.entries = entries
12577 else:
12578 self.entries = []
12579 return
12580
12581 def pack(self):
12582 packed = []
12583 packed.append(struct.pack("!B", self.version))
12584 packed.append(struct.pack("!B", self.type))
12585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12586 packed.append(struct.pack("!L", self.xid))
12587 packed.append(struct.pack("!H", self.stats_type))
12588 packed.append(struct.pack("!H", self.flags))
12589 packed.append('\x00' * 4)
12590 packed.append(loxi.generic_util.pack_list(self.entries))
12591 length = sum([len(x) for x in packed])
12592 packed[2] = struct.pack("!H", length)
12593 return ''.join(packed)
12594
12595 @staticmethod
12596 def unpack(reader):
12597 obj = meter_config_stats_reply()
12598 _version = reader.read("!B")[0]
12599 assert(_version == 4)
12600 _type = reader.read("!B")[0]
12601 assert(_type == 19)
12602 _length = reader.read("!H")[0]
12603 orig_reader = reader
12604 reader = orig_reader.slice(_length, 4)
12605 obj.xid = reader.read("!L")[0]
12606 _stats_type = reader.read("!H")[0]
12607 assert(_stats_type == 10)
12608 obj.flags = reader.read("!H")[0]
12609 reader.skip(4)
12610 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_config.unpack)
12611 return obj
12612
12613 def __eq__(self, other):
12614 if type(self) != type(other): return False
12615 if self.xid != other.xid: return False
12616 if self.flags != other.flags: return False
12617 if self.entries != other.entries: return False
12618 return True
12619
12620 def pretty_print(self, q):
12621 q.text("meter_config_stats_reply {")
12622 with q.group():
12623 with q.indent(2):
12624 q.breakable()
12625 q.text("xid = ");
12626 if self.xid != None:
12627 q.text("%#x" % self.xid)
12628 else:
12629 q.text('None')
12630 q.text(","); q.breakable()
12631 q.text("flags = ");
12632 q.text("%#x" % self.flags)
12633 q.text(","); q.breakable()
12634 q.text("entries = ");
12635 q.pp(self.entries)
12636 q.breakable()
12637 q.text('}')
12638
12639stats_reply.subtypes[10] = meter_config_stats_reply
12640
12641class meter_config_stats_request(stats_request):
12642 version = 4
12643 type = 18
12644 stats_type = 10
12645
12646 def __init__(self, xid=None, flags=None, meter_id=None):
12647 if xid != None:
12648 self.xid = xid
12649 else:
12650 self.xid = None
12651 if flags != None:
12652 self.flags = flags
12653 else:
12654 self.flags = 0
12655 if meter_id != None:
12656 self.meter_id = meter_id
12657 else:
12658 self.meter_id = 0
12659 return
12660
12661 def pack(self):
12662 packed = []
12663 packed.append(struct.pack("!B", self.version))
12664 packed.append(struct.pack("!B", self.type))
12665 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12666 packed.append(struct.pack("!L", self.xid))
12667 packed.append(struct.pack("!H", self.stats_type))
12668 packed.append(struct.pack("!H", self.flags))
12669 packed.append('\x00' * 4)
12670 packed.append(struct.pack("!L", self.meter_id))
12671 packed.append('\x00' * 4)
12672 length = sum([len(x) for x in packed])
12673 packed[2] = struct.pack("!H", length)
12674 return ''.join(packed)
12675
12676 @staticmethod
12677 def unpack(reader):
12678 obj = meter_config_stats_request()
12679 _version = reader.read("!B")[0]
12680 assert(_version == 4)
12681 _type = reader.read("!B")[0]
12682 assert(_type == 18)
12683 _length = reader.read("!H")[0]
12684 orig_reader = reader
12685 reader = orig_reader.slice(_length, 4)
12686 obj.xid = reader.read("!L")[0]
12687 _stats_type = reader.read("!H")[0]
12688 assert(_stats_type == 10)
12689 obj.flags = reader.read("!H")[0]
12690 reader.skip(4)
12691 obj.meter_id = reader.read("!L")[0]
12692 reader.skip(4)
12693 return obj
12694
12695 def __eq__(self, other):
12696 if type(self) != type(other): return False
12697 if self.xid != other.xid: return False
12698 if self.flags != other.flags: return False
12699 if self.meter_id != other.meter_id: return False
12700 return True
12701
12702 def pretty_print(self, q):
12703 q.text("meter_config_stats_request {")
12704 with q.group():
12705 with q.indent(2):
12706 q.breakable()
12707 q.text("xid = ");
12708 if self.xid != None:
12709 q.text("%#x" % self.xid)
12710 else:
12711 q.text('None')
12712 q.text(","); q.breakable()
12713 q.text("flags = ");
12714 q.text("%#x" % self.flags)
12715 q.text(","); q.breakable()
12716 q.text("meter_id = ");
12717 q.text("%#x" % self.meter_id)
12718 q.breakable()
12719 q.text('}')
12720
12721stats_request.subtypes[10] = meter_config_stats_request
12722
12723class meter_features_stats_reply(stats_reply):
12724 version = 4
12725 type = 19
12726 stats_type = 11
12727
12728 def __init__(self, xid=None, flags=None, features=None):
12729 if xid != None:
12730 self.xid = xid
12731 else:
12732 self.xid = None
12733 if flags != None:
12734 self.flags = flags
12735 else:
12736 self.flags = 0
12737 if features != None:
12738 self.features = features
12739 else:
12740 self.features = ofp.meter_features()
12741 return
12742
12743 def pack(self):
12744 packed = []
12745 packed.append(struct.pack("!B", self.version))
12746 packed.append(struct.pack("!B", self.type))
12747 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12748 packed.append(struct.pack("!L", self.xid))
12749 packed.append(struct.pack("!H", self.stats_type))
12750 packed.append(struct.pack("!H", self.flags))
12751 packed.append('\x00' * 4)
12752 packed.append(self.features.pack())
12753 length = sum([len(x) for x in packed])
12754 packed[2] = struct.pack("!H", length)
12755 return ''.join(packed)
12756
12757 @staticmethod
12758 def unpack(reader):
12759 obj = meter_features_stats_reply()
12760 _version = reader.read("!B")[0]
12761 assert(_version == 4)
12762 _type = reader.read("!B")[0]
12763 assert(_type == 19)
12764 _length = reader.read("!H")[0]
12765 orig_reader = reader
12766 reader = orig_reader.slice(_length, 4)
12767 obj.xid = reader.read("!L")[0]
12768 _stats_type = reader.read("!H")[0]
12769 assert(_stats_type == 11)
12770 obj.flags = reader.read("!H")[0]
12771 reader.skip(4)
12772 obj.features = ofp.meter_features.unpack(reader)
12773 return obj
12774
12775 def __eq__(self, other):
12776 if type(self) != type(other): return False
12777 if self.xid != other.xid: return False
12778 if self.flags != other.flags: return False
12779 if self.features != other.features: return False
12780 return True
12781
12782 def pretty_print(self, q):
12783 q.text("meter_features_stats_reply {")
12784 with q.group():
12785 with q.indent(2):
12786 q.breakable()
12787 q.text("xid = ");
12788 if self.xid != None:
12789 q.text("%#x" % self.xid)
12790 else:
12791 q.text('None')
12792 q.text(","); q.breakable()
12793 q.text("flags = ");
12794 q.text("%#x" % self.flags)
12795 q.text(","); q.breakable()
12796 q.text("features = ");
12797 q.pp(self.features)
12798 q.breakable()
12799 q.text('}')
12800
12801stats_reply.subtypes[11] = meter_features_stats_reply
12802
12803class meter_features_stats_request(stats_request):
12804 version = 4
12805 type = 18
12806 stats_type = 11
12807
12808 def __init__(self, xid=None, flags=None):
12809 if xid != None:
12810 self.xid = xid
12811 else:
12812 self.xid = None
12813 if flags != None:
12814 self.flags = flags
12815 else:
12816 self.flags = 0
12817 return
12818
12819 def pack(self):
12820 packed = []
12821 packed.append(struct.pack("!B", self.version))
12822 packed.append(struct.pack("!B", self.type))
12823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12824 packed.append(struct.pack("!L", self.xid))
12825 packed.append(struct.pack("!H", self.stats_type))
12826 packed.append(struct.pack("!H", self.flags))
12827 packed.append('\x00' * 4)
12828 length = sum([len(x) for x in packed])
12829 packed[2] = struct.pack("!H", length)
12830 return ''.join(packed)
12831
12832 @staticmethod
12833 def unpack(reader):
12834 obj = meter_features_stats_request()
12835 _version = reader.read("!B")[0]
12836 assert(_version == 4)
12837 _type = reader.read("!B")[0]
12838 assert(_type == 18)
12839 _length = reader.read("!H")[0]
12840 orig_reader = reader
12841 reader = orig_reader.slice(_length, 4)
12842 obj.xid = reader.read("!L")[0]
12843 _stats_type = reader.read("!H")[0]
12844 assert(_stats_type == 11)
12845 obj.flags = reader.read("!H")[0]
12846 reader.skip(4)
12847 return obj
12848
12849 def __eq__(self, other):
12850 if type(self) != type(other): return False
12851 if self.xid != other.xid: return False
12852 if self.flags != other.flags: return False
12853 return True
12854
12855 def pretty_print(self, q):
12856 q.text("meter_features_stats_request {")
12857 with q.group():
12858 with q.indent(2):
12859 q.breakable()
12860 q.text("xid = ");
12861 if self.xid != None:
12862 q.text("%#x" % self.xid)
12863 else:
12864 q.text('None')
12865 q.text(","); q.breakable()
12866 q.text("flags = ");
12867 q.text("%#x" % self.flags)
12868 q.breakable()
12869 q.text('}')
12870
12871stats_request.subtypes[11] = meter_features_stats_request
12872
12873class meter_mod(message):
12874 version = 4
12875 type = 29
12876
12877 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
12878 if xid != None:
12879 self.xid = xid
12880 else:
12881 self.xid = None
12882 if command != None:
12883 self.command = command
12884 else:
12885 self.command = 0
12886 if flags != None:
12887 self.flags = flags
12888 else:
12889 self.flags = 0
12890 if meter_id != None:
12891 self.meter_id = meter_id
12892 else:
12893 self.meter_id = 0
12894 if meters != None:
12895 self.meters = meters
12896 else:
12897 self.meters = []
12898 return
12899
12900 def pack(self):
12901 packed = []
12902 packed.append(struct.pack("!B", self.version))
12903 packed.append(struct.pack("!B", self.type))
12904 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12905 packed.append(struct.pack("!L", self.xid))
12906 packed.append(struct.pack("!H", self.command))
12907 packed.append(struct.pack("!H", self.flags))
12908 packed.append(struct.pack("!L", self.meter_id))
12909 packed.append(loxi.generic_util.pack_list(self.meters))
12910 length = sum([len(x) for x in packed])
12911 packed[2] = struct.pack("!H", length)
12912 return ''.join(packed)
12913
12914 @staticmethod
12915 def unpack(reader):
12916 obj = meter_mod()
12917 _version = reader.read("!B")[0]
12918 assert(_version == 4)
12919 _type = reader.read("!B")[0]
12920 assert(_type == 29)
12921 _length = reader.read("!H")[0]
12922 orig_reader = reader
12923 reader = orig_reader.slice(_length, 4)
12924 obj.xid = reader.read("!L")[0]
12925 obj.command = reader.read("!H")[0]
12926 obj.flags = reader.read("!H")[0]
12927 obj.meter_id = reader.read("!L")[0]
12928 obj.meters = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
12929 return obj
12930
12931 def __eq__(self, other):
12932 if type(self) != type(other): return False
12933 if self.xid != other.xid: return False
12934 if self.command != other.command: return False
12935 if self.flags != other.flags: return False
12936 if self.meter_id != other.meter_id: return False
12937 if self.meters != other.meters: return False
12938 return True
12939
12940 def pretty_print(self, q):
12941 q.text("meter_mod {")
12942 with q.group():
12943 with q.indent(2):
12944 q.breakable()
12945 q.text("xid = ");
12946 if self.xid != None:
12947 q.text("%#x" % self.xid)
12948 else:
12949 q.text('None')
12950 q.text(","); q.breakable()
12951 q.text("command = ");
12952 q.text("%#x" % self.command)
12953 q.text(","); q.breakable()
12954 q.text("flags = ");
12955 q.text("%#x" % self.flags)
12956 q.text(","); q.breakable()
12957 q.text("meter_id = ");
12958 q.text("%#x" % self.meter_id)
12959 q.text(","); q.breakable()
12960 q.text("meters = ");
12961 q.pp(self.meters)
12962 q.breakable()
12963 q.text('}')
12964
12965message.subtypes[29] = meter_mod
12966
12967class meter_mod_failed_error_msg(error_msg):
12968 version = 4
12969 type = 1
12970 err_type = 12
12971
12972 def __init__(self, xid=None, code=None, data=None):
12973 if xid != None:
12974 self.xid = xid
12975 else:
12976 self.xid = None
12977 if code != None:
12978 self.code = code
12979 else:
12980 self.code = 0
12981 if data != None:
12982 self.data = data
12983 else:
12984 self.data = ''
12985 return
12986
12987 def pack(self):
12988 packed = []
12989 packed.append(struct.pack("!B", self.version))
12990 packed.append(struct.pack("!B", self.type))
12991 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12992 packed.append(struct.pack("!L", self.xid))
12993 packed.append(struct.pack("!H", self.err_type))
12994 packed.append(struct.pack("!H", self.code))
12995 packed.append(self.data)
12996 length = sum([len(x) for x in packed])
12997 packed[2] = struct.pack("!H", length)
12998 return ''.join(packed)
12999
13000 @staticmethod
13001 def unpack(reader):
13002 obj = meter_mod_failed_error_msg()
13003 _version = reader.read("!B")[0]
13004 assert(_version == 4)
13005 _type = reader.read("!B")[0]
13006 assert(_type == 1)
13007 _length = reader.read("!H")[0]
13008 orig_reader = reader
13009 reader = orig_reader.slice(_length, 4)
13010 obj.xid = reader.read("!L")[0]
13011 _err_type = reader.read("!H")[0]
13012 assert(_err_type == 12)
13013 obj.code = reader.read("!H")[0]
13014 obj.data = str(reader.read_all())
13015 return obj
13016
13017 def __eq__(self, other):
13018 if type(self) != type(other): return False
13019 if self.xid != other.xid: return False
13020 if self.code != other.code: return False
13021 if self.data != other.data: return False
13022 return True
13023
13024 def pretty_print(self, q):
13025 q.text("meter_mod_failed_error_msg {")
13026 with q.group():
13027 with q.indent(2):
13028 q.breakable()
13029 q.text("xid = ");
13030 if self.xid != None:
13031 q.text("%#x" % self.xid)
13032 else:
13033 q.text('None')
13034 q.text(","); q.breakable()
13035 q.text("code = ");
13036 q.text("%#x" % self.code)
13037 q.text(","); q.breakable()
13038 q.text("data = ");
13039 q.pp(self.data)
13040 q.breakable()
13041 q.text('}')
13042
13043error_msg.subtypes[12] = meter_mod_failed_error_msg
13044
13045class meter_stats_reply(stats_reply):
13046 version = 4
13047 type = 19
13048 stats_type = 9
13049
13050 def __init__(self, xid=None, flags=None, entries=None):
13051 if xid != None:
13052 self.xid = xid
13053 else:
13054 self.xid = None
13055 if flags != None:
13056 self.flags = flags
13057 else:
13058 self.flags = 0
13059 if entries != None:
13060 self.entries = entries
13061 else:
13062 self.entries = []
13063 return
13064
13065 def pack(self):
13066 packed = []
13067 packed.append(struct.pack("!B", self.version))
13068 packed.append(struct.pack("!B", self.type))
13069 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13070 packed.append(struct.pack("!L", self.xid))
13071 packed.append(struct.pack("!H", self.stats_type))
13072 packed.append(struct.pack("!H", self.flags))
13073 packed.append('\x00' * 4)
13074 packed.append(loxi.generic_util.pack_list(self.entries))
13075 length = sum([len(x) for x in packed])
13076 packed[2] = struct.pack("!H", length)
13077 return ''.join(packed)
13078
13079 @staticmethod
13080 def unpack(reader):
13081 obj = meter_stats_reply()
13082 _version = reader.read("!B")[0]
13083 assert(_version == 4)
13084 _type = reader.read("!B")[0]
13085 assert(_type == 19)
13086 _length = reader.read("!H")[0]
13087 orig_reader = reader
13088 reader = orig_reader.slice(_length, 4)
13089 obj.xid = reader.read("!L")[0]
13090 _stats_type = reader.read("!H")[0]
13091 assert(_stats_type == 9)
13092 obj.flags = reader.read("!H")[0]
13093 reader.skip(4)
13094 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
13095 return obj
13096
13097 def __eq__(self, other):
13098 if type(self) != type(other): return False
13099 if self.xid != other.xid: return False
13100 if self.flags != other.flags: return False
13101 if self.entries != other.entries: return False
13102 return True
13103
13104 def pretty_print(self, q):
13105 q.text("meter_stats_reply {")
13106 with q.group():
13107 with q.indent(2):
13108 q.breakable()
13109 q.text("xid = ");
13110 if self.xid != None:
13111 q.text("%#x" % self.xid)
13112 else:
13113 q.text('None')
13114 q.text(","); q.breakable()
13115 q.text("flags = ");
13116 q.text("%#x" % self.flags)
13117 q.text(","); q.breakable()
13118 q.text("entries = ");
13119 q.pp(self.entries)
13120 q.breakable()
13121 q.text('}')
13122
13123stats_reply.subtypes[9] = meter_stats_reply
13124
13125class meter_stats_request(stats_request):
13126 version = 4
13127 type = 18
13128 stats_type = 9
13129
13130 def __init__(self, xid=None, flags=None, meter_id=None):
13131 if xid != None:
13132 self.xid = xid
13133 else:
13134 self.xid = None
13135 if flags != None:
13136 self.flags = flags
13137 else:
13138 self.flags = 0
13139 if meter_id != None:
13140 self.meter_id = meter_id
13141 else:
13142 self.meter_id = 0
13143 return
13144
13145 def pack(self):
13146 packed = []
13147 packed.append(struct.pack("!B", self.version))
13148 packed.append(struct.pack("!B", self.type))
13149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13150 packed.append(struct.pack("!L", self.xid))
13151 packed.append(struct.pack("!H", self.stats_type))
13152 packed.append(struct.pack("!H", self.flags))
13153 packed.append('\x00' * 4)
13154 packed.append(struct.pack("!L", self.meter_id))
13155 packed.append('\x00' * 4)
13156 length = sum([len(x) for x in packed])
13157 packed[2] = struct.pack("!H", length)
13158 return ''.join(packed)
13159
13160 @staticmethod
13161 def unpack(reader):
13162 obj = meter_stats_request()
13163 _version = reader.read("!B")[0]
13164 assert(_version == 4)
13165 _type = reader.read("!B")[0]
13166 assert(_type == 18)
13167 _length = reader.read("!H")[0]
13168 orig_reader = reader
13169 reader = orig_reader.slice(_length, 4)
13170 obj.xid = reader.read("!L")[0]
13171 _stats_type = reader.read("!H")[0]
13172 assert(_stats_type == 9)
13173 obj.flags = reader.read("!H")[0]
13174 reader.skip(4)
13175 obj.meter_id = reader.read("!L")[0]
13176 reader.skip(4)
13177 return obj
13178
13179 def __eq__(self, other):
13180 if type(self) != type(other): return False
13181 if self.xid != other.xid: return False
13182 if self.flags != other.flags: return False
13183 if self.meter_id != other.meter_id: return False
13184 return True
13185
13186 def pretty_print(self, q):
13187 q.text("meter_stats_request {")
13188 with q.group():
13189 with q.indent(2):
13190 q.breakable()
13191 q.text("xid = ");
13192 if self.xid != None:
13193 q.text("%#x" % self.xid)
13194 else:
13195 q.text('None')
13196 q.text(","); q.breakable()
13197 q.text("flags = ");
13198 q.text("%#x" % self.flags)
13199 q.text(","); q.breakable()
13200 q.text("meter_id = ");
13201 q.text("%#x" % self.meter_id)
13202 q.breakable()
13203 q.text('}')
13204
13205stats_request.subtypes[9] = meter_stats_request
13206
13207class nicira_header(experimenter):
13208 subtypes = {}
13209
13210 version = 4
13211 type = 4
13212 experimenter = 8992
13213
13214 def __init__(self, xid=None, subtype=None):
13215 if xid != None:
13216 self.xid = xid
13217 else:
13218 self.xid = None
13219 if subtype != None:
13220 self.subtype = subtype
13221 else:
13222 self.subtype = 0
13223 return
13224
13225 def pack(self):
13226 packed = []
13227 packed.append(struct.pack("!B", self.version))
13228 packed.append(struct.pack("!B", self.type))
13229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13230 packed.append(struct.pack("!L", self.xid))
13231 packed.append(struct.pack("!L", self.experimenter))
13232 packed.append(struct.pack("!L", self.subtype))
13233 length = sum([len(x) for x in packed])
13234 packed[2] = struct.pack("!H", length)
13235 return ''.join(packed)
13236
13237 @staticmethod
13238 def unpack(reader):
13239 subtype, = reader.peek('!L', 12)
13240 subclass = nicira_header.subtypes.get(subtype)
13241 if subclass:
13242 return subclass.unpack(reader)
13243
13244 obj = nicira_header()
13245 _version = reader.read("!B")[0]
13246 assert(_version == 4)
13247 _type = reader.read("!B")[0]
13248 assert(_type == 4)
13249 _length = reader.read("!H")[0]
13250 orig_reader = reader
13251 reader = orig_reader.slice(_length, 4)
13252 obj.xid = reader.read("!L")[0]
13253 _experimenter = reader.read("!L")[0]
13254 assert(_experimenter == 8992)
13255 obj.subtype = reader.read("!L")[0]
13256 return obj
13257
13258 def __eq__(self, other):
13259 if type(self) != type(other): return False
13260 if self.xid != other.xid: return False
13261 if self.subtype != other.subtype: return False
13262 return True
13263
13264 def pretty_print(self, q):
13265 q.text("nicira_header {")
13266 with q.group():
13267 with q.indent(2):
13268 q.breakable()
13269 q.text("xid = ");
13270 if self.xid != None:
13271 q.text("%#x" % self.xid)
13272 else:
13273 q.text('None')
13274 q.breakable()
13275 q.text('}')
13276
13277experimenter.subtypes[8992] = nicira_header
13278
13279class packet_in(message):
13280 version = 4
13281 type = 10
13282
13283 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13284 if xid != None:
13285 self.xid = xid
13286 else:
13287 self.xid = None
13288 if buffer_id != None:
13289 self.buffer_id = buffer_id
13290 else:
13291 self.buffer_id = 0
13292 if total_len != None:
13293 self.total_len = total_len
13294 else:
13295 self.total_len = 0
13296 if reason != None:
13297 self.reason = reason
13298 else:
13299 self.reason = 0
13300 if table_id != None:
13301 self.table_id = table_id
13302 else:
13303 self.table_id = 0
13304 if cookie != None:
13305 self.cookie = cookie
13306 else:
13307 self.cookie = 0
13308 if match != None:
13309 self.match = match
13310 else:
13311 self.match = ofp.match()
13312 if data != None:
13313 self.data = data
13314 else:
13315 self.data = ''
13316 return
13317
13318 def pack(self):
13319 packed = []
13320 packed.append(struct.pack("!B", self.version))
13321 packed.append(struct.pack("!B", self.type))
13322 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13323 packed.append(struct.pack("!L", self.xid))
13324 packed.append(struct.pack("!L", self.buffer_id))
13325 packed.append(struct.pack("!H", self.total_len))
13326 packed.append(struct.pack("!B", self.reason))
13327 packed.append(struct.pack("!B", self.table_id))
13328 packed.append(struct.pack("!Q", self.cookie))
13329 packed.append(self.match.pack())
13330 packed.append('\x00' * 2)
13331 packed.append(self.data)
13332 length = sum([len(x) for x in packed])
13333 packed[2] = struct.pack("!H", length)
13334 return ''.join(packed)
13335
13336 @staticmethod
13337 def unpack(reader):
13338 obj = packet_in()
13339 _version = reader.read("!B")[0]
13340 assert(_version == 4)
13341 _type = reader.read("!B")[0]
13342 assert(_type == 10)
13343 _length = reader.read("!H")[0]
13344 orig_reader = reader
13345 reader = orig_reader.slice(_length, 4)
13346 obj.xid = reader.read("!L")[0]
13347 obj.buffer_id = reader.read("!L")[0]
13348 obj.total_len = reader.read("!H")[0]
13349 obj.reason = reader.read("!B")[0]
13350 obj.table_id = reader.read("!B")[0]
13351 obj.cookie = reader.read("!Q")[0]
13352 obj.match = ofp.match.unpack(reader)
13353 reader.skip(2)
13354 obj.data = str(reader.read_all())
13355 return obj
13356
13357 def __eq__(self, other):
13358 if type(self) != type(other): return False
13359 if self.xid != other.xid: return False
13360 if self.buffer_id != other.buffer_id: return False
13361 if self.total_len != other.total_len: return False
13362 if self.reason != other.reason: return False
13363 if self.table_id != other.table_id: return False
13364 if self.cookie != other.cookie: return False
13365 if self.match != other.match: return False
13366 if self.data != other.data: return False
13367 return True
13368
13369 def pretty_print(self, q):
13370 q.text("packet_in {")
13371 with q.group():
13372 with q.indent(2):
13373 q.breakable()
13374 q.text("xid = ");
13375 if self.xid != None:
13376 q.text("%#x" % self.xid)
13377 else:
13378 q.text('None')
13379 q.text(","); q.breakable()
13380 q.text("buffer_id = ");
13381 q.text("%#x" % self.buffer_id)
13382 q.text(","); q.breakable()
13383 q.text("total_len = ");
13384 q.text("%#x" % self.total_len)
13385 q.text(","); q.breakable()
13386 q.text("reason = ");
13387 q.text("%#x" % self.reason)
13388 q.text(","); q.breakable()
13389 q.text("table_id = ");
13390 q.text("%#x" % self.table_id)
13391 q.text(","); q.breakable()
13392 q.text("cookie = ");
13393 q.text("%#x" % self.cookie)
13394 q.text(","); q.breakable()
13395 q.text("match = ");
13396 q.pp(self.match)
13397 q.text(","); q.breakable()
13398 q.text("data = ");
13399 q.pp(self.data)
13400 q.breakable()
13401 q.text('}')
13402
13403message.subtypes[10] = packet_in
13404
13405class packet_out(message):
13406 version = 4
13407 type = 13
13408
13409 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13410 if xid != None:
13411 self.xid = xid
13412 else:
13413 self.xid = None
13414 if buffer_id != None:
13415 self.buffer_id = buffer_id
13416 else:
13417 self.buffer_id = 0
13418 if in_port != None:
13419 self.in_port = in_port
13420 else:
13421 self.in_port = 0
13422 if actions != None:
13423 self.actions = actions
13424 else:
13425 self.actions = []
13426 if data != None:
13427 self.data = data
13428 else:
13429 self.data = ''
13430 return
13431
13432 def pack(self):
13433 packed = []
13434 packed.append(struct.pack("!B", self.version))
13435 packed.append(struct.pack("!B", self.type))
13436 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13437 packed.append(struct.pack("!L", self.xid))
13438 packed.append(struct.pack("!L", self.buffer_id))
13439 packed.append(util.pack_port_no(self.in_port))
13440 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13441 packed.append('\x00' * 6)
13442 packed.append(loxi.generic_util.pack_list(self.actions))
13443 packed[6] = struct.pack("!H", len(packed[-1]))
13444 packed.append(self.data)
13445 length = sum([len(x) for x in packed])
13446 packed[2] = struct.pack("!H", length)
13447 return ''.join(packed)
13448
13449 @staticmethod
13450 def unpack(reader):
13451 obj = packet_out()
13452 _version = reader.read("!B")[0]
13453 assert(_version == 4)
13454 _type = reader.read("!B")[0]
13455 assert(_type == 13)
13456 _length = reader.read("!H")[0]
13457 orig_reader = reader
13458 reader = orig_reader.slice(_length, 4)
13459 obj.xid = reader.read("!L")[0]
13460 obj.buffer_id = reader.read("!L")[0]
13461 obj.in_port = util.unpack_port_no(reader)
13462 _actions_len = reader.read("!H")[0]
13463 reader.skip(6)
13464 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
13465 obj.data = str(reader.read_all())
13466 return obj
13467
13468 def __eq__(self, other):
13469 if type(self) != type(other): return False
13470 if self.xid != other.xid: return False
13471 if self.buffer_id != other.buffer_id: return False
13472 if self.in_port != other.in_port: return False
13473 if self.actions != other.actions: return False
13474 if self.data != other.data: return False
13475 return True
13476
13477 def pretty_print(self, q):
13478 q.text("packet_out {")
13479 with q.group():
13480 with q.indent(2):
13481 q.breakable()
13482 q.text("xid = ");
13483 if self.xid != None:
13484 q.text("%#x" % self.xid)
13485 else:
13486 q.text('None')
13487 q.text(","); q.breakable()
13488 q.text("buffer_id = ");
13489 q.text("%#x" % self.buffer_id)
13490 q.text(","); q.breakable()
13491 q.text("in_port = ");
13492 q.text(util.pretty_port(self.in_port))
13493 q.text(","); q.breakable()
13494 q.text("actions = ");
13495 q.pp(self.actions)
13496 q.text(","); q.breakable()
13497 q.text("data = ");
13498 q.pp(self.data)
13499 q.breakable()
13500 q.text('}')
13501
13502message.subtypes[13] = packet_out
13503
13504class port_desc_stats_reply(stats_reply):
13505 version = 4
13506 type = 19
13507 stats_type = 13
13508
13509 def __init__(self, xid=None, flags=None, entries=None):
13510 if xid != None:
13511 self.xid = xid
13512 else:
13513 self.xid = None
13514 if flags != None:
13515 self.flags = flags
13516 else:
13517 self.flags = 0
13518 if entries != None:
13519 self.entries = entries
13520 else:
13521 self.entries = []
13522 return
13523
13524 def pack(self):
13525 packed = []
13526 packed.append(struct.pack("!B", self.version))
13527 packed.append(struct.pack("!B", self.type))
13528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13529 packed.append(struct.pack("!L", self.xid))
13530 packed.append(struct.pack("!H", self.stats_type))
13531 packed.append(struct.pack("!H", self.flags))
13532 packed.append('\x00' * 4)
13533 packed.append(loxi.generic_util.pack_list(self.entries))
13534 length = sum([len(x) for x in packed])
13535 packed[2] = struct.pack("!H", length)
13536 return ''.join(packed)
13537
13538 @staticmethod
13539 def unpack(reader):
13540 obj = port_desc_stats_reply()
13541 _version = reader.read("!B")[0]
13542 assert(_version == 4)
13543 _type = reader.read("!B")[0]
13544 assert(_type == 19)
13545 _length = reader.read("!H")[0]
13546 orig_reader = reader
13547 reader = orig_reader.slice(_length, 4)
13548 obj.xid = reader.read("!L")[0]
13549 _stats_type = reader.read("!H")[0]
13550 assert(_stats_type == 13)
13551 obj.flags = reader.read("!H")[0]
13552 reader.skip(4)
13553 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
13554 return obj
13555
13556 def __eq__(self, other):
13557 if type(self) != type(other): return False
13558 if self.xid != other.xid: return False
13559 if self.flags != other.flags: return False
13560 if self.entries != other.entries: return False
13561 return True
13562
13563 def pretty_print(self, q):
13564 q.text("port_desc_stats_reply {")
13565 with q.group():
13566 with q.indent(2):
13567 q.breakable()
13568 q.text("xid = ");
13569 if self.xid != None:
13570 q.text("%#x" % self.xid)
13571 else:
13572 q.text('None')
13573 q.text(","); q.breakable()
13574 q.text("flags = ");
13575 q.text("%#x" % self.flags)
13576 q.text(","); q.breakable()
13577 q.text("entries = ");
13578 q.pp(self.entries)
13579 q.breakable()
13580 q.text('}')
13581
13582stats_reply.subtypes[13] = port_desc_stats_reply
13583
13584class port_desc_stats_request(stats_request):
13585 version = 4
13586 type = 18
13587 stats_type = 13
13588
13589 def __init__(self, xid=None, flags=None):
13590 if xid != None:
13591 self.xid = xid
13592 else:
13593 self.xid = None
13594 if flags != None:
13595 self.flags = flags
13596 else:
13597 self.flags = 0
13598 return
13599
13600 def pack(self):
13601 packed = []
13602 packed.append(struct.pack("!B", self.version))
13603 packed.append(struct.pack("!B", self.type))
13604 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13605 packed.append(struct.pack("!L", self.xid))
13606 packed.append(struct.pack("!H", self.stats_type))
13607 packed.append(struct.pack("!H", self.flags))
13608 packed.append('\x00' * 4)
13609 length = sum([len(x) for x in packed])
13610 packed[2] = struct.pack("!H", length)
13611 return ''.join(packed)
13612
13613 @staticmethod
13614 def unpack(reader):
13615 obj = port_desc_stats_request()
13616 _version = reader.read("!B")[0]
13617 assert(_version == 4)
13618 _type = reader.read("!B")[0]
13619 assert(_type == 18)
13620 _length = reader.read("!H")[0]
13621 orig_reader = reader
13622 reader = orig_reader.slice(_length, 4)
13623 obj.xid = reader.read("!L")[0]
13624 _stats_type = reader.read("!H")[0]
13625 assert(_stats_type == 13)
13626 obj.flags = reader.read("!H")[0]
13627 reader.skip(4)
13628 return obj
13629
13630 def __eq__(self, other):
13631 if type(self) != type(other): return False
13632 if self.xid != other.xid: return False
13633 if self.flags != other.flags: return False
13634 return True
13635
13636 def pretty_print(self, q):
13637 q.text("port_desc_stats_request {")
13638 with q.group():
13639 with q.indent(2):
13640 q.breakable()
13641 q.text("xid = ");
13642 if self.xid != None:
13643 q.text("%#x" % self.xid)
13644 else:
13645 q.text('None')
13646 q.text(","); q.breakable()
13647 q.text("flags = ");
13648 q.text("%#x" % self.flags)
13649 q.breakable()
13650 q.text('}')
13651
13652stats_request.subtypes[13] = port_desc_stats_request
13653
13654class port_mod(message):
13655 version = 4
13656 type = 16
13657
13658 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
13659 if xid != None:
13660 self.xid = xid
13661 else:
13662 self.xid = None
13663 if port_no != None:
13664 self.port_no = port_no
13665 else:
13666 self.port_no = 0
13667 if hw_addr != None:
13668 self.hw_addr = hw_addr
13669 else:
13670 self.hw_addr = [0,0,0,0,0,0]
13671 if config != None:
13672 self.config = config
13673 else:
13674 self.config = 0
13675 if mask != None:
13676 self.mask = mask
13677 else:
13678 self.mask = 0
13679 if advertise != None:
13680 self.advertise = advertise
13681 else:
13682 self.advertise = 0
13683 return
13684
13685 def pack(self):
13686 packed = []
13687 packed.append(struct.pack("!B", self.version))
13688 packed.append(struct.pack("!B", self.type))
13689 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13690 packed.append(struct.pack("!L", self.xid))
13691 packed.append(util.pack_port_no(self.port_no))
13692 packed.append('\x00' * 4)
13693 packed.append(struct.pack("!6B", *self.hw_addr))
13694 packed.append('\x00' * 2)
13695 packed.append(struct.pack("!L", self.config))
13696 packed.append(struct.pack("!L", self.mask))
13697 packed.append(struct.pack("!L", self.advertise))
13698 packed.append('\x00' * 4)
13699 length = sum([len(x) for x in packed])
13700 packed[2] = struct.pack("!H", length)
13701 return ''.join(packed)
13702
13703 @staticmethod
13704 def unpack(reader):
13705 obj = port_mod()
13706 _version = reader.read("!B")[0]
13707 assert(_version == 4)
13708 _type = reader.read("!B")[0]
13709 assert(_type == 16)
13710 _length = reader.read("!H")[0]
13711 orig_reader = reader
13712 reader = orig_reader.slice(_length, 4)
13713 obj.xid = reader.read("!L")[0]
13714 obj.port_no = util.unpack_port_no(reader)
13715 reader.skip(4)
13716 obj.hw_addr = list(reader.read('!6B'))
13717 reader.skip(2)
13718 obj.config = reader.read("!L")[0]
13719 obj.mask = reader.read("!L")[0]
13720 obj.advertise = reader.read("!L")[0]
13721 reader.skip(4)
13722 return obj
13723
13724 def __eq__(self, other):
13725 if type(self) != type(other): return False
13726 if self.xid != other.xid: return False
13727 if self.port_no != other.port_no: return False
13728 if self.hw_addr != other.hw_addr: return False
13729 if self.config != other.config: return False
13730 if self.mask != other.mask: return False
13731 if self.advertise != other.advertise: return False
13732 return True
13733
13734 def pretty_print(self, q):
13735 q.text("port_mod {")
13736 with q.group():
13737 with q.indent(2):
13738 q.breakable()
13739 q.text("xid = ");
13740 if self.xid != None:
13741 q.text("%#x" % self.xid)
13742 else:
13743 q.text('None')
13744 q.text(","); q.breakable()
13745 q.text("port_no = ");
13746 q.text(util.pretty_port(self.port_no))
13747 q.text(","); q.breakable()
13748 q.text("hw_addr = ");
13749 q.text(util.pretty_mac(self.hw_addr))
13750 q.text(","); q.breakable()
13751 q.text("config = ");
13752 q.text("%#x" % self.config)
13753 q.text(","); q.breakable()
13754 q.text("mask = ");
13755 q.text("%#x" % self.mask)
13756 q.text(","); q.breakable()
13757 q.text("advertise = ");
13758 q.text("%#x" % self.advertise)
13759 q.breakable()
13760 q.text('}')
13761
13762message.subtypes[16] = port_mod
13763
13764class port_mod_failed_error_msg(error_msg):
13765 version = 4
13766 type = 1
13767 err_type = 7
13768
13769 def __init__(self, xid=None, code=None, data=None):
13770 if xid != None:
13771 self.xid = xid
13772 else:
13773 self.xid = None
13774 if code != None:
13775 self.code = code
13776 else:
13777 self.code = 0
13778 if data != None:
13779 self.data = data
13780 else:
13781 self.data = ''
13782 return
13783
13784 def pack(self):
13785 packed = []
13786 packed.append(struct.pack("!B", self.version))
13787 packed.append(struct.pack("!B", self.type))
13788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13789 packed.append(struct.pack("!L", self.xid))
13790 packed.append(struct.pack("!H", self.err_type))
13791 packed.append(struct.pack("!H", self.code))
13792 packed.append(self.data)
13793 length = sum([len(x) for x in packed])
13794 packed[2] = struct.pack("!H", length)
13795 return ''.join(packed)
13796
13797 @staticmethod
13798 def unpack(reader):
13799 obj = port_mod_failed_error_msg()
13800 _version = reader.read("!B")[0]
13801 assert(_version == 4)
13802 _type = reader.read("!B")[0]
13803 assert(_type == 1)
13804 _length = reader.read("!H")[0]
13805 orig_reader = reader
13806 reader = orig_reader.slice(_length, 4)
13807 obj.xid = reader.read("!L")[0]
13808 _err_type = reader.read("!H")[0]
13809 assert(_err_type == 7)
13810 obj.code = reader.read("!H")[0]
13811 obj.data = str(reader.read_all())
13812 return obj
13813
13814 def __eq__(self, other):
13815 if type(self) != type(other): return False
13816 if self.xid != other.xid: return False
13817 if self.code != other.code: return False
13818 if self.data != other.data: return False
13819 return True
13820
13821 def pretty_print(self, q):
13822 q.text("port_mod_failed_error_msg {")
13823 with q.group():
13824 with q.indent(2):
13825 q.breakable()
13826 q.text("xid = ");
13827 if self.xid != None:
13828 q.text("%#x" % self.xid)
13829 else:
13830 q.text('None')
13831 q.text(","); q.breakable()
13832 q.text("code = ");
13833 q.text("%#x" % self.code)
13834 q.text(","); q.breakable()
13835 q.text("data = ");
13836 q.pp(self.data)
13837 q.breakable()
13838 q.text('}')
13839
13840error_msg.subtypes[7] = port_mod_failed_error_msg
13841
13842class port_stats_reply(stats_reply):
13843 version = 4
13844 type = 19
13845 stats_type = 4
13846
13847 def __init__(self, xid=None, flags=None, entries=None):
13848 if xid != None:
13849 self.xid = xid
13850 else:
13851 self.xid = None
13852 if flags != None:
13853 self.flags = flags
13854 else:
13855 self.flags = 0
13856 if entries != None:
13857 self.entries = entries
13858 else:
13859 self.entries = []
13860 return
13861
13862 def pack(self):
13863 packed = []
13864 packed.append(struct.pack("!B", self.version))
13865 packed.append(struct.pack("!B", self.type))
13866 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13867 packed.append(struct.pack("!L", self.xid))
13868 packed.append(struct.pack("!H", self.stats_type))
13869 packed.append(struct.pack("!H", self.flags))
13870 packed.append('\x00' * 4)
13871 packed.append(loxi.generic_util.pack_list(self.entries))
13872 length = sum([len(x) for x in packed])
13873 packed[2] = struct.pack("!H", length)
13874 return ''.join(packed)
13875
13876 @staticmethod
13877 def unpack(reader):
13878 obj = port_stats_reply()
13879 _version = reader.read("!B")[0]
13880 assert(_version == 4)
13881 _type = reader.read("!B")[0]
13882 assert(_type == 19)
13883 _length = reader.read("!H")[0]
13884 orig_reader = reader
13885 reader = orig_reader.slice(_length, 4)
13886 obj.xid = reader.read("!L")[0]
13887 _stats_type = reader.read("!H")[0]
13888 assert(_stats_type == 4)
13889 obj.flags = reader.read("!H")[0]
13890 reader.skip(4)
13891 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
13892 return obj
13893
13894 def __eq__(self, other):
13895 if type(self) != type(other): return False
13896 if self.xid != other.xid: return False
13897 if self.flags != other.flags: return False
13898 if self.entries != other.entries: return False
13899 return True
13900
13901 def pretty_print(self, q):
13902 q.text("port_stats_reply {")
13903 with q.group():
13904 with q.indent(2):
13905 q.breakable()
13906 q.text("xid = ");
13907 if self.xid != None:
13908 q.text("%#x" % self.xid)
13909 else:
13910 q.text('None')
13911 q.text(","); q.breakable()
13912 q.text("flags = ");
13913 q.text("%#x" % self.flags)
13914 q.text(","); q.breakable()
13915 q.text("entries = ");
13916 q.pp(self.entries)
13917 q.breakable()
13918 q.text('}')
13919
13920stats_reply.subtypes[4] = port_stats_reply
13921
13922class port_stats_request(stats_request):
13923 version = 4
13924 type = 18
13925 stats_type = 4
13926
13927 def __init__(self, xid=None, flags=None, port_no=None):
13928 if xid != None:
13929 self.xid = xid
13930 else:
13931 self.xid = None
13932 if flags != None:
13933 self.flags = flags
13934 else:
13935 self.flags = 0
13936 if port_no != None:
13937 self.port_no = port_no
13938 else:
13939 self.port_no = 0
13940 return
13941
13942 def pack(self):
13943 packed = []
13944 packed.append(struct.pack("!B", self.version))
13945 packed.append(struct.pack("!B", self.type))
13946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13947 packed.append(struct.pack("!L", self.xid))
13948 packed.append(struct.pack("!H", self.stats_type))
13949 packed.append(struct.pack("!H", self.flags))
13950 packed.append('\x00' * 4)
13951 packed.append(util.pack_port_no(self.port_no))
13952 packed.append('\x00' * 4)
13953 length = sum([len(x) for x in packed])
13954 packed[2] = struct.pack("!H", length)
13955 return ''.join(packed)
13956
13957 @staticmethod
13958 def unpack(reader):
13959 obj = port_stats_request()
13960 _version = reader.read("!B")[0]
13961 assert(_version == 4)
13962 _type = reader.read("!B")[0]
13963 assert(_type == 18)
13964 _length = reader.read("!H")[0]
13965 orig_reader = reader
13966 reader = orig_reader.slice(_length, 4)
13967 obj.xid = reader.read("!L")[0]
13968 _stats_type = reader.read("!H")[0]
13969 assert(_stats_type == 4)
13970 obj.flags = reader.read("!H")[0]
13971 reader.skip(4)
13972 obj.port_no = util.unpack_port_no(reader)
13973 reader.skip(4)
13974 return obj
13975
13976 def __eq__(self, other):
13977 if type(self) != type(other): return False
13978 if self.xid != other.xid: return False
13979 if self.flags != other.flags: return False
13980 if self.port_no != other.port_no: return False
13981 return True
13982
13983 def pretty_print(self, q):
13984 q.text("port_stats_request {")
13985 with q.group():
13986 with q.indent(2):
13987 q.breakable()
13988 q.text("xid = ");
13989 if self.xid != None:
13990 q.text("%#x" % self.xid)
13991 else:
13992 q.text('None')
13993 q.text(","); q.breakable()
13994 q.text("flags = ");
13995 q.text("%#x" % self.flags)
13996 q.text(","); q.breakable()
13997 q.text("port_no = ");
13998 q.text(util.pretty_port(self.port_no))
13999 q.breakable()
14000 q.text('}')
14001
14002stats_request.subtypes[4] = port_stats_request
14003
14004class port_status(message):
14005 version = 4
14006 type = 12
14007
14008 def __init__(self, xid=None, reason=None, desc=None):
14009 if xid != None:
14010 self.xid = xid
14011 else:
14012 self.xid = None
14013 if reason != None:
14014 self.reason = reason
14015 else:
14016 self.reason = 0
14017 if desc != None:
14018 self.desc = desc
14019 else:
14020 self.desc = ofp.port_desc()
14021 return
14022
14023 def pack(self):
14024 packed = []
14025 packed.append(struct.pack("!B", self.version))
14026 packed.append(struct.pack("!B", self.type))
14027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14028 packed.append(struct.pack("!L", self.xid))
14029 packed.append(struct.pack("!B", self.reason))
14030 packed.append('\x00' * 7)
14031 packed.append(self.desc.pack())
14032 length = sum([len(x) for x in packed])
14033 packed[2] = struct.pack("!H", length)
14034 return ''.join(packed)
14035
14036 @staticmethod
14037 def unpack(reader):
14038 obj = port_status()
14039 _version = reader.read("!B")[0]
14040 assert(_version == 4)
14041 _type = reader.read("!B")[0]
14042 assert(_type == 12)
14043 _length = reader.read("!H")[0]
14044 orig_reader = reader
14045 reader = orig_reader.slice(_length, 4)
14046 obj.xid = reader.read("!L")[0]
14047 obj.reason = reader.read("!B")[0]
14048 reader.skip(7)
14049 obj.desc = ofp.port_desc.unpack(reader)
14050 return obj
14051
14052 def __eq__(self, other):
14053 if type(self) != type(other): return False
14054 if self.xid != other.xid: return False
14055 if self.reason != other.reason: return False
14056 if self.desc != other.desc: return False
14057 return True
14058
14059 def pretty_print(self, q):
14060 q.text("port_status {")
14061 with q.group():
14062 with q.indent(2):
14063 q.breakable()
14064 q.text("xid = ");
14065 if self.xid != None:
14066 q.text("%#x" % self.xid)
14067 else:
14068 q.text('None')
14069 q.text(","); q.breakable()
14070 q.text("reason = ");
14071 q.text("%#x" % self.reason)
14072 q.text(","); q.breakable()
14073 q.text("desc = ");
14074 q.pp(self.desc)
14075 q.breakable()
14076 q.text('}')
14077
14078message.subtypes[12] = port_status
14079
14080class queue_get_config_reply(message):
14081 version = 4
14082 type = 23
14083
14084 def __init__(self, xid=None, port=None, queues=None):
14085 if xid != None:
14086 self.xid = xid
14087 else:
14088 self.xid = None
14089 if port != None:
14090 self.port = port
14091 else:
14092 self.port = 0
14093 if queues != None:
14094 self.queues = queues
14095 else:
14096 self.queues = []
14097 return
14098
14099 def pack(self):
14100 packed = []
14101 packed.append(struct.pack("!B", self.version))
14102 packed.append(struct.pack("!B", self.type))
14103 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14104 packed.append(struct.pack("!L", self.xid))
14105 packed.append(util.pack_port_no(self.port))
14106 packed.append('\x00' * 4)
14107 packed.append(loxi.generic_util.pack_list(self.queues))
14108 length = sum([len(x) for x in packed])
14109 packed[2] = struct.pack("!H", length)
14110 return ''.join(packed)
14111
14112 @staticmethod
14113 def unpack(reader):
14114 obj = queue_get_config_reply()
14115 _version = reader.read("!B")[0]
14116 assert(_version == 4)
14117 _type = reader.read("!B")[0]
14118 assert(_type == 23)
14119 _length = reader.read("!H")[0]
14120 orig_reader = reader
14121 reader = orig_reader.slice(_length, 4)
14122 obj.xid = reader.read("!L")[0]
14123 obj.port = util.unpack_port_no(reader)
14124 reader.skip(4)
14125 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
14126 return obj
14127
14128 def __eq__(self, other):
14129 if type(self) != type(other): return False
14130 if self.xid != other.xid: return False
14131 if self.port != other.port: return False
14132 if self.queues != other.queues: return False
14133 return True
14134
14135 def pretty_print(self, q):
14136 q.text("queue_get_config_reply {")
14137 with q.group():
14138 with q.indent(2):
14139 q.breakable()
14140 q.text("xid = ");
14141 if self.xid != None:
14142 q.text("%#x" % self.xid)
14143 else:
14144 q.text('None')
14145 q.text(","); q.breakable()
14146 q.text("port = ");
14147 q.text(util.pretty_port(self.port))
14148 q.text(","); q.breakable()
14149 q.text("queues = ");
14150 q.pp(self.queues)
14151 q.breakable()
14152 q.text('}')
14153
14154message.subtypes[23] = queue_get_config_reply
14155
14156class queue_get_config_request(message):
14157 version = 4
14158 type = 22
14159
14160 def __init__(self, xid=None, port=None):
14161 if xid != None:
14162 self.xid = xid
14163 else:
14164 self.xid = None
14165 if port != None:
14166 self.port = port
14167 else:
14168 self.port = 0
14169 return
14170
14171 def pack(self):
14172 packed = []
14173 packed.append(struct.pack("!B", self.version))
14174 packed.append(struct.pack("!B", self.type))
14175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14176 packed.append(struct.pack("!L", self.xid))
14177 packed.append(util.pack_port_no(self.port))
14178 packed.append('\x00' * 4)
14179 length = sum([len(x) for x in packed])
14180 packed[2] = struct.pack("!H", length)
14181 return ''.join(packed)
14182
14183 @staticmethod
14184 def unpack(reader):
14185 obj = queue_get_config_request()
14186 _version = reader.read("!B")[0]
14187 assert(_version == 4)
14188 _type = reader.read("!B")[0]
14189 assert(_type == 22)
14190 _length = reader.read("!H")[0]
14191 orig_reader = reader
14192 reader = orig_reader.slice(_length, 4)
14193 obj.xid = reader.read("!L")[0]
14194 obj.port = util.unpack_port_no(reader)
14195 reader.skip(4)
14196 return obj
14197
14198 def __eq__(self, other):
14199 if type(self) != type(other): return False
14200 if self.xid != other.xid: return False
14201 if self.port != other.port: return False
14202 return True
14203
14204 def pretty_print(self, q):
14205 q.text("queue_get_config_request {")
14206 with q.group():
14207 with q.indent(2):
14208 q.breakable()
14209 q.text("xid = ");
14210 if self.xid != None:
14211 q.text("%#x" % self.xid)
14212 else:
14213 q.text('None')
14214 q.text(","); q.breakable()
14215 q.text("port = ");
14216 q.text(util.pretty_port(self.port))
14217 q.breakable()
14218 q.text('}')
14219
14220message.subtypes[22] = queue_get_config_request
14221
14222class queue_op_failed_error_msg(error_msg):
14223 version = 4
14224 type = 1
14225 err_type = 9
14226
14227 def __init__(self, xid=None, code=None, data=None):
14228 if xid != None:
14229 self.xid = xid
14230 else:
14231 self.xid = None
14232 if code != None:
14233 self.code = code
14234 else:
14235 self.code = 0
14236 if data != None:
14237 self.data = data
14238 else:
14239 self.data = ''
14240 return
14241
14242 def pack(self):
14243 packed = []
14244 packed.append(struct.pack("!B", self.version))
14245 packed.append(struct.pack("!B", self.type))
14246 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14247 packed.append(struct.pack("!L", self.xid))
14248 packed.append(struct.pack("!H", self.err_type))
14249 packed.append(struct.pack("!H", self.code))
14250 packed.append(self.data)
14251 length = sum([len(x) for x in packed])
14252 packed[2] = struct.pack("!H", length)
14253 return ''.join(packed)
14254
14255 @staticmethod
14256 def unpack(reader):
14257 obj = queue_op_failed_error_msg()
14258 _version = reader.read("!B")[0]
14259 assert(_version == 4)
14260 _type = reader.read("!B")[0]
14261 assert(_type == 1)
14262 _length = reader.read("!H")[0]
14263 orig_reader = reader
14264 reader = orig_reader.slice(_length, 4)
14265 obj.xid = reader.read("!L")[0]
14266 _err_type = reader.read("!H")[0]
14267 assert(_err_type == 9)
14268 obj.code = reader.read("!H")[0]
14269 obj.data = str(reader.read_all())
14270 return obj
14271
14272 def __eq__(self, other):
14273 if type(self) != type(other): return False
14274 if self.xid != other.xid: return False
14275 if self.code != other.code: return False
14276 if self.data != other.data: return False
14277 return True
14278
14279 def pretty_print(self, q):
14280 q.text("queue_op_failed_error_msg {")
14281 with q.group():
14282 with q.indent(2):
14283 q.breakable()
14284 q.text("xid = ");
14285 if self.xid != None:
14286 q.text("%#x" % self.xid)
14287 else:
14288 q.text('None')
14289 q.text(","); q.breakable()
14290 q.text("code = ");
14291 q.text("%#x" % self.code)
14292 q.text(","); q.breakable()
14293 q.text("data = ");
14294 q.pp(self.data)
14295 q.breakable()
14296 q.text('}')
14297
14298error_msg.subtypes[9] = queue_op_failed_error_msg
14299
14300class queue_stats_reply(stats_reply):
14301 version = 4
14302 type = 19
14303 stats_type = 5
14304
14305 def __init__(self, xid=None, flags=None, entries=None):
14306 if xid != None:
14307 self.xid = xid
14308 else:
14309 self.xid = None
14310 if flags != None:
14311 self.flags = flags
14312 else:
14313 self.flags = 0
14314 if entries != None:
14315 self.entries = entries
14316 else:
14317 self.entries = []
14318 return
14319
14320 def pack(self):
14321 packed = []
14322 packed.append(struct.pack("!B", self.version))
14323 packed.append(struct.pack("!B", self.type))
14324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14325 packed.append(struct.pack("!L", self.xid))
14326 packed.append(struct.pack("!H", self.stats_type))
14327 packed.append(struct.pack("!H", self.flags))
14328 packed.append('\x00' * 4)
14329 packed.append(loxi.generic_util.pack_list(self.entries))
14330 length = sum([len(x) for x in packed])
14331 packed[2] = struct.pack("!H", length)
14332 return ''.join(packed)
14333
14334 @staticmethod
14335 def unpack(reader):
14336 obj = queue_stats_reply()
14337 _version = reader.read("!B")[0]
14338 assert(_version == 4)
14339 _type = reader.read("!B")[0]
14340 assert(_type == 19)
14341 _length = reader.read("!H")[0]
14342 orig_reader = reader
14343 reader = orig_reader.slice(_length, 4)
14344 obj.xid = reader.read("!L")[0]
14345 _stats_type = reader.read("!H")[0]
14346 assert(_stats_type == 5)
14347 obj.flags = reader.read("!H")[0]
14348 reader.skip(4)
14349 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
14350 return obj
14351
14352 def __eq__(self, other):
14353 if type(self) != type(other): return False
14354 if self.xid != other.xid: return False
14355 if self.flags != other.flags: return False
14356 if self.entries != other.entries: return False
14357 return True
14358
14359 def pretty_print(self, q):
14360 q.text("queue_stats_reply {")
14361 with q.group():
14362 with q.indent(2):
14363 q.breakable()
14364 q.text("xid = ");
14365 if self.xid != None:
14366 q.text("%#x" % self.xid)
14367 else:
14368 q.text('None')
14369 q.text(","); q.breakable()
14370 q.text("flags = ");
14371 q.text("%#x" % self.flags)
14372 q.text(","); q.breakable()
14373 q.text("entries = ");
14374 q.pp(self.entries)
14375 q.breakable()
14376 q.text('}')
14377
14378stats_reply.subtypes[5] = queue_stats_reply
14379
14380class queue_stats_request(stats_request):
14381 version = 4
14382 type = 18
14383 stats_type = 5
14384
14385 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14386 if xid != None:
14387 self.xid = xid
14388 else:
14389 self.xid = None
14390 if flags != None:
14391 self.flags = flags
14392 else:
14393 self.flags = 0
14394 if port_no != None:
14395 self.port_no = port_no
14396 else:
14397 self.port_no = 0
14398 if queue_id != None:
14399 self.queue_id = queue_id
14400 else:
14401 self.queue_id = 0
14402 return
14403
14404 def pack(self):
14405 packed = []
14406 packed.append(struct.pack("!B", self.version))
14407 packed.append(struct.pack("!B", self.type))
14408 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14409 packed.append(struct.pack("!L", self.xid))
14410 packed.append(struct.pack("!H", self.stats_type))
14411 packed.append(struct.pack("!H", self.flags))
14412 packed.append('\x00' * 4)
14413 packed.append(util.pack_port_no(self.port_no))
14414 packed.append(struct.pack("!L", self.queue_id))
14415 length = sum([len(x) for x in packed])
14416 packed[2] = struct.pack("!H", length)
14417 return ''.join(packed)
14418
14419 @staticmethod
14420 def unpack(reader):
14421 obj = queue_stats_request()
14422 _version = reader.read("!B")[0]
14423 assert(_version == 4)
14424 _type = reader.read("!B")[0]
14425 assert(_type == 18)
14426 _length = reader.read("!H")[0]
14427 orig_reader = reader
14428 reader = orig_reader.slice(_length, 4)
14429 obj.xid = reader.read("!L")[0]
14430 _stats_type = reader.read("!H")[0]
14431 assert(_stats_type == 5)
14432 obj.flags = reader.read("!H")[0]
14433 reader.skip(4)
14434 obj.port_no = util.unpack_port_no(reader)
14435 obj.queue_id = reader.read("!L")[0]
14436 return obj
14437
14438 def __eq__(self, other):
14439 if type(self) != type(other): return False
14440 if self.xid != other.xid: return False
14441 if self.flags != other.flags: return False
14442 if self.port_no != other.port_no: return False
14443 if self.queue_id != other.queue_id: return False
14444 return True
14445
14446 def pretty_print(self, q):
14447 q.text("queue_stats_request {")
14448 with q.group():
14449 with q.indent(2):
14450 q.breakable()
14451 q.text("xid = ");
14452 if self.xid != None:
14453 q.text("%#x" % self.xid)
14454 else:
14455 q.text('None')
14456 q.text(","); q.breakable()
14457 q.text("flags = ");
14458 q.text("%#x" % self.flags)
14459 q.text(","); q.breakable()
14460 q.text("port_no = ");
14461 q.text(util.pretty_port(self.port_no))
14462 q.text(","); q.breakable()
14463 q.text("queue_id = ");
14464 q.text("%#x" % self.queue_id)
14465 q.breakable()
14466 q.text('}')
14467
14468stats_request.subtypes[5] = queue_stats_request
14469
14470class role_reply(message):
14471 version = 4
14472 type = 25
14473
14474 def __init__(self, xid=None, role=None, generation_id=None):
14475 if xid != None:
14476 self.xid = xid
14477 else:
14478 self.xid = None
14479 if role != None:
14480 self.role = role
14481 else:
14482 self.role = 0
14483 if generation_id != None:
14484 self.generation_id = generation_id
14485 else:
14486 self.generation_id = 0
14487 return
14488
14489 def pack(self):
14490 packed = []
14491 packed.append(struct.pack("!B", self.version))
14492 packed.append(struct.pack("!B", self.type))
14493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14494 packed.append(struct.pack("!L", self.xid))
14495 packed.append(struct.pack("!L", self.role))
14496 packed.append('\x00' * 4)
14497 packed.append(struct.pack("!Q", self.generation_id))
14498 length = sum([len(x) for x in packed])
14499 packed[2] = struct.pack("!H", length)
14500 return ''.join(packed)
14501
14502 @staticmethod
14503 def unpack(reader):
14504 obj = role_reply()
14505 _version = reader.read("!B")[0]
14506 assert(_version == 4)
14507 _type = reader.read("!B")[0]
14508 assert(_type == 25)
14509 _length = reader.read("!H")[0]
14510 orig_reader = reader
14511 reader = orig_reader.slice(_length, 4)
14512 obj.xid = reader.read("!L")[0]
14513 obj.role = reader.read("!L")[0]
14514 reader.skip(4)
14515 obj.generation_id = reader.read("!Q")[0]
14516 return obj
14517
14518 def __eq__(self, other):
14519 if type(self) != type(other): return False
14520 if self.xid != other.xid: return False
14521 if self.role != other.role: return False
14522 if self.generation_id != other.generation_id: return False
14523 return True
14524
14525 def pretty_print(self, q):
14526 q.text("role_reply {")
14527 with q.group():
14528 with q.indent(2):
14529 q.breakable()
14530 q.text("xid = ");
14531 if self.xid != None:
14532 q.text("%#x" % self.xid)
14533 else:
14534 q.text('None')
14535 q.text(","); q.breakable()
14536 q.text("role = ");
14537 q.text("%#x" % self.role)
14538 q.text(","); q.breakable()
14539 q.text("generation_id = ");
14540 q.text("%#x" % self.generation_id)
14541 q.breakable()
14542 q.text('}')
14543
14544message.subtypes[25] = role_reply
14545
14546class role_request(message):
14547 version = 4
14548 type = 24
14549
14550 def __init__(self, xid=None, role=None, generation_id=None):
14551 if xid != None:
14552 self.xid = xid
14553 else:
14554 self.xid = None
14555 if role != None:
14556 self.role = role
14557 else:
14558 self.role = 0
14559 if generation_id != None:
14560 self.generation_id = generation_id
14561 else:
14562 self.generation_id = 0
14563 return
14564
14565 def pack(self):
14566 packed = []
14567 packed.append(struct.pack("!B", self.version))
14568 packed.append(struct.pack("!B", self.type))
14569 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14570 packed.append(struct.pack("!L", self.xid))
14571 packed.append(struct.pack("!L", self.role))
14572 packed.append('\x00' * 4)
14573 packed.append(struct.pack("!Q", self.generation_id))
14574 length = sum([len(x) for x in packed])
14575 packed[2] = struct.pack("!H", length)
14576 return ''.join(packed)
14577
14578 @staticmethod
14579 def unpack(reader):
14580 obj = role_request()
14581 _version = reader.read("!B")[0]
14582 assert(_version == 4)
14583 _type = reader.read("!B")[0]
14584 assert(_type == 24)
14585 _length = reader.read("!H")[0]
14586 orig_reader = reader
14587 reader = orig_reader.slice(_length, 4)
14588 obj.xid = reader.read("!L")[0]
14589 obj.role = reader.read("!L")[0]
14590 reader.skip(4)
14591 obj.generation_id = reader.read("!Q")[0]
14592 return obj
14593
14594 def __eq__(self, other):
14595 if type(self) != type(other): return False
14596 if self.xid != other.xid: return False
14597 if self.role != other.role: return False
14598 if self.generation_id != other.generation_id: return False
14599 return True
14600
14601 def pretty_print(self, q):
14602 q.text("role_request {")
14603 with q.group():
14604 with q.indent(2):
14605 q.breakable()
14606 q.text("xid = ");
14607 if self.xid != None:
14608 q.text("%#x" % self.xid)
14609 else:
14610 q.text('None')
14611 q.text(","); q.breakable()
14612 q.text("role = ");
14613 q.text("%#x" % self.role)
14614 q.text(","); q.breakable()
14615 q.text("generation_id = ");
14616 q.text("%#x" % self.generation_id)
14617 q.breakable()
14618 q.text('}')
14619
14620message.subtypes[24] = role_request
14621
14622class role_request_failed_error_msg(error_msg):
14623 version = 4
14624 type = 1
14625 err_type = 11
14626
14627 def __init__(self, xid=None, code=None, data=None):
14628 if xid != None:
14629 self.xid = xid
14630 else:
14631 self.xid = None
14632 if code != None:
14633 self.code = code
14634 else:
14635 self.code = 0
14636 if data != None:
14637 self.data = data
14638 else:
14639 self.data = ''
14640 return
14641
14642 def pack(self):
14643 packed = []
14644 packed.append(struct.pack("!B", self.version))
14645 packed.append(struct.pack("!B", self.type))
14646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14647 packed.append(struct.pack("!L", self.xid))
14648 packed.append(struct.pack("!H", self.err_type))
14649 packed.append(struct.pack("!H", self.code))
14650 packed.append(self.data)
14651 length = sum([len(x) for x in packed])
14652 packed[2] = struct.pack("!H", length)
14653 return ''.join(packed)
14654
14655 @staticmethod
14656 def unpack(reader):
14657 obj = role_request_failed_error_msg()
14658 _version = reader.read("!B")[0]
14659 assert(_version == 4)
14660 _type = reader.read("!B")[0]
14661 assert(_type == 1)
14662 _length = reader.read("!H")[0]
14663 orig_reader = reader
14664 reader = orig_reader.slice(_length, 4)
14665 obj.xid = reader.read("!L")[0]
14666 _err_type = reader.read("!H")[0]
14667 assert(_err_type == 11)
14668 obj.code = reader.read("!H")[0]
14669 obj.data = str(reader.read_all())
14670 return obj
14671
14672 def __eq__(self, other):
14673 if type(self) != type(other): return False
14674 if self.xid != other.xid: return False
14675 if self.code != other.code: return False
14676 if self.data != other.data: return False
14677 return True
14678
14679 def pretty_print(self, q):
14680 q.text("role_request_failed_error_msg {")
14681 with q.group():
14682 with q.indent(2):
14683 q.breakable()
14684 q.text("xid = ");
14685 if self.xid != None:
14686 q.text("%#x" % self.xid)
14687 else:
14688 q.text('None')
14689 q.text(","); q.breakable()
14690 q.text("code = ");
14691 q.text("%#x" % self.code)
14692 q.text(","); q.breakable()
14693 q.text("data = ");
14694 q.pp(self.data)
14695 q.breakable()
14696 q.text('}')
14697
14698error_msg.subtypes[11] = role_request_failed_error_msg
14699
14700class set_config(message):
14701 version = 4
14702 type = 9
14703
14704 def __init__(self, xid=None, flags=None, miss_send_len=None):
14705 if xid != None:
14706 self.xid = xid
14707 else:
14708 self.xid = None
14709 if flags != None:
14710 self.flags = flags
14711 else:
14712 self.flags = 0
14713 if miss_send_len != None:
14714 self.miss_send_len = miss_send_len
14715 else:
14716 self.miss_send_len = 0
14717 return
14718
14719 def pack(self):
14720 packed = []
14721 packed.append(struct.pack("!B", self.version))
14722 packed.append(struct.pack("!B", self.type))
14723 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14724 packed.append(struct.pack("!L", self.xid))
14725 packed.append(struct.pack("!H", self.flags))
14726 packed.append(struct.pack("!H", self.miss_send_len))
14727 length = sum([len(x) for x in packed])
14728 packed[2] = struct.pack("!H", length)
14729 return ''.join(packed)
14730
14731 @staticmethod
14732 def unpack(reader):
14733 obj = set_config()
14734 _version = reader.read("!B")[0]
14735 assert(_version == 4)
14736 _type = reader.read("!B")[0]
14737 assert(_type == 9)
14738 _length = reader.read("!H")[0]
14739 orig_reader = reader
14740 reader = orig_reader.slice(_length, 4)
14741 obj.xid = reader.read("!L")[0]
14742 obj.flags = reader.read("!H")[0]
14743 obj.miss_send_len = reader.read("!H")[0]
14744 return obj
14745
14746 def __eq__(self, other):
14747 if type(self) != type(other): return False
14748 if self.xid != other.xid: return False
14749 if self.flags != other.flags: return False
14750 if self.miss_send_len != other.miss_send_len: return False
14751 return True
14752
14753 def pretty_print(self, q):
14754 q.text("set_config {")
14755 with q.group():
14756 with q.indent(2):
14757 q.breakable()
14758 q.text("xid = ");
14759 if self.xid != None:
14760 q.text("%#x" % self.xid)
14761 else:
14762 q.text('None')
14763 q.text(","); q.breakable()
14764 q.text("flags = ");
14765 q.text("%#x" % self.flags)
14766 q.text(","); q.breakable()
14767 q.text("miss_send_len = ");
14768 q.text("%#x" % self.miss_send_len)
14769 q.breakable()
14770 q.text('}')
14771
14772message.subtypes[9] = set_config
14773
14774class switch_config_failed_error_msg(error_msg):
14775 version = 4
14776 type = 1
14777 err_type = 10
14778
14779 def __init__(self, xid=None, code=None, data=None):
14780 if xid != None:
14781 self.xid = xid
14782 else:
14783 self.xid = None
14784 if code != None:
14785 self.code = code
14786 else:
14787 self.code = 0
14788 if data != None:
14789 self.data = data
14790 else:
14791 self.data = ''
14792 return
14793
14794 def pack(self):
14795 packed = []
14796 packed.append(struct.pack("!B", self.version))
14797 packed.append(struct.pack("!B", self.type))
14798 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14799 packed.append(struct.pack("!L", self.xid))
14800 packed.append(struct.pack("!H", self.err_type))
14801 packed.append(struct.pack("!H", self.code))
14802 packed.append(self.data)
14803 length = sum([len(x) for x in packed])
14804 packed[2] = struct.pack("!H", length)
14805 return ''.join(packed)
14806
14807 @staticmethod
14808 def unpack(reader):
14809 obj = switch_config_failed_error_msg()
14810 _version = reader.read("!B")[0]
14811 assert(_version == 4)
14812 _type = reader.read("!B")[0]
14813 assert(_type == 1)
14814 _length = reader.read("!H")[0]
14815 orig_reader = reader
14816 reader = orig_reader.slice(_length, 4)
14817 obj.xid = reader.read("!L")[0]
14818 _err_type = reader.read("!H")[0]
14819 assert(_err_type == 10)
14820 obj.code = reader.read("!H")[0]
14821 obj.data = str(reader.read_all())
14822 return obj
14823
14824 def __eq__(self, other):
14825 if type(self) != type(other): return False
14826 if self.xid != other.xid: return False
14827 if self.code != other.code: return False
14828 if self.data != other.data: return False
14829 return True
14830
14831 def pretty_print(self, q):
14832 q.text("switch_config_failed_error_msg {")
14833 with q.group():
14834 with q.indent(2):
14835 q.breakable()
14836 q.text("xid = ");
14837 if self.xid != None:
14838 q.text("%#x" % self.xid)
14839 else:
14840 q.text('None')
14841 q.text(","); q.breakable()
14842 q.text("code = ");
14843 q.text("%#x" % self.code)
14844 q.text(","); q.breakable()
14845 q.text("data = ");
14846 q.pp(self.data)
14847 q.breakable()
14848 q.text('}')
14849
14850error_msg.subtypes[10] = switch_config_failed_error_msg
14851
14852class table_features_failed_error_msg(error_msg):
14853 version = 4
14854 type = 1
14855 err_type = 13
14856
14857 def __init__(self, xid=None, code=None, data=None):
14858 if xid != None:
14859 self.xid = xid
14860 else:
14861 self.xid = None
14862 if code != None:
14863 self.code = code
14864 else:
14865 self.code = 0
14866 if data != None:
14867 self.data = data
14868 else:
14869 self.data = ''
14870 return
14871
14872 def pack(self):
14873 packed = []
14874 packed.append(struct.pack("!B", self.version))
14875 packed.append(struct.pack("!B", self.type))
14876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14877 packed.append(struct.pack("!L", self.xid))
14878 packed.append(struct.pack("!H", self.err_type))
14879 packed.append(struct.pack("!H", self.code))
14880 packed.append(self.data)
14881 length = sum([len(x) for x in packed])
14882 packed[2] = struct.pack("!H", length)
14883 return ''.join(packed)
14884
14885 @staticmethod
14886 def unpack(reader):
14887 obj = table_features_failed_error_msg()
14888 _version = reader.read("!B")[0]
14889 assert(_version == 4)
14890 _type = reader.read("!B")[0]
14891 assert(_type == 1)
14892 _length = reader.read("!H")[0]
14893 orig_reader = reader
14894 reader = orig_reader.slice(_length, 4)
14895 obj.xid = reader.read("!L")[0]
14896 _err_type = reader.read("!H")[0]
14897 assert(_err_type == 13)
14898 obj.code = reader.read("!H")[0]
14899 obj.data = str(reader.read_all())
14900 return obj
14901
14902 def __eq__(self, other):
14903 if type(self) != type(other): return False
14904 if self.xid != other.xid: return False
14905 if self.code != other.code: return False
14906 if self.data != other.data: return False
14907 return True
14908
14909 def pretty_print(self, q):
14910 q.text("table_features_failed_error_msg {")
14911 with q.group():
14912 with q.indent(2):
14913 q.breakable()
14914 q.text("xid = ");
14915 if self.xid != None:
14916 q.text("%#x" % self.xid)
14917 else:
14918 q.text('None')
14919 q.text(","); q.breakable()
14920 q.text("code = ");
14921 q.text("%#x" % self.code)
14922 q.text(","); q.breakable()
14923 q.text("data = ");
14924 q.pp(self.data)
14925 q.breakable()
14926 q.text('}')
14927
14928error_msg.subtypes[13] = table_features_failed_error_msg
14929
14930class table_features_stats_reply(stats_reply):
14931 version = 4
14932 type = 19
14933 stats_type = 12
14934
14935 def __init__(self, xid=None, flags=None, entries=None):
14936 if xid != None:
14937 self.xid = xid
14938 else:
14939 self.xid = None
14940 if flags != None:
14941 self.flags = flags
14942 else:
14943 self.flags = 0
14944 if entries != None:
14945 self.entries = entries
14946 else:
14947 self.entries = []
14948 return
14949
14950 def pack(self):
14951 packed = []
14952 packed.append(struct.pack("!B", self.version))
14953 packed.append(struct.pack("!B", self.type))
14954 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14955 packed.append(struct.pack("!L", self.xid))
14956 packed.append(struct.pack("!H", self.stats_type))
14957 packed.append(struct.pack("!H", self.flags))
14958 packed.append('\x00' * 4)
14959 packed.append(loxi.generic_util.pack_list(self.entries))
14960 length = sum([len(x) for x in packed])
14961 packed[2] = struct.pack("!H", length)
14962 return ''.join(packed)
14963
14964 @staticmethod
14965 def unpack(reader):
14966 obj = table_features_stats_reply()
14967 _version = reader.read("!B")[0]
14968 assert(_version == 4)
14969 _type = reader.read("!B")[0]
14970 assert(_type == 19)
14971 _length = reader.read("!H")[0]
14972 orig_reader = reader
14973 reader = orig_reader.slice(_length, 4)
14974 obj.xid = reader.read("!L")[0]
14975 _stats_type = reader.read("!H")[0]
14976 assert(_stats_type == 12)
14977 obj.flags = reader.read("!H")[0]
14978 reader.skip(4)
14979 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
14980 return obj
14981
14982 def __eq__(self, other):
14983 if type(self) != type(other): return False
14984 if self.xid != other.xid: return False
14985 if self.flags != other.flags: return False
14986 if self.entries != other.entries: return False
14987 return True
14988
14989 def pretty_print(self, q):
14990 q.text("table_features_stats_reply {")
14991 with q.group():
14992 with q.indent(2):
14993 q.breakable()
14994 q.text("xid = ");
14995 if self.xid != None:
14996 q.text("%#x" % self.xid)
14997 else:
14998 q.text('None')
14999 q.text(","); q.breakable()
15000 q.text("flags = ");
15001 q.text("%#x" % self.flags)
15002 q.text(","); q.breakable()
15003 q.text("entries = ");
15004 q.pp(self.entries)
15005 q.breakable()
15006 q.text('}')
15007
15008stats_reply.subtypes[12] = table_features_stats_reply
15009
15010class table_features_stats_request(stats_request):
15011 version = 4
15012 type = 18
15013 stats_type = 12
15014
15015 def __init__(self, xid=None, flags=None, entries=None):
15016 if xid != None:
15017 self.xid = xid
15018 else:
15019 self.xid = None
15020 if flags != None:
15021 self.flags = flags
15022 else:
15023 self.flags = 0
15024 if entries != None:
15025 self.entries = entries
15026 else:
15027 self.entries = []
15028 return
15029
15030 def pack(self):
15031 packed = []
15032 packed.append(struct.pack("!B", self.version))
15033 packed.append(struct.pack("!B", self.type))
15034 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15035 packed.append(struct.pack("!L", self.xid))
15036 packed.append(struct.pack("!H", self.stats_type))
15037 packed.append(struct.pack("!H", self.flags))
15038 packed.append('\x00' * 4)
15039 packed.append(loxi.generic_util.pack_list(self.entries))
15040 length = sum([len(x) for x in packed])
15041 packed[2] = struct.pack("!H", length)
15042 return ''.join(packed)
15043
15044 @staticmethod
15045 def unpack(reader):
15046 obj = table_features_stats_request()
15047 _version = reader.read("!B")[0]
15048 assert(_version == 4)
15049 _type = reader.read("!B")[0]
15050 assert(_type == 18)
15051 _length = reader.read("!H")[0]
15052 orig_reader = reader
15053 reader = orig_reader.slice(_length, 4)
15054 obj.xid = reader.read("!L")[0]
15055 _stats_type = reader.read("!H")[0]
15056 assert(_stats_type == 12)
15057 obj.flags = reader.read("!H")[0]
15058 reader.skip(4)
15059 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
15060 return obj
15061
15062 def __eq__(self, other):
15063 if type(self) != type(other): return False
15064 if self.xid != other.xid: return False
15065 if self.flags != other.flags: return False
15066 if self.entries != other.entries: return False
15067 return True
15068
15069 def pretty_print(self, q):
15070 q.text("table_features_stats_request {")
15071 with q.group():
15072 with q.indent(2):
15073 q.breakable()
15074 q.text("xid = ");
15075 if self.xid != None:
15076 q.text("%#x" % self.xid)
15077 else:
15078 q.text('None')
15079 q.text(","); q.breakable()
15080 q.text("flags = ");
15081 q.text("%#x" % self.flags)
15082 q.text(","); q.breakable()
15083 q.text("entries = ");
15084 q.pp(self.entries)
15085 q.breakable()
15086 q.text('}')
15087
15088stats_request.subtypes[12] = table_features_stats_request
15089
15090class table_mod(message):
15091 version = 4
15092 type = 17
15093
15094 def __init__(self, xid=None, table_id=None, config=None):
15095 if xid != None:
15096 self.xid = xid
15097 else:
15098 self.xid = None
15099 if table_id != None:
15100 self.table_id = table_id
15101 else:
15102 self.table_id = 0
15103 if config != None:
15104 self.config = config
15105 else:
15106 self.config = 0
15107 return
15108
15109 def pack(self):
15110 packed = []
15111 packed.append(struct.pack("!B", self.version))
15112 packed.append(struct.pack("!B", self.type))
15113 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15114 packed.append(struct.pack("!L", self.xid))
15115 packed.append(struct.pack("!B", self.table_id))
15116 packed.append('\x00' * 3)
15117 packed.append(struct.pack("!L", self.config))
15118 length = sum([len(x) for x in packed])
15119 packed[2] = struct.pack("!H", length)
15120 return ''.join(packed)
15121
15122 @staticmethod
15123 def unpack(reader):
15124 obj = table_mod()
15125 _version = reader.read("!B")[0]
15126 assert(_version == 4)
15127 _type = reader.read("!B")[0]
15128 assert(_type == 17)
15129 _length = reader.read("!H")[0]
15130 orig_reader = reader
15131 reader = orig_reader.slice(_length, 4)
15132 obj.xid = reader.read("!L")[0]
15133 obj.table_id = reader.read("!B")[0]
15134 reader.skip(3)
15135 obj.config = reader.read("!L")[0]
15136 return obj
15137
15138 def __eq__(self, other):
15139 if type(self) != type(other): return False
15140 if self.xid != other.xid: return False
15141 if self.table_id != other.table_id: return False
15142 if self.config != other.config: return False
15143 return True
15144
15145 def pretty_print(self, q):
15146 q.text("table_mod {")
15147 with q.group():
15148 with q.indent(2):
15149 q.breakable()
15150 q.text("xid = ");
15151 if self.xid != None:
15152 q.text("%#x" % self.xid)
15153 else:
15154 q.text('None')
15155 q.text(","); q.breakable()
15156 q.text("table_id = ");
15157 q.text("%#x" % self.table_id)
15158 q.text(","); q.breakable()
15159 q.text("config = ");
15160 q.text("%#x" % self.config)
15161 q.breakable()
15162 q.text('}')
15163
15164message.subtypes[17] = table_mod
15165
15166class table_mod_failed_error_msg(error_msg):
15167 version = 4
15168 type = 1
15169 err_type = 8
15170
15171 def __init__(self, xid=None, code=None, data=None):
15172 if xid != None:
15173 self.xid = xid
15174 else:
15175 self.xid = None
15176 if code != None:
15177 self.code = code
15178 else:
15179 self.code = 0
15180 if data != None:
15181 self.data = data
15182 else:
15183 self.data = ''
15184 return
15185
15186 def pack(self):
15187 packed = []
15188 packed.append(struct.pack("!B", self.version))
15189 packed.append(struct.pack("!B", self.type))
15190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15191 packed.append(struct.pack("!L", self.xid))
15192 packed.append(struct.pack("!H", self.err_type))
15193 packed.append(struct.pack("!H", self.code))
15194 packed.append(self.data)
15195 length = sum([len(x) for x in packed])
15196 packed[2] = struct.pack("!H", length)
15197 return ''.join(packed)
15198
15199 @staticmethod
15200 def unpack(reader):
15201 obj = table_mod_failed_error_msg()
15202 _version = reader.read("!B")[0]
15203 assert(_version == 4)
15204 _type = reader.read("!B")[0]
15205 assert(_type == 1)
15206 _length = reader.read("!H")[0]
15207 orig_reader = reader
15208 reader = orig_reader.slice(_length, 4)
15209 obj.xid = reader.read("!L")[0]
15210 _err_type = reader.read("!H")[0]
15211 assert(_err_type == 8)
15212 obj.code = reader.read("!H")[0]
15213 obj.data = str(reader.read_all())
15214 return obj
15215
15216 def __eq__(self, other):
15217 if type(self) != type(other): return False
15218 if self.xid != other.xid: return False
15219 if self.code != other.code: return False
15220 if self.data != other.data: return False
15221 return True
15222
15223 def pretty_print(self, q):
15224 q.text("table_mod_failed_error_msg {")
15225 with q.group():
15226 with q.indent(2):
15227 q.breakable()
15228 q.text("xid = ");
15229 if self.xid != None:
15230 q.text("%#x" % self.xid)
15231 else:
15232 q.text('None')
15233 q.text(","); q.breakable()
15234 q.text("code = ");
15235 q.text("%#x" % self.code)
15236 q.text(","); q.breakable()
15237 q.text("data = ");
15238 q.pp(self.data)
15239 q.breakable()
15240 q.text('}')
15241
15242error_msg.subtypes[8] = table_mod_failed_error_msg
15243
15244class table_stats_reply(stats_reply):
15245 version = 4
15246 type = 19
15247 stats_type = 3
15248
15249 def __init__(self, xid=None, flags=None, entries=None):
15250 if xid != None:
15251 self.xid = xid
15252 else:
15253 self.xid = None
15254 if flags != None:
15255 self.flags = flags
15256 else:
15257 self.flags = 0
15258 if entries != None:
15259 self.entries = entries
15260 else:
15261 self.entries = []
15262 return
15263
15264 def pack(self):
15265 packed = []
15266 packed.append(struct.pack("!B", self.version))
15267 packed.append(struct.pack("!B", self.type))
15268 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15269 packed.append(struct.pack("!L", self.xid))
15270 packed.append(struct.pack("!H", self.stats_type))
15271 packed.append(struct.pack("!H", self.flags))
15272 packed.append('\x00' * 4)
15273 packed.append(loxi.generic_util.pack_list(self.entries))
15274 length = sum([len(x) for x in packed])
15275 packed[2] = struct.pack("!H", length)
15276 return ''.join(packed)
15277
15278 @staticmethod
15279 def unpack(reader):
15280 obj = table_stats_reply()
15281 _version = reader.read("!B")[0]
15282 assert(_version == 4)
15283 _type = reader.read("!B")[0]
15284 assert(_type == 19)
15285 _length = reader.read("!H")[0]
15286 orig_reader = reader
15287 reader = orig_reader.slice(_length, 4)
15288 obj.xid = reader.read("!L")[0]
15289 _stats_type = reader.read("!H")[0]
15290 assert(_stats_type == 3)
15291 obj.flags = reader.read("!H")[0]
15292 reader.skip(4)
15293 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
15294 return obj
15295
15296 def __eq__(self, other):
15297 if type(self) != type(other): return False
15298 if self.xid != other.xid: return False
15299 if self.flags != other.flags: return False
15300 if self.entries != other.entries: return False
15301 return True
15302
15303 def pretty_print(self, q):
15304 q.text("table_stats_reply {")
15305 with q.group():
15306 with q.indent(2):
15307 q.breakable()
15308 q.text("xid = ");
15309 if self.xid != None:
15310 q.text("%#x" % self.xid)
15311 else:
15312 q.text('None')
15313 q.text(","); q.breakable()
15314 q.text("flags = ");
15315 q.text("%#x" % self.flags)
15316 q.text(","); q.breakable()
15317 q.text("entries = ");
15318 q.pp(self.entries)
15319 q.breakable()
15320 q.text('}')
15321
15322stats_reply.subtypes[3] = table_stats_reply
15323
15324class table_stats_request(stats_request):
15325 version = 4
15326 type = 18
15327 stats_type = 3
15328
15329 def __init__(self, xid=None, flags=None):
15330 if xid != None:
15331 self.xid = xid
15332 else:
15333 self.xid = None
15334 if flags != None:
15335 self.flags = flags
15336 else:
15337 self.flags = 0
15338 return
15339
15340 def pack(self):
15341 packed = []
15342 packed.append(struct.pack("!B", self.version))
15343 packed.append(struct.pack("!B", self.type))
15344 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15345 packed.append(struct.pack("!L", self.xid))
15346 packed.append(struct.pack("!H", self.stats_type))
15347 packed.append(struct.pack("!H", self.flags))
15348 packed.append('\x00' * 4)
15349 length = sum([len(x) for x in packed])
15350 packed[2] = struct.pack("!H", length)
15351 return ''.join(packed)
15352
15353 @staticmethod
15354 def unpack(reader):
15355 obj = table_stats_request()
15356 _version = reader.read("!B")[0]
15357 assert(_version == 4)
15358 _type = reader.read("!B")[0]
15359 assert(_type == 18)
15360 _length = reader.read("!H")[0]
15361 orig_reader = reader
15362 reader = orig_reader.slice(_length, 4)
15363 obj.xid = reader.read("!L")[0]
15364 _stats_type = reader.read("!H")[0]
15365 assert(_stats_type == 3)
15366 obj.flags = reader.read("!H")[0]
15367 reader.skip(4)
15368 return obj
15369
15370 def __eq__(self, other):
15371 if type(self) != type(other): return False
15372 if self.xid != other.xid: return False
15373 if self.flags != other.flags: return False
15374 return True
15375
15376 def pretty_print(self, q):
15377 q.text("table_stats_request {")
15378 with q.group():
15379 with q.indent(2):
15380 q.breakable()
15381 q.text("xid = ");
15382 if self.xid != None:
15383 q.text("%#x" % self.xid)
15384 else:
15385 q.text('None')
15386 q.text(","); q.breakable()
15387 q.text("flags = ");
15388 q.text("%#x" % self.flags)
15389 q.breakable()
15390 q.text('}')
15391
15392stats_request.subtypes[3] = table_stats_request
15393
15394
15395def parse_header(buf):
15396 if len(buf) < 8:
15397 raise loxi.ProtocolError("too short to be an OpenFlow message")
15398 return struct.unpack_from("!BBHL", buf)
15399
15400def parse_message(buf):
15401 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
15402 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
15403 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
15404 if len(buf) != msg_len:
15405 raise loxi.ProtocolError("incorrect message size")
15406 return message.unpack(loxi.generic_util.OFReader(buf))