blob: e1962ee8c61650648a7a3273faef4f796499bb60 [file] [log] [blame]
Rich Lane2e079da2014-10-29 15:30:24 -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
Rich Lane2e079da2014-10-29 15:30:24 -070011import util
12import loxi.generic_util
13
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of14']
16
Rich Lane2e079da2014-10-29 15:30:24 -070017class message(loxi.OFObject):
18 subtypes = {}
19
20 version = 5
21
22 def __init__(self, type=None, xid=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 if xid != None:
28 self.xid = xid
29 else:
30 self.xid = None
31 return
32
33 def pack(self):
34 packed = []
35 packed.append(struct.pack("!B", self.version))
36 packed.append(struct.pack("!B", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
38 packed.append(struct.pack("!L", self.xid))
39 length = sum([len(x) for x in packed])
40 packed[2] = struct.pack("!H", length)
41 return ''.join(packed)
42
43 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('B', 1)
46 subclass = message.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = message()
51 _version = reader.read("!B")[0]
52 assert(_version == 5)
53 obj.type = reader.read("!B")[0]
54 _length = reader.read("!H")[0]
55 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080056 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070057 obj.xid = reader.read("!L")[0]
58 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.type != other.type: return False
63 if self.xid != other.xid: return False
64 return True
65
66 def pretty_print(self, q):
67 q.text("message {")
68 with q.group():
69 with q.indent(2):
70 q.breakable()
71 q.text("xid = ");
72 if self.xid != None:
73 q.text("%#x" % self.xid)
74 else:
75 q.text('None')
76 q.breakable()
77 q.text('}')
78
79
80class stats_reply(message):
81 subtypes = {}
82
83 version = 5
84 type = 19
85
86 def __init__(self, xid=None, stats_type=None, flags=None):
87 if xid != None:
88 self.xid = xid
89 else:
90 self.xid = None
91 if stats_type != None:
92 self.stats_type = stats_type
93 else:
94 self.stats_type = 0
95 if flags != None:
96 self.flags = flags
97 else:
98 self.flags = 0
99 return
100
101 def pack(self):
102 packed = []
103 packed.append(struct.pack("!B", self.version))
104 packed.append(struct.pack("!B", self.type))
105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
106 packed.append(struct.pack("!L", self.xid))
107 packed.append(struct.pack("!H", self.stats_type))
108 packed.append(struct.pack("!H", self.flags))
109 packed.append('\x00' * 4)
110 length = sum([len(x) for x in packed])
111 packed[2] = struct.pack("!H", length)
112 return ''.join(packed)
113
114 @staticmethod
115 def unpack(reader):
116 subtype, = reader.peek('!H', 8)
117 subclass = stats_reply.subtypes.get(subtype)
118 if subclass:
119 return subclass.unpack(reader)
120
121 obj = stats_reply()
122 _version = reader.read("!B")[0]
123 assert(_version == 5)
124 _type = reader.read("!B")[0]
125 assert(_type == 19)
126 _length = reader.read("!H")[0]
127 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800128 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700129 obj.xid = reader.read("!L")[0]
130 obj.stats_type = reader.read("!H")[0]
131 obj.flags = reader.read("!H")[0]
132 reader.skip(4)
133 return obj
134
135 def __eq__(self, other):
136 if type(self) != type(other): return False
137 if self.xid != other.xid: return False
138 if self.stats_type != other.stats_type: return False
139 if self.flags != other.flags: return False
140 return True
141
142 def pretty_print(self, q):
143 q.text("stats_reply {")
144 with q.group():
145 with q.indent(2):
146 q.breakable()
147 q.text("xid = ");
148 if self.xid != None:
149 q.text("%#x" % self.xid)
150 else:
151 q.text('None')
152 q.text(","); q.breakable()
153 q.text("flags = ");
154 q.text("%#x" % self.flags)
155 q.breakable()
156 q.text('}')
157
158message.subtypes[19] = stats_reply
159
160class aggregate_stats_reply(stats_reply):
161 version = 5
162 type = 19
163 stats_type = 2
164
165 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
166 if xid != None:
167 self.xid = xid
168 else:
169 self.xid = None
170 if flags != None:
171 self.flags = flags
172 else:
173 self.flags = 0
174 if packet_count != None:
175 self.packet_count = packet_count
176 else:
177 self.packet_count = 0
178 if byte_count != None:
179 self.byte_count = byte_count
180 else:
181 self.byte_count = 0
182 if flow_count != None:
183 self.flow_count = flow_count
184 else:
185 self.flow_count = 0
186 return
187
188 def pack(self):
189 packed = []
190 packed.append(struct.pack("!B", self.version))
191 packed.append(struct.pack("!B", self.type))
192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
193 packed.append(struct.pack("!L", self.xid))
194 packed.append(struct.pack("!H", self.stats_type))
195 packed.append(struct.pack("!H", self.flags))
196 packed.append('\x00' * 4)
197 packed.append(struct.pack("!Q", self.packet_count))
198 packed.append(struct.pack("!Q", self.byte_count))
199 packed.append(struct.pack("!L", self.flow_count))
200 packed.append('\x00' * 4)
201 length = sum([len(x) for x in packed])
202 packed[2] = struct.pack("!H", length)
203 return ''.join(packed)
204
205 @staticmethod
206 def unpack(reader):
207 obj = aggregate_stats_reply()
208 _version = reader.read("!B")[0]
209 assert(_version == 5)
210 _type = reader.read("!B")[0]
211 assert(_type == 19)
212 _length = reader.read("!H")[0]
213 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800214 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700215 obj.xid = reader.read("!L")[0]
216 _stats_type = reader.read("!H")[0]
217 assert(_stats_type == 2)
218 obj.flags = reader.read("!H")[0]
219 reader.skip(4)
220 obj.packet_count = reader.read("!Q")[0]
221 obj.byte_count = reader.read("!Q")[0]
222 obj.flow_count = reader.read("!L")[0]
223 reader.skip(4)
224 return obj
225
226 def __eq__(self, other):
227 if type(self) != type(other): return False
228 if self.xid != other.xid: return False
229 if self.flags != other.flags: return False
230 if self.packet_count != other.packet_count: return False
231 if self.byte_count != other.byte_count: return False
232 if self.flow_count != other.flow_count: return False
233 return True
234
235 def pretty_print(self, q):
236 q.text("aggregate_stats_reply {")
237 with q.group():
238 with q.indent(2):
239 q.breakable()
240 q.text("xid = ");
241 if self.xid != None:
242 q.text("%#x" % self.xid)
243 else:
244 q.text('None')
245 q.text(","); q.breakable()
246 q.text("flags = ");
247 q.text("%#x" % self.flags)
248 q.text(","); q.breakable()
249 q.text("packet_count = ");
250 q.text("%#x" % self.packet_count)
251 q.text(","); q.breakable()
252 q.text("byte_count = ");
253 q.text("%#x" % self.byte_count)
254 q.text(","); q.breakable()
255 q.text("flow_count = ");
256 q.text("%#x" % self.flow_count)
257 q.breakable()
258 q.text('}')
259
260stats_reply.subtypes[2] = aggregate_stats_reply
261
262class stats_request(message):
263 subtypes = {}
264
265 version = 5
266 type = 18
267
268 def __init__(self, xid=None, stats_type=None, flags=None):
269 if xid != None:
270 self.xid = xid
271 else:
272 self.xid = None
273 if stats_type != None:
274 self.stats_type = stats_type
275 else:
276 self.stats_type = 0
277 if flags != None:
278 self.flags = flags
279 else:
280 self.flags = 0
281 return
282
283 def pack(self):
284 packed = []
285 packed.append(struct.pack("!B", self.version))
286 packed.append(struct.pack("!B", self.type))
287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
288 packed.append(struct.pack("!L", self.xid))
289 packed.append(struct.pack("!H", self.stats_type))
290 packed.append(struct.pack("!H", self.flags))
291 packed.append('\x00' * 4)
292 length = sum([len(x) for x in packed])
293 packed[2] = struct.pack("!H", length)
294 return ''.join(packed)
295
296 @staticmethod
297 def unpack(reader):
298 subtype, = reader.peek('!H', 8)
299 subclass = stats_request.subtypes.get(subtype)
300 if subclass:
301 return subclass.unpack(reader)
302
303 obj = stats_request()
304 _version = reader.read("!B")[0]
305 assert(_version == 5)
306 _type = reader.read("!B")[0]
307 assert(_type == 18)
308 _length = reader.read("!H")[0]
309 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800310 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700311 obj.xid = reader.read("!L")[0]
312 obj.stats_type = reader.read("!H")[0]
313 obj.flags = reader.read("!H")[0]
314 reader.skip(4)
315 return obj
316
317 def __eq__(self, other):
318 if type(self) != type(other): return False
319 if self.xid != other.xid: return False
320 if self.stats_type != other.stats_type: return False
321 if self.flags != other.flags: return False
322 return True
323
324 def pretty_print(self, q):
325 q.text("stats_request {")
326 with q.group():
327 with q.indent(2):
328 q.breakable()
329 q.text("xid = ");
330 if self.xid != None:
331 q.text("%#x" % self.xid)
332 else:
333 q.text('None')
334 q.text(","); q.breakable()
335 q.text("flags = ");
336 q.text("%#x" % self.flags)
337 q.breakable()
338 q.text('}')
339
340message.subtypes[18] = stats_request
341
342class aggregate_stats_request(stats_request):
343 version = 5
344 type = 18
345 stats_type = 2
346
347 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
348 if xid != None:
349 self.xid = xid
350 else:
351 self.xid = None
352 if flags != None:
353 self.flags = flags
354 else:
355 self.flags = 0
356 if table_id != None:
357 self.table_id = table_id
358 else:
359 self.table_id = 0
360 if out_port != None:
361 self.out_port = out_port
362 else:
363 self.out_port = 0
364 if out_group != None:
365 self.out_group = out_group
366 else:
367 self.out_group = 0
368 if cookie != None:
369 self.cookie = cookie
370 else:
371 self.cookie = 0
372 if cookie_mask != None:
373 self.cookie_mask = cookie_mask
374 else:
375 self.cookie_mask = 0
376 if match != None:
377 self.match = match
378 else:
Rich Lanee2567702015-01-26 15:04:35 -0800379 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -0700380 return
381
382 def pack(self):
383 packed = []
384 packed.append(struct.pack("!B", self.version))
385 packed.append(struct.pack("!B", self.type))
386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
387 packed.append(struct.pack("!L", self.xid))
388 packed.append(struct.pack("!H", self.stats_type))
389 packed.append(struct.pack("!H", self.flags))
390 packed.append('\x00' * 4)
391 packed.append(struct.pack("!B", self.table_id))
392 packed.append('\x00' * 3)
393 packed.append(util.pack_port_no(self.out_port))
394 packed.append(struct.pack("!L", self.out_group))
395 packed.append('\x00' * 4)
396 packed.append(struct.pack("!Q", self.cookie))
397 packed.append(struct.pack("!Q", self.cookie_mask))
398 packed.append(self.match.pack())
399 length = sum([len(x) for x in packed])
400 packed[2] = struct.pack("!H", length)
401 return ''.join(packed)
402
403 @staticmethod
404 def unpack(reader):
405 obj = aggregate_stats_request()
406 _version = reader.read("!B")[0]
407 assert(_version == 5)
408 _type = reader.read("!B")[0]
409 assert(_type == 18)
410 _length = reader.read("!H")[0]
411 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800412 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700413 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]
Rich Lanee2567702015-01-26 15:04:35 -0800425 obj.match = ofp.match.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -0700426 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
Rich Laneccd32ed2014-11-10 17:48:24 -0800476class error_msg(message):
477 subtypes = {}
478
479 version = 5
480 type = 1
481
482 def __init__(self, xid=None, err_type=None):
483 if xid != None:
484 self.xid = xid
485 else:
486 self.xid = None
487 if err_type != None:
488 self.err_type = err_type
489 else:
490 self.err_type = 0
491 return
492
493 def pack(self):
494 packed = []
495 packed.append(struct.pack("!B", self.version))
496 packed.append(struct.pack("!B", self.type))
497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
498 packed.append(struct.pack("!L", self.xid))
499 packed.append(struct.pack("!H", self.err_type))
500 length = sum([len(x) for x in packed])
501 packed[2] = struct.pack("!H", length)
502 return ''.join(packed)
503
504 @staticmethod
505 def unpack(reader):
506 subtype, = reader.peek('!H', 8)
507 subclass = error_msg.subtypes.get(subtype)
508 if subclass:
509 return subclass.unpack(reader)
510
511 obj = error_msg()
512 _version = reader.read("!B")[0]
513 assert(_version == 5)
514 _type = reader.read("!B")[0]
515 assert(_type == 1)
516 _length = reader.read("!H")[0]
517 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800518 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800519 obj.xid = reader.read("!L")[0]
520 obj.err_type = reader.read("!H")[0]
521 return obj
522
523 def __eq__(self, other):
524 if type(self) != type(other): return False
525 if self.xid != other.xid: return False
526 if self.err_type != other.err_type: return False
527 return True
528
529 def pretty_print(self, q):
530 q.text("error_msg {")
531 with q.group():
532 with q.indent(2):
533 q.breakable()
534 q.text("xid = ");
535 if self.xid != None:
536 q.text("%#x" % self.xid)
537 else:
538 q.text('None')
539 q.breakable()
540 q.text('}')
541
542message.subtypes[1] = error_msg
543
544class async_config_failed_error_msg(error_msg):
545 version = 5
546 type = 1
547 err_type = 15
548
549 def __init__(self, xid=None, code=None, data=None):
550 if xid != None:
551 self.xid = xid
552 else:
553 self.xid = None
554 if code != None:
555 self.code = code
556 else:
557 self.code = 0
558 if data != None:
559 self.data = data
560 else:
561 self.data = ''
562 return
563
564 def pack(self):
565 packed = []
566 packed.append(struct.pack("!B", self.version))
567 packed.append(struct.pack("!B", self.type))
568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
569 packed.append(struct.pack("!L", self.xid))
570 packed.append(struct.pack("!H", self.err_type))
571 packed.append(struct.pack("!H", self.code))
572 packed.append(self.data)
573 length = sum([len(x) for x in packed])
574 packed[2] = struct.pack("!H", length)
575 return ''.join(packed)
576
577 @staticmethod
578 def unpack(reader):
579 obj = async_config_failed_error_msg()
580 _version = reader.read("!B")[0]
581 assert(_version == 5)
582 _type = reader.read("!B")[0]
583 assert(_type == 1)
584 _length = reader.read("!H")[0]
585 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800586 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800587 obj.xid = reader.read("!L")[0]
588 _err_type = reader.read("!H")[0]
589 assert(_err_type == 15)
590 obj.code = reader.read("!H")[0]
591 obj.data = str(reader.read_all())
592 return obj
593
594 def __eq__(self, other):
595 if type(self) != type(other): return False
596 if self.xid != other.xid: return False
597 if self.code != other.code: return False
598 if self.data != other.data: return False
599 return True
600
601 def pretty_print(self, q):
602 q.text("async_config_failed_error_msg {")
603 with q.group():
604 with q.indent(2):
605 q.breakable()
606 q.text("xid = ");
607 if self.xid != None:
608 q.text("%#x" % self.xid)
609 else:
610 q.text('None')
611 q.text(","); q.breakable()
612 q.text("code = ");
613 q.text("%#x" % self.code)
614 q.text(","); q.breakable()
615 q.text("data = ");
616 q.pp(self.data)
617 q.breakable()
618 q.text('}')
619
620error_msg.subtypes[15] = async_config_failed_error_msg
621
Rich Lane2e079da2014-10-29 15:30:24 -0700622class async_get_reply(message):
623 version = 5
624 type = 27
625
626 def __init__(self, xid=None, properties=None):
627 if xid != None:
628 self.xid = xid
629 else:
630 self.xid = None
631 if properties != None:
632 self.properties = properties
633 else:
634 self.properties = []
635 return
636
637 def pack(self):
638 packed = []
639 packed.append(struct.pack("!B", self.version))
640 packed.append(struct.pack("!B", self.type))
641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
642 packed.append(struct.pack("!L", self.xid))
643 packed.append(loxi.generic_util.pack_list(self.properties))
644 length = sum([len(x) for x in packed])
645 packed[2] = struct.pack("!H", length)
646 return ''.join(packed)
647
648 @staticmethod
649 def unpack(reader):
650 obj = async_get_reply()
651 _version = reader.read("!B")[0]
652 assert(_version == 5)
653 _type = reader.read("!B")[0]
654 assert(_type == 27)
655 _length = reader.read("!H")[0]
656 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800657 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700658 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800659 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -0700660 return obj
661
662 def __eq__(self, other):
663 if type(self) != type(other): return False
664 if self.xid != other.xid: return False
665 if self.properties != other.properties: return False
666 return True
667
668 def pretty_print(self, q):
669 q.text("async_get_reply {")
670 with q.group():
671 with q.indent(2):
672 q.breakable()
673 q.text("xid = ");
674 if self.xid != None:
675 q.text("%#x" % self.xid)
676 else:
677 q.text('None')
678 q.text(","); q.breakable()
679 q.text("properties = ");
680 q.pp(self.properties)
681 q.breakable()
682 q.text('}')
683
684message.subtypes[27] = async_get_reply
685
686class async_get_request(message):
687 version = 5
688 type = 26
689
690 def __init__(self, xid=None, properties=None):
691 if xid != None:
692 self.xid = xid
693 else:
694 self.xid = None
695 if properties != None:
696 self.properties = properties
697 else:
698 self.properties = []
699 return
700
701 def pack(self):
702 packed = []
703 packed.append(struct.pack("!B", self.version))
704 packed.append(struct.pack("!B", self.type))
705 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
706 packed.append(struct.pack("!L", self.xid))
707 packed.append(loxi.generic_util.pack_list(self.properties))
708 length = sum([len(x) for x in packed])
709 packed[2] = struct.pack("!H", length)
710 return ''.join(packed)
711
712 @staticmethod
713 def unpack(reader):
714 obj = async_get_request()
715 _version = reader.read("!B")[0]
716 assert(_version == 5)
717 _type = reader.read("!B")[0]
718 assert(_type == 26)
719 _length = reader.read("!H")[0]
720 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800721 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700722 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800723 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -0700724 return obj
725
726 def __eq__(self, other):
727 if type(self) != type(other): return False
728 if self.xid != other.xid: return False
729 if self.properties != other.properties: return False
730 return True
731
732 def pretty_print(self, q):
733 q.text("async_get_request {")
734 with q.group():
735 with q.indent(2):
736 q.breakable()
737 q.text("xid = ");
738 if self.xid != None:
739 q.text("%#x" % self.xid)
740 else:
741 q.text('None')
742 q.text(","); q.breakable()
743 q.text("properties = ");
744 q.pp(self.properties)
745 q.breakable()
746 q.text('}')
747
748message.subtypes[26] = async_get_request
749
750class async_set(message):
751 version = 5
752 type = 28
753
754 def __init__(self, xid=None, properties=None):
755 if xid != None:
756 self.xid = xid
757 else:
758 self.xid = None
759 if properties != None:
760 self.properties = properties
761 else:
762 self.properties = []
763 return
764
765 def pack(self):
766 packed = []
767 packed.append(struct.pack("!B", self.version))
768 packed.append(struct.pack("!B", self.type))
769 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
770 packed.append(struct.pack("!L", self.xid))
771 packed.append(loxi.generic_util.pack_list(self.properties))
772 length = sum([len(x) for x in packed])
773 packed[2] = struct.pack("!H", length)
774 return ''.join(packed)
775
776 @staticmethod
777 def unpack(reader):
778 obj = async_set()
779 _version = reader.read("!B")[0]
780 assert(_version == 5)
781 _type = reader.read("!B")[0]
782 assert(_type == 28)
783 _length = reader.read("!H")[0]
784 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800785 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700786 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800787 obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -0700788 return obj
789
790 def __eq__(self, other):
791 if type(self) != type(other): return False
792 if self.xid != other.xid: return False
793 if self.properties != other.properties: return False
794 return True
795
796 def pretty_print(self, q):
797 q.text("async_set {")
798 with q.group():
799 with q.indent(2):
800 q.breakable()
801 q.text("xid = ");
802 if self.xid != None:
803 q.text("%#x" % self.xid)
804 else:
805 q.text('None')
806 q.text(","); q.breakable()
807 q.text("properties = ");
808 q.pp(self.properties)
809 q.breakable()
810 q.text('}')
811
812message.subtypes[28] = async_set
813
Rich Lane2e079da2014-10-29 15:30:24 -0700814class bad_action_error_msg(error_msg):
815 version = 5
816 type = 1
817 err_type = 2
818
819 def __init__(self, xid=None, code=None, data=None):
820 if xid != None:
821 self.xid = xid
822 else:
823 self.xid = None
824 if code != None:
825 self.code = code
826 else:
827 self.code = 0
828 if data != None:
829 self.data = data
830 else:
831 self.data = ''
832 return
833
834 def pack(self):
835 packed = []
836 packed.append(struct.pack("!B", self.version))
837 packed.append(struct.pack("!B", self.type))
838 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
839 packed.append(struct.pack("!L", self.xid))
840 packed.append(struct.pack("!H", self.err_type))
841 packed.append(struct.pack("!H", self.code))
842 packed.append(self.data)
843 length = sum([len(x) for x in packed])
844 packed[2] = struct.pack("!H", length)
845 return ''.join(packed)
846
847 @staticmethod
848 def unpack(reader):
849 obj = bad_action_error_msg()
850 _version = reader.read("!B")[0]
851 assert(_version == 5)
852 _type = reader.read("!B")[0]
853 assert(_type == 1)
854 _length = reader.read("!H")[0]
855 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800856 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700857 obj.xid = reader.read("!L")[0]
858 _err_type = reader.read("!H")[0]
859 assert(_err_type == 2)
860 obj.code = reader.read("!H")[0]
861 obj.data = str(reader.read_all())
862 return obj
863
864 def __eq__(self, other):
865 if type(self) != type(other): return False
866 if self.xid != other.xid: return False
867 if self.code != other.code: return False
868 if self.data != other.data: return False
869 return True
870
871 def pretty_print(self, q):
872 q.text("bad_action_error_msg {")
873 with q.group():
874 with q.indent(2):
875 q.breakable()
876 q.text("xid = ");
877 if self.xid != None:
878 q.text("%#x" % self.xid)
879 else:
880 q.text('None')
881 q.text(","); q.breakable()
882 q.text("code = ");
883 q.text("%#x" % self.code)
884 q.text(","); q.breakable()
885 q.text("data = ");
886 q.pp(self.data)
887 q.breakable()
888 q.text('}')
889
890error_msg.subtypes[2] = bad_action_error_msg
891
892class bad_instruction_error_msg(error_msg):
893 version = 5
894 type = 1
895 err_type = 3
896
897 def __init__(self, xid=None, code=None, data=None):
898 if xid != None:
899 self.xid = xid
900 else:
901 self.xid = None
902 if code != None:
903 self.code = code
904 else:
905 self.code = 0
906 if data != None:
907 self.data = data
908 else:
909 self.data = ''
910 return
911
912 def pack(self):
913 packed = []
914 packed.append(struct.pack("!B", self.version))
915 packed.append(struct.pack("!B", self.type))
916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
917 packed.append(struct.pack("!L", self.xid))
918 packed.append(struct.pack("!H", self.err_type))
919 packed.append(struct.pack("!H", self.code))
920 packed.append(self.data)
921 length = sum([len(x) for x in packed])
922 packed[2] = struct.pack("!H", length)
923 return ''.join(packed)
924
925 @staticmethod
926 def unpack(reader):
927 obj = bad_instruction_error_msg()
928 _version = reader.read("!B")[0]
929 assert(_version == 5)
930 _type = reader.read("!B")[0]
931 assert(_type == 1)
932 _length = reader.read("!H")[0]
933 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800934 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700935 obj.xid = reader.read("!L")[0]
936 _err_type = reader.read("!H")[0]
937 assert(_err_type == 3)
938 obj.code = reader.read("!H")[0]
939 obj.data = str(reader.read_all())
940 return obj
941
942 def __eq__(self, other):
943 if type(self) != type(other): return False
944 if self.xid != other.xid: return False
945 if self.code != other.code: return False
946 if self.data != other.data: return False
947 return True
948
949 def pretty_print(self, q):
950 q.text("bad_instruction_error_msg {")
951 with q.group():
952 with q.indent(2):
953 q.breakable()
954 q.text("xid = ");
955 if self.xid != None:
956 q.text("%#x" % self.xid)
957 else:
958 q.text('None')
959 q.text(","); q.breakable()
960 q.text("code = ");
961 q.text("%#x" % self.code)
962 q.text(","); q.breakable()
963 q.text("data = ");
964 q.pp(self.data)
965 q.breakable()
966 q.text('}')
967
968error_msg.subtypes[3] = bad_instruction_error_msg
969
970class bad_match_error_msg(error_msg):
971 version = 5
972 type = 1
973 err_type = 4
974
975 def __init__(self, xid=None, code=None, data=None):
976 if xid != None:
977 self.xid = xid
978 else:
979 self.xid = None
980 if code != None:
981 self.code = code
982 else:
983 self.code = 0
984 if data != None:
985 self.data = data
986 else:
987 self.data = ''
988 return
989
990 def pack(self):
991 packed = []
992 packed.append(struct.pack("!B", self.version))
993 packed.append(struct.pack("!B", self.type))
994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
995 packed.append(struct.pack("!L", self.xid))
996 packed.append(struct.pack("!H", self.err_type))
997 packed.append(struct.pack("!H", self.code))
998 packed.append(self.data)
999 length = sum([len(x) for x in packed])
1000 packed[2] = struct.pack("!H", length)
1001 return ''.join(packed)
1002
1003 @staticmethod
1004 def unpack(reader):
1005 obj = bad_match_error_msg()
1006 _version = reader.read("!B")[0]
1007 assert(_version == 5)
1008 _type = reader.read("!B")[0]
1009 assert(_type == 1)
1010 _length = reader.read("!H")[0]
1011 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001012 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001013 obj.xid = reader.read("!L")[0]
1014 _err_type = reader.read("!H")[0]
1015 assert(_err_type == 4)
1016 obj.code = reader.read("!H")[0]
1017 obj.data = str(reader.read_all())
1018 return obj
1019
1020 def __eq__(self, other):
1021 if type(self) != type(other): return False
1022 if self.xid != other.xid: return False
1023 if self.code != other.code: return False
1024 if self.data != other.data: return False
1025 return True
1026
1027 def pretty_print(self, q):
1028 q.text("bad_match_error_msg {")
1029 with q.group():
1030 with q.indent(2):
1031 q.breakable()
1032 q.text("xid = ");
1033 if self.xid != None:
1034 q.text("%#x" % self.xid)
1035 else:
1036 q.text('None')
1037 q.text(","); q.breakable()
1038 q.text("code = ");
1039 q.text("%#x" % self.code)
1040 q.text(","); q.breakable()
1041 q.text("data = ");
1042 q.pp(self.data)
1043 q.breakable()
1044 q.text('}')
1045
1046error_msg.subtypes[4] = bad_match_error_msg
1047
Rich Laneccd32ed2014-11-10 17:48:24 -08001048class bad_property_error_msg(error_msg):
1049 version = 5
1050 type = 1
1051 err_type = 14
1052
1053 def __init__(self, xid=None, code=None, data=None):
1054 if xid != None:
1055 self.xid = xid
1056 else:
1057 self.xid = None
1058 if code != None:
1059 self.code = code
1060 else:
1061 self.code = 0
1062 if data != None:
1063 self.data = data
1064 else:
1065 self.data = ''
1066 return
1067
1068 def pack(self):
1069 packed = []
1070 packed.append(struct.pack("!B", self.version))
1071 packed.append(struct.pack("!B", self.type))
1072 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1073 packed.append(struct.pack("!L", self.xid))
1074 packed.append(struct.pack("!H", self.err_type))
1075 packed.append(struct.pack("!H", self.code))
1076 packed.append(self.data)
1077 length = sum([len(x) for x in packed])
1078 packed[2] = struct.pack("!H", length)
1079 return ''.join(packed)
1080
1081 @staticmethod
1082 def unpack(reader):
1083 obj = bad_property_error_msg()
1084 _version = reader.read("!B")[0]
1085 assert(_version == 5)
1086 _type = reader.read("!B")[0]
1087 assert(_type == 1)
1088 _length = reader.read("!H")[0]
1089 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001090 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001091 obj.xid = reader.read("!L")[0]
1092 _err_type = reader.read("!H")[0]
1093 assert(_err_type == 14)
1094 obj.code = reader.read("!H")[0]
1095 obj.data = str(reader.read_all())
1096 return obj
1097
1098 def __eq__(self, other):
1099 if type(self) != type(other): return False
1100 if self.xid != other.xid: return False
1101 if self.code != other.code: return False
1102 if self.data != other.data: return False
1103 return True
1104
1105 def pretty_print(self, q):
1106 q.text("bad_property_error_msg {")
1107 with q.group():
1108 with q.indent(2):
1109 q.breakable()
1110 q.text("xid = ");
1111 if self.xid != None:
1112 q.text("%#x" % self.xid)
1113 else:
1114 q.text('None')
1115 q.text(","); q.breakable()
1116 q.text("code = ");
1117 q.text("%#x" % self.code)
1118 q.text(","); q.breakable()
1119 q.text("data = ");
1120 q.pp(self.data)
1121 q.breakable()
1122 q.text('}')
1123
1124error_msg.subtypes[14] = bad_property_error_msg
1125
Rich Lane2e079da2014-10-29 15:30:24 -07001126class bad_request_error_msg(error_msg):
1127 version = 5
1128 type = 1
1129 err_type = 1
1130
1131 def __init__(self, xid=None, code=None, data=None):
1132 if xid != None:
1133 self.xid = xid
1134 else:
1135 self.xid = None
1136 if code != None:
1137 self.code = code
1138 else:
1139 self.code = 0
1140 if data != None:
1141 self.data = data
1142 else:
1143 self.data = ''
1144 return
1145
1146 def pack(self):
1147 packed = []
1148 packed.append(struct.pack("!B", self.version))
1149 packed.append(struct.pack("!B", self.type))
1150 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1151 packed.append(struct.pack("!L", self.xid))
1152 packed.append(struct.pack("!H", self.err_type))
1153 packed.append(struct.pack("!H", self.code))
1154 packed.append(self.data)
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 = bad_request_error_msg()
1162 _version = reader.read("!B")[0]
1163 assert(_version == 5)
1164 _type = reader.read("!B")[0]
1165 assert(_type == 1)
1166 _length = reader.read("!H")[0]
1167 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001168 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001169 obj.xid = reader.read("!L")[0]
1170 _err_type = reader.read("!H")[0]
1171 assert(_err_type == 1)
1172 obj.code = reader.read("!H")[0]
1173 obj.data = str(reader.read_all())
1174 return obj
1175
1176 def __eq__(self, other):
1177 if type(self) != type(other): return False
1178 if self.xid != other.xid: return False
1179 if self.code != other.code: return False
1180 if self.data != other.data: return False
1181 return True
1182
1183 def pretty_print(self, q):
1184 q.text("bad_request_error_msg {")
1185 with q.group():
1186 with q.indent(2):
1187 q.breakable()
1188 q.text("xid = ");
1189 if self.xid != None:
1190 q.text("%#x" % self.xid)
1191 else:
1192 q.text('None')
1193 q.text(","); q.breakable()
1194 q.text("code = ");
1195 q.text("%#x" % self.code)
1196 q.text(","); q.breakable()
1197 q.text("data = ");
1198 q.pp(self.data)
1199 q.breakable()
1200 q.text('}')
1201
1202error_msg.subtypes[1] = bad_request_error_msg
1203
1204class barrier_reply(message):
1205 version = 5
1206 type = 21
1207
1208 def __init__(self, xid=None):
1209 if xid != None:
1210 self.xid = xid
1211 else:
1212 self.xid = None
1213 return
1214
1215 def pack(self):
1216 packed = []
1217 packed.append(struct.pack("!B", self.version))
1218 packed.append(struct.pack("!B", self.type))
1219 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1220 packed.append(struct.pack("!L", self.xid))
1221 length = sum([len(x) for x in packed])
1222 packed[2] = struct.pack("!H", length)
1223 return ''.join(packed)
1224
1225 @staticmethod
1226 def unpack(reader):
1227 obj = barrier_reply()
1228 _version = reader.read("!B")[0]
1229 assert(_version == 5)
1230 _type = reader.read("!B")[0]
1231 assert(_type == 21)
1232 _length = reader.read("!H")[0]
1233 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001234 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001235 obj.xid = reader.read("!L")[0]
1236 return obj
1237
1238 def __eq__(self, other):
1239 if type(self) != type(other): return False
1240 if self.xid != other.xid: return False
1241 return True
1242
1243 def pretty_print(self, q):
1244 q.text("barrier_reply {")
1245 with q.group():
1246 with q.indent(2):
1247 q.breakable()
1248 q.text("xid = ");
1249 if self.xid != None:
1250 q.text("%#x" % self.xid)
1251 else:
1252 q.text('None')
1253 q.breakable()
1254 q.text('}')
1255
1256message.subtypes[21] = barrier_reply
1257
1258class barrier_request(message):
1259 version = 5
1260 type = 20
1261
1262 def __init__(self, xid=None):
1263 if xid != None:
1264 self.xid = xid
1265 else:
1266 self.xid = None
1267 return
1268
1269 def pack(self):
1270 packed = []
1271 packed.append(struct.pack("!B", self.version))
1272 packed.append(struct.pack("!B", self.type))
1273 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1274 packed.append(struct.pack("!L", self.xid))
1275 length = sum([len(x) for x in packed])
1276 packed[2] = struct.pack("!H", length)
1277 return ''.join(packed)
1278
1279 @staticmethod
1280 def unpack(reader):
1281 obj = barrier_request()
1282 _version = reader.read("!B")[0]
1283 assert(_version == 5)
1284 _type = reader.read("!B")[0]
1285 assert(_type == 20)
1286 _length = reader.read("!H")[0]
1287 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001288 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001289 obj.xid = reader.read("!L")[0]
1290 return obj
1291
1292 def __eq__(self, other):
1293 if type(self) != type(other): return False
1294 if self.xid != other.xid: return False
1295 return True
1296
1297 def pretty_print(self, q):
1298 q.text("barrier_request {")
1299 with q.group():
1300 with q.indent(2):
1301 q.breakable()
1302 q.text("xid = ");
1303 if self.xid != None:
1304 q.text("%#x" % self.xid)
1305 else:
1306 q.text('None')
1307 q.breakable()
1308 q.text('}')
1309
1310message.subtypes[20] = barrier_request
1311
1312class experimenter(message):
1313 subtypes = {}
1314
1315 version = 5
1316 type = 4
1317
1318 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1319 if xid != None:
1320 self.xid = xid
1321 else:
1322 self.xid = None
1323 if experimenter != None:
1324 self.experimenter = experimenter
1325 else:
1326 self.experimenter = 0
1327 if subtype != None:
1328 self.subtype = subtype
1329 else:
1330 self.subtype = 0
1331 if data != None:
1332 self.data = data
1333 else:
1334 self.data = ''
1335 return
1336
1337 def pack(self):
1338 packed = []
1339 packed.append(struct.pack("!B", self.version))
1340 packed.append(struct.pack("!B", self.type))
1341 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1342 packed.append(struct.pack("!L", self.xid))
1343 packed.append(struct.pack("!L", self.experimenter))
1344 packed.append(struct.pack("!L", self.subtype))
1345 packed.append(self.data)
1346 length = sum([len(x) for x in packed])
1347 packed[2] = struct.pack("!H", length)
1348 return ''.join(packed)
1349
1350 @staticmethod
1351 def unpack(reader):
1352 subtype, = reader.peek('!L', 8)
1353 subclass = experimenter.subtypes.get(subtype)
1354 if subclass:
1355 return subclass.unpack(reader)
1356
1357 obj = experimenter()
1358 _version = reader.read("!B")[0]
1359 assert(_version == 5)
1360 _type = reader.read("!B")[0]
1361 assert(_type == 4)
1362 _length = reader.read("!H")[0]
1363 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001364 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001365 obj.xid = reader.read("!L")[0]
1366 obj.experimenter = reader.read("!L")[0]
1367 obj.subtype = reader.read("!L")[0]
1368 obj.data = str(reader.read_all())
1369 return obj
1370
1371 def __eq__(self, other):
1372 if type(self) != type(other): return False
1373 if self.xid != other.xid: return False
1374 if self.experimenter != other.experimenter: return False
1375 if self.subtype != other.subtype: return False
1376 if self.data != other.data: return False
1377 return True
1378
1379 def pretty_print(self, q):
1380 q.text("experimenter {")
1381 with q.group():
1382 with q.indent(2):
1383 q.breakable()
1384 q.text("xid = ");
1385 if self.xid != None:
1386 q.text("%#x" % self.xid)
1387 else:
1388 q.text('None')
1389 q.text(","); q.breakable()
1390 q.text("subtype = ");
1391 q.text("%#x" % self.subtype)
1392 q.text(","); q.breakable()
1393 q.text("data = ");
1394 q.pp(self.data)
1395 q.breakable()
1396 q.text('}')
1397
1398message.subtypes[4] = experimenter
1399
1400class bsn_header(experimenter):
1401 subtypes = {}
1402
1403 version = 5
1404 type = 4
1405 experimenter = 6035143
1406
1407 def __init__(self, xid=None, subtype=None):
1408 if xid != None:
1409 self.xid = xid
1410 else:
1411 self.xid = None
1412 if subtype != None:
1413 self.subtype = subtype
1414 else:
1415 self.subtype = 0
1416 return
1417
1418 def pack(self):
1419 packed = []
1420 packed.append(struct.pack("!B", self.version))
1421 packed.append(struct.pack("!B", self.type))
1422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1423 packed.append(struct.pack("!L", self.xid))
1424 packed.append(struct.pack("!L", self.experimenter))
1425 packed.append(struct.pack("!L", self.subtype))
1426 length = sum([len(x) for x in packed])
1427 packed[2] = struct.pack("!H", length)
1428 return ''.join(packed)
1429
1430 @staticmethod
1431 def unpack(reader):
1432 subtype, = reader.peek('!L', 12)
1433 subclass = bsn_header.subtypes.get(subtype)
1434 if subclass:
1435 return subclass.unpack(reader)
1436
1437 obj = bsn_header()
1438 _version = reader.read("!B")[0]
1439 assert(_version == 5)
1440 _type = reader.read("!B")[0]
1441 assert(_type == 4)
1442 _length = reader.read("!H")[0]
1443 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001444 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001445 obj.xid = reader.read("!L")[0]
1446 _experimenter = reader.read("!L")[0]
1447 assert(_experimenter == 6035143)
1448 obj.subtype = reader.read("!L")[0]
1449 return obj
1450
1451 def __eq__(self, other):
1452 if type(self) != type(other): return False
1453 if self.xid != other.xid: return False
1454 if self.subtype != other.subtype: return False
1455 return True
1456
1457 def pretty_print(self, q):
1458 q.text("bsn_header {")
1459 with q.group():
1460 with q.indent(2):
1461 q.breakable()
1462 q.text("xid = ");
1463 if self.xid != None:
1464 q.text("%#x" % self.xid)
1465 else:
1466 q.text('None')
1467 q.breakable()
1468 q.text('}')
1469
1470experimenter.subtypes[6035143] = bsn_header
1471
Rich Laneccd32ed2014-11-10 17:48:24 -08001472class bsn_arp_idle(bsn_header):
1473 version = 5
1474 type = 4
1475 experimenter = 6035143
1476 subtype = 60
1477
1478 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1479 if xid != None:
1480 self.xid = xid
1481 else:
1482 self.xid = None
1483 if vlan_vid != None:
1484 self.vlan_vid = vlan_vid
1485 else:
1486 self.vlan_vid = 0
1487 if ipv4_addr != None:
1488 self.ipv4_addr = ipv4_addr
1489 else:
1490 self.ipv4_addr = 0
1491 return
1492
1493 def pack(self):
1494 packed = []
1495 packed.append(struct.pack("!B", self.version))
1496 packed.append(struct.pack("!B", self.type))
1497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1498 packed.append(struct.pack("!L", self.xid))
1499 packed.append(struct.pack("!L", self.experimenter))
1500 packed.append(struct.pack("!L", self.subtype))
1501 packed.append(struct.pack("!H", self.vlan_vid))
1502 packed.append('\x00' * 2)
1503 packed.append(struct.pack("!L", self.ipv4_addr))
1504 length = sum([len(x) for x in packed])
1505 packed[2] = struct.pack("!H", length)
1506 return ''.join(packed)
1507
1508 @staticmethod
1509 def unpack(reader):
1510 obj = bsn_arp_idle()
1511 _version = reader.read("!B")[0]
1512 assert(_version == 5)
1513 _type = reader.read("!B")[0]
1514 assert(_type == 4)
1515 _length = reader.read("!H")[0]
1516 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001517 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001518 obj.xid = reader.read("!L")[0]
1519 _experimenter = reader.read("!L")[0]
1520 assert(_experimenter == 6035143)
1521 _subtype = reader.read("!L")[0]
1522 assert(_subtype == 60)
1523 obj.vlan_vid = reader.read("!H")[0]
1524 reader.skip(2)
1525 obj.ipv4_addr = reader.read("!L")[0]
1526 return obj
1527
1528 def __eq__(self, other):
1529 if type(self) != type(other): return False
1530 if self.xid != other.xid: return False
1531 if self.vlan_vid != other.vlan_vid: return False
1532 if self.ipv4_addr != other.ipv4_addr: return False
1533 return True
1534
1535 def pretty_print(self, q):
1536 q.text("bsn_arp_idle {")
1537 with q.group():
1538 with q.indent(2):
1539 q.breakable()
1540 q.text("xid = ");
1541 if self.xid != None:
1542 q.text("%#x" % self.xid)
1543 else:
1544 q.text('None')
1545 q.text(","); q.breakable()
1546 q.text("vlan_vid = ");
1547 q.text("%#x" % self.vlan_vid)
1548 q.text(","); q.breakable()
1549 q.text("ipv4_addr = ");
1550 q.text(util.pretty_ipv4(self.ipv4_addr))
1551 q.breakable()
1552 q.text('}')
1553
1554bsn_header.subtypes[60] = bsn_arp_idle
1555
Rich Lane2e079da2014-10-29 15:30:24 -07001556class bsn_bw_clear_data_reply(bsn_header):
1557 version = 5
1558 type = 4
1559 experimenter = 6035143
1560 subtype = 22
1561
1562 def __init__(self, xid=None, status=None):
1563 if xid != None:
1564 self.xid = xid
1565 else:
1566 self.xid = None
1567 if status != None:
1568 self.status = status
1569 else:
1570 self.status = 0
1571 return
1572
1573 def pack(self):
1574 packed = []
1575 packed.append(struct.pack("!B", self.version))
1576 packed.append(struct.pack("!B", self.type))
1577 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1578 packed.append(struct.pack("!L", self.xid))
1579 packed.append(struct.pack("!L", self.experimenter))
1580 packed.append(struct.pack("!L", self.subtype))
1581 packed.append(struct.pack("!L", self.status))
1582 length = sum([len(x) for x in packed])
1583 packed[2] = struct.pack("!H", length)
1584 return ''.join(packed)
1585
1586 @staticmethod
1587 def unpack(reader):
1588 obj = bsn_bw_clear_data_reply()
1589 _version = reader.read("!B")[0]
1590 assert(_version == 5)
1591 _type = reader.read("!B")[0]
1592 assert(_type == 4)
1593 _length = reader.read("!H")[0]
1594 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001595 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001596 obj.xid = reader.read("!L")[0]
1597 _experimenter = reader.read("!L")[0]
1598 assert(_experimenter == 6035143)
1599 _subtype = reader.read("!L")[0]
1600 assert(_subtype == 22)
1601 obj.status = reader.read("!L")[0]
1602 return obj
1603
1604 def __eq__(self, other):
1605 if type(self) != type(other): return False
1606 if self.xid != other.xid: return False
1607 if self.status != other.status: return False
1608 return True
1609
1610 def pretty_print(self, q):
1611 q.text("bsn_bw_clear_data_reply {")
1612 with q.group():
1613 with q.indent(2):
1614 q.breakable()
1615 q.text("xid = ");
1616 if self.xid != None:
1617 q.text("%#x" % self.xid)
1618 else:
1619 q.text('None')
1620 q.text(","); q.breakable()
1621 q.text("status = ");
1622 q.text("%#x" % self.status)
1623 q.breakable()
1624 q.text('}')
1625
1626bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1627
1628class bsn_bw_clear_data_request(bsn_header):
1629 version = 5
1630 type = 4
1631 experimenter = 6035143
1632 subtype = 21
1633
1634 def __init__(self, xid=None):
1635 if xid != None:
1636 self.xid = xid
1637 else:
1638 self.xid = None
1639 return
1640
1641 def pack(self):
1642 packed = []
1643 packed.append(struct.pack("!B", self.version))
1644 packed.append(struct.pack("!B", self.type))
1645 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1646 packed.append(struct.pack("!L", self.xid))
1647 packed.append(struct.pack("!L", self.experimenter))
1648 packed.append(struct.pack("!L", self.subtype))
1649 length = sum([len(x) for x in packed])
1650 packed[2] = struct.pack("!H", length)
1651 return ''.join(packed)
1652
1653 @staticmethod
1654 def unpack(reader):
1655 obj = bsn_bw_clear_data_request()
1656 _version = reader.read("!B")[0]
1657 assert(_version == 5)
1658 _type = reader.read("!B")[0]
1659 assert(_type == 4)
1660 _length = reader.read("!H")[0]
1661 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001662 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001663 obj.xid = reader.read("!L")[0]
1664 _experimenter = reader.read("!L")[0]
1665 assert(_experimenter == 6035143)
1666 _subtype = reader.read("!L")[0]
1667 assert(_subtype == 21)
1668 return obj
1669
1670 def __eq__(self, other):
1671 if type(self) != type(other): return False
1672 if self.xid != other.xid: return False
1673 return True
1674
1675 def pretty_print(self, q):
1676 q.text("bsn_bw_clear_data_request {")
1677 with q.group():
1678 with q.indent(2):
1679 q.breakable()
1680 q.text("xid = ");
1681 if self.xid != None:
1682 q.text("%#x" % self.xid)
1683 else:
1684 q.text('None')
1685 q.breakable()
1686 q.text('}')
1687
1688bsn_header.subtypes[21] = bsn_bw_clear_data_request
1689
1690class bsn_bw_enable_get_reply(bsn_header):
1691 version = 5
1692 type = 4
1693 experimenter = 6035143
1694 subtype = 20
1695
1696 def __init__(self, xid=None, enabled=None):
1697 if xid != None:
1698 self.xid = xid
1699 else:
1700 self.xid = None
1701 if enabled != None:
1702 self.enabled = enabled
1703 else:
1704 self.enabled = 0
1705 return
1706
1707 def pack(self):
1708 packed = []
1709 packed.append(struct.pack("!B", self.version))
1710 packed.append(struct.pack("!B", self.type))
1711 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1712 packed.append(struct.pack("!L", self.xid))
1713 packed.append(struct.pack("!L", self.experimenter))
1714 packed.append(struct.pack("!L", self.subtype))
1715 packed.append(struct.pack("!L", self.enabled))
1716 length = sum([len(x) for x in packed])
1717 packed[2] = struct.pack("!H", length)
1718 return ''.join(packed)
1719
1720 @staticmethod
1721 def unpack(reader):
1722 obj = bsn_bw_enable_get_reply()
1723 _version = reader.read("!B")[0]
1724 assert(_version == 5)
1725 _type = reader.read("!B")[0]
1726 assert(_type == 4)
1727 _length = reader.read("!H")[0]
1728 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001729 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001730 obj.xid = reader.read("!L")[0]
1731 _experimenter = reader.read("!L")[0]
1732 assert(_experimenter == 6035143)
1733 _subtype = reader.read("!L")[0]
1734 assert(_subtype == 20)
1735 obj.enabled = reader.read("!L")[0]
1736 return obj
1737
1738 def __eq__(self, other):
1739 if type(self) != type(other): return False
1740 if self.xid != other.xid: return False
1741 if self.enabled != other.enabled: return False
1742 return True
1743
1744 def pretty_print(self, q):
1745 q.text("bsn_bw_enable_get_reply {")
1746 with q.group():
1747 with q.indent(2):
1748 q.breakable()
1749 q.text("xid = ");
1750 if self.xid != None:
1751 q.text("%#x" % self.xid)
1752 else:
1753 q.text('None')
1754 q.text(","); q.breakable()
1755 q.text("enabled = ");
1756 q.text("%#x" % self.enabled)
1757 q.breakable()
1758 q.text('}')
1759
1760bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1761
1762class bsn_bw_enable_get_request(bsn_header):
1763 version = 5
1764 type = 4
1765 experimenter = 6035143
1766 subtype = 19
1767
1768 def __init__(self, xid=None):
1769 if xid != None:
1770 self.xid = xid
1771 else:
1772 self.xid = None
1773 return
1774
1775 def pack(self):
1776 packed = []
1777 packed.append(struct.pack("!B", self.version))
1778 packed.append(struct.pack("!B", self.type))
1779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1780 packed.append(struct.pack("!L", self.xid))
1781 packed.append(struct.pack("!L", self.experimenter))
1782 packed.append(struct.pack("!L", self.subtype))
1783 length = sum([len(x) for x in packed])
1784 packed[2] = struct.pack("!H", length)
1785 return ''.join(packed)
1786
1787 @staticmethod
1788 def unpack(reader):
1789 obj = bsn_bw_enable_get_request()
1790 _version = reader.read("!B")[0]
1791 assert(_version == 5)
1792 _type = reader.read("!B")[0]
1793 assert(_type == 4)
1794 _length = reader.read("!H")[0]
1795 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001796 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001797 obj.xid = reader.read("!L")[0]
1798 _experimenter = reader.read("!L")[0]
1799 assert(_experimenter == 6035143)
1800 _subtype = reader.read("!L")[0]
1801 assert(_subtype == 19)
1802 return obj
1803
1804 def __eq__(self, other):
1805 if type(self) != type(other): return False
1806 if self.xid != other.xid: return False
1807 return True
1808
1809 def pretty_print(self, q):
1810 q.text("bsn_bw_enable_get_request {")
1811 with q.group():
1812 with q.indent(2):
1813 q.breakable()
1814 q.text("xid = ");
1815 if self.xid != None:
1816 q.text("%#x" % self.xid)
1817 else:
1818 q.text('None')
1819 q.breakable()
1820 q.text('}')
1821
1822bsn_header.subtypes[19] = bsn_bw_enable_get_request
1823
1824class bsn_bw_enable_set_reply(bsn_header):
1825 version = 5
1826 type = 4
1827 experimenter = 6035143
1828 subtype = 23
1829
1830 def __init__(self, xid=None, enable=None, status=None):
1831 if xid != None:
1832 self.xid = xid
1833 else:
1834 self.xid = None
1835 if enable != None:
1836 self.enable = enable
1837 else:
1838 self.enable = 0
1839 if status != None:
1840 self.status = status
1841 else:
1842 self.status = 0
1843 return
1844
1845 def pack(self):
1846 packed = []
1847 packed.append(struct.pack("!B", self.version))
1848 packed.append(struct.pack("!B", self.type))
1849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1850 packed.append(struct.pack("!L", self.xid))
1851 packed.append(struct.pack("!L", self.experimenter))
1852 packed.append(struct.pack("!L", self.subtype))
1853 packed.append(struct.pack("!L", self.enable))
1854 packed.append(struct.pack("!L", self.status))
1855 length = sum([len(x) for x in packed])
1856 packed[2] = struct.pack("!H", length)
1857 return ''.join(packed)
1858
1859 @staticmethod
1860 def unpack(reader):
1861 obj = bsn_bw_enable_set_reply()
1862 _version = reader.read("!B")[0]
1863 assert(_version == 5)
1864 _type = reader.read("!B")[0]
1865 assert(_type == 4)
1866 _length = reader.read("!H")[0]
1867 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001868 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001869 obj.xid = reader.read("!L")[0]
1870 _experimenter = reader.read("!L")[0]
1871 assert(_experimenter == 6035143)
1872 _subtype = reader.read("!L")[0]
1873 assert(_subtype == 23)
1874 obj.enable = reader.read("!L")[0]
1875 obj.status = reader.read("!L")[0]
1876 return obj
1877
1878 def __eq__(self, other):
1879 if type(self) != type(other): return False
1880 if self.xid != other.xid: return False
1881 if self.enable != other.enable: return False
1882 if self.status != other.status: return False
1883 return True
1884
1885 def pretty_print(self, q):
1886 q.text("bsn_bw_enable_set_reply {")
1887 with q.group():
1888 with q.indent(2):
1889 q.breakable()
1890 q.text("xid = ");
1891 if self.xid != None:
1892 q.text("%#x" % self.xid)
1893 else:
1894 q.text('None')
1895 q.text(","); q.breakable()
1896 q.text("enable = ");
1897 q.text("%#x" % self.enable)
1898 q.text(","); q.breakable()
1899 q.text("status = ");
1900 q.text("%#x" % self.status)
1901 q.breakable()
1902 q.text('}')
1903
1904bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1905
1906class bsn_bw_enable_set_request(bsn_header):
1907 version = 5
1908 type = 4
1909 experimenter = 6035143
1910 subtype = 18
1911
1912 def __init__(self, xid=None, enable=None):
1913 if xid != None:
1914 self.xid = xid
1915 else:
1916 self.xid = None
1917 if enable != None:
1918 self.enable = enable
1919 else:
1920 self.enable = 0
1921 return
1922
1923 def pack(self):
1924 packed = []
1925 packed.append(struct.pack("!B", self.version))
1926 packed.append(struct.pack("!B", self.type))
1927 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1928 packed.append(struct.pack("!L", self.xid))
1929 packed.append(struct.pack("!L", self.experimenter))
1930 packed.append(struct.pack("!L", self.subtype))
1931 packed.append(struct.pack("!L", self.enable))
1932 length = sum([len(x) for x in packed])
1933 packed[2] = struct.pack("!H", length)
1934 return ''.join(packed)
1935
1936 @staticmethod
1937 def unpack(reader):
1938 obj = bsn_bw_enable_set_request()
1939 _version = reader.read("!B")[0]
1940 assert(_version == 5)
1941 _type = reader.read("!B")[0]
1942 assert(_type == 4)
1943 _length = reader.read("!H")[0]
1944 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001945 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07001946 obj.xid = reader.read("!L")[0]
1947 _experimenter = reader.read("!L")[0]
1948 assert(_experimenter == 6035143)
1949 _subtype = reader.read("!L")[0]
1950 assert(_subtype == 18)
1951 obj.enable = reader.read("!L")[0]
1952 return obj
1953
1954 def __eq__(self, other):
1955 if type(self) != type(other): return False
1956 if self.xid != other.xid: return False
1957 if self.enable != other.enable: return False
1958 return True
1959
1960 def pretty_print(self, q):
1961 q.text("bsn_bw_enable_set_request {")
1962 with q.group():
1963 with q.indent(2):
1964 q.breakable()
1965 q.text("xid = ");
1966 if self.xid != None:
1967 q.text("%#x" % self.xid)
1968 else:
1969 q.text('None')
1970 q.text(","); q.breakable()
1971 q.text("enable = ");
1972 q.text("%#x" % self.enable)
1973 q.breakable()
1974 q.text('}')
1975
1976bsn_header.subtypes[18] = bsn_bw_enable_set_request
1977
Rich Laneccd32ed2014-11-10 17:48:24 -08001978class bsn_controller_connections_reply(bsn_header):
1979 version = 5
1980 type = 4
1981 experimenter = 6035143
1982 subtype = 57
1983
1984 def __init__(self, xid=None, connections=None):
1985 if xid != None:
1986 self.xid = xid
1987 else:
1988 self.xid = None
1989 if connections != None:
1990 self.connections = connections
1991 else:
1992 self.connections = []
1993 return
1994
1995 def pack(self):
1996 packed = []
1997 packed.append(struct.pack("!B", self.version))
1998 packed.append(struct.pack("!B", self.type))
1999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2000 packed.append(struct.pack("!L", self.xid))
2001 packed.append(struct.pack("!L", self.experimenter))
2002 packed.append(struct.pack("!L", self.subtype))
2003 packed.append(loxi.generic_util.pack_list(self.connections))
2004 length = sum([len(x) for x in packed])
2005 packed[2] = struct.pack("!H", length)
2006 return ''.join(packed)
2007
2008 @staticmethod
2009 def unpack(reader):
2010 obj = bsn_controller_connections_reply()
2011 _version = reader.read("!B")[0]
2012 assert(_version == 5)
2013 _type = reader.read("!B")[0]
2014 assert(_type == 4)
2015 _length = reader.read("!H")[0]
2016 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002017 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002018 obj.xid = reader.read("!L")[0]
2019 _experimenter = reader.read("!L")[0]
2020 assert(_experimenter == 6035143)
2021 _subtype = reader.read("!L")[0]
2022 assert(_subtype == 57)
Rich Lanee2567702015-01-26 15:04:35 -08002023 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08002024 return obj
2025
2026 def __eq__(self, other):
2027 if type(self) != type(other): return False
2028 if self.xid != other.xid: return False
2029 if self.connections != other.connections: return False
2030 return True
2031
2032 def pretty_print(self, q):
2033 q.text("bsn_controller_connections_reply {")
2034 with q.group():
2035 with q.indent(2):
2036 q.breakable()
2037 q.text("xid = ");
2038 if self.xid != None:
2039 q.text("%#x" % self.xid)
2040 else:
2041 q.text('None')
2042 q.text(","); q.breakable()
2043 q.text("connections = ");
2044 q.pp(self.connections)
2045 q.breakable()
2046 q.text('}')
2047
2048bsn_header.subtypes[57] = bsn_controller_connections_reply
2049
2050class bsn_controller_connections_request(bsn_header):
2051 version = 5
2052 type = 4
2053 experimenter = 6035143
2054 subtype = 56
2055
2056 def __init__(self, xid=None):
2057 if xid != None:
2058 self.xid = xid
2059 else:
2060 self.xid = None
2061 return
2062
2063 def pack(self):
2064 packed = []
2065 packed.append(struct.pack("!B", self.version))
2066 packed.append(struct.pack("!B", self.type))
2067 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2068 packed.append(struct.pack("!L", self.xid))
2069 packed.append(struct.pack("!L", self.experimenter))
2070 packed.append(struct.pack("!L", self.subtype))
2071 length = sum([len(x) for x in packed])
2072 packed[2] = struct.pack("!H", length)
2073 return ''.join(packed)
2074
2075 @staticmethod
2076 def unpack(reader):
2077 obj = bsn_controller_connections_request()
2078 _version = reader.read("!B")[0]
2079 assert(_version == 5)
2080 _type = reader.read("!B")[0]
2081 assert(_type == 4)
2082 _length = reader.read("!H")[0]
2083 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002084 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002085 obj.xid = reader.read("!L")[0]
2086 _experimenter = reader.read("!L")[0]
2087 assert(_experimenter == 6035143)
2088 _subtype = reader.read("!L")[0]
2089 assert(_subtype == 56)
2090 return obj
2091
2092 def __eq__(self, other):
2093 if type(self) != type(other): return False
2094 if self.xid != other.xid: return False
2095 return True
2096
2097 def pretty_print(self, q):
2098 q.text("bsn_controller_connections_request {")
2099 with q.group():
2100 with q.indent(2):
2101 q.breakable()
2102 q.text("xid = ");
2103 if self.xid != None:
2104 q.text("%#x" % self.xid)
2105 else:
2106 q.text('None')
2107 q.breakable()
2108 q.text('}')
2109
2110bsn_header.subtypes[56] = bsn_controller_connections_request
2111
2112class experimenter_stats_reply(stats_reply):
2113 subtypes = {}
2114
2115 version = 5
2116 type = 19
2117 stats_type = 65535
2118
2119 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2120 if xid != None:
2121 self.xid = xid
2122 else:
2123 self.xid = None
2124 if flags != None:
2125 self.flags = flags
2126 else:
2127 self.flags = 0
2128 if experimenter != None:
2129 self.experimenter = experimenter
2130 else:
2131 self.experimenter = 0
2132 if subtype != None:
2133 self.subtype = subtype
2134 else:
2135 self.subtype = 0
2136 return
2137
2138 def pack(self):
2139 packed = []
2140 packed.append(struct.pack("!B", self.version))
2141 packed.append(struct.pack("!B", self.type))
2142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2143 packed.append(struct.pack("!L", self.xid))
2144 packed.append(struct.pack("!H", self.stats_type))
2145 packed.append(struct.pack("!H", self.flags))
2146 packed.append('\x00' * 4)
2147 packed.append(struct.pack("!L", self.experimenter))
2148 packed.append(struct.pack("!L", self.subtype))
2149 length = sum([len(x) for x in packed])
2150 packed[2] = struct.pack("!H", length)
2151 return ''.join(packed)
2152
2153 @staticmethod
2154 def unpack(reader):
2155 subtype, = reader.peek('!L', 16)
2156 subclass = experimenter_stats_reply.subtypes.get(subtype)
2157 if subclass:
2158 return subclass.unpack(reader)
2159
2160 obj = experimenter_stats_reply()
2161 _version = reader.read("!B")[0]
2162 assert(_version == 5)
2163 _type = reader.read("!B")[0]
2164 assert(_type == 19)
2165 _length = reader.read("!H")[0]
2166 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002167 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002168 obj.xid = reader.read("!L")[0]
2169 _stats_type = reader.read("!H")[0]
2170 assert(_stats_type == 65535)
2171 obj.flags = reader.read("!H")[0]
2172 reader.skip(4)
2173 obj.experimenter = reader.read("!L")[0]
2174 obj.subtype = reader.read("!L")[0]
2175 return obj
2176
2177 def __eq__(self, other):
2178 if type(self) != type(other): return False
2179 if self.xid != other.xid: return False
2180 if self.flags != other.flags: return False
2181 if self.experimenter != other.experimenter: return False
2182 if self.subtype != other.subtype: return False
2183 return True
2184
2185 def pretty_print(self, q):
2186 q.text("experimenter_stats_reply {")
2187 with q.group():
2188 with q.indent(2):
2189 q.breakable()
2190 q.text("xid = ");
2191 if self.xid != None:
2192 q.text("%#x" % self.xid)
2193 else:
2194 q.text('None')
2195 q.text(","); q.breakable()
2196 q.text("flags = ");
2197 q.text("%#x" % self.flags)
2198 q.text(","); q.breakable()
2199 q.text("subtype = ");
2200 q.text("%#x" % self.subtype)
2201 q.breakable()
2202 q.text('}')
2203
2204stats_reply.subtypes[65535] = experimenter_stats_reply
2205
2206class bsn_stats_reply(experimenter_stats_reply):
2207 subtypes = {}
2208
2209 version = 5
2210 type = 19
2211 stats_type = 65535
2212 experimenter = 6035143
2213
2214 def __init__(self, xid=None, flags=None, subtype=None):
2215 if xid != None:
2216 self.xid = xid
2217 else:
2218 self.xid = None
2219 if flags != None:
2220 self.flags = flags
2221 else:
2222 self.flags = 0
2223 if subtype != None:
2224 self.subtype = subtype
2225 else:
2226 self.subtype = 0
2227 return
2228
2229 def pack(self):
2230 packed = []
2231 packed.append(struct.pack("!B", self.version))
2232 packed.append(struct.pack("!B", self.type))
2233 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2234 packed.append(struct.pack("!L", self.xid))
2235 packed.append(struct.pack("!H", self.stats_type))
2236 packed.append(struct.pack("!H", self.flags))
2237 packed.append('\x00' * 4)
2238 packed.append(struct.pack("!L", self.experimenter))
2239 packed.append(struct.pack("!L", self.subtype))
2240 length = sum([len(x) for x in packed])
2241 packed[2] = struct.pack("!H", length)
2242 return ''.join(packed)
2243
2244 @staticmethod
2245 def unpack(reader):
2246 subtype, = reader.peek('!L', 20)
2247 subclass = bsn_stats_reply.subtypes.get(subtype)
2248 if subclass:
2249 return subclass.unpack(reader)
2250
2251 obj = bsn_stats_reply()
2252 _version = reader.read("!B")[0]
2253 assert(_version == 5)
2254 _type = reader.read("!B")[0]
2255 assert(_type == 19)
2256 _length = reader.read("!H")[0]
2257 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002258 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002259 obj.xid = reader.read("!L")[0]
2260 _stats_type = reader.read("!H")[0]
2261 assert(_stats_type == 65535)
2262 obj.flags = reader.read("!H")[0]
2263 reader.skip(4)
2264 _experimenter = reader.read("!L")[0]
2265 assert(_experimenter == 6035143)
2266 obj.subtype = reader.read("!L")[0]
2267 return obj
2268
2269 def __eq__(self, other):
2270 if type(self) != type(other): return False
2271 if self.xid != other.xid: return False
2272 if self.flags != other.flags: return False
2273 if self.subtype != other.subtype: return False
2274 return True
2275
2276 def pretty_print(self, q):
2277 q.text("bsn_stats_reply {")
2278 with q.group():
2279 with q.indent(2):
2280 q.breakable()
2281 q.text("xid = ");
2282 if self.xid != None:
2283 q.text("%#x" % self.xid)
2284 else:
2285 q.text('None')
2286 q.text(","); q.breakable()
2287 q.text("flags = ");
2288 q.text("%#x" % self.flags)
2289 q.breakable()
2290 q.text('}')
2291
2292experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2293
2294class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
2295 version = 5
2296 type = 19
2297 stats_type = 65535
2298 experimenter = 6035143
2299 subtype = 13
2300
2301 def __init__(self, xid=None, flags=None, entries=None):
2302 if xid != None:
2303 self.xid = xid
2304 else:
2305 self.xid = None
2306 if flags != None:
2307 self.flags = flags
2308 else:
2309 self.flags = 0
2310 if entries != None:
2311 self.entries = entries
2312 else:
2313 self.entries = []
2314 return
2315
2316 def pack(self):
2317 packed = []
2318 packed.append(struct.pack("!B", self.version))
2319 packed.append(struct.pack("!B", self.type))
2320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2321 packed.append(struct.pack("!L", self.xid))
2322 packed.append(struct.pack("!H", self.stats_type))
2323 packed.append(struct.pack("!H", self.flags))
2324 packed.append('\x00' * 4)
2325 packed.append(struct.pack("!L", self.experimenter))
2326 packed.append(struct.pack("!L", self.subtype))
2327 packed.append(loxi.generic_util.pack_list(self.entries))
2328 length = sum([len(x) for x in packed])
2329 packed[2] = struct.pack("!H", length)
2330 return ''.join(packed)
2331
2332 @staticmethod
2333 def unpack(reader):
2334 obj = bsn_debug_counter_desc_stats_reply()
2335 _version = reader.read("!B")[0]
2336 assert(_version == 5)
2337 _type = reader.read("!B")[0]
2338 assert(_type == 19)
2339 _length = reader.read("!H")[0]
2340 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002341 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002342 obj.xid = reader.read("!L")[0]
2343 _stats_type = reader.read("!H")[0]
2344 assert(_stats_type == 65535)
2345 obj.flags = reader.read("!H")[0]
2346 reader.skip(4)
2347 _experimenter = reader.read("!L")[0]
2348 assert(_experimenter == 6035143)
2349 _subtype = reader.read("!L")[0]
2350 assert(_subtype == 13)
Rich Lanee2567702015-01-26 15:04:35 -08002351 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08002352 return obj
2353
2354 def __eq__(self, other):
2355 if type(self) != type(other): return False
2356 if self.xid != other.xid: return False
2357 if self.flags != other.flags: return False
2358 if self.entries != other.entries: return False
2359 return True
2360
2361 def pretty_print(self, q):
2362 q.text("bsn_debug_counter_desc_stats_reply {")
2363 with q.group():
2364 with q.indent(2):
2365 q.breakable()
2366 q.text("xid = ");
2367 if self.xid != None:
2368 q.text("%#x" % self.xid)
2369 else:
2370 q.text('None')
2371 q.text(","); q.breakable()
2372 q.text("flags = ");
2373 q.text("%#x" % self.flags)
2374 q.text(","); q.breakable()
2375 q.text("entries = ");
2376 q.pp(self.entries)
2377 q.breakable()
2378 q.text('}')
2379
2380bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
2381
2382class experimenter_stats_request(stats_request):
2383 subtypes = {}
2384
2385 version = 5
2386 type = 18
2387 stats_type = 65535
2388
2389 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2390 if xid != None:
2391 self.xid = xid
2392 else:
2393 self.xid = None
2394 if flags != None:
2395 self.flags = flags
2396 else:
2397 self.flags = 0
2398 if experimenter != None:
2399 self.experimenter = experimenter
2400 else:
2401 self.experimenter = 0
2402 if subtype != None:
2403 self.subtype = subtype
2404 else:
2405 self.subtype = 0
2406 return
2407
2408 def pack(self):
2409 packed = []
2410 packed.append(struct.pack("!B", self.version))
2411 packed.append(struct.pack("!B", self.type))
2412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2413 packed.append(struct.pack("!L", self.xid))
2414 packed.append(struct.pack("!H", self.stats_type))
2415 packed.append(struct.pack("!H", self.flags))
2416 packed.append('\x00' * 4)
2417 packed.append(struct.pack("!L", self.experimenter))
2418 packed.append(struct.pack("!L", self.subtype))
2419 length = sum([len(x) for x in packed])
2420 packed[2] = struct.pack("!H", length)
2421 return ''.join(packed)
2422
2423 @staticmethod
2424 def unpack(reader):
2425 subtype, = reader.peek('!L', 16)
2426 subclass = experimenter_stats_request.subtypes.get(subtype)
2427 if subclass:
2428 return subclass.unpack(reader)
2429
2430 obj = experimenter_stats_request()
2431 _version = reader.read("!B")[0]
2432 assert(_version == 5)
2433 _type = reader.read("!B")[0]
2434 assert(_type == 18)
2435 _length = reader.read("!H")[0]
2436 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002437 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002438 obj.xid = reader.read("!L")[0]
2439 _stats_type = reader.read("!H")[0]
2440 assert(_stats_type == 65535)
2441 obj.flags = reader.read("!H")[0]
2442 reader.skip(4)
2443 obj.experimenter = reader.read("!L")[0]
2444 obj.subtype = reader.read("!L")[0]
2445 return obj
2446
2447 def __eq__(self, other):
2448 if type(self) != type(other): return False
2449 if self.xid != other.xid: return False
2450 if self.flags != other.flags: return False
2451 if self.experimenter != other.experimenter: return False
2452 if self.subtype != other.subtype: return False
2453 return True
2454
2455 def pretty_print(self, q):
2456 q.text("experimenter_stats_request {")
2457 with q.group():
2458 with q.indent(2):
2459 q.breakable()
2460 q.text("xid = ");
2461 if self.xid != None:
2462 q.text("%#x" % self.xid)
2463 else:
2464 q.text('None')
2465 q.text(","); q.breakable()
2466 q.text("flags = ");
2467 q.text("%#x" % self.flags)
2468 q.text(","); q.breakable()
2469 q.text("subtype = ");
2470 q.text("%#x" % self.subtype)
2471 q.breakable()
2472 q.text('}')
2473
2474stats_request.subtypes[65535] = experimenter_stats_request
2475
2476class bsn_stats_request(experimenter_stats_request):
2477 subtypes = {}
2478
2479 version = 5
2480 type = 18
2481 stats_type = 65535
2482 experimenter = 6035143
2483
2484 def __init__(self, xid=None, flags=None, subtype=None):
2485 if xid != None:
2486 self.xid = xid
2487 else:
2488 self.xid = None
2489 if flags != None:
2490 self.flags = flags
2491 else:
2492 self.flags = 0
2493 if subtype != None:
2494 self.subtype = subtype
2495 else:
2496 self.subtype = 0
2497 return
2498
2499 def pack(self):
2500 packed = []
2501 packed.append(struct.pack("!B", self.version))
2502 packed.append(struct.pack("!B", self.type))
2503 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2504 packed.append(struct.pack("!L", self.xid))
2505 packed.append(struct.pack("!H", self.stats_type))
2506 packed.append(struct.pack("!H", self.flags))
2507 packed.append('\x00' * 4)
2508 packed.append(struct.pack("!L", self.experimenter))
2509 packed.append(struct.pack("!L", self.subtype))
2510 length = sum([len(x) for x in packed])
2511 packed[2] = struct.pack("!H", length)
2512 return ''.join(packed)
2513
2514 @staticmethod
2515 def unpack(reader):
2516 subtype, = reader.peek('!L', 20)
2517 subclass = bsn_stats_request.subtypes.get(subtype)
2518 if subclass:
2519 return subclass.unpack(reader)
2520
2521 obj = bsn_stats_request()
2522 _version = reader.read("!B")[0]
2523 assert(_version == 5)
2524 _type = reader.read("!B")[0]
2525 assert(_type == 18)
2526 _length = reader.read("!H")[0]
2527 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002528 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002529 obj.xid = reader.read("!L")[0]
2530 _stats_type = reader.read("!H")[0]
2531 assert(_stats_type == 65535)
2532 obj.flags = reader.read("!H")[0]
2533 reader.skip(4)
2534 _experimenter = reader.read("!L")[0]
2535 assert(_experimenter == 6035143)
2536 obj.subtype = reader.read("!L")[0]
2537 return obj
2538
2539 def __eq__(self, other):
2540 if type(self) != type(other): return False
2541 if self.xid != other.xid: return False
2542 if self.flags != other.flags: return False
2543 if self.subtype != other.subtype: return False
2544 return True
2545
2546 def pretty_print(self, q):
2547 q.text("bsn_stats_request {")
2548 with q.group():
2549 with q.indent(2):
2550 q.breakable()
2551 q.text("xid = ");
2552 if self.xid != None:
2553 q.text("%#x" % self.xid)
2554 else:
2555 q.text('None')
2556 q.text(","); q.breakable()
2557 q.text("flags = ");
2558 q.text("%#x" % self.flags)
2559 q.breakable()
2560 q.text('}')
2561
2562experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2563
2564class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2565 version = 5
2566 type = 18
2567 stats_type = 65535
2568 experimenter = 6035143
2569 subtype = 13
2570
2571 def __init__(self, xid=None, flags=None):
2572 if xid != None:
2573 self.xid = xid
2574 else:
2575 self.xid = None
2576 if flags != None:
2577 self.flags = flags
2578 else:
2579 self.flags = 0
2580 return
2581
2582 def pack(self):
2583 packed = []
2584 packed.append(struct.pack("!B", self.version))
2585 packed.append(struct.pack("!B", self.type))
2586 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2587 packed.append(struct.pack("!L", self.xid))
2588 packed.append(struct.pack("!H", self.stats_type))
2589 packed.append(struct.pack("!H", self.flags))
2590 packed.append('\x00' * 4)
2591 packed.append(struct.pack("!L", self.experimenter))
2592 packed.append(struct.pack("!L", self.subtype))
2593 length = sum([len(x) for x in packed])
2594 packed[2] = struct.pack("!H", length)
2595 return ''.join(packed)
2596
2597 @staticmethod
2598 def unpack(reader):
2599 obj = bsn_debug_counter_desc_stats_request()
2600 _version = reader.read("!B")[0]
2601 assert(_version == 5)
2602 _type = reader.read("!B")[0]
2603 assert(_type == 18)
2604 _length = reader.read("!H")[0]
2605 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002606 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002607 obj.xid = reader.read("!L")[0]
2608 _stats_type = reader.read("!H")[0]
2609 assert(_stats_type == 65535)
2610 obj.flags = reader.read("!H")[0]
2611 reader.skip(4)
2612 _experimenter = reader.read("!L")[0]
2613 assert(_experimenter == 6035143)
2614 _subtype = reader.read("!L")[0]
2615 assert(_subtype == 13)
2616 return obj
2617
2618 def __eq__(self, other):
2619 if type(self) != type(other): return False
2620 if self.xid != other.xid: return False
2621 if self.flags != other.flags: return False
2622 return True
2623
2624 def pretty_print(self, q):
2625 q.text("bsn_debug_counter_desc_stats_request {")
2626 with q.group():
2627 with q.indent(2):
2628 q.breakable()
2629 q.text("xid = ");
2630 if self.xid != None:
2631 q.text("%#x" % self.xid)
2632 else:
2633 q.text('None')
2634 q.text(","); q.breakable()
2635 q.text("flags = ");
2636 q.text("%#x" % self.flags)
2637 q.breakable()
2638 q.text('}')
2639
2640bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2641
2642class bsn_debug_counter_stats_reply(bsn_stats_reply):
2643 version = 5
2644 type = 19
2645 stats_type = 65535
2646 experimenter = 6035143
2647 subtype = 12
2648
2649 def __init__(self, xid=None, flags=None, entries=None):
2650 if xid != None:
2651 self.xid = xid
2652 else:
2653 self.xid = None
2654 if flags != None:
2655 self.flags = flags
2656 else:
2657 self.flags = 0
2658 if entries != None:
2659 self.entries = entries
2660 else:
2661 self.entries = []
2662 return
2663
2664 def pack(self):
2665 packed = []
2666 packed.append(struct.pack("!B", self.version))
2667 packed.append(struct.pack("!B", self.type))
2668 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2669 packed.append(struct.pack("!L", self.xid))
2670 packed.append(struct.pack("!H", self.stats_type))
2671 packed.append(struct.pack("!H", self.flags))
2672 packed.append('\x00' * 4)
2673 packed.append(struct.pack("!L", self.experimenter))
2674 packed.append(struct.pack("!L", self.subtype))
2675 packed.append(loxi.generic_util.pack_list(self.entries))
2676 length = sum([len(x) for x in packed])
2677 packed[2] = struct.pack("!H", length)
2678 return ''.join(packed)
2679
2680 @staticmethod
2681 def unpack(reader):
2682 obj = bsn_debug_counter_stats_reply()
2683 _version = reader.read("!B")[0]
2684 assert(_version == 5)
2685 _type = reader.read("!B")[0]
2686 assert(_type == 19)
2687 _length = reader.read("!H")[0]
2688 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002689 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002690 obj.xid = reader.read("!L")[0]
2691 _stats_type = reader.read("!H")[0]
2692 assert(_stats_type == 65535)
2693 obj.flags = reader.read("!H")[0]
2694 reader.skip(4)
2695 _experimenter = reader.read("!L")[0]
2696 assert(_experimenter == 6035143)
2697 _subtype = reader.read("!L")[0]
2698 assert(_subtype == 12)
Rich Lanee2567702015-01-26 15:04:35 -08002699 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08002700 return obj
2701
2702 def __eq__(self, other):
2703 if type(self) != type(other): return False
2704 if self.xid != other.xid: return False
2705 if self.flags != other.flags: return False
2706 if self.entries != other.entries: return False
2707 return True
2708
2709 def pretty_print(self, q):
2710 q.text("bsn_debug_counter_stats_reply {")
2711 with q.group():
2712 with q.indent(2):
2713 q.breakable()
2714 q.text("xid = ");
2715 if self.xid != None:
2716 q.text("%#x" % self.xid)
2717 else:
2718 q.text('None')
2719 q.text(","); q.breakable()
2720 q.text("flags = ");
2721 q.text("%#x" % self.flags)
2722 q.text(","); q.breakable()
2723 q.text("entries = ");
2724 q.pp(self.entries)
2725 q.breakable()
2726 q.text('}')
2727
2728bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2729
2730class bsn_debug_counter_stats_request(bsn_stats_request):
2731 version = 5
2732 type = 18
2733 stats_type = 65535
2734 experimenter = 6035143
2735 subtype = 12
2736
2737 def __init__(self, xid=None, flags=None):
2738 if xid != None:
2739 self.xid = xid
2740 else:
2741 self.xid = None
2742 if flags != None:
2743 self.flags = flags
2744 else:
2745 self.flags = 0
2746 return
2747
2748 def pack(self):
2749 packed = []
2750 packed.append(struct.pack("!B", self.version))
2751 packed.append(struct.pack("!B", self.type))
2752 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2753 packed.append(struct.pack("!L", self.xid))
2754 packed.append(struct.pack("!H", self.stats_type))
2755 packed.append(struct.pack("!H", self.flags))
2756 packed.append('\x00' * 4)
2757 packed.append(struct.pack("!L", self.experimenter))
2758 packed.append(struct.pack("!L", self.subtype))
2759 length = sum([len(x) for x in packed])
2760 packed[2] = struct.pack("!H", length)
2761 return ''.join(packed)
2762
2763 @staticmethod
2764 def unpack(reader):
2765 obj = bsn_debug_counter_stats_request()
2766 _version = reader.read("!B")[0]
2767 assert(_version == 5)
2768 _type = reader.read("!B")[0]
2769 assert(_type == 18)
2770 _length = reader.read("!H")[0]
2771 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002772 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002773 obj.xid = reader.read("!L")[0]
2774 _stats_type = reader.read("!H")[0]
2775 assert(_stats_type == 65535)
2776 obj.flags = reader.read("!H")[0]
2777 reader.skip(4)
2778 _experimenter = reader.read("!L")[0]
2779 assert(_experimenter == 6035143)
2780 _subtype = reader.read("!L")[0]
2781 assert(_subtype == 12)
2782 return obj
2783
2784 def __eq__(self, other):
2785 if type(self) != type(other): return False
2786 if self.xid != other.xid: return False
2787 if self.flags != other.flags: return False
2788 return True
2789
2790 def pretty_print(self, q):
2791 q.text("bsn_debug_counter_stats_request {")
2792 with q.group():
2793 with q.indent(2):
2794 q.breakable()
2795 q.text("xid = ");
2796 if self.xid != None:
2797 q.text("%#x" % self.xid)
2798 else:
2799 q.text('None')
2800 q.text(","); q.breakable()
2801 q.text("flags = ");
2802 q.text("%#x" % self.flags)
2803 q.breakable()
2804 q.text('}')
2805
2806bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2807
2808class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2809 version = 5
2810 type = 19
2811 stats_type = 65535
2812 experimenter = 6035143
2813 subtype = 10
2814
2815 def __init__(self, xid=None, flags=None, entries=None):
2816 if xid != None:
2817 self.xid = xid
2818 else:
2819 self.xid = None
2820 if flags != None:
2821 self.flags = flags
2822 else:
2823 self.flags = 0
2824 if entries != None:
2825 self.entries = entries
2826 else:
2827 self.entries = []
2828 return
2829
2830 def pack(self):
2831 packed = []
2832 packed.append(struct.pack("!B", self.version))
2833 packed.append(struct.pack("!B", self.type))
2834 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2835 packed.append(struct.pack("!L", self.xid))
2836 packed.append(struct.pack("!H", self.stats_type))
2837 packed.append(struct.pack("!H", self.flags))
2838 packed.append('\x00' * 4)
2839 packed.append(struct.pack("!L", self.experimenter))
2840 packed.append(struct.pack("!L", self.subtype))
2841 packed.append(loxi.generic_util.pack_list(self.entries))
2842 length = sum([len(x) for x in packed])
2843 packed[2] = struct.pack("!H", length)
2844 return ''.join(packed)
2845
2846 @staticmethod
2847 def unpack(reader):
2848 obj = bsn_flow_checksum_bucket_stats_reply()
2849 _version = reader.read("!B")[0]
2850 assert(_version == 5)
2851 _type = reader.read("!B")[0]
2852 assert(_type == 19)
2853 _length = reader.read("!H")[0]
2854 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002855 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002856 obj.xid = reader.read("!L")[0]
2857 _stats_type = reader.read("!H")[0]
2858 assert(_stats_type == 65535)
2859 obj.flags = reader.read("!H")[0]
2860 reader.skip(4)
2861 _experimenter = reader.read("!L")[0]
2862 assert(_experimenter == 6035143)
2863 _subtype = reader.read("!L")[0]
2864 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08002865 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08002866 return obj
2867
2868 def __eq__(self, other):
2869 if type(self) != type(other): return False
2870 if self.xid != other.xid: return False
2871 if self.flags != other.flags: return False
2872 if self.entries != other.entries: return False
2873 return True
2874
2875 def pretty_print(self, q):
2876 q.text("bsn_flow_checksum_bucket_stats_reply {")
2877 with q.group():
2878 with q.indent(2):
2879 q.breakable()
2880 q.text("xid = ");
2881 if self.xid != None:
2882 q.text("%#x" % self.xid)
2883 else:
2884 q.text('None')
2885 q.text(","); q.breakable()
2886 q.text("flags = ");
2887 q.text("%#x" % self.flags)
2888 q.text(","); q.breakable()
2889 q.text("entries = ");
2890 q.pp(self.entries)
2891 q.breakable()
2892 q.text('}')
2893
2894bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2895
2896class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2897 version = 5
2898 type = 18
2899 stats_type = 65535
2900 experimenter = 6035143
2901 subtype = 10
2902
2903 def __init__(self, xid=None, flags=None, table_id=None):
2904 if xid != None:
2905 self.xid = xid
2906 else:
2907 self.xid = None
2908 if flags != None:
2909 self.flags = flags
2910 else:
2911 self.flags = 0
2912 if table_id != None:
2913 self.table_id = table_id
2914 else:
2915 self.table_id = 0
2916 return
2917
2918 def pack(self):
2919 packed = []
2920 packed.append(struct.pack("!B", self.version))
2921 packed.append(struct.pack("!B", self.type))
2922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2923 packed.append(struct.pack("!L", self.xid))
2924 packed.append(struct.pack("!H", self.stats_type))
2925 packed.append(struct.pack("!H", self.flags))
2926 packed.append('\x00' * 4)
2927 packed.append(struct.pack("!L", self.experimenter))
2928 packed.append(struct.pack("!L", self.subtype))
2929 packed.append(struct.pack("!B", self.table_id))
2930 length = sum([len(x) for x in packed])
2931 packed[2] = struct.pack("!H", length)
2932 return ''.join(packed)
2933
2934 @staticmethod
2935 def unpack(reader):
2936 obj = bsn_flow_checksum_bucket_stats_request()
2937 _version = reader.read("!B")[0]
2938 assert(_version == 5)
2939 _type = reader.read("!B")[0]
2940 assert(_type == 18)
2941 _length = reader.read("!H")[0]
2942 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002943 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002944 obj.xid = reader.read("!L")[0]
2945 _stats_type = reader.read("!H")[0]
2946 assert(_stats_type == 65535)
2947 obj.flags = reader.read("!H")[0]
2948 reader.skip(4)
2949 _experimenter = reader.read("!L")[0]
2950 assert(_experimenter == 6035143)
2951 _subtype = reader.read("!L")[0]
2952 assert(_subtype == 10)
2953 obj.table_id = reader.read("!B")[0]
2954 return obj
2955
2956 def __eq__(self, other):
2957 if type(self) != type(other): return False
2958 if self.xid != other.xid: return False
2959 if self.flags != other.flags: return False
2960 if self.table_id != other.table_id: return False
2961 return True
2962
2963 def pretty_print(self, q):
2964 q.text("bsn_flow_checksum_bucket_stats_request {")
2965 with q.group():
2966 with q.indent(2):
2967 q.breakable()
2968 q.text("xid = ");
2969 if self.xid != None:
2970 q.text("%#x" % self.xid)
2971 else:
2972 q.text('None')
2973 q.text(","); q.breakable()
2974 q.text("flags = ");
2975 q.text("%#x" % self.flags)
2976 q.text(","); q.breakable()
2977 q.text("table_id = ");
2978 q.text("%#x" % self.table_id)
2979 q.breakable()
2980 q.text('}')
2981
2982bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2983
2984class bsn_flow_idle(bsn_header):
2985 version = 5
2986 type = 4
2987 experimenter = 6035143
2988 subtype = 40
2989
2990 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
2991 if xid != None:
2992 self.xid = xid
2993 else:
2994 self.xid = None
2995 if cookie != None:
2996 self.cookie = cookie
2997 else:
2998 self.cookie = 0
2999 if priority != None:
3000 self.priority = priority
3001 else:
3002 self.priority = 0
3003 if table_id != None:
3004 self.table_id = table_id
3005 else:
3006 self.table_id = 0
3007 if match != None:
3008 self.match = match
3009 else:
Rich Lanee2567702015-01-26 15:04:35 -08003010 self.match = ofp.match()
Rich Laneccd32ed2014-11-10 17:48:24 -08003011 return
3012
3013 def pack(self):
3014 packed = []
3015 packed.append(struct.pack("!B", self.version))
3016 packed.append(struct.pack("!B", self.type))
3017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3018 packed.append(struct.pack("!L", self.xid))
3019 packed.append(struct.pack("!L", self.experimenter))
3020 packed.append(struct.pack("!L", self.subtype))
3021 packed.append(struct.pack("!Q", self.cookie))
3022 packed.append(struct.pack("!H", self.priority))
3023 packed.append(struct.pack("!B", self.table_id))
3024 packed.append('\x00' * 5)
3025 packed.append(self.match.pack())
3026 length = sum([len(x) for x in packed])
3027 packed[2] = struct.pack("!H", length)
3028 return ''.join(packed)
3029
3030 @staticmethod
3031 def unpack(reader):
3032 obj = bsn_flow_idle()
3033 _version = reader.read("!B")[0]
3034 assert(_version == 5)
3035 _type = reader.read("!B")[0]
3036 assert(_type == 4)
3037 _length = reader.read("!H")[0]
3038 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003039 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003040 obj.xid = reader.read("!L")[0]
3041 _experimenter = reader.read("!L")[0]
3042 assert(_experimenter == 6035143)
3043 _subtype = reader.read("!L")[0]
3044 assert(_subtype == 40)
3045 obj.cookie = reader.read("!Q")[0]
3046 obj.priority = reader.read("!H")[0]
3047 obj.table_id = reader.read("!B")[0]
3048 reader.skip(5)
Rich Lanee2567702015-01-26 15:04:35 -08003049 obj.match = ofp.match.unpack(reader)
Rich Laneccd32ed2014-11-10 17:48:24 -08003050 return obj
3051
3052 def __eq__(self, other):
3053 if type(self) != type(other): return False
3054 if self.xid != other.xid: return False
3055 if self.cookie != other.cookie: return False
3056 if self.priority != other.priority: return False
3057 if self.table_id != other.table_id: return False
3058 if self.match != other.match: return False
3059 return True
3060
3061 def pretty_print(self, q):
3062 q.text("bsn_flow_idle {")
3063 with q.group():
3064 with q.indent(2):
3065 q.breakable()
3066 q.text("xid = ");
3067 if self.xid != None:
3068 q.text("%#x" % self.xid)
3069 else:
3070 q.text('None')
3071 q.text(","); q.breakable()
3072 q.text("cookie = ");
3073 q.text("%#x" % self.cookie)
3074 q.text(","); q.breakable()
3075 q.text("priority = ");
3076 q.text("%#x" % self.priority)
3077 q.text(","); q.breakable()
3078 q.text("table_id = ");
3079 q.text("%#x" % self.table_id)
3080 q.text(","); q.breakable()
3081 q.text("match = ");
3082 q.pp(self.match)
3083 q.breakable()
3084 q.text('}')
3085
3086bsn_header.subtypes[40] = bsn_flow_idle
3087
3088class bsn_flow_idle_enable_get_reply(bsn_header):
3089 version = 5
3090 type = 4
3091 experimenter = 6035143
3092 subtype = 39
3093
3094 def __init__(self, xid=None, enabled=None):
3095 if xid != None:
3096 self.xid = xid
3097 else:
3098 self.xid = None
3099 if enabled != None:
3100 self.enabled = enabled
3101 else:
3102 self.enabled = 0
3103 return
3104
3105 def pack(self):
3106 packed = []
3107 packed.append(struct.pack("!B", self.version))
3108 packed.append(struct.pack("!B", self.type))
3109 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3110 packed.append(struct.pack("!L", self.xid))
3111 packed.append(struct.pack("!L", self.experimenter))
3112 packed.append(struct.pack("!L", self.subtype))
3113 packed.append(struct.pack("!L", self.enabled))
3114 length = sum([len(x) for x in packed])
3115 packed[2] = struct.pack("!H", length)
3116 return ''.join(packed)
3117
3118 @staticmethod
3119 def unpack(reader):
3120 obj = bsn_flow_idle_enable_get_reply()
3121 _version = reader.read("!B")[0]
3122 assert(_version == 5)
3123 _type = reader.read("!B")[0]
3124 assert(_type == 4)
3125 _length = reader.read("!H")[0]
3126 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003127 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003128 obj.xid = reader.read("!L")[0]
3129 _experimenter = reader.read("!L")[0]
3130 assert(_experimenter == 6035143)
3131 _subtype = reader.read("!L")[0]
3132 assert(_subtype == 39)
3133 obj.enabled = reader.read("!L")[0]
3134 return obj
3135
3136 def __eq__(self, other):
3137 if type(self) != type(other): return False
3138 if self.xid != other.xid: return False
3139 if self.enabled != other.enabled: return False
3140 return True
3141
3142 def pretty_print(self, q):
3143 q.text("bsn_flow_idle_enable_get_reply {")
3144 with q.group():
3145 with q.indent(2):
3146 q.breakable()
3147 q.text("xid = ");
3148 if self.xid != None:
3149 q.text("%#x" % self.xid)
3150 else:
3151 q.text('None')
3152 q.text(","); q.breakable()
3153 q.text("enabled = ");
3154 q.text("%#x" % self.enabled)
3155 q.breakable()
3156 q.text('}')
3157
3158bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3159
3160class bsn_flow_idle_enable_get_request(bsn_header):
3161 version = 5
3162 type = 4
3163 experimenter = 6035143
3164 subtype = 38
3165
3166 def __init__(self, xid=None):
3167 if xid != None:
3168 self.xid = xid
3169 else:
3170 self.xid = None
3171 return
3172
3173 def pack(self):
3174 packed = []
3175 packed.append(struct.pack("!B", self.version))
3176 packed.append(struct.pack("!B", self.type))
3177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3178 packed.append(struct.pack("!L", self.xid))
3179 packed.append(struct.pack("!L", self.experimenter))
3180 packed.append(struct.pack("!L", self.subtype))
3181 length = sum([len(x) for x in packed])
3182 packed[2] = struct.pack("!H", length)
3183 return ''.join(packed)
3184
3185 @staticmethod
3186 def unpack(reader):
3187 obj = bsn_flow_idle_enable_get_request()
3188 _version = reader.read("!B")[0]
3189 assert(_version == 5)
3190 _type = reader.read("!B")[0]
3191 assert(_type == 4)
3192 _length = reader.read("!H")[0]
3193 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003194 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003195 obj.xid = reader.read("!L")[0]
3196 _experimenter = reader.read("!L")[0]
3197 assert(_experimenter == 6035143)
3198 _subtype = reader.read("!L")[0]
3199 assert(_subtype == 38)
3200 return obj
3201
3202 def __eq__(self, other):
3203 if type(self) != type(other): return False
3204 if self.xid != other.xid: return False
3205 return True
3206
3207 def pretty_print(self, q):
3208 q.text("bsn_flow_idle_enable_get_request {")
3209 with q.group():
3210 with q.indent(2):
3211 q.breakable()
3212 q.text("xid = ");
3213 if self.xid != None:
3214 q.text("%#x" % self.xid)
3215 else:
3216 q.text('None')
3217 q.breakable()
3218 q.text('}')
3219
3220bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3221
3222class bsn_flow_idle_enable_set_reply(bsn_header):
3223 version = 5
3224 type = 4
3225 experimenter = 6035143
3226 subtype = 37
3227
3228 def __init__(self, xid=None, enable=None, status=None):
3229 if xid != None:
3230 self.xid = xid
3231 else:
3232 self.xid = None
3233 if enable != None:
3234 self.enable = enable
3235 else:
3236 self.enable = 0
3237 if status != None:
3238 self.status = status
3239 else:
3240 self.status = 0
3241 return
3242
3243 def pack(self):
3244 packed = []
3245 packed.append(struct.pack("!B", self.version))
3246 packed.append(struct.pack("!B", self.type))
3247 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3248 packed.append(struct.pack("!L", self.xid))
3249 packed.append(struct.pack("!L", self.experimenter))
3250 packed.append(struct.pack("!L", self.subtype))
3251 packed.append(struct.pack("!L", self.enable))
3252 packed.append(struct.pack("!L", self.status))
3253 length = sum([len(x) for x in packed])
3254 packed[2] = struct.pack("!H", length)
3255 return ''.join(packed)
3256
3257 @staticmethod
3258 def unpack(reader):
3259 obj = bsn_flow_idle_enable_set_reply()
3260 _version = reader.read("!B")[0]
3261 assert(_version == 5)
3262 _type = reader.read("!B")[0]
3263 assert(_type == 4)
3264 _length = reader.read("!H")[0]
3265 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003266 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003267 obj.xid = reader.read("!L")[0]
3268 _experimenter = reader.read("!L")[0]
3269 assert(_experimenter == 6035143)
3270 _subtype = reader.read("!L")[0]
3271 assert(_subtype == 37)
3272 obj.enable = reader.read("!L")[0]
3273 obj.status = reader.read("!L")[0]
3274 return obj
3275
3276 def __eq__(self, other):
3277 if type(self) != type(other): return False
3278 if self.xid != other.xid: return False
3279 if self.enable != other.enable: return False
3280 if self.status != other.status: return False
3281 return True
3282
3283 def pretty_print(self, q):
3284 q.text("bsn_flow_idle_enable_set_reply {")
3285 with q.group():
3286 with q.indent(2):
3287 q.breakable()
3288 q.text("xid = ");
3289 if self.xid != None:
3290 q.text("%#x" % self.xid)
3291 else:
3292 q.text('None')
3293 q.text(","); q.breakable()
3294 q.text("enable = ");
3295 q.text("%#x" % self.enable)
3296 q.text(","); q.breakable()
3297 q.text("status = ");
3298 q.text("%#x" % self.status)
3299 q.breakable()
3300 q.text('}')
3301
3302bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3303
3304class bsn_flow_idle_enable_set_request(bsn_header):
3305 version = 5
3306 type = 4
3307 experimenter = 6035143
3308 subtype = 36
3309
3310 def __init__(self, xid=None, enable=None):
3311 if xid != None:
3312 self.xid = xid
3313 else:
3314 self.xid = None
3315 if enable != None:
3316 self.enable = enable
3317 else:
3318 self.enable = 0
3319 return
3320
3321 def pack(self):
3322 packed = []
3323 packed.append(struct.pack("!B", self.version))
3324 packed.append(struct.pack("!B", self.type))
3325 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3326 packed.append(struct.pack("!L", self.xid))
3327 packed.append(struct.pack("!L", self.experimenter))
3328 packed.append(struct.pack("!L", self.subtype))
3329 packed.append(struct.pack("!L", self.enable))
3330 length = sum([len(x) for x in packed])
3331 packed[2] = struct.pack("!H", length)
3332 return ''.join(packed)
3333
3334 @staticmethod
3335 def unpack(reader):
3336 obj = bsn_flow_idle_enable_set_request()
3337 _version = reader.read("!B")[0]
3338 assert(_version == 5)
3339 _type = reader.read("!B")[0]
3340 assert(_type == 4)
3341 _length = reader.read("!H")[0]
3342 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003343 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003344 obj.xid = reader.read("!L")[0]
3345 _experimenter = reader.read("!L")[0]
3346 assert(_experimenter == 6035143)
3347 _subtype = reader.read("!L")[0]
3348 assert(_subtype == 36)
3349 obj.enable = reader.read("!L")[0]
3350 return obj
3351
3352 def __eq__(self, other):
3353 if type(self) != type(other): return False
3354 if self.xid != other.xid: return False
3355 if self.enable != other.enable: return False
3356 return True
3357
3358 def pretty_print(self, q):
3359 q.text("bsn_flow_idle_enable_set_request {")
3360 with q.group():
3361 with q.indent(2):
3362 q.breakable()
3363 q.text("xid = ");
3364 if self.xid != None:
3365 q.text("%#x" % self.xid)
3366 else:
3367 q.text('None')
3368 q.text(","); q.breakable()
3369 q.text("enable = ");
3370 q.text("%#x" % self.enable)
3371 q.breakable()
3372 q.text('}')
3373
3374bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3375
Rich Lanecb18dbd2014-12-18 10:02:29 -08003376class bsn_generic_stats_reply(bsn_stats_reply):
3377 version = 5
3378 type = 19
3379 stats_type = 65535
3380 experimenter = 6035143
3381 subtype = 16
3382
3383 def __init__(self, xid=None, flags=None, entries=None):
3384 if xid != None:
3385 self.xid = xid
3386 else:
3387 self.xid = None
3388 if flags != None:
3389 self.flags = flags
3390 else:
3391 self.flags = 0
3392 if entries != None:
3393 self.entries = entries
3394 else:
3395 self.entries = []
3396 return
3397
3398 def pack(self):
3399 packed = []
3400 packed.append(struct.pack("!B", self.version))
3401 packed.append(struct.pack("!B", self.type))
3402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3403 packed.append(struct.pack("!L", self.xid))
3404 packed.append(struct.pack("!H", self.stats_type))
3405 packed.append(struct.pack("!H", self.flags))
3406 packed.append('\x00' * 4)
3407 packed.append(struct.pack("!L", self.experimenter))
3408 packed.append(struct.pack("!L", self.subtype))
3409 packed.append(loxi.generic_util.pack_list(self.entries))
3410 length = sum([len(x) for x in packed])
3411 packed[2] = struct.pack("!H", length)
3412 return ''.join(packed)
3413
3414 @staticmethod
3415 def unpack(reader):
3416 obj = bsn_generic_stats_reply()
3417 _version = reader.read("!B")[0]
3418 assert(_version == 5)
3419 _type = reader.read("!B")[0]
3420 assert(_type == 19)
3421 _length = reader.read("!H")[0]
3422 orig_reader = reader
3423 reader = orig_reader.slice(_length, 4)
3424 obj.xid = reader.read("!L")[0]
3425 _stats_type = reader.read("!H")[0]
3426 assert(_stats_type == 65535)
3427 obj.flags = reader.read("!H")[0]
3428 reader.skip(4)
3429 _experimenter = reader.read("!L")[0]
3430 assert(_experimenter == 6035143)
3431 _subtype = reader.read("!L")[0]
3432 assert(_subtype == 16)
Rich Lanee2567702015-01-26 15:04:35 -08003433 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003434 return obj
3435
3436 def __eq__(self, other):
3437 if type(self) != type(other): return False
3438 if self.xid != other.xid: return False
3439 if self.flags != other.flags: return False
3440 if self.entries != other.entries: return False
3441 return True
3442
3443 def pretty_print(self, q):
3444 q.text("bsn_generic_stats_reply {")
3445 with q.group():
3446 with q.indent(2):
3447 q.breakable()
3448 q.text("xid = ");
3449 if self.xid != None:
3450 q.text("%#x" % self.xid)
3451 else:
3452 q.text('None')
3453 q.text(","); q.breakable()
3454 q.text("flags = ");
3455 q.text("%#x" % self.flags)
3456 q.text(","); q.breakable()
3457 q.text("entries = ");
3458 q.pp(self.entries)
3459 q.breakable()
3460 q.text('}')
3461
3462bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3463
3464class bsn_generic_stats_request(bsn_stats_request):
3465 version = 5
3466 type = 18
3467 stats_type = 65535
3468 experimenter = 6035143
3469 subtype = 16
3470
3471 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3472 if xid != None:
3473 self.xid = xid
3474 else:
3475 self.xid = None
3476 if flags != None:
3477 self.flags = flags
3478 else:
3479 self.flags = 0
3480 if name != None:
3481 self.name = name
3482 else:
3483 self.name = ""
3484 if tlvs != None:
3485 self.tlvs = tlvs
3486 else:
3487 self.tlvs = []
3488 return
3489
3490 def pack(self):
3491 packed = []
3492 packed.append(struct.pack("!B", self.version))
3493 packed.append(struct.pack("!B", self.type))
3494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3495 packed.append(struct.pack("!L", self.xid))
3496 packed.append(struct.pack("!H", self.stats_type))
3497 packed.append(struct.pack("!H", self.flags))
3498 packed.append('\x00' * 4)
3499 packed.append(struct.pack("!L", self.experimenter))
3500 packed.append(struct.pack("!L", self.subtype))
3501 packed.append(struct.pack("!64s", self.name))
3502 packed.append(loxi.generic_util.pack_list(self.tlvs))
3503 length = sum([len(x) for x in packed])
3504 packed[2] = struct.pack("!H", length)
3505 return ''.join(packed)
3506
3507 @staticmethod
3508 def unpack(reader):
3509 obj = bsn_generic_stats_request()
3510 _version = reader.read("!B")[0]
3511 assert(_version == 5)
3512 _type = reader.read("!B")[0]
3513 assert(_type == 18)
3514 _length = reader.read("!H")[0]
3515 orig_reader = reader
3516 reader = orig_reader.slice(_length, 4)
3517 obj.xid = reader.read("!L")[0]
3518 _stats_type = reader.read("!H")[0]
3519 assert(_stats_type == 65535)
3520 obj.flags = reader.read("!H")[0]
3521 reader.skip(4)
3522 _experimenter = reader.read("!L")[0]
3523 assert(_experimenter == 6035143)
3524 _subtype = reader.read("!L")[0]
3525 assert(_subtype == 16)
3526 obj.name = reader.read("!64s")[0].rstrip("\x00")
Rich Lanee2567702015-01-26 15:04:35 -08003527 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003528 return obj
3529
3530 def __eq__(self, other):
3531 if type(self) != type(other): return False
3532 if self.xid != other.xid: return False
3533 if self.flags != other.flags: return False
3534 if self.name != other.name: return False
3535 if self.tlvs != other.tlvs: return False
3536 return True
3537
3538 def pretty_print(self, q):
3539 q.text("bsn_generic_stats_request {")
3540 with q.group():
3541 with q.indent(2):
3542 q.breakable()
3543 q.text("xid = ");
3544 if self.xid != None:
3545 q.text("%#x" % self.xid)
3546 else:
3547 q.text('None')
3548 q.text(","); q.breakable()
3549 q.text("flags = ");
3550 q.text("%#x" % self.flags)
3551 q.text(","); q.breakable()
3552 q.text("name = ");
3553 q.pp(self.name)
3554 q.text(","); q.breakable()
3555 q.text("tlvs = ");
3556 q.pp(self.tlvs)
3557 q.breakable()
3558 q.text('}')
3559
3560bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3561
Rich Laneccd32ed2014-11-10 17:48:24 -08003562class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3563 version = 5
3564 type = 19
3565 stats_type = 65535
3566 experimenter = 6035143
3567 subtype = 5
3568
3569 def __init__(self, xid=None, flags=None, entries=None):
3570 if xid != None:
3571 self.xid = xid
3572 else:
3573 self.xid = None
3574 if flags != None:
3575 self.flags = flags
3576 else:
3577 self.flags = 0
3578 if entries != None:
3579 self.entries = entries
3580 else:
3581 self.entries = []
3582 return
3583
3584 def pack(self):
3585 packed = []
3586 packed.append(struct.pack("!B", self.version))
3587 packed.append(struct.pack("!B", self.type))
3588 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3589 packed.append(struct.pack("!L", self.xid))
3590 packed.append(struct.pack("!H", self.stats_type))
3591 packed.append(struct.pack("!H", self.flags))
3592 packed.append('\x00' * 4)
3593 packed.append(struct.pack("!L", self.experimenter))
3594 packed.append(struct.pack("!L", self.subtype))
3595 packed.append(loxi.generic_util.pack_list(self.entries))
3596 length = sum([len(x) for x in packed])
3597 packed[2] = struct.pack("!H", length)
3598 return ''.join(packed)
3599
3600 @staticmethod
3601 def unpack(reader):
3602 obj = bsn_gentable_bucket_stats_reply()
3603 _version = reader.read("!B")[0]
3604 assert(_version == 5)
3605 _type = reader.read("!B")[0]
3606 assert(_type == 19)
3607 _length = reader.read("!H")[0]
3608 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003609 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003610 obj.xid = reader.read("!L")[0]
3611 _stats_type = reader.read("!H")[0]
3612 assert(_stats_type == 65535)
3613 obj.flags = reader.read("!H")[0]
3614 reader.skip(4)
3615 _experimenter = reader.read("!L")[0]
3616 assert(_experimenter == 6035143)
3617 _subtype = reader.read("!L")[0]
3618 assert(_subtype == 5)
Rich Lanee2567702015-01-26 15:04:35 -08003619 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08003620 return obj
3621
3622 def __eq__(self, other):
3623 if type(self) != type(other): return False
3624 if self.xid != other.xid: return False
3625 if self.flags != other.flags: return False
3626 if self.entries != other.entries: return False
3627 return True
3628
3629 def pretty_print(self, q):
3630 q.text("bsn_gentable_bucket_stats_reply {")
3631 with q.group():
3632 with q.indent(2):
3633 q.breakable()
3634 q.text("xid = ");
3635 if self.xid != None:
3636 q.text("%#x" % self.xid)
3637 else:
3638 q.text('None')
3639 q.text(","); q.breakable()
3640 q.text("flags = ");
3641 q.text("%#x" % self.flags)
3642 q.text(","); q.breakable()
3643 q.text("entries = ");
3644 q.pp(self.entries)
3645 q.breakable()
3646 q.text('}')
3647
3648bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3649
3650class bsn_gentable_bucket_stats_request(bsn_stats_request):
3651 version = 5
3652 type = 18
3653 stats_type = 65535
3654 experimenter = 6035143
3655 subtype = 5
3656
3657 def __init__(self, xid=None, flags=None, table_id=None):
3658 if xid != None:
3659 self.xid = xid
3660 else:
3661 self.xid = None
3662 if flags != None:
3663 self.flags = flags
3664 else:
3665 self.flags = 0
3666 if table_id != None:
3667 self.table_id = table_id
3668 else:
3669 self.table_id = 0
3670 return
3671
3672 def pack(self):
3673 packed = []
3674 packed.append(struct.pack("!B", self.version))
3675 packed.append(struct.pack("!B", self.type))
3676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3677 packed.append(struct.pack("!L", self.xid))
3678 packed.append(struct.pack("!H", self.stats_type))
3679 packed.append(struct.pack("!H", self.flags))
3680 packed.append('\x00' * 4)
3681 packed.append(struct.pack("!L", self.experimenter))
3682 packed.append(struct.pack("!L", self.subtype))
3683 packed.append(struct.pack("!H", self.table_id))
3684 length = sum([len(x) for x in packed])
3685 packed[2] = struct.pack("!H", length)
3686 return ''.join(packed)
3687
3688 @staticmethod
3689 def unpack(reader):
3690 obj = bsn_gentable_bucket_stats_request()
3691 _version = reader.read("!B")[0]
3692 assert(_version == 5)
3693 _type = reader.read("!B")[0]
3694 assert(_type == 18)
3695 _length = reader.read("!H")[0]
3696 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003697 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003698 obj.xid = reader.read("!L")[0]
3699 _stats_type = reader.read("!H")[0]
3700 assert(_stats_type == 65535)
3701 obj.flags = reader.read("!H")[0]
3702 reader.skip(4)
3703 _experimenter = reader.read("!L")[0]
3704 assert(_experimenter == 6035143)
3705 _subtype = reader.read("!L")[0]
3706 assert(_subtype == 5)
3707 obj.table_id = reader.read("!H")[0]
3708 return obj
3709
3710 def __eq__(self, other):
3711 if type(self) != type(other): return False
3712 if self.xid != other.xid: return False
3713 if self.flags != other.flags: return False
3714 if self.table_id != other.table_id: return False
3715 return True
3716
3717 def pretty_print(self, q):
3718 q.text("bsn_gentable_bucket_stats_request {")
3719 with q.group():
3720 with q.indent(2):
3721 q.breakable()
3722 q.text("xid = ");
3723 if self.xid != None:
3724 q.text("%#x" % self.xid)
3725 else:
3726 q.text('None')
3727 q.text(","); q.breakable()
3728 q.text("flags = ");
3729 q.text("%#x" % self.flags)
3730 q.text(","); q.breakable()
3731 q.text("table_id = ");
3732 q.text("%#x" % self.table_id)
3733 q.breakable()
3734 q.text('}')
3735
3736bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3737
3738class bsn_gentable_clear_reply(bsn_header):
3739 version = 5
3740 type = 4
3741 experimenter = 6035143
3742 subtype = 49
3743
3744 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3745 if xid != None:
3746 self.xid = xid
3747 else:
3748 self.xid = None
3749 if table_id != None:
3750 self.table_id = table_id
3751 else:
3752 self.table_id = 0
3753 if deleted_count != None:
3754 self.deleted_count = deleted_count
3755 else:
3756 self.deleted_count = 0
3757 if error_count != None:
3758 self.error_count = error_count
3759 else:
3760 self.error_count = 0
3761 return
3762
3763 def pack(self):
3764 packed = []
3765 packed.append(struct.pack("!B", self.version))
3766 packed.append(struct.pack("!B", self.type))
3767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3768 packed.append(struct.pack("!L", self.xid))
3769 packed.append(struct.pack("!L", self.experimenter))
3770 packed.append(struct.pack("!L", self.subtype))
3771 packed.append(struct.pack("!H", self.table_id))
3772 packed.append('\x00' * 2)
3773 packed.append(struct.pack("!L", self.deleted_count))
3774 packed.append(struct.pack("!L", self.error_count))
3775 length = sum([len(x) for x in packed])
3776 packed[2] = struct.pack("!H", length)
3777 return ''.join(packed)
3778
3779 @staticmethod
3780 def unpack(reader):
3781 obj = bsn_gentable_clear_reply()
3782 _version = reader.read("!B")[0]
3783 assert(_version == 5)
3784 _type = reader.read("!B")[0]
3785 assert(_type == 4)
3786 _length = reader.read("!H")[0]
3787 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003788 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003789 obj.xid = reader.read("!L")[0]
3790 _experimenter = reader.read("!L")[0]
3791 assert(_experimenter == 6035143)
3792 _subtype = reader.read("!L")[0]
3793 assert(_subtype == 49)
3794 obj.table_id = reader.read("!H")[0]
3795 reader.skip(2)
3796 obj.deleted_count = reader.read("!L")[0]
3797 obj.error_count = reader.read("!L")[0]
3798 return obj
3799
3800 def __eq__(self, other):
3801 if type(self) != type(other): return False
3802 if self.xid != other.xid: return False
3803 if self.table_id != other.table_id: return False
3804 if self.deleted_count != other.deleted_count: return False
3805 if self.error_count != other.error_count: return False
3806 return True
3807
3808 def pretty_print(self, q):
3809 q.text("bsn_gentable_clear_reply {")
3810 with q.group():
3811 with q.indent(2):
3812 q.breakable()
3813 q.text("xid = ");
3814 if self.xid != None:
3815 q.text("%#x" % self.xid)
3816 else:
3817 q.text('None')
3818 q.text(","); q.breakable()
3819 q.text("table_id = ");
3820 q.text("%#x" % self.table_id)
3821 q.text(","); q.breakable()
3822 q.text("deleted_count = ");
3823 q.text("%#x" % self.deleted_count)
3824 q.text(","); q.breakable()
3825 q.text("error_count = ");
3826 q.text("%#x" % self.error_count)
3827 q.breakable()
3828 q.text('}')
3829
3830bsn_header.subtypes[49] = bsn_gentable_clear_reply
3831
3832class bsn_gentable_clear_request(bsn_header):
3833 version = 5
3834 type = 4
3835 experimenter = 6035143
3836 subtype = 48
3837
3838 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3839 if xid != None:
3840 self.xid = xid
3841 else:
3842 self.xid = None
3843 if table_id != None:
3844 self.table_id = table_id
3845 else:
3846 self.table_id = 0
3847 if checksum != None:
3848 self.checksum = checksum
3849 else:
3850 self.checksum = 0
3851 if checksum_mask != None:
3852 self.checksum_mask = checksum_mask
3853 else:
3854 self.checksum_mask = 0
3855 return
3856
3857 def pack(self):
3858 packed = []
3859 packed.append(struct.pack("!B", self.version))
3860 packed.append(struct.pack("!B", self.type))
3861 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3862 packed.append(struct.pack("!L", self.xid))
3863 packed.append(struct.pack("!L", self.experimenter))
3864 packed.append(struct.pack("!L", self.subtype))
3865 packed.append(struct.pack("!H", self.table_id))
3866 packed.append('\x00' * 2)
3867 packed.append(util.pack_checksum_128(self.checksum))
3868 packed.append(util.pack_checksum_128(self.checksum_mask))
3869 length = sum([len(x) for x in packed])
3870 packed[2] = struct.pack("!H", length)
3871 return ''.join(packed)
3872
3873 @staticmethod
3874 def unpack(reader):
3875 obj = bsn_gentable_clear_request()
3876 _version = reader.read("!B")[0]
3877 assert(_version == 5)
3878 _type = reader.read("!B")[0]
3879 assert(_type == 4)
3880 _length = reader.read("!H")[0]
3881 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003882 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003883 obj.xid = reader.read("!L")[0]
3884 _experimenter = reader.read("!L")[0]
3885 assert(_experimenter == 6035143)
3886 _subtype = reader.read("!L")[0]
3887 assert(_subtype == 48)
3888 obj.table_id = reader.read("!H")[0]
3889 reader.skip(2)
3890 obj.checksum = util.unpack_checksum_128(reader)
3891 obj.checksum_mask = util.unpack_checksum_128(reader)
3892 return obj
3893
3894 def __eq__(self, other):
3895 if type(self) != type(other): return False
3896 if self.xid != other.xid: return False
3897 if self.table_id != other.table_id: return False
3898 if self.checksum != other.checksum: return False
3899 if self.checksum_mask != other.checksum_mask: return False
3900 return True
3901
3902 def pretty_print(self, q):
3903 q.text("bsn_gentable_clear_request {")
3904 with q.group():
3905 with q.indent(2):
3906 q.breakable()
3907 q.text("xid = ");
3908 if self.xid != None:
3909 q.text("%#x" % self.xid)
3910 else:
3911 q.text('None')
3912 q.text(","); q.breakable()
3913 q.text("table_id = ");
3914 q.text("%#x" % self.table_id)
3915 q.text(","); q.breakable()
3916 q.text("checksum = ");
3917 q.pp(self.checksum)
3918 q.text(","); q.breakable()
3919 q.text("checksum_mask = ");
3920 q.pp(self.checksum_mask)
3921 q.breakable()
3922 q.text('}')
3923
3924bsn_header.subtypes[48] = bsn_gentable_clear_request
3925
3926class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3927 version = 5
3928 type = 19
3929 stats_type = 65535
3930 experimenter = 6035143
3931 subtype = 4
3932
3933 def __init__(self, xid=None, flags=None, entries=None):
3934 if xid != None:
3935 self.xid = xid
3936 else:
3937 self.xid = None
3938 if flags != None:
3939 self.flags = flags
3940 else:
3941 self.flags = 0
3942 if entries != None:
3943 self.entries = entries
3944 else:
3945 self.entries = []
3946 return
3947
3948 def pack(self):
3949 packed = []
3950 packed.append(struct.pack("!B", self.version))
3951 packed.append(struct.pack("!B", self.type))
3952 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3953 packed.append(struct.pack("!L", self.xid))
3954 packed.append(struct.pack("!H", self.stats_type))
3955 packed.append(struct.pack("!H", self.flags))
3956 packed.append('\x00' * 4)
3957 packed.append(struct.pack("!L", self.experimenter))
3958 packed.append(struct.pack("!L", self.subtype))
3959 packed.append(loxi.generic_util.pack_list(self.entries))
3960 length = sum([len(x) for x in packed])
3961 packed[2] = struct.pack("!H", length)
3962 return ''.join(packed)
3963
3964 @staticmethod
3965 def unpack(reader):
3966 obj = bsn_gentable_desc_stats_reply()
3967 _version = reader.read("!B")[0]
3968 assert(_version == 5)
3969 _type = reader.read("!B")[0]
3970 assert(_type == 19)
3971 _length = reader.read("!H")[0]
3972 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003973 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003974 obj.xid = reader.read("!L")[0]
3975 _stats_type = reader.read("!H")[0]
3976 assert(_stats_type == 65535)
3977 obj.flags = reader.read("!H")[0]
3978 reader.skip(4)
3979 _experimenter = reader.read("!L")[0]
3980 assert(_experimenter == 6035143)
3981 _subtype = reader.read("!L")[0]
3982 assert(_subtype == 4)
Rich Lanee2567702015-01-26 15:04:35 -08003983 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08003984 return obj
3985
3986 def __eq__(self, other):
3987 if type(self) != type(other): return False
3988 if self.xid != other.xid: return False
3989 if self.flags != other.flags: return False
3990 if self.entries != other.entries: return False
3991 return True
3992
3993 def pretty_print(self, q):
3994 q.text("bsn_gentable_desc_stats_reply {")
3995 with q.group():
3996 with q.indent(2):
3997 q.breakable()
3998 q.text("xid = ");
3999 if self.xid != None:
4000 q.text("%#x" % self.xid)
4001 else:
4002 q.text('None')
4003 q.text(","); q.breakable()
4004 q.text("flags = ");
4005 q.text("%#x" % self.flags)
4006 q.text(","); q.breakable()
4007 q.text("entries = ");
4008 q.pp(self.entries)
4009 q.breakable()
4010 q.text('}')
4011
4012bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4013
4014class bsn_gentable_desc_stats_request(bsn_stats_request):
4015 version = 5
4016 type = 18
4017 stats_type = 65535
4018 experimenter = 6035143
4019 subtype = 4
4020
4021 def __init__(self, xid=None, flags=None):
4022 if xid != None:
4023 self.xid = xid
4024 else:
4025 self.xid = None
4026 if flags != None:
4027 self.flags = flags
4028 else:
4029 self.flags = 0
4030 return
4031
4032 def pack(self):
4033 packed = []
4034 packed.append(struct.pack("!B", self.version))
4035 packed.append(struct.pack("!B", self.type))
4036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4037 packed.append(struct.pack("!L", self.xid))
4038 packed.append(struct.pack("!H", self.stats_type))
4039 packed.append(struct.pack("!H", self.flags))
4040 packed.append('\x00' * 4)
4041 packed.append(struct.pack("!L", self.experimenter))
4042 packed.append(struct.pack("!L", self.subtype))
4043 length = sum([len(x) for x in packed])
4044 packed[2] = struct.pack("!H", length)
4045 return ''.join(packed)
4046
4047 @staticmethod
4048 def unpack(reader):
4049 obj = bsn_gentable_desc_stats_request()
4050 _version = reader.read("!B")[0]
4051 assert(_version == 5)
4052 _type = reader.read("!B")[0]
4053 assert(_type == 18)
4054 _length = reader.read("!H")[0]
4055 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004056 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004057 obj.xid = reader.read("!L")[0]
4058 _stats_type = reader.read("!H")[0]
4059 assert(_stats_type == 65535)
4060 obj.flags = reader.read("!H")[0]
4061 reader.skip(4)
4062 _experimenter = reader.read("!L")[0]
4063 assert(_experimenter == 6035143)
4064 _subtype = reader.read("!L")[0]
4065 assert(_subtype == 4)
4066 return obj
4067
4068 def __eq__(self, other):
4069 if type(self) != type(other): return False
4070 if self.xid != other.xid: return False
4071 if self.flags != other.flags: return False
4072 return True
4073
4074 def pretty_print(self, q):
4075 q.text("bsn_gentable_desc_stats_request {")
4076 with q.group():
4077 with q.indent(2):
4078 q.breakable()
4079 q.text("xid = ");
4080 if self.xid != None:
4081 q.text("%#x" % self.xid)
4082 else:
4083 q.text('None')
4084 q.text(","); q.breakable()
4085 q.text("flags = ");
4086 q.text("%#x" % self.flags)
4087 q.breakable()
4088 q.text('}')
4089
4090bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4091
4092class bsn_gentable_entry_add(bsn_header):
4093 version = 5
4094 type = 4
4095 experimenter = 6035143
4096 subtype = 46
4097
4098 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4099 if xid != None:
4100 self.xid = xid
4101 else:
4102 self.xid = None
4103 if table_id != None:
4104 self.table_id = table_id
4105 else:
4106 self.table_id = 0
4107 if checksum != None:
4108 self.checksum = checksum
4109 else:
4110 self.checksum = 0
4111 if key != None:
4112 self.key = key
4113 else:
4114 self.key = []
4115 if value != None:
4116 self.value = value
4117 else:
4118 self.value = []
4119 return
4120
4121 def pack(self):
4122 packed = []
4123 packed.append(struct.pack("!B", self.version))
4124 packed.append(struct.pack("!B", self.type))
4125 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4126 packed.append(struct.pack("!L", self.xid))
4127 packed.append(struct.pack("!L", self.experimenter))
4128 packed.append(struct.pack("!L", self.subtype))
4129 packed.append(struct.pack("!H", self.table_id))
4130 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4131 packed.append(util.pack_checksum_128(self.checksum))
4132 packed.append(loxi.generic_util.pack_list(self.key))
4133 packed[7] = struct.pack("!H", len(packed[-1]))
4134 packed.append(loxi.generic_util.pack_list(self.value))
4135 length = sum([len(x) for x in packed])
4136 packed[2] = struct.pack("!H", length)
4137 return ''.join(packed)
4138
4139 @staticmethod
4140 def unpack(reader):
4141 obj = bsn_gentable_entry_add()
4142 _version = reader.read("!B")[0]
4143 assert(_version == 5)
4144 _type = reader.read("!B")[0]
4145 assert(_type == 4)
4146 _length = reader.read("!H")[0]
4147 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004148 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004149 obj.xid = reader.read("!L")[0]
4150 _experimenter = reader.read("!L")[0]
4151 assert(_experimenter == 6035143)
4152 _subtype = reader.read("!L")[0]
4153 assert(_subtype == 46)
4154 obj.table_id = reader.read("!H")[0]
4155 _key_length = reader.read("!H")[0]
4156 obj.checksum = util.unpack_checksum_128(reader)
Rich Lanee2567702015-01-26 15:04:35 -08004157 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4158 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08004159 return obj
4160
4161 def __eq__(self, other):
4162 if type(self) != type(other): return False
4163 if self.xid != other.xid: return False
4164 if self.table_id != other.table_id: return False
4165 if self.checksum != other.checksum: return False
4166 if self.key != other.key: return False
4167 if self.value != other.value: return False
4168 return True
4169
4170 def pretty_print(self, q):
4171 q.text("bsn_gentable_entry_add {")
4172 with q.group():
4173 with q.indent(2):
4174 q.breakable()
4175 q.text("xid = ");
4176 if self.xid != None:
4177 q.text("%#x" % self.xid)
4178 else:
4179 q.text('None')
4180 q.text(","); q.breakable()
4181 q.text("table_id = ");
4182 q.text("%#x" % self.table_id)
4183 q.text(","); q.breakable()
4184 q.text("checksum = ");
4185 q.pp(self.checksum)
4186 q.text(","); q.breakable()
4187 q.text("key = ");
4188 q.pp(self.key)
4189 q.text(","); q.breakable()
4190 q.text("value = ");
4191 q.pp(self.value)
4192 q.breakable()
4193 q.text('}')
4194
4195bsn_header.subtypes[46] = bsn_gentable_entry_add
4196
4197class bsn_gentable_entry_delete(bsn_header):
4198 version = 5
4199 type = 4
4200 experimenter = 6035143
4201 subtype = 47
4202
4203 def __init__(self, xid=None, table_id=None, key=None):
4204 if xid != None:
4205 self.xid = xid
4206 else:
4207 self.xid = None
4208 if table_id != None:
4209 self.table_id = table_id
4210 else:
4211 self.table_id = 0
4212 if key != None:
4213 self.key = key
4214 else:
4215 self.key = []
4216 return
4217
4218 def pack(self):
4219 packed = []
4220 packed.append(struct.pack("!B", self.version))
4221 packed.append(struct.pack("!B", self.type))
4222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4223 packed.append(struct.pack("!L", self.xid))
4224 packed.append(struct.pack("!L", self.experimenter))
4225 packed.append(struct.pack("!L", self.subtype))
4226 packed.append(struct.pack("!H", self.table_id))
4227 packed.append(loxi.generic_util.pack_list(self.key))
4228 length = sum([len(x) for x in packed])
4229 packed[2] = struct.pack("!H", length)
4230 return ''.join(packed)
4231
4232 @staticmethod
4233 def unpack(reader):
4234 obj = bsn_gentable_entry_delete()
4235 _version = reader.read("!B")[0]
4236 assert(_version == 5)
4237 _type = reader.read("!B")[0]
4238 assert(_type == 4)
4239 _length = reader.read("!H")[0]
4240 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004241 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004242 obj.xid = reader.read("!L")[0]
4243 _experimenter = reader.read("!L")[0]
4244 assert(_experimenter == 6035143)
4245 _subtype = reader.read("!L")[0]
4246 assert(_subtype == 47)
4247 obj.table_id = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004248 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08004249 return obj
4250
4251 def __eq__(self, other):
4252 if type(self) != type(other): return False
4253 if self.xid != other.xid: return False
4254 if self.table_id != other.table_id: return False
4255 if self.key != other.key: return False
4256 return True
4257
4258 def pretty_print(self, q):
4259 q.text("bsn_gentable_entry_delete {")
4260 with q.group():
4261 with q.indent(2):
4262 q.breakable()
4263 q.text("xid = ");
4264 if self.xid != None:
4265 q.text("%#x" % self.xid)
4266 else:
4267 q.text('None')
4268 q.text(","); q.breakable()
4269 q.text("table_id = ");
4270 q.text("%#x" % self.table_id)
4271 q.text(","); q.breakable()
4272 q.text("key = ");
4273 q.pp(self.key)
4274 q.breakable()
4275 q.text('}')
4276
4277bsn_header.subtypes[47] = bsn_gentable_entry_delete
4278
4279class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4280 version = 5
4281 type = 19
4282 stats_type = 65535
4283 experimenter = 6035143
4284 subtype = 2
4285
4286 def __init__(self, xid=None, flags=None, entries=None):
4287 if xid != None:
4288 self.xid = xid
4289 else:
4290 self.xid = None
4291 if flags != None:
4292 self.flags = flags
4293 else:
4294 self.flags = 0
4295 if entries != None:
4296 self.entries = entries
4297 else:
4298 self.entries = []
4299 return
4300
4301 def pack(self):
4302 packed = []
4303 packed.append(struct.pack("!B", self.version))
4304 packed.append(struct.pack("!B", self.type))
4305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4306 packed.append(struct.pack("!L", self.xid))
4307 packed.append(struct.pack("!H", self.stats_type))
4308 packed.append(struct.pack("!H", self.flags))
4309 packed.append('\x00' * 4)
4310 packed.append(struct.pack("!L", self.experimenter))
4311 packed.append(struct.pack("!L", self.subtype))
4312 packed.append(loxi.generic_util.pack_list(self.entries))
4313 length = sum([len(x) for x in packed])
4314 packed[2] = struct.pack("!H", length)
4315 return ''.join(packed)
4316
4317 @staticmethod
4318 def unpack(reader):
4319 obj = bsn_gentable_entry_desc_stats_reply()
4320 _version = reader.read("!B")[0]
4321 assert(_version == 5)
4322 _type = reader.read("!B")[0]
4323 assert(_type == 19)
4324 _length = reader.read("!H")[0]
4325 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004326 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004327 obj.xid = reader.read("!L")[0]
4328 _stats_type = reader.read("!H")[0]
4329 assert(_stats_type == 65535)
4330 obj.flags = reader.read("!H")[0]
4331 reader.skip(4)
4332 _experimenter = reader.read("!L")[0]
4333 assert(_experimenter == 6035143)
4334 _subtype = reader.read("!L")[0]
4335 assert(_subtype == 2)
Rich Lanee2567702015-01-26 15:04:35 -08004336 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08004337 return obj
4338
4339 def __eq__(self, other):
4340 if type(self) != type(other): return False
4341 if self.xid != other.xid: return False
4342 if self.flags != other.flags: return False
4343 if self.entries != other.entries: return False
4344 return True
4345
4346 def pretty_print(self, q):
4347 q.text("bsn_gentable_entry_desc_stats_reply {")
4348 with q.group():
4349 with q.indent(2):
4350 q.breakable()
4351 q.text("xid = ");
4352 if self.xid != None:
4353 q.text("%#x" % self.xid)
4354 else:
4355 q.text('None')
4356 q.text(","); q.breakable()
4357 q.text("flags = ");
4358 q.text("%#x" % self.flags)
4359 q.text(","); q.breakable()
4360 q.text("entries = ");
4361 q.pp(self.entries)
4362 q.breakable()
4363 q.text('}')
4364
4365bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4366
4367class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4368 version = 5
4369 type = 18
4370 stats_type = 65535
4371 experimenter = 6035143
4372 subtype = 2
4373
4374 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4375 if xid != None:
4376 self.xid = xid
4377 else:
4378 self.xid = None
4379 if flags != None:
4380 self.flags = flags
4381 else:
4382 self.flags = 0
4383 if table_id != None:
4384 self.table_id = table_id
4385 else:
4386 self.table_id = 0
4387 if checksum != None:
4388 self.checksum = checksum
4389 else:
4390 self.checksum = 0
4391 if checksum_mask != None:
4392 self.checksum_mask = checksum_mask
4393 else:
4394 self.checksum_mask = 0
4395 return
4396
4397 def pack(self):
4398 packed = []
4399 packed.append(struct.pack("!B", self.version))
4400 packed.append(struct.pack("!B", self.type))
4401 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4402 packed.append(struct.pack("!L", self.xid))
4403 packed.append(struct.pack("!H", self.stats_type))
4404 packed.append(struct.pack("!H", self.flags))
4405 packed.append('\x00' * 4)
4406 packed.append(struct.pack("!L", self.experimenter))
4407 packed.append(struct.pack("!L", self.subtype))
4408 packed.append(struct.pack("!H", self.table_id))
4409 packed.append('\x00' * 2)
4410 packed.append(util.pack_checksum_128(self.checksum))
4411 packed.append(util.pack_checksum_128(self.checksum_mask))
4412 length = sum([len(x) for x in packed])
4413 packed[2] = struct.pack("!H", length)
4414 return ''.join(packed)
4415
4416 @staticmethod
4417 def unpack(reader):
4418 obj = bsn_gentable_entry_desc_stats_request()
4419 _version = reader.read("!B")[0]
4420 assert(_version == 5)
4421 _type = reader.read("!B")[0]
4422 assert(_type == 18)
4423 _length = reader.read("!H")[0]
4424 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004425 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004426 obj.xid = reader.read("!L")[0]
4427 _stats_type = reader.read("!H")[0]
4428 assert(_stats_type == 65535)
4429 obj.flags = reader.read("!H")[0]
4430 reader.skip(4)
4431 _experimenter = reader.read("!L")[0]
4432 assert(_experimenter == 6035143)
4433 _subtype = reader.read("!L")[0]
4434 assert(_subtype == 2)
4435 obj.table_id = reader.read("!H")[0]
4436 reader.skip(2)
4437 obj.checksum = util.unpack_checksum_128(reader)
4438 obj.checksum_mask = util.unpack_checksum_128(reader)
4439 return obj
4440
4441 def __eq__(self, other):
4442 if type(self) != type(other): return False
4443 if self.xid != other.xid: return False
4444 if self.flags != other.flags: return False
4445 if self.table_id != other.table_id: return False
4446 if self.checksum != other.checksum: return False
4447 if self.checksum_mask != other.checksum_mask: return False
4448 return True
4449
4450 def pretty_print(self, q):
4451 q.text("bsn_gentable_entry_desc_stats_request {")
4452 with q.group():
4453 with q.indent(2):
4454 q.breakable()
4455 q.text("xid = ");
4456 if self.xid != None:
4457 q.text("%#x" % self.xid)
4458 else:
4459 q.text('None')
4460 q.text(","); q.breakable()
4461 q.text("flags = ");
4462 q.text("%#x" % self.flags)
4463 q.text(","); q.breakable()
4464 q.text("table_id = ");
4465 q.text("%#x" % self.table_id)
4466 q.text(","); q.breakable()
4467 q.text("checksum = ");
4468 q.pp(self.checksum)
4469 q.text(","); q.breakable()
4470 q.text("checksum_mask = ");
4471 q.pp(self.checksum_mask)
4472 q.breakable()
4473 q.text('}')
4474
4475bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4476
4477class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4478 version = 5
4479 type = 19
4480 stats_type = 65535
4481 experimenter = 6035143
4482 subtype = 3
4483
4484 def __init__(self, xid=None, flags=None, entries=None):
4485 if xid != None:
4486 self.xid = xid
4487 else:
4488 self.xid = None
4489 if flags != None:
4490 self.flags = flags
4491 else:
4492 self.flags = 0
4493 if entries != None:
4494 self.entries = entries
4495 else:
4496 self.entries = []
4497 return
4498
4499 def pack(self):
4500 packed = []
4501 packed.append(struct.pack("!B", self.version))
4502 packed.append(struct.pack("!B", self.type))
4503 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4504 packed.append(struct.pack("!L", self.xid))
4505 packed.append(struct.pack("!H", self.stats_type))
4506 packed.append(struct.pack("!H", self.flags))
4507 packed.append('\x00' * 4)
4508 packed.append(struct.pack("!L", self.experimenter))
4509 packed.append(struct.pack("!L", self.subtype))
4510 packed.append(loxi.generic_util.pack_list(self.entries))
4511 length = sum([len(x) for x in packed])
4512 packed[2] = struct.pack("!H", length)
4513 return ''.join(packed)
4514
4515 @staticmethod
4516 def unpack(reader):
4517 obj = bsn_gentable_entry_stats_reply()
4518 _version = reader.read("!B")[0]
4519 assert(_version == 5)
4520 _type = reader.read("!B")[0]
4521 assert(_type == 19)
4522 _length = reader.read("!H")[0]
4523 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004524 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004525 obj.xid = reader.read("!L")[0]
4526 _stats_type = reader.read("!H")[0]
4527 assert(_stats_type == 65535)
4528 obj.flags = reader.read("!H")[0]
4529 reader.skip(4)
4530 _experimenter = reader.read("!L")[0]
4531 assert(_experimenter == 6035143)
4532 _subtype = reader.read("!L")[0]
4533 assert(_subtype == 3)
Rich Lanee2567702015-01-26 15:04:35 -08004534 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08004535 return obj
4536
4537 def __eq__(self, other):
4538 if type(self) != type(other): return False
4539 if self.xid != other.xid: return False
4540 if self.flags != other.flags: return False
4541 if self.entries != other.entries: return False
4542 return True
4543
4544 def pretty_print(self, q):
4545 q.text("bsn_gentable_entry_stats_reply {")
4546 with q.group():
4547 with q.indent(2):
4548 q.breakable()
4549 q.text("xid = ");
4550 if self.xid != None:
4551 q.text("%#x" % self.xid)
4552 else:
4553 q.text('None')
4554 q.text(","); q.breakable()
4555 q.text("flags = ");
4556 q.text("%#x" % self.flags)
4557 q.text(","); q.breakable()
4558 q.text("entries = ");
4559 q.pp(self.entries)
4560 q.breakable()
4561 q.text('}')
4562
4563bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4564
4565class bsn_gentable_entry_stats_request(bsn_stats_request):
4566 version = 5
4567 type = 18
4568 stats_type = 65535
4569 experimenter = 6035143
4570 subtype = 3
4571
4572 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4573 if xid != None:
4574 self.xid = xid
4575 else:
4576 self.xid = None
4577 if flags != None:
4578 self.flags = flags
4579 else:
4580 self.flags = 0
4581 if table_id != None:
4582 self.table_id = table_id
4583 else:
4584 self.table_id = 0
4585 if checksum != None:
4586 self.checksum = checksum
4587 else:
4588 self.checksum = 0
4589 if checksum_mask != None:
4590 self.checksum_mask = checksum_mask
4591 else:
4592 self.checksum_mask = 0
4593 return
4594
4595 def pack(self):
4596 packed = []
4597 packed.append(struct.pack("!B", self.version))
4598 packed.append(struct.pack("!B", self.type))
4599 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4600 packed.append(struct.pack("!L", self.xid))
4601 packed.append(struct.pack("!H", self.stats_type))
4602 packed.append(struct.pack("!H", self.flags))
4603 packed.append('\x00' * 4)
4604 packed.append(struct.pack("!L", self.experimenter))
4605 packed.append(struct.pack("!L", self.subtype))
4606 packed.append(struct.pack("!H", self.table_id))
4607 packed.append('\x00' * 2)
4608 packed.append(util.pack_checksum_128(self.checksum))
4609 packed.append(util.pack_checksum_128(self.checksum_mask))
4610 length = sum([len(x) for x in packed])
4611 packed[2] = struct.pack("!H", length)
4612 return ''.join(packed)
4613
4614 @staticmethod
4615 def unpack(reader):
4616 obj = bsn_gentable_entry_stats_request()
4617 _version = reader.read("!B")[0]
4618 assert(_version == 5)
4619 _type = reader.read("!B")[0]
4620 assert(_type == 18)
4621 _length = reader.read("!H")[0]
4622 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004623 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004624 obj.xid = reader.read("!L")[0]
4625 _stats_type = reader.read("!H")[0]
4626 assert(_stats_type == 65535)
4627 obj.flags = reader.read("!H")[0]
4628 reader.skip(4)
4629 _experimenter = reader.read("!L")[0]
4630 assert(_experimenter == 6035143)
4631 _subtype = reader.read("!L")[0]
4632 assert(_subtype == 3)
4633 obj.table_id = reader.read("!H")[0]
4634 reader.skip(2)
4635 obj.checksum = util.unpack_checksum_128(reader)
4636 obj.checksum_mask = util.unpack_checksum_128(reader)
4637 return obj
4638
4639 def __eq__(self, other):
4640 if type(self) != type(other): return False
4641 if self.xid != other.xid: return False
4642 if self.flags != other.flags: return False
4643 if self.table_id != other.table_id: return False
4644 if self.checksum != other.checksum: return False
4645 if self.checksum_mask != other.checksum_mask: return False
4646 return True
4647
4648 def pretty_print(self, q):
4649 q.text("bsn_gentable_entry_stats_request {")
4650 with q.group():
4651 with q.indent(2):
4652 q.breakable()
4653 q.text("xid = ");
4654 if self.xid != None:
4655 q.text("%#x" % self.xid)
4656 else:
4657 q.text('None')
4658 q.text(","); q.breakable()
4659 q.text("flags = ");
4660 q.text("%#x" % self.flags)
4661 q.text(","); q.breakable()
4662 q.text("table_id = ");
4663 q.text("%#x" % self.table_id)
4664 q.text(","); q.breakable()
4665 q.text("checksum = ");
4666 q.pp(self.checksum)
4667 q.text(","); q.breakable()
4668 q.text("checksum_mask = ");
4669 q.pp(self.checksum_mask)
4670 q.breakable()
4671 q.text('}')
4672
4673bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4674
4675class bsn_gentable_set_buckets_size(bsn_header):
4676 version = 5
4677 type = 4
4678 experimenter = 6035143
4679 subtype = 50
4680
4681 def __init__(self, xid=None, table_id=None, buckets_size=None):
4682 if xid != None:
4683 self.xid = xid
4684 else:
4685 self.xid = None
4686 if table_id != None:
4687 self.table_id = table_id
4688 else:
4689 self.table_id = 0
4690 if buckets_size != None:
4691 self.buckets_size = buckets_size
4692 else:
4693 self.buckets_size = 0
4694 return
4695
4696 def pack(self):
4697 packed = []
4698 packed.append(struct.pack("!B", self.version))
4699 packed.append(struct.pack("!B", self.type))
4700 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4701 packed.append(struct.pack("!L", self.xid))
4702 packed.append(struct.pack("!L", self.experimenter))
4703 packed.append(struct.pack("!L", self.subtype))
4704 packed.append(struct.pack("!H", self.table_id))
4705 packed.append('\x00' * 2)
4706 packed.append(struct.pack("!L", self.buckets_size))
4707 length = sum([len(x) for x in packed])
4708 packed[2] = struct.pack("!H", length)
4709 return ''.join(packed)
4710
4711 @staticmethod
4712 def unpack(reader):
4713 obj = bsn_gentable_set_buckets_size()
4714 _version = reader.read("!B")[0]
4715 assert(_version == 5)
4716 _type = reader.read("!B")[0]
4717 assert(_type == 4)
4718 _length = reader.read("!H")[0]
4719 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004720 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004721 obj.xid = reader.read("!L")[0]
4722 _experimenter = reader.read("!L")[0]
4723 assert(_experimenter == 6035143)
4724 _subtype = reader.read("!L")[0]
4725 assert(_subtype == 50)
4726 obj.table_id = reader.read("!H")[0]
4727 reader.skip(2)
4728 obj.buckets_size = reader.read("!L")[0]
4729 return obj
4730
4731 def __eq__(self, other):
4732 if type(self) != type(other): return False
4733 if self.xid != other.xid: return False
4734 if self.table_id != other.table_id: return False
4735 if self.buckets_size != other.buckets_size: return False
4736 return True
4737
4738 def pretty_print(self, q):
4739 q.text("bsn_gentable_set_buckets_size {")
4740 with q.group():
4741 with q.indent(2):
4742 q.breakable()
4743 q.text("xid = ");
4744 if self.xid != None:
4745 q.text("%#x" % self.xid)
4746 else:
4747 q.text('None')
4748 q.text(","); q.breakable()
4749 q.text("table_id = ");
4750 q.text("%#x" % self.table_id)
4751 q.text(","); q.breakable()
4752 q.text("buckets_size = ");
4753 q.text("%#x" % self.buckets_size)
4754 q.breakable()
4755 q.text('}')
4756
4757bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4758
4759class bsn_gentable_stats_reply(bsn_stats_reply):
4760 version = 5
4761 type = 19
4762 stats_type = 65535
4763 experimenter = 6035143
4764 subtype = 7
4765
4766 def __init__(self, xid=None, flags=None, entries=None):
4767 if xid != None:
4768 self.xid = xid
4769 else:
4770 self.xid = None
4771 if flags != None:
4772 self.flags = flags
4773 else:
4774 self.flags = 0
4775 if entries != None:
4776 self.entries = entries
4777 else:
4778 self.entries = []
4779 return
4780
4781 def pack(self):
4782 packed = []
4783 packed.append(struct.pack("!B", self.version))
4784 packed.append(struct.pack("!B", self.type))
4785 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4786 packed.append(struct.pack("!L", self.xid))
4787 packed.append(struct.pack("!H", self.stats_type))
4788 packed.append(struct.pack("!H", self.flags))
4789 packed.append('\x00' * 4)
4790 packed.append(struct.pack("!L", self.experimenter))
4791 packed.append(struct.pack("!L", self.subtype))
4792 packed.append(loxi.generic_util.pack_list(self.entries))
4793 length = sum([len(x) for x in packed])
4794 packed[2] = struct.pack("!H", length)
4795 return ''.join(packed)
4796
4797 @staticmethod
4798 def unpack(reader):
4799 obj = bsn_gentable_stats_reply()
4800 _version = reader.read("!B")[0]
4801 assert(_version == 5)
4802 _type = reader.read("!B")[0]
4803 assert(_type == 19)
4804 _length = reader.read("!H")[0]
4805 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004806 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004807 obj.xid = reader.read("!L")[0]
4808 _stats_type = reader.read("!H")[0]
4809 assert(_stats_type == 65535)
4810 obj.flags = reader.read("!H")[0]
4811 reader.skip(4)
4812 _experimenter = reader.read("!L")[0]
4813 assert(_experimenter == 6035143)
4814 _subtype = reader.read("!L")[0]
4815 assert(_subtype == 7)
Rich Lanee2567702015-01-26 15:04:35 -08004816 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08004817 return obj
4818
4819 def __eq__(self, other):
4820 if type(self) != type(other): return False
4821 if self.xid != other.xid: return False
4822 if self.flags != other.flags: return False
4823 if self.entries != other.entries: return False
4824 return True
4825
4826 def pretty_print(self, q):
4827 q.text("bsn_gentable_stats_reply {")
4828 with q.group():
4829 with q.indent(2):
4830 q.breakable()
4831 q.text("xid = ");
4832 if self.xid != None:
4833 q.text("%#x" % self.xid)
4834 else:
4835 q.text('None')
4836 q.text(","); q.breakable()
4837 q.text("flags = ");
4838 q.text("%#x" % self.flags)
4839 q.text(","); q.breakable()
4840 q.text("entries = ");
4841 q.pp(self.entries)
4842 q.breakable()
4843 q.text('}')
4844
4845bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4846
4847class bsn_gentable_stats_request(bsn_stats_request):
4848 version = 5
4849 type = 18
4850 stats_type = 65535
4851 experimenter = 6035143
4852 subtype = 7
4853
4854 def __init__(self, xid=None, flags=None):
4855 if xid != None:
4856 self.xid = xid
4857 else:
4858 self.xid = None
4859 if flags != None:
4860 self.flags = flags
4861 else:
4862 self.flags = 0
4863 return
4864
4865 def pack(self):
4866 packed = []
4867 packed.append(struct.pack("!B", self.version))
4868 packed.append(struct.pack("!B", self.type))
4869 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4870 packed.append(struct.pack("!L", self.xid))
4871 packed.append(struct.pack("!H", self.stats_type))
4872 packed.append(struct.pack("!H", self.flags))
4873 packed.append('\x00' * 4)
4874 packed.append(struct.pack("!L", self.experimenter))
4875 packed.append(struct.pack("!L", self.subtype))
4876 length = sum([len(x) for x in packed])
4877 packed[2] = struct.pack("!H", length)
4878 return ''.join(packed)
4879
4880 @staticmethod
4881 def unpack(reader):
4882 obj = bsn_gentable_stats_request()
4883 _version = reader.read("!B")[0]
4884 assert(_version == 5)
4885 _type = reader.read("!B")[0]
4886 assert(_type == 18)
4887 _length = reader.read("!H")[0]
4888 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004889 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08004890 obj.xid = reader.read("!L")[0]
4891 _stats_type = reader.read("!H")[0]
4892 assert(_stats_type == 65535)
4893 obj.flags = reader.read("!H")[0]
4894 reader.skip(4)
4895 _experimenter = reader.read("!L")[0]
4896 assert(_experimenter == 6035143)
4897 _subtype = reader.read("!L")[0]
4898 assert(_subtype == 7)
4899 return obj
4900
4901 def __eq__(self, other):
4902 if type(self) != type(other): return False
4903 if self.xid != other.xid: return False
4904 if self.flags != other.flags: return False
4905 return True
4906
4907 def pretty_print(self, q):
4908 q.text("bsn_gentable_stats_request {")
4909 with q.group():
4910 with q.indent(2):
4911 q.breakable()
4912 q.text("xid = ");
4913 if self.xid != None:
4914 q.text("%#x" % self.xid)
4915 else:
4916 q.text('None')
4917 q.text(","); q.breakable()
4918 q.text("flags = ");
4919 q.text("%#x" % self.flags)
4920 q.breakable()
4921 q.text('}')
4922
4923bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4924
Rich Lane2e079da2014-10-29 15:30:24 -07004925class bsn_get_interfaces_reply(bsn_header):
4926 version = 5
4927 type = 4
4928 experimenter = 6035143
4929 subtype = 10
4930
4931 def __init__(self, xid=None, interfaces=None):
4932 if xid != None:
4933 self.xid = xid
4934 else:
4935 self.xid = None
4936 if interfaces != None:
4937 self.interfaces = interfaces
4938 else:
4939 self.interfaces = []
4940 return
4941
4942 def pack(self):
4943 packed = []
4944 packed.append(struct.pack("!B", self.version))
4945 packed.append(struct.pack("!B", self.type))
4946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4947 packed.append(struct.pack("!L", self.xid))
4948 packed.append(struct.pack("!L", self.experimenter))
4949 packed.append(struct.pack("!L", self.subtype))
4950 packed.append(loxi.generic_util.pack_list(self.interfaces))
4951 length = sum([len(x) for x in packed])
4952 packed[2] = struct.pack("!H", length)
4953 return ''.join(packed)
4954
4955 @staticmethod
4956 def unpack(reader):
4957 obj = bsn_get_interfaces_reply()
4958 _version = reader.read("!B")[0]
4959 assert(_version == 5)
4960 _type = reader.read("!B")[0]
4961 assert(_type == 4)
4962 _length = reader.read("!H")[0]
4963 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004964 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07004965 obj.xid = reader.read("!L")[0]
4966 _experimenter = reader.read("!L")[0]
4967 assert(_experimenter == 6035143)
4968 _subtype = reader.read("!L")[0]
4969 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08004970 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07004971 return obj
4972
4973 def __eq__(self, other):
4974 if type(self) != type(other): return False
4975 if self.xid != other.xid: return False
4976 if self.interfaces != other.interfaces: return False
4977 return True
4978
4979 def pretty_print(self, q):
4980 q.text("bsn_get_interfaces_reply {")
4981 with q.group():
4982 with q.indent(2):
4983 q.breakable()
4984 q.text("xid = ");
4985 if self.xid != None:
4986 q.text("%#x" % self.xid)
4987 else:
4988 q.text('None')
4989 q.text(","); q.breakable()
4990 q.text("interfaces = ");
4991 q.pp(self.interfaces)
4992 q.breakable()
4993 q.text('}')
4994
4995bsn_header.subtypes[10] = bsn_get_interfaces_reply
4996
4997class bsn_get_interfaces_request(bsn_header):
4998 version = 5
4999 type = 4
5000 experimenter = 6035143
5001 subtype = 9
5002
5003 def __init__(self, xid=None):
5004 if xid != None:
5005 self.xid = xid
5006 else:
5007 self.xid = None
5008 return
5009
5010 def pack(self):
5011 packed = []
5012 packed.append(struct.pack("!B", self.version))
5013 packed.append(struct.pack("!B", self.type))
5014 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5015 packed.append(struct.pack("!L", self.xid))
5016 packed.append(struct.pack("!L", self.experimenter))
5017 packed.append(struct.pack("!L", self.subtype))
5018 length = sum([len(x) for x in packed])
5019 packed[2] = struct.pack("!H", length)
5020 return ''.join(packed)
5021
5022 @staticmethod
5023 def unpack(reader):
5024 obj = bsn_get_interfaces_request()
5025 _version = reader.read("!B")[0]
5026 assert(_version == 5)
5027 _type = reader.read("!B")[0]
5028 assert(_type == 4)
5029 _length = reader.read("!H")[0]
5030 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005031 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005032 obj.xid = reader.read("!L")[0]
5033 _experimenter = reader.read("!L")[0]
5034 assert(_experimenter == 6035143)
5035 _subtype = reader.read("!L")[0]
5036 assert(_subtype == 9)
5037 return obj
5038
5039 def __eq__(self, other):
5040 if type(self) != type(other): return False
5041 if self.xid != other.xid: return False
5042 return True
5043
5044 def pretty_print(self, q):
5045 q.text("bsn_get_interfaces_request {")
5046 with q.group():
5047 with q.indent(2):
5048 q.breakable()
5049 q.text("xid = ");
5050 if self.xid != None:
5051 q.text("%#x" % self.xid)
5052 else:
5053 q.text('None')
5054 q.breakable()
5055 q.text('}')
5056
5057bsn_header.subtypes[9] = bsn_get_interfaces_request
5058
5059class bsn_get_mirroring_reply(bsn_header):
5060 version = 5
5061 type = 4
5062 experimenter = 6035143
5063 subtype = 5
5064
5065 def __init__(self, xid=None, report_mirror_ports=None):
5066 if xid != None:
5067 self.xid = xid
5068 else:
5069 self.xid = None
5070 if report_mirror_ports != None:
5071 self.report_mirror_ports = report_mirror_ports
5072 else:
5073 self.report_mirror_ports = 0
5074 return
5075
5076 def pack(self):
5077 packed = []
5078 packed.append(struct.pack("!B", self.version))
5079 packed.append(struct.pack("!B", self.type))
5080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5081 packed.append(struct.pack("!L", self.xid))
5082 packed.append(struct.pack("!L", self.experimenter))
5083 packed.append(struct.pack("!L", self.subtype))
5084 packed.append(struct.pack("!B", self.report_mirror_ports))
5085 packed.append('\x00' * 3)
5086 length = sum([len(x) for x in packed])
5087 packed[2] = struct.pack("!H", length)
5088 return ''.join(packed)
5089
5090 @staticmethod
5091 def unpack(reader):
5092 obj = bsn_get_mirroring_reply()
5093 _version = reader.read("!B")[0]
5094 assert(_version == 5)
5095 _type = reader.read("!B")[0]
5096 assert(_type == 4)
5097 _length = reader.read("!H")[0]
5098 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005099 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005100 obj.xid = reader.read("!L")[0]
5101 _experimenter = reader.read("!L")[0]
5102 assert(_experimenter == 6035143)
5103 _subtype = reader.read("!L")[0]
5104 assert(_subtype == 5)
5105 obj.report_mirror_ports = reader.read("!B")[0]
5106 reader.skip(3)
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.report_mirror_ports != other.report_mirror_ports: return False
5113 return True
5114
5115 def pretty_print(self, q):
5116 q.text("bsn_get_mirroring_reply {")
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("report_mirror_ports = ");
5127 q.text("%#x" % self.report_mirror_ports)
5128 q.breakable()
5129 q.text('}')
5130
5131bsn_header.subtypes[5] = bsn_get_mirroring_reply
5132
5133class bsn_get_mirroring_request(bsn_header):
5134 version = 5
5135 type = 4
5136 experimenter = 6035143
5137 subtype = 4
5138
5139 def __init__(self, xid=None, report_mirror_ports=None):
5140 if xid != None:
5141 self.xid = xid
5142 else:
5143 self.xid = None
5144 if report_mirror_ports != None:
5145 self.report_mirror_ports = report_mirror_ports
5146 else:
5147 self.report_mirror_ports = 0
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(struct.pack("!B", self.report_mirror_ports))
5159 packed.append('\x00' * 3)
5160 length = sum([len(x) for x in packed])
5161 packed[2] = struct.pack("!H", length)
5162 return ''.join(packed)
5163
5164 @staticmethod
5165 def unpack(reader):
5166 obj = bsn_get_mirroring_request()
5167 _version = reader.read("!B")[0]
5168 assert(_version == 5)
5169 _type = reader.read("!B")[0]
5170 assert(_type == 4)
5171 _length = reader.read("!H")[0]
5172 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005173 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07005174 obj.xid = reader.read("!L")[0]
5175 _experimenter = reader.read("!L")[0]
5176 assert(_experimenter == 6035143)
5177 _subtype = reader.read("!L")[0]
5178 assert(_subtype == 4)
5179 obj.report_mirror_ports = reader.read("!B")[0]
5180 reader.skip(3)
5181 return obj
5182
5183 def __eq__(self, other):
5184 if type(self) != type(other): return False
5185 if self.xid != other.xid: return False
5186 if self.report_mirror_ports != other.report_mirror_ports: return False
5187 return True
5188
5189 def pretty_print(self, q):
5190 q.text("bsn_get_mirroring_request {")
5191 with q.group():
5192 with q.indent(2):
5193 q.breakable()
5194 q.text("xid = ");
5195 if self.xid != None:
5196 q.text("%#x" % self.xid)
5197 else:
5198 q.text('None')
5199 q.text(","); q.breakable()
5200 q.text("report_mirror_ports = ");
5201 q.text("%#x" % self.report_mirror_ports)
5202 q.breakable()
5203 q.text('}')
5204
5205bsn_header.subtypes[4] = bsn_get_mirroring_request
5206
Rich Laneccd32ed2014-11-10 17:48:24 -08005207class bsn_get_switch_pipeline_reply(bsn_header):
5208 version = 5
5209 type = 4
5210 experimenter = 6035143
5211 subtype = 52
5212
5213 def __init__(self, xid=None, pipeline=None):
5214 if xid != None:
5215 self.xid = xid
5216 else:
5217 self.xid = None
5218 if pipeline != None:
5219 self.pipeline = pipeline
5220 else:
5221 self.pipeline = ""
5222 return
5223
5224 def pack(self):
5225 packed = []
5226 packed.append(struct.pack("!B", self.version))
5227 packed.append(struct.pack("!B", self.type))
5228 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5229 packed.append(struct.pack("!L", self.xid))
5230 packed.append(struct.pack("!L", self.experimenter))
5231 packed.append(struct.pack("!L", self.subtype))
5232 packed.append(struct.pack("!256s", self.pipeline))
5233 length = sum([len(x) for x in packed])
5234 packed[2] = struct.pack("!H", length)
5235 return ''.join(packed)
5236
5237 @staticmethod
5238 def unpack(reader):
5239 obj = bsn_get_switch_pipeline_reply()
5240 _version = reader.read("!B")[0]
5241 assert(_version == 5)
5242 _type = reader.read("!B")[0]
5243 assert(_type == 4)
5244 _length = reader.read("!H")[0]
5245 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005246 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005247 obj.xid = reader.read("!L")[0]
5248 _experimenter = reader.read("!L")[0]
5249 assert(_experimenter == 6035143)
5250 _subtype = reader.read("!L")[0]
5251 assert(_subtype == 52)
5252 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5253 return obj
5254
5255 def __eq__(self, other):
5256 if type(self) != type(other): return False
5257 if self.xid != other.xid: return False
5258 if self.pipeline != other.pipeline: return False
5259 return True
5260
5261 def pretty_print(self, q):
5262 q.text("bsn_get_switch_pipeline_reply {")
5263 with q.group():
5264 with q.indent(2):
5265 q.breakable()
5266 q.text("xid = ");
5267 if self.xid != None:
5268 q.text("%#x" % self.xid)
5269 else:
5270 q.text('None')
5271 q.text(","); q.breakable()
5272 q.text("pipeline = ");
5273 q.pp(self.pipeline)
5274 q.breakable()
5275 q.text('}')
5276
5277bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5278
5279class bsn_get_switch_pipeline_request(bsn_header):
5280 version = 5
5281 type = 4
5282 experimenter = 6035143
5283 subtype = 51
5284
5285 def __init__(self, xid=None):
5286 if xid != None:
5287 self.xid = xid
5288 else:
5289 self.xid = None
5290 return
5291
5292 def pack(self):
5293 packed = []
5294 packed.append(struct.pack("!B", self.version))
5295 packed.append(struct.pack("!B", self.type))
5296 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5297 packed.append(struct.pack("!L", self.xid))
5298 packed.append(struct.pack("!L", self.experimenter))
5299 packed.append(struct.pack("!L", self.subtype))
5300 length = sum([len(x) for x in packed])
5301 packed[2] = struct.pack("!H", length)
5302 return ''.join(packed)
5303
5304 @staticmethod
5305 def unpack(reader):
5306 obj = bsn_get_switch_pipeline_request()
5307 _version = reader.read("!B")[0]
5308 assert(_version == 5)
5309 _type = reader.read("!B")[0]
5310 assert(_type == 4)
5311 _length = reader.read("!H")[0]
5312 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005313 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005314 obj.xid = reader.read("!L")[0]
5315 _experimenter = reader.read("!L")[0]
5316 assert(_experimenter == 6035143)
5317 _subtype = reader.read("!L")[0]
5318 assert(_subtype == 51)
5319 return obj
5320
5321 def __eq__(self, other):
5322 if type(self) != type(other): return False
5323 if self.xid != other.xid: return False
5324 return True
5325
5326 def pretty_print(self, q):
5327 q.text("bsn_get_switch_pipeline_request {")
5328 with q.group():
5329 with q.indent(2):
5330 q.breakable()
5331 q.text("xid = ");
5332 if self.xid != None:
5333 q.text("%#x" % self.xid)
5334 else:
5335 q.text('None')
5336 q.breakable()
5337 q.text('}')
5338
5339bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5340
5341class bsn_image_desc_stats_reply(bsn_stats_reply):
5342 version = 5
5343 type = 19
5344 stats_type = 65535
5345 experimenter = 6035143
5346 subtype = 14
5347
5348 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5349 if xid != None:
5350 self.xid = xid
5351 else:
5352 self.xid = None
5353 if flags != None:
5354 self.flags = flags
5355 else:
5356 self.flags = 0
5357 if image_checksum != None:
5358 self.image_checksum = image_checksum
5359 else:
5360 self.image_checksum = ""
5361 if startup_config_checksum != None:
5362 self.startup_config_checksum = startup_config_checksum
5363 else:
5364 self.startup_config_checksum = ""
5365 return
5366
5367 def pack(self):
5368 packed = []
5369 packed.append(struct.pack("!B", self.version))
5370 packed.append(struct.pack("!B", self.type))
5371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5372 packed.append(struct.pack("!L", self.xid))
5373 packed.append(struct.pack("!H", self.stats_type))
5374 packed.append(struct.pack("!H", self.flags))
5375 packed.append('\x00' * 4)
5376 packed.append(struct.pack("!L", self.experimenter))
5377 packed.append(struct.pack("!L", self.subtype))
5378 packed.append(struct.pack("!256s", self.image_checksum))
5379 packed.append(struct.pack("!256s", self.startup_config_checksum))
5380 length = sum([len(x) for x in packed])
5381 packed[2] = struct.pack("!H", length)
5382 return ''.join(packed)
5383
5384 @staticmethod
5385 def unpack(reader):
5386 obj = bsn_image_desc_stats_reply()
5387 _version = reader.read("!B")[0]
5388 assert(_version == 5)
5389 _type = reader.read("!B")[0]
5390 assert(_type == 19)
5391 _length = reader.read("!H")[0]
5392 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005393 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005394 obj.xid = reader.read("!L")[0]
5395 _stats_type = reader.read("!H")[0]
5396 assert(_stats_type == 65535)
5397 obj.flags = reader.read("!H")[0]
5398 reader.skip(4)
5399 _experimenter = reader.read("!L")[0]
5400 assert(_experimenter == 6035143)
5401 _subtype = reader.read("!L")[0]
5402 assert(_subtype == 14)
5403 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5404 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5405 return obj
5406
5407 def __eq__(self, other):
5408 if type(self) != type(other): return False
5409 if self.xid != other.xid: return False
5410 if self.flags != other.flags: return False
5411 if self.image_checksum != other.image_checksum: return False
5412 if self.startup_config_checksum != other.startup_config_checksum: return False
5413 return True
5414
5415 def pretty_print(self, q):
5416 q.text("bsn_image_desc_stats_reply {")
5417 with q.group():
5418 with q.indent(2):
5419 q.breakable()
5420 q.text("xid = ");
5421 if self.xid != None:
5422 q.text("%#x" % self.xid)
5423 else:
5424 q.text('None')
5425 q.text(","); q.breakable()
5426 q.text("flags = ");
5427 q.text("%#x" % self.flags)
5428 q.text(","); q.breakable()
5429 q.text("image_checksum = ");
5430 q.pp(self.image_checksum)
5431 q.text(","); q.breakable()
5432 q.text("startup_config_checksum = ");
5433 q.pp(self.startup_config_checksum)
5434 q.breakable()
5435 q.text('}')
5436
5437bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5438
5439class bsn_image_desc_stats_request(bsn_stats_request):
5440 version = 5
5441 type = 18
5442 stats_type = 65535
5443 experimenter = 6035143
5444 subtype = 14
5445
5446 def __init__(self, xid=None, flags=None):
5447 if xid != None:
5448 self.xid = xid
5449 else:
5450 self.xid = None
5451 if flags != None:
5452 self.flags = flags
5453 else:
5454 self.flags = 0
5455 return
5456
5457 def pack(self):
5458 packed = []
5459 packed.append(struct.pack("!B", self.version))
5460 packed.append(struct.pack("!B", self.type))
5461 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5462 packed.append(struct.pack("!L", self.xid))
5463 packed.append(struct.pack("!H", self.stats_type))
5464 packed.append(struct.pack("!H", self.flags))
5465 packed.append('\x00' * 4)
5466 packed.append(struct.pack("!L", self.experimenter))
5467 packed.append(struct.pack("!L", self.subtype))
5468 length = sum([len(x) for x in packed])
5469 packed[2] = struct.pack("!H", length)
5470 return ''.join(packed)
5471
5472 @staticmethod
5473 def unpack(reader):
5474 obj = bsn_image_desc_stats_request()
5475 _version = reader.read("!B")[0]
5476 assert(_version == 5)
5477 _type = reader.read("!B")[0]
5478 assert(_type == 18)
5479 _length = reader.read("!H")[0]
5480 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005481 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005482 obj.xid = reader.read("!L")[0]
5483 _stats_type = reader.read("!H")[0]
5484 assert(_stats_type == 65535)
5485 obj.flags = reader.read("!H")[0]
5486 reader.skip(4)
5487 _experimenter = reader.read("!L")[0]
5488 assert(_experimenter == 6035143)
5489 _subtype = reader.read("!L")[0]
5490 assert(_subtype == 14)
5491 return obj
5492
5493 def __eq__(self, other):
5494 if type(self) != type(other): return False
5495 if self.xid != other.xid: return False
5496 if self.flags != other.flags: return False
5497 return True
5498
5499 def pretty_print(self, q):
5500 q.text("bsn_image_desc_stats_request {")
5501 with q.group():
5502 with q.indent(2):
5503 q.breakable()
5504 q.text("xid = ");
5505 if self.xid != None:
5506 q.text("%#x" % self.xid)
5507 else:
5508 q.text('None')
5509 q.text(","); q.breakable()
5510 q.text("flags = ");
5511 q.text("%#x" % self.flags)
5512 q.breakable()
5513 q.text('}')
5514
5515bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5516
5517class bsn_lacp_convergence_notif(bsn_header):
5518 version = 5
5519 type = 4
5520 experimenter = 6035143
5521 subtype = 43
5522
5523 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):
5524 if xid != None:
5525 self.xid = xid
5526 else:
5527 self.xid = None
5528 if convergence_status != None:
5529 self.convergence_status = convergence_status
5530 else:
5531 self.convergence_status = 0
5532 if port_no != None:
5533 self.port_no = port_no
5534 else:
5535 self.port_no = 0
5536 if actor_sys_priority != None:
5537 self.actor_sys_priority = actor_sys_priority
5538 else:
5539 self.actor_sys_priority = 0
5540 if actor_sys_mac != None:
5541 self.actor_sys_mac = actor_sys_mac
5542 else:
5543 self.actor_sys_mac = [0,0,0,0,0,0]
5544 if actor_port_priority != None:
5545 self.actor_port_priority = actor_port_priority
5546 else:
5547 self.actor_port_priority = 0
5548 if actor_port_num != None:
5549 self.actor_port_num = actor_port_num
5550 else:
5551 self.actor_port_num = 0
5552 if actor_key != None:
5553 self.actor_key = actor_key
5554 else:
5555 self.actor_key = 0
5556 if partner_sys_priority != None:
5557 self.partner_sys_priority = partner_sys_priority
5558 else:
5559 self.partner_sys_priority = 0
5560 if partner_sys_mac != None:
5561 self.partner_sys_mac = partner_sys_mac
5562 else:
5563 self.partner_sys_mac = [0,0,0,0,0,0]
5564 if partner_port_priority != None:
5565 self.partner_port_priority = partner_port_priority
5566 else:
5567 self.partner_port_priority = 0
5568 if partner_port_num != None:
5569 self.partner_port_num = partner_port_num
5570 else:
5571 self.partner_port_num = 0
5572 if partner_key != None:
5573 self.partner_key = partner_key
5574 else:
5575 self.partner_key = 0
5576 return
5577
5578 def pack(self):
5579 packed = []
5580 packed.append(struct.pack("!B", self.version))
5581 packed.append(struct.pack("!B", self.type))
5582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5583 packed.append(struct.pack("!L", self.xid))
5584 packed.append(struct.pack("!L", self.experimenter))
5585 packed.append(struct.pack("!L", self.subtype))
5586 packed.append(struct.pack("!B", self.convergence_status))
5587 packed.append('\x00' * 3)
5588 packed.append(util.pack_port_no(self.port_no))
5589 packed.append(struct.pack("!H", self.actor_sys_priority))
5590 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5591 packed.append(struct.pack("!H", self.actor_port_priority))
5592 packed.append(struct.pack("!H", self.actor_port_num))
5593 packed.append(struct.pack("!H", self.actor_key))
5594 packed.append(struct.pack("!H", self.partner_sys_priority))
5595 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5596 packed.append(struct.pack("!H", self.partner_port_priority))
5597 packed.append(struct.pack("!H", self.partner_port_num))
5598 packed.append(struct.pack("!H", self.partner_key))
5599 length = sum([len(x) for x in packed])
5600 packed[2] = struct.pack("!H", length)
5601 return ''.join(packed)
5602
5603 @staticmethod
5604 def unpack(reader):
5605 obj = bsn_lacp_convergence_notif()
5606 _version = reader.read("!B")[0]
5607 assert(_version == 5)
5608 _type = reader.read("!B")[0]
5609 assert(_type == 4)
5610 _length = reader.read("!H")[0]
5611 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005612 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005613 obj.xid = reader.read("!L")[0]
5614 _experimenter = reader.read("!L")[0]
5615 assert(_experimenter == 6035143)
5616 _subtype = reader.read("!L")[0]
5617 assert(_subtype == 43)
5618 obj.convergence_status = reader.read("!B")[0]
5619 reader.skip(3)
5620 obj.port_no = util.unpack_port_no(reader)
5621 obj.actor_sys_priority = reader.read("!H")[0]
5622 obj.actor_sys_mac = list(reader.read('!6B'))
5623 obj.actor_port_priority = reader.read("!H")[0]
5624 obj.actor_port_num = reader.read("!H")[0]
5625 obj.actor_key = reader.read("!H")[0]
5626 obj.partner_sys_priority = reader.read("!H")[0]
5627 obj.partner_sys_mac = list(reader.read('!6B'))
5628 obj.partner_port_priority = reader.read("!H")[0]
5629 obj.partner_port_num = reader.read("!H")[0]
5630 obj.partner_key = reader.read("!H")[0]
5631 return obj
5632
5633 def __eq__(self, other):
5634 if type(self) != type(other): return False
5635 if self.xid != other.xid: return False
5636 if self.convergence_status != other.convergence_status: return False
5637 if self.port_no != other.port_no: return False
5638 if self.actor_sys_priority != other.actor_sys_priority: return False
5639 if self.actor_sys_mac != other.actor_sys_mac: return False
5640 if self.actor_port_priority != other.actor_port_priority: return False
5641 if self.actor_port_num != other.actor_port_num: return False
5642 if self.actor_key != other.actor_key: return False
5643 if self.partner_sys_priority != other.partner_sys_priority: return False
5644 if self.partner_sys_mac != other.partner_sys_mac: return False
5645 if self.partner_port_priority != other.partner_port_priority: return False
5646 if self.partner_port_num != other.partner_port_num: return False
5647 if self.partner_key != other.partner_key: return False
5648 return True
5649
5650 def pretty_print(self, q):
5651 q.text("bsn_lacp_convergence_notif {")
5652 with q.group():
5653 with q.indent(2):
5654 q.breakable()
5655 q.text("xid = ");
5656 if self.xid != None:
5657 q.text("%#x" % self.xid)
5658 else:
5659 q.text('None')
5660 q.text(","); q.breakable()
5661 q.text("convergence_status = ");
5662 q.text("%#x" % self.convergence_status)
5663 q.text(","); q.breakable()
5664 q.text("port_no = ");
5665 q.text(util.pretty_port(self.port_no))
5666 q.text(","); q.breakable()
5667 q.text("actor_sys_priority = ");
5668 q.text("%#x" % self.actor_sys_priority)
5669 q.text(","); q.breakable()
5670 q.text("actor_sys_mac = ");
5671 q.text(util.pretty_mac(self.actor_sys_mac))
5672 q.text(","); q.breakable()
5673 q.text("actor_port_priority = ");
5674 q.text("%#x" % self.actor_port_priority)
5675 q.text(","); q.breakable()
5676 q.text("actor_port_num = ");
5677 q.text("%#x" % self.actor_port_num)
5678 q.text(","); q.breakable()
5679 q.text("actor_key = ");
5680 q.text("%#x" % self.actor_key)
5681 q.text(","); q.breakable()
5682 q.text("partner_sys_priority = ");
5683 q.text("%#x" % self.partner_sys_priority)
5684 q.text(","); q.breakable()
5685 q.text("partner_sys_mac = ");
5686 q.text(util.pretty_mac(self.partner_sys_mac))
5687 q.text(","); q.breakable()
5688 q.text("partner_port_priority = ");
5689 q.text("%#x" % self.partner_port_priority)
5690 q.text(","); q.breakable()
5691 q.text("partner_port_num = ");
5692 q.text("%#x" % self.partner_port_num)
5693 q.text(","); q.breakable()
5694 q.text("partner_key = ");
5695 q.text("%#x" % self.partner_key)
5696 q.breakable()
5697 q.text('}')
5698
5699bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5700
5701class bsn_lacp_stats_reply(bsn_stats_reply):
5702 version = 5
5703 type = 19
5704 stats_type = 65535
5705 experimenter = 6035143
5706 subtype = 1
5707
5708 def __init__(self, xid=None, flags=None, entries=None):
5709 if xid != None:
5710 self.xid = xid
5711 else:
5712 self.xid = None
5713 if flags != None:
5714 self.flags = flags
5715 else:
5716 self.flags = 0
5717 if entries != None:
5718 self.entries = entries
5719 else:
5720 self.entries = []
5721 return
5722
5723 def pack(self):
5724 packed = []
5725 packed.append(struct.pack("!B", self.version))
5726 packed.append(struct.pack("!B", self.type))
5727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5728 packed.append(struct.pack("!L", self.xid))
5729 packed.append(struct.pack("!H", self.stats_type))
5730 packed.append(struct.pack("!H", self.flags))
5731 packed.append('\x00' * 4)
5732 packed.append(struct.pack("!L", self.experimenter))
5733 packed.append(struct.pack("!L", self.subtype))
5734 packed.append(loxi.generic_util.pack_list(self.entries))
5735 length = sum([len(x) for x in packed])
5736 packed[2] = struct.pack("!H", length)
5737 return ''.join(packed)
5738
5739 @staticmethod
5740 def unpack(reader):
5741 obj = bsn_lacp_stats_reply()
5742 _version = reader.read("!B")[0]
5743 assert(_version == 5)
5744 _type = reader.read("!B")[0]
5745 assert(_type == 19)
5746 _length = reader.read("!H")[0]
5747 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005748 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005749 obj.xid = reader.read("!L")[0]
5750 _stats_type = reader.read("!H")[0]
5751 assert(_stats_type == 65535)
5752 obj.flags = reader.read("!H")[0]
5753 reader.skip(4)
5754 _experimenter = reader.read("!L")[0]
5755 assert(_experimenter == 6035143)
5756 _subtype = reader.read("!L")[0]
5757 assert(_subtype == 1)
Rich Lanee2567702015-01-26 15:04:35 -08005758 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08005759 return obj
5760
5761 def __eq__(self, other):
5762 if type(self) != type(other): return False
5763 if self.xid != other.xid: return False
5764 if self.flags != other.flags: return False
5765 if self.entries != other.entries: return False
5766 return True
5767
5768 def pretty_print(self, q):
5769 q.text("bsn_lacp_stats_reply {")
5770 with q.group():
5771 with q.indent(2):
5772 q.breakable()
5773 q.text("xid = ");
5774 if self.xid != None:
5775 q.text("%#x" % self.xid)
5776 else:
5777 q.text('None')
5778 q.text(","); q.breakable()
5779 q.text("flags = ");
5780 q.text("%#x" % self.flags)
5781 q.text(","); q.breakable()
5782 q.text("entries = ");
5783 q.pp(self.entries)
5784 q.breakable()
5785 q.text('}')
5786
5787bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5788
5789class bsn_lacp_stats_request(bsn_stats_request):
5790 version = 5
5791 type = 18
5792 stats_type = 65535
5793 experimenter = 6035143
5794 subtype = 1
5795
5796 def __init__(self, xid=None, flags=None):
5797 if xid != None:
5798 self.xid = xid
5799 else:
5800 self.xid = None
5801 if flags != None:
5802 self.flags = flags
5803 else:
5804 self.flags = 0
5805 return
5806
5807 def pack(self):
5808 packed = []
5809 packed.append(struct.pack("!B", self.version))
5810 packed.append(struct.pack("!B", self.type))
5811 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5812 packed.append(struct.pack("!L", self.xid))
5813 packed.append(struct.pack("!H", self.stats_type))
5814 packed.append(struct.pack("!H", self.flags))
5815 packed.append('\x00' * 4)
5816 packed.append(struct.pack("!L", self.experimenter))
5817 packed.append(struct.pack("!L", self.subtype))
5818 length = sum([len(x) for x in packed])
5819 packed[2] = struct.pack("!H", length)
5820 return ''.join(packed)
5821
5822 @staticmethod
5823 def unpack(reader):
5824 obj = bsn_lacp_stats_request()
5825 _version = reader.read("!B")[0]
5826 assert(_version == 5)
5827 _type = reader.read("!B")[0]
5828 assert(_type == 18)
5829 _length = reader.read("!H")[0]
5830 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005831 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005832 obj.xid = reader.read("!L")[0]
5833 _stats_type = reader.read("!H")[0]
5834 assert(_stats_type == 65535)
5835 obj.flags = reader.read("!H")[0]
5836 reader.skip(4)
5837 _experimenter = reader.read("!L")[0]
5838 assert(_experimenter == 6035143)
5839 _subtype = reader.read("!L")[0]
5840 assert(_subtype == 1)
5841 return obj
5842
5843 def __eq__(self, other):
5844 if type(self) != type(other): return False
5845 if self.xid != other.xid: return False
5846 if self.flags != other.flags: return False
5847 return True
5848
5849 def pretty_print(self, q):
5850 q.text("bsn_lacp_stats_request {")
5851 with q.group():
5852 with q.indent(2):
5853 q.breakable()
5854 q.text("xid = ");
5855 if self.xid != None:
5856 q.text("%#x" % self.xid)
5857 else:
5858 q.text('None')
5859 q.text(","); q.breakable()
5860 q.text("flags = ");
5861 q.text("%#x" % self.flags)
5862 q.breakable()
5863 q.text('}')
5864
5865bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5866
5867class bsn_log(bsn_header):
5868 version = 5
5869 type = 4
5870 experimenter = 6035143
5871 subtype = 63
5872
5873 def __init__(self, xid=None, loglevel=None, data=None):
5874 if xid != None:
5875 self.xid = xid
5876 else:
5877 self.xid = None
5878 if loglevel != None:
5879 self.loglevel = loglevel
5880 else:
5881 self.loglevel = 0
5882 if data != None:
5883 self.data = data
5884 else:
5885 self.data = ''
5886 return
5887
5888 def pack(self):
5889 packed = []
5890 packed.append(struct.pack("!B", self.version))
5891 packed.append(struct.pack("!B", self.type))
5892 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5893 packed.append(struct.pack("!L", self.xid))
5894 packed.append(struct.pack("!L", self.experimenter))
5895 packed.append(struct.pack("!L", self.subtype))
5896 packed.append(struct.pack("!B", self.loglevel))
5897 packed.append(self.data)
5898 length = sum([len(x) for x in packed])
5899 packed[2] = struct.pack("!H", length)
5900 return ''.join(packed)
5901
5902 @staticmethod
5903 def unpack(reader):
5904 obj = bsn_log()
5905 _version = reader.read("!B")[0]
5906 assert(_version == 5)
5907 _type = reader.read("!B")[0]
5908 assert(_type == 4)
5909 _length = reader.read("!H")[0]
5910 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005911 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08005912 obj.xid = reader.read("!L")[0]
5913 _experimenter = reader.read("!L")[0]
5914 assert(_experimenter == 6035143)
5915 _subtype = reader.read("!L")[0]
5916 assert(_subtype == 63)
5917 obj.loglevel = reader.read("!B")[0]
5918 obj.data = str(reader.read_all())
5919 return obj
5920
5921 def __eq__(self, other):
5922 if type(self) != type(other): return False
5923 if self.xid != other.xid: return False
5924 if self.loglevel != other.loglevel: return False
5925 if self.data != other.data: return False
5926 return True
5927
5928 def pretty_print(self, q):
5929 q.text("bsn_log {")
5930 with q.group():
5931 with q.indent(2):
5932 q.breakable()
5933 q.text("xid = ");
5934 if self.xid != None:
5935 q.text("%#x" % self.xid)
5936 else:
5937 q.text('None')
5938 q.text(","); q.breakable()
5939 q.text("loglevel = ");
5940 q.text("%#x" % self.loglevel)
5941 q.text(","); q.breakable()
5942 q.text("data = ");
5943 q.pp(self.data)
5944 q.breakable()
5945 q.text('}')
5946
5947bsn_header.subtypes[63] = bsn_log
5948
Rich Lane474324f2015-01-14 15:22:56 -08005949class bsn_lua_command_reply(bsn_header):
5950 version = 5
5951 type = 4
5952 experimenter = 6035143
5953 subtype = 66
5954
5955 def __init__(self, xid=None, data=None):
5956 if xid != None:
5957 self.xid = xid
5958 else:
5959 self.xid = None
5960 if data != None:
5961 self.data = data
5962 else:
5963 self.data = ''
5964 return
5965
5966 def pack(self):
5967 packed = []
5968 packed.append(struct.pack("!B", self.version))
5969 packed.append(struct.pack("!B", self.type))
5970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5971 packed.append(struct.pack("!L", self.xid))
5972 packed.append(struct.pack("!L", self.experimenter))
5973 packed.append(struct.pack("!L", self.subtype))
5974 packed.append(self.data)
5975 length = sum([len(x) for x in packed])
5976 packed[2] = struct.pack("!H", length)
5977 return ''.join(packed)
5978
5979 @staticmethod
5980 def unpack(reader):
5981 obj = bsn_lua_command_reply()
5982 _version = reader.read("!B")[0]
5983 assert(_version == 5)
5984 _type = reader.read("!B")[0]
5985 assert(_type == 4)
5986 _length = reader.read("!H")[0]
5987 orig_reader = reader
5988 reader = orig_reader.slice(_length, 4)
5989 obj.xid = reader.read("!L")[0]
5990 _experimenter = reader.read("!L")[0]
5991 assert(_experimenter == 6035143)
5992 _subtype = reader.read("!L")[0]
5993 assert(_subtype == 66)
5994 obj.data = str(reader.read_all())
5995 return obj
5996
5997 def __eq__(self, other):
5998 if type(self) != type(other): return False
5999 if self.xid != other.xid: return False
6000 if self.data != other.data: return False
6001 return True
6002
6003 def pretty_print(self, q):
6004 q.text("bsn_lua_command_reply {")
6005 with q.group():
6006 with q.indent(2):
6007 q.breakable()
6008 q.text("xid = ");
6009 if self.xid != None:
6010 q.text("%#x" % self.xid)
6011 else:
6012 q.text('None')
6013 q.text(","); q.breakable()
6014 q.text("data = ");
6015 q.pp(self.data)
6016 q.breakable()
6017 q.text('}')
6018
6019bsn_header.subtypes[66] = bsn_lua_command_reply
6020
6021class bsn_lua_command_request(bsn_header):
6022 version = 5
6023 type = 4
6024 experimenter = 6035143
6025 subtype = 65
6026
6027 def __init__(self, xid=None, data=None):
6028 if xid != None:
6029 self.xid = xid
6030 else:
6031 self.xid = None
6032 if data != None:
6033 self.data = data
6034 else:
6035 self.data = ''
6036 return
6037
6038 def pack(self):
6039 packed = []
6040 packed.append(struct.pack("!B", self.version))
6041 packed.append(struct.pack("!B", self.type))
6042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6043 packed.append(struct.pack("!L", self.xid))
6044 packed.append(struct.pack("!L", self.experimenter))
6045 packed.append(struct.pack("!L", self.subtype))
6046 packed.append(self.data)
6047 length = sum([len(x) for x in packed])
6048 packed[2] = struct.pack("!H", length)
6049 return ''.join(packed)
6050
6051 @staticmethod
6052 def unpack(reader):
6053 obj = bsn_lua_command_request()
6054 _version = reader.read("!B")[0]
6055 assert(_version == 5)
6056 _type = reader.read("!B")[0]
6057 assert(_type == 4)
6058 _length = reader.read("!H")[0]
6059 orig_reader = reader
6060 reader = orig_reader.slice(_length, 4)
6061 obj.xid = reader.read("!L")[0]
6062 _experimenter = reader.read("!L")[0]
6063 assert(_experimenter == 6035143)
6064 _subtype = reader.read("!L")[0]
6065 assert(_subtype == 65)
6066 obj.data = str(reader.read_all())
6067 return obj
6068
6069 def __eq__(self, other):
6070 if type(self) != type(other): return False
6071 if self.xid != other.xid: return False
6072 if self.data != other.data: return False
6073 return True
6074
6075 def pretty_print(self, q):
6076 q.text("bsn_lua_command_request {")
6077 with q.group():
6078 with q.indent(2):
6079 q.breakable()
6080 q.text("xid = ");
6081 if self.xid != None:
6082 q.text("%#x" % self.xid)
6083 else:
6084 q.text('None')
6085 q.text(","); q.breakable()
6086 q.text("data = ");
6087 q.pp(self.data)
6088 q.breakable()
6089 q.text('}')
6090
6091bsn_header.subtypes[65] = bsn_lua_command_request
6092
6093class bsn_lua_notification(bsn_header):
6094 version = 5
6095 type = 4
6096 experimenter = 6035143
6097 subtype = 67
6098
6099 def __init__(self, xid=None, data=None):
6100 if xid != None:
6101 self.xid = xid
6102 else:
6103 self.xid = None
6104 if data != None:
6105 self.data = data
6106 else:
6107 self.data = ''
6108 return
6109
6110 def pack(self):
6111 packed = []
6112 packed.append(struct.pack("!B", self.version))
6113 packed.append(struct.pack("!B", self.type))
6114 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6115 packed.append(struct.pack("!L", self.xid))
6116 packed.append(struct.pack("!L", self.experimenter))
6117 packed.append(struct.pack("!L", self.subtype))
6118 packed.append(self.data)
6119 length = sum([len(x) for x in packed])
6120 packed[2] = struct.pack("!H", length)
6121 return ''.join(packed)
6122
6123 @staticmethod
6124 def unpack(reader):
6125 obj = bsn_lua_notification()
6126 _version = reader.read("!B")[0]
6127 assert(_version == 5)
6128 _type = reader.read("!B")[0]
6129 assert(_type == 4)
6130 _length = reader.read("!H")[0]
6131 orig_reader = reader
6132 reader = orig_reader.slice(_length, 4)
6133 obj.xid = reader.read("!L")[0]
6134 _experimenter = reader.read("!L")[0]
6135 assert(_experimenter == 6035143)
6136 _subtype = reader.read("!L")[0]
6137 assert(_subtype == 67)
6138 obj.data = str(reader.read_all())
6139 return obj
6140
6141 def __eq__(self, other):
6142 if type(self) != type(other): return False
6143 if self.xid != other.xid: return False
6144 if self.data != other.data: return False
6145 return True
6146
6147 def pretty_print(self, q):
6148 q.text("bsn_lua_notification {")
6149 with q.group():
6150 with q.indent(2):
6151 q.breakable()
6152 q.text("xid = ");
6153 if self.xid != None:
6154 q.text("%#x" % self.xid)
6155 else:
6156 q.text('None')
6157 q.text(","); q.breakable()
6158 q.text("data = ");
6159 q.pp(self.data)
6160 q.breakable()
6161 q.text('}')
6162
6163bsn_header.subtypes[67] = bsn_lua_notification
6164
6165class bsn_lua_upload(bsn_header):
6166 version = 5
6167 type = 4
6168 experimenter = 6035143
6169 subtype = 64
6170
6171 def __init__(self, xid=None, flags=None, filename=None, data=None):
6172 if xid != None:
6173 self.xid = xid
6174 else:
6175 self.xid = None
6176 if flags != None:
6177 self.flags = flags
6178 else:
6179 self.flags = 0
6180 if filename != None:
6181 self.filename = filename
6182 else:
6183 self.filename = ""
6184 if data != None:
6185 self.data = data
6186 else:
6187 self.data = ''
6188 return
6189
6190 def pack(self):
6191 packed = []
6192 packed.append(struct.pack("!B", self.version))
6193 packed.append(struct.pack("!B", self.type))
6194 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6195 packed.append(struct.pack("!L", self.xid))
6196 packed.append(struct.pack("!L", self.experimenter))
6197 packed.append(struct.pack("!L", self.subtype))
6198 packed.append(struct.pack("!H", self.flags))
6199 packed.append(struct.pack("!64s", self.filename))
6200 packed.append(self.data)
6201 length = sum([len(x) for x in packed])
6202 packed[2] = struct.pack("!H", length)
6203 return ''.join(packed)
6204
6205 @staticmethod
6206 def unpack(reader):
6207 obj = bsn_lua_upload()
6208 _version = reader.read("!B")[0]
6209 assert(_version == 5)
6210 _type = reader.read("!B")[0]
6211 assert(_type == 4)
6212 _length = reader.read("!H")[0]
6213 orig_reader = reader
6214 reader = orig_reader.slice(_length, 4)
6215 obj.xid = reader.read("!L")[0]
6216 _experimenter = reader.read("!L")[0]
6217 assert(_experimenter == 6035143)
6218 _subtype = reader.read("!L")[0]
6219 assert(_subtype == 64)
6220 obj.flags = reader.read("!H")[0]
6221 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6222 obj.data = str(reader.read_all())
6223 return obj
6224
6225 def __eq__(self, other):
6226 if type(self) != type(other): return False
6227 if self.xid != other.xid: return False
6228 if self.flags != other.flags: return False
6229 if self.filename != other.filename: return False
6230 if self.data != other.data: return False
6231 return True
6232
6233 def pretty_print(self, q):
6234 q.text("bsn_lua_upload {")
6235 with q.group():
6236 with q.indent(2):
6237 q.breakable()
6238 q.text("xid = ");
6239 if self.xid != None:
6240 q.text("%#x" % self.xid)
6241 else:
6242 q.text('None')
6243 q.text(","); q.breakable()
6244 q.text("flags = ");
6245 q.text("%#x" % self.flags)
6246 q.text(","); q.breakable()
6247 q.text("filename = ");
6248 q.pp(self.filename)
6249 q.text(","); q.breakable()
6250 q.text("data = ");
6251 q.pp(self.data)
6252 q.breakable()
6253 q.text('}')
6254
6255bsn_header.subtypes[64] = bsn_lua_upload
6256
Rich Lane2e079da2014-10-29 15:30:24 -07006257class bsn_pdu_rx_reply(bsn_header):
6258 version = 5
6259 type = 4
6260 experimenter = 6035143
6261 subtype = 34
6262
6263 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6264 if xid != None:
6265 self.xid = xid
6266 else:
6267 self.xid = None
6268 if status != None:
6269 self.status = status
6270 else:
6271 self.status = 0
6272 if port_no != None:
6273 self.port_no = port_no
6274 else:
6275 self.port_no = 0
6276 if slot_num != None:
6277 self.slot_num = slot_num
6278 else:
6279 self.slot_num = 0
6280 return
6281
6282 def pack(self):
6283 packed = []
6284 packed.append(struct.pack("!B", self.version))
6285 packed.append(struct.pack("!B", self.type))
6286 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6287 packed.append(struct.pack("!L", self.xid))
6288 packed.append(struct.pack("!L", self.experimenter))
6289 packed.append(struct.pack("!L", self.subtype))
6290 packed.append(struct.pack("!L", self.status))
6291 packed.append(util.pack_port_no(self.port_no))
6292 packed.append(struct.pack("!B", self.slot_num))
6293 length = sum([len(x) for x in packed])
6294 packed[2] = struct.pack("!H", length)
6295 return ''.join(packed)
6296
6297 @staticmethod
6298 def unpack(reader):
6299 obj = bsn_pdu_rx_reply()
6300 _version = reader.read("!B")[0]
6301 assert(_version == 5)
6302 _type = reader.read("!B")[0]
6303 assert(_type == 4)
6304 _length = reader.read("!H")[0]
6305 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006306 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006307 obj.xid = reader.read("!L")[0]
6308 _experimenter = reader.read("!L")[0]
6309 assert(_experimenter == 6035143)
6310 _subtype = reader.read("!L")[0]
6311 assert(_subtype == 34)
6312 obj.status = reader.read("!L")[0]
6313 obj.port_no = util.unpack_port_no(reader)
6314 obj.slot_num = reader.read("!B")[0]
6315 return obj
6316
6317 def __eq__(self, other):
6318 if type(self) != type(other): return False
6319 if self.xid != other.xid: return False
6320 if self.status != other.status: return False
6321 if self.port_no != other.port_no: return False
6322 if self.slot_num != other.slot_num: return False
6323 return True
6324
6325 def pretty_print(self, q):
6326 q.text("bsn_pdu_rx_reply {")
6327 with q.group():
6328 with q.indent(2):
6329 q.breakable()
6330 q.text("xid = ");
6331 if self.xid != None:
6332 q.text("%#x" % self.xid)
6333 else:
6334 q.text('None')
6335 q.text(","); q.breakable()
6336 q.text("status = ");
6337 q.text("%#x" % self.status)
6338 q.text(","); q.breakable()
6339 q.text("port_no = ");
6340 q.text(util.pretty_port(self.port_no))
6341 q.text(","); q.breakable()
6342 q.text("slot_num = ");
6343 q.text("%#x" % self.slot_num)
6344 q.breakable()
6345 q.text('}')
6346
6347bsn_header.subtypes[34] = bsn_pdu_rx_reply
6348
6349class bsn_pdu_rx_request(bsn_header):
6350 version = 5
6351 type = 4
6352 experimenter = 6035143
6353 subtype = 33
6354
6355 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
6356 if xid != None:
6357 self.xid = xid
6358 else:
6359 self.xid = None
6360 if timeout_ms != None:
6361 self.timeout_ms = timeout_ms
6362 else:
6363 self.timeout_ms = 0
6364 if port_no != None:
6365 self.port_no = port_no
6366 else:
6367 self.port_no = 0
6368 if slot_num != None:
6369 self.slot_num = slot_num
6370 else:
6371 self.slot_num = 0
6372 if data != None:
6373 self.data = data
6374 else:
6375 self.data = ''
6376 return
6377
6378 def pack(self):
6379 packed = []
6380 packed.append(struct.pack("!B", self.version))
6381 packed.append(struct.pack("!B", self.type))
6382 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6383 packed.append(struct.pack("!L", self.xid))
6384 packed.append(struct.pack("!L", self.experimenter))
6385 packed.append(struct.pack("!L", self.subtype))
6386 packed.append(struct.pack("!L", self.timeout_ms))
6387 packed.append(util.pack_port_no(self.port_no))
6388 packed.append(struct.pack("!B", self.slot_num))
6389 packed.append('\x00' * 3)
6390 packed.append(self.data)
6391 length = sum([len(x) for x in packed])
6392 packed[2] = struct.pack("!H", length)
6393 return ''.join(packed)
6394
6395 @staticmethod
6396 def unpack(reader):
6397 obj = bsn_pdu_rx_request()
6398 _version = reader.read("!B")[0]
6399 assert(_version == 5)
6400 _type = reader.read("!B")[0]
6401 assert(_type == 4)
6402 _length = reader.read("!H")[0]
6403 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006404 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006405 obj.xid = reader.read("!L")[0]
6406 _experimenter = reader.read("!L")[0]
6407 assert(_experimenter == 6035143)
6408 _subtype = reader.read("!L")[0]
6409 assert(_subtype == 33)
6410 obj.timeout_ms = reader.read("!L")[0]
6411 obj.port_no = util.unpack_port_no(reader)
6412 obj.slot_num = reader.read("!B")[0]
6413 reader.skip(3)
6414 obj.data = str(reader.read_all())
6415 return obj
6416
6417 def __eq__(self, other):
6418 if type(self) != type(other): return False
6419 if self.xid != other.xid: return False
6420 if self.timeout_ms != other.timeout_ms: return False
6421 if self.port_no != other.port_no: return False
6422 if self.slot_num != other.slot_num: return False
6423 if self.data != other.data: return False
6424 return True
6425
6426 def pretty_print(self, q):
6427 q.text("bsn_pdu_rx_request {")
6428 with q.group():
6429 with q.indent(2):
6430 q.breakable()
6431 q.text("xid = ");
6432 if self.xid != None:
6433 q.text("%#x" % self.xid)
6434 else:
6435 q.text('None')
6436 q.text(","); q.breakable()
6437 q.text("timeout_ms = ");
6438 q.text("%#x" % self.timeout_ms)
6439 q.text(","); q.breakable()
6440 q.text("port_no = ");
6441 q.text(util.pretty_port(self.port_no))
6442 q.text(","); q.breakable()
6443 q.text("slot_num = ");
6444 q.text("%#x" % self.slot_num)
6445 q.text(","); q.breakable()
6446 q.text("data = ");
6447 q.pp(self.data)
6448 q.breakable()
6449 q.text('}')
6450
6451bsn_header.subtypes[33] = bsn_pdu_rx_request
6452
6453class bsn_pdu_rx_timeout(bsn_header):
6454 version = 5
6455 type = 4
6456 experimenter = 6035143
6457 subtype = 35
6458
6459 def __init__(self, xid=None, port_no=None, slot_num=None):
6460 if xid != None:
6461 self.xid = xid
6462 else:
6463 self.xid = None
6464 if port_no != None:
6465 self.port_no = port_no
6466 else:
6467 self.port_no = 0
6468 if slot_num != None:
6469 self.slot_num = slot_num
6470 else:
6471 self.slot_num = 0
6472 return
6473
6474 def pack(self):
6475 packed = []
6476 packed.append(struct.pack("!B", self.version))
6477 packed.append(struct.pack("!B", self.type))
6478 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6479 packed.append(struct.pack("!L", self.xid))
6480 packed.append(struct.pack("!L", self.experimenter))
6481 packed.append(struct.pack("!L", self.subtype))
6482 packed.append(util.pack_port_no(self.port_no))
6483 packed.append(struct.pack("!B", self.slot_num))
6484 length = sum([len(x) for x in packed])
6485 packed[2] = struct.pack("!H", length)
6486 return ''.join(packed)
6487
6488 @staticmethod
6489 def unpack(reader):
6490 obj = bsn_pdu_rx_timeout()
6491 _version = reader.read("!B")[0]
6492 assert(_version == 5)
6493 _type = reader.read("!B")[0]
6494 assert(_type == 4)
6495 _length = reader.read("!H")[0]
6496 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006497 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006498 obj.xid = reader.read("!L")[0]
6499 _experimenter = reader.read("!L")[0]
6500 assert(_experimenter == 6035143)
6501 _subtype = reader.read("!L")[0]
6502 assert(_subtype == 35)
6503 obj.port_no = util.unpack_port_no(reader)
6504 obj.slot_num = reader.read("!B")[0]
6505 return obj
6506
6507 def __eq__(self, other):
6508 if type(self) != type(other): return False
6509 if self.xid != other.xid: return False
6510 if self.port_no != other.port_no: return False
6511 if self.slot_num != other.slot_num: return False
6512 return True
6513
6514 def pretty_print(self, q):
6515 q.text("bsn_pdu_rx_timeout {")
6516 with q.group():
6517 with q.indent(2):
6518 q.breakable()
6519 q.text("xid = ");
6520 if self.xid != None:
6521 q.text("%#x" % self.xid)
6522 else:
6523 q.text('None')
6524 q.text(","); q.breakable()
6525 q.text("port_no = ");
6526 q.text(util.pretty_port(self.port_no))
6527 q.text(","); q.breakable()
6528 q.text("slot_num = ");
6529 q.text("%#x" % self.slot_num)
6530 q.breakable()
6531 q.text('}')
6532
6533bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6534
6535class bsn_pdu_tx_reply(bsn_header):
6536 version = 5
6537 type = 4
6538 experimenter = 6035143
6539 subtype = 32
6540
6541 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6542 if xid != None:
6543 self.xid = xid
6544 else:
6545 self.xid = None
6546 if status != None:
6547 self.status = status
6548 else:
6549 self.status = 0
6550 if port_no != None:
6551 self.port_no = port_no
6552 else:
6553 self.port_no = 0
6554 if slot_num != None:
6555 self.slot_num = slot_num
6556 else:
6557 self.slot_num = 0
6558 return
6559
6560 def pack(self):
6561 packed = []
6562 packed.append(struct.pack("!B", self.version))
6563 packed.append(struct.pack("!B", self.type))
6564 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6565 packed.append(struct.pack("!L", self.xid))
6566 packed.append(struct.pack("!L", self.experimenter))
6567 packed.append(struct.pack("!L", self.subtype))
6568 packed.append(struct.pack("!L", self.status))
6569 packed.append(util.pack_port_no(self.port_no))
6570 packed.append(struct.pack("!B", self.slot_num))
6571 length = sum([len(x) for x in packed])
6572 packed[2] = struct.pack("!H", length)
6573 return ''.join(packed)
6574
6575 @staticmethod
6576 def unpack(reader):
6577 obj = bsn_pdu_tx_reply()
6578 _version = reader.read("!B")[0]
6579 assert(_version == 5)
6580 _type = reader.read("!B")[0]
6581 assert(_type == 4)
6582 _length = reader.read("!H")[0]
6583 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006584 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006585 obj.xid = reader.read("!L")[0]
6586 _experimenter = reader.read("!L")[0]
6587 assert(_experimenter == 6035143)
6588 _subtype = reader.read("!L")[0]
6589 assert(_subtype == 32)
6590 obj.status = reader.read("!L")[0]
6591 obj.port_no = util.unpack_port_no(reader)
6592 obj.slot_num = reader.read("!B")[0]
6593 return obj
6594
6595 def __eq__(self, other):
6596 if type(self) != type(other): return False
6597 if self.xid != other.xid: return False
6598 if self.status != other.status: return False
6599 if self.port_no != other.port_no: return False
6600 if self.slot_num != other.slot_num: return False
6601 return True
6602
6603 def pretty_print(self, q):
6604 q.text("bsn_pdu_tx_reply {")
6605 with q.group():
6606 with q.indent(2):
6607 q.breakable()
6608 q.text("xid = ");
6609 if self.xid != None:
6610 q.text("%#x" % self.xid)
6611 else:
6612 q.text('None')
6613 q.text(","); q.breakable()
6614 q.text("status = ");
6615 q.text("%#x" % self.status)
6616 q.text(","); q.breakable()
6617 q.text("port_no = ");
6618 q.text(util.pretty_port(self.port_no))
6619 q.text(","); q.breakable()
6620 q.text("slot_num = ");
6621 q.text("%#x" % self.slot_num)
6622 q.breakable()
6623 q.text('}')
6624
6625bsn_header.subtypes[32] = bsn_pdu_tx_reply
6626
6627class bsn_pdu_tx_request(bsn_header):
6628 version = 5
6629 type = 4
6630 experimenter = 6035143
6631 subtype = 31
6632
6633 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
6634 if xid != None:
6635 self.xid = xid
6636 else:
6637 self.xid = None
6638 if tx_interval_ms != None:
6639 self.tx_interval_ms = tx_interval_ms
6640 else:
6641 self.tx_interval_ms = 0
6642 if port_no != None:
6643 self.port_no = port_no
6644 else:
6645 self.port_no = 0
6646 if slot_num != None:
6647 self.slot_num = slot_num
6648 else:
6649 self.slot_num = 0
6650 if data != None:
6651 self.data = data
6652 else:
6653 self.data = ''
6654 return
6655
6656 def pack(self):
6657 packed = []
6658 packed.append(struct.pack("!B", self.version))
6659 packed.append(struct.pack("!B", self.type))
6660 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6661 packed.append(struct.pack("!L", self.xid))
6662 packed.append(struct.pack("!L", self.experimenter))
6663 packed.append(struct.pack("!L", self.subtype))
6664 packed.append(struct.pack("!L", self.tx_interval_ms))
6665 packed.append(util.pack_port_no(self.port_no))
6666 packed.append(struct.pack("!B", self.slot_num))
6667 packed.append('\x00' * 3)
6668 packed.append(self.data)
6669 length = sum([len(x) for x in packed])
6670 packed[2] = struct.pack("!H", length)
6671 return ''.join(packed)
6672
6673 @staticmethod
6674 def unpack(reader):
6675 obj = bsn_pdu_tx_request()
6676 _version = reader.read("!B")[0]
6677 assert(_version == 5)
6678 _type = reader.read("!B")[0]
6679 assert(_type == 4)
6680 _length = reader.read("!H")[0]
6681 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006682 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07006683 obj.xid = reader.read("!L")[0]
6684 _experimenter = reader.read("!L")[0]
6685 assert(_experimenter == 6035143)
6686 _subtype = reader.read("!L")[0]
6687 assert(_subtype == 31)
6688 obj.tx_interval_ms = reader.read("!L")[0]
6689 obj.port_no = util.unpack_port_no(reader)
6690 obj.slot_num = reader.read("!B")[0]
6691 reader.skip(3)
6692 obj.data = str(reader.read_all())
6693 return obj
6694
6695 def __eq__(self, other):
6696 if type(self) != type(other): return False
6697 if self.xid != other.xid: return False
6698 if self.tx_interval_ms != other.tx_interval_ms: return False
6699 if self.port_no != other.port_no: return False
6700 if self.slot_num != other.slot_num: return False
6701 if self.data != other.data: return False
6702 return True
6703
6704 def pretty_print(self, q):
6705 q.text("bsn_pdu_tx_request {")
6706 with q.group():
6707 with q.indent(2):
6708 q.breakable()
6709 q.text("xid = ");
6710 if self.xid != None:
6711 q.text("%#x" % self.xid)
6712 else:
6713 q.text('None')
6714 q.text(","); q.breakable()
6715 q.text("tx_interval_ms = ");
6716 q.text("%#x" % self.tx_interval_ms)
6717 q.text(","); q.breakable()
6718 q.text("port_no = ");
6719 q.text(util.pretty_port(self.port_no))
6720 q.text(","); q.breakable()
6721 q.text("slot_num = ");
6722 q.text("%#x" % self.slot_num)
6723 q.text(","); q.breakable()
6724 q.text("data = ");
6725 q.pp(self.data)
6726 q.breakable()
6727 q.text('}')
6728
6729bsn_header.subtypes[31] = bsn_pdu_tx_request
6730
Rich Laneccd32ed2014-11-10 17:48:24 -08006731class bsn_port_counter_stats_reply(bsn_stats_reply):
6732 version = 5
6733 type = 19
6734 stats_type = 65535
6735 experimenter = 6035143
6736 subtype = 8
6737
6738 def __init__(self, xid=None, flags=None, entries=None):
6739 if xid != None:
6740 self.xid = xid
6741 else:
6742 self.xid = None
6743 if flags != None:
6744 self.flags = flags
6745 else:
6746 self.flags = 0
6747 if entries != None:
6748 self.entries = entries
6749 else:
6750 self.entries = []
6751 return
6752
6753 def pack(self):
6754 packed = []
6755 packed.append(struct.pack("!B", self.version))
6756 packed.append(struct.pack("!B", self.type))
6757 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6758 packed.append(struct.pack("!L", self.xid))
6759 packed.append(struct.pack("!H", self.stats_type))
6760 packed.append(struct.pack("!H", self.flags))
6761 packed.append('\x00' * 4)
6762 packed.append(struct.pack("!L", self.experimenter))
6763 packed.append(struct.pack("!L", self.subtype))
6764 packed.append(loxi.generic_util.pack_list(self.entries))
6765 length = sum([len(x) for x in packed])
6766 packed[2] = struct.pack("!H", length)
6767 return ''.join(packed)
6768
6769 @staticmethod
6770 def unpack(reader):
6771 obj = bsn_port_counter_stats_reply()
6772 _version = reader.read("!B")[0]
6773 assert(_version == 5)
6774 _type = reader.read("!B")[0]
6775 assert(_type == 19)
6776 _length = reader.read("!H")[0]
6777 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006778 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006779 obj.xid = reader.read("!L")[0]
6780 _stats_type = reader.read("!H")[0]
6781 assert(_stats_type == 65535)
6782 obj.flags = reader.read("!H")[0]
6783 reader.skip(4)
6784 _experimenter = reader.read("!L")[0]
6785 assert(_experimenter == 6035143)
6786 _subtype = reader.read("!L")[0]
6787 assert(_subtype == 8)
Rich Lanee2567702015-01-26 15:04:35 -08006788 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08006789 return obj
6790
6791 def __eq__(self, other):
6792 if type(self) != type(other): return False
6793 if self.xid != other.xid: return False
6794 if self.flags != other.flags: return False
6795 if self.entries != other.entries: return False
6796 return True
6797
6798 def pretty_print(self, q):
6799 q.text("bsn_port_counter_stats_reply {")
6800 with q.group():
6801 with q.indent(2):
6802 q.breakable()
6803 q.text("xid = ");
6804 if self.xid != None:
6805 q.text("%#x" % self.xid)
6806 else:
6807 q.text('None')
6808 q.text(","); q.breakable()
6809 q.text("flags = ");
6810 q.text("%#x" % self.flags)
6811 q.text(","); q.breakable()
6812 q.text("entries = ");
6813 q.pp(self.entries)
6814 q.breakable()
6815 q.text('}')
6816
6817bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6818
6819class bsn_port_counter_stats_request(bsn_stats_request):
6820 version = 5
6821 type = 18
6822 stats_type = 65535
6823 experimenter = 6035143
6824 subtype = 8
6825
6826 def __init__(self, xid=None, flags=None, port_no=None):
6827 if xid != None:
6828 self.xid = xid
6829 else:
6830 self.xid = None
6831 if flags != None:
6832 self.flags = flags
6833 else:
6834 self.flags = 0
6835 if port_no != None:
6836 self.port_no = port_no
6837 else:
6838 self.port_no = 0
6839 return
6840
6841 def pack(self):
6842 packed = []
6843 packed.append(struct.pack("!B", self.version))
6844 packed.append(struct.pack("!B", self.type))
6845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6846 packed.append(struct.pack("!L", self.xid))
6847 packed.append(struct.pack("!H", self.stats_type))
6848 packed.append(struct.pack("!H", self.flags))
6849 packed.append('\x00' * 4)
6850 packed.append(struct.pack("!L", self.experimenter))
6851 packed.append(struct.pack("!L", self.subtype))
6852 packed.append(util.pack_port_no(self.port_no))
6853 length = sum([len(x) for x in packed])
6854 packed[2] = struct.pack("!H", length)
6855 return ''.join(packed)
6856
6857 @staticmethod
6858 def unpack(reader):
6859 obj = bsn_port_counter_stats_request()
6860 _version = reader.read("!B")[0]
6861 assert(_version == 5)
6862 _type = reader.read("!B")[0]
6863 assert(_type == 18)
6864 _length = reader.read("!H")[0]
6865 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006866 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006867 obj.xid = reader.read("!L")[0]
6868 _stats_type = reader.read("!H")[0]
6869 assert(_stats_type == 65535)
6870 obj.flags = reader.read("!H")[0]
6871 reader.skip(4)
6872 _experimenter = reader.read("!L")[0]
6873 assert(_experimenter == 6035143)
6874 _subtype = reader.read("!L")[0]
6875 assert(_subtype == 8)
6876 obj.port_no = util.unpack_port_no(reader)
6877 return obj
6878
6879 def __eq__(self, other):
6880 if type(self) != type(other): return False
6881 if self.xid != other.xid: return False
6882 if self.flags != other.flags: return False
6883 if self.port_no != other.port_no: return False
6884 return True
6885
6886 def pretty_print(self, q):
6887 q.text("bsn_port_counter_stats_request {")
6888 with q.group():
6889 with q.indent(2):
6890 q.breakable()
6891 q.text("xid = ");
6892 if self.xid != None:
6893 q.text("%#x" % self.xid)
6894 else:
6895 q.text('None')
6896 q.text(","); q.breakable()
6897 q.text("flags = ");
6898 q.text("%#x" % self.flags)
6899 q.text(","); q.breakable()
6900 q.text("port_no = ");
6901 q.text(util.pretty_port(self.port_no))
6902 q.breakable()
6903 q.text('}')
6904
6905bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6906
6907class bsn_set_aux_cxns_reply(bsn_header):
6908 version = 5
6909 type = 4
6910 experimenter = 6035143
6911 subtype = 59
6912
6913 def __init__(self, xid=None, num_aux=None, status=None):
6914 if xid != None:
6915 self.xid = xid
6916 else:
6917 self.xid = None
6918 if num_aux != None:
6919 self.num_aux = num_aux
6920 else:
6921 self.num_aux = 0
6922 if status != None:
6923 self.status = status
6924 else:
6925 self.status = 0
6926 return
6927
6928 def pack(self):
6929 packed = []
6930 packed.append(struct.pack("!B", self.version))
6931 packed.append(struct.pack("!B", self.type))
6932 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6933 packed.append(struct.pack("!L", self.xid))
6934 packed.append(struct.pack("!L", self.experimenter))
6935 packed.append(struct.pack("!L", self.subtype))
6936 packed.append(struct.pack("!L", self.num_aux))
6937 packed.append(struct.pack("!L", self.status))
6938 length = sum([len(x) for x in packed])
6939 packed[2] = struct.pack("!H", length)
6940 return ''.join(packed)
6941
6942 @staticmethod
6943 def unpack(reader):
6944 obj = bsn_set_aux_cxns_reply()
6945 _version = reader.read("!B")[0]
6946 assert(_version == 5)
6947 _type = reader.read("!B")[0]
6948 assert(_type == 4)
6949 _length = reader.read("!H")[0]
6950 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006951 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08006952 obj.xid = reader.read("!L")[0]
6953 _experimenter = reader.read("!L")[0]
6954 assert(_experimenter == 6035143)
6955 _subtype = reader.read("!L")[0]
6956 assert(_subtype == 59)
6957 obj.num_aux = reader.read("!L")[0]
6958 obj.status = reader.read("!L")[0]
6959 return obj
6960
6961 def __eq__(self, other):
6962 if type(self) != type(other): return False
6963 if self.xid != other.xid: return False
6964 if self.num_aux != other.num_aux: return False
6965 if self.status != other.status: return False
6966 return True
6967
6968 def pretty_print(self, q):
6969 q.text("bsn_set_aux_cxns_reply {")
6970 with q.group():
6971 with q.indent(2):
6972 q.breakable()
6973 q.text("xid = ");
6974 if self.xid != None:
6975 q.text("%#x" % self.xid)
6976 else:
6977 q.text('None')
6978 q.text(","); q.breakable()
6979 q.text("num_aux = ");
6980 q.text("%#x" % self.num_aux)
6981 q.text(","); q.breakable()
6982 q.text("status = ");
6983 q.text("%#x" % self.status)
6984 q.breakable()
6985 q.text('}')
6986
6987bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
6988
6989class bsn_set_aux_cxns_request(bsn_header):
6990 version = 5
6991 type = 4
6992 experimenter = 6035143
6993 subtype = 58
6994
6995 def __init__(self, xid=None, num_aux=None):
6996 if xid != None:
6997 self.xid = xid
6998 else:
6999 self.xid = None
7000 if num_aux != None:
7001 self.num_aux = num_aux
7002 else:
7003 self.num_aux = 0
7004 return
7005
7006 def pack(self):
7007 packed = []
7008 packed.append(struct.pack("!B", self.version))
7009 packed.append(struct.pack("!B", self.type))
7010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7011 packed.append(struct.pack("!L", self.xid))
7012 packed.append(struct.pack("!L", self.experimenter))
7013 packed.append(struct.pack("!L", self.subtype))
7014 packed.append(struct.pack("!L", self.num_aux))
7015 length = sum([len(x) for x in packed])
7016 packed[2] = struct.pack("!H", length)
7017 return ''.join(packed)
7018
7019 @staticmethod
7020 def unpack(reader):
7021 obj = bsn_set_aux_cxns_request()
7022 _version = reader.read("!B")[0]
7023 assert(_version == 5)
7024 _type = reader.read("!B")[0]
7025 assert(_type == 4)
7026 _length = reader.read("!H")[0]
7027 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007028 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007029 obj.xid = reader.read("!L")[0]
7030 _experimenter = reader.read("!L")[0]
7031 assert(_experimenter == 6035143)
7032 _subtype = reader.read("!L")[0]
7033 assert(_subtype == 58)
7034 obj.num_aux = reader.read("!L")[0]
7035 return obj
7036
7037 def __eq__(self, other):
7038 if type(self) != type(other): return False
7039 if self.xid != other.xid: return False
7040 if self.num_aux != other.num_aux: return False
7041 return True
7042
7043 def pretty_print(self, q):
7044 q.text("bsn_set_aux_cxns_request {")
7045 with q.group():
7046 with q.indent(2):
7047 q.breakable()
7048 q.text("xid = ");
7049 if self.xid != None:
7050 q.text("%#x" % self.xid)
7051 else:
7052 q.text('None')
7053 q.text(","); q.breakable()
7054 q.text("num_aux = ");
7055 q.text("%#x" % self.num_aux)
7056 q.breakable()
7057 q.text('}')
7058
7059bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7060
7061class bsn_set_lacp_reply(bsn_header):
7062 version = 5
7063 type = 4
7064 experimenter = 6035143
7065 subtype = 42
7066
7067 def __init__(self, xid=None, status=None, port_no=None):
7068 if xid != None:
7069 self.xid = xid
7070 else:
7071 self.xid = None
7072 if status != None:
7073 self.status = status
7074 else:
7075 self.status = 0
7076 if port_no != None:
7077 self.port_no = port_no
7078 else:
7079 self.port_no = 0
7080 return
7081
7082 def pack(self):
7083 packed = []
7084 packed.append(struct.pack("!B", self.version))
7085 packed.append(struct.pack("!B", self.type))
7086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7087 packed.append(struct.pack("!L", self.xid))
7088 packed.append(struct.pack("!L", self.experimenter))
7089 packed.append(struct.pack("!L", self.subtype))
7090 packed.append(struct.pack("!L", self.status))
7091 packed.append(util.pack_port_no(self.port_no))
7092 length = sum([len(x) for x in packed])
7093 packed[2] = struct.pack("!H", length)
7094 return ''.join(packed)
7095
7096 @staticmethod
7097 def unpack(reader):
7098 obj = bsn_set_lacp_reply()
7099 _version = reader.read("!B")[0]
7100 assert(_version == 5)
7101 _type = reader.read("!B")[0]
7102 assert(_type == 4)
7103 _length = reader.read("!H")[0]
7104 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007105 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007106 obj.xid = reader.read("!L")[0]
7107 _experimenter = reader.read("!L")[0]
7108 assert(_experimenter == 6035143)
7109 _subtype = reader.read("!L")[0]
7110 assert(_subtype == 42)
7111 obj.status = reader.read("!L")[0]
7112 obj.port_no = util.unpack_port_no(reader)
7113 return obj
7114
7115 def __eq__(self, other):
7116 if type(self) != type(other): return False
7117 if self.xid != other.xid: return False
7118 if self.status != other.status: return False
7119 if self.port_no != other.port_no: return False
7120 return True
7121
7122 def pretty_print(self, q):
7123 q.text("bsn_set_lacp_reply {")
7124 with q.group():
7125 with q.indent(2):
7126 q.breakable()
7127 q.text("xid = ");
7128 if self.xid != None:
7129 q.text("%#x" % self.xid)
7130 else:
7131 q.text('None')
7132 q.text(","); q.breakable()
7133 q.text("status = ");
7134 q.text("%#x" % self.status)
7135 q.text(","); q.breakable()
7136 q.text("port_no = ");
7137 q.text(util.pretty_port(self.port_no))
7138 q.breakable()
7139 q.text('}')
7140
7141bsn_header.subtypes[42] = bsn_set_lacp_reply
7142
7143class bsn_set_lacp_request(bsn_header):
7144 version = 5
7145 type = 4
7146 experimenter = 6035143
7147 subtype = 41
7148
7149 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):
7150 if xid != None:
7151 self.xid = xid
7152 else:
7153 self.xid = None
7154 if enabled != None:
7155 self.enabled = enabled
7156 else:
7157 self.enabled = 0
7158 if port_no != None:
7159 self.port_no = port_no
7160 else:
7161 self.port_no = 0
7162 if actor_sys_priority != None:
7163 self.actor_sys_priority = actor_sys_priority
7164 else:
7165 self.actor_sys_priority = 0
7166 if actor_sys_mac != None:
7167 self.actor_sys_mac = actor_sys_mac
7168 else:
7169 self.actor_sys_mac = [0,0,0,0,0,0]
7170 if actor_port_priority != None:
7171 self.actor_port_priority = actor_port_priority
7172 else:
7173 self.actor_port_priority = 0
7174 if actor_port_num != None:
7175 self.actor_port_num = actor_port_num
7176 else:
7177 self.actor_port_num = 0
7178 if actor_key != None:
7179 self.actor_key = actor_key
7180 else:
7181 self.actor_key = 0
7182 return
7183
7184 def pack(self):
7185 packed = []
7186 packed.append(struct.pack("!B", self.version))
7187 packed.append(struct.pack("!B", self.type))
7188 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7189 packed.append(struct.pack("!L", self.xid))
7190 packed.append(struct.pack("!L", self.experimenter))
7191 packed.append(struct.pack("!L", self.subtype))
7192 packed.append(struct.pack("!B", self.enabled))
7193 packed.append('\x00' * 3)
7194 packed.append(util.pack_port_no(self.port_no))
7195 packed.append(struct.pack("!H", self.actor_sys_priority))
7196 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7197 packed.append(struct.pack("!H", self.actor_port_priority))
7198 packed.append(struct.pack("!H", self.actor_port_num))
7199 packed.append(struct.pack("!H", self.actor_key))
7200 length = sum([len(x) for x in packed])
7201 packed[2] = struct.pack("!H", length)
7202 return ''.join(packed)
7203
7204 @staticmethod
7205 def unpack(reader):
7206 obj = bsn_set_lacp_request()
7207 _version = reader.read("!B")[0]
7208 assert(_version == 5)
7209 _type = reader.read("!B")[0]
7210 assert(_type == 4)
7211 _length = reader.read("!H")[0]
7212 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007213 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007214 obj.xid = reader.read("!L")[0]
7215 _experimenter = reader.read("!L")[0]
7216 assert(_experimenter == 6035143)
7217 _subtype = reader.read("!L")[0]
7218 assert(_subtype == 41)
7219 obj.enabled = reader.read("!B")[0]
7220 reader.skip(3)
7221 obj.port_no = util.unpack_port_no(reader)
7222 obj.actor_sys_priority = reader.read("!H")[0]
7223 obj.actor_sys_mac = list(reader.read('!6B'))
7224 obj.actor_port_priority = reader.read("!H")[0]
7225 obj.actor_port_num = reader.read("!H")[0]
7226 obj.actor_key = reader.read("!H")[0]
7227 return obj
7228
7229 def __eq__(self, other):
7230 if type(self) != type(other): return False
7231 if self.xid != other.xid: return False
7232 if self.enabled != other.enabled: return False
7233 if self.port_no != other.port_no: return False
7234 if self.actor_sys_priority != other.actor_sys_priority: return False
7235 if self.actor_sys_mac != other.actor_sys_mac: return False
7236 if self.actor_port_priority != other.actor_port_priority: return False
7237 if self.actor_port_num != other.actor_port_num: return False
7238 if self.actor_key != other.actor_key: return False
7239 return True
7240
7241 def pretty_print(self, q):
7242 q.text("bsn_set_lacp_request {")
7243 with q.group():
7244 with q.indent(2):
7245 q.breakable()
7246 q.text("xid = ");
7247 if self.xid != None:
7248 q.text("%#x" % self.xid)
7249 else:
7250 q.text('None')
7251 q.text(","); q.breakable()
7252 q.text("enabled = ");
7253 q.text("%#x" % self.enabled)
7254 q.text(","); q.breakable()
7255 q.text("port_no = ");
7256 q.text(util.pretty_port(self.port_no))
7257 q.text(","); q.breakable()
7258 q.text("actor_sys_priority = ");
7259 q.text("%#x" % self.actor_sys_priority)
7260 q.text(","); q.breakable()
7261 q.text("actor_sys_mac = ");
7262 q.text(util.pretty_mac(self.actor_sys_mac))
7263 q.text(","); q.breakable()
7264 q.text("actor_port_priority = ");
7265 q.text("%#x" % self.actor_port_priority)
7266 q.text(","); q.breakable()
7267 q.text("actor_port_num = ");
7268 q.text("%#x" % self.actor_port_num)
7269 q.text(","); q.breakable()
7270 q.text("actor_key = ");
7271 q.text("%#x" % self.actor_key)
7272 q.breakable()
7273 q.text('}')
7274
7275bsn_header.subtypes[41] = bsn_set_lacp_request
7276
Rich Lane2e079da2014-10-29 15:30:24 -07007277class bsn_set_mirroring(bsn_header):
7278 version = 5
7279 type = 4
7280 experimenter = 6035143
7281 subtype = 3
7282
7283 def __init__(self, xid=None, report_mirror_ports=None):
7284 if xid != None:
7285 self.xid = xid
7286 else:
7287 self.xid = None
7288 if report_mirror_ports != None:
7289 self.report_mirror_ports = report_mirror_ports
7290 else:
7291 self.report_mirror_ports = 0
7292 return
7293
7294 def pack(self):
7295 packed = []
7296 packed.append(struct.pack("!B", self.version))
7297 packed.append(struct.pack("!B", self.type))
7298 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7299 packed.append(struct.pack("!L", self.xid))
7300 packed.append(struct.pack("!L", self.experimenter))
7301 packed.append(struct.pack("!L", self.subtype))
7302 packed.append(struct.pack("!B", self.report_mirror_ports))
7303 packed.append('\x00' * 3)
7304 length = sum([len(x) for x in packed])
7305 packed[2] = struct.pack("!H", length)
7306 return ''.join(packed)
7307
7308 @staticmethod
7309 def unpack(reader):
7310 obj = bsn_set_mirroring()
7311 _version = reader.read("!B")[0]
7312 assert(_version == 5)
7313 _type = reader.read("!B")[0]
7314 assert(_type == 4)
7315 _length = reader.read("!H")[0]
7316 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007317 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007318 obj.xid = reader.read("!L")[0]
7319 _experimenter = reader.read("!L")[0]
7320 assert(_experimenter == 6035143)
7321 _subtype = reader.read("!L")[0]
7322 assert(_subtype == 3)
7323 obj.report_mirror_ports = reader.read("!B")[0]
7324 reader.skip(3)
7325 return obj
7326
7327 def __eq__(self, other):
7328 if type(self) != type(other): return False
7329 if self.xid != other.xid: return False
7330 if self.report_mirror_ports != other.report_mirror_ports: return False
7331 return True
7332
7333 def pretty_print(self, q):
7334 q.text("bsn_set_mirroring {")
7335 with q.group():
7336 with q.indent(2):
7337 q.breakable()
7338 q.text("xid = ");
7339 if self.xid != None:
7340 q.text("%#x" % self.xid)
7341 else:
7342 q.text('None')
7343 q.text(","); q.breakable()
7344 q.text("report_mirror_ports = ");
7345 q.text("%#x" % self.report_mirror_ports)
7346 q.breakable()
7347 q.text('}')
7348
7349bsn_header.subtypes[3] = bsn_set_mirroring
7350
7351class bsn_set_pktin_suppression_reply(bsn_header):
7352 version = 5
7353 type = 4
7354 experimenter = 6035143
7355 subtype = 25
7356
7357 def __init__(self, xid=None, status=None):
7358 if xid != None:
7359 self.xid = xid
7360 else:
7361 self.xid = None
7362 if status != None:
7363 self.status = status
7364 else:
7365 self.status = 0
7366 return
7367
7368 def pack(self):
7369 packed = []
7370 packed.append(struct.pack("!B", self.version))
7371 packed.append(struct.pack("!B", self.type))
7372 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7373 packed.append(struct.pack("!L", self.xid))
7374 packed.append(struct.pack("!L", self.experimenter))
7375 packed.append(struct.pack("!L", self.subtype))
7376 packed.append(struct.pack("!L", self.status))
7377 length = sum([len(x) for x in packed])
7378 packed[2] = struct.pack("!H", length)
7379 return ''.join(packed)
7380
7381 @staticmethod
7382 def unpack(reader):
7383 obj = bsn_set_pktin_suppression_reply()
7384 _version = reader.read("!B")[0]
7385 assert(_version == 5)
7386 _type = reader.read("!B")[0]
7387 assert(_type == 4)
7388 _length = reader.read("!H")[0]
7389 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007390 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007391 obj.xid = reader.read("!L")[0]
7392 _experimenter = reader.read("!L")[0]
7393 assert(_experimenter == 6035143)
7394 _subtype = reader.read("!L")[0]
7395 assert(_subtype == 25)
7396 obj.status = reader.read("!L")[0]
7397 return obj
7398
7399 def __eq__(self, other):
7400 if type(self) != type(other): return False
7401 if self.xid != other.xid: return False
7402 if self.status != other.status: return False
7403 return True
7404
7405 def pretty_print(self, q):
7406 q.text("bsn_set_pktin_suppression_reply {")
7407 with q.group():
7408 with q.indent(2):
7409 q.breakable()
7410 q.text("xid = ");
7411 if self.xid != None:
7412 q.text("%#x" % self.xid)
7413 else:
7414 q.text('None')
7415 q.text(","); q.breakable()
7416 q.text("status = ");
7417 q.text("%#x" % self.status)
7418 q.breakable()
7419 q.text('}')
7420
7421bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7422
7423class bsn_set_pktin_suppression_request(bsn_header):
7424 version = 5
7425 type = 4
7426 experimenter = 6035143
7427 subtype = 11
7428
7429 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
7430 if xid != None:
7431 self.xid = xid
7432 else:
7433 self.xid = None
7434 if enabled != None:
7435 self.enabled = enabled
7436 else:
7437 self.enabled = 0
7438 if idle_timeout != None:
7439 self.idle_timeout = idle_timeout
7440 else:
7441 self.idle_timeout = 0
7442 if hard_timeout != None:
7443 self.hard_timeout = hard_timeout
7444 else:
7445 self.hard_timeout = 0
7446 if priority != None:
7447 self.priority = priority
7448 else:
7449 self.priority = 0
7450 if cookie != None:
7451 self.cookie = cookie
7452 else:
7453 self.cookie = 0
7454 return
7455
7456 def pack(self):
7457 packed = []
7458 packed.append(struct.pack("!B", self.version))
7459 packed.append(struct.pack("!B", self.type))
7460 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7461 packed.append(struct.pack("!L", self.xid))
7462 packed.append(struct.pack("!L", self.experimenter))
7463 packed.append(struct.pack("!L", self.subtype))
7464 packed.append(struct.pack("!B", self.enabled))
7465 packed.append('\x00' * 1)
7466 packed.append(struct.pack("!H", self.idle_timeout))
7467 packed.append(struct.pack("!H", self.hard_timeout))
7468 packed.append(struct.pack("!H", self.priority))
7469 packed.append(struct.pack("!Q", self.cookie))
7470 length = sum([len(x) for x in packed])
7471 packed[2] = struct.pack("!H", length)
7472 return ''.join(packed)
7473
7474 @staticmethod
7475 def unpack(reader):
7476 obj = bsn_set_pktin_suppression_request()
7477 _version = reader.read("!B")[0]
7478 assert(_version == 5)
7479 _type = reader.read("!B")[0]
7480 assert(_type == 4)
7481 _length = reader.read("!H")[0]
7482 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007483 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007484 obj.xid = reader.read("!L")[0]
7485 _experimenter = reader.read("!L")[0]
7486 assert(_experimenter == 6035143)
7487 _subtype = reader.read("!L")[0]
7488 assert(_subtype == 11)
7489 obj.enabled = reader.read("!B")[0]
7490 reader.skip(1)
7491 obj.idle_timeout = reader.read("!H")[0]
7492 obj.hard_timeout = reader.read("!H")[0]
7493 obj.priority = reader.read("!H")[0]
7494 obj.cookie = reader.read("!Q")[0]
7495 return obj
7496
7497 def __eq__(self, other):
7498 if type(self) != type(other): return False
7499 if self.xid != other.xid: return False
7500 if self.enabled != other.enabled: return False
7501 if self.idle_timeout != other.idle_timeout: return False
7502 if self.hard_timeout != other.hard_timeout: return False
7503 if self.priority != other.priority: return False
7504 if self.cookie != other.cookie: return False
7505 return True
7506
7507 def pretty_print(self, q):
7508 q.text("bsn_set_pktin_suppression_request {")
7509 with q.group():
7510 with q.indent(2):
7511 q.breakable()
7512 q.text("xid = ");
7513 if self.xid != None:
7514 q.text("%#x" % self.xid)
7515 else:
7516 q.text('None')
7517 q.text(","); q.breakable()
7518 q.text("enabled = ");
7519 q.text("%#x" % self.enabled)
7520 q.text(","); q.breakable()
7521 q.text("idle_timeout = ");
7522 q.text("%#x" % self.idle_timeout)
7523 q.text(","); q.breakable()
7524 q.text("hard_timeout = ");
7525 q.text("%#x" % self.hard_timeout)
7526 q.text(","); q.breakable()
7527 q.text("priority = ");
7528 q.text("%#x" % self.priority)
7529 q.text(","); q.breakable()
7530 q.text("cookie = ");
7531 q.text("%#x" % self.cookie)
7532 q.breakable()
7533 q.text('}')
7534
7535bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7536
Rich Laneccd32ed2014-11-10 17:48:24 -08007537class bsn_set_switch_pipeline_reply(bsn_header):
Rich Lane2e079da2014-10-29 15:30:24 -07007538 version = 5
Rich Laneccd32ed2014-11-10 17:48:24 -08007539 type = 4
7540 experimenter = 6035143
7541 subtype = 54
Rich Lane2e079da2014-10-29 15:30:24 -07007542
Rich Laneccd32ed2014-11-10 17:48:24 -08007543 def __init__(self, xid=None, status=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007544 if xid != None:
7545 self.xid = xid
7546 else:
7547 self.xid = None
Rich Laneccd32ed2014-11-10 17:48:24 -08007548 if status != None:
7549 self.status = status
Rich Lane2e079da2014-10-29 15:30:24 -07007550 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007551 self.status = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007552 return
7553
7554 def pack(self):
7555 packed = []
7556 packed.append(struct.pack("!B", self.version))
7557 packed.append(struct.pack("!B", self.type))
7558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7559 packed.append(struct.pack("!L", self.xid))
Rich Lane2e079da2014-10-29 15:30:24 -07007560 packed.append(struct.pack("!L", self.experimenter))
7561 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007562 packed.append(struct.pack("!L", self.status))
Rich Lane2e079da2014-10-29 15:30:24 -07007563 length = sum([len(x) for x in packed])
7564 packed[2] = struct.pack("!H", length)
7565 return ''.join(packed)
7566
7567 @staticmethod
7568 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007569 obj = bsn_set_switch_pipeline_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007570 _version = reader.read("!B")[0]
7571 assert(_version == 5)
7572 _type = reader.read("!B")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007573 assert(_type == 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007574 _length = reader.read("!H")[0]
7575 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007576 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007577 obj.xid = reader.read("!L")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007578 _experimenter = reader.read("!L")[0]
7579 assert(_experimenter == 6035143)
7580 _subtype = reader.read("!L")[0]
7581 assert(_subtype == 54)
7582 obj.status = reader.read("!L")[0]
Rich Lane2e079da2014-10-29 15:30:24 -07007583 return obj
7584
7585 def __eq__(self, other):
7586 if type(self) != type(other): return False
7587 if self.xid != other.xid: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007588 if self.status != other.status: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007589 return True
7590
7591 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007592 q.text("bsn_set_switch_pipeline_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007593 with q.group():
7594 with q.indent(2):
7595 q.breakable()
7596 q.text("xid = ");
7597 if self.xid != None:
7598 q.text("%#x" % self.xid)
7599 else:
7600 q.text('None')
7601 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007602 q.text("status = ");
7603 q.text("%#x" % self.status)
Rich Lane2e079da2014-10-29 15:30:24 -07007604 q.breakable()
7605 q.text('}')
7606
Rich Laneccd32ed2014-11-10 17:48:24 -08007607bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007608
Rich Laneccd32ed2014-11-10 17:48:24 -08007609class bsn_set_switch_pipeline_request(bsn_header):
7610 version = 5
7611 type = 4
7612 experimenter = 6035143
7613 subtype = 53
Rich Lane2e079da2014-10-29 15:30:24 -07007614
Rich Laneccd32ed2014-11-10 17:48:24 -08007615 def __init__(self, xid=None, pipeline=None):
7616 if xid != None:
7617 self.xid = xid
7618 else:
7619 self.xid = None
7620 if pipeline != None:
7621 self.pipeline = pipeline
7622 else:
7623 self.pipeline = ""
7624 return
7625
7626 def pack(self):
7627 packed = []
7628 packed.append(struct.pack("!B", self.version))
7629 packed.append(struct.pack("!B", self.type))
7630 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7631 packed.append(struct.pack("!L", self.xid))
7632 packed.append(struct.pack("!L", self.experimenter))
7633 packed.append(struct.pack("!L", self.subtype))
7634 packed.append(struct.pack("!256s", self.pipeline))
7635 length = sum([len(x) for x in packed])
7636 packed[2] = struct.pack("!H", length)
7637 return ''.join(packed)
7638
7639 @staticmethod
7640 def unpack(reader):
7641 obj = bsn_set_switch_pipeline_request()
7642 _version = reader.read("!B")[0]
7643 assert(_version == 5)
7644 _type = reader.read("!B")[0]
7645 assert(_type == 4)
7646 _length = reader.read("!H")[0]
7647 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007648 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007649 obj.xid = reader.read("!L")[0]
7650 _experimenter = reader.read("!L")[0]
7651 assert(_experimenter == 6035143)
7652 _subtype = reader.read("!L")[0]
7653 assert(_subtype == 53)
7654 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7655 return obj
7656
7657 def __eq__(self, other):
7658 if type(self) != type(other): return False
7659 if self.xid != other.xid: return False
7660 if self.pipeline != other.pipeline: return False
7661 return True
7662
7663 def pretty_print(self, q):
7664 q.text("bsn_set_switch_pipeline_request {")
7665 with q.group():
7666 with q.indent(2):
7667 q.breakable()
7668 q.text("xid = ");
7669 if self.xid != None:
7670 q.text("%#x" % self.xid)
7671 else:
7672 q.text('None')
7673 q.text(","); q.breakable()
7674 q.text("pipeline = ");
7675 q.pp(self.pipeline)
7676 q.breakable()
7677 q.text('}')
7678
7679bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7680
7681class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
Rich Lane2e079da2014-10-29 15:30:24 -07007682 version = 5
7683 type = 19
7684 stats_type = 65535
7685 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007686 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007687
Rich Laneccd32ed2014-11-10 17:48:24 -08007688 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007689 if xid != None:
7690 self.xid = xid
7691 else:
7692 self.xid = None
7693 if flags != None:
7694 self.flags = flags
7695 else:
7696 self.flags = 0
Rich Laneccd32ed2014-11-10 17:48:24 -08007697 if entries != None:
7698 self.entries = entries
Rich Lane2e079da2014-10-29 15:30:24 -07007699 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007700 self.entries = []
Rich Lane2e079da2014-10-29 15:30:24 -07007701 return
7702
7703 def pack(self):
7704 packed = []
7705 packed.append(struct.pack("!B", self.version))
7706 packed.append(struct.pack("!B", self.type))
7707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7708 packed.append(struct.pack("!L", self.xid))
7709 packed.append(struct.pack("!H", self.stats_type))
7710 packed.append(struct.pack("!H", self.flags))
7711 packed.append('\x00' * 4)
7712 packed.append(struct.pack("!L", self.experimenter))
7713 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007714 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane2e079da2014-10-29 15:30:24 -07007715 length = sum([len(x) for x in packed])
7716 packed[2] = struct.pack("!H", length)
7717 return ''.join(packed)
7718
7719 @staticmethod
7720 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007721 obj = bsn_switch_pipeline_stats_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007722 _version = reader.read("!B")[0]
7723 assert(_version == 5)
7724 _type = reader.read("!B")[0]
7725 assert(_type == 19)
7726 _length = reader.read("!H")[0]
7727 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007728 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007729 obj.xid = reader.read("!L")[0]
7730 _stats_type = reader.read("!H")[0]
7731 assert(_stats_type == 65535)
7732 obj.flags = reader.read("!H")[0]
7733 reader.skip(4)
7734 _experimenter = reader.read("!L")[0]
7735 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007736 _subtype = reader.read("!L")[0]
7737 assert(_subtype == 6)
Rich Lanee2567702015-01-26 15:04:35 -08007738 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07007739 return obj
7740
7741 def __eq__(self, other):
7742 if type(self) != type(other): return False
7743 if self.xid != other.xid: return False
7744 if self.flags != other.flags: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007745 if self.entries != other.entries: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007746 return True
7747
7748 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007749 q.text("bsn_switch_pipeline_stats_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007750 with q.group():
7751 with q.indent(2):
7752 q.breakable()
7753 q.text("xid = ");
7754 if self.xid != None:
7755 q.text("%#x" % self.xid)
7756 else:
7757 q.text('None')
7758 q.text(","); q.breakable()
7759 q.text("flags = ");
7760 q.text("%#x" % self.flags)
7761 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007762 q.text("entries = ");
7763 q.pp(self.entries)
Rich Lane2e079da2014-10-29 15:30:24 -07007764 q.breakable()
7765 q.text('}')
7766
Rich Laneccd32ed2014-11-10 17:48:24 -08007767bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007768
Rich Laneccd32ed2014-11-10 17:48:24 -08007769class bsn_switch_pipeline_stats_request(bsn_stats_request):
Rich Lane2e079da2014-10-29 15:30:24 -07007770 version = 5
7771 type = 18
7772 stats_type = 65535
7773 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007774 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007775
Rich Laneccd32ed2014-11-10 17:48:24 -08007776 def __init__(self, xid=None, flags=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007777 if xid != None:
7778 self.xid = xid
7779 else:
7780 self.xid = None
7781 if flags != None:
7782 self.flags = flags
7783 else:
7784 self.flags = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007785 return
7786
7787 def pack(self):
7788 packed = []
7789 packed.append(struct.pack("!B", self.version))
7790 packed.append(struct.pack("!B", self.type))
7791 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7792 packed.append(struct.pack("!L", self.xid))
7793 packed.append(struct.pack("!H", self.stats_type))
7794 packed.append(struct.pack("!H", self.flags))
7795 packed.append('\x00' * 4)
7796 packed.append(struct.pack("!L", self.experimenter))
7797 packed.append(struct.pack("!L", self.subtype))
7798 length = sum([len(x) for x in packed])
7799 packed[2] = struct.pack("!H", length)
7800 return ''.join(packed)
7801
7802 @staticmethod
7803 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007804 obj = bsn_switch_pipeline_stats_request()
Rich Lane2e079da2014-10-29 15:30:24 -07007805 _version = reader.read("!B")[0]
7806 assert(_version == 5)
7807 _type = reader.read("!B")[0]
7808 assert(_type == 18)
7809 _length = reader.read("!H")[0]
7810 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007811 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007812 obj.xid = reader.read("!L")[0]
7813 _stats_type = reader.read("!H")[0]
7814 assert(_stats_type == 65535)
7815 obj.flags = reader.read("!H")[0]
7816 reader.skip(4)
7817 _experimenter = reader.read("!L")[0]
7818 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007819 _subtype = reader.read("!L")[0]
7820 assert(_subtype == 6)
Rich Lane2e079da2014-10-29 15:30:24 -07007821 return obj
7822
7823 def __eq__(self, other):
7824 if type(self) != type(other): return False
7825 if self.xid != other.xid: return False
7826 if self.flags != other.flags: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007827 return True
7828
7829 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007830 q.text("bsn_switch_pipeline_stats_request {")
Rich Lane2e079da2014-10-29 15:30:24 -07007831 with q.group():
7832 with q.indent(2):
7833 q.breakable()
7834 q.text("xid = ");
7835 if self.xid != None:
7836 q.text("%#x" % self.xid)
7837 else:
7838 q.text('None')
7839 q.text(","); q.breakable()
7840 q.text("flags = ");
7841 q.text("%#x" % self.flags)
7842 q.breakable()
7843 q.text('}')
7844
Rich Laneccd32ed2014-11-10 17:48:24 -08007845bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7846
7847class bsn_table_checksum_stats_reply(bsn_stats_reply):
7848 version = 5
7849 type = 19
7850 stats_type = 65535
7851 experimenter = 6035143
7852 subtype = 11
7853
7854 def __init__(self, xid=None, flags=None, entries=None):
7855 if xid != None:
7856 self.xid = xid
7857 else:
7858 self.xid = None
7859 if flags != None:
7860 self.flags = flags
7861 else:
7862 self.flags = 0
7863 if entries != None:
7864 self.entries = entries
7865 else:
7866 self.entries = []
7867 return
7868
7869 def pack(self):
7870 packed = []
7871 packed.append(struct.pack("!B", self.version))
7872 packed.append(struct.pack("!B", self.type))
7873 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7874 packed.append(struct.pack("!L", self.xid))
7875 packed.append(struct.pack("!H", self.stats_type))
7876 packed.append(struct.pack("!H", self.flags))
7877 packed.append('\x00' * 4)
7878 packed.append(struct.pack("!L", self.experimenter))
7879 packed.append(struct.pack("!L", self.subtype))
7880 packed.append(loxi.generic_util.pack_list(self.entries))
7881 length = sum([len(x) for x in packed])
7882 packed[2] = struct.pack("!H", length)
7883 return ''.join(packed)
7884
7885 @staticmethod
7886 def unpack(reader):
7887 obj = bsn_table_checksum_stats_reply()
7888 _version = reader.read("!B")[0]
7889 assert(_version == 5)
7890 _type = reader.read("!B")[0]
7891 assert(_type == 19)
7892 _length = reader.read("!H")[0]
7893 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007894 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007895 obj.xid = reader.read("!L")[0]
7896 _stats_type = reader.read("!H")[0]
7897 assert(_stats_type == 65535)
7898 obj.flags = reader.read("!H")[0]
7899 reader.skip(4)
7900 _experimenter = reader.read("!L")[0]
7901 assert(_experimenter == 6035143)
7902 _subtype = reader.read("!L")[0]
7903 assert(_subtype == 11)
Rich Lanee2567702015-01-26 15:04:35 -08007904 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08007905 return obj
7906
7907 def __eq__(self, other):
7908 if type(self) != type(other): return False
7909 if self.xid != other.xid: return False
7910 if self.flags != other.flags: return False
7911 if self.entries != other.entries: return False
7912 return True
7913
7914 def pretty_print(self, q):
7915 q.text("bsn_table_checksum_stats_reply {")
7916 with q.group():
7917 with q.indent(2):
7918 q.breakable()
7919 q.text("xid = ");
7920 if self.xid != None:
7921 q.text("%#x" % self.xid)
7922 else:
7923 q.text('None')
7924 q.text(","); q.breakable()
7925 q.text("flags = ");
7926 q.text("%#x" % self.flags)
7927 q.text(","); q.breakable()
7928 q.text("entries = ");
7929 q.pp(self.entries)
7930 q.breakable()
7931 q.text('}')
7932
7933bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7934
7935class bsn_table_checksum_stats_request(bsn_stats_request):
7936 version = 5
7937 type = 18
7938 stats_type = 65535
7939 experimenter = 6035143
7940 subtype = 11
7941
7942 def __init__(self, xid=None, flags=None):
7943 if xid != None:
7944 self.xid = xid
7945 else:
7946 self.xid = None
7947 if flags != None:
7948 self.flags = flags
7949 else:
7950 self.flags = 0
7951 return
7952
7953 def pack(self):
7954 packed = []
7955 packed.append(struct.pack("!B", self.version))
7956 packed.append(struct.pack("!B", self.type))
7957 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7958 packed.append(struct.pack("!L", self.xid))
7959 packed.append(struct.pack("!H", self.stats_type))
7960 packed.append(struct.pack("!H", self.flags))
7961 packed.append('\x00' * 4)
7962 packed.append(struct.pack("!L", self.experimenter))
7963 packed.append(struct.pack("!L", self.subtype))
7964 length = sum([len(x) for x in packed])
7965 packed[2] = struct.pack("!H", length)
7966 return ''.join(packed)
7967
7968 @staticmethod
7969 def unpack(reader):
7970 obj = bsn_table_checksum_stats_request()
7971 _version = reader.read("!B")[0]
7972 assert(_version == 5)
7973 _type = reader.read("!B")[0]
7974 assert(_type == 18)
7975 _length = reader.read("!H")[0]
7976 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007977 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08007978 obj.xid = reader.read("!L")[0]
7979 _stats_type = reader.read("!H")[0]
7980 assert(_stats_type == 65535)
7981 obj.flags = reader.read("!H")[0]
7982 reader.skip(4)
7983 _experimenter = reader.read("!L")[0]
7984 assert(_experimenter == 6035143)
7985 _subtype = reader.read("!L")[0]
7986 assert(_subtype == 11)
7987 return obj
7988
7989 def __eq__(self, other):
7990 if type(self) != type(other): return False
7991 if self.xid != other.xid: return False
7992 if self.flags != other.flags: return False
7993 return True
7994
7995 def pretty_print(self, q):
7996 q.text("bsn_table_checksum_stats_request {")
7997 with q.group():
7998 with q.indent(2):
7999 q.breakable()
8000 q.text("xid = ");
8001 if self.xid != None:
8002 q.text("%#x" % self.xid)
8003 else:
8004 q.text('None')
8005 q.text(","); q.breakable()
8006 q.text("flags = ");
8007 q.text("%#x" % self.flags)
8008 q.breakable()
8009 q.text('}')
8010
8011bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8012
8013class bsn_table_set_buckets_size(bsn_header):
8014 version = 5
8015 type = 4
8016 experimenter = 6035143
8017 subtype = 61
8018
8019 def __init__(self, xid=None, table_id=None, buckets_size=None):
8020 if xid != None:
8021 self.xid = xid
8022 else:
8023 self.xid = None
8024 if table_id != None:
8025 self.table_id = table_id
8026 else:
8027 self.table_id = 0
8028 if buckets_size != None:
8029 self.buckets_size = buckets_size
8030 else:
8031 self.buckets_size = 0
8032 return
8033
8034 def pack(self):
8035 packed = []
8036 packed.append(struct.pack("!B", self.version))
8037 packed.append(struct.pack("!B", self.type))
8038 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8039 packed.append(struct.pack("!L", self.xid))
8040 packed.append(struct.pack("!L", self.experimenter))
8041 packed.append(struct.pack("!L", self.subtype))
8042 packed.append('\x00' * 1)
8043 packed.append(struct.pack("!B", self.table_id))
8044 packed.append('\x00' * 2)
8045 packed.append(struct.pack("!L", self.buckets_size))
8046 length = sum([len(x) for x in packed])
8047 packed[2] = struct.pack("!H", length)
8048 return ''.join(packed)
8049
8050 @staticmethod
8051 def unpack(reader):
8052 obj = bsn_table_set_buckets_size()
8053 _version = reader.read("!B")[0]
8054 assert(_version == 5)
8055 _type = reader.read("!B")[0]
8056 assert(_type == 4)
8057 _length = reader.read("!H")[0]
8058 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008059 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008060 obj.xid = reader.read("!L")[0]
8061 _experimenter = reader.read("!L")[0]
8062 assert(_experimenter == 6035143)
8063 _subtype = reader.read("!L")[0]
8064 assert(_subtype == 61)
8065 reader.skip(1)
8066 obj.table_id = reader.read("!B")[0]
8067 reader.skip(2)
8068 obj.buckets_size = reader.read("!L")[0]
8069 return obj
8070
8071 def __eq__(self, other):
8072 if type(self) != type(other): return False
8073 if self.xid != other.xid: return False
8074 if self.table_id != other.table_id: return False
8075 if self.buckets_size != other.buckets_size: return False
8076 return True
8077
8078 def pretty_print(self, q):
8079 q.text("bsn_table_set_buckets_size {")
8080 with q.group():
8081 with q.indent(2):
8082 q.breakable()
8083 q.text("xid = ");
8084 if self.xid != None:
8085 q.text("%#x" % self.xid)
8086 else:
8087 q.text('None')
8088 q.text(","); q.breakable()
8089 q.text("table_id = ");
8090 q.text("%#x" % self.table_id)
8091 q.text(","); q.breakable()
8092 q.text("buckets_size = ");
8093 q.text("%#x" % self.buckets_size)
8094 q.breakable()
8095 q.text('}')
8096
8097bsn_header.subtypes[61] = bsn_table_set_buckets_size
8098
8099class bsn_time_reply(bsn_header):
8100 version = 5
8101 type = 4
8102 experimenter = 6035143
8103 subtype = 45
8104
8105 def __init__(self, xid=None, time_ms=None):
8106 if xid != None:
8107 self.xid = xid
8108 else:
8109 self.xid = None
8110 if time_ms != None:
8111 self.time_ms = time_ms
8112 else:
8113 self.time_ms = 0
8114 return
8115
8116 def pack(self):
8117 packed = []
8118 packed.append(struct.pack("!B", self.version))
8119 packed.append(struct.pack("!B", self.type))
8120 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8121 packed.append(struct.pack("!L", self.xid))
8122 packed.append(struct.pack("!L", self.experimenter))
8123 packed.append(struct.pack("!L", self.subtype))
8124 packed.append(struct.pack("!Q", self.time_ms))
8125 length = sum([len(x) for x in packed])
8126 packed[2] = struct.pack("!H", length)
8127 return ''.join(packed)
8128
8129 @staticmethod
8130 def unpack(reader):
8131 obj = bsn_time_reply()
8132 _version = reader.read("!B")[0]
8133 assert(_version == 5)
8134 _type = reader.read("!B")[0]
8135 assert(_type == 4)
8136 _length = reader.read("!H")[0]
8137 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008138 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008139 obj.xid = reader.read("!L")[0]
8140 _experimenter = reader.read("!L")[0]
8141 assert(_experimenter == 6035143)
8142 _subtype = reader.read("!L")[0]
8143 assert(_subtype == 45)
8144 obj.time_ms = reader.read("!Q")[0]
8145 return obj
8146
8147 def __eq__(self, other):
8148 if type(self) != type(other): return False
8149 if self.xid != other.xid: return False
8150 if self.time_ms != other.time_ms: return False
8151 return True
8152
8153 def pretty_print(self, q):
8154 q.text("bsn_time_reply {")
8155 with q.group():
8156 with q.indent(2):
8157 q.breakable()
8158 q.text("xid = ");
8159 if self.xid != None:
8160 q.text("%#x" % self.xid)
8161 else:
8162 q.text('None')
8163 q.text(","); q.breakable()
8164 q.text("time_ms = ");
8165 q.text("%#x" % self.time_ms)
8166 q.breakable()
8167 q.text('}')
8168
8169bsn_header.subtypes[45] = bsn_time_reply
8170
8171class bsn_time_request(bsn_header):
8172 version = 5
8173 type = 4
8174 experimenter = 6035143
8175 subtype = 44
8176
8177 def __init__(self, xid=None):
8178 if xid != None:
8179 self.xid = xid
8180 else:
8181 self.xid = None
8182 return
8183
8184 def pack(self):
8185 packed = []
8186 packed.append(struct.pack("!B", self.version))
8187 packed.append(struct.pack("!B", self.type))
8188 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8189 packed.append(struct.pack("!L", self.xid))
8190 packed.append(struct.pack("!L", self.experimenter))
8191 packed.append(struct.pack("!L", self.subtype))
8192 length = sum([len(x) for x in packed])
8193 packed[2] = struct.pack("!H", length)
8194 return ''.join(packed)
8195
8196 @staticmethod
8197 def unpack(reader):
8198 obj = bsn_time_request()
8199 _version = reader.read("!B")[0]
8200 assert(_version == 5)
8201 _type = reader.read("!B")[0]
8202 assert(_type == 4)
8203 _length = reader.read("!H")[0]
8204 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008205 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008206 obj.xid = reader.read("!L")[0]
8207 _experimenter = reader.read("!L")[0]
8208 assert(_experimenter == 6035143)
8209 _subtype = reader.read("!L")[0]
8210 assert(_subtype == 44)
8211 return obj
8212
8213 def __eq__(self, other):
8214 if type(self) != type(other): return False
8215 if self.xid != other.xid: return False
8216 return True
8217
8218 def pretty_print(self, q):
8219 q.text("bsn_time_request {")
8220 with q.group():
8221 with q.indent(2):
8222 q.breakable()
8223 q.text("xid = ");
8224 if self.xid != None:
8225 q.text("%#x" % self.xid)
8226 else:
8227 q.text('None')
8228 q.breakable()
8229 q.text('}')
8230
8231bsn_header.subtypes[44] = bsn_time_request
Rich Lane2e079da2014-10-29 15:30:24 -07008232
8233class bsn_virtual_port_create_reply(bsn_header):
8234 version = 5
8235 type = 4
8236 experimenter = 6035143
8237 subtype = 16
8238
8239 def __init__(self, xid=None, status=None, vport_no=None):
8240 if xid != None:
8241 self.xid = xid
8242 else:
8243 self.xid = None
8244 if status != None:
8245 self.status = status
8246 else:
8247 self.status = 0
8248 if vport_no != None:
8249 self.vport_no = vport_no
8250 else:
8251 self.vport_no = 0
8252 return
8253
8254 def pack(self):
8255 packed = []
8256 packed.append(struct.pack("!B", self.version))
8257 packed.append(struct.pack("!B", self.type))
8258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8259 packed.append(struct.pack("!L", self.xid))
8260 packed.append(struct.pack("!L", self.experimenter))
8261 packed.append(struct.pack("!L", self.subtype))
8262 packed.append(struct.pack("!L", self.status))
8263 packed.append(struct.pack("!L", self.vport_no))
8264 length = sum([len(x) for x in packed])
8265 packed[2] = struct.pack("!H", length)
8266 return ''.join(packed)
8267
8268 @staticmethod
8269 def unpack(reader):
8270 obj = bsn_virtual_port_create_reply()
8271 _version = reader.read("!B")[0]
8272 assert(_version == 5)
8273 _type = reader.read("!B")[0]
8274 assert(_type == 4)
8275 _length = reader.read("!H")[0]
8276 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008277 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008278 obj.xid = reader.read("!L")[0]
8279 _experimenter = reader.read("!L")[0]
8280 assert(_experimenter == 6035143)
8281 _subtype = reader.read("!L")[0]
8282 assert(_subtype == 16)
8283 obj.status = reader.read("!L")[0]
8284 obj.vport_no = reader.read("!L")[0]
8285 return obj
8286
8287 def __eq__(self, other):
8288 if type(self) != type(other): return False
8289 if self.xid != other.xid: return False
8290 if self.status != other.status: return False
8291 if self.vport_no != other.vport_no: return False
8292 return True
8293
8294 def pretty_print(self, q):
8295 q.text("bsn_virtual_port_create_reply {")
8296 with q.group():
8297 with q.indent(2):
8298 q.breakable()
8299 q.text("xid = ");
8300 if self.xid != None:
8301 q.text("%#x" % self.xid)
8302 else:
8303 q.text('None')
8304 q.text(","); q.breakable()
8305 q.text("status = ");
8306 q.text("%#x" % self.status)
8307 q.text(","); q.breakable()
8308 q.text("vport_no = ");
8309 q.text("%#x" % self.vport_no)
8310 q.breakable()
8311 q.text('}')
8312
8313bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8314
8315class bsn_virtual_port_create_request(bsn_header):
8316 version = 5
8317 type = 4
8318 experimenter = 6035143
8319 subtype = 15
8320
8321 def __init__(self, xid=None, vport=None):
8322 if xid != None:
8323 self.xid = xid
8324 else:
8325 self.xid = None
8326 if vport != None:
8327 self.vport = vport
8328 else:
Rich Lanee2567702015-01-26 15:04:35 -08008329 self.vport = ofp.bsn_vport()
Rich Lane2e079da2014-10-29 15:30:24 -07008330 return
8331
8332 def pack(self):
8333 packed = []
8334 packed.append(struct.pack("!B", self.version))
8335 packed.append(struct.pack("!B", self.type))
8336 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8337 packed.append(struct.pack("!L", self.xid))
8338 packed.append(struct.pack("!L", self.experimenter))
8339 packed.append(struct.pack("!L", self.subtype))
8340 packed.append(self.vport.pack())
8341 length = sum([len(x) for x in packed])
8342 packed[2] = struct.pack("!H", length)
8343 return ''.join(packed)
8344
8345 @staticmethod
8346 def unpack(reader):
8347 obj = bsn_virtual_port_create_request()
8348 _version = reader.read("!B")[0]
8349 assert(_version == 5)
8350 _type = reader.read("!B")[0]
8351 assert(_type == 4)
8352 _length = reader.read("!H")[0]
8353 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008354 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008355 obj.xid = reader.read("!L")[0]
8356 _experimenter = reader.read("!L")[0]
8357 assert(_experimenter == 6035143)
8358 _subtype = reader.read("!L")[0]
8359 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008360 obj.vport = ofp.bsn_vport.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -07008361 return obj
8362
8363 def __eq__(self, other):
8364 if type(self) != type(other): return False
8365 if self.xid != other.xid: return False
8366 if self.vport != other.vport: return False
8367 return True
8368
8369 def pretty_print(self, q):
8370 q.text("bsn_virtual_port_create_request {")
8371 with q.group():
8372 with q.indent(2):
8373 q.breakable()
8374 q.text("xid = ");
8375 if self.xid != None:
8376 q.text("%#x" % self.xid)
8377 else:
8378 q.text('None')
8379 q.text(","); q.breakable()
8380 q.text("vport = ");
8381 q.pp(self.vport)
8382 q.breakable()
8383 q.text('}')
8384
8385bsn_header.subtypes[15] = bsn_virtual_port_create_request
8386
8387class bsn_virtual_port_remove_reply(bsn_header):
8388 version = 5
8389 type = 4
8390 experimenter = 6035143
8391 subtype = 26
8392
8393 def __init__(self, xid=None, status=None):
8394 if xid != None:
8395 self.xid = xid
8396 else:
8397 self.xid = None
8398 if status != None:
8399 self.status = status
8400 else:
8401 self.status = 0
8402 return
8403
8404 def pack(self):
8405 packed = []
8406 packed.append(struct.pack("!B", self.version))
8407 packed.append(struct.pack("!B", self.type))
8408 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8409 packed.append(struct.pack("!L", self.xid))
8410 packed.append(struct.pack("!L", self.experimenter))
8411 packed.append(struct.pack("!L", self.subtype))
8412 packed.append(struct.pack("!L", self.status))
8413 length = sum([len(x) for x in packed])
8414 packed[2] = struct.pack("!H", length)
8415 return ''.join(packed)
8416
8417 @staticmethod
8418 def unpack(reader):
8419 obj = bsn_virtual_port_remove_reply()
8420 _version = reader.read("!B")[0]
8421 assert(_version == 5)
8422 _type = reader.read("!B")[0]
8423 assert(_type == 4)
8424 _length = reader.read("!H")[0]
8425 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008426 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008427 obj.xid = reader.read("!L")[0]
8428 _experimenter = reader.read("!L")[0]
8429 assert(_experimenter == 6035143)
8430 _subtype = reader.read("!L")[0]
8431 assert(_subtype == 26)
8432 obj.status = reader.read("!L")[0]
8433 return obj
8434
8435 def __eq__(self, other):
8436 if type(self) != type(other): return False
8437 if self.xid != other.xid: return False
8438 if self.status != other.status: return False
8439 return True
8440
8441 def pretty_print(self, q):
8442 q.text("bsn_virtual_port_remove_reply {")
8443 with q.group():
8444 with q.indent(2):
8445 q.breakable()
8446 q.text("xid = ");
8447 if self.xid != None:
8448 q.text("%#x" % self.xid)
8449 else:
8450 q.text('None')
8451 q.text(","); q.breakable()
8452 q.text("status = ");
8453 q.text("%#x" % self.status)
8454 q.breakable()
8455 q.text('}')
8456
8457bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8458
8459class bsn_virtual_port_remove_request(bsn_header):
8460 version = 5
8461 type = 4
8462 experimenter = 6035143
8463 subtype = 17
8464
8465 def __init__(self, xid=None, vport_no=None):
8466 if xid != None:
8467 self.xid = xid
8468 else:
8469 self.xid = None
8470 if vport_no != None:
8471 self.vport_no = vport_no
8472 else:
8473 self.vport_no = 0
8474 return
8475
8476 def pack(self):
8477 packed = []
8478 packed.append(struct.pack("!B", self.version))
8479 packed.append(struct.pack("!B", self.type))
8480 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8481 packed.append(struct.pack("!L", self.xid))
8482 packed.append(struct.pack("!L", self.experimenter))
8483 packed.append(struct.pack("!L", self.subtype))
8484 packed.append(struct.pack("!L", self.vport_no))
8485 length = sum([len(x) for x in packed])
8486 packed[2] = struct.pack("!H", length)
8487 return ''.join(packed)
8488
8489 @staticmethod
8490 def unpack(reader):
8491 obj = bsn_virtual_port_remove_request()
8492 _version = reader.read("!B")[0]
8493 assert(_version == 5)
8494 _type = reader.read("!B")[0]
8495 assert(_type == 4)
8496 _length = reader.read("!H")[0]
8497 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008498 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008499 obj.xid = reader.read("!L")[0]
8500 _experimenter = reader.read("!L")[0]
8501 assert(_experimenter == 6035143)
8502 _subtype = reader.read("!L")[0]
8503 assert(_subtype == 17)
8504 obj.vport_no = reader.read("!L")[0]
8505 return obj
8506
8507 def __eq__(self, other):
8508 if type(self) != type(other): return False
8509 if self.xid != other.xid: return False
8510 if self.vport_no != other.vport_no: return False
8511 return True
8512
8513 def pretty_print(self, q):
8514 q.text("bsn_virtual_port_remove_request {")
8515 with q.group():
8516 with q.indent(2):
8517 q.breakable()
8518 q.text("xid = ");
8519 if self.xid != None:
8520 q.text("%#x" % self.xid)
8521 else:
8522 q.text('None')
8523 q.text(","); q.breakable()
8524 q.text("vport_no = ");
8525 q.text("%#x" % self.vport_no)
8526 q.breakable()
8527 q.text('}')
8528
8529bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8530
Rich Laneccd32ed2014-11-10 17:48:24 -08008531class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8532 version = 5
8533 type = 19
8534 stats_type = 65535
8535 experimenter = 6035143
8536 subtype = 9
8537
8538 def __init__(self, xid=None, flags=None, entries=None):
8539 if xid != None:
8540 self.xid = xid
8541 else:
8542 self.xid = None
8543 if flags != None:
8544 self.flags = flags
8545 else:
8546 self.flags = 0
8547 if entries != None:
8548 self.entries = entries
8549 else:
8550 self.entries = []
8551 return
8552
8553 def pack(self):
8554 packed = []
8555 packed.append(struct.pack("!B", self.version))
8556 packed.append(struct.pack("!B", self.type))
8557 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8558 packed.append(struct.pack("!L", self.xid))
8559 packed.append(struct.pack("!H", self.stats_type))
8560 packed.append(struct.pack("!H", self.flags))
8561 packed.append('\x00' * 4)
8562 packed.append(struct.pack("!L", self.experimenter))
8563 packed.append(struct.pack("!L", self.subtype))
8564 packed.append(loxi.generic_util.pack_list(self.entries))
8565 length = sum([len(x) for x in packed])
8566 packed[2] = struct.pack("!H", length)
8567 return ''.join(packed)
8568
8569 @staticmethod
8570 def unpack(reader):
8571 obj = bsn_vlan_counter_stats_reply()
8572 _version = reader.read("!B")[0]
8573 assert(_version == 5)
8574 _type = reader.read("!B")[0]
8575 assert(_type == 19)
8576 _length = reader.read("!H")[0]
8577 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008578 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008579 obj.xid = reader.read("!L")[0]
8580 _stats_type = reader.read("!H")[0]
8581 assert(_stats_type == 65535)
8582 obj.flags = reader.read("!H")[0]
8583 reader.skip(4)
8584 _experimenter = reader.read("!L")[0]
8585 assert(_experimenter == 6035143)
8586 _subtype = reader.read("!L")[0]
8587 assert(_subtype == 9)
Rich Lanee2567702015-01-26 15:04:35 -08008588 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08008589 return obj
8590
8591 def __eq__(self, other):
8592 if type(self) != type(other): return False
8593 if self.xid != other.xid: return False
8594 if self.flags != other.flags: return False
8595 if self.entries != other.entries: return False
8596 return True
8597
8598 def pretty_print(self, q):
8599 q.text("bsn_vlan_counter_stats_reply {")
8600 with q.group():
8601 with q.indent(2):
8602 q.breakable()
8603 q.text("xid = ");
8604 if self.xid != None:
8605 q.text("%#x" % self.xid)
8606 else:
8607 q.text('None')
8608 q.text(","); q.breakable()
8609 q.text("flags = ");
8610 q.text("%#x" % self.flags)
8611 q.text(","); q.breakable()
8612 q.text("entries = ");
8613 q.pp(self.entries)
8614 q.breakable()
8615 q.text('}')
8616
8617bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8618
8619class bsn_vlan_counter_stats_request(bsn_stats_request):
8620 version = 5
8621 type = 18
8622 stats_type = 65535
8623 experimenter = 6035143
8624 subtype = 9
8625
8626 def __init__(self, xid=None, flags=None, vlan_vid=None):
8627 if xid != None:
8628 self.xid = xid
8629 else:
8630 self.xid = None
8631 if flags != None:
8632 self.flags = flags
8633 else:
8634 self.flags = 0
8635 if vlan_vid != None:
8636 self.vlan_vid = vlan_vid
8637 else:
8638 self.vlan_vid = 0
8639 return
8640
8641 def pack(self):
8642 packed = []
8643 packed.append(struct.pack("!B", self.version))
8644 packed.append(struct.pack("!B", self.type))
8645 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8646 packed.append(struct.pack("!L", self.xid))
8647 packed.append(struct.pack("!H", self.stats_type))
8648 packed.append(struct.pack("!H", self.flags))
8649 packed.append('\x00' * 4)
8650 packed.append(struct.pack("!L", self.experimenter))
8651 packed.append(struct.pack("!L", self.subtype))
8652 packed.append(struct.pack("!H", self.vlan_vid))
8653 length = sum([len(x) for x in packed])
8654 packed[2] = struct.pack("!H", length)
8655 return ''.join(packed)
8656
8657 @staticmethod
8658 def unpack(reader):
8659 obj = bsn_vlan_counter_stats_request()
8660 _version = reader.read("!B")[0]
8661 assert(_version == 5)
8662 _type = reader.read("!B")[0]
8663 assert(_type == 18)
8664 _length = reader.read("!H")[0]
8665 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008666 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008667 obj.xid = reader.read("!L")[0]
8668 _stats_type = reader.read("!H")[0]
8669 assert(_stats_type == 65535)
8670 obj.flags = reader.read("!H")[0]
8671 reader.skip(4)
8672 _experimenter = reader.read("!L")[0]
8673 assert(_experimenter == 6035143)
8674 _subtype = reader.read("!L")[0]
8675 assert(_subtype == 9)
8676 obj.vlan_vid = reader.read("!H")[0]
8677 return obj
8678
8679 def __eq__(self, other):
8680 if type(self) != type(other): return False
8681 if self.xid != other.xid: return False
8682 if self.flags != other.flags: return False
8683 if self.vlan_vid != other.vlan_vid: return False
8684 return True
8685
8686 def pretty_print(self, q):
8687 q.text("bsn_vlan_counter_stats_request {")
8688 with q.group():
8689 with q.indent(2):
8690 q.breakable()
8691 q.text("xid = ");
8692 if self.xid != None:
8693 q.text("%#x" % self.xid)
8694 else:
8695 q.text('None')
8696 q.text(","); q.breakable()
8697 q.text("flags = ");
8698 q.text("%#x" % self.flags)
8699 q.text(","); q.breakable()
8700 q.text("vlan_vid = ");
8701 q.text("%#x" % self.vlan_vid)
8702 q.breakable()
8703 q.text('}')
8704
8705bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8706
8707class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8708 version = 5
8709 type = 19
8710 stats_type = 65535
8711 experimenter = 6035143
8712 subtype = 15
8713
8714 def __init__(self, xid=None, flags=None, entries=None):
8715 if xid != None:
8716 self.xid = xid
8717 else:
8718 self.xid = None
8719 if flags != None:
8720 self.flags = flags
8721 else:
8722 self.flags = 0
8723 if entries != None:
8724 self.entries = entries
8725 else:
8726 self.entries = []
8727 return
8728
8729 def pack(self):
8730 packed = []
8731 packed.append(struct.pack("!B", self.version))
8732 packed.append(struct.pack("!B", self.type))
8733 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8734 packed.append(struct.pack("!L", self.xid))
8735 packed.append(struct.pack("!H", self.stats_type))
8736 packed.append(struct.pack("!H", self.flags))
8737 packed.append('\x00' * 4)
8738 packed.append(struct.pack("!L", self.experimenter))
8739 packed.append(struct.pack("!L", self.subtype))
8740 packed.append(loxi.generic_util.pack_list(self.entries))
8741 length = sum([len(x) for x in packed])
8742 packed[2] = struct.pack("!H", length)
8743 return ''.join(packed)
8744
8745 @staticmethod
8746 def unpack(reader):
8747 obj = bsn_vrf_counter_stats_reply()
8748 _version = reader.read("!B")[0]
8749 assert(_version == 5)
8750 _type = reader.read("!B")[0]
8751 assert(_type == 19)
8752 _length = reader.read("!H")[0]
8753 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008754 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008755 obj.xid = reader.read("!L")[0]
8756 _stats_type = reader.read("!H")[0]
8757 assert(_stats_type == 65535)
8758 obj.flags = reader.read("!H")[0]
8759 reader.skip(4)
8760 _experimenter = reader.read("!L")[0]
8761 assert(_experimenter == 6035143)
8762 _subtype = reader.read("!L")[0]
8763 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008764 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
Rich Laneccd32ed2014-11-10 17:48:24 -08008765 return obj
8766
8767 def __eq__(self, other):
8768 if type(self) != type(other): return False
8769 if self.xid != other.xid: return False
8770 if self.flags != other.flags: return False
8771 if self.entries != other.entries: return False
8772 return True
8773
8774 def pretty_print(self, q):
8775 q.text("bsn_vrf_counter_stats_reply {")
8776 with q.group():
8777 with q.indent(2):
8778 q.breakable()
8779 q.text("xid = ");
8780 if self.xid != None:
8781 q.text("%#x" % self.xid)
8782 else:
8783 q.text('None')
8784 q.text(","); q.breakable()
8785 q.text("flags = ");
8786 q.text("%#x" % self.flags)
8787 q.text(","); q.breakable()
8788 q.text("entries = ");
8789 q.pp(self.entries)
8790 q.breakable()
8791 q.text('}')
8792
8793bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8794
8795class bsn_vrf_counter_stats_request(bsn_stats_request):
8796 version = 5
8797 type = 18
8798 stats_type = 65535
8799 experimenter = 6035143
8800 subtype = 15
8801
8802 def __init__(self, xid=None, flags=None, vrf=None):
8803 if xid != None:
8804 self.xid = xid
8805 else:
8806 self.xid = None
8807 if flags != None:
8808 self.flags = flags
8809 else:
8810 self.flags = 0
8811 if vrf != None:
8812 self.vrf = vrf
8813 else:
8814 self.vrf = 0
8815 return
8816
8817 def pack(self):
8818 packed = []
8819 packed.append(struct.pack("!B", self.version))
8820 packed.append(struct.pack("!B", self.type))
8821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8822 packed.append(struct.pack("!L", self.xid))
8823 packed.append(struct.pack("!H", self.stats_type))
8824 packed.append(struct.pack("!H", self.flags))
8825 packed.append('\x00' * 4)
8826 packed.append(struct.pack("!L", self.experimenter))
8827 packed.append(struct.pack("!L", self.subtype))
8828 packed.append(struct.pack("!L", self.vrf))
8829 length = sum([len(x) for x in packed])
8830 packed[2] = struct.pack("!H", length)
8831 return ''.join(packed)
8832
8833 @staticmethod
8834 def unpack(reader):
8835 obj = bsn_vrf_counter_stats_request()
8836 _version = reader.read("!B")[0]
8837 assert(_version == 5)
8838 _type = reader.read("!B")[0]
8839 assert(_type == 18)
8840 _length = reader.read("!H")[0]
8841 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008842 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08008843 obj.xid = reader.read("!L")[0]
8844 _stats_type = reader.read("!H")[0]
8845 assert(_stats_type == 65535)
8846 obj.flags = reader.read("!H")[0]
8847 reader.skip(4)
8848 _experimenter = reader.read("!L")[0]
8849 assert(_experimenter == 6035143)
8850 _subtype = reader.read("!L")[0]
8851 assert(_subtype == 15)
8852 obj.vrf = reader.read("!L")[0]
8853 return obj
8854
8855 def __eq__(self, other):
8856 if type(self) != type(other): return False
8857 if self.xid != other.xid: return False
8858 if self.flags != other.flags: return False
8859 if self.vrf != other.vrf: return False
8860 return True
8861
8862 def pretty_print(self, q):
8863 q.text("bsn_vrf_counter_stats_request {")
8864 with q.group():
8865 with q.indent(2):
8866 q.breakable()
8867 q.text("xid = ");
8868 if self.xid != None:
8869 q.text("%#x" % self.xid)
8870 else:
8871 q.text('None')
8872 q.text(","); q.breakable()
8873 q.text("flags = ");
8874 q.text("%#x" % self.flags)
8875 q.text(","); q.breakable()
8876 q.text("vrf = ");
8877 q.text("%#x" % self.vrf)
8878 q.breakable()
8879 q.text('}')
8880
8881bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8882
Rich Lane2e079da2014-10-29 15:30:24 -07008883class bundle_add_msg(message):
8884 version = 5
8885 type = 34
8886
8887 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
8888 if xid != None:
8889 self.xid = xid
8890 else:
8891 self.xid = None
8892 if bundle_id != None:
8893 self.bundle_id = bundle_id
8894 else:
8895 self.bundle_id = 0
8896 if flags != None:
8897 self.flags = flags
8898 else:
8899 self.flags = 0
8900 if data != None:
8901 self.data = data
8902 else:
8903 self.data = ''
8904 return
8905
8906 def pack(self):
8907 packed = []
8908 packed.append(struct.pack("!B", self.version))
8909 packed.append(struct.pack("!B", self.type))
8910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8911 packed.append(struct.pack("!L", self.xid))
8912 packed.append(struct.pack("!L", self.bundle_id))
8913 packed.append('\x00' * 2)
8914 packed.append(struct.pack("!H", self.flags))
8915 packed.append(self.data)
8916 length = sum([len(x) for x in packed])
8917 packed[2] = struct.pack("!H", length)
8918 return ''.join(packed)
8919
8920 @staticmethod
8921 def unpack(reader):
8922 obj = bundle_add_msg()
8923 _version = reader.read("!B")[0]
8924 assert(_version == 5)
8925 _type = reader.read("!B")[0]
8926 assert(_type == 34)
8927 _length = reader.read("!H")[0]
8928 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008929 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07008930 obj.xid = reader.read("!L")[0]
8931 obj.bundle_id = reader.read("!L")[0]
8932 reader.skip(2)
8933 obj.flags = reader.read("!H")[0]
8934 obj.data = str(reader.read_all())
8935 return obj
8936
8937 def __eq__(self, other):
8938 if type(self) != type(other): return False
8939 if self.xid != other.xid: return False
8940 if self.bundle_id != other.bundle_id: return False
8941 if self.flags != other.flags: return False
8942 if self.data != other.data: return False
8943 return True
8944
8945 def pretty_print(self, q):
8946 q.text("bundle_add_msg {")
8947 with q.group():
8948 with q.indent(2):
8949 q.breakable()
8950 q.text("xid = ");
8951 if self.xid != None:
8952 q.text("%#x" % self.xid)
8953 else:
8954 q.text('None')
8955 q.text(","); q.breakable()
8956 q.text("bundle_id = ");
8957 q.text("%#x" % self.bundle_id)
8958 q.text(","); q.breakable()
8959 q.text("flags = ");
8960 q.text("%#x" % self.flags)
8961 q.text(","); q.breakable()
8962 q.text("data = ");
8963 q.pp(self.data)
8964 q.breakable()
8965 q.text('}')
8966
8967message.subtypes[34] = bundle_add_msg
8968
8969class bundle_ctrl_msg(message):
8970 version = 5
8971 type = 33
8972
8973 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
8974 if xid != None:
8975 self.xid = xid
8976 else:
8977 self.xid = None
8978 if bundle_id != None:
8979 self.bundle_id = bundle_id
8980 else:
8981 self.bundle_id = 0
8982 if bundle_ctrl_type != None:
8983 self.bundle_ctrl_type = bundle_ctrl_type
8984 else:
8985 self.bundle_ctrl_type = 0
8986 if flags != None:
8987 self.flags = flags
8988 else:
8989 self.flags = 0
8990 if properties != None:
8991 self.properties = properties
8992 else:
8993 self.properties = []
8994 return
8995
8996 def pack(self):
8997 packed = []
8998 packed.append(struct.pack("!B", self.version))
8999 packed.append(struct.pack("!B", self.type))
9000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9001 packed.append(struct.pack("!L", self.xid))
9002 packed.append(struct.pack("!L", self.bundle_id))
9003 packed.append(struct.pack("!H", self.bundle_ctrl_type))
9004 packed.append(struct.pack("!H", self.flags))
9005 packed.append(loxi.generic_util.pack_list(self.properties))
9006 length = sum([len(x) for x in packed])
9007 packed[2] = struct.pack("!H", length)
9008 return ''.join(packed)
9009
9010 @staticmethod
9011 def unpack(reader):
9012 obj = bundle_ctrl_msg()
9013 _version = reader.read("!B")[0]
9014 assert(_version == 5)
9015 _type = reader.read("!B")[0]
9016 assert(_type == 33)
9017 _length = reader.read("!H")[0]
9018 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009019 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009020 obj.xid = reader.read("!L")[0]
9021 obj.bundle_id = reader.read("!L")[0]
9022 obj.bundle_ctrl_type = reader.read("!H")[0]
9023 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08009024 obj.properties = loxi.generic_util.unpack_list(reader, ofp.bundle_prop.bundle_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07009025 return obj
9026
9027 def __eq__(self, other):
9028 if type(self) != type(other): return False
9029 if self.xid != other.xid: return False
9030 if self.bundle_id != other.bundle_id: return False
9031 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
9032 if self.flags != other.flags: return False
9033 if self.properties != other.properties: return False
9034 return True
9035
9036 def pretty_print(self, q):
9037 q.text("bundle_ctrl_msg {")
9038 with q.group():
9039 with q.indent(2):
9040 q.breakable()
9041 q.text("xid = ");
9042 if self.xid != None:
9043 q.text("%#x" % self.xid)
9044 else:
9045 q.text('None')
9046 q.text(","); q.breakable()
9047 q.text("bundle_id = ");
9048 q.text("%#x" % self.bundle_id)
9049 q.text(","); q.breakable()
9050 q.text("bundle_ctrl_type = ");
9051 q.text("%#x" % self.bundle_ctrl_type)
9052 q.text(","); q.breakable()
9053 q.text("flags = ");
9054 q.text("%#x" % self.flags)
9055 q.text(","); q.breakable()
9056 q.text("properties = ");
9057 q.pp(self.properties)
9058 q.breakable()
9059 q.text('}')
9060
9061message.subtypes[33] = bundle_ctrl_msg
9062
Rich Laneccd32ed2014-11-10 17:48:24 -08009063class bundle_failed_error_msg(error_msg):
9064 version = 5
9065 type = 1
9066 err_type = 17
9067
9068 def __init__(self, xid=None, code=None, data=None):
9069 if xid != None:
9070 self.xid = xid
9071 else:
9072 self.xid = None
9073 if code != None:
9074 self.code = code
9075 else:
9076 self.code = 0
9077 if data != None:
9078 self.data = data
9079 else:
9080 self.data = ''
9081 return
9082
9083 def pack(self):
9084 packed = []
9085 packed.append(struct.pack("!B", self.version))
9086 packed.append(struct.pack("!B", self.type))
9087 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9088 packed.append(struct.pack("!L", self.xid))
9089 packed.append(struct.pack("!H", self.err_type))
9090 packed.append(struct.pack("!H", self.code))
9091 packed.append(self.data)
9092 length = sum([len(x) for x in packed])
9093 packed[2] = struct.pack("!H", length)
9094 return ''.join(packed)
9095
9096 @staticmethod
9097 def unpack(reader):
9098 obj = bundle_failed_error_msg()
9099 _version = reader.read("!B")[0]
9100 assert(_version == 5)
9101 _type = reader.read("!B")[0]
9102 assert(_type == 1)
9103 _length = reader.read("!H")[0]
9104 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009105 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08009106 obj.xid = reader.read("!L")[0]
9107 _err_type = reader.read("!H")[0]
9108 assert(_err_type == 17)
9109 obj.code = reader.read("!H")[0]
9110 obj.data = str(reader.read_all())
9111 return obj
9112
9113 def __eq__(self, other):
9114 if type(self) != type(other): return False
9115 if self.xid != other.xid: return False
9116 if self.code != other.code: return False
9117 if self.data != other.data: return False
9118 return True
9119
9120 def pretty_print(self, q):
9121 q.text("bundle_failed_error_msg {")
9122 with q.group():
9123 with q.indent(2):
9124 q.breakable()
9125 q.text("xid = ");
9126 if self.xid != None:
9127 q.text("%#x" % self.xid)
9128 else:
9129 q.text('None')
9130 q.text(","); q.breakable()
9131 q.text("code = ");
9132 q.text("%#x" % self.code)
9133 q.text(","); q.breakable()
9134 q.text("data = ");
9135 q.pp(self.data)
9136 q.breakable()
9137 q.text('}')
9138
9139error_msg.subtypes[17] = bundle_failed_error_msg
9140
Rich Lane2e079da2014-10-29 15:30:24 -07009141class desc_stats_reply(stats_reply):
9142 version = 5
9143 type = 19
9144 stats_type = 0
9145
9146 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
9147 if xid != None:
9148 self.xid = xid
9149 else:
9150 self.xid = None
9151 if flags != None:
9152 self.flags = flags
9153 else:
9154 self.flags = 0
9155 if mfr_desc != None:
9156 self.mfr_desc = mfr_desc
9157 else:
9158 self.mfr_desc = ""
9159 if hw_desc != None:
9160 self.hw_desc = hw_desc
9161 else:
9162 self.hw_desc = ""
9163 if sw_desc != None:
9164 self.sw_desc = sw_desc
9165 else:
9166 self.sw_desc = ""
9167 if serial_num != None:
9168 self.serial_num = serial_num
9169 else:
9170 self.serial_num = ""
9171 if dp_desc != None:
9172 self.dp_desc = dp_desc
9173 else:
9174 self.dp_desc = ""
9175 return
9176
9177 def pack(self):
9178 packed = []
9179 packed.append(struct.pack("!B", self.version))
9180 packed.append(struct.pack("!B", self.type))
9181 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9182 packed.append(struct.pack("!L", self.xid))
9183 packed.append(struct.pack("!H", self.stats_type))
9184 packed.append(struct.pack("!H", self.flags))
9185 packed.append('\x00' * 4)
9186 packed.append(struct.pack("!256s", self.mfr_desc))
9187 packed.append(struct.pack("!256s", self.hw_desc))
9188 packed.append(struct.pack("!256s", self.sw_desc))
9189 packed.append(struct.pack("!32s", self.serial_num))
9190 packed.append(struct.pack("!256s", self.dp_desc))
9191 length = sum([len(x) for x in packed])
9192 packed[2] = struct.pack("!H", length)
9193 return ''.join(packed)
9194
9195 @staticmethod
9196 def unpack(reader):
9197 obj = desc_stats_reply()
9198 _version = reader.read("!B")[0]
9199 assert(_version == 5)
9200 _type = reader.read("!B")[0]
9201 assert(_type == 19)
9202 _length = reader.read("!H")[0]
9203 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009204 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009205 obj.xid = reader.read("!L")[0]
9206 _stats_type = reader.read("!H")[0]
9207 assert(_stats_type == 0)
9208 obj.flags = reader.read("!H")[0]
9209 reader.skip(4)
9210 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9211 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9212 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9213 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9214 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9215 return obj
9216
9217 def __eq__(self, other):
9218 if type(self) != type(other): return False
9219 if self.xid != other.xid: return False
9220 if self.flags != other.flags: return False
9221 if self.mfr_desc != other.mfr_desc: return False
9222 if self.hw_desc != other.hw_desc: return False
9223 if self.sw_desc != other.sw_desc: return False
9224 if self.serial_num != other.serial_num: return False
9225 if self.dp_desc != other.dp_desc: return False
9226 return True
9227
9228 def pretty_print(self, q):
9229 q.text("desc_stats_reply {")
9230 with q.group():
9231 with q.indent(2):
9232 q.breakable()
9233 q.text("xid = ");
9234 if self.xid != None:
9235 q.text("%#x" % self.xid)
9236 else:
9237 q.text('None')
9238 q.text(","); q.breakable()
9239 q.text("flags = ");
9240 q.text("%#x" % self.flags)
9241 q.text(","); q.breakable()
9242 q.text("mfr_desc = ");
9243 q.pp(self.mfr_desc)
9244 q.text(","); q.breakable()
9245 q.text("hw_desc = ");
9246 q.pp(self.hw_desc)
9247 q.text(","); q.breakable()
9248 q.text("sw_desc = ");
9249 q.pp(self.sw_desc)
9250 q.text(","); q.breakable()
9251 q.text("serial_num = ");
9252 q.pp(self.serial_num)
9253 q.text(","); q.breakable()
9254 q.text("dp_desc = ");
9255 q.pp(self.dp_desc)
9256 q.breakable()
9257 q.text('}')
9258
9259stats_reply.subtypes[0] = desc_stats_reply
9260
9261class desc_stats_request(stats_request):
9262 version = 5
9263 type = 18
9264 stats_type = 0
9265
9266 def __init__(self, xid=None, flags=None):
9267 if xid != None:
9268 self.xid = xid
9269 else:
9270 self.xid = None
9271 if flags != None:
9272 self.flags = flags
9273 else:
9274 self.flags = 0
9275 return
9276
9277 def pack(self):
9278 packed = []
9279 packed.append(struct.pack("!B", self.version))
9280 packed.append(struct.pack("!B", self.type))
9281 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9282 packed.append(struct.pack("!L", self.xid))
9283 packed.append(struct.pack("!H", self.stats_type))
9284 packed.append(struct.pack("!H", self.flags))
9285 packed.append('\x00' * 4)
9286 length = sum([len(x) for x in packed])
9287 packed[2] = struct.pack("!H", length)
9288 return ''.join(packed)
9289
9290 @staticmethod
9291 def unpack(reader):
9292 obj = desc_stats_request()
9293 _version = reader.read("!B")[0]
9294 assert(_version == 5)
9295 _type = reader.read("!B")[0]
9296 assert(_type == 18)
9297 _length = reader.read("!H")[0]
9298 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009299 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009300 obj.xid = reader.read("!L")[0]
9301 _stats_type = reader.read("!H")[0]
9302 assert(_stats_type == 0)
9303 obj.flags = reader.read("!H")[0]
9304 reader.skip(4)
9305 return obj
9306
9307 def __eq__(self, other):
9308 if type(self) != type(other): return False
9309 if self.xid != other.xid: return False
9310 if self.flags != other.flags: return False
9311 return True
9312
9313 def pretty_print(self, q):
9314 q.text("desc_stats_request {")
9315 with q.group():
9316 with q.indent(2):
9317 q.breakable()
9318 q.text("xid = ");
9319 if self.xid != None:
9320 q.text("%#x" % self.xid)
9321 else:
9322 q.text('None')
9323 q.text(","); q.breakable()
9324 q.text("flags = ");
9325 q.text("%#x" % self.flags)
9326 q.breakable()
9327 q.text('}')
9328
9329stats_request.subtypes[0] = desc_stats_request
9330
9331class echo_reply(message):
9332 version = 5
9333 type = 3
9334
9335 def __init__(self, xid=None, data=None):
9336 if xid != None:
9337 self.xid = xid
9338 else:
9339 self.xid = None
9340 if data != None:
9341 self.data = data
9342 else:
9343 self.data = ''
9344 return
9345
9346 def pack(self):
9347 packed = []
9348 packed.append(struct.pack("!B", self.version))
9349 packed.append(struct.pack("!B", self.type))
9350 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9351 packed.append(struct.pack("!L", self.xid))
9352 packed.append(self.data)
9353 length = sum([len(x) for x in packed])
9354 packed[2] = struct.pack("!H", length)
9355 return ''.join(packed)
9356
9357 @staticmethod
9358 def unpack(reader):
9359 obj = echo_reply()
9360 _version = reader.read("!B")[0]
9361 assert(_version == 5)
9362 _type = reader.read("!B")[0]
9363 assert(_type == 3)
9364 _length = reader.read("!H")[0]
9365 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009366 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009367 obj.xid = reader.read("!L")[0]
9368 obj.data = str(reader.read_all())
9369 return obj
9370
9371 def __eq__(self, other):
9372 if type(self) != type(other): return False
9373 if self.xid != other.xid: return False
9374 if self.data != other.data: return False
9375 return True
9376
9377 def pretty_print(self, q):
9378 q.text("echo_reply {")
9379 with q.group():
9380 with q.indent(2):
9381 q.breakable()
9382 q.text("xid = ");
9383 if self.xid != None:
9384 q.text("%#x" % self.xid)
9385 else:
9386 q.text('None')
9387 q.text(","); q.breakable()
9388 q.text("data = ");
9389 q.pp(self.data)
9390 q.breakable()
9391 q.text('}')
9392
9393message.subtypes[3] = echo_reply
9394
9395class echo_request(message):
9396 version = 5
9397 type = 2
9398
9399 def __init__(self, xid=None, data=None):
9400 if xid != None:
9401 self.xid = xid
9402 else:
9403 self.xid = None
9404 if data != None:
9405 self.data = data
9406 else:
9407 self.data = ''
9408 return
9409
9410 def pack(self):
9411 packed = []
9412 packed.append(struct.pack("!B", self.version))
9413 packed.append(struct.pack("!B", self.type))
9414 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9415 packed.append(struct.pack("!L", self.xid))
9416 packed.append(self.data)
9417 length = sum([len(x) for x in packed])
9418 packed[2] = struct.pack("!H", length)
9419 return ''.join(packed)
9420
9421 @staticmethod
9422 def unpack(reader):
9423 obj = echo_request()
9424 _version = reader.read("!B")[0]
9425 assert(_version == 5)
9426 _type = reader.read("!B")[0]
9427 assert(_type == 2)
9428 _length = reader.read("!H")[0]
9429 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009430 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009431 obj.xid = reader.read("!L")[0]
9432 obj.data = str(reader.read_all())
9433 return obj
9434
9435 def __eq__(self, other):
9436 if type(self) != type(other): return False
9437 if self.xid != other.xid: return False
9438 if self.data != other.data: return False
9439 return True
9440
9441 def pretty_print(self, q):
9442 q.text("echo_request {")
9443 with q.group():
9444 with q.indent(2):
9445 q.breakable()
9446 q.text("xid = ");
9447 if self.xid != None:
9448 q.text("%#x" % self.xid)
9449 else:
9450 q.text('None')
9451 q.text(","); q.breakable()
9452 q.text("data = ");
9453 q.pp(self.data)
9454 q.breakable()
9455 q.text('}')
9456
9457message.subtypes[2] = echo_request
9458
9459class experimenter_error_msg(error_msg):
9460 version = 5
9461 type = 1
9462 err_type = 65535
9463
9464 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
9465 if xid != None:
9466 self.xid = xid
9467 else:
9468 self.xid = None
9469 if subtype != None:
9470 self.subtype = subtype
9471 else:
9472 self.subtype = 0
9473 if experimenter != None:
9474 self.experimenter = experimenter
9475 else:
9476 self.experimenter = 0
9477 if data != None:
9478 self.data = data
9479 else:
9480 self.data = ''
9481 return
9482
9483 def pack(self):
9484 packed = []
9485 packed.append(struct.pack("!B", self.version))
9486 packed.append(struct.pack("!B", self.type))
9487 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9488 packed.append(struct.pack("!L", self.xid))
9489 packed.append(struct.pack("!H", self.err_type))
9490 packed.append(struct.pack("!H", self.subtype))
9491 packed.append(struct.pack("!L", self.experimenter))
9492 packed.append(self.data)
9493 length = sum([len(x) for x in packed])
9494 packed[2] = struct.pack("!H", length)
9495 return ''.join(packed)
9496
9497 @staticmethod
9498 def unpack(reader):
9499 obj = experimenter_error_msg()
9500 _version = reader.read("!B")[0]
9501 assert(_version == 5)
9502 _type = reader.read("!B")[0]
9503 assert(_type == 1)
9504 _length = reader.read("!H")[0]
9505 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009506 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009507 obj.xid = reader.read("!L")[0]
9508 _err_type = reader.read("!H")[0]
9509 assert(_err_type == 65535)
9510 obj.subtype = reader.read("!H")[0]
9511 obj.experimenter = reader.read("!L")[0]
9512 obj.data = str(reader.read_all())
9513 return obj
9514
9515 def __eq__(self, other):
9516 if type(self) != type(other): return False
9517 if self.xid != other.xid: return False
9518 if self.subtype != other.subtype: return False
9519 if self.experimenter != other.experimenter: return False
9520 if self.data != other.data: return False
9521 return True
9522
9523 def pretty_print(self, q):
9524 q.text("experimenter_error_msg {")
9525 with q.group():
9526 with q.indent(2):
9527 q.breakable()
9528 q.text("xid = ");
9529 if self.xid != None:
9530 q.text("%#x" % self.xid)
9531 else:
9532 q.text('None')
9533 q.text(","); q.breakable()
9534 q.text("subtype = ");
9535 q.text("%#x" % self.subtype)
9536 q.text(","); q.breakable()
9537 q.text("experimenter = ");
9538 q.text("%#x" % self.experimenter)
9539 q.text(","); q.breakable()
9540 q.text("data = ");
9541 q.pp(self.data)
9542 q.breakable()
9543 q.text('}')
9544
9545error_msg.subtypes[65535] = experimenter_error_msg
9546
9547class features_reply(message):
9548 version = 5
9549 type = 6
9550
9551 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
9552 if xid != None:
9553 self.xid = xid
9554 else:
9555 self.xid = None
9556 if datapath_id != None:
9557 self.datapath_id = datapath_id
9558 else:
9559 self.datapath_id = 0
9560 if n_buffers != None:
9561 self.n_buffers = n_buffers
9562 else:
9563 self.n_buffers = 0
9564 if n_tables != None:
9565 self.n_tables = n_tables
9566 else:
9567 self.n_tables = 0
9568 if auxiliary_id != None:
9569 self.auxiliary_id = auxiliary_id
9570 else:
9571 self.auxiliary_id = 0
9572 if capabilities != None:
9573 self.capabilities = capabilities
9574 else:
9575 self.capabilities = 0
9576 if reserved != None:
9577 self.reserved = reserved
9578 else:
9579 self.reserved = 0
9580 return
9581
9582 def pack(self):
9583 packed = []
9584 packed.append(struct.pack("!B", self.version))
9585 packed.append(struct.pack("!B", self.type))
9586 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9587 packed.append(struct.pack("!L", self.xid))
9588 packed.append(struct.pack("!Q", self.datapath_id))
9589 packed.append(struct.pack("!L", self.n_buffers))
9590 packed.append(struct.pack("!B", self.n_tables))
9591 packed.append(struct.pack("!B", self.auxiliary_id))
9592 packed.append('\x00' * 2)
9593 packed.append(struct.pack("!L", self.capabilities))
9594 packed.append(struct.pack("!L", self.reserved))
9595 length = sum([len(x) for x in packed])
9596 packed[2] = struct.pack("!H", length)
9597 return ''.join(packed)
9598
9599 @staticmethod
9600 def unpack(reader):
9601 obj = features_reply()
9602 _version = reader.read("!B")[0]
9603 assert(_version == 5)
9604 _type = reader.read("!B")[0]
9605 assert(_type == 6)
9606 _length = reader.read("!H")[0]
9607 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009608 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009609 obj.xid = reader.read("!L")[0]
9610 obj.datapath_id = reader.read("!Q")[0]
9611 obj.n_buffers = reader.read("!L")[0]
9612 obj.n_tables = reader.read("!B")[0]
9613 obj.auxiliary_id = reader.read("!B")[0]
9614 reader.skip(2)
9615 obj.capabilities = reader.read("!L")[0]
9616 obj.reserved = reader.read("!L")[0]
9617 return obj
9618
9619 def __eq__(self, other):
9620 if type(self) != type(other): return False
9621 if self.xid != other.xid: return False
9622 if self.datapath_id != other.datapath_id: return False
9623 if self.n_buffers != other.n_buffers: return False
9624 if self.n_tables != other.n_tables: return False
9625 if self.auxiliary_id != other.auxiliary_id: return False
9626 if self.capabilities != other.capabilities: return False
9627 if self.reserved != other.reserved: return False
9628 return True
9629
9630 def pretty_print(self, q):
9631 q.text("features_reply {")
9632 with q.group():
9633 with q.indent(2):
9634 q.breakable()
9635 q.text("xid = ");
9636 if self.xid != None:
9637 q.text("%#x" % self.xid)
9638 else:
9639 q.text('None')
9640 q.text(","); q.breakable()
9641 q.text("datapath_id = ");
9642 q.text("%#x" % self.datapath_id)
9643 q.text(","); q.breakable()
9644 q.text("n_buffers = ");
9645 q.text("%#x" % self.n_buffers)
9646 q.text(","); q.breakable()
9647 q.text("n_tables = ");
9648 q.text("%#x" % self.n_tables)
9649 q.text(","); q.breakable()
9650 q.text("auxiliary_id = ");
9651 q.text("%#x" % self.auxiliary_id)
9652 q.text(","); q.breakable()
9653 q.text("capabilities = ");
9654 q.text("%#x" % self.capabilities)
9655 q.text(","); q.breakable()
9656 q.text("reserved = ");
9657 q.text("%#x" % self.reserved)
9658 q.breakable()
9659 q.text('}')
9660
9661message.subtypes[6] = features_reply
9662
9663class features_request(message):
9664 version = 5
9665 type = 5
9666
9667 def __init__(self, xid=None):
9668 if xid != None:
9669 self.xid = xid
9670 else:
9671 self.xid = None
9672 return
9673
9674 def pack(self):
9675 packed = []
9676 packed.append(struct.pack("!B", self.version))
9677 packed.append(struct.pack("!B", self.type))
9678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9679 packed.append(struct.pack("!L", self.xid))
9680 length = sum([len(x) for x in packed])
9681 packed[2] = struct.pack("!H", length)
9682 return ''.join(packed)
9683
9684 @staticmethod
9685 def unpack(reader):
9686 obj = features_request()
9687 _version = reader.read("!B")[0]
9688 assert(_version == 5)
9689 _type = reader.read("!B")[0]
9690 assert(_type == 5)
9691 _length = reader.read("!H")[0]
9692 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009693 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009694 obj.xid = reader.read("!L")[0]
9695 return obj
9696
9697 def __eq__(self, other):
9698 if type(self) != type(other): return False
9699 if self.xid != other.xid: return False
9700 return True
9701
9702 def pretty_print(self, q):
9703 q.text("features_request {")
9704 with q.group():
9705 with q.indent(2):
9706 q.breakable()
9707 q.text("xid = ");
9708 if self.xid != None:
9709 q.text("%#x" % self.xid)
9710 else:
9711 q.text('None')
9712 q.breakable()
9713 q.text('}')
9714
9715message.subtypes[5] = features_request
9716
9717class flow_mod(message):
9718 subtypes = {}
9719
9720 version = 5
9721 type = 14
9722
9723 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):
9724 if xid != None:
9725 self.xid = xid
9726 else:
9727 self.xid = None
9728 if cookie != None:
9729 self.cookie = cookie
9730 else:
9731 self.cookie = 0
9732 if cookie_mask != None:
9733 self.cookie_mask = cookie_mask
9734 else:
9735 self.cookie_mask = 0
9736 if table_id != None:
9737 self.table_id = table_id
9738 else:
9739 self.table_id = 0
9740 if _command != None:
9741 self._command = _command
9742 else:
9743 self._command = 0
9744 if idle_timeout != None:
9745 self.idle_timeout = idle_timeout
9746 else:
9747 self.idle_timeout = 0
9748 if hard_timeout != None:
9749 self.hard_timeout = hard_timeout
9750 else:
9751 self.hard_timeout = 0
9752 if priority != None:
9753 self.priority = priority
9754 else:
9755 self.priority = 0
9756 if buffer_id != None:
9757 self.buffer_id = buffer_id
9758 else:
9759 self.buffer_id = 0
9760 if out_port != None:
9761 self.out_port = out_port
9762 else:
9763 self.out_port = 0
9764 if out_group != None:
9765 self.out_group = out_group
9766 else:
9767 self.out_group = 0
9768 if flags != None:
9769 self.flags = flags
9770 else:
9771 self.flags = 0
9772 if match != None:
9773 self.match = match
9774 else:
Rich Lanee2567702015-01-26 15:04:35 -08009775 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -07009776 if instructions != None:
9777 self.instructions = instructions
9778 else:
9779 self.instructions = []
9780 return
9781
9782 def pack(self):
9783 packed = []
9784 packed.append(struct.pack("!B", self.version))
9785 packed.append(struct.pack("!B", self.type))
9786 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9787 packed.append(struct.pack("!L", self.xid))
9788 packed.append(struct.pack("!Q", self.cookie))
9789 packed.append(struct.pack("!Q", self.cookie_mask))
9790 packed.append(struct.pack("!B", self.table_id))
9791 packed.append(util.pack_fm_cmd(self._command))
9792 packed.append(struct.pack("!H", self.idle_timeout))
9793 packed.append(struct.pack("!H", self.hard_timeout))
9794 packed.append(struct.pack("!H", self.priority))
9795 packed.append(struct.pack("!L", self.buffer_id))
9796 packed.append(util.pack_port_no(self.out_port))
9797 packed.append(struct.pack("!L", self.out_group))
9798 packed.append(struct.pack("!H", self.flags))
9799 packed.append('\x00' * 2)
9800 packed.append(self.match.pack())
9801 packed.append(loxi.generic_util.pack_list(self.instructions))
9802 length = sum([len(x) for x in packed])
9803 packed[2] = struct.pack("!H", length)
9804 return ''.join(packed)
9805
9806 @staticmethod
9807 def unpack(reader):
9808 subtype, = reader.peek('B', 25)
9809 subclass = flow_mod.subtypes.get(subtype)
9810 if subclass:
9811 return subclass.unpack(reader)
9812
9813 obj = flow_mod()
9814 _version = reader.read("!B")[0]
9815 assert(_version == 5)
9816 _type = reader.read("!B")[0]
9817 assert(_type == 14)
9818 _length = reader.read("!H")[0]
9819 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009820 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07009821 obj.xid = reader.read("!L")[0]
9822 obj.cookie = reader.read("!Q")[0]
9823 obj.cookie_mask = reader.read("!Q")[0]
9824 obj.table_id = reader.read("!B")[0]
9825 obj._command = util.unpack_fm_cmd(reader)
9826 obj.idle_timeout = reader.read("!H")[0]
9827 obj.hard_timeout = reader.read("!H")[0]
9828 obj.priority = reader.read("!H")[0]
9829 obj.buffer_id = reader.read("!L")[0]
9830 obj.out_port = util.unpack_port_no(reader)
9831 obj.out_group = reader.read("!L")[0]
9832 obj.flags = reader.read("!H")[0]
9833 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -08009834 obj.match = ofp.match.unpack(reader)
9835 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07009836 return obj
9837
9838 def __eq__(self, other):
9839 if type(self) != type(other): return False
9840 if self.xid != other.xid: return False
9841 if self.cookie != other.cookie: return False
9842 if self.cookie_mask != other.cookie_mask: return False
9843 if self.table_id != other.table_id: return False
9844 if self._command != other._command: return False
9845 if self.idle_timeout != other.idle_timeout: return False
9846 if self.hard_timeout != other.hard_timeout: return False
9847 if self.priority != other.priority: return False
9848 if self.buffer_id != other.buffer_id: return False
9849 if self.out_port != other.out_port: return False
9850 if self.out_group != other.out_group: return False
9851 if self.flags != other.flags: return False
9852 if self.match != other.match: return False
9853 if self.instructions != other.instructions: return False
9854 return True
9855
9856 def pretty_print(self, q):
9857 q.text("flow_mod {")
9858 with q.group():
9859 with q.indent(2):
9860 q.breakable()
9861 q.text("xid = ");
9862 if self.xid != None:
9863 q.text("%#x" % self.xid)
9864 else:
9865 q.text('None')
9866 q.text(","); q.breakable()
9867 q.text("cookie = ");
9868 q.text("%#x" % self.cookie)
9869 q.text(","); q.breakable()
9870 q.text("cookie_mask = ");
9871 q.text("%#x" % self.cookie_mask)
9872 q.text(","); q.breakable()
9873 q.text("table_id = ");
9874 q.text("%#x" % self.table_id)
9875 q.text(","); q.breakable()
9876 q.text("idle_timeout = ");
9877 q.text("%#x" % self.idle_timeout)
9878 q.text(","); q.breakable()
9879 q.text("hard_timeout = ");
9880 q.text("%#x" % self.hard_timeout)
9881 q.text(","); q.breakable()
9882 q.text("priority = ");
9883 q.text("%#x" % self.priority)
9884 q.text(","); q.breakable()
9885 q.text("buffer_id = ");
9886 q.text("%#x" % self.buffer_id)
9887 q.text(","); q.breakable()
9888 q.text("out_port = ");
9889 q.text(util.pretty_port(self.out_port))
9890 q.text(","); q.breakable()
9891 q.text("out_group = ");
9892 q.text("%#x" % self.out_group)
9893 q.text(","); q.breakable()
9894 q.text("flags = ");
9895 q.text("%#x" % self.flags)
9896 q.text(","); q.breakable()
9897 q.text("match = ");
9898 q.pp(self.match)
9899 q.text(","); q.breakable()
9900 q.text("instructions = ");
9901 q.pp(self.instructions)
9902 q.breakable()
9903 q.text('}')
9904
9905message.subtypes[14] = flow_mod
9906
9907class flow_add(flow_mod):
9908 version = 5
9909 type = 14
9910 _command = 0
9911
9912 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
9913 if xid != None:
9914 self.xid = xid
9915 else:
9916 self.xid = None
9917 if cookie != None:
9918 self.cookie = cookie
9919 else:
9920 self.cookie = 0
9921 if cookie_mask != None:
9922 self.cookie_mask = cookie_mask
9923 else:
9924 self.cookie_mask = 0
9925 if table_id != None:
9926 self.table_id = table_id
9927 else:
9928 self.table_id = 0
9929 if idle_timeout != None:
9930 self.idle_timeout = idle_timeout
9931 else:
9932 self.idle_timeout = 0
9933 if hard_timeout != None:
9934 self.hard_timeout = hard_timeout
9935 else:
9936 self.hard_timeout = 0
9937 if priority != None:
9938 self.priority = priority
9939 else:
9940 self.priority = 0
9941 if buffer_id != None:
9942 self.buffer_id = buffer_id
9943 else:
9944 self.buffer_id = 0
9945 if out_port != None:
9946 self.out_port = out_port
9947 else:
9948 self.out_port = 0
9949 if out_group != None:
9950 self.out_group = out_group
9951 else:
9952 self.out_group = 0
9953 if flags != None:
9954 self.flags = flags
9955 else:
9956 self.flags = 0
9957 if importance != None:
9958 self.importance = importance
9959 else:
9960 self.importance = 0
9961 if match != None:
9962 self.match = match
9963 else:
Rich Lanee2567702015-01-26 15:04:35 -08009964 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -07009965 if instructions != None:
9966 self.instructions = instructions
9967 else:
9968 self.instructions = []
9969 return
9970
9971 def pack(self):
9972 packed = []
9973 packed.append(struct.pack("!B", self.version))
9974 packed.append(struct.pack("!B", self.type))
9975 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9976 packed.append(struct.pack("!L", self.xid))
9977 packed.append(struct.pack("!Q", self.cookie))
9978 packed.append(struct.pack("!Q", self.cookie_mask))
9979 packed.append(struct.pack("!B", self.table_id))
9980 packed.append(util.pack_fm_cmd(self._command))
9981 packed.append(struct.pack("!H", self.idle_timeout))
9982 packed.append(struct.pack("!H", self.hard_timeout))
9983 packed.append(struct.pack("!H", self.priority))
9984 packed.append(struct.pack("!L", self.buffer_id))
9985 packed.append(util.pack_port_no(self.out_port))
9986 packed.append(struct.pack("!L", self.out_group))
9987 packed.append(struct.pack("!H", self.flags))
9988 packed.append(struct.pack("!H", self.importance))
9989 packed.append(self.match.pack())
9990 packed.append(loxi.generic_util.pack_list(self.instructions))
9991 length = sum([len(x) for x in packed])
9992 packed[2] = struct.pack("!H", length)
9993 return ''.join(packed)
9994
9995 @staticmethod
9996 def unpack(reader):
9997 obj = flow_add()
9998 _version = reader.read("!B")[0]
9999 assert(_version == 5)
10000 _type = reader.read("!B")[0]
10001 assert(_type == 14)
10002 _length = reader.read("!H")[0]
10003 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010004 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010005 obj.xid = reader.read("!L")[0]
10006 obj.cookie = reader.read("!Q")[0]
10007 obj.cookie_mask = reader.read("!Q")[0]
10008 obj.table_id = reader.read("!B")[0]
10009 __command = util.unpack_fm_cmd(reader)
10010 assert(__command == 0)
10011 obj.idle_timeout = reader.read("!H")[0]
10012 obj.hard_timeout = reader.read("!H")[0]
10013 obj.priority = reader.read("!H")[0]
10014 obj.buffer_id = reader.read("!L")[0]
10015 obj.out_port = util.unpack_port_no(reader)
10016 obj.out_group = reader.read("!L")[0]
10017 obj.flags = reader.read("!H")[0]
10018 obj.importance = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010019 obj.match = ofp.match.unpack(reader)
10020 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070010021 return obj
10022
10023 def __eq__(self, other):
10024 if type(self) != type(other): return False
10025 if self.xid != other.xid: return False
10026 if self.cookie != other.cookie: return False
10027 if self.cookie_mask != other.cookie_mask: return False
10028 if self.table_id != other.table_id: return False
10029 if self.idle_timeout != other.idle_timeout: return False
10030 if self.hard_timeout != other.hard_timeout: return False
10031 if self.priority != other.priority: return False
10032 if self.buffer_id != other.buffer_id: return False
10033 if self.out_port != other.out_port: return False
10034 if self.out_group != other.out_group: return False
10035 if self.flags != other.flags: return False
10036 if self.importance != other.importance: return False
10037 if self.match != other.match: return False
10038 if self.instructions != other.instructions: return False
10039 return True
10040
10041 def pretty_print(self, q):
10042 q.text("flow_add {")
10043 with q.group():
10044 with q.indent(2):
10045 q.breakable()
10046 q.text("xid = ");
10047 if self.xid != None:
10048 q.text("%#x" % self.xid)
10049 else:
10050 q.text('None')
10051 q.text(","); q.breakable()
10052 q.text("cookie = ");
10053 q.text("%#x" % self.cookie)
10054 q.text(","); q.breakable()
10055 q.text("cookie_mask = ");
10056 q.text("%#x" % self.cookie_mask)
10057 q.text(","); q.breakable()
10058 q.text("table_id = ");
10059 q.text("%#x" % self.table_id)
10060 q.text(","); q.breakable()
10061 q.text("idle_timeout = ");
10062 q.text("%#x" % self.idle_timeout)
10063 q.text(","); q.breakable()
10064 q.text("hard_timeout = ");
10065 q.text("%#x" % self.hard_timeout)
10066 q.text(","); q.breakable()
10067 q.text("priority = ");
10068 q.text("%#x" % self.priority)
10069 q.text(","); q.breakable()
10070 q.text("buffer_id = ");
10071 q.text("%#x" % self.buffer_id)
10072 q.text(","); q.breakable()
10073 q.text("out_port = ");
10074 q.text(util.pretty_port(self.out_port))
10075 q.text(","); q.breakable()
10076 q.text("out_group = ");
10077 q.text("%#x" % self.out_group)
10078 q.text(","); q.breakable()
10079 q.text("flags = ");
10080 q.text("%#x" % self.flags)
10081 q.text(","); q.breakable()
10082 q.text("importance = ");
10083 q.text("%#x" % self.importance)
10084 q.text(","); q.breakable()
10085 q.text("match = ");
10086 q.pp(self.match)
10087 q.text(","); q.breakable()
10088 q.text("instructions = ");
10089 q.pp(self.instructions)
10090 q.breakable()
10091 q.text('}')
10092
10093flow_mod.subtypes[0] = flow_add
10094
10095class flow_delete(flow_mod):
10096 version = 5
10097 type = 14
10098 _command = 3
10099
10100 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10101 if xid != None:
10102 self.xid = xid
10103 else:
10104 self.xid = None
10105 if cookie != None:
10106 self.cookie = cookie
10107 else:
10108 self.cookie = 0
10109 if cookie_mask != None:
10110 self.cookie_mask = cookie_mask
10111 else:
10112 self.cookie_mask = 0
10113 if table_id != None:
10114 self.table_id = table_id
10115 else:
10116 self.table_id = 0
10117 if idle_timeout != None:
10118 self.idle_timeout = idle_timeout
10119 else:
10120 self.idle_timeout = 0
10121 if hard_timeout != None:
10122 self.hard_timeout = hard_timeout
10123 else:
10124 self.hard_timeout = 0
10125 if priority != None:
10126 self.priority = priority
10127 else:
10128 self.priority = 0
10129 if buffer_id != None:
10130 self.buffer_id = buffer_id
10131 else:
10132 self.buffer_id = 0
10133 if out_port != None:
10134 self.out_port = out_port
10135 else:
10136 self.out_port = 0
10137 if out_group != None:
10138 self.out_group = out_group
10139 else:
10140 self.out_group = 0
10141 if flags != None:
10142 self.flags = flags
10143 else:
10144 self.flags = 0
10145 if importance != None:
10146 self.importance = importance
10147 else:
10148 self.importance = 0
10149 if match != None:
10150 self.match = match
10151 else:
Rich Lanee2567702015-01-26 15:04:35 -080010152 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070010153 if instructions != None:
10154 self.instructions = instructions
10155 else:
10156 self.instructions = []
10157 return
10158
10159 def pack(self):
10160 packed = []
10161 packed.append(struct.pack("!B", self.version))
10162 packed.append(struct.pack("!B", self.type))
10163 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10164 packed.append(struct.pack("!L", self.xid))
10165 packed.append(struct.pack("!Q", self.cookie))
10166 packed.append(struct.pack("!Q", self.cookie_mask))
10167 packed.append(struct.pack("!B", self.table_id))
10168 packed.append(util.pack_fm_cmd(self._command))
10169 packed.append(struct.pack("!H", self.idle_timeout))
10170 packed.append(struct.pack("!H", self.hard_timeout))
10171 packed.append(struct.pack("!H", self.priority))
10172 packed.append(struct.pack("!L", self.buffer_id))
10173 packed.append(util.pack_port_no(self.out_port))
10174 packed.append(struct.pack("!L", self.out_group))
10175 packed.append(struct.pack("!H", self.flags))
10176 packed.append(struct.pack("!H", self.importance))
10177 packed.append(self.match.pack())
10178 packed.append(loxi.generic_util.pack_list(self.instructions))
10179 length = sum([len(x) for x in packed])
10180 packed[2] = struct.pack("!H", length)
10181 return ''.join(packed)
10182
10183 @staticmethod
10184 def unpack(reader):
10185 obj = flow_delete()
10186 _version = reader.read("!B")[0]
10187 assert(_version == 5)
10188 _type = reader.read("!B")[0]
10189 assert(_type == 14)
10190 _length = reader.read("!H")[0]
10191 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010192 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010193 obj.xid = reader.read("!L")[0]
10194 obj.cookie = reader.read("!Q")[0]
10195 obj.cookie_mask = reader.read("!Q")[0]
10196 obj.table_id = reader.read("!B")[0]
10197 __command = util.unpack_fm_cmd(reader)
10198 assert(__command == 3)
10199 obj.idle_timeout = reader.read("!H")[0]
10200 obj.hard_timeout = reader.read("!H")[0]
10201 obj.priority = reader.read("!H")[0]
10202 obj.buffer_id = reader.read("!L")[0]
10203 obj.out_port = util.unpack_port_no(reader)
10204 obj.out_group = reader.read("!L")[0]
10205 obj.flags = reader.read("!H")[0]
10206 obj.importance = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010207 obj.match = ofp.match.unpack(reader)
10208 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070010209 return obj
10210
10211 def __eq__(self, other):
10212 if type(self) != type(other): return False
10213 if self.xid != other.xid: return False
10214 if self.cookie != other.cookie: return False
10215 if self.cookie_mask != other.cookie_mask: return False
10216 if self.table_id != other.table_id: return False
10217 if self.idle_timeout != other.idle_timeout: return False
10218 if self.hard_timeout != other.hard_timeout: return False
10219 if self.priority != other.priority: return False
10220 if self.buffer_id != other.buffer_id: return False
10221 if self.out_port != other.out_port: return False
10222 if self.out_group != other.out_group: return False
10223 if self.flags != other.flags: return False
10224 if self.importance != other.importance: return False
10225 if self.match != other.match: return False
10226 if self.instructions != other.instructions: return False
10227 return True
10228
10229 def pretty_print(self, q):
10230 q.text("flow_delete {")
10231 with q.group():
10232 with q.indent(2):
10233 q.breakable()
10234 q.text("xid = ");
10235 if self.xid != None:
10236 q.text("%#x" % self.xid)
10237 else:
10238 q.text('None')
10239 q.text(","); q.breakable()
10240 q.text("cookie = ");
10241 q.text("%#x" % self.cookie)
10242 q.text(","); q.breakable()
10243 q.text("cookie_mask = ");
10244 q.text("%#x" % self.cookie_mask)
10245 q.text(","); q.breakable()
10246 q.text("table_id = ");
10247 q.text("%#x" % self.table_id)
10248 q.text(","); q.breakable()
10249 q.text("idle_timeout = ");
10250 q.text("%#x" % self.idle_timeout)
10251 q.text(","); q.breakable()
10252 q.text("hard_timeout = ");
10253 q.text("%#x" % self.hard_timeout)
10254 q.text(","); q.breakable()
10255 q.text("priority = ");
10256 q.text("%#x" % self.priority)
10257 q.text(","); q.breakable()
10258 q.text("buffer_id = ");
10259 q.text("%#x" % self.buffer_id)
10260 q.text(","); q.breakable()
10261 q.text("out_port = ");
10262 q.text(util.pretty_port(self.out_port))
10263 q.text(","); q.breakable()
10264 q.text("out_group = ");
10265 q.text("%#x" % self.out_group)
10266 q.text(","); q.breakable()
10267 q.text("flags = ");
10268 q.text("%#x" % self.flags)
10269 q.text(","); q.breakable()
10270 q.text("importance = ");
10271 q.text("%#x" % self.importance)
10272 q.text(","); q.breakable()
10273 q.text("match = ");
10274 q.pp(self.match)
10275 q.text(","); q.breakable()
10276 q.text("instructions = ");
10277 q.pp(self.instructions)
10278 q.breakable()
10279 q.text('}')
10280
10281flow_mod.subtypes[3] = flow_delete
10282
10283class flow_delete_strict(flow_mod):
10284 version = 5
10285 type = 14
10286 _command = 4
10287
10288 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10289 if xid != None:
10290 self.xid = xid
10291 else:
10292 self.xid = None
10293 if cookie != None:
10294 self.cookie = cookie
10295 else:
10296 self.cookie = 0
10297 if cookie_mask != None:
10298 self.cookie_mask = cookie_mask
10299 else:
10300 self.cookie_mask = 0
10301 if table_id != None:
10302 self.table_id = table_id
10303 else:
10304 self.table_id = 0
10305 if idle_timeout != None:
10306 self.idle_timeout = idle_timeout
10307 else:
10308 self.idle_timeout = 0
10309 if hard_timeout != None:
10310 self.hard_timeout = hard_timeout
10311 else:
10312 self.hard_timeout = 0
10313 if priority != None:
10314 self.priority = priority
10315 else:
10316 self.priority = 0
10317 if buffer_id != None:
10318 self.buffer_id = buffer_id
10319 else:
10320 self.buffer_id = 0
10321 if out_port != None:
10322 self.out_port = out_port
10323 else:
10324 self.out_port = 0
10325 if out_group != None:
10326 self.out_group = out_group
10327 else:
10328 self.out_group = 0
10329 if flags != None:
10330 self.flags = flags
10331 else:
10332 self.flags = 0
10333 if importance != None:
10334 self.importance = importance
10335 else:
10336 self.importance = 0
10337 if match != None:
10338 self.match = match
10339 else:
Rich Lanee2567702015-01-26 15:04:35 -080010340 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070010341 if instructions != None:
10342 self.instructions = instructions
10343 else:
10344 self.instructions = []
10345 return
10346
10347 def pack(self):
10348 packed = []
10349 packed.append(struct.pack("!B", self.version))
10350 packed.append(struct.pack("!B", self.type))
10351 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10352 packed.append(struct.pack("!L", self.xid))
10353 packed.append(struct.pack("!Q", self.cookie))
10354 packed.append(struct.pack("!Q", self.cookie_mask))
10355 packed.append(struct.pack("!B", self.table_id))
10356 packed.append(util.pack_fm_cmd(self._command))
10357 packed.append(struct.pack("!H", self.idle_timeout))
10358 packed.append(struct.pack("!H", self.hard_timeout))
10359 packed.append(struct.pack("!H", self.priority))
10360 packed.append(struct.pack("!L", self.buffer_id))
10361 packed.append(util.pack_port_no(self.out_port))
10362 packed.append(struct.pack("!L", self.out_group))
10363 packed.append(struct.pack("!H", self.flags))
10364 packed.append(struct.pack("!H", self.importance))
10365 packed.append(self.match.pack())
10366 packed.append(loxi.generic_util.pack_list(self.instructions))
10367 length = sum([len(x) for x in packed])
10368 packed[2] = struct.pack("!H", length)
10369 return ''.join(packed)
10370
10371 @staticmethod
10372 def unpack(reader):
10373 obj = flow_delete_strict()
10374 _version = reader.read("!B")[0]
10375 assert(_version == 5)
10376 _type = reader.read("!B")[0]
10377 assert(_type == 14)
10378 _length = reader.read("!H")[0]
10379 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010380 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010381 obj.xid = reader.read("!L")[0]
10382 obj.cookie = reader.read("!Q")[0]
10383 obj.cookie_mask = reader.read("!Q")[0]
10384 obj.table_id = reader.read("!B")[0]
10385 __command = util.unpack_fm_cmd(reader)
10386 assert(__command == 4)
10387 obj.idle_timeout = reader.read("!H")[0]
10388 obj.hard_timeout = reader.read("!H")[0]
10389 obj.priority = reader.read("!H")[0]
10390 obj.buffer_id = reader.read("!L")[0]
10391 obj.out_port = util.unpack_port_no(reader)
10392 obj.out_group = reader.read("!L")[0]
10393 obj.flags = reader.read("!H")[0]
10394 obj.importance = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010395 obj.match = ofp.match.unpack(reader)
10396 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070010397 return obj
10398
10399 def __eq__(self, other):
10400 if type(self) != type(other): return False
10401 if self.xid != other.xid: return False
10402 if self.cookie != other.cookie: return False
10403 if self.cookie_mask != other.cookie_mask: return False
10404 if self.table_id != other.table_id: return False
10405 if self.idle_timeout != other.idle_timeout: return False
10406 if self.hard_timeout != other.hard_timeout: return False
10407 if self.priority != other.priority: return False
10408 if self.buffer_id != other.buffer_id: return False
10409 if self.out_port != other.out_port: return False
10410 if self.out_group != other.out_group: return False
10411 if self.flags != other.flags: return False
10412 if self.importance != other.importance: return False
10413 if self.match != other.match: return False
10414 if self.instructions != other.instructions: return False
10415 return True
10416
10417 def pretty_print(self, q):
10418 q.text("flow_delete_strict {")
10419 with q.group():
10420 with q.indent(2):
10421 q.breakable()
10422 q.text("xid = ");
10423 if self.xid != None:
10424 q.text("%#x" % self.xid)
10425 else:
10426 q.text('None')
10427 q.text(","); q.breakable()
10428 q.text("cookie = ");
10429 q.text("%#x" % self.cookie)
10430 q.text(","); q.breakable()
10431 q.text("cookie_mask = ");
10432 q.text("%#x" % self.cookie_mask)
10433 q.text(","); q.breakable()
10434 q.text("table_id = ");
10435 q.text("%#x" % self.table_id)
10436 q.text(","); q.breakable()
10437 q.text("idle_timeout = ");
10438 q.text("%#x" % self.idle_timeout)
10439 q.text(","); q.breakable()
10440 q.text("hard_timeout = ");
10441 q.text("%#x" % self.hard_timeout)
10442 q.text(","); q.breakable()
10443 q.text("priority = ");
10444 q.text("%#x" % self.priority)
10445 q.text(","); q.breakable()
10446 q.text("buffer_id = ");
10447 q.text("%#x" % self.buffer_id)
10448 q.text(","); q.breakable()
10449 q.text("out_port = ");
10450 q.text(util.pretty_port(self.out_port))
10451 q.text(","); q.breakable()
10452 q.text("out_group = ");
10453 q.text("%#x" % self.out_group)
10454 q.text(","); q.breakable()
10455 q.text("flags = ");
10456 q.text("%#x" % self.flags)
10457 q.text(","); q.breakable()
10458 q.text("importance = ");
10459 q.text("%#x" % self.importance)
10460 q.text(","); q.breakable()
10461 q.text("match = ");
10462 q.pp(self.match)
10463 q.text(","); q.breakable()
10464 q.text("instructions = ");
10465 q.pp(self.instructions)
10466 q.breakable()
10467 q.text('}')
10468
10469flow_mod.subtypes[4] = flow_delete_strict
10470
10471class flow_mod_failed_error_msg(error_msg):
10472 version = 5
10473 type = 1
10474 err_type = 5
10475
10476 def __init__(self, xid=None, code=None, data=None):
10477 if xid != None:
10478 self.xid = xid
10479 else:
10480 self.xid = None
10481 if code != None:
10482 self.code = code
10483 else:
10484 self.code = 0
10485 if data != None:
10486 self.data = data
10487 else:
10488 self.data = ''
10489 return
10490
10491 def pack(self):
10492 packed = []
10493 packed.append(struct.pack("!B", self.version))
10494 packed.append(struct.pack("!B", self.type))
10495 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10496 packed.append(struct.pack("!L", self.xid))
10497 packed.append(struct.pack("!H", self.err_type))
10498 packed.append(struct.pack("!H", self.code))
10499 packed.append(self.data)
10500 length = sum([len(x) for x in packed])
10501 packed[2] = struct.pack("!H", length)
10502 return ''.join(packed)
10503
10504 @staticmethod
10505 def unpack(reader):
10506 obj = flow_mod_failed_error_msg()
10507 _version = reader.read("!B")[0]
10508 assert(_version == 5)
10509 _type = reader.read("!B")[0]
10510 assert(_type == 1)
10511 _length = reader.read("!H")[0]
10512 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010513 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010514 obj.xid = reader.read("!L")[0]
10515 _err_type = reader.read("!H")[0]
10516 assert(_err_type == 5)
10517 obj.code = reader.read("!H")[0]
10518 obj.data = str(reader.read_all())
10519 return obj
10520
10521 def __eq__(self, other):
10522 if type(self) != type(other): return False
10523 if self.xid != other.xid: return False
10524 if self.code != other.code: return False
10525 if self.data != other.data: return False
10526 return True
10527
10528 def pretty_print(self, q):
10529 q.text("flow_mod_failed_error_msg {")
10530 with q.group():
10531 with q.indent(2):
10532 q.breakable()
10533 q.text("xid = ");
10534 if self.xid != None:
10535 q.text("%#x" % self.xid)
10536 else:
10537 q.text('None')
10538 q.text(","); q.breakable()
10539 q.text("code = ");
10540 q.text("%#x" % self.code)
10541 q.text(","); q.breakable()
10542 q.text("data = ");
10543 q.pp(self.data)
10544 q.breakable()
10545 q.text('}')
10546
10547error_msg.subtypes[5] = flow_mod_failed_error_msg
10548
10549class flow_modify(flow_mod):
10550 version = 5
10551 type = 14
10552 _command = 1
10553
10554 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10555 if xid != None:
10556 self.xid = xid
10557 else:
10558 self.xid = None
10559 if cookie != None:
10560 self.cookie = cookie
10561 else:
10562 self.cookie = 0
10563 if cookie_mask != None:
10564 self.cookie_mask = cookie_mask
10565 else:
10566 self.cookie_mask = 0
10567 if table_id != None:
10568 self.table_id = table_id
10569 else:
10570 self.table_id = 0
10571 if idle_timeout != None:
10572 self.idle_timeout = idle_timeout
10573 else:
10574 self.idle_timeout = 0
10575 if hard_timeout != None:
10576 self.hard_timeout = hard_timeout
10577 else:
10578 self.hard_timeout = 0
10579 if priority != None:
10580 self.priority = priority
10581 else:
10582 self.priority = 0
10583 if buffer_id != None:
10584 self.buffer_id = buffer_id
10585 else:
10586 self.buffer_id = 0
10587 if out_port != None:
10588 self.out_port = out_port
10589 else:
10590 self.out_port = 0
10591 if out_group != None:
10592 self.out_group = out_group
10593 else:
10594 self.out_group = 0
10595 if flags != None:
10596 self.flags = flags
10597 else:
10598 self.flags = 0
10599 if importance != None:
10600 self.importance = importance
10601 else:
10602 self.importance = 0
10603 if match != None:
10604 self.match = match
10605 else:
Rich Lanee2567702015-01-26 15:04:35 -080010606 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070010607 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(struct.pack("!H", self.importance))
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 == 5)
10642 _type = reader.read("!B")[0]
10643 assert(_type == 14)
10644 _length = reader.read("!H")[0]
10645 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010646 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010647 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 obj.importance = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010661 obj.match = ofp.match.unpack(reader)
10662 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070010663 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.importance != other.importance: return False
10679 if self.match != other.match: return False
10680 if self.instructions != other.instructions: return False
10681 return True
10682
10683 def pretty_print(self, q):
10684 q.text("flow_modify {")
10685 with q.group():
10686 with q.indent(2):
10687 q.breakable()
10688 q.text("xid = ");
10689 if self.xid != None:
10690 q.text("%#x" % self.xid)
10691 else:
10692 q.text('None')
10693 q.text(","); q.breakable()
10694 q.text("cookie = ");
10695 q.text("%#x" % self.cookie)
10696 q.text(","); q.breakable()
10697 q.text("cookie_mask = ");
10698 q.text("%#x" % self.cookie_mask)
10699 q.text(","); q.breakable()
10700 q.text("table_id = ");
10701 q.text("%#x" % self.table_id)
10702 q.text(","); q.breakable()
10703 q.text("idle_timeout = ");
10704 q.text("%#x" % self.idle_timeout)
10705 q.text(","); q.breakable()
10706 q.text("hard_timeout = ");
10707 q.text("%#x" % self.hard_timeout)
10708 q.text(","); q.breakable()
10709 q.text("priority = ");
10710 q.text("%#x" % self.priority)
10711 q.text(","); q.breakable()
10712 q.text("buffer_id = ");
10713 q.text("%#x" % self.buffer_id)
10714 q.text(","); q.breakable()
10715 q.text("out_port = ");
10716 q.text(util.pretty_port(self.out_port))
10717 q.text(","); q.breakable()
10718 q.text("out_group = ");
10719 q.text("%#x" % self.out_group)
10720 q.text(","); q.breakable()
10721 q.text("flags = ");
10722 q.text("%#x" % self.flags)
10723 q.text(","); q.breakable()
10724 q.text("importance = ");
10725 q.text("%#x" % self.importance)
10726 q.text(","); q.breakable()
10727 q.text("match = ");
10728 q.pp(self.match)
10729 q.text(","); q.breakable()
10730 q.text("instructions = ");
10731 q.pp(self.instructions)
10732 q.breakable()
10733 q.text('}')
10734
10735flow_mod.subtypes[1] = flow_modify
10736
10737class flow_modify_strict(flow_mod):
10738 version = 5
10739 type = 14
10740 _command = 2
10741
10742 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10743 if xid != None:
10744 self.xid = xid
10745 else:
10746 self.xid = None
10747 if cookie != None:
10748 self.cookie = cookie
10749 else:
10750 self.cookie = 0
10751 if cookie_mask != None:
10752 self.cookie_mask = cookie_mask
10753 else:
10754 self.cookie_mask = 0
10755 if table_id != None:
10756 self.table_id = table_id
10757 else:
10758 self.table_id = 0
10759 if idle_timeout != None:
10760 self.idle_timeout = idle_timeout
10761 else:
10762 self.idle_timeout = 0
10763 if hard_timeout != None:
10764 self.hard_timeout = hard_timeout
10765 else:
10766 self.hard_timeout = 0
10767 if priority != None:
10768 self.priority = priority
10769 else:
10770 self.priority = 0
10771 if buffer_id != None:
10772 self.buffer_id = buffer_id
10773 else:
10774 self.buffer_id = 0
10775 if out_port != None:
10776 self.out_port = out_port
10777 else:
10778 self.out_port = 0
10779 if out_group != None:
10780 self.out_group = out_group
10781 else:
10782 self.out_group = 0
10783 if flags != None:
10784 self.flags = flags
10785 else:
10786 self.flags = 0
10787 if importance != None:
10788 self.importance = importance
10789 else:
10790 self.importance = 0
10791 if match != None:
10792 self.match = match
10793 else:
Rich Lanee2567702015-01-26 15:04:35 -080010794 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070010795 if instructions != None:
10796 self.instructions = instructions
10797 else:
10798 self.instructions = []
10799 return
10800
10801 def pack(self):
10802 packed = []
10803 packed.append(struct.pack("!B", self.version))
10804 packed.append(struct.pack("!B", self.type))
10805 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10806 packed.append(struct.pack("!L", self.xid))
10807 packed.append(struct.pack("!Q", self.cookie))
10808 packed.append(struct.pack("!Q", self.cookie_mask))
10809 packed.append(struct.pack("!B", self.table_id))
10810 packed.append(util.pack_fm_cmd(self._command))
10811 packed.append(struct.pack("!H", self.idle_timeout))
10812 packed.append(struct.pack("!H", self.hard_timeout))
10813 packed.append(struct.pack("!H", self.priority))
10814 packed.append(struct.pack("!L", self.buffer_id))
10815 packed.append(util.pack_port_no(self.out_port))
10816 packed.append(struct.pack("!L", self.out_group))
10817 packed.append(struct.pack("!H", self.flags))
10818 packed.append(struct.pack("!H", self.importance))
10819 packed.append(self.match.pack())
10820 packed.append(loxi.generic_util.pack_list(self.instructions))
10821 length = sum([len(x) for x in packed])
10822 packed[2] = struct.pack("!H", length)
10823 return ''.join(packed)
10824
10825 @staticmethod
10826 def unpack(reader):
10827 obj = flow_modify_strict()
10828 _version = reader.read("!B")[0]
10829 assert(_version == 5)
10830 _type = reader.read("!B")[0]
10831 assert(_type == 14)
10832 _length = reader.read("!H")[0]
10833 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010834 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070010835 obj.xid = reader.read("!L")[0]
10836 obj.cookie = reader.read("!Q")[0]
10837 obj.cookie_mask = reader.read("!Q")[0]
10838 obj.table_id = reader.read("!B")[0]
10839 __command = util.unpack_fm_cmd(reader)
10840 assert(__command == 2)
10841 obj.idle_timeout = reader.read("!H")[0]
10842 obj.hard_timeout = reader.read("!H")[0]
10843 obj.priority = reader.read("!H")[0]
10844 obj.buffer_id = reader.read("!L")[0]
10845 obj.out_port = util.unpack_port_no(reader)
10846 obj.out_group = reader.read("!L")[0]
10847 obj.flags = reader.read("!H")[0]
10848 obj.importance = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010849 obj.match = ofp.match.unpack(reader)
10850 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070010851 return obj
10852
10853 def __eq__(self, other):
10854 if type(self) != type(other): return False
10855 if self.xid != other.xid: return False
10856 if self.cookie != other.cookie: return False
10857 if self.cookie_mask != other.cookie_mask: return False
10858 if self.table_id != other.table_id: return False
10859 if self.idle_timeout != other.idle_timeout: return False
10860 if self.hard_timeout != other.hard_timeout: return False
10861 if self.priority != other.priority: return False
10862 if self.buffer_id != other.buffer_id: return False
10863 if self.out_port != other.out_port: return False
10864 if self.out_group != other.out_group: return False
10865 if self.flags != other.flags: return False
10866 if self.importance != other.importance: return False
10867 if self.match != other.match: return False
10868 if self.instructions != other.instructions: return False
10869 return True
10870
10871 def pretty_print(self, q):
10872 q.text("flow_modify_strict {")
10873 with q.group():
10874 with q.indent(2):
10875 q.breakable()
10876 q.text("xid = ");
10877 if self.xid != None:
10878 q.text("%#x" % self.xid)
10879 else:
10880 q.text('None')
10881 q.text(","); q.breakable()
10882 q.text("cookie = ");
10883 q.text("%#x" % self.cookie)
10884 q.text(","); q.breakable()
10885 q.text("cookie_mask = ");
10886 q.text("%#x" % self.cookie_mask)
10887 q.text(","); q.breakable()
10888 q.text("table_id = ");
10889 q.text("%#x" % self.table_id)
10890 q.text(","); q.breakable()
10891 q.text("idle_timeout = ");
10892 q.text("%#x" % self.idle_timeout)
10893 q.text(","); q.breakable()
10894 q.text("hard_timeout = ");
10895 q.text("%#x" % self.hard_timeout)
10896 q.text(","); q.breakable()
10897 q.text("priority = ");
10898 q.text("%#x" % self.priority)
10899 q.text(","); q.breakable()
10900 q.text("buffer_id = ");
10901 q.text("%#x" % self.buffer_id)
10902 q.text(","); q.breakable()
10903 q.text("out_port = ");
10904 q.text(util.pretty_port(self.out_port))
10905 q.text(","); q.breakable()
10906 q.text("out_group = ");
10907 q.text("%#x" % self.out_group)
10908 q.text(","); q.breakable()
10909 q.text("flags = ");
10910 q.text("%#x" % self.flags)
10911 q.text(","); q.breakable()
10912 q.text("importance = ");
10913 q.text("%#x" % self.importance)
10914 q.text(","); q.breakable()
10915 q.text("match = ");
10916 q.pp(self.match)
10917 q.text(","); q.breakable()
10918 q.text("instructions = ");
10919 q.pp(self.instructions)
10920 q.breakable()
10921 q.text('}')
10922
10923flow_mod.subtypes[2] = flow_modify_strict
10924
Rich Laneccd32ed2014-11-10 17:48:24 -080010925class flow_monitor_failed_error_msg(error_msg):
10926 version = 5
10927 type = 1
10928 err_type = 16
10929
10930 def __init__(self, xid=None, code=None, data=None):
10931 if xid != None:
10932 self.xid = xid
10933 else:
10934 self.xid = None
10935 if code != None:
10936 self.code = code
10937 else:
10938 self.code = 0
10939 if data != None:
10940 self.data = data
10941 else:
10942 self.data = ''
10943 return
10944
10945 def pack(self):
10946 packed = []
10947 packed.append(struct.pack("!B", self.version))
10948 packed.append(struct.pack("!B", self.type))
10949 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10950 packed.append(struct.pack("!L", self.xid))
10951 packed.append(struct.pack("!H", self.err_type))
10952 packed.append(struct.pack("!H", self.code))
10953 packed.append(self.data)
10954 length = sum([len(x) for x in packed])
10955 packed[2] = struct.pack("!H", length)
10956 return ''.join(packed)
10957
10958 @staticmethod
10959 def unpack(reader):
10960 obj = flow_monitor_failed_error_msg()
10961 _version = reader.read("!B")[0]
10962 assert(_version == 5)
10963 _type = reader.read("!B")[0]
10964 assert(_type == 1)
10965 _length = reader.read("!H")[0]
10966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010967 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -080010968 obj.xid = reader.read("!L")[0]
10969 _err_type = reader.read("!H")[0]
10970 assert(_err_type == 16)
10971 obj.code = reader.read("!H")[0]
10972 obj.data = str(reader.read_all())
10973 return obj
10974
10975 def __eq__(self, other):
10976 if type(self) != type(other): return False
10977 if self.xid != other.xid: return False
10978 if self.code != other.code: return False
10979 if self.data != other.data: return False
10980 return True
10981
10982 def pretty_print(self, q):
10983 q.text("flow_monitor_failed_error_msg {")
10984 with q.group():
10985 with q.indent(2):
10986 q.breakable()
10987 q.text("xid = ");
10988 if self.xid != None:
10989 q.text("%#x" % self.xid)
10990 else:
10991 q.text('None')
10992 q.text(","); q.breakable()
10993 q.text("code = ");
10994 q.text("%#x" % self.code)
10995 q.text(","); q.breakable()
10996 q.text("data = ");
10997 q.pp(self.data)
10998 q.breakable()
10999 q.text('}')
11000
11001error_msg.subtypes[16] = flow_monitor_failed_error_msg
11002
Rich Lane2e079da2014-10-29 15:30:24 -070011003class flow_removed(message):
11004 version = 5
11005 type = 11
11006
11007 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):
11008 if xid != None:
11009 self.xid = xid
11010 else:
11011 self.xid = None
11012 if cookie != None:
11013 self.cookie = cookie
11014 else:
11015 self.cookie = 0
11016 if priority != None:
11017 self.priority = priority
11018 else:
11019 self.priority = 0
11020 if reason != None:
11021 self.reason = reason
11022 else:
11023 self.reason = 0
11024 if table_id != None:
11025 self.table_id = table_id
11026 else:
11027 self.table_id = 0
11028 if duration_sec != None:
11029 self.duration_sec = duration_sec
11030 else:
11031 self.duration_sec = 0
11032 if duration_nsec != None:
11033 self.duration_nsec = duration_nsec
11034 else:
11035 self.duration_nsec = 0
11036 if idle_timeout != None:
11037 self.idle_timeout = idle_timeout
11038 else:
11039 self.idle_timeout = 0
11040 if hard_timeout != None:
11041 self.hard_timeout = hard_timeout
11042 else:
11043 self.hard_timeout = 0
11044 if packet_count != None:
11045 self.packet_count = packet_count
11046 else:
11047 self.packet_count = 0
11048 if byte_count != None:
11049 self.byte_count = byte_count
11050 else:
11051 self.byte_count = 0
11052 if match != None:
11053 self.match = match
11054 else:
Rich Lanee2567702015-01-26 15:04:35 -080011055 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070011056 return
11057
11058 def pack(self):
11059 packed = []
11060 packed.append(struct.pack("!B", self.version))
11061 packed.append(struct.pack("!B", self.type))
11062 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11063 packed.append(struct.pack("!L", self.xid))
11064 packed.append(struct.pack("!Q", self.cookie))
11065 packed.append(struct.pack("!H", self.priority))
11066 packed.append(struct.pack("!B", self.reason))
11067 packed.append(struct.pack("!B", self.table_id))
11068 packed.append(struct.pack("!L", self.duration_sec))
11069 packed.append(struct.pack("!L", self.duration_nsec))
11070 packed.append(struct.pack("!H", self.idle_timeout))
11071 packed.append(struct.pack("!H", self.hard_timeout))
11072 packed.append(struct.pack("!Q", self.packet_count))
11073 packed.append(struct.pack("!Q", self.byte_count))
11074 packed.append(self.match.pack())
11075 length = sum([len(x) for x in packed])
11076 packed[2] = struct.pack("!H", length)
11077 return ''.join(packed)
11078
11079 @staticmethod
11080 def unpack(reader):
11081 obj = flow_removed()
11082 _version = reader.read("!B")[0]
11083 assert(_version == 5)
11084 _type = reader.read("!B")[0]
11085 assert(_type == 11)
11086 _length = reader.read("!H")[0]
11087 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011088 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011089 obj.xid = reader.read("!L")[0]
11090 obj.cookie = reader.read("!Q")[0]
11091 obj.priority = reader.read("!H")[0]
11092 obj.reason = reader.read("!B")[0]
11093 obj.table_id = reader.read("!B")[0]
11094 obj.duration_sec = reader.read("!L")[0]
11095 obj.duration_nsec = reader.read("!L")[0]
11096 obj.idle_timeout = reader.read("!H")[0]
11097 obj.hard_timeout = reader.read("!H")[0]
11098 obj.packet_count = reader.read("!Q")[0]
11099 obj.byte_count = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011100 obj.match = ofp.match.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070011101 return obj
11102
11103 def __eq__(self, other):
11104 if type(self) != type(other): return False
11105 if self.xid != other.xid: return False
11106 if self.cookie != other.cookie: return False
11107 if self.priority != other.priority: return False
11108 if self.reason != other.reason: return False
11109 if self.table_id != other.table_id: return False
11110 if self.duration_sec != other.duration_sec: return False
11111 if self.duration_nsec != other.duration_nsec: return False
11112 if self.idle_timeout != other.idle_timeout: return False
11113 if self.hard_timeout != other.hard_timeout: return False
11114 if self.packet_count != other.packet_count: return False
11115 if self.byte_count != other.byte_count: return False
11116 if self.match != other.match: return False
11117 return True
11118
11119 def pretty_print(self, q):
11120 q.text("flow_removed {")
11121 with q.group():
11122 with q.indent(2):
11123 q.breakable()
11124 q.text("xid = ");
11125 if self.xid != None:
11126 q.text("%#x" % self.xid)
11127 else:
11128 q.text('None')
11129 q.text(","); q.breakable()
11130 q.text("cookie = ");
11131 q.text("%#x" % self.cookie)
11132 q.text(","); q.breakable()
11133 q.text("priority = ");
11134 q.text("%#x" % self.priority)
11135 q.text(","); q.breakable()
11136 q.text("reason = ");
11137 q.text("%#x" % self.reason)
11138 q.text(","); q.breakable()
11139 q.text("table_id = ");
11140 q.text("%#x" % self.table_id)
11141 q.text(","); q.breakable()
11142 q.text("duration_sec = ");
11143 q.text("%#x" % self.duration_sec)
11144 q.text(","); q.breakable()
11145 q.text("duration_nsec = ");
11146 q.text("%#x" % self.duration_nsec)
11147 q.text(","); q.breakable()
11148 q.text("idle_timeout = ");
11149 q.text("%#x" % self.idle_timeout)
11150 q.text(","); q.breakable()
11151 q.text("hard_timeout = ");
11152 q.text("%#x" % self.hard_timeout)
11153 q.text(","); q.breakable()
11154 q.text("packet_count = ");
11155 q.text("%#x" % self.packet_count)
11156 q.text(","); q.breakable()
11157 q.text("byte_count = ");
11158 q.text("%#x" % self.byte_count)
11159 q.text(","); q.breakable()
11160 q.text("match = ");
11161 q.pp(self.match)
11162 q.breakable()
11163 q.text('}')
11164
11165message.subtypes[11] = flow_removed
11166
11167class flow_stats_reply(stats_reply):
11168 version = 5
11169 type = 19
11170 stats_type = 1
11171
11172 def __init__(self, xid=None, flags=None, entries=None):
11173 if xid != None:
11174 self.xid = xid
11175 else:
11176 self.xid = None
11177 if flags != None:
11178 self.flags = flags
11179 else:
11180 self.flags = 0
11181 if entries != None:
11182 self.entries = entries
11183 else:
11184 self.entries = []
11185 return
11186
11187 def pack(self):
11188 packed = []
11189 packed.append(struct.pack("!B", self.version))
11190 packed.append(struct.pack("!B", self.type))
11191 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11192 packed.append(struct.pack("!L", self.xid))
11193 packed.append(struct.pack("!H", self.stats_type))
11194 packed.append(struct.pack("!H", self.flags))
11195 packed.append('\x00' * 4)
11196 packed.append(loxi.generic_util.pack_list(self.entries))
11197 length = sum([len(x) for x in packed])
11198 packed[2] = struct.pack("!H", length)
11199 return ''.join(packed)
11200
11201 @staticmethod
11202 def unpack(reader):
11203 obj = flow_stats_reply()
11204 _version = reader.read("!B")[0]
11205 assert(_version == 5)
11206 _type = reader.read("!B")[0]
11207 assert(_type == 19)
11208 _length = reader.read("!H")[0]
11209 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011210 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011211 obj.xid = reader.read("!L")[0]
11212 _stats_type = reader.read("!H")[0]
11213 assert(_stats_type == 1)
11214 obj.flags = reader.read("!H")[0]
11215 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080011216 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070011217 return obj
11218
11219 def __eq__(self, other):
11220 if type(self) != type(other): return False
11221 if self.xid != other.xid: return False
11222 if self.flags != other.flags: return False
11223 if self.entries != other.entries: return False
11224 return True
11225
11226 def pretty_print(self, q):
11227 q.text("flow_stats_reply {")
11228 with q.group():
11229 with q.indent(2):
11230 q.breakable()
11231 q.text("xid = ");
11232 if self.xid != None:
11233 q.text("%#x" % self.xid)
11234 else:
11235 q.text('None')
11236 q.text(","); q.breakable()
11237 q.text("flags = ");
11238 q.text("%#x" % self.flags)
11239 q.text(","); q.breakable()
11240 q.text("entries = ");
11241 q.pp(self.entries)
11242 q.breakable()
11243 q.text('}')
11244
11245stats_reply.subtypes[1] = flow_stats_reply
11246
11247class flow_stats_request(stats_request):
11248 version = 5
11249 type = 18
11250 stats_type = 1
11251
11252 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
11253 if xid != None:
11254 self.xid = xid
11255 else:
11256 self.xid = None
11257 if flags != None:
11258 self.flags = flags
11259 else:
11260 self.flags = 0
11261 if table_id != None:
11262 self.table_id = table_id
11263 else:
11264 self.table_id = 0
11265 if out_port != None:
11266 self.out_port = out_port
11267 else:
11268 self.out_port = 0
11269 if out_group != None:
11270 self.out_group = out_group
11271 else:
11272 self.out_group = 0
11273 if cookie != None:
11274 self.cookie = cookie
11275 else:
11276 self.cookie = 0
11277 if cookie_mask != None:
11278 self.cookie_mask = cookie_mask
11279 else:
11280 self.cookie_mask = 0
11281 if match != None:
11282 self.match = match
11283 else:
Rich Lanee2567702015-01-26 15:04:35 -080011284 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070011285 return
11286
11287 def pack(self):
11288 packed = []
11289 packed.append(struct.pack("!B", self.version))
11290 packed.append(struct.pack("!B", self.type))
11291 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11292 packed.append(struct.pack("!L", self.xid))
11293 packed.append(struct.pack("!H", self.stats_type))
11294 packed.append(struct.pack("!H", self.flags))
11295 packed.append('\x00' * 4)
11296 packed.append(struct.pack("!B", self.table_id))
11297 packed.append('\x00' * 3)
11298 packed.append(util.pack_port_no(self.out_port))
11299 packed.append(struct.pack("!L", self.out_group))
11300 packed.append('\x00' * 4)
11301 packed.append(struct.pack("!Q", self.cookie))
11302 packed.append(struct.pack("!Q", self.cookie_mask))
11303 packed.append(self.match.pack())
11304 length = sum([len(x) for x in packed])
11305 packed[2] = struct.pack("!H", length)
11306 return ''.join(packed)
11307
11308 @staticmethod
11309 def unpack(reader):
11310 obj = flow_stats_request()
11311 _version = reader.read("!B")[0]
11312 assert(_version == 5)
11313 _type = reader.read("!B")[0]
11314 assert(_type == 18)
11315 _length = reader.read("!H")[0]
11316 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011317 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011318 obj.xid = reader.read("!L")[0]
11319 _stats_type = reader.read("!H")[0]
11320 assert(_stats_type == 1)
11321 obj.flags = reader.read("!H")[0]
11322 reader.skip(4)
11323 obj.table_id = reader.read("!B")[0]
11324 reader.skip(3)
11325 obj.out_port = util.unpack_port_no(reader)
11326 obj.out_group = reader.read("!L")[0]
11327 reader.skip(4)
11328 obj.cookie = reader.read("!Q")[0]
11329 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011330 obj.match = ofp.match.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070011331 return obj
11332
11333 def __eq__(self, other):
11334 if type(self) != type(other): return False
11335 if self.xid != other.xid: return False
11336 if self.flags != other.flags: return False
11337 if self.table_id != other.table_id: return False
11338 if self.out_port != other.out_port: return False
11339 if self.out_group != other.out_group: return False
11340 if self.cookie != other.cookie: return False
11341 if self.cookie_mask != other.cookie_mask: return False
11342 if self.match != other.match: return False
11343 return True
11344
11345 def pretty_print(self, q):
11346 q.text("flow_stats_request {")
11347 with q.group():
11348 with q.indent(2):
11349 q.breakable()
11350 q.text("xid = ");
11351 if self.xid != None:
11352 q.text("%#x" % self.xid)
11353 else:
11354 q.text('None')
11355 q.text(","); q.breakable()
11356 q.text("flags = ");
11357 q.text("%#x" % self.flags)
11358 q.text(","); q.breakable()
11359 q.text("table_id = ");
11360 q.text("%#x" % self.table_id)
11361 q.text(","); q.breakable()
11362 q.text("out_port = ");
11363 q.text(util.pretty_port(self.out_port))
11364 q.text(","); q.breakable()
11365 q.text("out_group = ");
11366 q.text("%#x" % self.out_group)
11367 q.text(","); q.breakable()
11368 q.text("cookie = ");
11369 q.text("%#x" % self.cookie)
11370 q.text(","); q.breakable()
11371 q.text("cookie_mask = ");
11372 q.text("%#x" % self.cookie_mask)
11373 q.text(","); q.breakable()
11374 q.text("match = ");
11375 q.pp(self.match)
11376 q.breakable()
11377 q.text('}')
11378
11379stats_request.subtypes[1] = flow_stats_request
11380
11381class get_config_reply(message):
11382 version = 5
11383 type = 8
11384
11385 def __init__(self, xid=None, flags=None, miss_send_len=None):
11386 if xid != None:
11387 self.xid = xid
11388 else:
11389 self.xid = None
11390 if flags != None:
11391 self.flags = flags
11392 else:
11393 self.flags = 0
11394 if miss_send_len != None:
11395 self.miss_send_len = miss_send_len
11396 else:
11397 self.miss_send_len = 0
11398 return
11399
11400 def pack(self):
11401 packed = []
11402 packed.append(struct.pack("!B", self.version))
11403 packed.append(struct.pack("!B", self.type))
11404 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11405 packed.append(struct.pack("!L", self.xid))
11406 packed.append(struct.pack("!H", self.flags))
11407 packed.append(struct.pack("!H", self.miss_send_len))
11408 length = sum([len(x) for x in packed])
11409 packed[2] = struct.pack("!H", length)
11410 return ''.join(packed)
11411
11412 @staticmethod
11413 def unpack(reader):
11414 obj = get_config_reply()
11415 _version = reader.read("!B")[0]
11416 assert(_version == 5)
11417 _type = reader.read("!B")[0]
11418 assert(_type == 8)
11419 _length = reader.read("!H")[0]
11420 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011421 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011422 obj.xid = reader.read("!L")[0]
11423 obj.flags = reader.read("!H")[0]
11424 obj.miss_send_len = reader.read("!H")[0]
11425 return obj
11426
11427 def __eq__(self, other):
11428 if type(self) != type(other): return False
11429 if self.xid != other.xid: return False
11430 if self.flags != other.flags: return False
11431 if self.miss_send_len != other.miss_send_len: return False
11432 return True
11433
11434 def pretty_print(self, q):
11435 q.text("get_config_reply {")
11436 with q.group():
11437 with q.indent(2):
11438 q.breakable()
11439 q.text("xid = ");
11440 if self.xid != None:
11441 q.text("%#x" % self.xid)
11442 else:
11443 q.text('None')
11444 q.text(","); q.breakable()
11445 q.text("flags = ");
11446 q.text("%#x" % self.flags)
11447 q.text(","); q.breakable()
11448 q.text("miss_send_len = ");
11449 q.text("%#x" % self.miss_send_len)
11450 q.breakable()
11451 q.text('}')
11452
11453message.subtypes[8] = get_config_reply
11454
11455class get_config_request(message):
11456 version = 5
11457 type = 7
11458
11459 def __init__(self, xid=None):
11460 if xid != None:
11461 self.xid = xid
11462 else:
11463 self.xid = None
11464 return
11465
11466 def pack(self):
11467 packed = []
11468 packed.append(struct.pack("!B", self.version))
11469 packed.append(struct.pack("!B", self.type))
11470 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11471 packed.append(struct.pack("!L", self.xid))
11472 length = sum([len(x) for x in packed])
11473 packed[2] = struct.pack("!H", length)
11474 return ''.join(packed)
11475
11476 @staticmethod
11477 def unpack(reader):
11478 obj = get_config_request()
11479 _version = reader.read("!B")[0]
11480 assert(_version == 5)
11481 _type = reader.read("!B")[0]
11482 assert(_type == 7)
11483 _length = reader.read("!H")[0]
11484 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011485 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011486 obj.xid = reader.read("!L")[0]
11487 return obj
11488
11489 def __eq__(self, other):
11490 if type(self) != type(other): return False
11491 if self.xid != other.xid: return False
11492 return True
11493
11494 def pretty_print(self, q):
11495 q.text("get_config_request {")
11496 with q.group():
11497 with q.indent(2):
11498 q.breakable()
11499 q.text("xid = ");
11500 if self.xid != None:
11501 q.text("%#x" % self.xid)
11502 else:
11503 q.text('None')
11504 q.breakable()
11505 q.text('}')
11506
11507message.subtypes[7] = get_config_request
11508
11509class group_mod(message):
11510 subtypes = {}
11511
11512 version = 5
11513 type = 15
11514
11515 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11516 if xid != None:
11517 self.xid = xid
11518 else:
11519 self.xid = None
11520 if command != None:
11521 self.command = command
11522 else:
11523 self.command = 0
11524 if group_type != None:
11525 self.group_type = group_type
11526 else:
11527 self.group_type = 0
11528 if group_id != None:
11529 self.group_id = group_id
11530 else:
11531 self.group_id = 0
11532 if buckets != None:
11533 self.buckets = buckets
11534 else:
11535 self.buckets = []
11536 return
11537
11538 def pack(self):
11539 packed = []
11540 packed.append(struct.pack("!B", self.version))
11541 packed.append(struct.pack("!B", self.type))
11542 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11543 packed.append(struct.pack("!L", self.xid))
11544 packed.append(struct.pack("!H", self.command))
11545 packed.append(struct.pack("!B", self.group_type))
11546 packed.append('\x00' * 1)
11547 packed.append(struct.pack("!L", self.group_id))
11548 packed.append(loxi.generic_util.pack_list(self.buckets))
11549 length = sum([len(x) for x in packed])
11550 packed[2] = struct.pack("!H", length)
11551 return ''.join(packed)
11552
11553 @staticmethod
11554 def unpack(reader):
11555 subtype, = reader.peek('!H', 8)
11556 subclass = group_mod.subtypes.get(subtype)
11557 if subclass:
11558 return subclass.unpack(reader)
11559
11560 obj = group_mod()
11561 _version = reader.read("!B")[0]
11562 assert(_version == 5)
11563 _type = reader.read("!B")[0]
11564 assert(_type == 15)
11565 _length = reader.read("!H")[0]
11566 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011567 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011568 obj.xid = reader.read("!L")[0]
11569 obj.command = reader.read("!H")[0]
11570 obj.group_type = reader.read("!B")[0]
11571 reader.skip(1)
11572 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011573 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070011574 return obj
11575
11576 def __eq__(self, other):
11577 if type(self) != type(other): return False
11578 if self.xid != other.xid: return False
11579 if self.command != other.command: 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_mod {")
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
11607message.subtypes[15] = group_mod
11608
11609class group_add(group_mod):
11610 version = 5
11611 type = 15
11612 command = 0
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_add()
11651 _version = reader.read("!B")[0]
11652 assert(_version == 5)
11653 _type = reader.read("!B")[0]
11654 assert(_type == 15)
11655 _length = reader.read("!H")[0]
11656 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011657 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011658 obj.xid = reader.read("!L")[0]
11659 _command = reader.read("!H")[0]
11660 assert(_command == 0)
11661 obj.group_type = reader.read("!B")[0]
11662 reader.skip(1)
11663 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011664 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070011665 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_add {")
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[0] = group_add
11698
11699class group_delete(group_mod):
11700 version = 5
11701 type = 15
11702 command = 2
11703
11704 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11705 if xid != None:
11706 self.xid = xid
11707 else:
11708 self.xid = None
11709 if group_type != None:
11710 self.group_type = group_type
11711 else:
11712 self.group_type = 0
11713 if group_id != None:
11714 self.group_id = group_id
11715 else:
11716 self.group_id = 0
11717 if buckets != None:
11718 self.buckets = buckets
11719 else:
11720 self.buckets = []
11721 return
11722
11723 def pack(self):
11724 packed = []
11725 packed.append(struct.pack("!B", self.version))
11726 packed.append(struct.pack("!B", self.type))
11727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11728 packed.append(struct.pack("!L", self.xid))
11729 packed.append(struct.pack("!H", self.command))
11730 packed.append(struct.pack("!B", self.group_type))
11731 packed.append('\x00' * 1)
11732 packed.append(struct.pack("!L", self.group_id))
11733 packed.append(loxi.generic_util.pack_list(self.buckets))
11734 length = sum([len(x) for x in packed])
11735 packed[2] = struct.pack("!H", length)
11736 return ''.join(packed)
11737
11738 @staticmethod
11739 def unpack(reader):
11740 obj = group_delete()
11741 _version = reader.read("!B")[0]
11742 assert(_version == 5)
11743 _type = reader.read("!B")[0]
11744 assert(_type == 15)
11745 _length = reader.read("!H")[0]
11746 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011747 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011748 obj.xid = reader.read("!L")[0]
11749 _command = reader.read("!H")[0]
11750 assert(_command == 2)
11751 obj.group_type = reader.read("!B")[0]
11752 reader.skip(1)
11753 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011754 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070011755 return obj
11756
11757 def __eq__(self, other):
11758 if type(self) != type(other): return False
11759 if self.xid != other.xid: return False
11760 if self.group_type != other.group_type: return False
11761 if self.group_id != other.group_id: return False
11762 if self.buckets != other.buckets: return False
11763 return True
11764
11765 def pretty_print(self, q):
11766 q.text("group_delete {")
11767 with q.group():
11768 with q.indent(2):
11769 q.breakable()
11770 q.text("xid = ");
11771 if self.xid != None:
11772 q.text("%#x" % self.xid)
11773 else:
11774 q.text('None')
11775 q.text(","); q.breakable()
11776 q.text("group_type = ");
11777 q.text("%#x" % self.group_type)
11778 q.text(","); q.breakable()
11779 q.text("group_id = ");
11780 q.text("%#x" % self.group_id)
11781 q.text(","); q.breakable()
11782 q.text("buckets = ");
11783 q.pp(self.buckets)
11784 q.breakable()
11785 q.text('}')
11786
11787group_mod.subtypes[2] = group_delete
11788
11789class group_desc_stats_reply(stats_reply):
11790 version = 5
11791 type = 19
11792 stats_type = 7
11793
11794 def __init__(self, xid=None, flags=None, entries=None):
11795 if xid != None:
11796 self.xid = xid
11797 else:
11798 self.xid = None
11799 if flags != None:
11800 self.flags = flags
11801 else:
11802 self.flags = 0
11803 if entries != None:
11804 self.entries = entries
11805 else:
11806 self.entries = []
11807 return
11808
11809 def pack(self):
11810 packed = []
11811 packed.append(struct.pack("!B", self.version))
11812 packed.append(struct.pack("!B", self.type))
11813 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11814 packed.append(struct.pack("!L", self.xid))
11815 packed.append(struct.pack("!H", self.stats_type))
11816 packed.append(struct.pack("!H", self.flags))
11817 packed.append('\x00' * 4)
11818 packed.append(loxi.generic_util.pack_list(self.entries))
11819 length = sum([len(x) for x in packed])
11820 packed[2] = struct.pack("!H", length)
11821 return ''.join(packed)
11822
11823 @staticmethod
11824 def unpack(reader):
11825 obj = group_desc_stats_reply()
11826 _version = reader.read("!B")[0]
11827 assert(_version == 5)
11828 _type = reader.read("!B")[0]
11829 assert(_type == 19)
11830 _length = reader.read("!H")[0]
11831 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011832 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011833 obj.xid = reader.read("!L")[0]
11834 _stats_type = reader.read("!H")[0]
11835 assert(_stats_type == 7)
11836 obj.flags = reader.read("!H")[0]
11837 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080011838 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070011839 return obj
11840
11841 def __eq__(self, other):
11842 if type(self) != type(other): return False
11843 if self.xid != other.xid: return False
11844 if self.flags != other.flags: return False
11845 if self.entries != other.entries: return False
11846 return True
11847
11848 def pretty_print(self, q):
11849 q.text("group_desc_stats_reply {")
11850 with q.group():
11851 with q.indent(2):
11852 q.breakable()
11853 q.text("xid = ");
11854 if self.xid != None:
11855 q.text("%#x" % self.xid)
11856 else:
11857 q.text('None')
11858 q.text(","); q.breakable()
11859 q.text("flags = ");
11860 q.text("%#x" % self.flags)
11861 q.text(","); q.breakable()
11862 q.text("entries = ");
11863 q.pp(self.entries)
11864 q.breakable()
11865 q.text('}')
11866
11867stats_reply.subtypes[7] = group_desc_stats_reply
11868
11869class group_desc_stats_request(stats_request):
11870 version = 5
11871 type = 18
11872 stats_type = 7
11873
11874 def __init__(self, xid=None, flags=None):
11875 if xid != None:
11876 self.xid = xid
11877 else:
11878 self.xid = None
11879 if flags != None:
11880 self.flags = flags
11881 else:
11882 self.flags = 0
11883 return
11884
11885 def pack(self):
11886 packed = []
11887 packed.append(struct.pack("!B", self.version))
11888 packed.append(struct.pack("!B", self.type))
11889 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11890 packed.append(struct.pack("!L", self.xid))
11891 packed.append(struct.pack("!H", self.stats_type))
11892 packed.append(struct.pack("!H", self.flags))
11893 packed.append('\x00' * 4)
11894 length = sum([len(x) for x in packed])
11895 packed[2] = struct.pack("!H", length)
11896 return ''.join(packed)
11897
11898 @staticmethod
11899 def unpack(reader):
11900 obj = group_desc_stats_request()
11901 _version = reader.read("!B")[0]
11902 assert(_version == 5)
11903 _type = reader.read("!B")[0]
11904 assert(_type == 18)
11905 _length = reader.read("!H")[0]
11906 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011907 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070011908 obj.xid = reader.read("!L")[0]
11909 _stats_type = reader.read("!H")[0]
11910 assert(_stats_type == 7)
11911 obj.flags = reader.read("!H")[0]
11912 reader.skip(4)
11913 return obj
11914
11915 def __eq__(self, other):
11916 if type(self) != type(other): return False
11917 if self.xid != other.xid: return False
11918 if self.flags != other.flags: return False
11919 return True
11920
11921 def pretty_print(self, q):
11922 q.text("group_desc_stats_request {")
11923 with q.group():
11924 with q.indent(2):
11925 q.breakable()
11926 q.text("xid = ");
11927 if self.xid != None:
11928 q.text("%#x" % self.xid)
11929 else:
11930 q.text('None')
11931 q.text(","); q.breakable()
11932 q.text("flags = ");
11933 q.text("%#x" % self.flags)
11934 q.breakable()
11935 q.text('}')
11936
11937stats_request.subtypes[7] = group_desc_stats_request
11938
11939class group_features_stats_reply(stats_reply):
11940 version = 5
11941 type = 19
11942 stats_type = 8
11943
11944 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):
11945 if xid != None:
11946 self.xid = xid
11947 else:
11948 self.xid = None
11949 if flags != None:
11950 self.flags = flags
11951 else:
11952 self.flags = 0
11953 if types != None:
11954 self.types = types
11955 else:
11956 self.types = 0
11957 if capabilities != None:
11958 self.capabilities = capabilities
11959 else:
11960 self.capabilities = 0
11961 if max_groups_all != None:
11962 self.max_groups_all = max_groups_all
11963 else:
11964 self.max_groups_all = 0
11965 if max_groups_select != None:
11966 self.max_groups_select = max_groups_select
11967 else:
11968 self.max_groups_select = 0
11969 if max_groups_indirect != None:
11970 self.max_groups_indirect = max_groups_indirect
11971 else:
11972 self.max_groups_indirect = 0
11973 if max_groups_ff != None:
11974 self.max_groups_ff = max_groups_ff
11975 else:
11976 self.max_groups_ff = 0
11977 if actions_all != None:
11978 self.actions_all = actions_all
11979 else:
11980 self.actions_all = 0
11981 if actions_select != None:
11982 self.actions_select = actions_select
11983 else:
11984 self.actions_select = 0
11985 if actions_indirect != None:
11986 self.actions_indirect = actions_indirect
11987 else:
11988 self.actions_indirect = 0
11989 if actions_ff != None:
11990 self.actions_ff = actions_ff
11991 else:
11992 self.actions_ff = 0
11993 return
11994
11995 def pack(self):
11996 packed = []
11997 packed.append(struct.pack("!B", self.version))
11998 packed.append(struct.pack("!B", self.type))
11999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12000 packed.append(struct.pack("!L", self.xid))
12001 packed.append(struct.pack("!H", self.stats_type))
12002 packed.append(struct.pack("!H", self.flags))
12003 packed.append('\x00' * 4)
12004 packed.append(struct.pack("!L", self.types))
12005 packed.append(struct.pack("!L", self.capabilities))
12006 packed.append(struct.pack("!L", self.max_groups_all))
12007 packed.append(struct.pack("!L", self.max_groups_select))
12008 packed.append(struct.pack("!L", self.max_groups_indirect))
12009 packed.append(struct.pack("!L", self.max_groups_ff))
12010 packed.append(struct.pack("!L", self.actions_all))
12011 packed.append(struct.pack("!L", self.actions_select))
12012 packed.append(struct.pack("!L", self.actions_indirect))
12013 packed.append(struct.pack("!L", self.actions_ff))
12014 length = sum([len(x) for x in packed])
12015 packed[2] = struct.pack("!H", length)
12016 return ''.join(packed)
12017
12018 @staticmethod
12019 def unpack(reader):
12020 obj = group_features_stats_reply()
12021 _version = reader.read("!B")[0]
12022 assert(_version == 5)
12023 _type = reader.read("!B")[0]
12024 assert(_type == 19)
12025 _length = reader.read("!H")[0]
12026 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012027 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012028 obj.xid = reader.read("!L")[0]
12029 _stats_type = reader.read("!H")[0]
12030 assert(_stats_type == 8)
12031 obj.flags = reader.read("!H")[0]
12032 reader.skip(4)
12033 obj.types = reader.read("!L")[0]
12034 obj.capabilities = reader.read("!L")[0]
12035 obj.max_groups_all = reader.read("!L")[0]
12036 obj.max_groups_select = reader.read("!L")[0]
12037 obj.max_groups_indirect = reader.read("!L")[0]
12038 obj.max_groups_ff = reader.read("!L")[0]
12039 obj.actions_all = reader.read("!L")[0]
12040 obj.actions_select = reader.read("!L")[0]
12041 obj.actions_indirect = reader.read("!L")[0]
12042 obj.actions_ff = reader.read("!L")[0]
12043 return obj
12044
12045 def __eq__(self, other):
12046 if type(self) != type(other): return False
12047 if self.xid != other.xid: return False
12048 if self.flags != other.flags: return False
12049 if self.types != other.types: return False
12050 if self.capabilities != other.capabilities: return False
12051 if self.max_groups_all != other.max_groups_all: return False
12052 if self.max_groups_select != other.max_groups_select: return False
12053 if self.max_groups_indirect != other.max_groups_indirect: return False
12054 if self.max_groups_ff != other.max_groups_ff: return False
12055 if self.actions_all != other.actions_all: return False
12056 if self.actions_select != other.actions_select: return False
12057 if self.actions_indirect != other.actions_indirect: return False
12058 if self.actions_ff != other.actions_ff: return False
12059 return True
12060
12061 def pretty_print(self, q):
12062 q.text("group_features_stats_reply {")
12063 with q.group():
12064 with q.indent(2):
12065 q.breakable()
12066 q.text("xid = ");
12067 if self.xid != None:
12068 q.text("%#x" % self.xid)
12069 else:
12070 q.text('None')
12071 q.text(","); q.breakable()
12072 q.text("flags = ");
12073 q.text("%#x" % self.flags)
12074 q.text(","); q.breakable()
12075 q.text("types = ");
12076 q.text("%#x" % self.types)
12077 q.text(","); q.breakable()
12078 q.text("capabilities = ");
12079 q.text("%#x" % self.capabilities)
12080 q.text(","); q.breakable()
12081 q.text("max_groups_all = ");
12082 q.text("%#x" % self.max_groups_all)
12083 q.text(","); q.breakable()
12084 q.text("max_groups_select = ");
12085 q.text("%#x" % self.max_groups_select)
12086 q.text(","); q.breakable()
12087 q.text("max_groups_indirect = ");
12088 q.text("%#x" % self.max_groups_indirect)
12089 q.text(","); q.breakable()
12090 q.text("max_groups_ff = ");
12091 q.text("%#x" % self.max_groups_ff)
12092 q.text(","); q.breakable()
12093 q.text("actions_all = ");
12094 q.text("%#x" % self.actions_all)
12095 q.text(","); q.breakable()
12096 q.text("actions_select = ");
12097 q.text("%#x" % self.actions_select)
12098 q.text(","); q.breakable()
12099 q.text("actions_indirect = ");
12100 q.text("%#x" % self.actions_indirect)
12101 q.text(","); q.breakable()
12102 q.text("actions_ff = ");
12103 q.text("%#x" % self.actions_ff)
12104 q.breakable()
12105 q.text('}')
12106
12107stats_reply.subtypes[8] = group_features_stats_reply
12108
12109class group_features_stats_request(stats_request):
12110 version = 5
12111 type = 18
12112 stats_type = 8
12113
12114 def __init__(self, xid=None, flags=None):
12115 if xid != None:
12116 self.xid = xid
12117 else:
12118 self.xid = None
12119 if flags != None:
12120 self.flags = flags
12121 else:
12122 self.flags = 0
12123 return
12124
12125 def pack(self):
12126 packed = []
12127 packed.append(struct.pack("!B", self.version))
12128 packed.append(struct.pack("!B", self.type))
12129 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12130 packed.append(struct.pack("!L", self.xid))
12131 packed.append(struct.pack("!H", self.stats_type))
12132 packed.append(struct.pack("!H", self.flags))
12133 packed.append('\x00' * 4)
12134 length = sum([len(x) for x in packed])
12135 packed[2] = struct.pack("!H", length)
12136 return ''.join(packed)
12137
12138 @staticmethod
12139 def unpack(reader):
12140 obj = group_features_stats_request()
12141 _version = reader.read("!B")[0]
12142 assert(_version == 5)
12143 _type = reader.read("!B")[0]
12144 assert(_type == 18)
12145 _length = reader.read("!H")[0]
12146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012147 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012148 obj.xid = reader.read("!L")[0]
12149 _stats_type = reader.read("!H")[0]
12150 assert(_stats_type == 8)
12151 obj.flags = reader.read("!H")[0]
12152 reader.skip(4)
12153 return obj
12154
12155 def __eq__(self, other):
12156 if type(self) != type(other): return False
12157 if self.xid != other.xid: return False
12158 if self.flags != other.flags: return False
12159 return True
12160
12161 def pretty_print(self, q):
12162 q.text("group_features_stats_request {")
12163 with q.group():
12164 with q.indent(2):
12165 q.breakable()
12166 q.text("xid = ");
12167 if self.xid != None:
12168 q.text("%#x" % self.xid)
12169 else:
12170 q.text('None')
12171 q.text(","); q.breakable()
12172 q.text("flags = ");
12173 q.text("%#x" % self.flags)
12174 q.breakable()
12175 q.text('}')
12176
12177stats_request.subtypes[8] = group_features_stats_request
12178
12179class group_mod_failed_error_msg(error_msg):
12180 version = 5
12181 type = 1
12182 err_type = 6
12183
12184 def __init__(self, xid=None, code=None, data=None):
12185 if xid != None:
12186 self.xid = xid
12187 else:
12188 self.xid = None
12189 if code != None:
12190 self.code = code
12191 else:
12192 self.code = 0
12193 if data != None:
12194 self.data = data
12195 else:
12196 self.data = ''
12197 return
12198
12199 def pack(self):
12200 packed = []
12201 packed.append(struct.pack("!B", self.version))
12202 packed.append(struct.pack("!B", self.type))
12203 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12204 packed.append(struct.pack("!L", self.xid))
12205 packed.append(struct.pack("!H", self.err_type))
12206 packed.append(struct.pack("!H", self.code))
12207 packed.append(self.data)
12208 length = sum([len(x) for x in packed])
12209 packed[2] = struct.pack("!H", length)
12210 return ''.join(packed)
12211
12212 @staticmethod
12213 def unpack(reader):
12214 obj = group_mod_failed_error_msg()
12215 _version = reader.read("!B")[0]
12216 assert(_version == 5)
12217 _type = reader.read("!B")[0]
12218 assert(_type == 1)
12219 _length = reader.read("!H")[0]
12220 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012221 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012222 obj.xid = reader.read("!L")[0]
12223 _err_type = reader.read("!H")[0]
12224 assert(_err_type == 6)
12225 obj.code = reader.read("!H")[0]
12226 obj.data = str(reader.read_all())
12227 return obj
12228
12229 def __eq__(self, other):
12230 if type(self) != type(other): return False
12231 if self.xid != other.xid: return False
12232 if self.code != other.code: return False
12233 if self.data != other.data: return False
12234 return True
12235
12236 def pretty_print(self, q):
12237 q.text("group_mod_failed_error_msg {")
12238 with q.group():
12239 with q.indent(2):
12240 q.breakable()
12241 q.text("xid = ");
12242 if self.xid != None:
12243 q.text("%#x" % self.xid)
12244 else:
12245 q.text('None')
12246 q.text(","); q.breakable()
12247 q.text("code = ");
12248 q.text("%#x" % self.code)
12249 q.text(","); q.breakable()
12250 q.text("data = ");
12251 q.pp(self.data)
12252 q.breakable()
12253 q.text('}')
12254
12255error_msg.subtypes[6] = group_mod_failed_error_msg
12256
12257class group_modify(group_mod):
12258 version = 5
12259 type = 15
12260 command = 1
12261
12262 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
12263 if xid != None:
12264 self.xid = xid
12265 else:
12266 self.xid = None
12267 if group_type != None:
12268 self.group_type = group_type
12269 else:
12270 self.group_type = 0
12271 if group_id != None:
12272 self.group_id = group_id
12273 else:
12274 self.group_id = 0
12275 if buckets != None:
12276 self.buckets = buckets
12277 else:
12278 self.buckets = []
12279 return
12280
12281 def pack(self):
12282 packed = []
12283 packed.append(struct.pack("!B", self.version))
12284 packed.append(struct.pack("!B", self.type))
12285 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12286 packed.append(struct.pack("!L", self.xid))
12287 packed.append(struct.pack("!H", self.command))
12288 packed.append(struct.pack("!B", self.group_type))
12289 packed.append('\x00' * 1)
12290 packed.append(struct.pack("!L", self.group_id))
12291 packed.append(loxi.generic_util.pack_list(self.buckets))
12292 length = sum([len(x) for x in packed])
12293 packed[2] = struct.pack("!H", length)
12294 return ''.join(packed)
12295
12296 @staticmethod
12297 def unpack(reader):
12298 obj = group_modify()
12299 _version = reader.read("!B")[0]
12300 assert(_version == 5)
12301 _type = reader.read("!B")[0]
12302 assert(_type == 15)
12303 _length = reader.read("!H")[0]
12304 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012305 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012306 obj.xid = reader.read("!L")[0]
12307 _command = reader.read("!H")[0]
12308 assert(_command == 1)
12309 obj.group_type = reader.read("!B")[0]
12310 reader.skip(1)
12311 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012312 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070012313 return obj
12314
12315 def __eq__(self, other):
12316 if type(self) != type(other): return False
12317 if self.xid != other.xid: return False
12318 if self.group_type != other.group_type: return False
12319 if self.group_id != other.group_id: return False
12320 if self.buckets != other.buckets: return False
12321 return True
12322
12323 def pretty_print(self, q):
12324 q.text("group_modify {")
12325 with q.group():
12326 with q.indent(2):
12327 q.breakable()
12328 q.text("xid = ");
12329 if self.xid != None:
12330 q.text("%#x" % self.xid)
12331 else:
12332 q.text('None')
12333 q.text(","); q.breakable()
12334 q.text("group_type = ");
12335 q.text("%#x" % self.group_type)
12336 q.text(","); q.breakable()
12337 q.text("group_id = ");
12338 q.text("%#x" % self.group_id)
12339 q.text(","); q.breakable()
12340 q.text("buckets = ");
12341 q.pp(self.buckets)
12342 q.breakable()
12343 q.text('}')
12344
12345group_mod.subtypes[1] = group_modify
12346
12347class group_stats_reply(stats_reply):
12348 version = 5
12349 type = 19
12350 stats_type = 6
12351
12352 def __init__(self, xid=None, flags=None, entries=None):
12353 if xid != None:
12354 self.xid = xid
12355 else:
12356 self.xid = None
12357 if flags != None:
12358 self.flags = flags
12359 else:
12360 self.flags = 0
12361 if entries != None:
12362 self.entries = entries
12363 else:
12364 self.entries = []
12365 return
12366
12367 def pack(self):
12368 packed = []
12369 packed.append(struct.pack("!B", self.version))
12370 packed.append(struct.pack("!B", self.type))
12371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12372 packed.append(struct.pack("!L", self.xid))
12373 packed.append(struct.pack("!H", self.stats_type))
12374 packed.append(struct.pack("!H", self.flags))
12375 packed.append('\x00' * 4)
12376 packed.append(loxi.generic_util.pack_list(self.entries))
12377 length = sum([len(x) for x in packed])
12378 packed[2] = struct.pack("!H", length)
12379 return ''.join(packed)
12380
12381 @staticmethod
12382 def unpack(reader):
12383 obj = group_stats_reply()
12384 _version = reader.read("!B")[0]
12385 assert(_version == 5)
12386 _type = reader.read("!B")[0]
12387 assert(_type == 19)
12388 _length = reader.read("!H")[0]
12389 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012390 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012391 obj.xid = reader.read("!L")[0]
12392 _stats_type = reader.read("!H")[0]
12393 assert(_stats_type == 6)
12394 obj.flags = reader.read("!H")[0]
12395 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012396 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070012397 return obj
12398
12399 def __eq__(self, other):
12400 if type(self) != type(other): return False
12401 if self.xid != other.xid: return False
12402 if self.flags != other.flags: return False
12403 if self.entries != other.entries: return False
12404 return True
12405
12406 def pretty_print(self, q):
12407 q.text("group_stats_reply {")
12408 with q.group():
12409 with q.indent(2):
12410 q.breakable()
12411 q.text("xid = ");
12412 if self.xid != None:
12413 q.text("%#x" % self.xid)
12414 else:
12415 q.text('None')
12416 q.text(","); q.breakable()
12417 q.text("flags = ");
12418 q.text("%#x" % self.flags)
12419 q.text(","); q.breakable()
12420 q.text("entries = ");
12421 q.pp(self.entries)
12422 q.breakable()
12423 q.text('}')
12424
12425stats_reply.subtypes[6] = group_stats_reply
12426
12427class group_stats_request(stats_request):
12428 version = 5
12429 type = 18
12430 stats_type = 6
12431
12432 def __init__(self, xid=None, flags=None, group_id=None):
12433 if xid != None:
12434 self.xid = xid
12435 else:
12436 self.xid = None
12437 if flags != None:
12438 self.flags = flags
12439 else:
12440 self.flags = 0
12441 if group_id != None:
12442 self.group_id = group_id
12443 else:
12444 self.group_id = 0
12445 return
12446
12447 def pack(self):
12448 packed = []
12449 packed.append(struct.pack("!B", self.version))
12450 packed.append(struct.pack("!B", self.type))
12451 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12452 packed.append(struct.pack("!L", self.xid))
12453 packed.append(struct.pack("!H", self.stats_type))
12454 packed.append(struct.pack("!H", self.flags))
12455 packed.append('\x00' * 4)
12456 packed.append(struct.pack("!L", self.group_id))
12457 packed.append('\x00' * 4)
12458 length = sum([len(x) for x in packed])
12459 packed[2] = struct.pack("!H", length)
12460 return ''.join(packed)
12461
12462 @staticmethod
12463 def unpack(reader):
12464 obj = group_stats_request()
12465 _version = reader.read("!B")[0]
12466 assert(_version == 5)
12467 _type = reader.read("!B")[0]
12468 assert(_type == 18)
12469 _length = reader.read("!H")[0]
12470 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012471 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012472 obj.xid = reader.read("!L")[0]
12473 _stats_type = reader.read("!H")[0]
12474 assert(_stats_type == 6)
12475 obj.flags = reader.read("!H")[0]
12476 reader.skip(4)
12477 obj.group_id = reader.read("!L")[0]
12478 reader.skip(4)
12479 return obj
12480
12481 def __eq__(self, other):
12482 if type(self) != type(other): return False
12483 if self.xid != other.xid: return False
12484 if self.flags != other.flags: return False
12485 if self.group_id != other.group_id: return False
12486 return True
12487
12488 def pretty_print(self, q):
12489 q.text("group_stats_request {")
12490 with q.group():
12491 with q.indent(2):
12492 q.breakable()
12493 q.text("xid = ");
12494 if self.xid != None:
12495 q.text("%#x" % self.xid)
12496 else:
12497 q.text('None')
12498 q.text(","); q.breakable()
12499 q.text("flags = ");
12500 q.text("%#x" % self.flags)
12501 q.text(","); q.breakable()
12502 q.text("group_id = ");
12503 q.text("%#x" % self.group_id)
12504 q.breakable()
12505 q.text('}')
12506
12507stats_request.subtypes[6] = group_stats_request
12508
12509class hello(message):
12510 version = 5
12511 type = 0
12512
12513 def __init__(self, xid=None, elements=None):
12514 if xid != None:
12515 self.xid = xid
12516 else:
12517 self.xid = None
12518 if elements != None:
12519 self.elements = elements
12520 else:
12521 self.elements = []
12522 return
12523
12524 def pack(self):
12525 packed = []
12526 packed.append(struct.pack("!B", self.version))
12527 packed.append(struct.pack("!B", self.type))
12528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12529 packed.append(struct.pack("!L", self.xid))
12530 packed.append(loxi.generic_util.pack_list(self.elements))
12531 length = sum([len(x) for x in packed])
12532 packed[2] = struct.pack("!H", length)
12533 return ''.join(packed)
12534
12535 @staticmethod
12536 def unpack(reader):
12537 obj = hello()
12538 _version = reader.read("!B")[0]
12539 assert(_version == 5)
12540 _type = reader.read("!B")[0]
12541 assert(_type == 0)
12542 _length = reader.read("!H")[0]
12543 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012544 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012545 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012546 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070012547 return obj
12548
12549 def __eq__(self, other):
12550 if type(self) != type(other): return False
12551 if self.xid != other.xid: return False
12552 if self.elements != other.elements: return False
12553 return True
12554
12555 def pretty_print(self, q):
12556 q.text("hello {")
12557 with q.group():
12558 with q.indent(2):
12559 q.breakable()
12560 q.text("xid = ");
12561 if self.xid != None:
12562 q.text("%#x" % self.xid)
12563 else:
12564 q.text('None')
12565 q.text(","); q.breakable()
12566 q.text("elements = ");
12567 q.pp(self.elements)
12568 q.breakable()
12569 q.text('}')
12570
12571message.subtypes[0] = hello
12572
12573class hello_failed_error_msg(error_msg):
12574 version = 5
12575 type = 1
12576 err_type = 0
12577
12578 def __init__(self, xid=None, code=None, data=None):
12579 if xid != None:
12580 self.xid = xid
12581 else:
12582 self.xid = None
12583 if code != None:
12584 self.code = code
12585 else:
12586 self.code = 0
12587 if data != None:
12588 self.data = data
12589 else:
12590 self.data = ''
12591 return
12592
12593 def pack(self):
12594 packed = []
12595 packed.append(struct.pack("!B", self.version))
12596 packed.append(struct.pack("!B", self.type))
12597 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12598 packed.append(struct.pack("!L", self.xid))
12599 packed.append(struct.pack("!H", self.err_type))
12600 packed.append(struct.pack("!H", self.code))
12601 packed.append(self.data)
12602 length = sum([len(x) for x in packed])
12603 packed[2] = struct.pack("!H", length)
12604 return ''.join(packed)
12605
12606 @staticmethod
12607 def unpack(reader):
12608 obj = hello_failed_error_msg()
12609 _version = reader.read("!B")[0]
12610 assert(_version == 5)
12611 _type = reader.read("!B")[0]
12612 assert(_type == 1)
12613 _length = reader.read("!H")[0]
12614 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012615 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012616 obj.xid = reader.read("!L")[0]
12617 _err_type = reader.read("!H")[0]
12618 assert(_err_type == 0)
12619 obj.code = reader.read("!H")[0]
12620 obj.data = str(reader.read_all())
12621 return obj
12622
12623 def __eq__(self, other):
12624 if type(self) != type(other): return False
12625 if self.xid != other.xid: return False
12626 if self.code != other.code: return False
12627 if self.data != other.data: return False
12628 return True
12629
12630 def pretty_print(self, q):
12631 q.text("hello_failed_error_msg {")
12632 with q.group():
12633 with q.indent(2):
12634 q.breakable()
12635 q.text("xid = ");
12636 if self.xid != None:
12637 q.text("%#x" % self.xid)
12638 else:
12639 q.text('None')
12640 q.text(","); q.breakable()
12641 q.text("code = ");
12642 q.text("%#x" % self.code)
12643 q.text(","); q.breakable()
12644 q.text("data = ");
12645 q.pp(self.data)
12646 q.breakable()
12647 q.text('}')
12648
12649error_msg.subtypes[0] = hello_failed_error_msg
12650
12651class meter_config_stats_reply(stats_reply):
12652 version = 5
12653 type = 19
12654 stats_type = 10
12655
12656 def __init__(self, xid=None, flags=None, entries=None):
12657 if xid != None:
12658 self.xid = xid
12659 else:
12660 self.xid = None
12661 if flags != None:
12662 self.flags = flags
12663 else:
12664 self.flags = 0
12665 if entries != None:
12666 self.entries = entries
12667 else:
12668 self.entries = []
12669 return
12670
12671 def pack(self):
12672 packed = []
12673 packed.append(struct.pack("!B", self.version))
12674 packed.append(struct.pack("!B", self.type))
12675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12676 packed.append(struct.pack("!L", self.xid))
12677 packed.append(struct.pack("!H", self.stats_type))
12678 packed.append(struct.pack("!H", self.flags))
12679 packed.append('\x00' * 4)
12680 packed.append(loxi.generic_util.pack_list(self.entries))
12681 length = sum([len(x) for x in packed])
12682 packed[2] = struct.pack("!H", length)
12683 return ''.join(packed)
12684
12685 @staticmethod
12686 def unpack(reader):
12687 obj = meter_config_stats_reply()
12688 _version = reader.read("!B")[0]
12689 assert(_version == 5)
12690 _type = reader.read("!B")[0]
12691 assert(_type == 19)
12692 _length = reader.read("!H")[0]
12693 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012694 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012695 obj.xid = reader.read("!L")[0]
12696 _stats_type = reader.read("!H")[0]
12697 assert(_stats_type == 10)
12698 obj.flags = reader.read("!H")[0]
12699 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012700 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070012701 return obj
12702
12703 def __eq__(self, other):
12704 if type(self) != type(other): return False
12705 if self.xid != other.xid: return False
12706 if self.flags != other.flags: return False
12707 if self.entries != other.entries: return False
12708 return True
12709
12710 def pretty_print(self, q):
12711 q.text("meter_config_stats_reply {")
12712 with q.group():
12713 with q.indent(2):
12714 q.breakable()
12715 q.text("xid = ");
12716 if self.xid != None:
12717 q.text("%#x" % self.xid)
12718 else:
12719 q.text('None')
12720 q.text(","); q.breakable()
12721 q.text("flags = ");
12722 q.text("%#x" % self.flags)
12723 q.text(","); q.breakable()
12724 q.text("entries = ");
12725 q.pp(self.entries)
12726 q.breakable()
12727 q.text('}')
12728
12729stats_reply.subtypes[10] = meter_config_stats_reply
12730
12731class meter_config_stats_request(stats_request):
12732 version = 5
12733 type = 18
12734 stats_type = 10
12735
12736 def __init__(self, xid=None, flags=None, meter_id=None):
12737 if xid != None:
12738 self.xid = xid
12739 else:
12740 self.xid = None
12741 if flags != None:
12742 self.flags = flags
12743 else:
12744 self.flags = 0
12745 if meter_id != None:
12746 self.meter_id = meter_id
12747 else:
12748 self.meter_id = 0
12749 return
12750
12751 def pack(self):
12752 packed = []
12753 packed.append(struct.pack("!B", self.version))
12754 packed.append(struct.pack("!B", self.type))
12755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12756 packed.append(struct.pack("!L", self.xid))
12757 packed.append(struct.pack("!H", self.stats_type))
12758 packed.append(struct.pack("!H", self.flags))
12759 packed.append('\x00' * 4)
12760 packed.append(struct.pack("!L", self.meter_id))
12761 packed.append('\x00' * 4)
12762 length = sum([len(x) for x in packed])
12763 packed[2] = struct.pack("!H", length)
12764 return ''.join(packed)
12765
12766 @staticmethod
12767 def unpack(reader):
12768 obj = meter_config_stats_request()
12769 _version = reader.read("!B")[0]
12770 assert(_version == 5)
12771 _type = reader.read("!B")[0]
12772 assert(_type == 18)
12773 _length = reader.read("!H")[0]
12774 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012775 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012776 obj.xid = reader.read("!L")[0]
12777 _stats_type = reader.read("!H")[0]
12778 assert(_stats_type == 10)
12779 obj.flags = reader.read("!H")[0]
12780 reader.skip(4)
12781 obj.meter_id = reader.read("!L")[0]
12782 reader.skip(4)
12783 return obj
12784
12785 def __eq__(self, other):
12786 if type(self) != type(other): return False
12787 if self.xid != other.xid: return False
12788 if self.flags != other.flags: return False
12789 if self.meter_id != other.meter_id: return False
12790 return True
12791
12792 def pretty_print(self, q):
12793 q.text("meter_config_stats_request {")
12794 with q.group():
12795 with q.indent(2):
12796 q.breakable()
12797 q.text("xid = ");
12798 if self.xid != None:
12799 q.text("%#x" % self.xid)
12800 else:
12801 q.text('None')
12802 q.text(","); q.breakable()
12803 q.text("flags = ");
12804 q.text("%#x" % self.flags)
12805 q.text(","); q.breakable()
12806 q.text("meter_id = ");
12807 q.text("%#x" % self.meter_id)
12808 q.breakable()
12809 q.text('}')
12810
12811stats_request.subtypes[10] = meter_config_stats_request
12812
12813class meter_features_stats_reply(stats_reply):
12814 version = 5
12815 type = 19
12816 stats_type = 11
12817
12818 def __init__(self, xid=None, flags=None, features=None):
12819 if xid != None:
12820 self.xid = xid
12821 else:
12822 self.xid = None
12823 if flags != None:
12824 self.flags = flags
12825 else:
12826 self.flags = 0
12827 if features != None:
12828 self.features = features
12829 else:
Rich Lanee2567702015-01-26 15:04:35 -080012830 self.features = ofp.meter_features()
Rich Lane2e079da2014-10-29 15:30:24 -070012831 return
12832
12833 def pack(self):
12834 packed = []
12835 packed.append(struct.pack("!B", self.version))
12836 packed.append(struct.pack("!B", self.type))
12837 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12838 packed.append(struct.pack("!L", self.xid))
12839 packed.append(struct.pack("!H", self.stats_type))
12840 packed.append(struct.pack("!H", self.flags))
12841 packed.append('\x00' * 4)
12842 packed.append(self.features.pack())
12843 length = sum([len(x) for x in packed])
12844 packed[2] = struct.pack("!H", length)
12845 return ''.join(packed)
12846
12847 @staticmethod
12848 def unpack(reader):
12849 obj = meter_features_stats_reply()
12850 _version = reader.read("!B")[0]
12851 assert(_version == 5)
12852 _type = reader.read("!B")[0]
12853 assert(_type == 19)
12854 _length = reader.read("!H")[0]
12855 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012856 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012857 obj.xid = reader.read("!L")[0]
12858 _stats_type = reader.read("!H")[0]
12859 assert(_stats_type == 11)
12860 obj.flags = reader.read("!H")[0]
12861 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012862 obj.features = ofp.meter_features.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070012863 return obj
12864
12865 def __eq__(self, other):
12866 if type(self) != type(other): return False
12867 if self.xid != other.xid: return False
12868 if self.flags != other.flags: return False
12869 if self.features != other.features: return False
12870 return True
12871
12872 def pretty_print(self, q):
12873 q.text("meter_features_stats_reply {")
12874 with q.group():
12875 with q.indent(2):
12876 q.breakable()
12877 q.text("xid = ");
12878 if self.xid != None:
12879 q.text("%#x" % self.xid)
12880 else:
12881 q.text('None')
12882 q.text(","); q.breakable()
12883 q.text("flags = ");
12884 q.text("%#x" % self.flags)
12885 q.text(","); q.breakable()
12886 q.text("features = ");
12887 q.pp(self.features)
12888 q.breakable()
12889 q.text('}')
12890
12891stats_reply.subtypes[11] = meter_features_stats_reply
12892
12893class meter_features_stats_request(stats_request):
12894 version = 5
12895 type = 18
12896 stats_type = 11
12897
12898 def __init__(self, xid=None, flags=None):
12899 if xid != None:
12900 self.xid = xid
12901 else:
12902 self.xid = None
12903 if flags != None:
12904 self.flags = flags
12905 else:
12906 self.flags = 0
12907 return
12908
12909 def pack(self):
12910 packed = []
12911 packed.append(struct.pack("!B", self.version))
12912 packed.append(struct.pack("!B", self.type))
12913 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12914 packed.append(struct.pack("!L", self.xid))
12915 packed.append(struct.pack("!H", self.stats_type))
12916 packed.append(struct.pack("!H", self.flags))
12917 packed.append('\x00' * 4)
12918 length = sum([len(x) for x in packed])
12919 packed[2] = struct.pack("!H", length)
12920 return ''.join(packed)
12921
12922 @staticmethod
12923 def unpack(reader):
12924 obj = meter_features_stats_request()
12925 _version = reader.read("!B")[0]
12926 assert(_version == 5)
12927 _type = reader.read("!B")[0]
12928 assert(_type == 18)
12929 _length = reader.read("!H")[0]
12930 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012931 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070012932 obj.xid = reader.read("!L")[0]
12933 _stats_type = reader.read("!H")[0]
12934 assert(_stats_type == 11)
12935 obj.flags = reader.read("!H")[0]
12936 reader.skip(4)
12937 return obj
12938
12939 def __eq__(self, other):
12940 if type(self) != type(other): return False
12941 if self.xid != other.xid: return False
12942 if self.flags != other.flags: return False
12943 return True
12944
12945 def pretty_print(self, q):
12946 q.text("meter_features_stats_request {")
12947 with q.group():
12948 with q.indent(2):
12949 q.breakable()
12950 q.text("xid = ");
12951 if self.xid != None:
12952 q.text("%#x" % self.xid)
12953 else:
12954 q.text('None')
12955 q.text(","); q.breakable()
12956 q.text("flags = ");
12957 q.text("%#x" % self.flags)
12958 q.breakable()
12959 q.text('}')
12960
12961stats_request.subtypes[11] = meter_features_stats_request
12962
12963class meter_mod(message):
12964 version = 5
12965 type = 29
12966
12967 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
12968 if xid != None:
12969 self.xid = xid
12970 else:
12971 self.xid = None
12972 if command != None:
12973 self.command = command
12974 else:
12975 self.command = 0
12976 if flags != None:
12977 self.flags = flags
12978 else:
12979 self.flags = 0
12980 if meter_id != None:
12981 self.meter_id = meter_id
12982 else:
12983 self.meter_id = 0
12984 if bands != None:
12985 self.bands = bands
12986 else:
12987 self.bands = []
12988 return
12989
12990 def pack(self):
12991 packed = []
12992 packed.append(struct.pack("!B", self.version))
12993 packed.append(struct.pack("!B", self.type))
12994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12995 packed.append(struct.pack("!L", self.xid))
12996 packed.append(struct.pack("!H", self.command))
12997 packed.append(struct.pack("!H", self.flags))
12998 packed.append(struct.pack("!L", self.meter_id))
12999 packed.append(loxi.generic_util.pack_list(self.bands))
13000 length = sum([len(x) for x in packed])
13001 packed[2] = struct.pack("!H", length)
13002 return ''.join(packed)
13003
13004 @staticmethod
13005 def unpack(reader):
13006 obj = meter_mod()
13007 _version = reader.read("!B")[0]
13008 assert(_version == 5)
13009 _type = reader.read("!B")[0]
13010 assert(_type == 29)
13011 _length = reader.read("!H")[0]
13012 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013013 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013014 obj.xid = reader.read("!L")[0]
13015 obj.command = reader.read("!H")[0]
13016 obj.flags = reader.read("!H")[0]
13017 obj.meter_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080013018 obj.bands = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013019 return obj
13020
13021 def __eq__(self, other):
13022 if type(self) != type(other): return False
13023 if self.xid != other.xid: return False
13024 if self.command != other.command: return False
13025 if self.flags != other.flags: return False
13026 if self.meter_id != other.meter_id: return False
13027 if self.bands != other.bands: return False
13028 return True
13029
13030 def pretty_print(self, q):
13031 q.text("meter_mod {")
13032 with q.group():
13033 with q.indent(2):
13034 q.breakable()
13035 q.text("xid = ");
13036 if self.xid != None:
13037 q.text("%#x" % self.xid)
13038 else:
13039 q.text('None')
13040 q.text(","); q.breakable()
13041 q.text("command = ");
13042 q.text("%#x" % self.command)
13043 q.text(","); q.breakable()
13044 q.text("flags = ");
13045 q.text("%#x" % self.flags)
13046 q.text(","); q.breakable()
13047 q.text("meter_id = ");
13048 q.text("%#x" % self.meter_id)
13049 q.text(","); q.breakable()
13050 q.text("bands = ");
13051 q.pp(self.bands)
13052 q.breakable()
13053 q.text('}')
13054
13055message.subtypes[29] = meter_mod
13056
13057class meter_mod_failed_error_msg(error_msg):
13058 version = 5
13059 type = 1
13060 err_type = 12
13061
13062 def __init__(self, xid=None, code=None, data=None):
13063 if xid != None:
13064 self.xid = xid
13065 else:
13066 self.xid = None
13067 if code != None:
13068 self.code = code
13069 else:
13070 self.code = 0
13071 if data != None:
13072 self.data = data
13073 else:
13074 self.data = ''
13075 return
13076
13077 def pack(self):
13078 packed = []
13079 packed.append(struct.pack("!B", self.version))
13080 packed.append(struct.pack("!B", self.type))
13081 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13082 packed.append(struct.pack("!L", self.xid))
13083 packed.append(struct.pack("!H", self.err_type))
13084 packed.append(struct.pack("!H", self.code))
13085 packed.append(self.data)
13086 length = sum([len(x) for x in packed])
13087 packed[2] = struct.pack("!H", length)
13088 return ''.join(packed)
13089
13090 @staticmethod
13091 def unpack(reader):
13092 obj = meter_mod_failed_error_msg()
13093 _version = reader.read("!B")[0]
13094 assert(_version == 5)
13095 _type = reader.read("!B")[0]
13096 assert(_type == 1)
13097 _length = reader.read("!H")[0]
13098 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013099 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013100 obj.xid = reader.read("!L")[0]
13101 _err_type = reader.read("!H")[0]
13102 assert(_err_type == 12)
13103 obj.code = reader.read("!H")[0]
13104 obj.data = str(reader.read_all())
13105 return obj
13106
13107 def __eq__(self, other):
13108 if type(self) != type(other): return False
13109 if self.xid != other.xid: return False
13110 if self.code != other.code: return False
13111 if self.data != other.data: return False
13112 return True
13113
13114 def pretty_print(self, q):
13115 q.text("meter_mod_failed_error_msg {")
13116 with q.group():
13117 with q.indent(2):
13118 q.breakable()
13119 q.text("xid = ");
13120 if self.xid != None:
13121 q.text("%#x" % self.xid)
13122 else:
13123 q.text('None')
13124 q.text(","); q.breakable()
13125 q.text("code = ");
13126 q.text("%#x" % self.code)
13127 q.text(","); q.breakable()
13128 q.text("data = ");
13129 q.pp(self.data)
13130 q.breakable()
13131 q.text('}')
13132
13133error_msg.subtypes[12] = meter_mod_failed_error_msg
13134
13135class meter_stats_reply(stats_reply):
13136 version = 5
13137 type = 19
13138 stats_type = 9
13139
13140 def __init__(self, xid=None, flags=None, entries=None):
13141 if xid != None:
13142 self.xid = xid
13143 else:
13144 self.xid = None
13145 if flags != None:
13146 self.flags = flags
13147 else:
13148 self.flags = 0
13149 if entries != None:
13150 self.entries = entries
13151 else:
13152 self.entries = []
13153 return
13154
13155 def pack(self):
13156 packed = []
13157 packed.append(struct.pack("!B", self.version))
13158 packed.append(struct.pack("!B", self.type))
13159 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13160 packed.append(struct.pack("!L", self.xid))
13161 packed.append(struct.pack("!H", self.stats_type))
13162 packed.append(struct.pack("!H", self.flags))
13163 packed.append('\x00' * 4)
13164 packed.append(loxi.generic_util.pack_list(self.entries))
13165 length = sum([len(x) for x in packed])
13166 packed[2] = struct.pack("!H", length)
13167 return ''.join(packed)
13168
13169 @staticmethod
13170 def unpack(reader):
13171 obj = meter_stats_reply()
13172 _version = reader.read("!B")[0]
13173 assert(_version == 5)
13174 _type = reader.read("!B")[0]
13175 assert(_type == 19)
13176 _length = reader.read("!H")[0]
13177 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013178 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013179 obj.xid = reader.read("!L")[0]
13180 _stats_type = reader.read("!H")[0]
13181 assert(_stats_type == 9)
13182 obj.flags = reader.read("!H")[0]
13183 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013184 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013185 return obj
13186
13187 def __eq__(self, other):
13188 if type(self) != type(other): return False
13189 if self.xid != other.xid: return False
13190 if self.flags != other.flags: return False
13191 if self.entries != other.entries: return False
13192 return True
13193
13194 def pretty_print(self, q):
13195 q.text("meter_stats_reply {")
13196 with q.group():
13197 with q.indent(2):
13198 q.breakable()
13199 q.text("xid = ");
13200 if self.xid != None:
13201 q.text("%#x" % self.xid)
13202 else:
13203 q.text('None')
13204 q.text(","); q.breakable()
13205 q.text("flags = ");
13206 q.text("%#x" % self.flags)
13207 q.text(","); q.breakable()
13208 q.text("entries = ");
13209 q.pp(self.entries)
13210 q.breakable()
13211 q.text('}')
13212
13213stats_reply.subtypes[9] = meter_stats_reply
13214
13215class meter_stats_request(stats_request):
13216 version = 5
13217 type = 18
13218 stats_type = 9
13219
13220 def __init__(self, xid=None, flags=None, meter_id=None):
13221 if xid != None:
13222 self.xid = xid
13223 else:
13224 self.xid = None
13225 if flags != None:
13226 self.flags = flags
13227 else:
13228 self.flags = 0
13229 if meter_id != None:
13230 self.meter_id = meter_id
13231 else:
13232 self.meter_id = 0
13233 return
13234
13235 def pack(self):
13236 packed = []
13237 packed.append(struct.pack("!B", self.version))
13238 packed.append(struct.pack("!B", self.type))
13239 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13240 packed.append(struct.pack("!L", self.xid))
13241 packed.append(struct.pack("!H", self.stats_type))
13242 packed.append(struct.pack("!H", self.flags))
13243 packed.append('\x00' * 4)
13244 packed.append(struct.pack("!L", self.meter_id))
13245 packed.append('\x00' * 4)
13246 length = sum([len(x) for x in packed])
13247 packed[2] = struct.pack("!H", length)
13248 return ''.join(packed)
13249
13250 @staticmethod
13251 def unpack(reader):
13252 obj = meter_stats_request()
13253 _version = reader.read("!B")[0]
13254 assert(_version == 5)
13255 _type = reader.read("!B")[0]
13256 assert(_type == 18)
13257 _length = reader.read("!H")[0]
13258 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013259 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013260 obj.xid = reader.read("!L")[0]
13261 _stats_type = reader.read("!H")[0]
13262 assert(_stats_type == 9)
13263 obj.flags = reader.read("!H")[0]
13264 reader.skip(4)
13265 obj.meter_id = reader.read("!L")[0]
13266 reader.skip(4)
13267 return obj
13268
13269 def __eq__(self, other):
13270 if type(self) != type(other): return False
13271 if self.xid != other.xid: return False
13272 if self.flags != other.flags: return False
13273 if self.meter_id != other.meter_id: return False
13274 return True
13275
13276 def pretty_print(self, q):
13277 q.text("meter_stats_request {")
13278 with q.group():
13279 with q.indent(2):
13280 q.breakable()
13281 q.text("xid = ");
13282 if self.xid != None:
13283 q.text("%#x" % self.xid)
13284 else:
13285 q.text('None')
13286 q.text(","); q.breakable()
13287 q.text("flags = ");
13288 q.text("%#x" % self.flags)
13289 q.text(","); q.breakable()
13290 q.text("meter_id = ");
13291 q.text("%#x" % self.meter_id)
13292 q.breakable()
13293 q.text('}')
13294
13295stats_request.subtypes[9] = meter_stats_request
13296
13297class nicira_header(experimenter):
13298 subtypes = {}
13299
13300 version = 5
13301 type = 4
13302 experimenter = 8992
13303
13304 def __init__(self, xid=None, subtype=None):
13305 if xid != None:
13306 self.xid = xid
13307 else:
13308 self.xid = None
13309 if subtype != None:
13310 self.subtype = subtype
13311 else:
13312 self.subtype = 0
13313 return
13314
13315 def pack(self):
13316 packed = []
13317 packed.append(struct.pack("!B", self.version))
13318 packed.append(struct.pack("!B", self.type))
13319 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13320 packed.append(struct.pack("!L", self.xid))
13321 packed.append(struct.pack("!L", self.experimenter))
13322 packed.append(struct.pack("!L", self.subtype))
13323 length = sum([len(x) for x in packed])
13324 packed[2] = struct.pack("!H", length)
13325 return ''.join(packed)
13326
13327 @staticmethod
13328 def unpack(reader):
13329 subtype, = reader.peek('!L', 12)
13330 subclass = nicira_header.subtypes.get(subtype)
13331 if subclass:
13332 return subclass.unpack(reader)
13333
13334 obj = nicira_header()
13335 _version = reader.read("!B")[0]
13336 assert(_version == 5)
13337 _type = reader.read("!B")[0]
13338 assert(_type == 4)
13339 _length = reader.read("!H")[0]
13340 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013341 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013342 obj.xid = reader.read("!L")[0]
13343 _experimenter = reader.read("!L")[0]
13344 assert(_experimenter == 8992)
13345 obj.subtype = reader.read("!L")[0]
13346 return obj
13347
13348 def __eq__(self, other):
13349 if type(self) != type(other): return False
13350 if self.xid != other.xid: return False
13351 if self.subtype != other.subtype: return False
13352 return True
13353
13354 def pretty_print(self, q):
13355 q.text("nicira_header {")
13356 with q.group():
13357 with q.indent(2):
13358 q.breakable()
13359 q.text("xid = ");
13360 if self.xid != None:
13361 q.text("%#x" % self.xid)
13362 else:
13363 q.text('None')
13364 q.breakable()
13365 q.text('}')
13366
13367experimenter.subtypes[8992] = nicira_header
13368
13369class packet_in(message):
13370 version = 5
13371 type = 10
13372
13373 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
13374 if xid != None:
13375 self.xid = xid
13376 else:
13377 self.xid = None
13378 if buffer_id != None:
13379 self.buffer_id = buffer_id
13380 else:
13381 self.buffer_id = 0
13382 if total_len != None:
13383 self.total_len = total_len
13384 else:
13385 self.total_len = 0
13386 if reason != None:
13387 self.reason = reason
13388 else:
13389 self.reason = 0
13390 if table_id != None:
13391 self.table_id = table_id
13392 else:
13393 self.table_id = 0
13394 if cookie != None:
13395 self.cookie = cookie
13396 else:
13397 self.cookie = 0
13398 if match != None:
13399 self.match = match
13400 else:
Rich Lanee2567702015-01-26 15:04:35 -080013401 self.match = ofp.match()
Rich Lane2e079da2014-10-29 15:30:24 -070013402 if data != None:
13403 self.data = data
13404 else:
13405 self.data = ''
13406 return
13407
13408 def pack(self):
13409 packed = []
13410 packed.append(struct.pack("!B", self.version))
13411 packed.append(struct.pack("!B", self.type))
13412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13413 packed.append(struct.pack("!L", self.xid))
13414 packed.append(struct.pack("!L", self.buffer_id))
13415 packed.append(struct.pack("!H", self.total_len))
13416 packed.append(struct.pack("!B", self.reason))
13417 packed.append(struct.pack("!B", self.table_id))
13418 packed.append(struct.pack("!Q", self.cookie))
13419 packed.append(self.match.pack())
13420 packed.append('\x00' * 2)
13421 packed.append(self.data)
13422 length = sum([len(x) for x in packed])
13423 packed[2] = struct.pack("!H", length)
13424 return ''.join(packed)
13425
13426 @staticmethod
13427 def unpack(reader):
13428 obj = packet_in()
13429 _version = reader.read("!B")[0]
13430 assert(_version == 5)
13431 _type = reader.read("!B")[0]
13432 assert(_type == 10)
13433 _length = reader.read("!H")[0]
13434 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013435 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013436 obj.xid = reader.read("!L")[0]
13437 obj.buffer_id = reader.read("!L")[0]
13438 obj.total_len = reader.read("!H")[0]
13439 obj.reason = reader.read("!B")[0]
13440 obj.table_id = reader.read("!B")[0]
13441 obj.cookie = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080013442 obj.match = ofp.match.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070013443 reader.skip(2)
13444 obj.data = str(reader.read_all())
13445 return obj
13446
13447 def __eq__(self, other):
13448 if type(self) != type(other): return False
13449 if self.xid != other.xid: return False
13450 if self.buffer_id != other.buffer_id: return False
13451 if self.total_len != other.total_len: return False
13452 if self.reason != other.reason: return False
13453 if self.table_id != other.table_id: return False
13454 if self.cookie != other.cookie: return False
13455 if self.match != other.match: return False
13456 if self.data != other.data: return False
13457 return True
13458
13459 def pretty_print(self, q):
13460 q.text("packet_in {")
13461 with q.group():
13462 with q.indent(2):
13463 q.breakable()
13464 q.text("xid = ");
13465 if self.xid != None:
13466 q.text("%#x" % self.xid)
13467 else:
13468 q.text('None')
13469 q.text(","); q.breakable()
13470 q.text("buffer_id = ");
13471 q.text("%#x" % self.buffer_id)
13472 q.text(","); q.breakable()
13473 q.text("total_len = ");
13474 q.text("%#x" % self.total_len)
13475 q.text(","); q.breakable()
13476 q.text("reason = ");
13477 q.text("%#x" % self.reason)
13478 q.text(","); q.breakable()
13479 q.text("table_id = ");
13480 q.text("%#x" % self.table_id)
13481 q.text(","); q.breakable()
13482 q.text("cookie = ");
13483 q.text("%#x" % self.cookie)
13484 q.text(","); q.breakable()
13485 q.text("match = ");
13486 q.pp(self.match)
13487 q.text(","); q.breakable()
13488 q.text("data = ");
13489 q.pp(self.data)
13490 q.breakable()
13491 q.text('}')
13492
13493message.subtypes[10] = packet_in
13494
13495class packet_out(message):
13496 version = 5
13497 type = 13
13498
13499 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13500 if xid != None:
13501 self.xid = xid
13502 else:
13503 self.xid = None
13504 if buffer_id != None:
13505 self.buffer_id = buffer_id
13506 else:
13507 self.buffer_id = 0
13508 if in_port != None:
13509 self.in_port = in_port
13510 else:
13511 self.in_port = 0
13512 if actions != None:
13513 self.actions = actions
13514 else:
13515 self.actions = []
13516 if data != None:
13517 self.data = data
13518 else:
13519 self.data = ''
13520 return
13521
13522 def pack(self):
13523 packed = []
13524 packed.append(struct.pack("!B", self.version))
13525 packed.append(struct.pack("!B", self.type))
13526 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13527 packed.append(struct.pack("!L", self.xid))
13528 packed.append(struct.pack("!L", self.buffer_id))
13529 packed.append(util.pack_port_no(self.in_port))
13530 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13531 packed.append('\x00' * 6)
13532 packed.append(loxi.generic_util.pack_list(self.actions))
13533 packed[6] = struct.pack("!H", len(packed[-1]))
13534 packed.append(self.data)
13535 length = sum([len(x) for x in packed])
13536 packed[2] = struct.pack("!H", length)
13537 return ''.join(packed)
13538
13539 @staticmethod
13540 def unpack(reader):
13541 obj = packet_out()
13542 _version = reader.read("!B")[0]
13543 assert(_version == 5)
13544 _type = reader.read("!B")[0]
13545 assert(_type == 13)
13546 _length = reader.read("!H")[0]
13547 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013548 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013549 obj.xid = reader.read("!L")[0]
13550 obj.buffer_id = reader.read("!L")[0]
13551 obj.in_port = util.unpack_port_no(reader)
13552 _actions_len = reader.read("!H")[0]
13553 reader.skip(6)
Rich Lanee2567702015-01-26 15:04:35 -080013554 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013555 obj.data = str(reader.read_all())
13556 return obj
13557
13558 def __eq__(self, other):
13559 if type(self) != type(other): return False
13560 if self.xid != other.xid: return False
13561 if self.buffer_id != other.buffer_id: return False
13562 if self.in_port != other.in_port: return False
13563 if self.actions != other.actions: return False
13564 if self.data != other.data: return False
13565 return True
13566
13567 def pretty_print(self, q):
13568 q.text("packet_out {")
13569 with q.group():
13570 with q.indent(2):
13571 q.breakable()
13572 q.text("xid = ");
13573 if self.xid != None:
13574 q.text("%#x" % self.xid)
13575 else:
13576 q.text('None')
13577 q.text(","); q.breakable()
13578 q.text("buffer_id = ");
13579 q.text("%#x" % self.buffer_id)
13580 q.text(","); q.breakable()
13581 q.text("in_port = ");
13582 q.text(util.pretty_port(self.in_port))
13583 q.text(","); q.breakable()
13584 q.text("actions = ");
13585 q.pp(self.actions)
13586 q.text(","); q.breakable()
13587 q.text("data = ");
13588 q.pp(self.data)
13589 q.breakable()
13590 q.text('}')
13591
13592message.subtypes[13] = packet_out
13593
13594class port_desc_stats_reply(stats_reply):
13595 version = 5
13596 type = 19
13597 stats_type = 13
13598
13599 def __init__(self, xid=None, flags=None, entries=None):
13600 if xid != None:
13601 self.xid = xid
13602 else:
13603 self.xid = None
13604 if flags != None:
13605 self.flags = flags
13606 else:
13607 self.flags = 0
13608 if entries != None:
13609 self.entries = entries
13610 else:
13611 self.entries = []
13612 return
13613
13614 def pack(self):
13615 packed = []
13616 packed.append(struct.pack("!B", self.version))
13617 packed.append(struct.pack("!B", self.type))
13618 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13619 packed.append(struct.pack("!L", self.xid))
13620 packed.append(struct.pack("!H", self.stats_type))
13621 packed.append(struct.pack("!H", self.flags))
13622 packed.append('\x00' * 4)
13623 packed.append(loxi.generic_util.pack_list(self.entries))
13624 length = sum([len(x) for x in packed])
13625 packed[2] = struct.pack("!H", length)
13626 return ''.join(packed)
13627
13628 @staticmethod
13629 def unpack(reader):
13630 obj = port_desc_stats_reply()
13631 _version = reader.read("!B")[0]
13632 assert(_version == 5)
13633 _type = reader.read("!B")[0]
13634 assert(_type == 19)
13635 _length = reader.read("!H")[0]
13636 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013637 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013638 obj.xid = reader.read("!L")[0]
13639 _stats_type = reader.read("!H")[0]
13640 assert(_stats_type == 13)
13641 obj.flags = reader.read("!H")[0]
13642 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013643 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013644 return obj
13645
13646 def __eq__(self, other):
13647 if type(self) != type(other): return False
13648 if self.xid != other.xid: return False
13649 if self.flags != other.flags: return False
13650 if self.entries != other.entries: return False
13651 return True
13652
13653 def pretty_print(self, q):
13654 q.text("port_desc_stats_reply {")
13655 with q.group():
13656 with q.indent(2):
13657 q.breakable()
13658 q.text("xid = ");
13659 if self.xid != None:
13660 q.text("%#x" % self.xid)
13661 else:
13662 q.text('None')
13663 q.text(","); q.breakable()
13664 q.text("flags = ");
13665 q.text("%#x" % self.flags)
13666 q.text(","); q.breakable()
13667 q.text("entries = ");
13668 q.pp(self.entries)
13669 q.breakable()
13670 q.text('}')
13671
13672stats_reply.subtypes[13] = port_desc_stats_reply
13673
13674class port_desc_stats_request(stats_request):
13675 version = 5
13676 type = 18
13677 stats_type = 13
13678
13679 def __init__(self, xid=None, flags=None):
13680 if xid != None:
13681 self.xid = xid
13682 else:
13683 self.xid = None
13684 if flags != None:
13685 self.flags = flags
13686 else:
13687 self.flags = 0
13688 return
13689
13690 def pack(self):
13691 packed = []
13692 packed.append(struct.pack("!B", self.version))
13693 packed.append(struct.pack("!B", self.type))
13694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13695 packed.append(struct.pack("!L", self.xid))
13696 packed.append(struct.pack("!H", self.stats_type))
13697 packed.append(struct.pack("!H", self.flags))
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_desc_stats_request()
13706 _version = reader.read("!B")[0]
13707 assert(_version == 5)
13708 _type = reader.read("!B")[0]
13709 assert(_type == 18)
13710 _length = reader.read("!H")[0]
13711 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013712 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013713 obj.xid = reader.read("!L")[0]
13714 _stats_type = reader.read("!H")[0]
13715 assert(_stats_type == 13)
13716 obj.flags = reader.read("!H")[0]
13717 reader.skip(4)
13718 return obj
13719
13720 def __eq__(self, other):
13721 if type(self) != type(other): return False
13722 if self.xid != other.xid: return False
13723 if self.flags != other.flags: return False
13724 return True
13725
13726 def pretty_print(self, q):
13727 q.text("port_desc_stats_request {")
13728 with q.group():
13729 with q.indent(2):
13730 q.breakable()
13731 q.text("xid = ");
13732 if self.xid != None:
13733 q.text("%#x" % self.xid)
13734 else:
13735 q.text('None')
13736 q.text(","); q.breakable()
13737 q.text("flags = ");
13738 q.text("%#x" % self.flags)
13739 q.breakable()
13740 q.text('}')
13741
13742stats_request.subtypes[13] = port_desc_stats_request
13743
13744class port_mod(message):
13745 version = 5
13746 type = 16
13747
13748 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
13749 if xid != None:
13750 self.xid = xid
13751 else:
13752 self.xid = None
13753 if port_no != None:
13754 self.port_no = port_no
13755 else:
13756 self.port_no = 0
13757 if hw_addr != None:
13758 self.hw_addr = hw_addr
13759 else:
13760 self.hw_addr = [0,0,0,0,0,0]
13761 if config != None:
13762 self.config = config
13763 else:
13764 self.config = 0
13765 if mask != None:
13766 self.mask = mask
13767 else:
13768 self.mask = 0
13769 if properties != None:
13770 self.properties = properties
13771 else:
13772 self.properties = []
13773 return
13774
13775 def pack(self):
13776 packed = []
13777 packed.append(struct.pack("!B", self.version))
13778 packed.append(struct.pack("!B", self.type))
13779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13780 packed.append(struct.pack("!L", self.xid))
13781 packed.append(util.pack_port_no(self.port_no))
13782 packed.append('\x00' * 4)
13783 packed.append(struct.pack("!6B", *self.hw_addr))
13784 packed.append('\x00' * 2)
13785 packed.append(struct.pack("!L", self.config))
13786 packed.append(struct.pack("!L", self.mask))
13787 packed.append(loxi.generic_util.pack_list(self.properties))
13788 length = sum([len(x) for x in packed])
13789 packed[2] = struct.pack("!H", length)
13790 return ''.join(packed)
13791
13792 @staticmethod
13793 def unpack(reader):
13794 obj = port_mod()
13795 _version = reader.read("!B")[0]
13796 assert(_version == 5)
13797 _type = reader.read("!B")[0]
13798 assert(_type == 16)
13799 _length = reader.read("!H")[0]
13800 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013801 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013802 obj.xid = reader.read("!L")[0]
13803 obj.port_no = util.unpack_port_no(reader)
13804 reader.skip(4)
13805 obj.hw_addr = list(reader.read('!6B'))
13806 reader.skip(2)
13807 obj.config = reader.read("!L")[0]
13808 obj.mask = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080013809 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_mod_prop.port_mod_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013810 return obj
13811
13812 def __eq__(self, other):
13813 if type(self) != type(other): return False
13814 if self.xid != other.xid: return False
13815 if self.port_no != other.port_no: return False
13816 if self.hw_addr != other.hw_addr: return False
13817 if self.config != other.config: return False
13818 if self.mask != other.mask: return False
13819 if self.properties != other.properties: return False
13820 return True
13821
13822 def pretty_print(self, q):
13823 q.text("port_mod {")
13824 with q.group():
13825 with q.indent(2):
13826 q.breakable()
13827 q.text("xid = ");
13828 if self.xid != None:
13829 q.text("%#x" % self.xid)
13830 else:
13831 q.text('None')
13832 q.text(","); q.breakable()
13833 q.text("port_no = ");
13834 q.text(util.pretty_port(self.port_no))
13835 q.text(","); q.breakable()
13836 q.text("hw_addr = ");
13837 q.text(util.pretty_mac(self.hw_addr))
13838 q.text(","); q.breakable()
13839 q.text("config = ");
13840 q.text("%#x" % self.config)
13841 q.text(","); q.breakable()
13842 q.text("mask = ");
13843 q.text("%#x" % self.mask)
13844 q.text(","); q.breakable()
13845 q.text("properties = ");
13846 q.pp(self.properties)
13847 q.breakable()
13848 q.text('}')
13849
13850message.subtypes[16] = port_mod
13851
13852class port_mod_failed_error_msg(error_msg):
13853 version = 5
13854 type = 1
13855 err_type = 7
13856
13857 def __init__(self, xid=None, code=None, data=None):
13858 if xid != None:
13859 self.xid = xid
13860 else:
13861 self.xid = None
13862 if code != None:
13863 self.code = code
13864 else:
13865 self.code = 0
13866 if data != None:
13867 self.data = data
13868 else:
13869 self.data = ''
13870 return
13871
13872 def pack(self):
13873 packed = []
13874 packed.append(struct.pack("!B", self.version))
13875 packed.append(struct.pack("!B", self.type))
13876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13877 packed.append(struct.pack("!L", self.xid))
13878 packed.append(struct.pack("!H", self.err_type))
13879 packed.append(struct.pack("!H", self.code))
13880 packed.append(self.data)
13881 length = sum([len(x) for x in packed])
13882 packed[2] = struct.pack("!H", length)
13883 return ''.join(packed)
13884
13885 @staticmethod
13886 def unpack(reader):
13887 obj = port_mod_failed_error_msg()
13888 _version = reader.read("!B")[0]
13889 assert(_version == 5)
13890 _type = reader.read("!B")[0]
13891 assert(_type == 1)
13892 _length = reader.read("!H")[0]
13893 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013894 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013895 obj.xid = reader.read("!L")[0]
13896 _err_type = reader.read("!H")[0]
13897 assert(_err_type == 7)
13898 obj.code = reader.read("!H")[0]
13899 obj.data = str(reader.read_all())
13900 return obj
13901
13902 def __eq__(self, other):
13903 if type(self) != type(other): return False
13904 if self.xid != other.xid: return False
13905 if self.code != other.code: return False
13906 if self.data != other.data: return False
13907 return True
13908
13909 def pretty_print(self, q):
13910 q.text("port_mod_failed_error_msg {")
13911 with q.group():
13912 with q.indent(2):
13913 q.breakable()
13914 q.text("xid = ");
13915 if self.xid != None:
13916 q.text("%#x" % self.xid)
13917 else:
13918 q.text('None')
13919 q.text(","); q.breakable()
13920 q.text("code = ");
13921 q.text("%#x" % self.code)
13922 q.text(","); q.breakable()
13923 q.text("data = ");
13924 q.pp(self.data)
13925 q.breakable()
13926 q.text('}')
13927
13928error_msg.subtypes[7] = port_mod_failed_error_msg
13929
13930class port_stats_reply(stats_reply):
13931 version = 5
13932 type = 19
13933 stats_type = 4
13934
13935 def __init__(self, xid=None, flags=None, entries=None):
13936 if xid != None:
13937 self.xid = xid
13938 else:
13939 self.xid = None
13940 if flags != None:
13941 self.flags = flags
13942 else:
13943 self.flags = 0
13944 if entries != None:
13945 self.entries = entries
13946 else:
13947 self.entries = []
13948 return
13949
13950 def pack(self):
13951 packed = []
13952 packed.append(struct.pack("!B", self.version))
13953 packed.append(struct.pack("!B", self.type))
13954 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13955 packed.append(struct.pack("!L", self.xid))
13956 packed.append(struct.pack("!H", self.stats_type))
13957 packed.append(struct.pack("!H", self.flags))
13958 packed.append('\x00' * 4)
13959 packed.append(loxi.generic_util.pack_list(self.entries))
13960 length = sum([len(x) for x in packed])
13961 packed[2] = struct.pack("!H", length)
13962 return ''.join(packed)
13963
13964 @staticmethod
13965 def unpack(reader):
13966 obj = port_stats_reply()
13967 _version = reader.read("!B")[0]
13968 assert(_version == 5)
13969 _type = reader.read("!B")[0]
13970 assert(_type == 19)
13971 _length = reader.read("!H")[0]
13972 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013973 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070013974 obj.xid = reader.read("!L")[0]
13975 _stats_type = reader.read("!H")[0]
13976 assert(_stats_type == 4)
13977 obj.flags = reader.read("!H")[0]
13978 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013979 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070013980 return obj
13981
13982 def __eq__(self, other):
13983 if type(self) != type(other): return False
13984 if self.xid != other.xid: return False
13985 if self.flags != other.flags: return False
13986 if self.entries != other.entries: return False
13987 return True
13988
13989 def pretty_print(self, q):
13990 q.text("port_stats_reply {")
13991 with q.group():
13992 with q.indent(2):
13993 q.breakable()
13994 q.text("xid = ");
13995 if self.xid != None:
13996 q.text("%#x" % self.xid)
13997 else:
13998 q.text('None')
13999 q.text(","); q.breakable()
14000 q.text("flags = ");
14001 q.text("%#x" % self.flags)
14002 q.text(","); q.breakable()
14003 q.text("entries = ");
14004 q.pp(self.entries)
14005 q.breakable()
14006 q.text('}')
14007
14008stats_reply.subtypes[4] = port_stats_reply
14009
14010class port_stats_request(stats_request):
14011 version = 5
14012 type = 18
14013 stats_type = 4
14014
14015 def __init__(self, xid=None, flags=None, port_no=None):
14016 if xid != None:
14017 self.xid = xid
14018 else:
14019 self.xid = None
14020 if flags != None:
14021 self.flags = flags
14022 else:
14023 self.flags = 0
14024 if port_no != None:
14025 self.port_no = port_no
14026 else:
14027 self.port_no = 0
14028 return
14029
14030 def pack(self):
14031 packed = []
14032 packed.append(struct.pack("!B", self.version))
14033 packed.append(struct.pack("!B", self.type))
14034 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14035 packed.append(struct.pack("!L", self.xid))
14036 packed.append(struct.pack("!H", self.stats_type))
14037 packed.append(struct.pack("!H", self.flags))
14038 packed.append('\x00' * 4)
14039 packed.append(util.pack_port_no(self.port_no))
14040 packed.append('\x00' * 4)
14041 length = sum([len(x) for x in packed])
14042 packed[2] = struct.pack("!H", length)
14043 return ''.join(packed)
14044
14045 @staticmethod
14046 def unpack(reader):
14047 obj = port_stats_request()
14048 _version = reader.read("!B")[0]
14049 assert(_version == 5)
14050 _type = reader.read("!B")[0]
14051 assert(_type == 18)
14052 _length = reader.read("!H")[0]
14053 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014054 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014055 obj.xid = reader.read("!L")[0]
14056 _stats_type = reader.read("!H")[0]
14057 assert(_stats_type == 4)
14058 obj.flags = reader.read("!H")[0]
14059 reader.skip(4)
14060 obj.port_no = util.unpack_port_no(reader)
14061 reader.skip(4)
14062 return obj
14063
14064 def __eq__(self, other):
14065 if type(self) != type(other): return False
14066 if self.xid != other.xid: return False
14067 if self.flags != other.flags: return False
14068 if self.port_no != other.port_no: return False
14069 return True
14070
14071 def pretty_print(self, q):
14072 q.text("port_stats_request {")
14073 with q.group():
14074 with q.indent(2):
14075 q.breakable()
14076 q.text("xid = ");
14077 if self.xid != None:
14078 q.text("%#x" % self.xid)
14079 else:
14080 q.text('None')
14081 q.text(","); q.breakable()
14082 q.text("flags = ");
14083 q.text("%#x" % self.flags)
14084 q.text(","); q.breakable()
14085 q.text("port_no = ");
14086 q.text(util.pretty_port(self.port_no))
14087 q.breakable()
14088 q.text('}')
14089
14090stats_request.subtypes[4] = port_stats_request
14091
14092class port_status(message):
14093 version = 5
14094 type = 12
14095
14096 def __init__(self, xid=None, reason=None, desc=None):
14097 if xid != None:
14098 self.xid = xid
14099 else:
14100 self.xid = None
14101 if reason != None:
14102 self.reason = reason
14103 else:
14104 self.reason = 0
14105 if desc != None:
14106 self.desc = desc
14107 else:
Rich Lanee2567702015-01-26 15:04:35 -080014108 self.desc = ofp.port_desc()
Rich Lane2e079da2014-10-29 15:30:24 -070014109 return
14110
14111 def pack(self):
14112 packed = []
14113 packed.append(struct.pack("!B", self.version))
14114 packed.append(struct.pack("!B", self.type))
14115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14116 packed.append(struct.pack("!L", self.xid))
14117 packed.append(struct.pack("!B", self.reason))
14118 packed.append('\x00' * 7)
14119 packed.append(self.desc.pack())
14120 length = sum([len(x) for x in packed])
14121 packed[2] = struct.pack("!H", length)
14122 return ''.join(packed)
14123
14124 @staticmethod
14125 def unpack(reader):
14126 obj = port_status()
14127 _version = reader.read("!B")[0]
14128 assert(_version == 5)
14129 _type = reader.read("!B")[0]
14130 assert(_type == 12)
14131 _length = reader.read("!H")[0]
14132 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014133 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014134 obj.xid = reader.read("!L")[0]
14135 obj.reason = reader.read("!B")[0]
14136 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -080014137 obj.desc = ofp.port_desc.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070014138 return obj
14139
14140 def __eq__(self, other):
14141 if type(self) != type(other): return False
14142 if self.xid != other.xid: return False
14143 if self.reason != other.reason: return False
14144 if self.desc != other.desc: return False
14145 return True
14146
14147 def pretty_print(self, q):
14148 q.text("port_status {")
14149 with q.group():
14150 with q.indent(2):
14151 q.breakable()
14152 q.text("xid = ");
14153 if self.xid != None:
14154 q.text("%#x" % self.xid)
14155 else:
14156 q.text('None')
14157 q.text(","); q.breakable()
14158 q.text("reason = ");
14159 q.text("%#x" % self.reason)
14160 q.text(","); q.breakable()
14161 q.text("desc = ");
14162 q.pp(self.desc)
14163 q.breakable()
14164 q.text('}')
14165
14166message.subtypes[12] = port_status
14167
14168class queue_desc_stats_reply(stats_reply):
14169 version = 5
14170 type = 19
14171 stats_type = 15
14172
14173 def __init__(self, xid=None, flags=None, entries=None):
14174 if xid != None:
14175 self.xid = xid
14176 else:
14177 self.xid = None
14178 if flags != None:
14179 self.flags = flags
14180 else:
14181 self.flags = 0
14182 if entries != None:
14183 self.entries = entries
14184 else:
14185 self.entries = []
14186 return
14187
14188 def pack(self):
14189 packed = []
14190 packed.append(struct.pack("!B", self.version))
14191 packed.append(struct.pack("!B", self.type))
14192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14193 packed.append(struct.pack("!L", self.xid))
14194 packed.append(struct.pack("!H", self.stats_type))
14195 packed.append(struct.pack("!H", self.flags))
14196 packed.append('\x00' * 4)
14197 packed.append(loxi.generic_util.pack_list(self.entries))
14198 length = sum([len(x) for x in packed])
14199 packed[2] = struct.pack("!H", length)
14200 return ''.join(packed)
14201
14202 @staticmethod
14203 def unpack(reader):
14204 obj = queue_desc_stats_reply()
14205 _version = reader.read("!B")[0]
14206 assert(_version == 5)
14207 _type = reader.read("!B")[0]
14208 assert(_type == 19)
14209 _length = reader.read("!H")[0]
14210 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014211 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014212 obj.xid = reader.read("!L")[0]
14213 _stats_type = reader.read("!H")[0]
14214 assert(_stats_type == 15)
14215 obj.flags = reader.read("!H")[0]
14216 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014217 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_desc.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070014218 return obj
14219
14220 def __eq__(self, other):
14221 if type(self) != type(other): return False
14222 if self.xid != other.xid: return False
14223 if self.flags != other.flags: return False
14224 if self.entries != other.entries: return False
14225 return True
14226
14227 def pretty_print(self, q):
14228 q.text("queue_desc_stats_reply {")
14229 with q.group():
14230 with q.indent(2):
14231 q.breakable()
14232 q.text("xid = ");
14233 if self.xid != None:
14234 q.text("%#x" % self.xid)
14235 else:
14236 q.text('None')
14237 q.text(","); q.breakable()
14238 q.text("flags = ");
14239 q.text("%#x" % self.flags)
14240 q.text(","); q.breakable()
14241 q.text("entries = ");
14242 q.pp(self.entries)
14243 q.breakable()
14244 q.text('}')
14245
14246stats_reply.subtypes[15] = queue_desc_stats_reply
14247
14248class queue_desc_stats_request(stats_request):
14249 version = 5
14250 type = 18
14251 stats_type = 15
14252
14253 def __init__(self, xid=None, flags=None):
14254 if xid != None:
14255 self.xid = xid
14256 else:
14257 self.xid = None
14258 if flags != None:
14259 self.flags = flags
14260 else:
14261 self.flags = 0
14262 return
14263
14264 def pack(self):
14265 packed = []
14266 packed.append(struct.pack("!B", self.version))
14267 packed.append(struct.pack("!B", self.type))
14268 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14269 packed.append(struct.pack("!L", self.xid))
14270 packed.append(struct.pack("!H", self.stats_type))
14271 packed.append(struct.pack("!H", self.flags))
14272 packed.append('\x00' * 4)
14273 length = sum([len(x) for x in packed])
14274 packed[2] = struct.pack("!H", length)
14275 return ''.join(packed)
14276
14277 @staticmethod
14278 def unpack(reader):
14279 obj = queue_desc_stats_request()
14280 _version = reader.read("!B")[0]
14281 assert(_version == 5)
14282 _type = reader.read("!B")[0]
14283 assert(_type == 18)
14284 _length = reader.read("!H")[0]
14285 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014286 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014287 obj.xid = reader.read("!L")[0]
14288 _stats_type = reader.read("!H")[0]
14289 assert(_stats_type == 15)
14290 obj.flags = reader.read("!H")[0]
14291 reader.skip(4)
14292 return obj
14293
14294 def __eq__(self, other):
14295 if type(self) != type(other): return False
14296 if self.xid != other.xid: return False
14297 if self.flags != other.flags: return False
14298 return True
14299
14300 def pretty_print(self, q):
14301 q.text("queue_desc_stats_request {")
14302 with q.group():
14303 with q.indent(2):
14304 q.breakable()
14305 q.text("xid = ");
14306 if self.xid != None:
14307 q.text("%#x" % self.xid)
14308 else:
14309 q.text('None')
14310 q.text(","); q.breakable()
14311 q.text("flags = ");
14312 q.text("%#x" % self.flags)
14313 q.breakable()
14314 q.text('}')
14315
14316stats_request.subtypes[15] = queue_desc_stats_request
14317
14318class queue_op_failed_error_msg(error_msg):
14319 version = 5
14320 type = 1
14321 err_type = 9
14322
14323 def __init__(self, xid=None, code=None, data=None):
14324 if xid != None:
14325 self.xid = xid
14326 else:
14327 self.xid = None
14328 if code != None:
14329 self.code = code
14330 else:
14331 self.code = 0
14332 if data != None:
14333 self.data = data
14334 else:
14335 self.data = ''
14336 return
14337
14338 def pack(self):
14339 packed = []
14340 packed.append(struct.pack("!B", self.version))
14341 packed.append(struct.pack("!B", self.type))
14342 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14343 packed.append(struct.pack("!L", self.xid))
14344 packed.append(struct.pack("!H", self.err_type))
14345 packed.append(struct.pack("!H", self.code))
14346 packed.append(self.data)
14347 length = sum([len(x) for x in packed])
14348 packed[2] = struct.pack("!H", length)
14349 return ''.join(packed)
14350
14351 @staticmethod
14352 def unpack(reader):
14353 obj = queue_op_failed_error_msg()
14354 _version = reader.read("!B")[0]
14355 assert(_version == 5)
14356 _type = reader.read("!B")[0]
14357 assert(_type == 1)
14358 _length = reader.read("!H")[0]
14359 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014360 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014361 obj.xid = reader.read("!L")[0]
14362 _err_type = reader.read("!H")[0]
14363 assert(_err_type == 9)
14364 obj.code = reader.read("!H")[0]
14365 obj.data = str(reader.read_all())
14366 return obj
14367
14368 def __eq__(self, other):
14369 if type(self) != type(other): return False
14370 if self.xid != other.xid: return False
14371 if self.code != other.code: return False
14372 if self.data != other.data: return False
14373 return True
14374
14375 def pretty_print(self, q):
14376 q.text("queue_op_failed_error_msg {")
14377 with q.group():
14378 with q.indent(2):
14379 q.breakable()
14380 q.text("xid = ");
14381 if self.xid != None:
14382 q.text("%#x" % self.xid)
14383 else:
14384 q.text('None')
14385 q.text(","); q.breakable()
14386 q.text("code = ");
14387 q.text("%#x" % self.code)
14388 q.text(","); q.breakable()
14389 q.text("data = ");
14390 q.pp(self.data)
14391 q.breakable()
14392 q.text('}')
14393
14394error_msg.subtypes[9] = queue_op_failed_error_msg
14395
14396class queue_stats_reply(stats_reply):
14397 version = 5
14398 type = 19
14399 stats_type = 5
14400
14401 def __init__(self, xid=None, flags=None, entries=None):
14402 if xid != None:
14403 self.xid = xid
14404 else:
14405 self.xid = None
14406 if flags != None:
14407 self.flags = flags
14408 else:
14409 self.flags = 0
14410 if entries != None:
14411 self.entries = entries
14412 else:
14413 self.entries = []
14414 return
14415
14416 def pack(self):
14417 packed = []
14418 packed.append(struct.pack("!B", self.version))
14419 packed.append(struct.pack("!B", self.type))
14420 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14421 packed.append(struct.pack("!L", self.xid))
14422 packed.append(struct.pack("!H", self.stats_type))
14423 packed.append(struct.pack("!H", self.flags))
14424 packed.append('\x00' * 4)
14425 packed.append(loxi.generic_util.pack_list(self.entries))
14426 length = sum([len(x) for x in packed])
14427 packed[2] = struct.pack("!H", length)
14428 return ''.join(packed)
14429
14430 @staticmethod
14431 def unpack(reader):
14432 obj = queue_stats_reply()
14433 _version = reader.read("!B")[0]
14434 assert(_version == 5)
14435 _type = reader.read("!B")[0]
14436 assert(_type == 19)
14437 _length = reader.read("!H")[0]
14438 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014439 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014440 obj.xid = reader.read("!L")[0]
14441 _stats_type = reader.read("!H")[0]
14442 assert(_stats_type == 5)
14443 obj.flags = reader.read("!H")[0]
14444 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014445 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070014446 return obj
14447
14448 def __eq__(self, other):
14449 if type(self) != type(other): return False
14450 if self.xid != other.xid: return False
14451 if self.flags != other.flags: return False
14452 if self.entries != other.entries: return False
14453 return True
14454
14455 def pretty_print(self, q):
14456 q.text("queue_stats_reply {")
14457 with q.group():
14458 with q.indent(2):
14459 q.breakable()
14460 q.text("xid = ");
14461 if self.xid != None:
14462 q.text("%#x" % self.xid)
14463 else:
14464 q.text('None')
14465 q.text(","); q.breakable()
14466 q.text("flags = ");
14467 q.text("%#x" % self.flags)
14468 q.text(","); q.breakable()
14469 q.text("entries = ");
14470 q.pp(self.entries)
14471 q.breakable()
14472 q.text('}')
14473
14474stats_reply.subtypes[5] = queue_stats_reply
14475
14476class queue_stats_request(stats_request):
14477 version = 5
14478 type = 18
14479 stats_type = 5
14480
14481 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14482 if xid != None:
14483 self.xid = xid
14484 else:
14485 self.xid = None
14486 if flags != None:
14487 self.flags = flags
14488 else:
14489 self.flags = 0
14490 if port_no != None:
14491 self.port_no = port_no
14492 else:
14493 self.port_no = 0
14494 if queue_id != None:
14495 self.queue_id = queue_id
14496 else:
14497 self.queue_id = 0
14498 return
14499
14500 def pack(self):
14501 packed = []
14502 packed.append(struct.pack("!B", self.version))
14503 packed.append(struct.pack("!B", self.type))
14504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14505 packed.append(struct.pack("!L", self.xid))
14506 packed.append(struct.pack("!H", self.stats_type))
14507 packed.append(struct.pack("!H", self.flags))
14508 packed.append('\x00' * 4)
14509 packed.append(util.pack_port_no(self.port_no))
14510 packed.append(struct.pack("!L", self.queue_id))
14511 length = sum([len(x) for x in packed])
14512 packed[2] = struct.pack("!H", length)
14513 return ''.join(packed)
14514
14515 @staticmethod
14516 def unpack(reader):
14517 obj = queue_stats_request()
14518 _version = reader.read("!B")[0]
14519 assert(_version == 5)
14520 _type = reader.read("!B")[0]
14521 assert(_type == 18)
14522 _length = reader.read("!H")[0]
14523 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014524 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014525 obj.xid = reader.read("!L")[0]
14526 _stats_type = reader.read("!H")[0]
14527 assert(_stats_type == 5)
14528 obj.flags = reader.read("!H")[0]
14529 reader.skip(4)
14530 obj.port_no = util.unpack_port_no(reader)
14531 obj.queue_id = reader.read("!L")[0]
14532 return obj
14533
14534 def __eq__(self, other):
14535 if type(self) != type(other): return False
14536 if self.xid != other.xid: return False
14537 if self.flags != other.flags: return False
14538 if self.port_no != other.port_no: return False
14539 if self.queue_id != other.queue_id: return False
14540 return True
14541
14542 def pretty_print(self, q):
14543 q.text("queue_stats_request {")
14544 with q.group():
14545 with q.indent(2):
14546 q.breakable()
14547 q.text("xid = ");
14548 if self.xid != None:
14549 q.text("%#x" % self.xid)
14550 else:
14551 q.text('None')
14552 q.text(","); q.breakable()
14553 q.text("flags = ");
14554 q.text("%#x" % self.flags)
14555 q.text(","); q.breakable()
14556 q.text("port_no = ");
14557 q.text(util.pretty_port(self.port_no))
14558 q.text(","); q.breakable()
14559 q.text("queue_id = ");
14560 q.text("%#x" % self.queue_id)
14561 q.breakable()
14562 q.text('}')
14563
14564stats_request.subtypes[5] = queue_stats_request
14565
14566class requestforward(message):
14567 version = 5
14568 type = 32
14569
14570 def __init__(self, xid=None, role=None, data=None):
14571 if xid != None:
14572 self.xid = xid
14573 else:
14574 self.xid = None
14575 if role != None:
14576 self.role = role
14577 else:
14578 self.role = 0
14579 if data != None:
14580 self.data = data
14581 else:
14582 self.data = ''
14583 return
14584
14585 def pack(self):
14586 packed = []
14587 packed.append(struct.pack("!B", self.version))
14588 packed.append(struct.pack("!B", self.type))
14589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14590 packed.append(struct.pack("!L", self.xid))
14591 packed.append(struct.pack("!L", self.role))
14592 packed.append(self.data)
14593 length = sum([len(x) for x in packed])
14594 packed[2] = struct.pack("!H", length)
14595 return ''.join(packed)
14596
14597 @staticmethod
14598 def unpack(reader):
14599 obj = requestforward()
14600 _version = reader.read("!B")[0]
14601 assert(_version == 5)
14602 _type = reader.read("!B")[0]
14603 assert(_type == 32)
14604 _length = reader.read("!H")[0]
14605 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014606 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014607 obj.xid = reader.read("!L")[0]
14608 obj.role = reader.read("!L")[0]
14609 obj.data = str(reader.read_all())
14610 return obj
14611
14612 def __eq__(self, other):
14613 if type(self) != type(other): return False
14614 if self.xid != other.xid: return False
14615 if self.role != other.role: return False
14616 if self.data != other.data: return False
14617 return True
14618
14619 def pretty_print(self, q):
14620 q.text("requestforward {")
14621 with q.group():
14622 with q.indent(2):
14623 q.breakable()
14624 q.text("xid = ");
14625 if self.xid != None:
14626 q.text("%#x" % self.xid)
14627 else:
14628 q.text('None')
14629 q.text(","); q.breakable()
14630 q.text("role = ");
14631 q.text("%#x" % self.role)
14632 q.text(","); q.breakable()
14633 q.text("data = ");
14634 q.pp(self.data)
14635 q.breakable()
14636 q.text('}')
14637
14638message.subtypes[32] = requestforward
14639
14640class role_reply(message):
14641 version = 5
14642 type = 25
14643
14644 def __init__(self, xid=None, role=None, generation_id=None):
14645 if xid != None:
14646 self.xid = xid
14647 else:
14648 self.xid = None
14649 if role != None:
14650 self.role = role
14651 else:
14652 self.role = 0
14653 if generation_id != None:
14654 self.generation_id = generation_id
14655 else:
14656 self.generation_id = 0
14657 return
14658
14659 def pack(self):
14660 packed = []
14661 packed.append(struct.pack("!B", self.version))
14662 packed.append(struct.pack("!B", self.type))
14663 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14664 packed.append(struct.pack("!L", self.xid))
14665 packed.append(struct.pack("!L", self.role))
14666 packed.append('\x00' * 4)
14667 packed.append(struct.pack("!Q", self.generation_id))
14668 length = sum([len(x) for x in packed])
14669 packed[2] = struct.pack("!H", length)
14670 return ''.join(packed)
14671
14672 @staticmethod
14673 def unpack(reader):
14674 obj = role_reply()
14675 _version = reader.read("!B")[0]
14676 assert(_version == 5)
14677 _type = reader.read("!B")[0]
14678 assert(_type == 25)
14679 _length = reader.read("!H")[0]
14680 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014681 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014682 obj.xid = reader.read("!L")[0]
14683 obj.role = reader.read("!L")[0]
14684 reader.skip(4)
14685 obj.generation_id = reader.read("!Q")[0]
14686 return obj
14687
14688 def __eq__(self, other):
14689 if type(self) != type(other): return False
14690 if self.xid != other.xid: return False
14691 if self.role != other.role: return False
14692 if self.generation_id != other.generation_id: return False
14693 return True
14694
14695 def pretty_print(self, q):
14696 q.text("role_reply {")
14697 with q.group():
14698 with q.indent(2):
14699 q.breakable()
14700 q.text("xid = ");
14701 if self.xid != None:
14702 q.text("%#x" % self.xid)
14703 else:
14704 q.text('None')
14705 q.text(","); q.breakable()
14706 q.text("role = ");
14707 q.text("%#x" % self.role)
14708 q.text(","); q.breakable()
14709 q.text("generation_id = ");
14710 q.text("%#x" % self.generation_id)
14711 q.breakable()
14712 q.text('}')
14713
14714message.subtypes[25] = role_reply
14715
14716class role_request(message):
14717 version = 5
14718 type = 24
14719
14720 def __init__(self, xid=None, role=None, generation_id=None):
14721 if xid != None:
14722 self.xid = xid
14723 else:
14724 self.xid = None
14725 if role != None:
14726 self.role = role
14727 else:
14728 self.role = 0
14729 if generation_id != None:
14730 self.generation_id = generation_id
14731 else:
14732 self.generation_id = 0
14733 return
14734
14735 def pack(self):
14736 packed = []
14737 packed.append(struct.pack("!B", self.version))
14738 packed.append(struct.pack("!B", self.type))
14739 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14740 packed.append(struct.pack("!L", self.xid))
14741 packed.append(struct.pack("!L", self.role))
14742 packed.append('\x00' * 4)
14743 packed.append(struct.pack("!Q", self.generation_id))
14744 length = sum([len(x) for x in packed])
14745 packed[2] = struct.pack("!H", length)
14746 return ''.join(packed)
14747
14748 @staticmethod
14749 def unpack(reader):
14750 obj = role_request()
14751 _version = reader.read("!B")[0]
14752 assert(_version == 5)
14753 _type = reader.read("!B")[0]
14754 assert(_type == 24)
14755 _length = reader.read("!H")[0]
14756 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014757 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014758 obj.xid = reader.read("!L")[0]
14759 obj.role = reader.read("!L")[0]
14760 reader.skip(4)
14761 obj.generation_id = reader.read("!Q")[0]
14762 return obj
14763
14764 def __eq__(self, other):
14765 if type(self) != type(other): return False
14766 if self.xid != other.xid: return False
14767 if self.role != other.role: return False
14768 if self.generation_id != other.generation_id: return False
14769 return True
14770
14771 def pretty_print(self, q):
14772 q.text("role_request {")
14773 with q.group():
14774 with q.indent(2):
14775 q.breakable()
14776 q.text("xid = ");
14777 if self.xid != None:
14778 q.text("%#x" % self.xid)
14779 else:
14780 q.text('None')
14781 q.text(","); q.breakable()
14782 q.text("role = ");
14783 q.text("%#x" % self.role)
14784 q.text(","); q.breakable()
14785 q.text("generation_id = ");
14786 q.text("%#x" % self.generation_id)
14787 q.breakable()
14788 q.text('}')
14789
14790message.subtypes[24] = role_request
14791
14792class role_request_failed_error_msg(error_msg):
14793 version = 5
14794 type = 1
14795 err_type = 11
14796
14797 def __init__(self, xid=None, code=None, data=None):
14798 if xid != None:
14799 self.xid = xid
14800 else:
14801 self.xid = None
14802 if code != None:
14803 self.code = code
14804 else:
14805 self.code = 0
14806 if data != None:
14807 self.data = data
14808 else:
14809 self.data = ''
14810 return
14811
14812 def pack(self):
14813 packed = []
14814 packed.append(struct.pack("!B", self.version))
14815 packed.append(struct.pack("!B", self.type))
14816 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14817 packed.append(struct.pack("!L", self.xid))
14818 packed.append(struct.pack("!H", self.err_type))
14819 packed.append(struct.pack("!H", self.code))
14820 packed.append(self.data)
14821 length = sum([len(x) for x in packed])
14822 packed[2] = struct.pack("!H", length)
14823 return ''.join(packed)
14824
14825 @staticmethod
14826 def unpack(reader):
14827 obj = role_request_failed_error_msg()
14828 _version = reader.read("!B")[0]
14829 assert(_version == 5)
14830 _type = reader.read("!B")[0]
14831 assert(_type == 1)
14832 _length = reader.read("!H")[0]
14833 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014834 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014835 obj.xid = reader.read("!L")[0]
14836 _err_type = reader.read("!H")[0]
14837 assert(_err_type == 11)
14838 obj.code = reader.read("!H")[0]
14839 obj.data = str(reader.read_all())
14840 return obj
14841
14842 def __eq__(self, other):
14843 if type(self) != type(other): return False
14844 if self.xid != other.xid: return False
14845 if self.code != other.code: return False
14846 if self.data != other.data: return False
14847 return True
14848
14849 def pretty_print(self, q):
14850 q.text("role_request_failed_error_msg {")
14851 with q.group():
14852 with q.indent(2):
14853 q.breakable()
14854 q.text("xid = ");
14855 if self.xid != None:
14856 q.text("%#x" % self.xid)
14857 else:
14858 q.text('None')
14859 q.text(","); q.breakable()
14860 q.text("code = ");
14861 q.text("%#x" % self.code)
14862 q.text(","); q.breakable()
14863 q.text("data = ");
14864 q.pp(self.data)
14865 q.breakable()
14866 q.text('}')
14867
14868error_msg.subtypes[11] = role_request_failed_error_msg
14869
14870class role_status(message):
14871 version = 5
14872 type = 30
14873
14874 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
14875 if xid != None:
14876 self.xid = xid
14877 else:
14878 self.xid = None
14879 if role != None:
14880 self.role = role
14881 else:
14882 self.role = 0
14883 if reason != None:
14884 self.reason = reason
14885 else:
14886 self.reason = 0
14887 if generation_id != None:
14888 self.generation_id = generation_id
14889 else:
14890 self.generation_id = 0
14891 if properties != None:
14892 self.properties = properties
14893 else:
14894 self.properties = []
14895 return
14896
14897 def pack(self):
14898 packed = []
14899 packed.append(struct.pack("!B", self.version))
14900 packed.append(struct.pack("!B", self.type))
14901 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14902 packed.append(struct.pack("!L", self.xid))
14903 packed.append(struct.pack("!L", self.role))
14904 packed.append(struct.pack("!B", self.reason))
14905 packed.append('\x00' * 3)
14906 packed.append(struct.pack("!Q", self.generation_id))
14907 packed.append(loxi.generic_util.pack_list(self.properties))
14908 length = sum([len(x) for x in packed])
14909 packed[2] = struct.pack("!H", length)
14910 return ''.join(packed)
14911
14912 @staticmethod
14913 def unpack(reader):
14914 obj = role_status()
14915 _version = reader.read("!B")[0]
14916 assert(_version == 5)
14917 _type = reader.read("!B")[0]
14918 assert(_type == 30)
14919 _length = reader.read("!H")[0]
14920 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014921 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070014922 obj.xid = reader.read("!L")[0]
14923 obj.role = reader.read("!L")[0]
14924 obj.reason = reader.read("!B")[0]
14925 reader.skip(3)
14926 obj.generation_id = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080014927 obj.properties = loxi.generic_util.unpack_list(reader, ofp.role_prop.role_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070014928 return obj
14929
14930 def __eq__(self, other):
14931 if type(self) != type(other): return False
14932 if self.xid != other.xid: return False
14933 if self.role != other.role: return False
14934 if self.reason != other.reason: return False
14935 if self.generation_id != other.generation_id: return False
14936 if self.properties != other.properties: return False
14937 return True
14938
14939 def pretty_print(self, q):
14940 q.text("role_status {")
14941 with q.group():
14942 with q.indent(2):
14943 q.breakable()
14944 q.text("xid = ");
14945 if self.xid != None:
14946 q.text("%#x" % self.xid)
14947 else:
14948 q.text('None')
14949 q.text(","); q.breakable()
14950 q.text("role = ");
14951 q.text("%#x" % self.role)
14952 q.text(","); q.breakable()
14953 q.text("reason = ");
14954 q.text("%#x" % self.reason)
14955 q.text(","); q.breakable()
14956 q.text("generation_id = ");
14957 q.text("%#x" % self.generation_id)
14958 q.text(","); q.breakable()
14959 q.text("properties = ");
14960 q.pp(self.properties)
14961 q.breakable()
14962 q.text('}')
14963
14964message.subtypes[30] = role_status
14965
14966class set_config(message):
14967 version = 5
14968 type = 9
14969
14970 def __init__(self, xid=None, flags=None, miss_send_len=None):
14971 if xid != None:
14972 self.xid = xid
14973 else:
14974 self.xid = None
14975 if flags != None:
14976 self.flags = flags
14977 else:
14978 self.flags = 0
14979 if miss_send_len != None:
14980 self.miss_send_len = miss_send_len
14981 else:
14982 self.miss_send_len = 0
14983 return
14984
14985 def pack(self):
14986 packed = []
14987 packed.append(struct.pack("!B", self.version))
14988 packed.append(struct.pack("!B", self.type))
14989 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14990 packed.append(struct.pack("!L", self.xid))
14991 packed.append(struct.pack("!H", self.flags))
14992 packed.append(struct.pack("!H", self.miss_send_len))
14993 length = sum([len(x) for x in packed])
14994 packed[2] = struct.pack("!H", length)
14995 return ''.join(packed)
14996
14997 @staticmethod
14998 def unpack(reader):
14999 obj = set_config()
15000 _version = reader.read("!B")[0]
15001 assert(_version == 5)
15002 _type = reader.read("!B")[0]
15003 assert(_type == 9)
15004 _length = reader.read("!H")[0]
15005 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015006 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015007 obj.xid = reader.read("!L")[0]
15008 obj.flags = reader.read("!H")[0]
15009 obj.miss_send_len = reader.read("!H")[0]
15010 return obj
15011
15012 def __eq__(self, other):
15013 if type(self) != type(other): return False
15014 if self.xid != other.xid: return False
15015 if self.flags != other.flags: return False
15016 if self.miss_send_len != other.miss_send_len: return False
15017 return True
15018
15019 def pretty_print(self, q):
15020 q.text("set_config {")
15021 with q.group():
15022 with q.indent(2):
15023 q.breakable()
15024 q.text("xid = ");
15025 if self.xid != None:
15026 q.text("%#x" % self.xid)
15027 else:
15028 q.text('None')
15029 q.text(","); q.breakable()
15030 q.text("flags = ");
15031 q.text("%#x" % self.flags)
15032 q.text(","); q.breakable()
15033 q.text("miss_send_len = ");
15034 q.text("%#x" % self.miss_send_len)
15035 q.breakable()
15036 q.text('}')
15037
15038message.subtypes[9] = set_config
15039
15040class switch_config_failed_error_msg(error_msg):
15041 version = 5
15042 type = 1
15043 err_type = 10
15044
15045 def __init__(self, xid=None, code=None, data=None):
15046 if xid != None:
15047 self.xid = xid
15048 else:
15049 self.xid = None
15050 if code != None:
15051 self.code = code
15052 else:
15053 self.code = 0
15054 if data != None:
15055 self.data = data
15056 else:
15057 self.data = ''
15058 return
15059
15060 def pack(self):
15061 packed = []
15062 packed.append(struct.pack("!B", self.version))
15063 packed.append(struct.pack("!B", self.type))
15064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15065 packed.append(struct.pack("!L", self.xid))
15066 packed.append(struct.pack("!H", self.err_type))
15067 packed.append(struct.pack("!H", self.code))
15068 packed.append(self.data)
15069 length = sum([len(x) for x in packed])
15070 packed[2] = struct.pack("!H", length)
15071 return ''.join(packed)
15072
15073 @staticmethod
15074 def unpack(reader):
15075 obj = switch_config_failed_error_msg()
15076 _version = reader.read("!B")[0]
15077 assert(_version == 5)
15078 _type = reader.read("!B")[0]
15079 assert(_type == 1)
15080 _length = reader.read("!H")[0]
15081 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015082 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015083 obj.xid = reader.read("!L")[0]
15084 _err_type = reader.read("!H")[0]
15085 assert(_err_type == 10)
15086 obj.code = reader.read("!H")[0]
15087 obj.data = str(reader.read_all())
15088 return obj
15089
15090 def __eq__(self, other):
15091 if type(self) != type(other): return False
15092 if self.xid != other.xid: return False
15093 if self.code != other.code: return False
15094 if self.data != other.data: return False
15095 return True
15096
15097 def pretty_print(self, q):
15098 q.text("switch_config_failed_error_msg {")
15099 with q.group():
15100 with q.indent(2):
15101 q.breakable()
15102 q.text("xid = ");
15103 if self.xid != None:
15104 q.text("%#x" % self.xid)
15105 else:
15106 q.text('None')
15107 q.text(","); q.breakable()
15108 q.text("code = ");
15109 q.text("%#x" % self.code)
15110 q.text(","); q.breakable()
15111 q.text("data = ");
15112 q.pp(self.data)
15113 q.breakable()
15114 q.text('}')
15115
15116error_msg.subtypes[10] = switch_config_failed_error_msg
15117
15118class table_desc_stats_reply(stats_reply):
15119 version = 5
15120 type = 19
15121 stats_type = 14
15122
15123 def __init__(self, xid=None, flags=None, entries=None):
15124 if xid != None:
15125 self.xid = xid
15126 else:
15127 self.xid = None
15128 if flags != None:
15129 self.flags = flags
15130 else:
15131 self.flags = 0
15132 if entries != None:
15133 self.entries = entries
15134 else:
15135 self.entries = []
15136 return
15137
15138 def pack(self):
15139 packed = []
15140 packed.append(struct.pack("!B", self.version))
15141 packed.append(struct.pack("!B", self.type))
15142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15143 packed.append(struct.pack("!L", self.xid))
15144 packed.append(struct.pack("!H", self.stats_type))
15145 packed.append(struct.pack("!H", self.flags))
15146 packed.append('\x00' * 4)
15147 packed.append(loxi.generic_util.pack_list(self.entries))
15148 length = sum([len(x) for x in packed])
15149 packed[2] = struct.pack("!H", length)
15150 return ''.join(packed)
15151
15152 @staticmethod
15153 def unpack(reader):
15154 obj = table_desc_stats_reply()
15155 _version = reader.read("!B")[0]
15156 assert(_version == 5)
15157 _type = reader.read("!B")[0]
15158 assert(_type == 19)
15159 _length = reader.read("!H")[0]
15160 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015161 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015162 obj.xid = reader.read("!L")[0]
15163 _stats_type = reader.read("!H")[0]
15164 assert(_stats_type == 14)
15165 obj.flags = reader.read("!H")[0]
15166 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015167 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_desc.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070015168 return obj
15169
15170 def __eq__(self, other):
15171 if type(self) != type(other): return False
15172 if self.xid != other.xid: return False
15173 if self.flags != other.flags: return False
15174 if self.entries != other.entries: return False
15175 return True
15176
15177 def pretty_print(self, q):
15178 q.text("table_desc_stats_reply {")
15179 with q.group():
15180 with q.indent(2):
15181 q.breakable()
15182 q.text("xid = ");
15183 if self.xid != None:
15184 q.text("%#x" % self.xid)
15185 else:
15186 q.text('None')
15187 q.text(","); q.breakable()
15188 q.text("flags = ");
15189 q.text("%#x" % self.flags)
15190 q.text(","); q.breakable()
15191 q.text("entries = ");
15192 q.pp(self.entries)
15193 q.breakable()
15194 q.text('}')
15195
15196stats_reply.subtypes[14] = table_desc_stats_reply
15197
15198class table_desc_stats_request(stats_request):
15199 version = 5
15200 type = 18
15201 stats_type = 14
15202
15203 def __init__(self, xid=None, flags=None):
15204 if xid != None:
15205 self.xid = xid
15206 else:
15207 self.xid = None
15208 if flags != None:
15209 self.flags = flags
15210 else:
15211 self.flags = 0
15212 return
15213
15214 def pack(self):
15215 packed = []
15216 packed.append(struct.pack("!B", self.version))
15217 packed.append(struct.pack("!B", self.type))
15218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15219 packed.append(struct.pack("!L", self.xid))
15220 packed.append(struct.pack("!H", self.stats_type))
15221 packed.append(struct.pack("!H", self.flags))
15222 packed.append('\x00' * 4)
15223 length = sum([len(x) for x in packed])
15224 packed[2] = struct.pack("!H", length)
15225 return ''.join(packed)
15226
15227 @staticmethod
15228 def unpack(reader):
15229 obj = table_desc_stats_request()
15230 _version = reader.read("!B")[0]
15231 assert(_version == 5)
15232 _type = reader.read("!B")[0]
15233 assert(_type == 18)
15234 _length = reader.read("!H")[0]
15235 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015236 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015237 obj.xid = reader.read("!L")[0]
15238 _stats_type = reader.read("!H")[0]
15239 assert(_stats_type == 14)
15240 obj.flags = reader.read("!H")[0]
15241 reader.skip(4)
15242 return obj
15243
15244 def __eq__(self, other):
15245 if type(self) != type(other): return False
15246 if self.xid != other.xid: return False
15247 if self.flags != other.flags: return False
15248 return True
15249
15250 def pretty_print(self, q):
15251 q.text("table_desc_stats_request {")
15252 with q.group():
15253 with q.indent(2):
15254 q.breakable()
15255 q.text("xid = ");
15256 if self.xid != None:
15257 q.text("%#x" % self.xid)
15258 else:
15259 q.text('None')
15260 q.text(","); q.breakable()
15261 q.text("flags = ");
15262 q.text("%#x" % self.flags)
15263 q.breakable()
15264 q.text('}')
15265
15266stats_request.subtypes[14] = table_desc_stats_request
15267
15268class table_features_failed_error_msg(error_msg):
15269 version = 5
15270 type = 1
15271 err_type = 13
15272
15273 def __init__(self, xid=None, code=None, data=None):
15274 if xid != None:
15275 self.xid = xid
15276 else:
15277 self.xid = None
15278 if code != None:
15279 self.code = code
15280 else:
15281 self.code = 0
15282 if data != None:
15283 self.data = data
15284 else:
15285 self.data = ''
15286 return
15287
15288 def pack(self):
15289 packed = []
15290 packed.append(struct.pack("!B", self.version))
15291 packed.append(struct.pack("!B", self.type))
15292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15293 packed.append(struct.pack("!L", self.xid))
15294 packed.append(struct.pack("!H", self.err_type))
15295 packed.append(struct.pack("!H", self.code))
15296 packed.append(self.data)
15297 length = sum([len(x) for x in packed])
15298 packed[2] = struct.pack("!H", length)
15299 return ''.join(packed)
15300
15301 @staticmethod
15302 def unpack(reader):
15303 obj = table_features_failed_error_msg()
15304 _version = reader.read("!B")[0]
15305 assert(_version == 5)
15306 _type = reader.read("!B")[0]
15307 assert(_type == 1)
15308 _length = reader.read("!H")[0]
15309 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015310 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015311 obj.xid = reader.read("!L")[0]
15312 _err_type = reader.read("!H")[0]
15313 assert(_err_type == 13)
15314 obj.code = reader.read("!H")[0]
15315 obj.data = str(reader.read_all())
15316 return obj
15317
15318 def __eq__(self, other):
15319 if type(self) != type(other): return False
15320 if self.xid != other.xid: return False
15321 if self.code != other.code: return False
15322 if self.data != other.data: return False
15323 return True
15324
15325 def pretty_print(self, q):
15326 q.text("table_features_failed_error_msg {")
15327 with q.group():
15328 with q.indent(2):
15329 q.breakable()
15330 q.text("xid = ");
15331 if self.xid != None:
15332 q.text("%#x" % self.xid)
15333 else:
15334 q.text('None')
15335 q.text(","); q.breakable()
15336 q.text("code = ");
15337 q.text("%#x" % self.code)
15338 q.text(","); q.breakable()
15339 q.text("data = ");
15340 q.pp(self.data)
15341 q.breakable()
15342 q.text('}')
15343
15344error_msg.subtypes[13] = table_features_failed_error_msg
15345
15346class table_features_stats_reply(stats_reply):
15347 version = 5
15348 type = 19
15349 stats_type = 12
15350
15351 def __init__(self, xid=None, flags=None, entries=None):
15352 if xid != None:
15353 self.xid = xid
15354 else:
15355 self.xid = None
15356 if flags != None:
15357 self.flags = flags
15358 else:
15359 self.flags = 0
15360 if entries != None:
15361 self.entries = entries
15362 else:
15363 self.entries = []
15364 return
15365
15366 def pack(self):
15367 packed = []
15368 packed.append(struct.pack("!B", self.version))
15369 packed.append(struct.pack("!B", self.type))
15370 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15371 packed.append(struct.pack("!L", self.xid))
15372 packed.append(struct.pack("!H", self.stats_type))
15373 packed.append(struct.pack("!H", self.flags))
15374 packed.append('\x00' * 4)
15375 packed.append(loxi.generic_util.pack_list(self.entries))
15376 length = sum([len(x) for x in packed])
15377 packed[2] = struct.pack("!H", length)
15378 return ''.join(packed)
15379
15380 @staticmethod
15381 def unpack(reader):
15382 obj = table_features_stats_reply()
15383 _version = reader.read("!B")[0]
15384 assert(_version == 5)
15385 _type = reader.read("!B")[0]
15386 assert(_type == 19)
15387 _length = reader.read("!H")[0]
15388 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015389 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015390 obj.xid = reader.read("!L")[0]
15391 _stats_type = reader.read("!H")[0]
15392 assert(_stats_type == 12)
15393 obj.flags = reader.read("!H")[0]
15394 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015395 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070015396 return obj
15397
15398 def __eq__(self, other):
15399 if type(self) != type(other): return False
15400 if self.xid != other.xid: return False
15401 if self.flags != other.flags: return False
15402 if self.entries != other.entries: return False
15403 return True
15404
15405 def pretty_print(self, q):
15406 q.text("table_features_stats_reply {")
15407 with q.group():
15408 with q.indent(2):
15409 q.breakable()
15410 q.text("xid = ");
15411 if self.xid != None:
15412 q.text("%#x" % self.xid)
15413 else:
15414 q.text('None')
15415 q.text(","); q.breakable()
15416 q.text("flags = ");
15417 q.text("%#x" % self.flags)
15418 q.text(","); q.breakable()
15419 q.text("entries = ");
15420 q.pp(self.entries)
15421 q.breakable()
15422 q.text('}')
15423
15424stats_reply.subtypes[12] = table_features_stats_reply
15425
15426class table_features_stats_request(stats_request):
15427 version = 5
15428 type = 18
15429 stats_type = 12
15430
15431 def __init__(self, xid=None, flags=None, entries=None):
15432 if xid != None:
15433 self.xid = xid
15434 else:
15435 self.xid = None
15436 if flags != None:
15437 self.flags = flags
15438 else:
15439 self.flags = 0
15440 if entries != None:
15441 self.entries = entries
15442 else:
15443 self.entries = []
15444 return
15445
15446 def pack(self):
15447 packed = []
15448 packed.append(struct.pack("!B", self.version))
15449 packed.append(struct.pack("!B", self.type))
15450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15451 packed.append(struct.pack("!L", self.xid))
15452 packed.append(struct.pack("!H", self.stats_type))
15453 packed.append(struct.pack("!H", self.flags))
15454 packed.append('\x00' * 4)
15455 packed.append(loxi.generic_util.pack_list(self.entries))
15456 length = sum([len(x) for x in packed])
15457 packed[2] = struct.pack("!H", length)
15458 return ''.join(packed)
15459
15460 @staticmethod
15461 def unpack(reader):
15462 obj = table_features_stats_request()
15463 _version = reader.read("!B")[0]
15464 assert(_version == 5)
15465 _type = reader.read("!B")[0]
15466 assert(_type == 18)
15467 _length = reader.read("!H")[0]
15468 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015469 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015470 obj.xid = reader.read("!L")[0]
15471 _stats_type = reader.read("!H")[0]
15472 assert(_stats_type == 12)
15473 obj.flags = reader.read("!H")[0]
15474 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015475 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070015476 return obj
15477
15478 def __eq__(self, other):
15479 if type(self) != type(other): return False
15480 if self.xid != other.xid: return False
15481 if self.flags != other.flags: return False
15482 if self.entries != other.entries: return False
15483 return True
15484
15485 def pretty_print(self, q):
15486 q.text("table_features_stats_request {")
15487 with q.group():
15488 with q.indent(2):
15489 q.breakable()
15490 q.text("xid = ");
15491 if self.xid != None:
15492 q.text("%#x" % self.xid)
15493 else:
15494 q.text('None')
15495 q.text(","); q.breakable()
15496 q.text("flags = ");
15497 q.text("%#x" % self.flags)
15498 q.text(","); q.breakable()
15499 q.text("entries = ");
15500 q.pp(self.entries)
15501 q.breakable()
15502 q.text('}')
15503
15504stats_request.subtypes[12] = table_features_stats_request
15505
15506class table_mod(message):
15507 version = 5
15508 type = 17
15509
15510 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15511 if xid != None:
15512 self.xid = xid
15513 else:
15514 self.xid = None
15515 if table_id != None:
15516 self.table_id = table_id
15517 else:
15518 self.table_id = 0
15519 if config != None:
15520 self.config = config
15521 else:
15522 self.config = 0
15523 if properties != None:
15524 self.properties = properties
15525 else:
15526 self.properties = []
15527 return
15528
15529 def pack(self):
15530 packed = []
15531 packed.append(struct.pack("!B", self.version))
15532 packed.append(struct.pack("!B", self.type))
15533 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15534 packed.append(struct.pack("!L", self.xid))
15535 packed.append(struct.pack("!B", self.table_id))
15536 packed.append('\x00' * 3)
15537 packed.append(struct.pack("!L", self.config))
15538 packed.append(loxi.generic_util.pack_list(self.properties))
15539 length = sum([len(x) for x in packed])
15540 packed[2] = struct.pack("!H", length)
15541 return ''.join(packed)
15542
15543 @staticmethod
15544 def unpack(reader):
15545 obj = table_mod()
15546 _version = reader.read("!B")[0]
15547 assert(_version == 5)
15548 _type = reader.read("!B")[0]
15549 assert(_type == 17)
15550 _length = reader.read("!H")[0]
15551 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015552 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015553 obj.xid = reader.read("!L")[0]
15554 obj.table_id = reader.read("!B")[0]
15555 reader.skip(3)
15556 obj.config = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080015557 obj.properties = loxi.generic_util.unpack_list(reader, ofp.table_mod_prop.table_mod_prop.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070015558 return obj
15559
15560 def __eq__(self, other):
15561 if type(self) != type(other): return False
15562 if self.xid != other.xid: return False
15563 if self.table_id != other.table_id: return False
15564 if self.config != other.config: return False
15565 if self.properties != other.properties: return False
15566 return True
15567
15568 def pretty_print(self, q):
15569 q.text("table_mod {")
15570 with q.group():
15571 with q.indent(2):
15572 q.breakable()
15573 q.text("xid = ");
15574 if self.xid != None:
15575 q.text("%#x" % self.xid)
15576 else:
15577 q.text('None')
15578 q.text(","); q.breakable()
15579 q.text("table_id = ");
15580 q.text("%#x" % self.table_id)
15581 q.text(","); q.breakable()
15582 q.text("config = ");
15583 q.text("%#x" % self.config)
15584 q.text(","); q.breakable()
15585 q.text("properties = ");
15586 q.pp(self.properties)
15587 q.breakable()
15588 q.text('}')
15589
15590message.subtypes[17] = table_mod
15591
15592class table_mod_failed_error_msg(error_msg):
15593 version = 5
15594 type = 1
15595 err_type = 8
15596
15597 def __init__(self, xid=None, code=None, data=None):
15598 if xid != None:
15599 self.xid = xid
15600 else:
15601 self.xid = None
15602 if code != None:
15603 self.code = code
15604 else:
15605 self.code = 0
15606 if data != None:
15607 self.data = data
15608 else:
15609 self.data = ''
15610 return
15611
15612 def pack(self):
15613 packed = []
15614 packed.append(struct.pack("!B", self.version))
15615 packed.append(struct.pack("!B", self.type))
15616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15617 packed.append(struct.pack("!L", self.xid))
15618 packed.append(struct.pack("!H", self.err_type))
15619 packed.append(struct.pack("!H", self.code))
15620 packed.append(self.data)
15621 length = sum([len(x) for x in packed])
15622 packed[2] = struct.pack("!H", length)
15623 return ''.join(packed)
15624
15625 @staticmethod
15626 def unpack(reader):
15627 obj = table_mod_failed_error_msg()
15628 _version = reader.read("!B")[0]
15629 assert(_version == 5)
15630 _type = reader.read("!B")[0]
15631 assert(_type == 1)
15632 _length = reader.read("!H")[0]
15633 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015634 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015635 obj.xid = reader.read("!L")[0]
15636 _err_type = reader.read("!H")[0]
15637 assert(_err_type == 8)
15638 obj.code = reader.read("!H")[0]
15639 obj.data = str(reader.read_all())
15640 return obj
15641
15642 def __eq__(self, other):
15643 if type(self) != type(other): return False
15644 if self.xid != other.xid: return False
15645 if self.code != other.code: return False
15646 if self.data != other.data: return False
15647 return True
15648
15649 def pretty_print(self, q):
15650 q.text("table_mod_failed_error_msg {")
15651 with q.group():
15652 with q.indent(2):
15653 q.breakable()
15654 q.text("xid = ");
15655 if self.xid != None:
15656 q.text("%#x" % self.xid)
15657 else:
15658 q.text('None')
15659 q.text(","); q.breakable()
15660 q.text("code = ");
15661 q.text("%#x" % self.code)
15662 q.text(","); q.breakable()
15663 q.text("data = ");
15664 q.pp(self.data)
15665 q.breakable()
15666 q.text('}')
15667
15668error_msg.subtypes[8] = table_mod_failed_error_msg
15669
15670class table_stats_reply(stats_reply):
15671 version = 5
15672 type = 19
15673 stats_type = 3
15674
15675 def __init__(self, xid=None, flags=None, entries=None):
15676 if xid != None:
15677 self.xid = xid
15678 else:
15679 self.xid = None
15680 if flags != None:
15681 self.flags = flags
15682 else:
15683 self.flags = 0
15684 if entries != None:
15685 self.entries = entries
15686 else:
15687 self.entries = []
15688 return
15689
15690 def pack(self):
15691 packed = []
15692 packed.append(struct.pack("!B", self.version))
15693 packed.append(struct.pack("!B", self.type))
15694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15695 packed.append(struct.pack("!L", self.xid))
15696 packed.append(struct.pack("!H", self.stats_type))
15697 packed.append(struct.pack("!H", self.flags))
15698 packed.append('\x00' * 4)
15699 packed.append(loxi.generic_util.pack_list(self.entries))
15700 length = sum([len(x) for x in packed])
15701 packed[2] = struct.pack("!H", length)
15702 return ''.join(packed)
15703
15704 @staticmethod
15705 def unpack(reader):
15706 obj = table_stats_reply()
15707 _version = reader.read("!B")[0]
15708 assert(_version == 5)
15709 _type = reader.read("!B")[0]
15710 assert(_type == 19)
15711 _length = reader.read("!H")[0]
15712 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015713 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015714 obj.xid = reader.read("!L")[0]
15715 _stats_type = reader.read("!H")[0]
15716 assert(_stats_type == 3)
15717 obj.flags = reader.read("!H")[0]
15718 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015719 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -070015720 return obj
15721
15722 def __eq__(self, other):
15723 if type(self) != type(other): return False
15724 if self.xid != other.xid: return False
15725 if self.flags != other.flags: return False
15726 if self.entries != other.entries: return False
15727 return True
15728
15729 def pretty_print(self, q):
15730 q.text("table_stats_reply {")
15731 with q.group():
15732 with q.indent(2):
15733 q.breakable()
15734 q.text("xid = ");
15735 if self.xid != None:
15736 q.text("%#x" % self.xid)
15737 else:
15738 q.text('None')
15739 q.text(","); q.breakable()
15740 q.text("flags = ");
15741 q.text("%#x" % self.flags)
15742 q.text(","); q.breakable()
15743 q.text("entries = ");
15744 q.pp(self.entries)
15745 q.breakable()
15746 q.text('}')
15747
15748stats_reply.subtypes[3] = table_stats_reply
15749
15750class table_stats_request(stats_request):
15751 version = 5
15752 type = 18
15753 stats_type = 3
15754
15755 def __init__(self, xid=None, flags=None):
15756 if xid != None:
15757 self.xid = xid
15758 else:
15759 self.xid = None
15760 if flags != None:
15761 self.flags = flags
15762 else:
15763 self.flags = 0
15764 return
15765
15766 def pack(self):
15767 packed = []
15768 packed.append(struct.pack("!B", self.version))
15769 packed.append(struct.pack("!B", self.type))
15770 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15771 packed.append(struct.pack("!L", self.xid))
15772 packed.append(struct.pack("!H", self.stats_type))
15773 packed.append(struct.pack("!H", self.flags))
15774 packed.append('\x00' * 4)
15775 length = sum([len(x) for x in packed])
15776 packed[2] = struct.pack("!H", length)
15777 return ''.join(packed)
15778
15779 @staticmethod
15780 def unpack(reader):
15781 obj = table_stats_request()
15782 _version = reader.read("!B")[0]
15783 assert(_version == 5)
15784 _type = reader.read("!B")[0]
15785 assert(_type == 18)
15786 _length = reader.read("!H")[0]
15787 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015788 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015789 obj.xid = reader.read("!L")[0]
15790 _stats_type = reader.read("!H")[0]
15791 assert(_stats_type == 3)
15792 obj.flags = reader.read("!H")[0]
15793 reader.skip(4)
15794 return obj
15795
15796 def __eq__(self, other):
15797 if type(self) != type(other): return False
15798 if self.xid != other.xid: return False
15799 if self.flags != other.flags: return False
15800 return True
15801
15802 def pretty_print(self, q):
15803 q.text("table_stats_request {")
15804 with q.group():
15805 with q.indent(2):
15806 q.breakable()
15807 q.text("xid = ");
15808 if self.xid != None:
15809 q.text("%#x" % self.xid)
15810 else:
15811 q.text('None')
15812 q.text(","); q.breakable()
15813 q.text("flags = ");
15814 q.text("%#x" % self.flags)
15815 q.breakable()
15816 q.text('}')
15817
15818stats_request.subtypes[3] = table_stats_request
15819
15820class table_status(message):
15821 version = 5
15822 type = 31
15823
15824 def __init__(self, xid=None, role=None, reason=None, table=None):
15825 if xid != None:
15826 self.xid = xid
15827 else:
15828 self.xid = None
15829 if role != None:
15830 self.role = role
15831 else:
15832 self.role = 0
15833 if reason != None:
15834 self.reason = reason
15835 else:
15836 self.reason = 0
15837 if table != None:
15838 self.table = table
15839 else:
Rich Lanee2567702015-01-26 15:04:35 -080015840 self.table = ofp.table_desc()
Rich Lane2e079da2014-10-29 15:30:24 -070015841 return
15842
15843 def pack(self):
15844 packed = []
15845 packed.append(struct.pack("!B", self.version))
15846 packed.append(struct.pack("!B", self.type))
15847 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15848 packed.append(struct.pack("!L", self.xid))
15849 packed.append(struct.pack("!L", self.role))
15850 packed.append(struct.pack("!B", self.reason))
15851 packed.append('\x00' * 7)
15852 packed.append(self.table.pack())
15853 length = sum([len(x) for x in packed])
15854 packed[2] = struct.pack("!H", length)
15855 return ''.join(packed)
15856
15857 @staticmethod
15858 def unpack(reader):
15859 obj = table_status()
15860 _version = reader.read("!B")[0]
15861 assert(_version == 5)
15862 _type = reader.read("!B")[0]
15863 assert(_type == 31)
15864 _length = reader.read("!H")[0]
15865 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015866 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070015867 obj.xid = reader.read("!L")[0]
15868 obj.role = reader.read("!L")[0]
15869 obj.reason = reader.read("!B")[0]
15870 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -080015871 obj.table = ofp.table_desc.unpack(reader)
Rich Lane2e079da2014-10-29 15:30:24 -070015872 return obj
15873
15874 def __eq__(self, other):
15875 if type(self) != type(other): return False
15876 if self.xid != other.xid: return False
15877 if self.role != other.role: return False
15878 if self.reason != other.reason: return False
15879 if self.table != other.table: return False
15880 return True
15881
15882 def pretty_print(self, q):
15883 q.text("table_status {")
15884 with q.group():
15885 with q.indent(2):
15886 q.breakable()
15887 q.text("xid = ");
15888 if self.xid != None:
15889 q.text("%#x" % self.xid)
15890 else:
15891 q.text('None')
15892 q.text(","); q.breakable()
15893 q.text("role = ");
15894 q.text("%#x" % self.role)
15895 q.text(","); q.breakable()
15896 q.text("reason = ");
15897 q.text("%#x" % self.reason)
15898 q.text(","); q.breakable()
15899 q.text("table = ");
15900 q.pp(self.table)
15901 q.breakable()
15902 q.text('}')
15903
15904message.subtypes[31] = table_status
15905
15906
15907def parse_header(buf):
15908 if len(buf) < 8:
15909 raise loxi.ProtocolError("too short to be an OpenFlow message")
15910 return struct.unpack_from("!BBHL", buf)
15911
15912def parse_message(buf):
15913 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanee2567702015-01-26 15:04:35 -080015914 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
15915 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
Rich Lane2e079da2014-10-29 15:30:24 -070015916 if len(buf) != msg_len:
15917 raise loxi.ProtocolError("incorrect message size")
15918 return message.unpack(loxi.generic_util.OFReader(buf))