blob: d856678cfa672b784a439820818459bf91377563 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -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.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
10import loxi
11import const
12import common
Rich Lane7dcdf022013-12-11 14:45:27 -080013import action
14import instruction
Rich Lanec2ee4b82013-04-24 17:12:38 -070015import util
16import loxi.generic_util
17
Rich Lane7dcdf022013-12-11 14:45:27 -080018class message(loxi.OFObject):
19 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070020
Rich Lane95f7fc92014-01-27 17:08:16 -080021 version = 2
22
23 def __init__(self, type=None, xid=None):
24 if type != None:
25 self.type = type
26 else:
27 self.type = 0
28 if xid != None:
29 self.xid = xid
30 else:
31 self.xid = None
32 return
33
34 def pack(self):
35 packed = []
36 packed.append(struct.pack("!B", self.version))
37 packed.append(struct.pack("!B", self.type))
38 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
39 packed.append(struct.pack("!L", self.xid))
40 length = sum([len(x) for x in packed])
41 packed[2] = struct.pack("!H", length)
42 return ''.join(packed)
43
Rich Lane7dcdf022013-12-11 14:45:27 -080044 @staticmethod
45 def unpack(reader):
46 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080047 subclass = message.subtypes.get(subtype)
48 if subclass:
49 return subclass.unpack(reader)
50
51 obj = message()
52 _version = reader.read("!B")[0]
53 assert(_version == 2)
54 obj.type = reader.read("!B")[0]
55 _length = reader.read("!H")[0]
56 orig_reader = reader
57 reader = orig_reader.slice(_length - (2 + 2))
58 obj.xid = reader.read("!L")[0]
59 return obj
60
61 def __eq__(self, other):
62 if type(self) != type(other): return False
63 if self.type != other.type: return False
64 if self.xid != other.xid: return False
65 return True
66
67 def pretty_print(self, q):
68 q.text("message {")
69 with q.group():
70 with q.indent(2):
71 q.breakable()
72 q.text("xid = ");
73 if self.xid != None:
74 q.text("%#x" % self.xid)
75 else:
76 q.text('None')
77 q.breakable()
78 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080079
80
81class stats_reply(message):
82 subtypes = {}
83
Rich Lane95f7fc92014-01-27 17:08:16 -080084 version = 2
85 type = 19
86
87 def __init__(self, xid=None, stats_type=None, flags=None):
88 if xid != None:
89 self.xid = xid
90 else:
91 self.xid = None
92 if stats_type != None:
93 self.stats_type = stats_type
94 else:
95 self.stats_type = 0
96 if flags != None:
97 self.flags = flags
98 else:
99 self.flags = 0
100 return
101
102 def pack(self):
103 packed = []
104 packed.append(struct.pack("!B", self.version))
105 packed.append(struct.pack("!B", self.type))
106 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
107 packed.append(struct.pack("!L", self.xid))
108 packed.append(struct.pack("!H", self.stats_type))
109 packed.append(struct.pack("!H", self.flags))
110 packed.append('\x00' * 4)
111 length = sum([len(x) for x in packed])
112 packed[2] = struct.pack("!H", length)
113 return ''.join(packed)
114
Rich Lane7dcdf022013-12-11 14:45:27 -0800115 @staticmethod
116 def unpack(reader):
117 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800118 subclass = stats_reply.subtypes.get(subtype)
119 if subclass:
120 return subclass.unpack(reader)
121
122 obj = stats_reply()
123 _version = reader.read("!B")[0]
124 assert(_version == 2)
125 _type = reader.read("!B")[0]
126 assert(_type == 19)
127 _length = reader.read("!H")[0]
128 orig_reader = reader
129 reader = orig_reader.slice(_length - (2 + 2))
130 obj.xid = reader.read("!L")[0]
131 obj.stats_type = reader.read("!H")[0]
132 obj.flags = reader.read("!H")[0]
133 reader.skip(4)
134 return obj
135
136 def __eq__(self, other):
137 if type(self) != type(other): return False
138 if self.xid != other.xid: return False
139 if self.stats_type != other.stats_type: return False
140 if self.flags != other.flags: return False
141 return True
142
143 def pretty_print(self, q):
144 q.text("stats_reply {")
145 with q.group():
146 with q.indent(2):
147 q.breakable()
148 q.text("xid = ");
149 if self.xid != None:
150 q.text("%#x" % self.xid)
151 else:
152 q.text('None')
153 q.text(","); q.breakable()
154 q.text("flags = ");
155 q.text("%#x" % self.flags)
156 q.breakable()
157 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800158
159message.subtypes[19] = stats_reply
160
161class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700162 version = 2
163 type = 19
164 stats_type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -0700165
166 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800167 if xid != None:
168 self.xid = xid
169 else:
170 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700171 if flags != None:
172 self.flags = flags
173 else:
174 self.flags = 0
175 if packet_count != None:
176 self.packet_count = packet_count
177 else:
178 self.packet_count = 0
179 if byte_count != None:
180 self.byte_count = byte_count
181 else:
182 self.byte_count = 0
183 if flow_count != None:
184 self.flow_count = flow_count
185 else:
186 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800187 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700188
189 def pack(self):
190 packed = []
191 packed.append(struct.pack("!B", self.version))
192 packed.append(struct.pack("!B", self.type))
193 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
194 packed.append(struct.pack("!L", self.xid))
195 packed.append(struct.pack("!H", self.stats_type))
196 packed.append(struct.pack("!H", self.flags))
197 packed.append('\x00' * 4)
198 packed.append(struct.pack("!Q", self.packet_count))
199 packed.append(struct.pack("!Q", self.byte_count))
200 packed.append(struct.pack("!L", self.flow_count))
201 packed.append('\x00' * 4)
202 length = sum([len(x) for x in packed])
203 packed[2] = struct.pack("!H", length)
204 return ''.join(packed)
205
206 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800207 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700208 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700209 _version = reader.read("!B")[0]
210 assert(_version == 2)
211 _type = reader.read("!B")[0]
212 assert(_type == 19)
213 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800214 orig_reader = reader
215 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700216 obj.xid = reader.read("!L")[0]
217 _stats_type = reader.read("!H")[0]
218 assert(_stats_type == 2)
219 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700220 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700221 obj.packet_count = reader.read("!Q")[0]
222 obj.byte_count = reader.read("!Q")[0]
223 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700224 reader.skip(4)
225 return obj
226
227 def __eq__(self, other):
228 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700229 if self.xid != other.xid: return False
230 if self.flags != other.flags: return False
231 if self.packet_count != other.packet_count: return False
232 if self.byte_count != other.byte_count: return False
233 if self.flow_count != other.flow_count: return False
234 return True
235
Rich Lanec2ee4b82013-04-24 17:12:38 -0700236 def pretty_print(self, q):
237 q.text("aggregate_stats_reply {")
238 with q.group():
239 with q.indent(2):
240 q.breakable()
241 q.text("xid = ");
242 if self.xid != None:
243 q.text("%#x" % self.xid)
244 else:
245 q.text('None')
246 q.text(","); q.breakable()
247 q.text("flags = ");
248 q.text("%#x" % self.flags)
249 q.text(","); q.breakable()
250 q.text("packet_count = ");
251 q.text("%#x" % self.packet_count)
252 q.text(","); q.breakable()
253 q.text("byte_count = ");
254 q.text("%#x" % self.byte_count)
255 q.text(","); q.breakable()
256 q.text("flow_count = ");
257 q.text("%#x" % self.flow_count)
258 q.breakable()
259 q.text('}')
260
Rich Lane7dcdf022013-12-11 14:45:27 -0800261stats_reply.subtypes[2] = aggregate_stats_reply
262
263class stats_request(message):
264 subtypes = {}
265
Rich Lane95f7fc92014-01-27 17:08:16 -0800266 version = 2
267 type = 18
268
269 def __init__(self, xid=None, stats_type=None, flags=None):
270 if xid != None:
271 self.xid = xid
272 else:
273 self.xid = None
274 if stats_type != None:
275 self.stats_type = stats_type
276 else:
277 self.stats_type = 0
278 if flags != None:
279 self.flags = flags
280 else:
281 self.flags = 0
282 return
283
284 def pack(self):
285 packed = []
286 packed.append(struct.pack("!B", self.version))
287 packed.append(struct.pack("!B", self.type))
288 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
289 packed.append(struct.pack("!L", self.xid))
290 packed.append(struct.pack("!H", self.stats_type))
291 packed.append(struct.pack("!H", self.flags))
292 packed.append('\x00' * 4)
293 length = sum([len(x) for x in packed])
294 packed[2] = struct.pack("!H", length)
295 return ''.join(packed)
296
Rich Lane7dcdf022013-12-11 14:45:27 -0800297 @staticmethod
298 def unpack(reader):
299 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800300 subclass = stats_request.subtypes.get(subtype)
301 if subclass:
302 return subclass.unpack(reader)
303
304 obj = stats_request()
305 _version = reader.read("!B")[0]
306 assert(_version == 2)
307 _type = reader.read("!B")[0]
308 assert(_type == 18)
309 _length = reader.read("!H")[0]
310 orig_reader = reader
311 reader = orig_reader.slice(_length - (2 + 2))
312 obj.xid = reader.read("!L")[0]
313 obj.stats_type = reader.read("!H")[0]
314 obj.flags = reader.read("!H")[0]
315 reader.skip(4)
316 return obj
317
318 def __eq__(self, other):
319 if type(self) != type(other): return False
320 if self.xid != other.xid: return False
321 if self.stats_type != other.stats_type: return False
322 if self.flags != other.flags: return False
323 return True
324
325 def pretty_print(self, q):
326 q.text("stats_request {")
327 with q.group():
328 with q.indent(2):
329 q.breakable()
330 q.text("xid = ");
331 if self.xid != None:
332 q.text("%#x" % self.xid)
333 else:
334 q.text('None')
335 q.text(","); q.breakable()
336 q.text("flags = ");
337 q.text("%#x" % self.flags)
338 q.breakable()
339 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800340
341message.subtypes[18] = stats_request
342
343class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700344 version = 2
345 type = 18
346 stats_type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -0700347
348 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800349 if xid != None:
350 self.xid = xid
351 else:
352 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700353 if flags != None:
354 self.flags = flags
355 else:
356 self.flags = 0
357 if table_id != None:
358 self.table_id = table_id
359 else:
360 self.table_id = 0
361 if out_port != None:
362 self.out_port = out_port
363 else:
364 self.out_port = 0
365 if out_group != None:
366 self.out_group = out_group
367 else:
368 self.out_group = 0
369 if cookie != None:
370 self.cookie = cookie
371 else:
372 self.cookie = 0
373 if cookie_mask != None:
374 self.cookie_mask = cookie_mask
375 else:
376 self.cookie_mask = 0
377 if match != None:
378 self.match = match
379 else:
380 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800381 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700382
383 def pack(self):
384 packed = []
385 packed.append(struct.pack("!B", self.version))
386 packed.append(struct.pack("!B", self.type))
387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
388 packed.append(struct.pack("!L", self.xid))
389 packed.append(struct.pack("!H", self.stats_type))
390 packed.append(struct.pack("!H", self.flags))
391 packed.append('\x00' * 4)
392 packed.append(struct.pack("!B", self.table_id))
393 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700394 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700395 packed.append(struct.pack("!L", self.out_group))
396 packed.append('\x00' * 4)
397 packed.append(struct.pack("!Q", self.cookie))
398 packed.append(struct.pack("!Q", self.cookie_mask))
399 packed.append(self.match.pack())
400 length = sum([len(x) for x in packed])
401 packed[2] = struct.pack("!H", length)
402 return ''.join(packed)
403
404 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800405 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700406 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700407 _version = reader.read("!B")[0]
408 assert(_version == 2)
409 _type = reader.read("!B")[0]
410 assert(_type == 18)
411 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800412 orig_reader = reader
413 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700414 obj.xid = reader.read("!L")[0]
415 _stats_type = reader.read("!H")[0]
416 assert(_stats_type == 2)
417 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700418 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700419 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700420 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700421 obj.out_port = util.unpack_port_no(reader)
422 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700423 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700424 obj.cookie = reader.read("!Q")[0]
425 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700426 obj.match = common.match.unpack(reader)
427 return obj
428
429 def __eq__(self, other):
430 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700431 if self.xid != other.xid: return False
432 if self.flags != other.flags: return False
433 if self.table_id != other.table_id: return False
434 if self.out_port != other.out_port: return False
435 if self.out_group != other.out_group: return False
436 if self.cookie != other.cookie: return False
437 if self.cookie_mask != other.cookie_mask: return False
438 if self.match != other.match: return False
439 return True
440
Rich Lanec2ee4b82013-04-24 17:12:38 -0700441 def pretty_print(self, q):
442 q.text("aggregate_stats_request {")
443 with q.group():
444 with q.indent(2):
445 q.breakable()
446 q.text("xid = ");
447 if self.xid != None:
448 q.text("%#x" % self.xid)
449 else:
450 q.text('None')
451 q.text(","); q.breakable()
452 q.text("flags = ");
453 q.text("%#x" % self.flags)
454 q.text(","); q.breakable()
455 q.text("table_id = ");
456 q.text("%#x" % self.table_id)
457 q.text(","); q.breakable()
458 q.text("out_port = ");
459 q.text(util.pretty_port(self.out_port))
460 q.text(","); q.breakable()
461 q.text("out_group = ");
462 q.text("%#x" % self.out_group)
463 q.text(","); q.breakable()
464 q.text("cookie = ");
465 q.text("%#x" % self.cookie)
466 q.text(","); q.breakable()
467 q.text("cookie_mask = ");
468 q.text("%#x" % self.cookie_mask)
469 q.text(","); q.breakable()
470 q.text("match = ");
471 q.pp(self.match)
472 q.breakable()
473 q.text('}')
474
Rich Lane7dcdf022013-12-11 14:45:27 -0800475stats_request.subtypes[2] = aggregate_stats_request
476
477class error_msg(message):
478 subtypes = {}
479
Rich Lane95f7fc92014-01-27 17:08:16 -0800480 version = 2
481 type = 1
482
483 def __init__(self, xid=None, err_type=None):
484 if xid != None:
485 self.xid = xid
486 else:
487 self.xid = None
488 if err_type != None:
489 self.err_type = err_type
490 else:
491 self.err_type = 0
492 return
493
494 def pack(self):
495 packed = []
496 packed.append(struct.pack("!B", self.version))
497 packed.append(struct.pack("!B", self.type))
498 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
499 packed.append(struct.pack("!L", self.xid))
500 packed.append(struct.pack("!H", self.err_type))
501 length = sum([len(x) for x in packed])
502 packed[2] = struct.pack("!H", length)
503 return ''.join(packed)
504
Rich Lane7dcdf022013-12-11 14:45:27 -0800505 @staticmethod
506 def unpack(reader):
507 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800508 subclass = error_msg.subtypes.get(subtype)
509 if subclass:
510 return subclass.unpack(reader)
511
512 obj = error_msg()
513 _version = reader.read("!B")[0]
514 assert(_version == 2)
515 _type = reader.read("!B")[0]
516 assert(_type == 1)
517 _length = reader.read("!H")[0]
518 orig_reader = reader
519 reader = orig_reader.slice(_length - (2 + 2))
520 obj.xid = reader.read("!L")[0]
521 obj.err_type = reader.read("!H")[0]
522 return obj
523
524 def __eq__(self, other):
525 if type(self) != type(other): return False
526 if self.xid != other.xid: return False
527 if self.err_type != other.err_type: return False
528 return True
529
530 def pretty_print(self, q):
531 q.text("error_msg {")
532 with q.group():
533 with q.indent(2):
534 q.breakable()
535 q.text("xid = ");
536 if self.xid != None:
537 q.text("%#x" % self.xid)
538 else:
539 q.text('None')
540 q.breakable()
541 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800542
543message.subtypes[1] = error_msg
544
545class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700546 version = 2
547 type = 1
548 err_type = 2
549
550 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800551 if xid != None:
552 self.xid = xid
553 else:
554 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700555 if code != None:
556 self.code = code
557 else:
558 self.code = 0
559 if data != None:
560 self.data = data
561 else:
562 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800563 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700564
565 def pack(self):
566 packed = []
567 packed.append(struct.pack("!B", self.version))
568 packed.append(struct.pack("!B", self.type))
569 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
570 packed.append(struct.pack("!L", self.xid))
571 packed.append(struct.pack("!H", self.err_type))
572 packed.append(struct.pack("!H", self.code))
573 packed.append(self.data)
574 length = sum([len(x) for x in packed])
575 packed[2] = struct.pack("!H", length)
576 return ''.join(packed)
577
578 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800579 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700580 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700581 _version = reader.read("!B")[0]
582 assert(_version == 2)
583 _type = reader.read("!B")[0]
584 assert(_type == 1)
585 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800586 orig_reader = reader
587 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700588 obj.xid = reader.read("!L")[0]
589 _err_type = reader.read("!H")[0]
590 assert(_err_type == 2)
591 obj.code = reader.read("!H")[0]
592 obj.data = str(reader.read_all())
593 return obj
594
595 def __eq__(self, other):
596 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700597 if self.xid != other.xid: return False
598 if self.code != other.code: return False
599 if self.data != other.data: return False
600 return True
601
Rich Lane6f4978c2013-10-20 21:33:52 -0700602 def pretty_print(self, q):
603 q.text("bad_action_error_msg {")
604 with q.group():
605 with q.indent(2):
606 q.breakable()
607 q.text("xid = ");
608 if self.xid != None:
609 q.text("%#x" % self.xid)
610 else:
611 q.text('None')
612 q.text(","); q.breakable()
613 q.text("code = ");
614 q.text("%#x" % self.code)
615 q.text(","); q.breakable()
616 q.text("data = ");
617 q.pp(self.data)
618 q.breakable()
619 q.text('}')
620
Rich Lane7dcdf022013-12-11 14:45:27 -0800621error_msg.subtypes[2] = bad_action_error_msg
622
623class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700624 version = 2
625 type = 1
626 err_type = 3
627
628 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800629 if xid != None:
630 self.xid = xid
631 else:
632 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700633 if code != None:
634 self.code = code
635 else:
636 self.code = 0
637 if data != None:
638 self.data = data
639 else:
640 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800641 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700642
643 def pack(self):
644 packed = []
645 packed.append(struct.pack("!B", self.version))
646 packed.append(struct.pack("!B", self.type))
647 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
648 packed.append(struct.pack("!L", self.xid))
649 packed.append(struct.pack("!H", self.err_type))
650 packed.append(struct.pack("!H", self.code))
651 packed.append(self.data)
652 length = sum([len(x) for x in packed])
653 packed[2] = struct.pack("!H", length)
654 return ''.join(packed)
655
656 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800657 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700658 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700659 _version = reader.read("!B")[0]
660 assert(_version == 2)
661 _type = reader.read("!B")[0]
662 assert(_type == 1)
663 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800664 orig_reader = reader
665 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700666 obj.xid = reader.read("!L")[0]
667 _err_type = reader.read("!H")[0]
668 assert(_err_type == 3)
669 obj.code = reader.read("!H")[0]
670 obj.data = str(reader.read_all())
671 return obj
672
673 def __eq__(self, other):
674 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700675 if self.xid != other.xid: return False
676 if self.code != other.code: return False
677 if self.data != other.data: return False
678 return True
679
Rich Lane6f4978c2013-10-20 21:33:52 -0700680 def pretty_print(self, q):
681 q.text("bad_instruction_error_msg {")
682 with q.group():
683 with q.indent(2):
684 q.breakable()
685 q.text("xid = ");
686 if self.xid != None:
687 q.text("%#x" % self.xid)
688 else:
689 q.text('None')
690 q.text(","); q.breakable()
691 q.text("code = ");
692 q.text("%#x" % self.code)
693 q.text(","); q.breakable()
694 q.text("data = ");
695 q.pp(self.data)
696 q.breakable()
697 q.text('}')
698
Rich Lane7dcdf022013-12-11 14:45:27 -0800699error_msg.subtypes[3] = bad_instruction_error_msg
700
701class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700702 version = 2
703 type = 1
704 err_type = 4
705
706 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800707 if xid != None:
708 self.xid = xid
709 else:
710 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700711 if code != None:
712 self.code = code
713 else:
714 self.code = 0
715 if data != None:
716 self.data = data
717 else:
718 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800719 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700720
721 def pack(self):
722 packed = []
723 packed.append(struct.pack("!B", self.version))
724 packed.append(struct.pack("!B", self.type))
725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
726 packed.append(struct.pack("!L", self.xid))
727 packed.append(struct.pack("!H", self.err_type))
728 packed.append(struct.pack("!H", self.code))
729 packed.append(self.data)
730 length = sum([len(x) for x in packed])
731 packed[2] = struct.pack("!H", length)
732 return ''.join(packed)
733
734 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800735 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700736 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700737 _version = reader.read("!B")[0]
738 assert(_version == 2)
739 _type = reader.read("!B")[0]
740 assert(_type == 1)
741 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800742 orig_reader = reader
743 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700744 obj.xid = reader.read("!L")[0]
745 _err_type = reader.read("!H")[0]
746 assert(_err_type == 4)
747 obj.code = reader.read("!H")[0]
748 obj.data = str(reader.read_all())
749 return obj
750
751 def __eq__(self, other):
752 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700753 if self.xid != other.xid: return False
754 if self.code != other.code: return False
755 if self.data != other.data: return False
756 return True
757
Rich Lane6f4978c2013-10-20 21:33:52 -0700758 def pretty_print(self, q):
759 q.text("bad_match_error_msg {")
760 with q.group():
761 with q.indent(2):
762 q.breakable()
763 q.text("xid = ");
764 if self.xid != None:
765 q.text("%#x" % self.xid)
766 else:
767 q.text('None')
768 q.text(","); q.breakable()
769 q.text("code = ");
770 q.text("%#x" % self.code)
771 q.text(","); q.breakable()
772 q.text("data = ");
773 q.pp(self.data)
774 q.breakable()
775 q.text('}')
776
Rich Lane7dcdf022013-12-11 14:45:27 -0800777error_msg.subtypes[4] = bad_match_error_msg
778
779class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700780 version = 2
781 type = 1
782 err_type = 1
783
784 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800785 if xid != None:
786 self.xid = xid
787 else:
788 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700789 if code != None:
790 self.code = code
791 else:
792 self.code = 0
793 if data != None:
794 self.data = data
795 else:
796 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800797 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700798
799 def pack(self):
800 packed = []
801 packed.append(struct.pack("!B", self.version))
802 packed.append(struct.pack("!B", self.type))
803 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
804 packed.append(struct.pack("!L", self.xid))
805 packed.append(struct.pack("!H", self.err_type))
806 packed.append(struct.pack("!H", self.code))
807 packed.append(self.data)
808 length = sum([len(x) for x in packed])
809 packed[2] = struct.pack("!H", length)
810 return ''.join(packed)
811
812 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800813 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700814 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700815 _version = reader.read("!B")[0]
816 assert(_version == 2)
817 _type = reader.read("!B")[0]
818 assert(_type == 1)
819 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800820 orig_reader = reader
821 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700822 obj.xid = reader.read("!L")[0]
823 _err_type = reader.read("!H")[0]
824 assert(_err_type == 1)
825 obj.code = reader.read("!H")[0]
826 obj.data = str(reader.read_all())
827 return obj
828
829 def __eq__(self, other):
830 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700831 if self.xid != other.xid: return False
832 if self.code != other.code: return False
833 if self.data != other.data: return False
834 return True
835
Rich Lane6f4978c2013-10-20 21:33:52 -0700836 def pretty_print(self, q):
837 q.text("bad_request_error_msg {")
838 with q.group():
839 with q.indent(2):
840 q.breakable()
841 q.text("xid = ");
842 if self.xid != None:
843 q.text("%#x" % self.xid)
844 else:
845 q.text('None')
846 q.text(","); q.breakable()
847 q.text("code = ");
848 q.text("%#x" % self.code)
849 q.text(","); q.breakable()
850 q.text("data = ");
851 q.pp(self.data)
852 q.breakable()
853 q.text('}')
854
Rich Lane7dcdf022013-12-11 14:45:27 -0800855error_msg.subtypes[1] = bad_request_error_msg
856
857class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700858 version = 2
859 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -0700860
861 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800862 if xid != None:
863 self.xid = xid
864 else:
865 self.xid = None
866 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700867
868 def pack(self):
869 packed = []
870 packed.append(struct.pack("!B", self.version))
871 packed.append(struct.pack("!B", self.type))
872 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
873 packed.append(struct.pack("!L", self.xid))
874 length = sum([len(x) for x in packed])
875 packed[2] = struct.pack("!H", length)
876 return ''.join(packed)
877
878 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800879 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700880 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700881 _version = reader.read("!B")[0]
882 assert(_version == 2)
883 _type = reader.read("!B")[0]
884 assert(_type == 21)
885 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800886 orig_reader = reader
887 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700888 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700889 return obj
890
891 def __eq__(self, other):
892 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700893 if self.xid != other.xid: return False
894 return True
895
Rich Lanec2ee4b82013-04-24 17:12:38 -0700896 def pretty_print(self, q):
897 q.text("barrier_reply {")
898 with q.group():
899 with q.indent(2):
900 q.breakable()
901 q.text("xid = ");
902 if self.xid != None:
903 q.text("%#x" % self.xid)
904 else:
905 q.text('None')
906 q.breakable()
907 q.text('}')
908
Rich Lane7dcdf022013-12-11 14:45:27 -0800909message.subtypes[21] = barrier_reply
910
911class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700912 version = 2
913 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700914
915 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800916 if xid != None:
917 self.xid = xid
918 else:
919 self.xid = None
920 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700921
922 def pack(self):
923 packed = []
924 packed.append(struct.pack("!B", self.version))
925 packed.append(struct.pack("!B", self.type))
926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
927 packed.append(struct.pack("!L", self.xid))
928 length = sum([len(x) for x in packed])
929 packed[2] = struct.pack("!H", length)
930 return ''.join(packed)
931
932 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800933 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700934 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700935 _version = reader.read("!B")[0]
936 assert(_version == 2)
937 _type = reader.read("!B")[0]
938 assert(_type == 20)
939 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800940 orig_reader = reader
941 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700942 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700943 return obj
944
945 def __eq__(self, other):
946 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700947 if self.xid != other.xid: return False
948 return True
949
Rich Lanec2ee4b82013-04-24 17:12:38 -0700950 def pretty_print(self, q):
951 q.text("barrier_request {")
952 with q.group():
953 with q.indent(2):
954 q.breakable()
955 q.text("xid = ");
956 if self.xid != None:
957 q.text("%#x" % self.xid)
958 else:
959 q.text('None')
960 q.breakable()
961 q.text('}')
962
Rich Lane7dcdf022013-12-11 14:45:27 -0800963message.subtypes[20] = barrier_request
964
965class experimenter(message):
966 subtypes = {}
967
Rich Lane95f7fc92014-01-27 17:08:16 -0800968 version = 2
969 type = 4
970
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700971 def __init__(self, xid=None, experimenter=None, data=None):
Rich Lane95f7fc92014-01-27 17:08:16 -0800972 if xid != None:
973 self.xid = xid
974 else:
975 self.xid = None
976 if experimenter != None:
977 self.experimenter = experimenter
978 else:
979 self.experimenter = 0
Rich Lane95f7fc92014-01-27 17:08:16 -0800980 if data != None:
981 self.data = data
982 else:
983 self.data = ''
984 return
985
986 def pack(self):
987 packed = []
988 packed.append(struct.pack("!B", self.version))
989 packed.append(struct.pack("!B", self.type))
990 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
991 packed.append(struct.pack("!L", self.xid))
992 packed.append(struct.pack("!L", self.experimenter))
Rich Lane95f7fc92014-01-27 17:08:16 -0800993 packed.append(self.data)
994 length = sum([len(x) for x in packed])
995 packed[2] = struct.pack("!H", length)
996 return ''.join(packed)
997
Rich Lane7dcdf022013-12-11 14:45:27 -0800998 @staticmethod
999 def unpack(reader):
1000 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001001 subclass = experimenter.subtypes.get(subtype)
1002 if subclass:
1003 return subclass.unpack(reader)
1004
1005 obj = experimenter()
1006 _version = reader.read("!B")[0]
1007 assert(_version == 2)
1008 _type = reader.read("!B")[0]
1009 assert(_type == 4)
1010 _length = reader.read("!H")[0]
1011 orig_reader = reader
1012 reader = orig_reader.slice(_length - (2 + 2))
1013 obj.xid = reader.read("!L")[0]
1014 obj.experimenter = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -08001015 obj.data = str(reader.read_all())
1016 return obj
1017
1018 def __eq__(self, other):
1019 if type(self) != type(other): return False
1020 if self.xid != other.xid: return False
1021 if self.experimenter != other.experimenter: return False
Rich Lane95f7fc92014-01-27 17:08:16 -08001022 if self.data != other.data: return False
1023 return True
1024
1025 def pretty_print(self, q):
1026 q.text("experimenter {")
1027 with q.group():
1028 with q.indent(2):
1029 q.breakable()
1030 q.text("xid = ");
1031 if self.xid != None:
1032 q.text("%#x" % self.xid)
1033 else:
1034 q.text('None')
1035 q.text(","); q.breakable()
Rich Lane95f7fc92014-01-27 17:08:16 -08001036 q.text("data = ");
1037 q.pp(self.data)
1038 q.breakable()
1039 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001040
1041message.subtypes[4] = experimenter
1042
1043class bsn_header(experimenter):
1044 subtypes = {}
1045
Rich Lane95f7fc92014-01-27 17:08:16 -08001046 version = 2
1047 type = 4
1048 experimenter = 6035143
1049
1050 def __init__(self, xid=None, subtype=None):
1051 if xid != None:
1052 self.xid = xid
1053 else:
1054 self.xid = None
1055 if subtype != None:
1056 self.subtype = subtype
1057 else:
1058 self.subtype = 0
1059 return
1060
1061 def pack(self):
1062 packed = []
1063 packed.append(struct.pack("!B", self.version))
1064 packed.append(struct.pack("!B", self.type))
1065 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1066 packed.append(struct.pack("!L", self.xid))
1067 packed.append(struct.pack("!L", self.experimenter))
1068 packed.append(struct.pack("!L", self.subtype))
1069 length = sum([len(x) for x in packed])
1070 packed[2] = struct.pack("!H", length)
1071 return ''.join(packed)
1072
Rich Lane7dcdf022013-12-11 14:45:27 -08001073 @staticmethod
1074 def unpack(reader):
1075 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001076 subclass = bsn_header.subtypes.get(subtype)
1077 if subclass:
1078 return subclass.unpack(reader)
1079
1080 obj = bsn_header()
1081 _version = reader.read("!B")[0]
1082 assert(_version == 2)
1083 _type = reader.read("!B")[0]
1084 assert(_type == 4)
1085 _length = reader.read("!H")[0]
1086 orig_reader = reader
1087 reader = orig_reader.slice(_length - (2 + 2))
1088 obj.xid = reader.read("!L")[0]
1089 _experimenter = reader.read("!L")[0]
1090 assert(_experimenter == 6035143)
1091 obj.subtype = reader.read("!L")[0]
1092 return obj
1093
1094 def __eq__(self, other):
1095 if type(self) != type(other): return False
1096 if self.xid != other.xid: return False
1097 if self.subtype != other.subtype: return False
1098 return True
1099
1100 def pretty_print(self, q):
1101 q.text("bsn_header {")
1102 with q.group():
1103 with q.indent(2):
1104 q.breakable()
1105 q.text("xid = ");
1106 if self.xid != None:
1107 q.text("%#x" % self.xid)
1108 else:
1109 q.text('None')
1110 q.breakable()
1111 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001112
1113experimenter.subtypes[6035143] = bsn_header
1114
1115class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001116 version = 2
1117 type = 4
1118 experimenter = 6035143
1119 subtype = 22
1120
1121 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001122 if xid != None:
1123 self.xid = xid
1124 else:
1125 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001126 if status != None:
1127 self.status = status
1128 else:
1129 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001130 return
Dan Talaycof6202252013-07-02 01:00:29 -07001131
1132 def pack(self):
1133 packed = []
1134 packed.append(struct.pack("!B", self.version))
1135 packed.append(struct.pack("!B", self.type))
1136 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1137 packed.append(struct.pack("!L", self.xid))
1138 packed.append(struct.pack("!L", self.experimenter))
1139 packed.append(struct.pack("!L", self.subtype))
1140 packed.append(struct.pack("!L", self.status))
1141 length = sum([len(x) for x in packed])
1142 packed[2] = struct.pack("!H", length)
1143 return ''.join(packed)
1144
1145 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001146 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001147 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001148 _version = reader.read("!B")[0]
1149 assert(_version == 2)
1150 _type = reader.read("!B")[0]
1151 assert(_type == 4)
1152 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001153 orig_reader = reader
1154 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001155 obj.xid = reader.read("!L")[0]
1156 _experimenter = reader.read("!L")[0]
1157 assert(_experimenter == 6035143)
1158 _subtype = reader.read("!L")[0]
1159 assert(_subtype == 22)
1160 obj.status = reader.read("!L")[0]
1161 return obj
1162
1163 def __eq__(self, other):
1164 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001165 if self.xid != other.xid: return False
1166 if self.status != other.status: return False
1167 return True
1168
Dan Talaycof6202252013-07-02 01:00:29 -07001169 def pretty_print(self, q):
1170 q.text("bsn_bw_clear_data_reply {")
1171 with q.group():
1172 with q.indent(2):
1173 q.breakable()
1174 q.text("xid = ");
1175 if self.xid != None:
1176 q.text("%#x" % self.xid)
1177 else:
1178 q.text('None')
1179 q.text(","); q.breakable()
1180 q.text("status = ");
1181 q.text("%#x" % self.status)
1182 q.breakable()
1183 q.text('}')
1184
Rich Lane7dcdf022013-12-11 14:45:27 -08001185bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1186
1187class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001188 version = 2
1189 type = 4
1190 experimenter = 6035143
1191 subtype = 21
1192
1193 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001194 if xid != None:
1195 self.xid = xid
1196 else:
1197 self.xid = None
1198 return
Dan Talaycof6202252013-07-02 01:00:29 -07001199
1200 def pack(self):
1201 packed = []
1202 packed.append(struct.pack("!B", self.version))
1203 packed.append(struct.pack("!B", self.type))
1204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1205 packed.append(struct.pack("!L", self.xid))
1206 packed.append(struct.pack("!L", self.experimenter))
1207 packed.append(struct.pack("!L", self.subtype))
1208 length = sum([len(x) for x in packed])
1209 packed[2] = struct.pack("!H", length)
1210 return ''.join(packed)
1211
1212 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001213 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001214 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001215 _version = reader.read("!B")[0]
1216 assert(_version == 2)
1217 _type = reader.read("!B")[0]
1218 assert(_type == 4)
1219 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001220 orig_reader = reader
1221 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001222 obj.xid = reader.read("!L")[0]
1223 _experimenter = reader.read("!L")[0]
1224 assert(_experimenter == 6035143)
1225 _subtype = reader.read("!L")[0]
1226 assert(_subtype == 21)
1227 return obj
1228
1229 def __eq__(self, other):
1230 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001231 if self.xid != other.xid: return False
1232 return True
1233
Dan Talaycof6202252013-07-02 01:00:29 -07001234 def pretty_print(self, q):
1235 q.text("bsn_bw_clear_data_request {")
1236 with q.group():
1237 with q.indent(2):
1238 q.breakable()
1239 q.text("xid = ");
1240 if self.xid != None:
1241 q.text("%#x" % self.xid)
1242 else:
1243 q.text('None')
1244 q.breakable()
1245 q.text('}')
1246
Rich Lane7dcdf022013-12-11 14:45:27 -08001247bsn_header.subtypes[21] = bsn_bw_clear_data_request
1248
1249class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001250 version = 2
1251 type = 4
1252 experimenter = 6035143
1253 subtype = 20
1254
1255 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001256 if xid != None:
1257 self.xid = xid
1258 else:
1259 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001260 if enabled != None:
1261 self.enabled = enabled
1262 else:
1263 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001264 return
Dan Talaycof6202252013-07-02 01:00:29 -07001265
1266 def pack(self):
1267 packed = []
1268 packed.append(struct.pack("!B", self.version))
1269 packed.append(struct.pack("!B", self.type))
1270 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1271 packed.append(struct.pack("!L", self.xid))
1272 packed.append(struct.pack("!L", self.experimenter))
1273 packed.append(struct.pack("!L", self.subtype))
1274 packed.append(struct.pack("!L", self.enabled))
1275 length = sum([len(x) for x in packed])
1276 packed[2] = struct.pack("!H", length)
1277 return ''.join(packed)
1278
1279 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001280 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001281 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001282 _version = reader.read("!B")[0]
1283 assert(_version == 2)
1284 _type = reader.read("!B")[0]
1285 assert(_type == 4)
1286 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001287 orig_reader = reader
1288 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001289 obj.xid = reader.read("!L")[0]
1290 _experimenter = reader.read("!L")[0]
1291 assert(_experimenter == 6035143)
1292 _subtype = reader.read("!L")[0]
1293 assert(_subtype == 20)
1294 obj.enabled = reader.read("!L")[0]
1295 return obj
1296
1297 def __eq__(self, other):
1298 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001299 if self.xid != other.xid: return False
1300 if self.enabled != other.enabled: return False
1301 return True
1302
Dan Talaycof6202252013-07-02 01:00:29 -07001303 def pretty_print(self, q):
1304 q.text("bsn_bw_enable_get_reply {")
1305 with q.group():
1306 with q.indent(2):
1307 q.breakable()
1308 q.text("xid = ");
1309 if self.xid != None:
1310 q.text("%#x" % self.xid)
1311 else:
1312 q.text('None')
1313 q.text(","); q.breakable()
1314 q.text("enabled = ");
1315 q.text("%#x" % self.enabled)
1316 q.breakable()
1317 q.text('}')
1318
Rich Lane7dcdf022013-12-11 14:45:27 -08001319bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1320
1321class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001322 version = 2
1323 type = 4
1324 experimenter = 6035143
1325 subtype = 19
1326
1327 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001328 if xid != None:
1329 self.xid = xid
1330 else:
1331 self.xid = None
1332 return
Dan Talaycof6202252013-07-02 01:00:29 -07001333
1334 def pack(self):
1335 packed = []
1336 packed.append(struct.pack("!B", self.version))
1337 packed.append(struct.pack("!B", self.type))
1338 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1339 packed.append(struct.pack("!L", self.xid))
1340 packed.append(struct.pack("!L", self.experimenter))
1341 packed.append(struct.pack("!L", self.subtype))
1342 length = sum([len(x) for x in packed])
1343 packed[2] = struct.pack("!H", length)
1344 return ''.join(packed)
1345
1346 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001347 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001348 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001349 _version = reader.read("!B")[0]
1350 assert(_version == 2)
1351 _type = reader.read("!B")[0]
1352 assert(_type == 4)
1353 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001354 orig_reader = reader
1355 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001356 obj.xid = reader.read("!L")[0]
1357 _experimenter = reader.read("!L")[0]
1358 assert(_experimenter == 6035143)
1359 _subtype = reader.read("!L")[0]
1360 assert(_subtype == 19)
1361 return obj
1362
1363 def __eq__(self, other):
1364 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001365 if self.xid != other.xid: return False
1366 return True
1367
Dan Talaycof6202252013-07-02 01:00:29 -07001368 def pretty_print(self, q):
1369 q.text("bsn_bw_enable_get_request {")
1370 with q.group():
1371 with q.indent(2):
1372 q.breakable()
1373 q.text("xid = ");
1374 if self.xid != None:
1375 q.text("%#x" % self.xid)
1376 else:
1377 q.text('None')
1378 q.breakable()
1379 q.text('}')
1380
Rich Lane7dcdf022013-12-11 14:45:27 -08001381bsn_header.subtypes[19] = bsn_bw_enable_get_request
1382
1383class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001384 version = 2
1385 type = 4
1386 experimenter = 6035143
1387 subtype = 23
1388
1389 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001390 if xid != None:
1391 self.xid = xid
1392 else:
1393 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001394 if enable != None:
1395 self.enable = enable
1396 else:
1397 self.enable = 0
1398 if status != None:
1399 self.status = status
1400 else:
1401 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001402 return
Dan Talaycof6202252013-07-02 01:00:29 -07001403
1404 def pack(self):
1405 packed = []
1406 packed.append(struct.pack("!B", self.version))
1407 packed.append(struct.pack("!B", self.type))
1408 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1409 packed.append(struct.pack("!L", self.xid))
1410 packed.append(struct.pack("!L", self.experimenter))
1411 packed.append(struct.pack("!L", self.subtype))
1412 packed.append(struct.pack("!L", self.enable))
1413 packed.append(struct.pack("!L", self.status))
1414 length = sum([len(x) for x in packed])
1415 packed[2] = struct.pack("!H", length)
1416 return ''.join(packed)
1417
1418 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001419 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001420 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001421 _version = reader.read("!B")[0]
1422 assert(_version == 2)
1423 _type = reader.read("!B")[0]
1424 assert(_type == 4)
1425 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001426 orig_reader = reader
1427 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001428 obj.xid = reader.read("!L")[0]
1429 _experimenter = reader.read("!L")[0]
1430 assert(_experimenter == 6035143)
1431 _subtype = reader.read("!L")[0]
1432 assert(_subtype == 23)
1433 obj.enable = reader.read("!L")[0]
1434 obj.status = reader.read("!L")[0]
1435 return obj
1436
1437 def __eq__(self, other):
1438 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001439 if self.xid != other.xid: return False
1440 if self.enable != other.enable: return False
1441 if self.status != other.status: return False
1442 return True
1443
Dan Talaycof6202252013-07-02 01:00:29 -07001444 def pretty_print(self, q):
1445 q.text("bsn_bw_enable_set_reply {")
1446 with q.group():
1447 with q.indent(2):
1448 q.breakable()
1449 q.text("xid = ");
1450 if self.xid != None:
1451 q.text("%#x" % self.xid)
1452 else:
1453 q.text('None')
1454 q.text(","); q.breakable()
1455 q.text("enable = ");
1456 q.text("%#x" % self.enable)
1457 q.text(","); q.breakable()
1458 q.text("status = ");
1459 q.text("%#x" % self.status)
1460 q.breakable()
1461 q.text('}')
1462
Rich Lane7dcdf022013-12-11 14:45:27 -08001463bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1464
1465class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001466 version = 2
1467 type = 4
1468 experimenter = 6035143
1469 subtype = 18
1470
1471 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001472 if xid != None:
1473 self.xid = xid
1474 else:
1475 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001476 if enable != None:
1477 self.enable = enable
1478 else:
1479 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001480 return
Dan Talaycof6202252013-07-02 01:00:29 -07001481
1482 def pack(self):
1483 packed = []
1484 packed.append(struct.pack("!B", self.version))
1485 packed.append(struct.pack("!B", self.type))
1486 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1487 packed.append(struct.pack("!L", self.xid))
1488 packed.append(struct.pack("!L", self.experimenter))
1489 packed.append(struct.pack("!L", self.subtype))
1490 packed.append(struct.pack("!L", self.enable))
1491 length = sum([len(x) for x in packed])
1492 packed[2] = struct.pack("!H", length)
1493 return ''.join(packed)
1494
1495 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001496 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001497 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001498 _version = reader.read("!B")[0]
1499 assert(_version == 2)
1500 _type = reader.read("!B")[0]
1501 assert(_type == 4)
1502 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001503 orig_reader = reader
1504 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001505 obj.xid = reader.read("!L")[0]
1506 _experimenter = reader.read("!L")[0]
1507 assert(_experimenter == 6035143)
1508 _subtype = reader.read("!L")[0]
1509 assert(_subtype == 18)
1510 obj.enable = reader.read("!L")[0]
1511 return obj
1512
1513 def __eq__(self, other):
1514 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001515 if self.xid != other.xid: return False
1516 if self.enable != other.enable: return False
1517 return True
1518
Dan Talaycof6202252013-07-02 01:00:29 -07001519 def pretty_print(self, q):
1520 q.text("bsn_bw_enable_set_request {")
1521 with q.group():
1522 with q.indent(2):
1523 q.breakable()
1524 q.text("xid = ");
1525 if self.xid != None:
1526 q.text("%#x" % self.xid)
1527 else:
1528 q.text('None')
1529 q.text(","); q.breakable()
1530 q.text("enable = ");
1531 q.text("%#x" % self.enable)
1532 q.breakable()
1533 q.text('}')
1534
Rich Lane7dcdf022013-12-11 14:45:27 -08001535bsn_header.subtypes[18] = bsn_bw_enable_set_request
1536
1537class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001538 version = 2
1539 type = 4
1540 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001541 subtype = 10
1542
1543 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001544 if xid != None:
1545 self.xid = xid
1546 else:
1547 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001548 if interfaces != None:
1549 self.interfaces = interfaces
1550 else:
1551 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001552 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001553
1554 def pack(self):
1555 packed = []
1556 packed.append(struct.pack("!B", self.version))
1557 packed.append(struct.pack("!B", self.type))
1558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1559 packed.append(struct.pack("!L", self.xid))
1560 packed.append(struct.pack("!L", self.experimenter))
1561 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001562 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001563 length = sum([len(x) for x in packed])
1564 packed[2] = struct.pack("!H", length)
1565 return ''.join(packed)
1566
1567 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001568 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001569 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001570 _version = reader.read("!B")[0]
1571 assert(_version == 2)
1572 _type = reader.read("!B")[0]
1573 assert(_type == 4)
1574 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001575 orig_reader = reader
1576 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001577 obj.xid = reader.read("!L")[0]
1578 _experimenter = reader.read("!L")[0]
1579 assert(_experimenter == 6035143)
1580 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001581 assert(_subtype == 10)
1582 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
1583 return obj
1584
1585 def __eq__(self, other):
1586 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001587 if self.xid != other.xid: return False
1588 if self.interfaces != other.interfaces: return False
1589 return True
1590
Rich Lanec2ee4b82013-04-24 17:12:38 -07001591 def pretty_print(self, q):
1592 q.text("bsn_get_interfaces_reply {")
1593 with q.group():
1594 with q.indent(2):
1595 q.breakable()
1596 q.text("xid = ");
1597 if self.xid != None:
1598 q.text("%#x" % self.xid)
1599 else:
1600 q.text('None')
1601 q.text(","); q.breakable()
1602 q.text("interfaces = ");
1603 q.pp(self.interfaces)
1604 q.breakable()
1605 q.text('}')
1606
Rich Lane7dcdf022013-12-11 14:45:27 -08001607bsn_header.subtypes[10] = bsn_get_interfaces_reply
1608
1609class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001610 version = 2
1611 type = 4
1612 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001613 subtype = 9
1614
1615 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001616 if xid != None:
1617 self.xid = xid
1618 else:
1619 self.xid = None
1620 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001621
1622 def pack(self):
1623 packed = []
1624 packed.append(struct.pack("!B", self.version))
1625 packed.append(struct.pack("!B", self.type))
1626 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1627 packed.append(struct.pack("!L", self.xid))
1628 packed.append(struct.pack("!L", self.experimenter))
1629 packed.append(struct.pack("!L", self.subtype))
1630 length = sum([len(x) for x in packed])
1631 packed[2] = struct.pack("!H", length)
1632 return ''.join(packed)
1633
1634 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001635 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001636 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001637 _version = reader.read("!B")[0]
1638 assert(_version == 2)
1639 _type = reader.read("!B")[0]
1640 assert(_type == 4)
1641 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001642 orig_reader = reader
1643 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001644 obj.xid = reader.read("!L")[0]
1645 _experimenter = reader.read("!L")[0]
1646 assert(_experimenter == 6035143)
1647 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001648 assert(_subtype == 9)
1649 return obj
1650
1651 def __eq__(self, other):
1652 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001653 if self.xid != other.xid: return False
1654 return True
1655
Rich Lanec2ee4b82013-04-24 17:12:38 -07001656 def pretty_print(self, q):
1657 q.text("bsn_get_interfaces_request {")
1658 with q.group():
1659 with q.indent(2):
1660 q.breakable()
1661 q.text("xid = ");
1662 if self.xid != None:
1663 q.text("%#x" % self.xid)
1664 else:
1665 q.text('None')
1666 q.breakable()
1667 q.text('}')
1668
Rich Lane7dcdf022013-12-11 14:45:27 -08001669bsn_header.subtypes[9] = bsn_get_interfaces_request
1670
1671class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001672 version = 2
1673 type = 4
1674 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001675 subtype = 5
1676
1677 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001678 if xid != None:
1679 self.xid = xid
1680 else:
1681 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001682 if report_mirror_ports != None:
1683 self.report_mirror_ports = report_mirror_ports
1684 else:
1685 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001686 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001687
1688 def pack(self):
1689 packed = []
1690 packed.append(struct.pack("!B", self.version))
1691 packed.append(struct.pack("!B", self.type))
1692 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1693 packed.append(struct.pack("!L", self.xid))
1694 packed.append(struct.pack("!L", self.experimenter))
1695 packed.append(struct.pack("!L", self.subtype))
1696 packed.append(struct.pack("!B", self.report_mirror_ports))
1697 packed.append('\x00' * 3)
1698 length = sum([len(x) for x in packed])
1699 packed[2] = struct.pack("!H", length)
1700 return ''.join(packed)
1701
1702 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001703 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001704 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001705 _version = reader.read("!B")[0]
1706 assert(_version == 2)
1707 _type = reader.read("!B")[0]
1708 assert(_type == 4)
1709 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001710 orig_reader = reader
1711 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001712 obj.xid = reader.read("!L")[0]
1713 _experimenter = reader.read("!L")[0]
1714 assert(_experimenter == 6035143)
1715 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001716 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001717 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001718 reader.skip(3)
1719 return obj
1720
1721 def __eq__(self, other):
1722 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001723 if self.xid != other.xid: return False
1724 if self.report_mirror_ports != other.report_mirror_ports: return False
1725 return True
1726
Rich Lanec2ee4b82013-04-24 17:12:38 -07001727 def pretty_print(self, q):
1728 q.text("bsn_get_mirroring_reply {")
1729 with q.group():
1730 with q.indent(2):
1731 q.breakable()
1732 q.text("xid = ");
1733 if self.xid != None:
1734 q.text("%#x" % self.xid)
1735 else:
1736 q.text('None')
1737 q.text(","); q.breakable()
1738 q.text("report_mirror_ports = ");
1739 q.text("%#x" % self.report_mirror_ports)
1740 q.breakable()
1741 q.text('}')
1742
Rich Lane7dcdf022013-12-11 14:45:27 -08001743bsn_header.subtypes[5] = bsn_get_mirroring_reply
1744
1745class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001746 version = 2
1747 type = 4
1748 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001749 subtype = 4
1750
1751 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001752 if xid != None:
1753 self.xid = xid
1754 else:
1755 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001756 if report_mirror_ports != None:
1757 self.report_mirror_ports = report_mirror_ports
1758 else:
1759 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001760 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001761
1762 def pack(self):
1763 packed = []
1764 packed.append(struct.pack("!B", self.version))
1765 packed.append(struct.pack("!B", self.type))
1766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1767 packed.append(struct.pack("!L", self.xid))
1768 packed.append(struct.pack("!L", self.experimenter))
1769 packed.append(struct.pack("!L", self.subtype))
1770 packed.append(struct.pack("!B", self.report_mirror_ports))
1771 packed.append('\x00' * 3)
1772 length = sum([len(x) for x in packed])
1773 packed[2] = struct.pack("!H", length)
1774 return ''.join(packed)
1775
1776 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001777 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001778 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001779 _version = reader.read("!B")[0]
1780 assert(_version == 2)
1781 _type = reader.read("!B")[0]
1782 assert(_type == 4)
1783 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001784 orig_reader = reader
1785 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001786 obj.xid = reader.read("!L")[0]
1787 _experimenter = reader.read("!L")[0]
1788 assert(_experimenter == 6035143)
1789 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001790 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001791 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001792 reader.skip(3)
1793 return obj
1794
1795 def __eq__(self, other):
1796 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001797 if self.xid != other.xid: return False
1798 if self.report_mirror_ports != other.report_mirror_ports: return False
1799 return True
1800
Rich Lanec2ee4b82013-04-24 17:12:38 -07001801 def pretty_print(self, q):
1802 q.text("bsn_get_mirroring_request {")
1803 with q.group():
1804 with q.indent(2):
1805 q.breakable()
1806 q.text("xid = ");
1807 if self.xid != None:
1808 q.text("%#x" % self.xid)
1809 else:
1810 q.text('None')
1811 q.text(","); q.breakable()
1812 q.text("report_mirror_ports = ");
1813 q.text("%#x" % self.report_mirror_ports)
1814 q.breakable()
1815 q.text('}')
1816
Rich Lane7dcdf022013-12-11 14:45:27 -08001817bsn_header.subtypes[4] = bsn_get_mirroring_request
1818
1819class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001820 version = 2
1821 type = 4
1822 experimenter = 6035143
1823 subtype = 34
1824
Rich Lane7b0f2012013-11-22 14:15:26 -08001825 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001826 if xid != None:
1827 self.xid = xid
1828 else:
1829 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001830 if status != None:
1831 self.status = status
1832 else:
1833 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08001834 if port_no != None:
1835 self.port_no = port_no
1836 else:
1837 self.port_no = 0
1838 if slot_num != None:
1839 self.slot_num = slot_num
1840 else:
1841 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001842 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001843
1844 def pack(self):
1845 packed = []
1846 packed.append(struct.pack("!B", self.version))
1847 packed.append(struct.pack("!B", self.type))
1848 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1849 packed.append(struct.pack("!L", self.xid))
1850 packed.append(struct.pack("!L", self.experimenter))
1851 packed.append(struct.pack("!L", self.subtype))
1852 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08001853 packed.append(util.pack_port_no(self.port_no))
1854 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07001855 length = sum([len(x) for x in packed])
1856 packed[2] = struct.pack("!H", length)
1857 return ''.join(packed)
1858
1859 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001860 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001861 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001862 _version = reader.read("!B")[0]
1863 assert(_version == 2)
1864 _type = reader.read("!B")[0]
1865 assert(_type == 4)
1866 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001867 orig_reader = reader
1868 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -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 == 34)
1874 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08001875 obj.port_no = util.unpack_port_no(reader)
1876 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07001877 return obj
1878
1879 def __eq__(self, other):
1880 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001881 if self.xid != other.xid: return False
1882 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08001883 if self.port_no != other.port_no: return False
1884 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001885 return True
1886
Rich Lane6f4978c2013-10-20 21:33:52 -07001887 def pretty_print(self, q):
1888 q.text("bsn_pdu_rx_reply {")
1889 with q.group():
1890 with q.indent(2):
1891 q.breakable()
1892 q.text("xid = ");
1893 if self.xid != None:
1894 q.text("%#x" % self.xid)
1895 else:
1896 q.text('None')
1897 q.text(","); q.breakable()
1898 q.text("status = ");
1899 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08001900 q.text(","); q.breakable()
1901 q.text("port_no = ");
1902 q.text(util.pretty_port(self.port_no))
1903 q.text(","); q.breakable()
1904 q.text("slot_num = ");
1905 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07001906 q.breakable()
1907 q.text('}')
1908
Rich Lane7dcdf022013-12-11 14:45:27 -08001909bsn_header.subtypes[34] = bsn_pdu_rx_reply
1910
1911class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001912 version = 2
1913 type = 4
1914 experimenter = 6035143
1915 subtype = 33
1916
1917 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001918 if xid != None:
1919 self.xid = xid
1920 else:
1921 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001922 if timeout_ms != None:
1923 self.timeout_ms = timeout_ms
1924 else:
1925 self.timeout_ms = 0
1926 if port_no != None:
1927 self.port_no = port_no
1928 else:
1929 self.port_no = 0
1930 if slot_num != None:
1931 self.slot_num = slot_num
1932 else:
1933 self.slot_num = 0
1934 if data != None:
1935 self.data = data
1936 else:
1937 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001938 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001939
1940 def pack(self):
1941 packed = []
1942 packed.append(struct.pack("!B", self.version))
1943 packed.append(struct.pack("!B", self.type))
1944 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1945 packed.append(struct.pack("!L", self.xid))
1946 packed.append(struct.pack("!L", self.experimenter))
1947 packed.append(struct.pack("!L", self.subtype))
1948 packed.append(struct.pack("!L", self.timeout_ms))
1949 packed.append(util.pack_port_no(self.port_no))
1950 packed.append(struct.pack("!B", self.slot_num))
1951 packed.append('\x00' * 3)
1952 packed.append(self.data)
1953 length = sum([len(x) for x in packed])
1954 packed[2] = struct.pack("!H", length)
1955 return ''.join(packed)
1956
1957 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001958 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001959 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001960 _version = reader.read("!B")[0]
1961 assert(_version == 2)
1962 _type = reader.read("!B")[0]
1963 assert(_type == 4)
1964 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001965 orig_reader = reader
1966 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001967 obj.xid = reader.read("!L")[0]
1968 _experimenter = reader.read("!L")[0]
1969 assert(_experimenter == 6035143)
1970 _subtype = reader.read("!L")[0]
1971 assert(_subtype == 33)
1972 obj.timeout_ms = reader.read("!L")[0]
1973 obj.port_no = util.unpack_port_no(reader)
1974 obj.slot_num = reader.read("!B")[0]
1975 reader.skip(3)
1976 obj.data = str(reader.read_all())
1977 return obj
1978
1979 def __eq__(self, other):
1980 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001981 if self.xid != other.xid: return False
1982 if self.timeout_ms != other.timeout_ms: return False
1983 if self.port_no != other.port_no: return False
1984 if self.slot_num != other.slot_num: return False
1985 if self.data != other.data: return False
1986 return True
1987
Rich Lane6f4978c2013-10-20 21:33:52 -07001988 def pretty_print(self, q):
1989 q.text("bsn_pdu_rx_request {")
1990 with q.group():
1991 with q.indent(2):
1992 q.breakable()
1993 q.text("xid = ");
1994 if self.xid != None:
1995 q.text("%#x" % self.xid)
1996 else:
1997 q.text('None')
1998 q.text(","); q.breakable()
1999 q.text("timeout_ms = ");
2000 q.text("%#x" % self.timeout_ms)
2001 q.text(","); q.breakable()
2002 q.text("port_no = ");
2003 q.text(util.pretty_port(self.port_no))
2004 q.text(","); q.breakable()
2005 q.text("slot_num = ");
2006 q.text("%#x" % self.slot_num)
2007 q.text(","); q.breakable()
2008 q.text("data = ");
2009 q.pp(self.data)
2010 q.breakable()
2011 q.text('}')
2012
Rich Lane7dcdf022013-12-11 14:45:27 -08002013bsn_header.subtypes[33] = bsn_pdu_rx_request
2014
2015class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002016 version = 2
2017 type = 4
2018 experimenter = 6035143
2019 subtype = 35
2020
2021 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002022 if xid != None:
2023 self.xid = xid
2024 else:
2025 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002026 if port_no != None:
2027 self.port_no = port_no
2028 else:
2029 self.port_no = 0
2030 if slot_num != None:
2031 self.slot_num = slot_num
2032 else:
2033 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002034 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002035
2036 def pack(self):
2037 packed = []
2038 packed.append(struct.pack("!B", self.version))
2039 packed.append(struct.pack("!B", self.type))
2040 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2041 packed.append(struct.pack("!L", self.xid))
2042 packed.append(struct.pack("!L", self.experimenter))
2043 packed.append(struct.pack("!L", self.subtype))
2044 packed.append(util.pack_port_no(self.port_no))
2045 packed.append(struct.pack("!B", self.slot_num))
2046 length = sum([len(x) for x in packed])
2047 packed[2] = struct.pack("!H", length)
2048 return ''.join(packed)
2049
2050 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002051 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002052 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002053 _version = reader.read("!B")[0]
2054 assert(_version == 2)
2055 _type = reader.read("!B")[0]
2056 assert(_type == 4)
2057 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002058 orig_reader = reader
2059 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002060 obj.xid = reader.read("!L")[0]
2061 _experimenter = reader.read("!L")[0]
2062 assert(_experimenter == 6035143)
2063 _subtype = reader.read("!L")[0]
2064 assert(_subtype == 35)
2065 obj.port_no = util.unpack_port_no(reader)
2066 obj.slot_num = reader.read("!B")[0]
2067 return obj
2068
2069 def __eq__(self, other):
2070 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002071 if self.xid != other.xid: return False
2072 if self.port_no != other.port_no: return False
2073 if self.slot_num != other.slot_num: return False
2074 return True
2075
Rich Lane6f4978c2013-10-20 21:33:52 -07002076 def pretty_print(self, q):
2077 q.text("bsn_pdu_rx_timeout {")
2078 with q.group():
2079 with q.indent(2):
2080 q.breakable()
2081 q.text("xid = ");
2082 if self.xid != None:
2083 q.text("%#x" % self.xid)
2084 else:
2085 q.text('None')
2086 q.text(","); q.breakable()
2087 q.text("port_no = ");
2088 q.text(util.pretty_port(self.port_no))
2089 q.text(","); q.breakable()
2090 q.text("slot_num = ");
2091 q.text("%#x" % self.slot_num)
2092 q.breakable()
2093 q.text('}')
2094
Rich Lane7dcdf022013-12-11 14:45:27 -08002095bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2096
2097class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002098 version = 2
2099 type = 4
2100 experimenter = 6035143
2101 subtype = 32
2102
Rich Lane7b0f2012013-11-22 14:15:26 -08002103 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002104 if xid != None:
2105 self.xid = xid
2106 else:
2107 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002108 if status != None:
2109 self.status = status
2110 else:
2111 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002112 if port_no != None:
2113 self.port_no = port_no
2114 else:
2115 self.port_no = 0
2116 if slot_num != None:
2117 self.slot_num = slot_num
2118 else:
2119 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002120 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002121
2122 def pack(self):
2123 packed = []
2124 packed.append(struct.pack("!B", self.version))
2125 packed.append(struct.pack("!B", self.type))
2126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2127 packed.append(struct.pack("!L", self.xid))
2128 packed.append(struct.pack("!L", self.experimenter))
2129 packed.append(struct.pack("!L", self.subtype))
2130 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002131 packed.append(util.pack_port_no(self.port_no))
2132 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002133 length = sum([len(x) for x in packed])
2134 packed[2] = struct.pack("!H", length)
2135 return ''.join(packed)
2136
2137 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002138 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002139 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002140 _version = reader.read("!B")[0]
2141 assert(_version == 2)
2142 _type = reader.read("!B")[0]
2143 assert(_type == 4)
2144 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002145 orig_reader = reader
2146 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002147 obj.xid = reader.read("!L")[0]
2148 _experimenter = reader.read("!L")[0]
2149 assert(_experimenter == 6035143)
2150 _subtype = reader.read("!L")[0]
2151 assert(_subtype == 32)
2152 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002153 obj.port_no = util.unpack_port_no(reader)
2154 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002155 return obj
2156
2157 def __eq__(self, other):
2158 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002159 if self.xid != other.xid: return False
2160 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002161 if self.port_no != other.port_no: return False
2162 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002163 return True
2164
Rich Lane6f4978c2013-10-20 21:33:52 -07002165 def pretty_print(self, q):
2166 q.text("bsn_pdu_tx_reply {")
2167 with q.group():
2168 with q.indent(2):
2169 q.breakable()
2170 q.text("xid = ");
2171 if self.xid != None:
2172 q.text("%#x" % self.xid)
2173 else:
2174 q.text('None')
2175 q.text(","); q.breakable()
2176 q.text("status = ");
2177 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002178 q.text(","); q.breakable()
2179 q.text("port_no = ");
2180 q.text(util.pretty_port(self.port_no))
2181 q.text(","); q.breakable()
2182 q.text("slot_num = ");
2183 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002184 q.breakable()
2185 q.text('}')
2186
Rich Lane7dcdf022013-12-11 14:45:27 -08002187bsn_header.subtypes[32] = bsn_pdu_tx_reply
2188
2189class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002190 version = 2
2191 type = 4
2192 experimenter = 6035143
2193 subtype = 31
2194
2195 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002196 if xid != None:
2197 self.xid = xid
2198 else:
2199 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002200 if tx_interval_ms != None:
2201 self.tx_interval_ms = tx_interval_ms
2202 else:
2203 self.tx_interval_ms = 0
2204 if port_no != None:
2205 self.port_no = port_no
2206 else:
2207 self.port_no = 0
2208 if slot_num != None:
2209 self.slot_num = slot_num
2210 else:
2211 self.slot_num = 0
2212 if data != None:
2213 self.data = data
2214 else:
2215 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002216 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002217
2218 def pack(self):
2219 packed = []
2220 packed.append(struct.pack("!B", self.version))
2221 packed.append(struct.pack("!B", self.type))
2222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2223 packed.append(struct.pack("!L", self.xid))
2224 packed.append(struct.pack("!L", self.experimenter))
2225 packed.append(struct.pack("!L", self.subtype))
2226 packed.append(struct.pack("!L", self.tx_interval_ms))
2227 packed.append(util.pack_port_no(self.port_no))
2228 packed.append(struct.pack("!B", self.slot_num))
2229 packed.append('\x00' * 3)
2230 packed.append(self.data)
2231 length = sum([len(x) for x in packed])
2232 packed[2] = struct.pack("!H", length)
2233 return ''.join(packed)
2234
2235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002236 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002237 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002238 _version = reader.read("!B")[0]
2239 assert(_version == 2)
2240 _type = reader.read("!B")[0]
2241 assert(_type == 4)
2242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002243 orig_reader = reader
2244 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002245 obj.xid = reader.read("!L")[0]
2246 _experimenter = reader.read("!L")[0]
2247 assert(_experimenter == 6035143)
2248 _subtype = reader.read("!L")[0]
2249 assert(_subtype == 31)
2250 obj.tx_interval_ms = reader.read("!L")[0]
2251 obj.port_no = util.unpack_port_no(reader)
2252 obj.slot_num = reader.read("!B")[0]
2253 reader.skip(3)
2254 obj.data = str(reader.read_all())
2255 return obj
2256
2257 def __eq__(self, other):
2258 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002259 if self.xid != other.xid: return False
2260 if self.tx_interval_ms != other.tx_interval_ms: return False
2261 if self.port_no != other.port_no: return False
2262 if self.slot_num != other.slot_num: return False
2263 if self.data != other.data: return False
2264 return True
2265
Rich Lane6f4978c2013-10-20 21:33:52 -07002266 def pretty_print(self, q):
2267 q.text("bsn_pdu_tx_request {")
2268 with q.group():
2269 with q.indent(2):
2270 q.breakable()
2271 q.text("xid = ");
2272 if self.xid != None:
2273 q.text("%#x" % self.xid)
2274 else:
2275 q.text('None')
2276 q.text(","); q.breakable()
2277 q.text("tx_interval_ms = ");
2278 q.text("%#x" % self.tx_interval_ms)
2279 q.text(","); q.breakable()
2280 q.text("port_no = ");
2281 q.text(util.pretty_port(self.port_no))
2282 q.text(","); q.breakable()
2283 q.text("slot_num = ");
2284 q.text("%#x" % self.slot_num)
2285 q.text(","); q.breakable()
2286 q.text("data = ");
2287 q.pp(self.data)
2288 q.breakable()
2289 q.text('}')
2290
Rich Lane7dcdf022013-12-11 14:45:27 -08002291bsn_header.subtypes[31] = bsn_pdu_tx_request
2292
2293class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002294 version = 2
2295 type = 4
2296 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002297 subtype = 3
2298
2299 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002300 if xid != None:
2301 self.xid = xid
2302 else:
2303 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002304 if report_mirror_ports != None:
2305 self.report_mirror_ports = report_mirror_ports
2306 else:
2307 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002308 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002309
2310 def pack(self):
2311 packed = []
2312 packed.append(struct.pack("!B", self.version))
2313 packed.append(struct.pack("!B", self.type))
2314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2315 packed.append(struct.pack("!L", self.xid))
2316 packed.append(struct.pack("!L", self.experimenter))
2317 packed.append(struct.pack("!L", self.subtype))
2318 packed.append(struct.pack("!B", self.report_mirror_ports))
2319 packed.append('\x00' * 3)
2320 length = sum([len(x) for x in packed])
2321 packed[2] = struct.pack("!H", length)
2322 return ''.join(packed)
2323
2324 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002325 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002326 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002327 _version = reader.read("!B")[0]
2328 assert(_version == 2)
2329 _type = reader.read("!B")[0]
2330 assert(_type == 4)
2331 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002332 orig_reader = reader
2333 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002334 obj.xid = reader.read("!L")[0]
2335 _experimenter = reader.read("!L")[0]
2336 assert(_experimenter == 6035143)
2337 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002338 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002339 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002340 reader.skip(3)
2341 return obj
2342
2343 def __eq__(self, other):
2344 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002345 if self.xid != other.xid: return False
2346 if self.report_mirror_ports != other.report_mirror_ports: return False
2347 return True
2348
Rich Lanec2ee4b82013-04-24 17:12:38 -07002349 def pretty_print(self, q):
2350 q.text("bsn_set_mirroring {")
2351 with q.group():
2352 with q.indent(2):
2353 q.breakable()
2354 q.text("xid = ");
2355 if self.xid != None:
2356 q.text("%#x" % self.xid)
2357 else:
2358 q.text('None')
2359 q.text(","); q.breakable()
2360 q.text("report_mirror_ports = ");
2361 q.text("%#x" % self.report_mirror_ports)
2362 q.breakable()
2363 q.text('}')
2364
Rich Lane7dcdf022013-12-11 14:45:27 -08002365bsn_header.subtypes[3] = bsn_set_mirroring
2366
2367class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002368 version = 2
2369 type = 4
2370 experimenter = 6035143
2371 subtype = 25
2372
2373 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002374 if xid != None:
2375 self.xid = xid
2376 else:
2377 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002378 if status != None:
2379 self.status = status
2380 else:
2381 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002382 return
Dan Talaycof6202252013-07-02 01:00:29 -07002383
2384 def pack(self):
2385 packed = []
2386 packed.append(struct.pack("!B", self.version))
2387 packed.append(struct.pack("!B", self.type))
2388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2389 packed.append(struct.pack("!L", self.xid))
2390 packed.append(struct.pack("!L", self.experimenter))
2391 packed.append(struct.pack("!L", self.subtype))
2392 packed.append(struct.pack("!L", self.status))
2393 length = sum([len(x) for x in packed])
2394 packed[2] = struct.pack("!H", length)
2395 return ''.join(packed)
2396
2397 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002398 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002399 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002400 _version = reader.read("!B")[0]
2401 assert(_version == 2)
2402 _type = reader.read("!B")[0]
2403 assert(_type == 4)
2404 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002405 orig_reader = reader
2406 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002407 obj.xid = reader.read("!L")[0]
2408 _experimenter = reader.read("!L")[0]
2409 assert(_experimenter == 6035143)
2410 _subtype = reader.read("!L")[0]
2411 assert(_subtype == 25)
2412 obj.status = reader.read("!L")[0]
2413 return obj
2414
2415 def __eq__(self, other):
2416 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002417 if self.xid != other.xid: return False
2418 if self.status != other.status: return False
2419 return True
2420
Dan Talaycof6202252013-07-02 01:00:29 -07002421 def pretty_print(self, q):
2422 q.text("bsn_set_pktin_suppression_reply {")
2423 with q.group():
2424 with q.indent(2):
2425 q.breakable()
2426 q.text("xid = ");
2427 if self.xid != None:
2428 q.text("%#x" % self.xid)
2429 else:
2430 q.text('None')
2431 q.text(","); q.breakable()
2432 q.text("status = ");
2433 q.text("%#x" % self.status)
2434 q.breakable()
2435 q.text('}')
2436
Rich Lane7dcdf022013-12-11 14:45:27 -08002437bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2438
2439class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002440 version = 2
2441 type = 4
2442 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002443 subtype = 11
2444
2445 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002446 if xid != None:
2447 self.xid = xid
2448 else:
2449 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002450 if enabled != None:
2451 self.enabled = enabled
2452 else:
2453 self.enabled = 0
2454 if idle_timeout != None:
2455 self.idle_timeout = idle_timeout
2456 else:
2457 self.idle_timeout = 0
2458 if hard_timeout != None:
2459 self.hard_timeout = hard_timeout
2460 else:
2461 self.hard_timeout = 0
2462 if priority != None:
2463 self.priority = priority
2464 else:
2465 self.priority = 0
2466 if cookie != None:
2467 self.cookie = cookie
2468 else:
2469 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002470 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002471
2472 def pack(self):
2473 packed = []
2474 packed.append(struct.pack("!B", self.version))
2475 packed.append(struct.pack("!B", self.type))
2476 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2477 packed.append(struct.pack("!L", self.xid))
2478 packed.append(struct.pack("!L", self.experimenter))
2479 packed.append(struct.pack("!L", self.subtype))
2480 packed.append(struct.pack("!B", self.enabled))
2481 packed.append('\x00' * 1)
2482 packed.append(struct.pack("!H", self.idle_timeout))
2483 packed.append(struct.pack("!H", self.hard_timeout))
2484 packed.append(struct.pack("!H", self.priority))
2485 packed.append(struct.pack("!Q", self.cookie))
2486 length = sum([len(x) for x in packed])
2487 packed[2] = struct.pack("!H", length)
2488 return ''.join(packed)
2489
2490 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002491 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002492 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002493 _version = reader.read("!B")[0]
2494 assert(_version == 2)
2495 _type = reader.read("!B")[0]
2496 assert(_type == 4)
2497 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002498 orig_reader = reader
2499 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002500 obj.xid = reader.read("!L")[0]
2501 _experimenter = reader.read("!L")[0]
2502 assert(_experimenter == 6035143)
2503 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002504 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07002505 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002506 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002507 obj.idle_timeout = reader.read("!H")[0]
2508 obj.hard_timeout = reader.read("!H")[0]
2509 obj.priority = reader.read("!H")[0]
2510 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002511 return obj
2512
2513 def __eq__(self, other):
2514 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002515 if self.xid != other.xid: return False
2516 if self.enabled != other.enabled: return False
2517 if self.idle_timeout != other.idle_timeout: return False
2518 if self.hard_timeout != other.hard_timeout: return False
2519 if self.priority != other.priority: return False
2520 if self.cookie != other.cookie: return False
2521 return True
2522
Rich Lanec2ee4b82013-04-24 17:12:38 -07002523 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002524 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07002525 with q.group():
2526 with q.indent(2):
2527 q.breakable()
2528 q.text("xid = ");
2529 if self.xid != None:
2530 q.text("%#x" % self.xid)
2531 else:
2532 q.text('None')
2533 q.text(","); q.breakable()
2534 q.text("enabled = ");
2535 q.text("%#x" % self.enabled)
2536 q.text(","); q.breakable()
2537 q.text("idle_timeout = ");
2538 q.text("%#x" % self.idle_timeout)
2539 q.text(","); q.breakable()
2540 q.text("hard_timeout = ");
2541 q.text("%#x" % self.hard_timeout)
2542 q.text(","); q.breakable()
2543 q.text("priority = ");
2544 q.text("%#x" % self.priority)
2545 q.text(","); q.breakable()
2546 q.text("cookie = ");
2547 q.text("%#x" % self.cookie)
2548 q.breakable()
2549 q.text('}')
2550
Rich Lane7dcdf022013-12-11 14:45:27 -08002551bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
2552
2553class experimenter_stats_reply(stats_reply):
2554 subtypes = {}
2555
Rich Lane95f7fc92014-01-27 17:08:16 -08002556 version = 2
2557 type = 19
2558 stats_type = 65535
2559
2560 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
2561 if xid != None:
2562 self.xid = xid
2563 else:
2564 self.xid = None
2565 if flags != None:
2566 self.flags = flags
2567 else:
2568 self.flags = 0
2569 if experimenter != None:
2570 self.experimenter = experimenter
2571 else:
2572 self.experimenter = 0
2573 if data != None:
2574 self.data = data
2575 else:
2576 self.data = ''
2577 return
2578
2579 def pack(self):
2580 packed = []
2581 packed.append(struct.pack("!B", self.version))
2582 packed.append(struct.pack("!B", self.type))
2583 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2584 packed.append(struct.pack("!L", self.xid))
2585 packed.append(struct.pack("!H", self.stats_type))
2586 packed.append(struct.pack("!H", self.flags))
2587 packed.append('\x00' * 4)
2588 packed.append(struct.pack("!L", self.experimenter))
2589 packed.append('\x00' * 4)
2590 packed.append(self.data)
2591 length = sum([len(x) for x in packed])
2592 packed[2] = struct.pack("!H", length)
2593 return ''.join(packed)
2594
Rich Lane7dcdf022013-12-11 14:45:27 -08002595 @staticmethod
2596 def unpack(reader):
2597 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002598 subclass = experimenter_stats_reply.subtypes.get(subtype)
2599 if subclass:
2600 return subclass.unpack(reader)
2601
2602 obj = experimenter_stats_reply()
2603 _version = reader.read("!B")[0]
2604 assert(_version == 2)
2605 _type = reader.read("!B")[0]
2606 assert(_type == 19)
2607 _length = reader.read("!H")[0]
2608 orig_reader = reader
2609 reader = orig_reader.slice(_length - (2 + 2))
2610 obj.xid = reader.read("!L")[0]
2611 _stats_type = reader.read("!H")[0]
2612 assert(_stats_type == 65535)
2613 obj.flags = reader.read("!H")[0]
2614 reader.skip(4)
2615 obj.experimenter = reader.read("!L")[0]
2616 reader.skip(4)
2617 obj.data = str(reader.read_all())
2618 return obj
2619
2620 def __eq__(self, other):
2621 if type(self) != type(other): return False
2622 if self.xid != other.xid: return False
2623 if self.flags != other.flags: return False
2624 if self.experimenter != other.experimenter: return False
2625 if self.data != other.data: return False
2626 return True
2627
2628 def pretty_print(self, q):
2629 q.text("experimenter_stats_reply {")
2630 with q.group():
2631 with q.indent(2):
2632 q.breakable()
2633 q.text("xid = ");
2634 if self.xid != None:
2635 q.text("%#x" % self.xid)
2636 else:
2637 q.text('None')
2638 q.text(","); q.breakable()
2639 q.text("flags = ");
2640 q.text("%#x" % self.flags)
2641 q.text(","); q.breakable()
2642 q.text("data = ");
2643 q.pp(self.data)
2644 q.breakable()
2645 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002646
2647stats_reply.subtypes[65535] = experimenter_stats_reply
2648
2649class bsn_stats_reply(experimenter_stats_reply):
2650 subtypes = {}
2651
Rich Lane95f7fc92014-01-27 17:08:16 -08002652 version = 2
2653 type = 19
2654 stats_type = 65535
2655 experimenter = 6035143
2656
2657 def __init__(self, xid=None, flags=None, subtype=None):
2658 if xid != None:
2659 self.xid = xid
2660 else:
2661 self.xid = None
2662 if flags != None:
2663 self.flags = flags
2664 else:
2665 self.flags = 0
2666 if subtype != None:
2667 self.subtype = subtype
2668 else:
2669 self.subtype = 0
2670 return
2671
2672 def pack(self):
2673 packed = []
2674 packed.append(struct.pack("!B", self.version))
2675 packed.append(struct.pack("!B", self.type))
2676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2677 packed.append(struct.pack("!L", self.xid))
2678 packed.append(struct.pack("!H", self.stats_type))
2679 packed.append(struct.pack("!H", self.flags))
2680 packed.append('\x00' * 4)
2681 packed.append(struct.pack("!L", self.experimenter))
2682 packed.append(struct.pack("!L", self.subtype))
2683 length = sum([len(x) for x in packed])
2684 packed[2] = struct.pack("!H", length)
2685 return ''.join(packed)
2686
Rich Lane7dcdf022013-12-11 14:45:27 -08002687 @staticmethod
2688 def unpack(reader):
2689 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002690 subclass = bsn_stats_reply.subtypes.get(subtype)
2691 if subclass:
2692 return subclass.unpack(reader)
2693
2694 obj = bsn_stats_reply()
2695 _version = reader.read("!B")[0]
2696 assert(_version == 2)
2697 _type = reader.read("!B")[0]
2698 assert(_type == 19)
2699 _length = reader.read("!H")[0]
2700 orig_reader = reader
2701 reader = orig_reader.slice(_length - (2 + 2))
2702 obj.xid = reader.read("!L")[0]
2703 _stats_type = reader.read("!H")[0]
2704 assert(_stats_type == 65535)
2705 obj.flags = reader.read("!H")[0]
2706 reader.skip(4)
2707 _experimenter = reader.read("!L")[0]
2708 assert(_experimenter == 6035143)
2709 obj.subtype = reader.read("!L")[0]
2710 return obj
2711
2712 def __eq__(self, other):
2713 if type(self) != type(other): return False
2714 if self.xid != other.xid: return False
2715 if self.flags != other.flags: return False
2716 if self.subtype != other.subtype: return False
2717 return True
2718
2719 def pretty_print(self, q):
2720 q.text("bsn_stats_reply {")
2721 with q.group():
2722 with q.indent(2):
2723 q.breakable()
2724 q.text("xid = ");
2725 if self.xid != None:
2726 q.text("%#x" % self.xid)
2727 else:
2728 q.text('None')
2729 q.text(","); q.breakable()
2730 q.text("flags = ");
2731 q.text("%#x" % self.flags)
2732 q.breakable()
2733 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002734
2735experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2736
2737class experimenter_stats_request(stats_request):
2738 subtypes = {}
2739
Rich Lane95f7fc92014-01-27 17:08:16 -08002740 version = 2
2741 type = 18
2742 stats_type = 65535
2743
2744 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
2745 if xid != None:
2746 self.xid = xid
2747 else:
2748 self.xid = None
2749 if flags != None:
2750 self.flags = flags
2751 else:
2752 self.flags = 0
2753 if experimenter != None:
2754 self.experimenter = experimenter
2755 else:
2756 self.experimenter = 0
2757 if data != None:
2758 self.data = data
2759 else:
2760 self.data = ''
2761 return
2762
2763 def pack(self):
2764 packed = []
2765 packed.append(struct.pack("!B", self.version))
2766 packed.append(struct.pack("!B", self.type))
2767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2768 packed.append(struct.pack("!L", self.xid))
2769 packed.append(struct.pack("!H", self.stats_type))
2770 packed.append(struct.pack("!H", self.flags))
2771 packed.append('\x00' * 4)
2772 packed.append(struct.pack("!L", self.experimenter))
2773 packed.append('\x00' * 4)
2774 packed.append(self.data)
2775 length = sum([len(x) for x in packed])
2776 packed[2] = struct.pack("!H", length)
2777 return ''.join(packed)
2778
Rich Lane7dcdf022013-12-11 14:45:27 -08002779 @staticmethod
2780 def unpack(reader):
2781 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002782 subclass = experimenter_stats_request.subtypes.get(subtype)
2783 if subclass:
2784 return subclass.unpack(reader)
2785
2786 obj = experimenter_stats_request()
2787 _version = reader.read("!B")[0]
2788 assert(_version == 2)
2789 _type = reader.read("!B")[0]
2790 assert(_type == 18)
2791 _length = reader.read("!H")[0]
2792 orig_reader = reader
2793 reader = orig_reader.slice(_length - (2 + 2))
2794 obj.xid = reader.read("!L")[0]
2795 _stats_type = reader.read("!H")[0]
2796 assert(_stats_type == 65535)
2797 obj.flags = reader.read("!H")[0]
2798 reader.skip(4)
2799 obj.experimenter = reader.read("!L")[0]
2800 reader.skip(4)
2801 obj.data = str(reader.read_all())
2802 return obj
2803
2804 def __eq__(self, other):
2805 if type(self) != type(other): return False
2806 if self.xid != other.xid: return False
2807 if self.flags != other.flags: return False
2808 if self.experimenter != other.experimenter: return False
2809 if self.data != other.data: return False
2810 return True
2811
2812 def pretty_print(self, q):
2813 q.text("experimenter_stats_request {")
2814 with q.group():
2815 with q.indent(2):
2816 q.breakable()
2817 q.text("xid = ");
2818 if self.xid != None:
2819 q.text("%#x" % self.xid)
2820 else:
2821 q.text('None')
2822 q.text(","); q.breakable()
2823 q.text("flags = ");
2824 q.text("%#x" % self.flags)
2825 q.text(","); q.breakable()
2826 q.text("data = ");
2827 q.pp(self.data)
2828 q.breakable()
2829 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002830
2831stats_request.subtypes[65535] = experimenter_stats_request
2832
2833class bsn_stats_request(experimenter_stats_request):
2834 subtypes = {}
2835
Rich Lane95f7fc92014-01-27 17:08:16 -08002836 version = 2
2837 type = 18
2838 stats_type = 65535
2839 experimenter = 6035143
2840
2841 def __init__(self, xid=None, flags=None, subtype=None):
2842 if xid != None:
2843 self.xid = xid
2844 else:
2845 self.xid = None
2846 if flags != None:
2847 self.flags = flags
2848 else:
2849 self.flags = 0
2850 if subtype != None:
2851 self.subtype = subtype
2852 else:
2853 self.subtype = 0
2854 return
2855
2856 def pack(self):
2857 packed = []
2858 packed.append(struct.pack("!B", self.version))
2859 packed.append(struct.pack("!B", self.type))
2860 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2861 packed.append(struct.pack("!L", self.xid))
2862 packed.append(struct.pack("!H", self.stats_type))
2863 packed.append(struct.pack("!H", self.flags))
2864 packed.append('\x00' * 4)
2865 packed.append(struct.pack("!L", self.experimenter))
2866 packed.append(struct.pack("!L", self.subtype))
2867 length = sum([len(x) for x in packed])
2868 packed[2] = struct.pack("!H", length)
2869 return ''.join(packed)
2870
Rich Lane7dcdf022013-12-11 14:45:27 -08002871 @staticmethod
2872 def unpack(reader):
2873 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002874 subclass = bsn_stats_request.subtypes.get(subtype)
2875 if subclass:
2876 return subclass.unpack(reader)
2877
2878 obj = bsn_stats_request()
2879 _version = reader.read("!B")[0]
2880 assert(_version == 2)
2881 _type = reader.read("!B")[0]
2882 assert(_type == 18)
2883 _length = reader.read("!H")[0]
2884 orig_reader = reader
2885 reader = orig_reader.slice(_length - (2 + 2))
2886 obj.xid = reader.read("!L")[0]
2887 _stats_type = reader.read("!H")[0]
2888 assert(_stats_type == 65535)
2889 obj.flags = reader.read("!H")[0]
2890 reader.skip(4)
2891 _experimenter = reader.read("!L")[0]
2892 assert(_experimenter == 6035143)
2893 obj.subtype = reader.read("!L")[0]
2894 return obj
2895
2896 def __eq__(self, other):
2897 if type(self) != type(other): return False
2898 if self.xid != other.xid: return False
2899 if self.flags != other.flags: return False
2900 if self.subtype != other.subtype: return False
2901 return True
2902
2903 def pretty_print(self, q):
2904 q.text("bsn_stats_request {")
2905 with q.group():
2906 with q.indent(2):
2907 q.breakable()
2908 q.text("xid = ");
2909 if self.xid != None:
2910 q.text("%#x" % self.xid)
2911 else:
2912 q.text('None')
2913 q.text(","); q.breakable()
2914 q.text("flags = ");
2915 q.text("%#x" % self.flags)
2916 q.breakable()
2917 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002918
2919experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2920
2921class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002922 version = 2
2923 type = 4
2924 experimenter = 6035143
2925 subtype = 16
2926
2927 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002928 if xid != None:
2929 self.xid = xid
2930 else:
2931 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002932 if status != None:
2933 self.status = status
2934 else:
2935 self.status = 0
2936 if vport_no != None:
2937 self.vport_no = vport_no
2938 else:
2939 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002940 return
Dan Talaycof6202252013-07-02 01:00:29 -07002941
2942 def pack(self):
2943 packed = []
2944 packed.append(struct.pack("!B", self.version))
2945 packed.append(struct.pack("!B", self.type))
2946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2947 packed.append(struct.pack("!L", self.xid))
2948 packed.append(struct.pack("!L", self.experimenter))
2949 packed.append(struct.pack("!L", self.subtype))
2950 packed.append(struct.pack("!L", self.status))
2951 packed.append(struct.pack("!L", self.vport_no))
2952 length = sum([len(x) for x in packed])
2953 packed[2] = struct.pack("!H", length)
2954 return ''.join(packed)
2955
2956 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002957 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002958 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002959 _version = reader.read("!B")[0]
2960 assert(_version == 2)
2961 _type = reader.read("!B")[0]
2962 assert(_type == 4)
2963 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002964 orig_reader = reader
2965 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002966 obj.xid = reader.read("!L")[0]
2967 _experimenter = reader.read("!L")[0]
2968 assert(_experimenter == 6035143)
2969 _subtype = reader.read("!L")[0]
2970 assert(_subtype == 16)
2971 obj.status = reader.read("!L")[0]
2972 obj.vport_no = reader.read("!L")[0]
2973 return obj
2974
2975 def __eq__(self, other):
2976 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002977 if self.xid != other.xid: return False
2978 if self.status != other.status: return False
2979 if self.vport_no != other.vport_no: return False
2980 return True
2981
Dan Talaycof6202252013-07-02 01:00:29 -07002982 def pretty_print(self, q):
2983 q.text("bsn_virtual_port_create_reply {")
2984 with q.group():
2985 with q.indent(2):
2986 q.breakable()
2987 q.text("xid = ");
2988 if self.xid != None:
2989 q.text("%#x" % self.xid)
2990 else:
2991 q.text('None')
2992 q.text(","); q.breakable()
2993 q.text("status = ");
2994 q.text("%#x" % self.status)
2995 q.text(","); q.breakable()
2996 q.text("vport_no = ");
2997 q.text("%#x" % self.vport_no)
2998 q.breakable()
2999 q.text('}')
3000
Rich Lane7dcdf022013-12-11 14:45:27 -08003001bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3002
3003class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003004 version = 2
3005 type = 4
3006 experimenter = 6035143
3007 subtype = 15
3008
3009 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003010 if xid != None:
3011 self.xid = xid
3012 else:
3013 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003014 if vport != None:
3015 self.vport = vport
3016 else:
Rich Lane93b33132014-04-21 12:20:58 -07003017 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003018 return
Dan Talaycof6202252013-07-02 01:00:29 -07003019
3020 def pack(self):
3021 packed = []
3022 packed.append(struct.pack("!B", self.version))
3023 packed.append(struct.pack("!B", self.type))
3024 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3025 packed.append(struct.pack("!L", self.xid))
3026 packed.append(struct.pack("!L", self.experimenter))
3027 packed.append(struct.pack("!L", self.subtype))
3028 packed.append(self.vport.pack())
3029 length = sum([len(x) for x in packed])
3030 packed[2] = struct.pack("!H", length)
3031 return ''.join(packed)
3032
3033 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003034 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003035 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003036 _version = reader.read("!B")[0]
3037 assert(_version == 2)
3038 _type = reader.read("!B")[0]
3039 assert(_type == 4)
3040 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003041 orig_reader = reader
3042 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003043 obj.xid = reader.read("!L")[0]
3044 _experimenter = reader.read("!L")[0]
3045 assert(_experimenter == 6035143)
3046 _subtype = reader.read("!L")[0]
3047 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07003048 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003049 return obj
3050
3051 def __eq__(self, other):
3052 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003053 if self.xid != other.xid: return False
3054 if self.vport != other.vport: return False
3055 return True
3056
Dan Talaycof6202252013-07-02 01:00:29 -07003057 def pretty_print(self, q):
3058 q.text("bsn_virtual_port_create_request {")
3059 with q.group():
3060 with q.indent(2):
3061 q.breakable()
3062 q.text("xid = ");
3063 if self.xid != None:
3064 q.text("%#x" % self.xid)
3065 else:
3066 q.text('None')
3067 q.text(","); q.breakable()
3068 q.text("vport = ");
3069 q.pp(self.vport)
3070 q.breakable()
3071 q.text('}')
3072
Rich Lane7dcdf022013-12-11 14:45:27 -08003073bsn_header.subtypes[15] = bsn_virtual_port_create_request
3074
3075class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003076 version = 2
3077 type = 4
3078 experimenter = 6035143
3079 subtype = 26
3080
3081 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003082 if xid != None:
3083 self.xid = xid
3084 else:
3085 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003086 if status != None:
3087 self.status = status
3088 else:
3089 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003090 return
Dan Talaycof6202252013-07-02 01:00:29 -07003091
3092 def pack(self):
3093 packed = []
3094 packed.append(struct.pack("!B", self.version))
3095 packed.append(struct.pack("!B", self.type))
3096 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3097 packed.append(struct.pack("!L", self.xid))
3098 packed.append(struct.pack("!L", self.experimenter))
3099 packed.append(struct.pack("!L", self.subtype))
3100 packed.append(struct.pack("!L", self.status))
3101 length = sum([len(x) for x in packed])
3102 packed[2] = struct.pack("!H", length)
3103 return ''.join(packed)
3104
3105 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003106 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003107 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003108 _version = reader.read("!B")[0]
3109 assert(_version == 2)
3110 _type = reader.read("!B")[0]
3111 assert(_type == 4)
3112 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003113 orig_reader = reader
3114 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003115 obj.xid = reader.read("!L")[0]
3116 _experimenter = reader.read("!L")[0]
3117 assert(_experimenter == 6035143)
3118 _subtype = reader.read("!L")[0]
3119 assert(_subtype == 26)
3120 obj.status = reader.read("!L")[0]
3121 return obj
3122
3123 def __eq__(self, other):
3124 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003125 if self.xid != other.xid: return False
3126 if self.status != other.status: return False
3127 return True
3128
Dan Talaycof6202252013-07-02 01:00:29 -07003129 def pretty_print(self, q):
3130 q.text("bsn_virtual_port_remove_reply {")
3131 with q.group():
3132 with q.indent(2):
3133 q.breakable()
3134 q.text("xid = ");
3135 if self.xid != None:
3136 q.text("%#x" % self.xid)
3137 else:
3138 q.text('None')
3139 q.text(","); q.breakable()
3140 q.text("status = ");
3141 q.text("%#x" % self.status)
3142 q.breakable()
3143 q.text('}')
3144
Rich Lane7dcdf022013-12-11 14:45:27 -08003145bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3146
3147class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003148 version = 2
3149 type = 4
3150 experimenter = 6035143
3151 subtype = 17
3152
3153 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003154 if xid != None:
3155 self.xid = xid
3156 else:
3157 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003158 if vport_no != None:
3159 self.vport_no = vport_no
3160 else:
3161 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003162 return
Dan Talaycof6202252013-07-02 01:00:29 -07003163
3164 def pack(self):
3165 packed = []
3166 packed.append(struct.pack("!B", self.version))
3167 packed.append(struct.pack("!B", self.type))
3168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3169 packed.append(struct.pack("!L", self.xid))
3170 packed.append(struct.pack("!L", self.experimenter))
3171 packed.append(struct.pack("!L", self.subtype))
3172 packed.append(struct.pack("!L", self.vport_no))
3173 length = sum([len(x) for x in packed])
3174 packed[2] = struct.pack("!H", length)
3175 return ''.join(packed)
3176
3177 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003178 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003179 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003180 _version = reader.read("!B")[0]
3181 assert(_version == 2)
3182 _type = reader.read("!B")[0]
3183 assert(_type == 4)
3184 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003185 orig_reader = reader
3186 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003187 obj.xid = reader.read("!L")[0]
3188 _experimenter = reader.read("!L")[0]
3189 assert(_experimenter == 6035143)
3190 _subtype = reader.read("!L")[0]
3191 assert(_subtype == 17)
3192 obj.vport_no = reader.read("!L")[0]
3193 return obj
3194
3195 def __eq__(self, other):
3196 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003197 if self.xid != other.xid: return False
3198 if self.vport_no != other.vport_no: return False
3199 return True
3200
Dan Talaycof6202252013-07-02 01:00:29 -07003201 def pretty_print(self, q):
3202 q.text("bsn_virtual_port_remove_request {")
3203 with q.group():
3204 with q.indent(2):
3205 q.breakable()
3206 q.text("xid = ");
3207 if self.xid != None:
3208 q.text("%#x" % self.xid)
3209 else:
3210 q.text('None')
3211 q.text(","); q.breakable()
3212 q.text("vport_no = ");
3213 q.text("%#x" % self.vport_no)
3214 q.breakable()
3215 q.text('}')
3216
Rich Lane7dcdf022013-12-11 14:45:27 -08003217bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3218
3219class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003220 version = 2
3221 type = 19
3222 stats_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003223
3224 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003225 if xid != None:
3226 self.xid = xid
3227 else:
3228 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003229 if flags != None:
3230 self.flags = flags
3231 else:
3232 self.flags = 0
3233 if mfr_desc != None:
3234 self.mfr_desc = mfr_desc
3235 else:
3236 self.mfr_desc = ""
3237 if hw_desc != None:
3238 self.hw_desc = hw_desc
3239 else:
3240 self.hw_desc = ""
3241 if sw_desc != None:
3242 self.sw_desc = sw_desc
3243 else:
3244 self.sw_desc = ""
3245 if serial_num != None:
3246 self.serial_num = serial_num
3247 else:
3248 self.serial_num = ""
3249 if dp_desc != None:
3250 self.dp_desc = dp_desc
3251 else:
3252 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08003253 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003254
3255 def pack(self):
3256 packed = []
3257 packed.append(struct.pack("!B", self.version))
3258 packed.append(struct.pack("!B", self.type))
3259 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3260 packed.append(struct.pack("!L", self.xid))
3261 packed.append(struct.pack("!H", self.stats_type))
3262 packed.append(struct.pack("!H", self.flags))
3263 packed.append('\x00' * 4)
3264 packed.append(struct.pack("!256s", self.mfr_desc))
3265 packed.append(struct.pack("!256s", self.hw_desc))
3266 packed.append(struct.pack("!256s", self.sw_desc))
3267 packed.append(struct.pack("!32s", self.serial_num))
3268 packed.append(struct.pack("!256s", self.dp_desc))
3269 length = sum([len(x) for x in packed])
3270 packed[2] = struct.pack("!H", length)
3271 return ''.join(packed)
3272
3273 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003274 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003275 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003276 _version = reader.read("!B")[0]
3277 assert(_version == 2)
3278 _type = reader.read("!B")[0]
3279 assert(_type == 19)
3280 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003281 orig_reader = reader
3282 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003283 obj.xid = reader.read("!L")[0]
3284 _stats_type = reader.read("!H")[0]
3285 assert(_stats_type == 0)
3286 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003287 reader.skip(4)
3288 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
3289 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
3290 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
3291 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
3292 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
3293 return obj
3294
3295 def __eq__(self, other):
3296 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003297 if self.xid != other.xid: return False
3298 if self.flags != other.flags: return False
3299 if self.mfr_desc != other.mfr_desc: return False
3300 if self.hw_desc != other.hw_desc: return False
3301 if self.sw_desc != other.sw_desc: return False
3302 if self.serial_num != other.serial_num: return False
3303 if self.dp_desc != other.dp_desc: return False
3304 return True
3305
Rich Lanec2ee4b82013-04-24 17:12:38 -07003306 def pretty_print(self, q):
3307 q.text("desc_stats_reply {")
3308 with q.group():
3309 with q.indent(2):
3310 q.breakable()
3311 q.text("xid = ");
3312 if self.xid != None:
3313 q.text("%#x" % self.xid)
3314 else:
3315 q.text('None')
3316 q.text(","); q.breakable()
3317 q.text("flags = ");
3318 q.text("%#x" % self.flags)
3319 q.text(","); q.breakable()
3320 q.text("mfr_desc = ");
3321 q.pp(self.mfr_desc)
3322 q.text(","); q.breakable()
3323 q.text("hw_desc = ");
3324 q.pp(self.hw_desc)
3325 q.text(","); q.breakable()
3326 q.text("sw_desc = ");
3327 q.pp(self.sw_desc)
3328 q.text(","); q.breakable()
3329 q.text("serial_num = ");
3330 q.pp(self.serial_num)
3331 q.text(","); q.breakable()
3332 q.text("dp_desc = ");
3333 q.pp(self.dp_desc)
3334 q.breakable()
3335 q.text('}')
3336
Rich Lane7dcdf022013-12-11 14:45:27 -08003337stats_reply.subtypes[0] = desc_stats_reply
3338
3339class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07003340 version = 2
3341 type = 18
3342 stats_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003343
3344 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003345 if xid != None:
3346 self.xid = xid
3347 else:
3348 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003349 if flags != None:
3350 self.flags = flags
3351 else:
3352 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003353 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003354
3355 def pack(self):
3356 packed = []
3357 packed.append(struct.pack("!B", self.version))
3358 packed.append(struct.pack("!B", self.type))
3359 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3360 packed.append(struct.pack("!L", self.xid))
3361 packed.append(struct.pack("!H", self.stats_type))
3362 packed.append(struct.pack("!H", self.flags))
3363 packed.append('\x00' * 4)
3364 length = sum([len(x) for x in packed])
3365 packed[2] = struct.pack("!H", length)
3366 return ''.join(packed)
3367
3368 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003369 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003370 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003371 _version = reader.read("!B")[0]
3372 assert(_version == 2)
3373 _type = reader.read("!B")[0]
3374 assert(_type == 18)
3375 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003376 orig_reader = reader
3377 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003378 obj.xid = reader.read("!L")[0]
3379 _stats_type = reader.read("!H")[0]
3380 assert(_stats_type == 0)
3381 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003382 reader.skip(4)
3383 return obj
3384
3385 def __eq__(self, other):
3386 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003387 if self.xid != other.xid: return False
3388 if self.flags != other.flags: return False
3389 return True
3390
Rich Lanec2ee4b82013-04-24 17:12:38 -07003391 def pretty_print(self, q):
3392 q.text("desc_stats_request {")
3393 with q.group():
3394 with q.indent(2):
3395 q.breakable()
3396 q.text("xid = ");
3397 if self.xid != None:
3398 q.text("%#x" % self.xid)
3399 else:
3400 q.text('None')
3401 q.text(","); q.breakable()
3402 q.text("flags = ");
3403 q.text("%#x" % self.flags)
3404 q.breakable()
3405 q.text('}')
3406
Rich Lane7dcdf022013-12-11 14:45:27 -08003407stats_request.subtypes[0] = desc_stats_request
3408
3409class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003410 version = 2
3411 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07003412
3413 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003414 if xid != None:
3415 self.xid = xid
3416 else:
3417 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003418 if data != None:
3419 self.data = data
3420 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003421 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003422 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003423
3424 def pack(self):
3425 packed = []
3426 packed.append(struct.pack("!B", self.version))
3427 packed.append(struct.pack("!B", self.type))
3428 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3429 packed.append(struct.pack("!L", self.xid))
3430 packed.append(self.data)
3431 length = sum([len(x) for x in packed])
3432 packed[2] = struct.pack("!H", length)
3433 return ''.join(packed)
3434
3435 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003436 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003437 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003438 _version = reader.read("!B")[0]
3439 assert(_version == 2)
3440 _type = reader.read("!B")[0]
3441 assert(_type == 3)
3442 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003443 orig_reader = reader
3444 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003445 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003446 obj.data = str(reader.read_all())
3447 return obj
3448
3449 def __eq__(self, other):
3450 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003451 if self.xid != other.xid: return False
3452 if self.data != other.data: return False
3453 return True
3454
Rich Lanec2ee4b82013-04-24 17:12:38 -07003455 def pretty_print(self, q):
3456 q.text("echo_reply {")
3457 with q.group():
3458 with q.indent(2):
3459 q.breakable()
3460 q.text("xid = ");
3461 if self.xid != None:
3462 q.text("%#x" % self.xid)
3463 else:
3464 q.text('None')
3465 q.text(","); q.breakable()
3466 q.text("data = ");
3467 q.pp(self.data)
3468 q.breakable()
3469 q.text('}')
3470
Rich Lane7dcdf022013-12-11 14:45:27 -08003471message.subtypes[3] = echo_reply
3472
3473class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003474 version = 2
3475 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07003476
3477 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003478 if xid != None:
3479 self.xid = xid
3480 else:
3481 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003482 if data != None:
3483 self.data = data
3484 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003485 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003486 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003487
3488 def pack(self):
3489 packed = []
3490 packed.append(struct.pack("!B", self.version))
3491 packed.append(struct.pack("!B", self.type))
3492 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3493 packed.append(struct.pack("!L", self.xid))
3494 packed.append(self.data)
3495 length = sum([len(x) for x in packed])
3496 packed[2] = struct.pack("!H", length)
3497 return ''.join(packed)
3498
3499 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003500 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003501 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003502 _version = reader.read("!B")[0]
3503 assert(_version == 2)
3504 _type = reader.read("!B")[0]
3505 assert(_type == 2)
3506 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003507 orig_reader = reader
3508 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003509 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003510 obj.data = str(reader.read_all())
3511 return obj
3512
3513 def __eq__(self, other):
3514 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003515 if self.xid != other.xid: return False
3516 if self.data != other.data: return False
3517 return True
3518
Rich Lanec2ee4b82013-04-24 17:12:38 -07003519 def pretty_print(self, q):
3520 q.text("echo_request {")
3521 with q.group():
3522 with q.indent(2):
3523 q.breakable()
3524 q.text("xid = ");
3525 if self.xid != None:
3526 q.text("%#x" % self.xid)
3527 else:
3528 q.text('None')
3529 q.text(","); q.breakable()
3530 q.text("data = ");
3531 q.pp(self.data)
3532 q.breakable()
3533 q.text('}')
3534
Rich Lane7dcdf022013-12-11 14:45:27 -08003535message.subtypes[2] = echo_request
3536
3537class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003538 version = 2
3539 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07003540
3541 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003542 if xid != None:
3543 self.xid = xid
3544 else:
3545 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003546 if datapath_id != None:
3547 self.datapath_id = datapath_id
3548 else:
3549 self.datapath_id = 0
3550 if n_buffers != None:
3551 self.n_buffers = n_buffers
3552 else:
3553 self.n_buffers = 0
3554 if n_tables != None:
3555 self.n_tables = n_tables
3556 else:
3557 self.n_tables = 0
3558 if capabilities != None:
3559 self.capabilities = capabilities
3560 else:
3561 self.capabilities = 0
3562 if reserved != None:
3563 self.reserved = reserved
3564 else:
3565 self.reserved = 0
3566 if ports != None:
3567 self.ports = ports
3568 else:
3569 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003570 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003571
3572 def pack(self):
3573 packed = []
3574 packed.append(struct.pack("!B", self.version))
3575 packed.append(struct.pack("!B", self.type))
3576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3577 packed.append(struct.pack("!L", self.xid))
3578 packed.append(struct.pack("!Q", self.datapath_id))
3579 packed.append(struct.pack("!L", self.n_buffers))
3580 packed.append(struct.pack("!B", self.n_tables))
3581 packed.append('\x00' * 3)
3582 packed.append(struct.pack("!L", self.capabilities))
3583 packed.append(struct.pack("!L", self.reserved))
Rich Lane7dcdf022013-12-11 14:45:27 -08003584 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003585 length = sum([len(x) for x in packed])
3586 packed[2] = struct.pack("!H", length)
3587 return ''.join(packed)
3588
3589 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003590 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003591 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003592 _version = reader.read("!B")[0]
3593 assert(_version == 2)
3594 _type = reader.read("!B")[0]
3595 assert(_type == 6)
3596 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003597 orig_reader = reader
3598 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003599 obj.xid = reader.read("!L")[0]
3600 obj.datapath_id = reader.read("!Q")[0]
3601 obj.n_buffers = reader.read("!L")[0]
3602 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003603 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07003604 obj.capabilities = reader.read("!L")[0]
3605 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003606 obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
3607 return obj
3608
3609 def __eq__(self, other):
3610 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003611 if self.xid != other.xid: return False
3612 if self.datapath_id != other.datapath_id: return False
3613 if self.n_buffers != other.n_buffers: return False
3614 if self.n_tables != other.n_tables: return False
3615 if self.capabilities != other.capabilities: return False
3616 if self.reserved != other.reserved: return False
3617 if self.ports != other.ports: return False
3618 return True
3619
Rich Lanec2ee4b82013-04-24 17:12:38 -07003620 def pretty_print(self, q):
3621 q.text("features_reply {")
3622 with q.group():
3623 with q.indent(2):
3624 q.breakable()
3625 q.text("xid = ");
3626 if self.xid != None:
3627 q.text("%#x" % self.xid)
3628 else:
3629 q.text('None')
3630 q.text(","); q.breakable()
3631 q.text("datapath_id = ");
3632 q.text("%#x" % self.datapath_id)
3633 q.text(","); q.breakable()
3634 q.text("n_buffers = ");
3635 q.text("%#x" % self.n_buffers)
3636 q.text(","); q.breakable()
3637 q.text("n_tables = ");
3638 q.text("%#x" % self.n_tables)
3639 q.text(","); q.breakable()
3640 q.text("capabilities = ");
3641 q.text("%#x" % self.capabilities)
3642 q.text(","); q.breakable()
3643 q.text("reserved = ");
3644 q.text("%#x" % self.reserved)
3645 q.text(","); q.breakable()
3646 q.text("ports = ");
3647 q.pp(self.ports)
3648 q.breakable()
3649 q.text('}')
3650
Rich Lane7dcdf022013-12-11 14:45:27 -08003651message.subtypes[6] = features_reply
3652
3653class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003654 version = 2
3655 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07003656
3657 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003658 if xid != None:
3659 self.xid = xid
3660 else:
3661 self.xid = None
3662 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003663
3664 def pack(self):
3665 packed = []
3666 packed.append(struct.pack("!B", self.version))
3667 packed.append(struct.pack("!B", self.type))
3668 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3669 packed.append(struct.pack("!L", self.xid))
3670 length = sum([len(x) for x in packed])
3671 packed[2] = struct.pack("!H", length)
3672 return ''.join(packed)
3673
3674 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003675 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003676 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003677 _version = reader.read("!B")[0]
3678 assert(_version == 2)
3679 _type = reader.read("!B")[0]
3680 assert(_type == 5)
3681 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003682 orig_reader = reader
3683 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003684 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003685 return obj
3686
3687 def __eq__(self, other):
3688 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003689 if self.xid != other.xid: return False
3690 return True
3691
Rich Lanec2ee4b82013-04-24 17:12:38 -07003692 def pretty_print(self, q):
3693 q.text("features_request {")
3694 with q.group():
3695 with q.indent(2):
3696 q.breakable()
3697 q.text("xid = ");
3698 if self.xid != None:
3699 q.text("%#x" % self.xid)
3700 else:
3701 q.text('None')
3702 q.breakable()
3703 q.text('}')
3704
Rich Lane7dcdf022013-12-11 14:45:27 -08003705message.subtypes[5] = features_request
3706
3707class flow_mod(message):
3708 subtypes = {}
3709
Rich Lane95f7fc92014-01-27 17:08:16 -08003710 version = 2
3711 type = 14
3712
3713 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):
3714 if xid != None:
3715 self.xid = xid
3716 else:
3717 self.xid = None
3718 if cookie != None:
3719 self.cookie = cookie
3720 else:
3721 self.cookie = 0
3722 if cookie_mask != None:
3723 self.cookie_mask = cookie_mask
3724 else:
3725 self.cookie_mask = 0
3726 if table_id != None:
3727 self.table_id = table_id
3728 else:
3729 self.table_id = 0
3730 if _command != None:
3731 self._command = _command
3732 else:
3733 self._command = 0
3734 if idle_timeout != None:
3735 self.idle_timeout = idle_timeout
3736 else:
3737 self.idle_timeout = 0
3738 if hard_timeout != None:
3739 self.hard_timeout = hard_timeout
3740 else:
3741 self.hard_timeout = 0
3742 if priority != None:
3743 self.priority = priority
3744 else:
3745 self.priority = 0
3746 if buffer_id != None:
3747 self.buffer_id = buffer_id
3748 else:
3749 self.buffer_id = 0
3750 if out_port != None:
3751 self.out_port = out_port
3752 else:
3753 self.out_port = 0
3754 if out_group != None:
3755 self.out_group = out_group
3756 else:
3757 self.out_group = 0
3758 if flags != None:
3759 self.flags = flags
3760 else:
3761 self.flags = 0
3762 if match != None:
3763 self.match = match
3764 else:
3765 self.match = common.match()
3766 if instructions != None:
3767 self.instructions = instructions
3768 else:
3769 self.instructions = []
3770 return
3771
3772 def pack(self):
3773 packed = []
3774 packed.append(struct.pack("!B", self.version))
3775 packed.append(struct.pack("!B", self.type))
3776 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3777 packed.append(struct.pack("!L", self.xid))
3778 packed.append(struct.pack("!Q", self.cookie))
3779 packed.append(struct.pack("!Q", self.cookie_mask))
3780 packed.append(struct.pack("!B", self.table_id))
3781 packed.append(util.pack_fm_cmd(self._command))
3782 packed.append(struct.pack("!H", self.idle_timeout))
3783 packed.append(struct.pack("!H", self.hard_timeout))
3784 packed.append(struct.pack("!H", self.priority))
3785 packed.append(struct.pack("!L", self.buffer_id))
3786 packed.append(util.pack_port_no(self.out_port))
3787 packed.append(struct.pack("!L", self.out_group))
3788 packed.append(struct.pack("!H", self.flags))
3789 packed.append('\x00' * 2)
3790 packed.append(self.match.pack())
3791 packed.append(loxi.generic_util.pack_list(self.instructions))
3792 length = sum([len(x) for x in packed])
3793 packed[2] = struct.pack("!H", length)
3794 return ''.join(packed)
3795
Rich Lane7dcdf022013-12-11 14:45:27 -08003796 @staticmethod
3797 def unpack(reader):
3798 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08003799 subclass = flow_mod.subtypes.get(subtype)
3800 if subclass:
3801 return subclass.unpack(reader)
3802
3803 obj = flow_mod()
3804 _version = reader.read("!B")[0]
3805 assert(_version == 2)
3806 _type = reader.read("!B")[0]
3807 assert(_type == 14)
3808 _length = reader.read("!H")[0]
3809 orig_reader = reader
3810 reader = orig_reader.slice(_length - (2 + 2))
3811 obj.xid = reader.read("!L")[0]
3812 obj.cookie = reader.read("!Q")[0]
3813 obj.cookie_mask = reader.read("!Q")[0]
3814 obj.table_id = reader.read("!B")[0]
3815 obj._command = util.unpack_fm_cmd(reader)
3816 obj.idle_timeout = reader.read("!H")[0]
3817 obj.hard_timeout = reader.read("!H")[0]
3818 obj.priority = reader.read("!H")[0]
3819 obj.buffer_id = reader.read("!L")[0]
3820 obj.out_port = util.unpack_port_no(reader)
3821 obj.out_group = reader.read("!L")[0]
3822 obj.flags = reader.read("!H")[0]
3823 reader.skip(2)
3824 obj.match = common.match.unpack(reader)
3825 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
3826 return obj
3827
3828 def __eq__(self, other):
3829 if type(self) != type(other): return False
3830 if self.xid != other.xid: return False
3831 if self.cookie != other.cookie: return False
3832 if self.cookie_mask != other.cookie_mask: return False
3833 if self.table_id != other.table_id: return False
3834 if self._command != other._command: return False
3835 if self.idle_timeout != other.idle_timeout: return False
3836 if self.hard_timeout != other.hard_timeout: return False
3837 if self.priority != other.priority: return False
3838 if self.buffer_id != other.buffer_id: return False
3839 if self.out_port != other.out_port: return False
3840 if self.out_group != other.out_group: return False
3841 if self.flags != other.flags: return False
3842 if self.match != other.match: return False
3843 if self.instructions != other.instructions: return False
3844 return True
3845
3846 def pretty_print(self, q):
3847 q.text("flow_mod {")
3848 with q.group():
3849 with q.indent(2):
3850 q.breakable()
3851 q.text("xid = ");
3852 if self.xid != None:
3853 q.text("%#x" % self.xid)
3854 else:
3855 q.text('None')
3856 q.text(","); q.breakable()
3857 q.text("cookie = ");
3858 q.text("%#x" % self.cookie)
3859 q.text(","); q.breakable()
3860 q.text("cookie_mask = ");
3861 q.text("%#x" % self.cookie_mask)
3862 q.text(","); q.breakable()
3863 q.text("table_id = ");
3864 q.text("%#x" % self.table_id)
3865 q.text(","); q.breakable()
3866 q.text("idle_timeout = ");
3867 q.text("%#x" % self.idle_timeout)
3868 q.text(","); q.breakable()
3869 q.text("hard_timeout = ");
3870 q.text("%#x" % self.hard_timeout)
3871 q.text(","); q.breakable()
3872 q.text("priority = ");
3873 q.text("%#x" % self.priority)
3874 q.text(","); q.breakable()
3875 q.text("buffer_id = ");
3876 q.text("%#x" % self.buffer_id)
3877 q.text(","); q.breakable()
3878 q.text("out_port = ");
3879 q.text(util.pretty_port(self.out_port))
3880 q.text(","); q.breakable()
3881 q.text("out_group = ");
3882 q.text("%#x" % self.out_group)
3883 q.text(","); q.breakable()
3884 q.text("flags = ");
3885 q.text("%#x" % self.flags)
3886 q.text(","); q.breakable()
3887 q.text("match = ");
3888 q.pp(self.match)
3889 q.text(","); q.breakable()
3890 q.text("instructions = ");
3891 q.pp(self.instructions)
3892 q.breakable()
3893 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003894
3895message.subtypes[14] = flow_mod
3896
3897class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07003898 version = 2
3899 type = 14
3900 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003901
3902 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003903 if xid != None:
3904 self.xid = xid
3905 else:
3906 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003907 if cookie != None:
3908 self.cookie = cookie
3909 else:
3910 self.cookie = 0
3911 if cookie_mask != None:
3912 self.cookie_mask = cookie_mask
3913 else:
3914 self.cookie_mask = 0
3915 if table_id != None:
3916 self.table_id = table_id
3917 else:
3918 self.table_id = 0
3919 if idle_timeout != None:
3920 self.idle_timeout = idle_timeout
3921 else:
3922 self.idle_timeout = 0
3923 if hard_timeout != None:
3924 self.hard_timeout = hard_timeout
3925 else:
3926 self.hard_timeout = 0
3927 if priority != None:
3928 self.priority = priority
3929 else:
3930 self.priority = 0
3931 if buffer_id != None:
3932 self.buffer_id = buffer_id
3933 else:
3934 self.buffer_id = 0
3935 if out_port != None:
3936 self.out_port = out_port
3937 else:
3938 self.out_port = 0
3939 if out_group != None:
3940 self.out_group = out_group
3941 else:
3942 self.out_group = 0
3943 if flags != None:
3944 self.flags = flags
3945 else:
3946 self.flags = 0
3947 if match != None:
3948 self.match = match
3949 else:
3950 self.match = common.match()
3951 if instructions != None:
3952 self.instructions = instructions
3953 else:
3954 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003955 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003956
3957 def pack(self):
3958 packed = []
3959 packed.append(struct.pack("!B", self.version))
3960 packed.append(struct.pack("!B", self.type))
3961 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3962 packed.append(struct.pack("!L", self.xid))
3963 packed.append(struct.pack("!Q", self.cookie))
3964 packed.append(struct.pack("!Q", self.cookie_mask))
3965 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07003966 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003967 packed.append(struct.pack("!H", self.idle_timeout))
3968 packed.append(struct.pack("!H", self.hard_timeout))
3969 packed.append(struct.pack("!H", self.priority))
3970 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07003971 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003972 packed.append(struct.pack("!L", self.out_group))
3973 packed.append(struct.pack("!H", self.flags))
3974 packed.append('\x00' * 2)
3975 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08003976 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003977 length = sum([len(x) for x in packed])
3978 packed[2] = struct.pack("!H", length)
3979 return ''.join(packed)
3980
3981 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003982 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003983 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07003984 _version = reader.read("!B")[0]
3985 assert(_version == 2)
3986 _type = reader.read("!B")[0]
3987 assert(_type == 14)
3988 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003989 orig_reader = reader
3990 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003991 obj.xid = reader.read("!L")[0]
3992 obj.cookie = reader.read("!Q")[0]
3993 obj.cookie_mask = reader.read("!Q")[0]
3994 obj.table_id = reader.read("!B")[0]
3995 __command = util.unpack_fm_cmd(reader)
3996 assert(__command == 0)
3997 obj.idle_timeout = reader.read("!H")[0]
3998 obj.hard_timeout = reader.read("!H")[0]
3999 obj.priority = reader.read("!H")[0]
4000 obj.buffer_id = reader.read("!L")[0]
4001 obj.out_port = util.unpack_port_no(reader)
4002 obj.out_group = reader.read("!L")[0]
4003 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004004 reader.skip(2)
4005 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004006 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004007 return obj
4008
4009 def __eq__(self, other):
4010 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004011 if self.xid != other.xid: return False
4012 if self.cookie != other.cookie: return False
4013 if self.cookie_mask != other.cookie_mask: return False
4014 if self.table_id != other.table_id: return False
4015 if self.idle_timeout != other.idle_timeout: return False
4016 if self.hard_timeout != other.hard_timeout: return False
4017 if self.priority != other.priority: return False
4018 if self.buffer_id != other.buffer_id: return False
4019 if self.out_port != other.out_port: return False
4020 if self.out_group != other.out_group: return False
4021 if self.flags != other.flags: return False
4022 if self.match != other.match: return False
4023 if self.instructions != other.instructions: return False
4024 return True
4025
Rich Lanec2ee4b82013-04-24 17:12:38 -07004026 def pretty_print(self, q):
4027 q.text("flow_add {")
4028 with q.group():
4029 with q.indent(2):
4030 q.breakable()
4031 q.text("xid = ");
4032 if self.xid != None:
4033 q.text("%#x" % self.xid)
4034 else:
4035 q.text('None')
4036 q.text(","); q.breakable()
4037 q.text("cookie = ");
4038 q.text("%#x" % self.cookie)
4039 q.text(","); q.breakable()
4040 q.text("cookie_mask = ");
4041 q.text("%#x" % self.cookie_mask)
4042 q.text(","); q.breakable()
4043 q.text("table_id = ");
4044 q.text("%#x" % self.table_id)
4045 q.text(","); q.breakable()
4046 q.text("idle_timeout = ");
4047 q.text("%#x" % self.idle_timeout)
4048 q.text(","); q.breakable()
4049 q.text("hard_timeout = ");
4050 q.text("%#x" % self.hard_timeout)
4051 q.text(","); q.breakable()
4052 q.text("priority = ");
4053 q.text("%#x" % self.priority)
4054 q.text(","); q.breakable()
4055 q.text("buffer_id = ");
4056 q.text("%#x" % self.buffer_id)
4057 q.text(","); q.breakable()
4058 q.text("out_port = ");
4059 q.text(util.pretty_port(self.out_port))
4060 q.text(","); q.breakable()
4061 q.text("out_group = ");
4062 q.text("%#x" % self.out_group)
4063 q.text(","); q.breakable()
4064 q.text("flags = ");
4065 q.text("%#x" % self.flags)
4066 q.text(","); q.breakable()
4067 q.text("match = ");
4068 q.pp(self.match)
4069 q.text(","); q.breakable()
4070 q.text("instructions = ");
4071 q.pp(self.instructions)
4072 q.breakable()
4073 q.text('}')
4074
Rich Lane7dcdf022013-12-11 14:45:27 -08004075flow_mod.subtypes[0] = flow_add
4076
4077class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004078 version = 2
4079 type = 14
4080 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07004081
4082 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004083 if xid != None:
4084 self.xid = xid
4085 else:
4086 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004087 if cookie != None:
4088 self.cookie = cookie
4089 else:
4090 self.cookie = 0
4091 if cookie_mask != None:
4092 self.cookie_mask = cookie_mask
4093 else:
4094 self.cookie_mask = 0
4095 if table_id != None:
4096 self.table_id = table_id
4097 else:
4098 self.table_id = 0
4099 if idle_timeout != None:
4100 self.idle_timeout = idle_timeout
4101 else:
4102 self.idle_timeout = 0
4103 if hard_timeout != None:
4104 self.hard_timeout = hard_timeout
4105 else:
4106 self.hard_timeout = 0
4107 if priority != None:
4108 self.priority = priority
4109 else:
4110 self.priority = 0
4111 if buffer_id != None:
4112 self.buffer_id = buffer_id
4113 else:
4114 self.buffer_id = 0
4115 if out_port != None:
4116 self.out_port = out_port
4117 else:
4118 self.out_port = 0
4119 if out_group != None:
4120 self.out_group = out_group
4121 else:
4122 self.out_group = 0
4123 if flags != None:
4124 self.flags = flags
4125 else:
4126 self.flags = 0
4127 if match != None:
4128 self.match = match
4129 else:
4130 self.match = common.match()
4131 if instructions != None:
4132 self.instructions = instructions
4133 else:
4134 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004135 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004136
4137 def pack(self):
4138 packed = []
4139 packed.append(struct.pack("!B", self.version))
4140 packed.append(struct.pack("!B", self.type))
4141 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4142 packed.append(struct.pack("!L", self.xid))
4143 packed.append(struct.pack("!Q", self.cookie))
4144 packed.append(struct.pack("!Q", self.cookie_mask))
4145 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004146 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004147 packed.append(struct.pack("!H", self.idle_timeout))
4148 packed.append(struct.pack("!H", self.hard_timeout))
4149 packed.append(struct.pack("!H", self.priority))
4150 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004151 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004152 packed.append(struct.pack("!L", self.out_group))
4153 packed.append(struct.pack("!H", self.flags))
4154 packed.append('\x00' * 2)
4155 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004156 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004157 length = sum([len(x) for x in packed])
4158 packed[2] = struct.pack("!H", length)
4159 return ''.join(packed)
4160
4161 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004162 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004163 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004164 _version = reader.read("!B")[0]
4165 assert(_version == 2)
4166 _type = reader.read("!B")[0]
4167 assert(_type == 14)
4168 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004169 orig_reader = reader
4170 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004171 obj.xid = reader.read("!L")[0]
4172 obj.cookie = reader.read("!Q")[0]
4173 obj.cookie_mask = reader.read("!Q")[0]
4174 obj.table_id = reader.read("!B")[0]
4175 __command = util.unpack_fm_cmd(reader)
4176 assert(__command == 3)
4177 obj.idle_timeout = reader.read("!H")[0]
4178 obj.hard_timeout = reader.read("!H")[0]
4179 obj.priority = reader.read("!H")[0]
4180 obj.buffer_id = reader.read("!L")[0]
4181 obj.out_port = util.unpack_port_no(reader)
4182 obj.out_group = reader.read("!L")[0]
4183 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004184 reader.skip(2)
4185 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004186 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004187 return obj
4188
4189 def __eq__(self, other):
4190 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004191 if self.xid != other.xid: return False
4192 if self.cookie != other.cookie: return False
4193 if self.cookie_mask != other.cookie_mask: return False
4194 if self.table_id != other.table_id: return False
4195 if self.idle_timeout != other.idle_timeout: return False
4196 if self.hard_timeout != other.hard_timeout: return False
4197 if self.priority != other.priority: return False
4198 if self.buffer_id != other.buffer_id: return False
4199 if self.out_port != other.out_port: return False
4200 if self.out_group != other.out_group: return False
4201 if self.flags != other.flags: return False
4202 if self.match != other.match: return False
4203 if self.instructions != other.instructions: return False
4204 return True
4205
Rich Lanec2ee4b82013-04-24 17:12:38 -07004206 def pretty_print(self, q):
4207 q.text("flow_delete {")
4208 with q.group():
4209 with q.indent(2):
4210 q.breakable()
4211 q.text("xid = ");
4212 if self.xid != None:
4213 q.text("%#x" % self.xid)
4214 else:
4215 q.text('None')
4216 q.text(","); q.breakable()
4217 q.text("cookie = ");
4218 q.text("%#x" % self.cookie)
4219 q.text(","); q.breakable()
4220 q.text("cookie_mask = ");
4221 q.text("%#x" % self.cookie_mask)
4222 q.text(","); q.breakable()
4223 q.text("table_id = ");
4224 q.text("%#x" % self.table_id)
4225 q.text(","); q.breakable()
4226 q.text("idle_timeout = ");
4227 q.text("%#x" % self.idle_timeout)
4228 q.text(","); q.breakable()
4229 q.text("hard_timeout = ");
4230 q.text("%#x" % self.hard_timeout)
4231 q.text(","); q.breakable()
4232 q.text("priority = ");
4233 q.text("%#x" % self.priority)
4234 q.text(","); q.breakable()
4235 q.text("buffer_id = ");
4236 q.text("%#x" % self.buffer_id)
4237 q.text(","); q.breakable()
4238 q.text("out_port = ");
4239 q.text(util.pretty_port(self.out_port))
4240 q.text(","); q.breakable()
4241 q.text("out_group = ");
4242 q.text("%#x" % self.out_group)
4243 q.text(","); q.breakable()
4244 q.text("flags = ");
4245 q.text("%#x" % self.flags)
4246 q.text(","); q.breakable()
4247 q.text("match = ");
4248 q.pp(self.match)
4249 q.text(","); q.breakable()
4250 q.text("instructions = ");
4251 q.pp(self.instructions)
4252 q.breakable()
4253 q.text('}')
4254
Rich Lane7dcdf022013-12-11 14:45:27 -08004255flow_mod.subtypes[3] = flow_delete
4256
4257class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004258 version = 2
4259 type = 14
4260 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07004261
4262 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004263 if xid != None:
4264 self.xid = xid
4265 else:
4266 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004267 if cookie != None:
4268 self.cookie = cookie
4269 else:
4270 self.cookie = 0
4271 if cookie_mask != None:
4272 self.cookie_mask = cookie_mask
4273 else:
4274 self.cookie_mask = 0
4275 if table_id != None:
4276 self.table_id = table_id
4277 else:
4278 self.table_id = 0
4279 if idle_timeout != None:
4280 self.idle_timeout = idle_timeout
4281 else:
4282 self.idle_timeout = 0
4283 if hard_timeout != None:
4284 self.hard_timeout = hard_timeout
4285 else:
4286 self.hard_timeout = 0
4287 if priority != None:
4288 self.priority = priority
4289 else:
4290 self.priority = 0
4291 if buffer_id != None:
4292 self.buffer_id = buffer_id
4293 else:
4294 self.buffer_id = 0
4295 if out_port != None:
4296 self.out_port = out_port
4297 else:
4298 self.out_port = 0
4299 if out_group != None:
4300 self.out_group = out_group
4301 else:
4302 self.out_group = 0
4303 if flags != None:
4304 self.flags = flags
4305 else:
4306 self.flags = 0
4307 if match != None:
4308 self.match = match
4309 else:
4310 self.match = common.match()
4311 if instructions != None:
4312 self.instructions = instructions
4313 else:
4314 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004315 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004316
4317 def pack(self):
4318 packed = []
4319 packed.append(struct.pack("!B", self.version))
4320 packed.append(struct.pack("!B", self.type))
4321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4322 packed.append(struct.pack("!L", self.xid))
4323 packed.append(struct.pack("!Q", self.cookie))
4324 packed.append(struct.pack("!Q", self.cookie_mask))
4325 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004326 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004327 packed.append(struct.pack("!H", self.idle_timeout))
4328 packed.append(struct.pack("!H", self.hard_timeout))
4329 packed.append(struct.pack("!H", self.priority))
4330 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004331 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004332 packed.append(struct.pack("!L", self.out_group))
4333 packed.append(struct.pack("!H", self.flags))
4334 packed.append('\x00' * 2)
4335 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004336 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004337 length = sum([len(x) for x in packed])
4338 packed[2] = struct.pack("!H", length)
4339 return ''.join(packed)
4340
4341 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004342 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004343 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004344 _version = reader.read("!B")[0]
4345 assert(_version == 2)
4346 _type = reader.read("!B")[0]
4347 assert(_type == 14)
4348 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004349 orig_reader = reader
4350 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004351 obj.xid = reader.read("!L")[0]
4352 obj.cookie = reader.read("!Q")[0]
4353 obj.cookie_mask = reader.read("!Q")[0]
4354 obj.table_id = reader.read("!B")[0]
4355 __command = util.unpack_fm_cmd(reader)
4356 assert(__command == 4)
4357 obj.idle_timeout = reader.read("!H")[0]
4358 obj.hard_timeout = reader.read("!H")[0]
4359 obj.priority = reader.read("!H")[0]
4360 obj.buffer_id = reader.read("!L")[0]
4361 obj.out_port = util.unpack_port_no(reader)
4362 obj.out_group = reader.read("!L")[0]
4363 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004364 reader.skip(2)
4365 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004366 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004367 return obj
4368
4369 def __eq__(self, other):
4370 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004371 if self.xid != other.xid: return False
4372 if self.cookie != other.cookie: return False
4373 if self.cookie_mask != other.cookie_mask: return False
4374 if self.table_id != other.table_id: return False
4375 if self.idle_timeout != other.idle_timeout: return False
4376 if self.hard_timeout != other.hard_timeout: return False
4377 if self.priority != other.priority: return False
4378 if self.buffer_id != other.buffer_id: return False
4379 if self.out_port != other.out_port: return False
4380 if self.out_group != other.out_group: return False
4381 if self.flags != other.flags: return False
4382 if self.match != other.match: return False
4383 if self.instructions != other.instructions: return False
4384 return True
4385
Rich Lanec2ee4b82013-04-24 17:12:38 -07004386 def pretty_print(self, q):
4387 q.text("flow_delete_strict {")
4388 with q.group():
4389 with q.indent(2):
4390 q.breakable()
4391 q.text("xid = ");
4392 if self.xid != None:
4393 q.text("%#x" % self.xid)
4394 else:
4395 q.text('None')
4396 q.text(","); q.breakable()
4397 q.text("cookie = ");
4398 q.text("%#x" % self.cookie)
4399 q.text(","); q.breakable()
4400 q.text("cookie_mask = ");
4401 q.text("%#x" % self.cookie_mask)
4402 q.text(","); q.breakable()
4403 q.text("table_id = ");
4404 q.text("%#x" % self.table_id)
4405 q.text(","); q.breakable()
4406 q.text("idle_timeout = ");
4407 q.text("%#x" % self.idle_timeout)
4408 q.text(","); q.breakable()
4409 q.text("hard_timeout = ");
4410 q.text("%#x" % self.hard_timeout)
4411 q.text(","); q.breakable()
4412 q.text("priority = ");
4413 q.text("%#x" % self.priority)
4414 q.text(","); q.breakable()
4415 q.text("buffer_id = ");
4416 q.text("%#x" % self.buffer_id)
4417 q.text(","); q.breakable()
4418 q.text("out_port = ");
4419 q.text(util.pretty_port(self.out_port))
4420 q.text(","); q.breakable()
4421 q.text("out_group = ");
4422 q.text("%#x" % self.out_group)
4423 q.text(","); q.breakable()
4424 q.text("flags = ");
4425 q.text("%#x" % self.flags)
4426 q.text(","); q.breakable()
4427 q.text("match = ");
4428 q.pp(self.match)
4429 q.text(","); q.breakable()
4430 q.text("instructions = ");
4431 q.pp(self.instructions)
4432 q.breakable()
4433 q.text('}')
4434
Rich Lane7dcdf022013-12-11 14:45:27 -08004435flow_mod.subtypes[4] = flow_delete_strict
4436
4437class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07004438 version = 2
4439 type = 1
4440 err_type = 5
4441
4442 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004443 if xid != None:
4444 self.xid = xid
4445 else:
4446 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07004447 if code != None:
4448 self.code = code
4449 else:
4450 self.code = 0
4451 if data != None:
4452 self.data = data
4453 else:
4454 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004455 return
Rich Lane6f4978c2013-10-20 21:33:52 -07004456
4457 def pack(self):
4458 packed = []
4459 packed.append(struct.pack("!B", self.version))
4460 packed.append(struct.pack("!B", self.type))
4461 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4462 packed.append(struct.pack("!L", self.xid))
4463 packed.append(struct.pack("!H", self.err_type))
4464 packed.append(struct.pack("!H", self.code))
4465 packed.append(self.data)
4466 length = sum([len(x) for x in packed])
4467 packed[2] = struct.pack("!H", length)
4468 return ''.join(packed)
4469
4470 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004471 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07004472 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07004473 _version = reader.read("!B")[0]
4474 assert(_version == 2)
4475 _type = reader.read("!B")[0]
4476 assert(_type == 1)
4477 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004478 orig_reader = reader
4479 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07004480 obj.xid = reader.read("!L")[0]
4481 _err_type = reader.read("!H")[0]
4482 assert(_err_type == 5)
4483 obj.code = reader.read("!H")[0]
4484 obj.data = str(reader.read_all())
4485 return obj
4486
4487 def __eq__(self, other):
4488 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07004489 if self.xid != other.xid: return False
4490 if self.code != other.code: return False
4491 if self.data != other.data: return False
4492 return True
4493
Rich Lane6f4978c2013-10-20 21:33:52 -07004494 def pretty_print(self, q):
4495 q.text("flow_mod_failed_error_msg {")
4496 with q.group():
4497 with q.indent(2):
4498 q.breakable()
4499 q.text("xid = ");
4500 if self.xid != None:
4501 q.text("%#x" % self.xid)
4502 else:
4503 q.text('None')
4504 q.text(","); q.breakable()
4505 q.text("code = ");
4506 q.text("%#x" % self.code)
4507 q.text(","); q.breakable()
4508 q.text("data = ");
4509 q.pp(self.data)
4510 q.breakable()
4511 q.text('}')
4512
Rich Lane7dcdf022013-12-11 14:45:27 -08004513error_msg.subtypes[5] = flow_mod_failed_error_msg
4514
4515class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004516 version = 2
4517 type = 14
4518 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07004519
4520 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004521 if xid != None:
4522 self.xid = xid
4523 else:
4524 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004525 if cookie != None:
4526 self.cookie = cookie
4527 else:
4528 self.cookie = 0
4529 if cookie_mask != None:
4530 self.cookie_mask = cookie_mask
4531 else:
4532 self.cookie_mask = 0
4533 if table_id != None:
4534 self.table_id = table_id
4535 else:
4536 self.table_id = 0
4537 if idle_timeout != None:
4538 self.idle_timeout = idle_timeout
4539 else:
4540 self.idle_timeout = 0
4541 if hard_timeout != None:
4542 self.hard_timeout = hard_timeout
4543 else:
4544 self.hard_timeout = 0
4545 if priority != None:
4546 self.priority = priority
4547 else:
4548 self.priority = 0
4549 if buffer_id != None:
4550 self.buffer_id = buffer_id
4551 else:
4552 self.buffer_id = 0
4553 if out_port != None:
4554 self.out_port = out_port
4555 else:
4556 self.out_port = 0
4557 if out_group != None:
4558 self.out_group = out_group
4559 else:
4560 self.out_group = 0
4561 if flags != None:
4562 self.flags = flags
4563 else:
4564 self.flags = 0
4565 if match != None:
4566 self.match = match
4567 else:
4568 self.match = common.match()
4569 if instructions != None:
4570 self.instructions = instructions
4571 else:
4572 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004573 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004574
4575 def pack(self):
4576 packed = []
4577 packed.append(struct.pack("!B", self.version))
4578 packed.append(struct.pack("!B", self.type))
4579 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4580 packed.append(struct.pack("!L", self.xid))
4581 packed.append(struct.pack("!Q", self.cookie))
4582 packed.append(struct.pack("!Q", self.cookie_mask))
4583 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004584 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004585 packed.append(struct.pack("!H", self.idle_timeout))
4586 packed.append(struct.pack("!H", self.hard_timeout))
4587 packed.append(struct.pack("!H", self.priority))
4588 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004589 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004590 packed.append(struct.pack("!L", self.out_group))
4591 packed.append(struct.pack("!H", self.flags))
4592 packed.append('\x00' * 2)
4593 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004594 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004595 length = sum([len(x) for x in packed])
4596 packed[2] = struct.pack("!H", length)
4597 return ''.join(packed)
4598
4599 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004600 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004601 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07004602 _version = reader.read("!B")[0]
4603 assert(_version == 2)
4604 _type = reader.read("!B")[0]
4605 assert(_type == 14)
4606 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004607 orig_reader = reader
4608 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004609 obj.xid = reader.read("!L")[0]
4610 obj.cookie = reader.read("!Q")[0]
4611 obj.cookie_mask = reader.read("!Q")[0]
4612 obj.table_id = reader.read("!B")[0]
4613 __command = util.unpack_fm_cmd(reader)
4614 assert(__command == 1)
4615 obj.idle_timeout = reader.read("!H")[0]
4616 obj.hard_timeout = reader.read("!H")[0]
4617 obj.priority = reader.read("!H")[0]
4618 obj.buffer_id = reader.read("!L")[0]
4619 obj.out_port = util.unpack_port_no(reader)
4620 obj.out_group = reader.read("!L")[0]
4621 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004622 reader.skip(2)
4623 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004624 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004625 return obj
4626
4627 def __eq__(self, other):
4628 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004629 if self.xid != other.xid: return False
4630 if self.cookie != other.cookie: return False
4631 if self.cookie_mask != other.cookie_mask: return False
4632 if self.table_id != other.table_id: return False
4633 if self.idle_timeout != other.idle_timeout: return False
4634 if self.hard_timeout != other.hard_timeout: return False
4635 if self.priority != other.priority: return False
4636 if self.buffer_id != other.buffer_id: return False
4637 if self.out_port != other.out_port: return False
4638 if self.out_group != other.out_group: return False
4639 if self.flags != other.flags: return False
4640 if self.match != other.match: return False
4641 if self.instructions != other.instructions: return False
4642 return True
4643
Rich Lanec2ee4b82013-04-24 17:12:38 -07004644 def pretty_print(self, q):
4645 q.text("flow_modify {")
4646 with q.group():
4647 with q.indent(2):
4648 q.breakable()
4649 q.text("xid = ");
4650 if self.xid != None:
4651 q.text("%#x" % self.xid)
4652 else:
4653 q.text('None')
4654 q.text(","); q.breakable()
4655 q.text("cookie = ");
4656 q.text("%#x" % self.cookie)
4657 q.text(","); q.breakable()
4658 q.text("cookie_mask = ");
4659 q.text("%#x" % self.cookie_mask)
4660 q.text(","); q.breakable()
4661 q.text("table_id = ");
4662 q.text("%#x" % self.table_id)
4663 q.text(","); q.breakable()
4664 q.text("idle_timeout = ");
4665 q.text("%#x" % self.idle_timeout)
4666 q.text(","); q.breakable()
4667 q.text("hard_timeout = ");
4668 q.text("%#x" % self.hard_timeout)
4669 q.text(","); q.breakable()
4670 q.text("priority = ");
4671 q.text("%#x" % self.priority)
4672 q.text(","); q.breakable()
4673 q.text("buffer_id = ");
4674 q.text("%#x" % self.buffer_id)
4675 q.text(","); q.breakable()
4676 q.text("out_port = ");
4677 q.text(util.pretty_port(self.out_port))
4678 q.text(","); q.breakable()
4679 q.text("out_group = ");
4680 q.text("%#x" % self.out_group)
4681 q.text(","); q.breakable()
4682 q.text("flags = ");
4683 q.text("%#x" % self.flags)
4684 q.text(","); q.breakable()
4685 q.text("match = ");
4686 q.pp(self.match)
4687 q.text(","); q.breakable()
4688 q.text("instructions = ");
4689 q.pp(self.instructions)
4690 q.breakable()
4691 q.text('}')
4692
Rich Lane7dcdf022013-12-11 14:45:27 -08004693flow_mod.subtypes[1] = flow_modify
4694
4695class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004696 version = 2
4697 type = 14
4698 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07004699
4700 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004701 if xid != None:
4702 self.xid = xid
4703 else:
4704 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004705 if cookie != None:
4706 self.cookie = cookie
4707 else:
4708 self.cookie = 0
4709 if cookie_mask != None:
4710 self.cookie_mask = cookie_mask
4711 else:
4712 self.cookie_mask = 0
4713 if table_id != None:
4714 self.table_id = table_id
4715 else:
4716 self.table_id = 0
4717 if idle_timeout != None:
4718 self.idle_timeout = idle_timeout
4719 else:
4720 self.idle_timeout = 0
4721 if hard_timeout != None:
4722 self.hard_timeout = hard_timeout
4723 else:
4724 self.hard_timeout = 0
4725 if priority != None:
4726 self.priority = priority
4727 else:
4728 self.priority = 0
4729 if buffer_id != None:
4730 self.buffer_id = buffer_id
4731 else:
4732 self.buffer_id = 0
4733 if out_port != None:
4734 self.out_port = out_port
4735 else:
4736 self.out_port = 0
4737 if out_group != None:
4738 self.out_group = out_group
4739 else:
4740 self.out_group = 0
4741 if flags != None:
4742 self.flags = flags
4743 else:
4744 self.flags = 0
4745 if match != None:
4746 self.match = match
4747 else:
4748 self.match = common.match()
4749 if instructions != None:
4750 self.instructions = instructions
4751 else:
4752 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004753 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004754
4755 def pack(self):
4756 packed = []
4757 packed.append(struct.pack("!B", self.version))
4758 packed.append(struct.pack("!B", self.type))
4759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4760 packed.append(struct.pack("!L", self.xid))
4761 packed.append(struct.pack("!Q", self.cookie))
4762 packed.append(struct.pack("!Q", self.cookie_mask))
4763 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004764 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004765 packed.append(struct.pack("!H", self.idle_timeout))
4766 packed.append(struct.pack("!H", self.hard_timeout))
4767 packed.append(struct.pack("!H", self.priority))
4768 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004769 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004770 packed.append(struct.pack("!L", self.out_group))
4771 packed.append(struct.pack("!H", self.flags))
4772 packed.append('\x00' * 2)
4773 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004774 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004775 length = sum([len(x) for x in packed])
4776 packed[2] = struct.pack("!H", length)
4777 return ''.join(packed)
4778
4779 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004780 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004781 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004782 _version = reader.read("!B")[0]
4783 assert(_version == 2)
4784 _type = reader.read("!B")[0]
4785 assert(_type == 14)
4786 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004787 orig_reader = reader
4788 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004789 obj.xid = reader.read("!L")[0]
4790 obj.cookie = reader.read("!Q")[0]
4791 obj.cookie_mask = reader.read("!Q")[0]
4792 obj.table_id = reader.read("!B")[0]
4793 __command = util.unpack_fm_cmd(reader)
4794 assert(__command == 2)
4795 obj.idle_timeout = reader.read("!H")[0]
4796 obj.hard_timeout = reader.read("!H")[0]
4797 obj.priority = reader.read("!H")[0]
4798 obj.buffer_id = reader.read("!L")[0]
4799 obj.out_port = util.unpack_port_no(reader)
4800 obj.out_group = reader.read("!L")[0]
4801 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004802 reader.skip(2)
4803 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004804 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004805 return obj
4806
4807 def __eq__(self, other):
4808 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004809 if self.xid != other.xid: return False
4810 if self.cookie != other.cookie: return False
4811 if self.cookie_mask != other.cookie_mask: return False
4812 if self.table_id != other.table_id: return False
4813 if self.idle_timeout != other.idle_timeout: return False
4814 if self.hard_timeout != other.hard_timeout: return False
4815 if self.priority != other.priority: return False
4816 if self.buffer_id != other.buffer_id: return False
4817 if self.out_port != other.out_port: return False
4818 if self.out_group != other.out_group: return False
4819 if self.flags != other.flags: return False
4820 if self.match != other.match: return False
4821 if self.instructions != other.instructions: return False
4822 return True
4823
Rich Lanec2ee4b82013-04-24 17:12:38 -07004824 def pretty_print(self, q):
4825 q.text("flow_modify_strict {")
4826 with q.group():
4827 with q.indent(2):
4828 q.breakable()
4829 q.text("xid = ");
4830 if self.xid != None:
4831 q.text("%#x" % self.xid)
4832 else:
4833 q.text('None')
4834 q.text(","); q.breakable()
4835 q.text("cookie = ");
4836 q.text("%#x" % self.cookie)
4837 q.text(","); q.breakable()
4838 q.text("cookie_mask = ");
4839 q.text("%#x" % self.cookie_mask)
4840 q.text(","); q.breakable()
4841 q.text("table_id = ");
4842 q.text("%#x" % self.table_id)
4843 q.text(","); q.breakable()
4844 q.text("idle_timeout = ");
4845 q.text("%#x" % self.idle_timeout)
4846 q.text(","); q.breakable()
4847 q.text("hard_timeout = ");
4848 q.text("%#x" % self.hard_timeout)
4849 q.text(","); q.breakable()
4850 q.text("priority = ");
4851 q.text("%#x" % self.priority)
4852 q.text(","); q.breakable()
4853 q.text("buffer_id = ");
4854 q.text("%#x" % self.buffer_id)
4855 q.text(","); q.breakable()
4856 q.text("out_port = ");
4857 q.text(util.pretty_port(self.out_port))
4858 q.text(","); q.breakable()
4859 q.text("out_group = ");
4860 q.text("%#x" % self.out_group)
4861 q.text(","); q.breakable()
4862 q.text("flags = ");
4863 q.text("%#x" % self.flags)
4864 q.text(","); q.breakable()
4865 q.text("match = ");
4866 q.pp(self.match)
4867 q.text(","); q.breakable()
4868 q.text("instructions = ");
4869 q.pp(self.instructions)
4870 q.breakable()
4871 q.text('}')
4872
Rich Lane7dcdf022013-12-11 14:45:27 -08004873flow_mod.subtypes[2] = flow_modify_strict
4874
4875class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004876 version = 2
4877 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07004878
4879 def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004880 if xid != None:
4881 self.xid = xid
4882 else:
4883 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004884 if cookie != None:
4885 self.cookie = cookie
4886 else:
4887 self.cookie = 0
4888 if priority != None:
4889 self.priority = priority
4890 else:
4891 self.priority = 0
4892 if reason != None:
4893 self.reason = reason
4894 else:
4895 self.reason = 0
4896 if table_id != None:
4897 self.table_id = table_id
4898 else:
4899 self.table_id = 0
4900 if duration_sec != None:
4901 self.duration_sec = duration_sec
4902 else:
4903 self.duration_sec = 0
4904 if duration_nsec != None:
4905 self.duration_nsec = duration_nsec
4906 else:
4907 self.duration_nsec = 0
4908 if idle_timeout != None:
4909 self.idle_timeout = idle_timeout
4910 else:
4911 self.idle_timeout = 0
4912 if packet_count != None:
4913 self.packet_count = packet_count
4914 else:
4915 self.packet_count = 0
4916 if byte_count != None:
4917 self.byte_count = byte_count
4918 else:
4919 self.byte_count = 0
4920 if match != None:
4921 self.match = match
4922 else:
4923 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08004924 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004925
4926 def pack(self):
4927 packed = []
4928 packed.append(struct.pack("!B", self.version))
4929 packed.append(struct.pack("!B", self.type))
4930 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4931 packed.append(struct.pack("!L", self.xid))
4932 packed.append(struct.pack("!Q", self.cookie))
4933 packed.append(struct.pack("!H", self.priority))
4934 packed.append(struct.pack("!B", self.reason))
4935 packed.append(struct.pack("!B", self.table_id))
4936 packed.append(struct.pack("!L", self.duration_sec))
4937 packed.append(struct.pack("!L", self.duration_nsec))
4938 packed.append(struct.pack("!H", self.idle_timeout))
4939 packed.append('\x00' * 2)
4940 packed.append(struct.pack("!Q", self.packet_count))
4941 packed.append(struct.pack("!Q", self.byte_count))
4942 packed.append(self.match.pack())
4943 length = sum([len(x) for x in packed])
4944 packed[2] = struct.pack("!H", length)
4945 return ''.join(packed)
4946
4947 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004948 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004949 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07004950 _version = reader.read("!B")[0]
4951 assert(_version == 2)
4952 _type = reader.read("!B")[0]
4953 assert(_type == 11)
4954 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004955 orig_reader = reader
4956 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004957 obj.xid = reader.read("!L")[0]
4958 obj.cookie = reader.read("!Q")[0]
4959 obj.priority = reader.read("!H")[0]
4960 obj.reason = reader.read("!B")[0]
4961 obj.table_id = reader.read("!B")[0]
4962 obj.duration_sec = reader.read("!L")[0]
4963 obj.duration_nsec = reader.read("!L")[0]
4964 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004965 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07004966 obj.packet_count = reader.read("!Q")[0]
4967 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004968 obj.match = common.match.unpack(reader)
4969 return obj
4970
4971 def __eq__(self, other):
4972 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004973 if self.xid != other.xid: return False
4974 if self.cookie != other.cookie: return False
4975 if self.priority != other.priority: return False
4976 if self.reason != other.reason: return False
4977 if self.table_id != other.table_id: return False
4978 if self.duration_sec != other.duration_sec: return False
4979 if self.duration_nsec != other.duration_nsec: return False
4980 if self.idle_timeout != other.idle_timeout: return False
4981 if self.packet_count != other.packet_count: return False
4982 if self.byte_count != other.byte_count: return False
4983 if self.match != other.match: return False
4984 return True
4985
Rich Lanec2ee4b82013-04-24 17:12:38 -07004986 def pretty_print(self, q):
4987 q.text("flow_removed {")
4988 with q.group():
4989 with q.indent(2):
4990 q.breakable()
4991 q.text("xid = ");
4992 if self.xid != None:
4993 q.text("%#x" % self.xid)
4994 else:
4995 q.text('None')
4996 q.text(","); q.breakable()
4997 q.text("cookie = ");
4998 q.text("%#x" % self.cookie)
4999 q.text(","); q.breakable()
5000 q.text("priority = ");
5001 q.text("%#x" % self.priority)
5002 q.text(","); q.breakable()
5003 q.text("reason = ");
5004 q.text("%#x" % self.reason)
5005 q.text(","); q.breakable()
5006 q.text("table_id = ");
5007 q.text("%#x" % self.table_id)
5008 q.text(","); q.breakable()
5009 q.text("duration_sec = ");
5010 q.text("%#x" % self.duration_sec)
5011 q.text(","); q.breakable()
5012 q.text("duration_nsec = ");
5013 q.text("%#x" % self.duration_nsec)
5014 q.text(","); q.breakable()
5015 q.text("idle_timeout = ");
5016 q.text("%#x" % self.idle_timeout)
5017 q.text(","); q.breakable()
5018 q.text("packet_count = ");
5019 q.text("%#x" % self.packet_count)
5020 q.text(","); q.breakable()
5021 q.text("byte_count = ");
5022 q.text("%#x" % self.byte_count)
5023 q.text(","); q.breakable()
5024 q.text("match = ");
5025 q.pp(self.match)
5026 q.breakable()
5027 q.text('}')
5028
Rich Lane7dcdf022013-12-11 14:45:27 -08005029message.subtypes[11] = flow_removed
5030
5031class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005032 version = 2
5033 type = 19
5034 stats_type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07005035
5036 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005037 if xid != None:
5038 self.xid = xid
5039 else:
5040 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005041 if flags != None:
5042 self.flags = flags
5043 else:
5044 self.flags = 0
5045 if entries != None:
5046 self.entries = entries
5047 else:
5048 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005049 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005050
5051 def pack(self):
5052 packed = []
5053 packed.append(struct.pack("!B", self.version))
5054 packed.append(struct.pack("!B", self.type))
5055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5056 packed.append(struct.pack("!L", self.xid))
5057 packed.append(struct.pack("!H", self.stats_type))
5058 packed.append(struct.pack("!H", self.flags))
5059 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005060 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005061 length = sum([len(x) for x in packed])
5062 packed[2] = struct.pack("!H", length)
5063 return ''.join(packed)
5064
5065 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005066 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005067 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005068 _version = reader.read("!B")[0]
5069 assert(_version == 2)
5070 _type = reader.read("!B")[0]
5071 assert(_type == 19)
5072 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005073 orig_reader = reader
5074 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005075 obj.xid = reader.read("!L")[0]
5076 _stats_type = reader.read("!H")[0]
5077 assert(_stats_type == 1)
5078 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005079 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005080 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005081 return obj
5082
5083 def __eq__(self, other):
5084 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005085 if self.xid != other.xid: return False
5086 if self.flags != other.flags: return False
5087 if self.entries != other.entries: return False
5088 return True
5089
Rich Lanec2ee4b82013-04-24 17:12:38 -07005090 def pretty_print(self, q):
5091 q.text("flow_stats_reply {")
5092 with q.group():
5093 with q.indent(2):
5094 q.breakable()
5095 q.text("xid = ");
5096 if self.xid != None:
5097 q.text("%#x" % self.xid)
5098 else:
5099 q.text('None')
5100 q.text(","); q.breakable()
5101 q.text("flags = ");
5102 q.text("%#x" % self.flags)
5103 q.text(","); q.breakable()
5104 q.text("entries = ");
5105 q.pp(self.entries)
5106 q.breakable()
5107 q.text('}')
5108
Rich Lane7dcdf022013-12-11 14:45:27 -08005109stats_reply.subtypes[1] = flow_stats_reply
5110
5111class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005112 version = 2
5113 type = 18
5114 stats_type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07005115
5116 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005117 if xid != None:
5118 self.xid = xid
5119 else:
5120 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005121 if flags != None:
5122 self.flags = flags
5123 else:
5124 self.flags = 0
5125 if table_id != None:
5126 self.table_id = table_id
5127 else:
5128 self.table_id = 0
5129 if out_port != None:
5130 self.out_port = out_port
5131 else:
5132 self.out_port = 0
5133 if out_group != None:
5134 self.out_group = out_group
5135 else:
5136 self.out_group = 0
5137 if cookie != None:
5138 self.cookie = cookie
5139 else:
5140 self.cookie = 0
5141 if cookie_mask != None:
5142 self.cookie_mask = cookie_mask
5143 else:
5144 self.cookie_mask = 0
5145 if match != None:
5146 self.match = match
5147 else:
5148 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08005149 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005150
5151 def pack(self):
5152 packed = []
5153 packed.append(struct.pack("!B", self.version))
5154 packed.append(struct.pack("!B", self.type))
5155 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5156 packed.append(struct.pack("!L", self.xid))
5157 packed.append(struct.pack("!H", self.stats_type))
5158 packed.append(struct.pack("!H", self.flags))
5159 packed.append('\x00' * 4)
5160 packed.append(struct.pack("!B", self.table_id))
5161 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07005162 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005163 packed.append(struct.pack("!L", self.out_group))
5164 packed.append('\x00' * 4)
5165 packed.append(struct.pack("!Q", self.cookie))
5166 packed.append(struct.pack("!Q", self.cookie_mask))
5167 packed.append(self.match.pack())
5168 length = sum([len(x) for x in packed])
5169 packed[2] = struct.pack("!H", length)
5170 return ''.join(packed)
5171
5172 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005173 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005174 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005175 _version = reader.read("!B")[0]
5176 assert(_version == 2)
5177 _type = reader.read("!B")[0]
5178 assert(_type == 18)
5179 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005180 orig_reader = reader
5181 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005182 obj.xid = reader.read("!L")[0]
5183 _stats_type = reader.read("!H")[0]
5184 assert(_stats_type == 1)
5185 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005186 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07005187 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005188 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07005189 obj.out_port = util.unpack_port_no(reader)
5190 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005191 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07005192 obj.cookie = reader.read("!Q")[0]
5193 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005194 obj.match = common.match.unpack(reader)
5195 return obj
5196
5197 def __eq__(self, other):
5198 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005199 if self.xid != other.xid: return False
5200 if self.flags != other.flags: return False
5201 if self.table_id != other.table_id: return False
5202 if self.out_port != other.out_port: return False
5203 if self.out_group != other.out_group: return False
5204 if self.cookie != other.cookie: return False
5205 if self.cookie_mask != other.cookie_mask: return False
5206 if self.match != other.match: return False
5207 return True
5208
Rich Lanec2ee4b82013-04-24 17:12:38 -07005209 def pretty_print(self, q):
5210 q.text("flow_stats_request {")
5211 with q.group():
5212 with q.indent(2):
5213 q.breakable()
5214 q.text("xid = ");
5215 if self.xid != None:
5216 q.text("%#x" % self.xid)
5217 else:
5218 q.text('None')
5219 q.text(","); q.breakable()
5220 q.text("flags = ");
5221 q.text("%#x" % self.flags)
5222 q.text(","); q.breakable()
5223 q.text("table_id = ");
5224 q.text("%#x" % self.table_id)
5225 q.text(","); q.breakable()
5226 q.text("out_port = ");
5227 q.text(util.pretty_port(self.out_port))
5228 q.text(","); q.breakable()
5229 q.text("out_group = ");
5230 q.text("%#x" % self.out_group)
5231 q.text(","); q.breakable()
5232 q.text("cookie = ");
5233 q.text("%#x" % self.cookie)
5234 q.text(","); q.breakable()
5235 q.text("cookie_mask = ");
5236 q.text("%#x" % self.cookie_mask)
5237 q.text(","); q.breakable()
5238 q.text("match = ");
5239 q.pp(self.match)
5240 q.breakable()
5241 q.text('}')
5242
Rich Lane7dcdf022013-12-11 14:45:27 -08005243stats_request.subtypes[1] = flow_stats_request
5244
5245class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005246 version = 2
5247 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07005248
5249 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005250 if xid != None:
5251 self.xid = xid
5252 else:
5253 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005254 if flags != None:
5255 self.flags = flags
5256 else:
5257 self.flags = 0
5258 if miss_send_len != None:
5259 self.miss_send_len = miss_send_len
5260 else:
5261 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005262 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005263
5264 def pack(self):
5265 packed = []
5266 packed.append(struct.pack("!B", self.version))
5267 packed.append(struct.pack("!B", self.type))
5268 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5269 packed.append(struct.pack("!L", self.xid))
5270 packed.append(struct.pack("!H", self.flags))
5271 packed.append(struct.pack("!H", self.miss_send_len))
5272 length = sum([len(x) for x in packed])
5273 packed[2] = struct.pack("!H", length)
5274 return ''.join(packed)
5275
5276 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005277 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005278 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005279 _version = reader.read("!B")[0]
5280 assert(_version == 2)
5281 _type = reader.read("!B")[0]
5282 assert(_type == 8)
5283 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005284 orig_reader = reader
5285 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005286 obj.xid = reader.read("!L")[0]
5287 obj.flags = reader.read("!H")[0]
5288 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005289 return obj
5290
5291 def __eq__(self, other):
5292 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005293 if self.xid != other.xid: return False
5294 if self.flags != other.flags: return False
5295 if self.miss_send_len != other.miss_send_len: return False
5296 return True
5297
Rich Lanec2ee4b82013-04-24 17:12:38 -07005298 def pretty_print(self, q):
5299 q.text("get_config_reply {")
5300 with q.group():
5301 with q.indent(2):
5302 q.breakable()
5303 q.text("xid = ");
5304 if self.xid != None:
5305 q.text("%#x" % self.xid)
5306 else:
5307 q.text('None')
5308 q.text(","); q.breakable()
5309 q.text("flags = ");
5310 q.text("%#x" % self.flags)
5311 q.text(","); q.breakable()
5312 q.text("miss_send_len = ");
5313 q.text("%#x" % self.miss_send_len)
5314 q.breakable()
5315 q.text('}')
5316
Rich Lane7dcdf022013-12-11 14:45:27 -08005317message.subtypes[8] = get_config_reply
5318
5319class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005320 version = 2
5321 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005322
5323 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005324 if xid != None:
5325 self.xid = xid
5326 else:
5327 self.xid = None
5328 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005329
5330 def pack(self):
5331 packed = []
5332 packed.append(struct.pack("!B", self.version))
5333 packed.append(struct.pack("!B", self.type))
5334 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5335 packed.append(struct.pack("!L", self.xid))
5336 length = sum([len(x) for x in packed])
5337 packed[2] = struct.pack("!H", length)
5338 return ''.join(packed)
5339
5340 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005341 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005342 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005343 _version = reader.read("!B")[0]
5344 assert(_version == 2)
5345 _type = reader.read("!B")[0]
5346 assert(_type == 7)
5347 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005348 orig_reader = reader
5349 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005350 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005351 return obj
5352
5353 def __eq__(self, other):
5354 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005355 if self.xid != other.xid: return False
5356 return True
5357
Rich Lanec2ee4b82013-04-24 17:12:38 -07005358 def pretty_print(self, q):
5359 q.text("get_config_request {")
5360 with q.group():
5361 with q.indent(2):
5362 q.breakable()
5363 q.text("xid = ");
5364 if self.xid != None:
5365 q.text("%#x" % self.xid)
5366 else:
5367 q.text('None')
5368 q.breakable()
5369 q.text('}')
5370
Rich Lane7dcdf022013-12-11 14:45:27 -08005371message.subtypes[7] = get_config_request
5372
5373class group_mod(message):
5374 subtypes = {}
5375
Rich Lane95f7fc92014-01-27 17:08:16 -08005376 version = 2
5377 type = 15
5378
5379 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
5380 if xid != None:
5381 self.xid = xid
5382 else:
5383 self.xid = None
5384 if command != None:
5385 self.command = command
5386 else:
5387 self.command = 0
5388 if group_type != None:
5389 self.group_type = group_type
5390 else:
5391 self.group_type = 0
5392 if group_id != None:
5393 self.group_id = group_id
5394 else:
5395 self.group_id = 0
5396 if buckets != None:
5397 self.buckets = buckets
5398 else:
5399 self.buckets = []
5400 return
5401
5402 def pack(self):
5403 packed = []
5404 packed.append(struct.pack("!B", self.version))
5405 packed.append(struct.pack("!B", self.type))
5406 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5407 packed.append(struct.pack("!L", self.xid))
5408 packed.append(struct.pack("!H", self.command))
5409 packed.append(struct.pack("!B", self.group_type))
5410 packed.append('\x00' * 1)
5411 packed.append(struct.pack("!L", self.group_id))
5412 packed.append(loxi.generic_util.pack_list(self.buckets))
5413 length = sum([len(x) for x in packed])
5414 packed[2] = struct.pack("!H", length)
5415 return ''.join(packed)
5416
Rich Lane7dcdf022013-12-11 14:45:27 -08005417 @staticmethod
5418 def unpack(reader):
5419 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08005420 subclass = group_mod.subtypes.get(subtype)
5421 if subclass:
5422 return subclass.unpack(reader)
5423
5424 obj = group_mod()
5425 _version = reader.read("!B")[0]
5426 assert(_version == 2)
5427 _type = reader.read("!B")[0]
5428 assert(_type == 15)
5429 _length = reader.read("!H")[0]
5430 orig_reader = reader
5431 reader = orig_reader.slice(_length - (2 + 2))
5432 obj.xid = reader.read("!L")[0]
5433 obj.command = reader.read("!H")[0]
5434 obj.group_type = reader.read("!B")[0]
5435 reader.skip(1)
5436 obj.group_id = reader.read("!L")[0]
5437 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
5438 return obj
5439
5440 def __eq__(self, other):
5441 if type(self) != type(other): return False
5442 if self.xid != other.xid: return False
5443 if self.command != other.command: return False
5444 if self.group_type != other.group_type: return False
5445 if self.group_id != other.group_id: return False
5446 if self.buckets != other.buckets: return False
5447 return True
5448
5449 def pretty_print(self, q):
5450 q.text("group_mod {")
5451 with q.group():
5452 with q.indent(2):
5453 q.breakable()
5454 q.text("xid = ");
5455 if self.xid != None:
5456 q.text("%#x" % self.xid)
5457 else:
5458 q.text('None')
5459 q.text(","); q.breakable()
5460 q.text("group_type = ");
5461 q.text("%#x" % self.group_type)
5462 q.text(","); q.breakable()
5463 q.text("group_id = ");
5464 q.text("%#x" % self.group_id)
5465 q.text(","); q.breakable()
5466 q.text("buckets = ");
5467 q.pp(self.buckets)
5468 q.breakable()
5469 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08005470
5471message.subtypes[15] = group_mod
5472
5473class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005474 version = 2
5475 type = 15
5476 command = 0
5477
5478 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005479 if xid != None:
5480 self.xid = xid
5481 else:
5482 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005483 if group_type != None:
5484 self.group_type = group_type
5485 else:
5486 self.group_type = 0
5487 if group_id != None:
5488 self.group_id = group_id
5489 else:
5490 self.group_id = 0
5491 if buckets != None:
5492 self.buckets = buckets
5493 else:
5494 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005495 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005496
5497 def pack(self):
5498 packed = []
5499 packed.append(struct.pack("!B", self.version))
5500 packed.append(struct.pack("!B", self.type))
5501 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5502 packed.append(struct.pack("!L", self.xid))
5503 packed.append(struct.pack("!H", self.command))
5504 packed.append(struct.pack("!B", self.group_type))
5505 packed.append('\x00' * 1)
5506 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005507 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005508 length = sum([len(x) for x in packed])
5509 packed[2] = struct.pack("!H", length)
5510 return ''.join(packed)
5511
5512 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005513 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005514 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -08005515 _version = reader.read("!B")[0]
5516 assert(_version == 2)
5517 _type = reader.read("!B")[0]
5518 assert(_type == 15)
5519 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005520 orig_reader = reader
5521 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005522 obj.xid = reader.read("!L")[0]
5523 _command = reader.read("!H")[0]
5524 assert(_command == 0)
5525 obj.group_type = reader.read("!B")[0]
5526 reader.skip(1)
5527 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005528 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005529 return obj
5530
5531 def __eq__(self, other):
5532 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005533 if self.xid != other.xid: return False
5534 if self.group_type != other.group_type: return False
5535 if self.group_id != other.group_id: return False
5536 if self.buckets != other.buckets: return False
5537 return True
5538
Rich Lane7b0f2012013-11-22 14:15:26 -08005539 def pretty_print(self, q):
5540 q.text("group_add {")
5541 with q.group():
5542 with q.indent(2):
5543 q.breakable()
5544 q.text("xid = ");
5545 if self.xid != None:
5546 q.text("%#x" % self.xid)
5547 else:
5548 q.text('None')
5549 q.text(","); q.breakable()
5550 q.text("group_type = ");
5551 q.text("%#x" % self.group_type)
5552 q.text(","); q.breakable()
5553 q.text("group_id = ");
5554 q.text("%#x" % self.group_id)
5555 q.text(","); q.breakable()
5556 q.text("buckets = ");
5557 q.pp(self.buckets)
5558 q.breakable()
5559 q.text('}')
5560
Rich Lane7dcdf022013-12-11 14:45:27 -08005561group_mod.subtypes[0] = group_add
5562
5563class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005564 version = 2
5565 type = 15
5566 command = 2
5567
5568 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005569 if xid != None:
5570 self.xid = xid
5571 else:
5572 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005573 if group_type != None:
5574 self.group_type = group_type
5575 else:
5576 self.group_type = 0
5577 if group_id != None:
5578 self.group_id = group_id
5579 else:
5580 self.group_id = 0
5581 if buckets != None:
5582 self.buckets = buckets
5583 else:
5584 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005585 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005586
5587 def pack(self):
5588 packed = []
5589 packed.append(struct.pack("!B", self.version))
5590 packed.append(struct.pack("!B", self.type))
5591 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5592 packed.append(struct.pack("!L", self.xid))
5593 packed.append(struct.pack("!H", self.command))
5594 packed.append(struct.pack("!B", self.group_type))
5595 packed.append('\x00' * 1)
5596 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005597 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005598 length = sum([len(x) for x in packed])
5599 packed[2] = struct.pack("!H", length)
5600 return ''.join(packed)
5601
5602 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005603 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005604 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -08005605 _version = reader.read("!B")[0]
5606 assert(_version == 2)
5607 _type = reader.read("!B")[0]
5608 assert(_type == 15)
5609 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005610 orig_reader = reader
5611 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005612 obj.xid = reader.read("!L")[0]
5613 _command = reader.read("!H")[0]
5614 assert(_command == 2)
5615 obj.group_type = reader.read("!B")[0]
5616 reader.skip(1)
5617 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005618 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005619 return obj
5620
5621 def __eq__(self, other):
5622 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005623 if self.xid != other.xid: return False
5624 if self.group_type != other.group_type: return False
5625 if self.group_id != other.group_id: return False
5626 if self.buckets != other.buckets: return False
5627 return True
5628
Rich Lane7b0f2012013-11-22 14:15:26 -08005629 def pretty_print(self, q):
5630 q.text("group_delete {")
5631 with q.group():
5632 with q.indent(2):
5633 q.breakable()
5634 q.text("xid = ");
5635 if self.xid != None:
5636 q.text("%#x" % self.xid)
5637 else:
5638 q.text('None')
5639 q.text(","); q.breakable()
5640 q.text("group_type = ");
5641 q.text("%#x" % self.group_type)
5642 q.text(","); q.breakable()
5643 q.text("group_id = ");
5644 q.text("%#x" % self.group_id)
5645 q.text(","); q.breakable()
5646 q.text("buckets = ");
5647 q.pp(self.buckets)
5648 q.breakable()
5649 q.text('}')
5650
Rich Lane7dcdf022013-12-11 14:45:27 -08005651group_mod.subtypes[2] = group_delete
5652
5653class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005654 version = 2
5655 type = 19
5656 stats_type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005657
5658 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005659 if xid != None:
5660 self.xid = xid
5661 else:
5662 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005663 if flags != None:
5664 self.flags = flags
5665 else:
5666 self.flags = 0
5667 if entries != None:
5668 self.entries = entries
5669 else:
5670 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005671 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005672
5673 def pack(self):
5674 packed = []
5675 packed.append(struct.pack("!B", self.version))
5676 packed.append(struct.pack("!B", self.type))
5677 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5678 packed.append(struct.pack("!L", self.xid))
5679 packed.append(struct.pack("!H", self.stats_type))
5680 packed.append(struct.pack("!H", self.flags))
5681 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005682 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005683 length = sum([len(x) for x in packed])
5684 packed[2] = struct.pack("!H", length)
5685 return ''.join(packed)
5686
5687 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005688 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005689 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005690 _version = reader.read("!B")[0]
5691 assert(_version == 2)
5692 _type = reader.read("!B")[0]
5693 assert(_type == 19)
5694 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005695 orig_reader = reader
5696 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005697 obj.xid = reader.read("!L")[0]
5698 _stats_type = reader.read("!H")[0]
5699 assert(_stats_type == 7)
5700 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005701 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005702 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005703 return obj
5704
5705 def __eq__(self, other):
5706 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005707 if self.xid != other.xid: return False
5708 if self.flags != other.flags: return False
5709 if self.entries != other.entries: return False
5710 return True
5711
Rich Lanec2ee4b82013-04-24 17:12:38 -07005712 def pretty_print(self, q):
5713 q.text("group_desc_stats_reply {")
5714 with q.group():
5715 with q.indent(2):
5716 q.breakable()
5717 q.text("xid = ");
5718 if self.xid != None:
5719 q.text("%#x" % self.xid)
5720 else:
5721 q.text('None')
5722 q.text(","); q.breakable()
5723 q.text("flags = ");
5724 q.text("%#x" % self.flags)
5725 q.text(","); q.breakable()
5726 q.text("entries = ");
5727 q.pp(self.entries)
5728 q.breakable()
5729 q.text('}')
5730
Rich Lane7dcdf022013-12-11 14:45:27 -08005731stats_reply.subtypes[7] = group_desc_stats_reply
5732
5733class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005734 version = 2
5735 type = 18
5736 stats_type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005737
5738 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005739 if xid != None:
5740 self.xid = xid
5741 else:
5742 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005743 if flags != None:
5744 self.flags = flags
5745 else:
5746 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005747 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005748
5749 def pack(self):
5750 packed = []
5751 packed.append(struct.pack("!B", self.version))
5752 packed.append(struct.pack("!B", self.type))
5753 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5754 packed.append(struct.pack("!L", self.xid))
5755 packed.append(struct.pack("!H", self.stats_type))
5756 packed.append(struct.pack("!H", self.flags))
5757 packed.append('\x00' * 4)
5758 length = sum([len(x) for x in packed])
5759 packed[2] = struct.pack("!H", length)
5760 return ''.join(packed)
5761
5762 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005763 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005764 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005765 _version = reader.read("!B")[0]
5766 assert(_version == 2)
5767 _type = reader.read("!B")[0]
5768 assert(_type == 18)
5769 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005770 orig_reader = reader
5771 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005772 obj.xid = reader.read("!L")[0]
5773 _stats_type = reader.read("!H")[0]
5774 assert(_stats_type == 7)
5775 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005776 reader.skip(4)
5777 return obj
5778
5779 def __eq__(self, other):
5780 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005781 if self.xid != other.xid: return False
5782 if self.flags != other.flags: return False
5783 return True
5784
Rich Lanec2ee4b82013-04-24 17:12:38 -07005785 def pretty_print(self, q):
5786 q.text("group_desc_stats_request {")
5787 with q.group():
5788 with q.indent(2):
5789 q.breakable()
5790 q.text("xid = ");
5791 if self.xid != None:
5792 q.text("%#x" % self.xid)
5793 else:
5794 q.text('None')
5795 q.text(","); q.breakable()
5796 q.text("flags = ");
5797 q.text("%#x" % self.flags)
5798 q.breakable()
5799 q.text('}')
5800
Rich Lane7dcdf022013-12-11 14:45:27 -08005801stats_request.subtypes[7] = group_desc_stats_request
5802
5803class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005804 version = 2
5805 type = 1
5806 err_type = 6
5807
5808 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005809 if xid != None:
5810 self.xid = xid
5811 else:
5812 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005813 if code != None:
5814 self.code = code
5815 else:
5816 self.code = 0
5817 if data != None:
5818 self.data = data
5819 else:
5820 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005821 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005822
5823 def pack(self):
5824 packed = []
5825 packed.append(struct.pack("!B", self.version))
5826 packed.append(struct.pack("!B", self.type))
5827 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5828 packed.append(struct.pack("!L", self.xid))
5829 packed.append(struct.pack("!H", self.err_type))
5830 packed.append(struct.pack("!H", self.code))
5831 packed.append(self.data)
5832 length = sum([len(x) for x in packed])
5833 packed[2] = struct.pack("!H", length)
5834 return ''.join(packed)
5835
5836 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005837 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005838 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005839 _version = reader.read("!B")[0]
5840 assert(_version == 2)
5841 _type = reader.read("!B")[0]
5842 assert(_type == 1)
5843 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005844 orig_reader = reader
5845 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005846 obj.xid = reader.read("!L")[0]
5847 _err_type = reader.read("!H")[0]
5848 assert(_err_type == 6)
5849 obj.code = reader.read("!H")[0]
5850 obj.data = str(reader.read_all())
5851 return obj
5852
5853 def __eq__(self, other):
5854 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005855 if self.xid != other.xid: return False
5856 if self.code != other.code: return False
5857 if self.data != other.data: return False
5858 return True
5859
Rich Lane6f4978c2013-10-20 21:33:52 -07005860 def pretty_print(self, q):
5861 q.text("group_mod_failed_error_msg {")
5862 with q.group():
5863 with q.indent(2):
5864 q.breakable()
5865 q.text("xid = ");
5866 if self.xid != None:
5867 q.text("%#x" % self.xid)
5868 else:
5869 q.text('None')
5870 q.text(","); q.breakable()
5871 q.text("code = ");
5872 q.text("%#x" % self.code)
5873 q.text(","); q.breakable()
5874 q.text("data = ");
5875 q.pp(self.data)
5876 q.breakable()
5877 q.text('}')
5878
Rich Lane7dcdf022013-12-11 14:45:27 -08005879error_msg.subtypes[6] = group_mod_failed_error_msg
5880
5881class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005882 version = 2
5883 type = 15
5884 command = 1
5885
5886 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005887 if xid != None:
5888 self.xid = xid
5889 else:
5890 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005891 if group_type != None:
5892 self.group_type = group_type
5893 else:
5894 self.group_type = 0
5895 if group_id != None:
5896 self.group_id = group_id
5897 else:
5898 self.group_id = 0
5899 if buckets != None:
5900 self.buckets = buckets
5901 else:
5902 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005903 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005904
5905 def pack(self):
5906 packed = []
5907 packed.append(struct.pack("!B", self.version))
5908 packed.append(struct.pack("!B", self.type))
5909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5910 packed.append(struct.pack("!L", self.xid))
5911 packed.append(struct.pack("!H", self.command))
5912 packed.append(struct.pack("!B", self.group_type))
5913 packed.append('\x00' * 1)
5914 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005915 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005916 length = sum([len(x) for x in packed])
5917 packed[2] = struct.pack("!H", length)
5918 return ''.join(packed)
5919
5920 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005921 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005922 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -08005923 _version = reader.read("!B")[0]
5924 assert(_version == 2)
5925 _type = reader.read("!B")[0]
5926 assert(_type == 15)
5927 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005928 orig_reader = reader
5929 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005930 obj.xid = reader.read("!L")[0]
5931 _command = reader.read("!H")[0]
5932 assert(_command == 1)
5933 obj.group_type = reader.read("!B")[0]
5934 reader.skip(1)
5935 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005936 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005937 return obj
5938
5939 def __eq__(self, other):
5940 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005941 if self.xid != other.xid: return False
5942 if self.group_type != other.group_type: return False
5943 if self.group_id != other.group_id: return False
5944 if self.buckets != other.buckets: return False
5945 return True
5946
Rich Lane7b0f2012013-11-22 14:15:26 -08005947 def pretty_print(self, q):
5948 q.text("group_modify {")
5949 with q.group():
5950 with q.indent(2):
5951 q.breakable()
5952 q.text("xid = ");
5953 if self.xid != None:
5954 q.text("%#x" % self.xid)
5955 else:
5956 q.text('None')
5957 q.text(","); q.breakable()
5958 q.text("group_type = ");
5959 q.text("%#x" % self.group_type)
5960 q.text(","); q.breakable()
5961 q.text("group_id = ");
5962 q.text("%#x" % self.group_id)
5963 q.text(","); q.breakable()
5964 q.text("buckets = ");
5965 q.pp(self.buckets)
5966 q.breakable()
5967 q.text('}')
5968
Rich Lane7dcdf022013-12-11 14:45:27 -08005969group_mod.subtypes[1] = group_modify
5970
5971class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005972 version = 2
5973 type = 19
5974 stats_type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07005975
5976 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005977 if xid != None:
5978 self.xid = xid
5979 else:
5980 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005981 if flags != None:
5982 self.flags = flags
5983 else:
5984 self.flags = 0
5985 if entries != None:
5986 self.entries = entries
5987 else:
5988 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005989 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005990
5991 def pack(self):
5992 packed = []
5993 packed.append(struct.pack("!B", self.version))
5994 packed.append(struct.pack("!B", self.type))
5995 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5996 packed.append(struct.pack("!L", self.xid))
5997 packed.append(struct.pack("!H", self.stats_type))
5998 packed.append(struct.pack("!H", self.flags))
5999 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006000 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006001 length = sum([len(x) for x in packed])
6002 packed[2] = struct.pack("!H", length)
6003 return ''.join(packed)
6004
6005 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006006 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006007 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006008 _version = reader.read("!B")[0]
6009 assert(_version == 2)
6010 _type = reader.read("!B")[0]
6011 assert(_type == 19)
6012 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006013 orig_reader = reader
6014 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006015 obj.xid = reader.read("!L")[0]
6016 _stats_type = reader.read("!H")[0]
6017 assert(_stats_type == 6)
6018 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006019 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006020 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006021 return obj
6022
6023 def __eq__(self, other):
6024 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006025 if self.xid != other.xid: return False
6026 if self.flags != other.flags: return False
6027 if self.entries != other.entries: return False
6028 return True
6029
Rich Lanec2ee4b82013-04-24 17:12:38 -07006030 def pretty_print(self, q):
6031 q.text("group_stats_reply {")
6032 with q.group():
6033 with q.indent(2):
6034 q.breakable()
6035 q.text("xid = ");
6036 if self.xid != None:
6037 q.text("%#x" % self.xid)
6038 else:
6039 q.text('None')
6040 q.text(","); q.breakable()
6041 q.text("flags = ");
6042 q.text("%#x" % self.flags)
6043 q.text(","); q.breakable()
6044 q.text("entries = ");
6045 q.pp(self.entries)
6046 q.breakable()
6047 q.text('}')
6048
Rich Lane7dcdf022013-12-11 14:45:27 -08006049stats_reply.subtypes[6] = group_stats_reply
6050
6051class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006052 version = 2
6053 type = 18
6054 stats_type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07006055
6056 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006057 if xid != None:
6058 self.xid = xid
6059 else:
6060 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006061 if flags != None:
6062 self.flags = flags
6063 else:
6064 self.flags = 0
6065 if group_id != None:
6066 self.group_id = group_id
6067 else:
6068 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006069 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006070
6071 def pack(self):
6072 packed = []
6073 packed.append(struct.pack("!B", self.version))
6074 packed.append(struct.pack("!B", self.type))
6075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6076 packed.append(struct.pack("!L", self.xid))
6077 packed.append(struct.pack("!H", self.stats_type))
6078 packed.append(struct.pack("!H", self.flags))
6079 packed.append('\x00' * 4)
6080 packed.append(struct.pack("!L", self.group_id))
6081 packed.append('\x00' * 4)
6082 length = sum([len(x) for x in packed])
6083 packed[2] = struct.pack("!H", length)
6084 return ''.join(packed)
6085
6086 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006087 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006088 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006089 _version = reader.read("!B")[0]
6090 assert(_version == 2)
6091 _type = reader.read("!B")[0]
6092 assert(_type == 18)
6093 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006094 orig_reader = reader
6095 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006096 obj.xid = reader.read("!L")[0]
6097 _stats_type = reader.read("!H")[0]
6098 assert(_stats_type == 6)
6099 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006100 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006101 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006102 reader.skip(4)
6103 return obj
6104
6105 def __eq__(self, other):
6106 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006107 if self.xid != other.xid: return False
6108 if self.flags != other.flags: return False
6109 if self.group_id != other.group_id: return False
6110 return True
6111
Rich Lanec2ee4b82013-04-24 17:12:38 -07006112 def pretty_print(self, q):
6113 q.text("group_stats_request {")
6114 with q.group():
6115 with q.indent(2):
6116 q.breakable()
6117 q.text("xid = ");
6118 if self.xid != None:
6119 q.text("%#x" % self.xid)
6120 else:
6121 q.text('None')
6122 q.text(","); q.breakable()
6123 q.text("flags = ");
6124 q.text("%#x" % self.flags)
6125 q.text(","); q.breakable()
6126 q.text("group_id = ");
6127 q.text("%#x" % self.group_id)
6128 q.breakable()
6129 q.text('}')
6130
Rich Lane7dcdf022013-12-11 14:45:27 -08006131stats_request.subtypes[6] = group_stats_request
6132
6133class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006134 version = 2
6135 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07006136
6137 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006138 if xid != None:
6139 self.xid = xid
6140 else:
6141 self.xid = None
6142 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006143
6144 def pack(self):
6145 packed = []
6146 packed.append(struct.pack("!B", self.version))
6147 packed.append(struct.pack("!B", self.type))
6148 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6149 packed.append(struct.pack("!L", self.xid))
6150 length = sum([len(x) for x in packed])
6151 packed[2] = struct.pack("!H", length)
6152 return ''.join(packed)
6153
6154 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006155 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006156 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07006157 _version = reader.read("!B")[0]
6158 assert(_version == 2)
6159 _type = reader.read("!B")[0]
6160 assert(_type == 0)
6161 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006162 orig_reader = reader
6163 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006164 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006165 return obj
6166
6167 def __eq__(self, other):
6168 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006169 if self.xid != other.xid: return False
6170 return True
6171
Rich Lanec2ee4b82013-04-24 17:12:38 -07006172 def pretty_print(self, q):
6173 q.text("hello {")
6174 with q.group():
6175 with q.indent(2):
6176 q.breakable()
6177 q.text("xid = ");
6178 if self.xid != None:
6179 q.text("%#x" % self.xid)
6180 else:
6181 q.text('None')
6182 q.breakable()
6183 q.text('}')
6184
Rich Lane7dcdf022013-12-11 14:45:27 -08006185message.subtypes[0] = hello
6186
6187class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006188 version = 2
6189 type = 1
6190 err_type = 0
6191
6192 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006193 if xid != None:
6194 self.xid = xid
6195 else:
6196 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006197 if code != None:
6198 self.code = code
6199 else:
6200 self.code = 0
6201 if data != None:
6202 self.data = data
6203 else:
6204 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006205 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006206
6207 def pack(self):
6208 packed = []
6209 packed.append(struct.pack("!B", self.version))
6210 packed.append(struct.pack("!B", self.type))
6211 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6212 packed.append(struct.pack("!L", self.xid))
6213 packed.append(struct.pack("!H", self.err_type))
6214 packed.append(struct.pack("!H", self.code))
6215 packed.append(self.data)
6216 length = sum([len(x) for x in packed])
6217 packed[2] = struct.pack("!H", length)
6218 return ''.join(packed)
6219
6220 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006221 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006222 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006223 _version = reader.read("!B")[0]
6224 assert(_version == 2)
6225 _type = reader.read("!B")[0]
6226 assert(_type == 1)
6227 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006228 orig_reader = reader
6229 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006230 obj.xid = reader.read("!L")[0]
6231 _err_type = reader.read("!H")[0]
6232 assert(_err_type == 0)
6233 obj.code = reader.read("!H")[0]
6234 obj.data = str(reader.read_all())
6235 return obj
6236
6237 def __eq__(self, other):
6238 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006239 if self.xid != other.xid: return False
6240 if self.code != other.code: return False
6241 if self.data != other.data: return False
6242 return True
6243
Rich Lane6f4978c2013-10-20 21:33:52 -07006244 def pretty_print(self, q):
6245 q.text("hello_failed_error_msg {")
6246 with q.group():
6247 with q.indent(2):
6248 q.breakable()
6249 q.text("xid = ");
6250 if self.xid != None:
6251 q.text("%#x" % self.xid)
6252 else:
6253 q.text('None')
6254 q.text(","); q.breakable()
6255 q.text("code = ");
6256 q.text("%#x" % self.code)
6257 q.text(","); q.breakable()
6258 q.text("data = ");
6259 q.pp(self.data)
6260 q.breakable()
6261 q.text('}')
6262
Rich Lane7dcdf022013-12-11 14:45:27 -08006263error_msg.subtypes[0] = hello_failed_error_msg
6264
6265class nicira_header(experimenter):
6266 subtypes = {}
6267
Rich Lane95f7fc92014-01-27 17:08:16 -08006268 version = 2
6269 type = 4
6270 experimenter = 8992
6271
6272 def __init__(self, xid=None, subtype=None):
6273 if xid != None:
6274 self.xid = xid
6275 else:
6276 self.xid = None
6277 if subtype != None:
6278 self.subtype = subtype
6279 else:
6280 self.subtype = 0
6281 return
6282
6283 def pack(self):
6284 packed = []
6285 packed.append(struct.pack("!B", self.version))
6286 packed.append(struct.pack("!B", self.type))
6287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6288 packed.append(struct.pack("!L", self.xid))
6289 packed.append(struct.pack("!L", self.experimenter))
6290 packed.append(struct.pack("!L", self.subtype))
6291 length = sum([len(x) for x in packed])
6292 packed[2] = struct.pack("!H", length)
6293 return ''.join(packed)
6294
Rich Lane7dcdf022013-12-11 14:45:27 -08006295 @staticmethod
6296 def unpack(reader):
6297 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006298 subclass = nicira_header.subtypes.get(subtype)
6299 if subclass:
6300 return subclass.unpack(reader)
6301
6302 obj = nicira_header()
6303 _version = reader.read("!B")[0]
6304 assert(_version == 2)
6305 _type = reader.read("!B")[0]
6306 assert(_type == 4)
6307 _length = reader.read("!H")[0]
6308 orig_reader = reader
6309 reader = orig_reader.slice(_length - (2 + 2))
6310 obj.xid = reader.read("!L")[0]
6311 _experimenter = reader.read("!L")[0]
6312 assert(_experimenter == 8992)
6313 obj.subtype = reader.read("!L")[0]
6314 return obj
6315
6316 def __eq__(self, other):
6317 if type(self) != type(other): return False
6318 if self.xid != other.xid: return False
6319 if self.subtype != other.subtype: return False
6320 return True
6321
6322 def pretty_print(self, q):
6323 q.text("nicira_header {")
6324 with q.group():
6325 with q.indent(2):
6326 q.breakable()
6327 q.text("xid = ");
6328 if self.xid != None:
6329 q.text("%#x" % self.xid)
6330 else:
6331 q.text('None')
6332 q.breakable()
6333 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006334
6335experimenter.subtypes[8992] = nicira_header
6336
6337class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006338 version = 2
6339 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -07006340
6341 def __init__(self, xid=None, buffer_id=None, in_port=None, in_phy_port=None, total_len=None, reason=None, table_id=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006342 if xid != None:
6343 self.xid = xid
6344 else:
6345 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006346 if buffer_id != None:
6347 self.buffer_id = buffer_id
6348 else:
6349 self.buffer_id = 0
6350 if in_port != None:
6351 self.in_port = in_port
6352 else:
6353 self.in_port = 0
6354 if in_phy_port != None:
6355 self.in_phy_port = in_phy_port
6356 else:
6357 self.in_phy_port = 0
6358 if total_len != None:
6359 self.total_len = total_len
6360 else:
6361 self.total_len = 0
6362 if reason != None:
6363 self.reason = reason
6364 else:
6365 self.reason = 0
6366 if table_id != None:
6367 self.table_id = table_id
6368 else:
6369 self.table_id = 0
6370 if data != None:
6371 self.data = data
6372 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006373 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006374 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006375
6376 def pack(self):
6377 packed = []
6378 packed.append(struct.pack("!B", self.version))
6379 packed.append(struct.pack("!B", self.type))
6380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6381 packed.append(struct.pack("!L", self.xid))
6382 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006383 packed.append(util.pack_port_no(self.in_port))
6384 packed.append(util.pack_port_no(self.in_phy_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006385 packed.append(struct.pack("!H", self.total_len))
6386 packed.append(struct.pack("!B", self.reason))
6387 packed.append(struct.pack("!B", self.table_id))
6388 packed.append(self.data)
6389 length = sum([len(x) for x in packed])
6390 packed[2] = struct.pack("!H", length)
6391 return ''.join(packed)
6392
6393 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006394 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006395 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006396 _version = reader.read("!B")[0]
6397 assert(_version == 2)
6398 _type = reader.read("!B")[0]
6399 assert(_type == 10)
6400 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006401 orig_reader = reader
6402 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006403 obj.xid = reader.read("!L")[0]
6404 obj.buffer_id = reader.read("!L")[0]
6405 obj.in_port = util.unpack_port_no(reader)
6406 obj.in_phy_port = util.unpack_port_no(reader)
6407 obj.total_len = reader.read("!H")[0]
6408 obj.reason = reader.read("!B")[0]
6409 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006410 obj.data = str(reader.read_all())
6411 return obj
6412
6413 def __eq__(self, other):
6414 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006415 if self.xid != other.xid: return False
6416 if self.buffer_id != other.buffer_id: return False
6417 if self.in_port != other.in_port: return False
6418 if self.in_phy_port != other.in_phy_port: return False
6419 if self.total_len != other.total_len: return False
6420 if self.reason != other.reason: return False
6421 if self.table_id != other.table_id: return False
6422 if self.data != other.data: return False
6423 return True
6424
Rich Lanec2ee4b82013-04-24 17:12:38 -07006425 def pretty_print(self, q):
6426 q.text("packet_in {")
6427 with q.group():
6428 with q.indent(2):
6429 q.breakable()
6430 q.text("xid = ");
6431 if self.xid != None:
6432 q.text("%#x" % self.xid)
6433 else:
6434 q.text('None')
6435 q.text(","); q.breakable()
6436 q.text("buffer_id = ");
6437 q.text("%#x" % self.buffer_id)
6438 q.text(","); q.breakable()
6439 q.text("in_port = ");
6440 q.text(util.pretty_port(self.in_port))
6441 q.text(","); q.breakable()
6442 q.text("in_phy_port = ");
6443 q.text(util.pretty_port(self.in_phy_port))
6444 q.text(","); q.breakable()
6445 q.text("total_len = ");
6446 q.text("%#x" % self.total_len)
6447 q.text(","); q.breakable()
6448 q.text("reason = ");
6449 q.text("%#x" % self.reason)
6450 q.text(","); q.breakable()
6451 q.text("table_id = ");
6452 q.text("%#x" % self.table_id)
6453 q.text(","); q.breakable()
6454 q.text("data = ");
6455 q.pp(self.data)
6456 q.breakable()
6457 q.text('}')
6458
Rich Lane7dcdf022013-12-11 14:45:27 -08006459message.subtypes[10] = packet_in
6460
6461class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006462 version = 2
6463 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -07006464
6465 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006466 if xid != None:
6467 self.xid = xid
6468 else:
6469 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006470 if buffer_id != None:
6471 self.buffer_id = buffer_id
6472 else:
6473 self.buffer_id = 0
6474 if in_port != None:
6475 self.in_port = in_port
6476 else:
6477 self.in_port = 0
6478 if actions != None:
6479 self.actions = actions
6480 else:
6481 self.actions = []
6482 if data != None:
6483 self.data = data
6484 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006485 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006486 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006487
6488 def pack(self):
6489 packed = []
6490 packed.append(struct.pack("!B", self.version))
6491 packed.append(struct.pack("!B", self.type))
6492 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6493 packed.append(struct.pack("!L", self.xid))
6494 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006495 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006496 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
6497 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006498 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006499 packed[6] = struct.pack("!H", len(packed[-1]))
6500 packed.append(self.data)
6501 length = sum([len(x) for x in packed])
6502 packed[2] = struct.pack("!H", length)
6503 return ''.join(packed)
6504
6505 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006506 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006507 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006508 _version = reader.read("!B")[0]
6509 assert(_version == 2)
6510 _type = reader.read("!B")[0]
6511 assert(_type == 13)
6512 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006513 orig_reader = reader
6514 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006515 obj.xid = reader.read("!L")[0]
6516 obj.buffer_id = reader.read("!L")[0]
6517 obj.in_port = util.unpack_port_no(reader)
6518 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006519 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006520 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006521 obj.data = str(reader.read_all())
6522 return obj
6523
6524 def __eq__(self, other):
6525 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006526 if self.xid != other.xid: return False
6527 if self.buffer_id != other.buffer_id: return False
6528 if self.in_port != other.in_port: return False
6529 if self.actions != other.actions: return False
6530 if self.data != other.data: return False
6531 return True
6532
Rich Lanec2ee4b82013-04-24 17:12:38 -07006533 def pretty_print(self, q):
6534 q.text("packet_out {")
6535 with q.group():
6536 with q.indent(2):
6537 q.breakable()
6538 q.text("xid = ");
6539 if self.xid != None:
6540 q.text("%#x" % self.xid)
6541 else:
6542 q.text('None')
6543 q.text(","); q.breakable()
6544 q.text("buffer_id = ");
6545 q.text("%#x" % self.buffer_id)
6546 q.text(","); q.breakable()
6547 q.text("in_port = ");
6548 q.text(util.pretty_port(self.in_port))
6549 q.text(","); q.breakable()
6550 q.text("actions = ");
6551 q.pp(self.actions)
6552 q.text(","); q.breakable()
6553 q.text("data = ");
6554 q.pp(self.data)
6555 q.breakable()
6556 q.text('}')
6557
Rich Lane7dcdf022013-12-11 14:45:27 -08006558message.subtypes[13] = packet_out
6559
6560class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006561 version = 2
6562 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -07006563
6564 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006565 if xid != None:
6566 self.xid = xid
6567 else:
6568 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006569 if port_no != None:
6570 self.port_no = port_no
6571 else:
6572 self.port_no = 0
6573 if hw_addr != None:
6574 self.hw_addr = hw_addr
6575 else:
6576 self.hw_addr = [0,0,0,0,0,0]
6577 if config != None:
6578 self.config = config
6579 else:
6580 self.config = 0
6581 if mask != None:
6582 self.mask = mask
6583 else:
6584 self.mask = 0
6585 if advertise != None:
6586 self.advertise = advertise
6587 else:
6588 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006589 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006590
6591 def pack(self):
6592 packed = []
6593 packed.append(struct.pack("!B", self.version))
6594 packed.append(struct.pack("!B", self.type))
6595 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6596 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006597 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006598 packed.append('\x00' * 4)
6599 packed.append(struct.pack("!6B", *self.hw_addr))
6600 packed.append('\x00' * 2)
6601 packed.append(struct.pack("!L", self.config))
6602 packed.append(struct.pack("!L", self.mask))
6603 packed.append(struct.pack("!L", self.advertise))
6604 packed.append('\x00' * 4)
6605 length = sum([len(x) for x in packed])
6606 packed[2] = struct.pack("!H", length)
6607 return ''.join(packed)
6608
6609 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006610 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006611 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006612 _version = reader.read("!B")[0]
6613 assert(_version == 2)
6614 _type = reader.read("!B")[0]
6615 assert(_type == 16)
6616 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006617 orig_reader = reader
6618 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006619 obj.xid = reader.read("!L")[0]
6620 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006621 reader.skip(4)
6622 obj.hw_addr = list(reader.read('!6B'))
6623 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07006624 obj.config = reader.read("!L")[0]
6625 obj.mask = reader.read("!L")[0]
6626 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006627 reader.skip(4)
6628 return obj
6629
6630 def __eq__(self, other):
6631 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006632 if self.xid != other.xid: return False
6633 if self.port_no != other.port_no: return False
6634 if self.hw_addr != other.hw_addr: return False
6635 if self.config != other.config: return False
6636 if self.mask != other.mask: return False
6637 if self.advertise != other.advertise: return False
6638 return True
6639
Rich Lanec2ee4b82013-04-24 17:12:38 -07006640 def pretty_print(self, q):
6641 q.text("port_mod {")
6642 with q.group():
6643 with q.indent(2):
6644 q.breakable()
6645 q.text("xid = ");
6646 if self.xid != None:
6647 q.text("%#x" % self.xid)
6648 else:
6649 q.text('None')
6650 q.text(","); q.breakable()
6651 q.text("port_no = ");
6652 q.text(util.pretty_port(self.port_no))
6653 q.text(","); q.breakable()
6654 q.text("hw_addr = ");
6655 q.text(util.pretty_mac(self.hw_addr))
6656 q.text(","); q.breakable()
6657 q.text("config = ");
6658 q.text("%#x" % self.config)
6659 q.text(","); q.breakable()
6660 q.text("mask = ");
6661 q.text("%#x" % self.mask)
6662 q.text(","); q.breakable()
6663 q.text("advertise = ");
6664 q.text("%#x" % self.advertise)
6665 q.breakable()
6666 q.text('}')
6667
Rich Lane7dcdf022013-12-11 14:45:27 -08006668message.subtypes[16] = port_mod
6669
6670class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006671 version = 2
6672 type = 1
6673 err_type = 7
6674
6675 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006676 if xid != None:
6677 self.xid = xid
6678 else:
6679 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006680 if code != None:
6681 self.code = code
6682 else:
6683 self.code = 0
6684 if data != None:
6685 self.data = data
6686 else:
6687 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006688 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006689
6690 def pack(self):
6691 packed = []
6692 packed.append(struct.pack("!B", self.version))
6693 packed.append(struct.pack("!B", self.type))
6694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6695 packed.append(struct.pack("!L", self.xid))
6696 packed.append(struct.pack("!H", self.err_type))
6697 packed.append(struct.pack("!H", self.code))
6698 packed.append(self.data)
6699 length = sum([len(x) for x in packed])
6700 packed[2] = struct.pack("!H", length)
6701 return ''.join(packed)
6702
6703 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006704 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006705 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006706 _version = reader.read("!B")[0]
6707 assert(_version == 2)
6708 _type = reader.read("!B")[0]
6709 assert(_type == 1)
6710 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006711 orig_reader = reader
6712 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006713 obj.xid = reader.read("!L")[0]
6714 _err_type = reader.read("!H")[0]
6715 assert(_err_type == 7)
6716 obj.code = reader.read("!H")[0]
6717 obj.data = str(reader.read_all())
6718 return obj
6719
6720 def __eq__(self, other):
6721 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006722 if self.xid != other.xid: return False
6723 if self.code != other.code: return False
6724 if self.data != other.data: return False
6725 return True
6726
Rich Lane6f4978c2013-10-20 21:33:52 -07006727 def pretty_print(self, q):
6728 q.text("port_mod_failed_error_msg {")
6729 with q.group():
6730 with q.indent(2):
6731 q.breakable()
6732 q.text("xid = ");
6733 if self.xid != None:
6734 q.text("%#x" % self.xid)
6735 else:
6736 q.text('None')
6737 q.text(","); q.breakable()
6738 q.text("code = ");
6739 q.text("%#x" % self.code)
6740 q.text(","); q.breakable()
6741 q.text("data = ");
6742 q.pp(self.data)
6743 q.breakable()
6744 q.text('}')
6745
Rich Lane7dcdf022013-12-11 14:45:27 -08006746error_msg.subtypes[7] = port_mod_failed_error_msg
6747
6748class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006749 version = 2
6750 type = 19
6751 stats_type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07006752
6753 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006754 if xid != None:
6755 self.xid = xid
6756 else:
6757 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006758 if flags != None:
6759 self.flags = flags
6760 else:
6761 self.flags = 0
6762 if entries != None:
6763 self.entries = entries
6764 else:
6765 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006766 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006767
6768 def pack(self):
6769 packed = []
6770 packed.append(struct.pack("!B", self.version))
6771 packed.append(struct.pack("!B", self.type))
6772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6773 packed.append(struct.pack("!L", self.xid))
6774 packed.append(struct.pack("!H", self.stats_type))
6775 packed.append(struct.pack("!H", self.flags))
6776 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006777 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006778 length = sum([len(x) for x in packed])
6779 packed[2] = struct.pack("!H", length)
6780 return ''.join(packed)
6781
6782 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006783 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006784 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006785 _version = reader.read("!B")[0]
6786 assert(_version == 2)
6787 _type = reader.read("!B")[0]
6788 assert(_type == 19)
6789 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006790 orig_reader = reader
6791 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006792 obj.xid = reader.read("!L")[0]
6793 _stats_type = reader.read("!H")[0]
6794 assert(_stats_type == 4)
6795 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006796 reader.skip(4)
6797 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
6798 return obj
6799
6800 def __eq__(self, other):
6801 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006802 if self.xid != other.xid: return False
6803 if self.flags != other.flags: return False
6804 if self.entries != other.entries: return False
6805 return True
6806
Rich Lanec2ee4b82013-04-24 17:12:38 -07006807 def pretty_print(self, q):
6808 q.text("port_stats_reply {")
6809 with q.group():
6810 with q.indent(2):
6811 q.breakable()
6812 q.text("xid = ");
6813 if self.xid != None:
6814 q.text("%#x" % self.xid)
6815 else:
6816 q.text('None')
6817 q.text(","); q.breakable()
6818 q.text("flags = ");
6819 q.text("%#x" % self.flags)
6820 q.text(","); q.breakable()
6821 q.text("entries = ");
6822 q.pp(self.entries)
6823 q.breakable()
6824 q.text('}')
6825
Rich Lane7dcdf022013-12-11 14:45:27 -08006826stats_reply.subtypes[4] = port_stats_reply
6827
6828class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006829 version = 2
6830 type = 18
6831 stats_type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07006832
6833 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006834 if xid != None:
6835 self.xid = xid
6836 else:
6837 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006838 if flags != None:
6839 self.flags = flags
6840 else:
6841 self.flags = 0
6842 if port_no != None:
6843 self.port_no = port_no
6844 else:
6845 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006846 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006847
6848 def pack(self):
6849 packed = []
6850 packed.append(struct.pack("!B", self.version))
6851 packed.append(struct.pack("!B", self.type))
6852 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6853 packed.append(struct.pack("!L", self.xid))
6854 packed.append(struct.pack("!H", self.stats_type))
6855 packed.append(struct.pack("!H", self.flags))
6856 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006857 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006858 packed.append('\x00' * 4)
6859 length = sum([len(x) for x in packed])
6860 packed[2] = struct.pack("!H", length)
6861 return ''.join(packed)
6862
6863 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006864 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006865 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006866 _version = reader.read("!B")[0]
6867 assert(_version == 2)
6868 _type = reader.read("!B")[0]
6869 assert(_type == 18)
6870 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006871 orig_reader = reader
6872 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006873 obj.xid = reader.read("!L")[0]
6874 _stats_type = reader.read("!H")[0]
6875 assert(_stats_type == 4)
6876 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006877 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006878 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006879 reader.skip(4)
6880 return obj
6881
6882 def __eq__(self, other):
6883 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006884 if self.xid != other.xid: return False
6885 if self.flags != other.flags: return False
6886 if self.port_no != other.port_no: return False
6887 return True
6888
Rich Lanec2ee4b82013-04-24 17:12:38 -07006889 def pretty_print(self, q):
6890 q.text("port_stats_request {")
6891 with q.group():
6892 with q.indent(2):
6893 q.breakable()
6894 q.text("xid = ");
6895 if self.xid != None:
6896 q.text("%#x" % self.xid)
6897 else:
6898 q.text('None')
6899 q.text(","); q.breakable()
6900 q.text("flags = ");
6901 q.text("%#x" % self.flags)
6902 q.text(","); q.breakable()
6903 q.text("port_no = ");
6904 q.text(util.pretty_port(self.port_no))
6905 q.breakable()
6906 q.text('}')
6907
Rich Lane7dcdf022013-12-11 14:45:27 -08006908stats_request.subtypes[4] = port_stats_request
6909
6910class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006911 version = 2
6912 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -07006913
6914 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006915 if xid != None:
6916 self.xid = xid
6917 else:
6918 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006919 if reason != None:
6920 self.reason = reason
6921 else:
6922 self.reason = 0
6923 if desc != None:
6924 self.desc = desc
6925 else:
6926 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006927 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006928
6929 def pack(self):
6930 packed = []
6931 packed.append(struct.pack("!B", self.version))
6932 packed.append(struct.pack("!B", self.type))
6933 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6934 packed.append(struct.pack("!L", self.xid))
6935 packed.append(struct.pack("!B", self.reason))
6936 packed.append('\x00' * 7)
6937 packed.append(self.desc.pack())
6938 length = sum([len(x) for x in packed])
6939 packed[2] = struct.pack("!H", length)
6940 return ''.join(packed)
6941
6942 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006943 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006944 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006945 _version = reader.read("!B")[0]
6946 assert(_version == 2)
6947 _type = reader.read("!B")[0]
6948 assert(_type == 12)
6949 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006950 orig_reader = reader
6951 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006952 obj.xid = reader.read("!L")[0]
6953 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006954 reader.skip(7)
6955 obj.desc = common.port_desc.unpack(reader)
6956 return obj
6957
6958 def __eq__(self, other):
6959 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006960 if self.xid != other.xid: return False
6961 if self.reason != other.reason: return False
6962 if self.desc != other.desc: return False
6963 return True
6964
Rich Lanec2ee4b82013-04-24 17:12:38 -07006965 def pretty_print(self, q):
6966 q.text("port_status {")
6967 with q.group():
6968 with q.indent(2):
6969 q.breakable()
6970 q.text("xid = ");
6971 if self.xid != None:
6972 q.text("%#x" % self.xid)
6973 else:
6974 q.text('None')
6975 q.text(","); q.breakable()
6976 q.text("reason = ");
6977 q.text("%#x" % self.reason)
6978 q.text(","); q.breakable()
6979 q.text("desc = ");
6980 q.pp(self.desc)
6981 q.breakable()
6982 q.text('}')
6983
Rich Lane7dcdf022013-12-11 14:45:27 -08006984message.subtypes[12] = port_status
6985
6986class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006987 version = 2
6988 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07006989
6990 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006991 if xid != None:
6992 self.xid = xid
6993 else:
6994 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006995 if port != None:
6996 self.port = port
6997 else:
6998 self.port = 0
6999 if queues != None:
7000 self.queues = queues
7001 else:
7002 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007003 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007004
7005 def pack(self):
7006 packed = []
7007 packed.append(struct.pack("!B", self.version))
7008 packed.append(struct.pack("!B", self.type))
7009 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7010 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07007011 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007012 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007013 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007014 length = sum([len(x) for x in packed])
7015 packed[2] = struct.pack("!H", length)
7016 return ''.join(packed)
7017
7018 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007019 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007020 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007021 _version = reader.read("!B")[0]
7022 assert(_version == 2)
7023 _type = reader.read("!B")[0]
7024 assert(_type == 23)
7025 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007026 orig_reader = reader
7027 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007028 obj.xid = reader.read("!L")[0]
7029 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007030 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007031 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007032 return obj
7033
7034 def __eq__(self, other):
7035 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007036 if self.xid != other.xid: return False
7037 if self.port != other.port: return False
7038 if self.queues != other.queues: return False
7039 return True
7040
Rich Lanec2ee4b82013-04-24 17:12:38 -07007041 def pretty_print(self, q):
7042 q.text("queue_get_config_reply {")
7043 with q.group():
7044 with q.indent(2):
7045 q.breakable()
7046 q.text("xid = ");
7047 if self.xid != None:
7048 q.text("%#x" % self.xid)
7049 else:
7050 q.text('None')
7051 q.text(","); q.breakable()
7052 q.text("port = ");
7053 q.text(util.pretty_port(self.port))
7054 q.text(","); q.breakable()
7055 q.text("queues = ");
7056 q.pp(self.queues)
7057 q.breakable()
7058 q.text('}')
7059
Rich Lane7dcdf022013-12-11 14:45:27 -08007060message.subtypes[23] = queue_get_config_reply
7061
7062class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007063 version = 2
7064 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -07007065
7066 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007067 if xid != None:
7068 self.xid = xid
7069 else:
7070 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007071 if port != None:
7072 self.port = port
7073 else:
7074 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007075 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007076
7077 def pack(self):
7078 packed = []
7079 packed.append(struct.pack("!B", self.version))
7080 packed.append(struct.pack("!B", self.type))
7081 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7082 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07007083 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007084 packed.append('\x00' * 4)
7085 length = sum([len(x) for x in packed])
7086 packed[2] = struct.pack("!H", length)
7087 return ''.join(packed)
7088
7089 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007090 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007091 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007092 _version = reader.read("!B")[0]
7093 assert(_version == 2)
7094 _type = reader.read("!B")[0]
7095 assert(_type == 22)
7096 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007097 orig_reader = reader
7098 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007099 obj.xid = reader.read("!L")[0]
7100 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007101 reader.skip(4)
7102 return obj
7103
7104 def __eq__(self, other):
7105 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007106 if self.xid != other.xid: return False
7107 if self.port != other.port: return False
7108 return True
7109
Rich Lanec2ee4b82013-04-24 17:12:38 -07007110 def pretty_print(self, q):
7111 q.text("queue_get_config_request {")
7112 with q.group():
7113 with q.indent(2):
7114 q.breakable()
7115 q.text("xid = ");
7116 if self.xid != None:
7117 q.text("%#x" % self.xid)
7118 else:
7119 q.text('None')
7120 q.text(","); q.breakable()
7121 q.text("port = ");
7122 q.text(util.pretty_port(self.port))
7123 q.breakable()
7124 q.text('}')
7125
Rich Lane7dcdf022013-12-11 14:45:27 -08007126message.subtypes[22] = queue_get_config_request
7127
7128class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007129 version = 2
7130 type = 1
7131 err_type = 9
7132
7133 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007134 if xid != None:
7135 self.xid = xid
7136 else:
7137 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007138 if code != None:
7139 self.code = code
7140 else:
7141 self.code = 0
7142 if data != None:
7143 self.data = data
7144 else:
7145 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007146 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007147
7148 def pack(self):
7149 packed = []
7150 packed.append(struct.pack("!B", self.version))
7151 packed.append(struct.pack("!B", self.type))
7152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7153 packed.append(struct.pack("!L", self.xid))
7154 packed.append(struct.pack("!H", self.err_type))
7155 packed.append(struct.pack("!H", self.code))
7156 packed.append(self.data)
7157 length = sum([len(x) for x in packed])
7158 packed[2] = struct.pack("!H", length)
7159 return ''.join(packed)
7160
7161 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007162 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007163 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007164 _version = reader.read("!B")[0]
7165 assert(_version == 2)
7166 _type = reader.read("!B")[0]
7167 assert(_type == 1)
7168 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007169 orig_reader = reader
7170 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007171 obj.xid = reader.read("!L")[0]
7172 _err_type = reader.read("!H")[0]
7173 assert(_err_type == 9)
7174 obj.code = reader.read("!H")[0]
7175 obj.data = str(reader.read_all())
7176 return obj
7177
7178 def __eq__(self, other):
7179 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007180 if self.xid != other.xid: return False
7181 if self.code != other.code: return False
7182 if self.data != other.data: return False
7183 return True
7184
Rich Lane6f4978c2013-10-20 21:33:52 -07007185 def pretty_print(self, q):
7186 q.text("queue_op_failed_error_msg {")
7187 with q.group():
7188 with q.indent(2):
7189 q.breakable()
7190 q.text("xid = ");
7191 if self.xid != None:
7192 q.text("%#x" % self.xid)
7193 else:
7194 q.text('None')
7195 q.text(","); q.breakable()
7196 q.text("code = ");
7197 q.text("%#x" % self.code)
7198 q.text(","); q.breakable()
7199 q.text("data = ");
7200 q.pp(self.data)
7201 q.breakable()
7202 q.text('}')
7203
Rich Lane7dcdf022013-12-11 14:45:27 -08007204error_msg.subtypes[9] = queue_op_failed_error_msg
7205
7206class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007207 version = 2
7208 type = 19
7209 stats_type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007210
7211 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007212 if xid != None:
7213 self.xid = xid
7214 else:
7215 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007216 if flags != None:
7217 self.flags = flags
7218 else:
7219 self.flags = 0
7220 if entries != None:
7221 self.entries = entries
7222 else:
7223 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007224 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007225
7226 def pack(self):
7227 packed = []
7228 packed.append(struct.pack("!B", self.version))
7229 packed.append(struct.pack("!B", self.type))
7230 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7231 packed.append(struct.pack("!L", self.xid))
7232 packed.append(struct.pack("!H", self.stats_type))
7233 packed.append(struct.pack("!H", self.flags))
7234 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007235 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007236 length = sum([len(x) for x in packed])
7237 packed[2] = struct.pack("!H", length)
7238 return ''.join(packed)
7239
7240 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007241 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007242 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007243 _version = reader.read("!B")[0]
7244 assert(_version == 2)
7245 _type = reader.read("!B")[0]
7246 assert(_type == 19)
7247 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007248 orig_reader = reader
7249 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007250 obj.xid = reader.read("!L")[0]
7251 _stats_type = reader.read("!H")[0]
7252 assert(_stats_type == 5)
7253 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007254 reader.skip(4)
7255 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
7256 return obj
7257
7258 def __eq__(self, other):
7259 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007260 if self.xid != other.xid: return False
7261 if self.flags != other.flags: return False
7262 if self.entries != other.entries: return False
7263 return True
7264
Rich Lanec2ee4b82013-04-24 17:12:38 -07007265 def pretty_print(self, q):
7266 q.text("queue_stats_reply {")
7267 with q.group():
7268 with q.indent(2):
7269 q.breakable()
7270 q.text("xid = ");
7271 if self.xid != None:
7272 q.text("%#x" % self.xid)
7273 else:
7274 q.text('None')
7275 q.text(","); q.breakable()
7276 q.text("flags = ");
7277 q.text("%#x" % self.flags)
7278 q.text(","); q.breakable()
7279 q.text("entries = ");
7280 q.pp(self.entries)
7281 q.breakable()
7282 q.text('}')
7283
Rich Lane7dcdf022013-12-11 14:45:27 -08007284stats_reply.subtypes[5] = queue_stats_reply
7285
7286class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007287 version = 2
7288 type = 18
7289 stats_type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007290
7291 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007292 if xid != None:
7293 self.xid = xid
7294 else:
7295 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007296 if flags != None:
7297 self.flags = flags
7298 else:
7299 self.flags = 0
7300 if port_no != None:
7301 self.port_no = port_no
7302 else:
7303 self.port_no = 0
7304 if queue_id != None:
7305 self.queue_id = queue_id
7306 else:
7307 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007308 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007309
7310 def pack(self):
7311 packed = []
7312 packed.append(struct.pack("!B", self.version))
7313 packed.append(struct.pack("!B", self.type))
7314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7315 packed.append(struct.pack("!L", self.xid))
7316 packed.append(struct.pack("!H", self.stats_type))
7317 packed.append(struct.pack("!H", self.flags))
7318 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007319 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007320 packed.append(struct.pack("!L", self.queue_id))
7321 length = sum([len(x) for x in packed])
7322 packed[2] = struct.pack("!H", length)
7323 return ''.join(packed)
7324
7325 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007326 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007327 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007328 _version = reader.read("!B")[0]
7329 assert(_version == 2)
7330 _type = reader.read("!B")[0]
7331 assert(_type == 18)
7332 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007333 orig_reader = reader
7334 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007335 obj.xid = reader.read("!L")[0]
7336 _stats_type = reader.read("!H")[0]
7337 assert(_stats_type == 5)
7338 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007339 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07007340 obj.port_no = util.unpack_port_no(reader)
7341 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007342 return obj
7343
7344 def __eq__(self, other):
7345 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007346 if self.xid != other.xid: return False
7347 if self.flags != other.flags: return False
7348 if self.port_no != other.port_no: return False
7349 if self.queue_id != other.queue_id: return False
7350 return True
7351
Rich Lanec2ee4b82013-04-24 17:12:38 -07007352 def pretty_print(self, q):
7353 q.text("queue_stats_request {")
7354 with q.group():
7355 with q.indent(2):
7356 q.breakable()
7357 q.text("xid = ");
7358 if self.xid != None:
7359 q.text("%#x" % self.xid)
7360 else:
7361 q.text('None')
7362 q.text(","); q.breakable()
7363 q.text("flags = ");
7364 q.text("%#x" % self.flags)
7365 q.text(","); q.breakable()
7366 q.text("port_no = ");
7367 q.text(util.pretty_port(self.port_no))
7368 q.text(","); q.breakable()
7369 q.text("queue_id = ");
7370 q.text("%#x" % self.queue_id)
7371 q.breakable()
7372 q.text('}')
7373
Rich Lane7dcdf022013-12-11 14:45:27 -08007374stats_request.subtypes[5] = queue_stats_request
7375
7376class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007377 version = 2
7378 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -07007379
7380 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007381 if xid != None:
7382 self.xid = xid
7383 else:
7384 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007385 if flags != None:
7386 self.flags = flags
7387 else:
7388 self.flags = 0
7389 if miss_send_len != None:
7390 self.miss_send_len = miss_send_len
7391 else:
7392 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007393 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007394
7395 def pack(self):
7396 packed = []
7397 packed.append(struct.pack("!B", self.version))
7398 packed.append(struct.pack("!B", self.type))
7399 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7400 packed.append(struct.pack("!L", self.xid))
7401 packed.append(struct.pack("!H", self.flags))
7402 packed.append(struct.pack("!H", self.miss_send_len))
7403 length = sum([len(x) for x in packed])
7404 packed[2] = struct.pack("!H", length)
7405 return ''.join(packed)
7406
7407 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007408 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007409 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007410 _version = reader.read("!B")[0]
7411 assert(_version == 2)
7412 _type = reader.read("!B")[0]
7413 assert(_type == 9)
7414 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007415 orig_reader = reader
7416 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007417 obj.xid = reader.read("!L")[0]
7418 obj.flags = reader.read("!H")[0]
7419 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007420 return obj
7421
7422 def __eq__(self, other):
7423 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007424 if self.xid != other.xid: return False
7425 if self.flags != other.flags: return False
7426 if self.miss_send_len != other.miss_send_len: return False
7427 return True
7428
Rich Lanec2ee4b82013-04-24 17:12:38 -07007429 def pretty_print(self, q):
7430 q.text("set_config {")
7431 with q.group():
7432 with q.indent(2):
7433 q.breakable()
7434 q.text("xid = ");
7435 if self.xid != None:
7436 q.text("%#x" % self.xid)
7437 else:
7438 q.text('None')
7439 q.text(","); q.breakable()
7440 q.text("flags = ");
7441 q.text("%#x" % self.flags)
7442 q.text(","); q.breakable()
7443 q.text("miss_send_len = ");
7444 q.text("%#x" % self.miss_send_len)
7445 q.breakable()
7446 q.text('}')
7447
Rich Lane7dcdf022013-12-11 14:45:27 -08007448message.subtypes[9] = set_config
7449
7450class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007451 version = 2
7452 type = 1
7453 err_type = 10
7454
7455 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007456 if xid != None:
7457 self.xid = xid
7458 else:
7459 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007460 if code != None:
7461 self.code = code
7462 else:
7463 self.code = 0
7464 if data != None:
7465 self.data = data
7466 else:
7467 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007468 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007469
7470 def pack(self):
7471 packed = []
7472 packed.append(struct.pack("!B", self.version))
7473 packed.append(struct.pack("!B", self.type))
7474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7475 packed.append(struct.pack("!L", self.xid))
7476 packed.append(struct.pack("!H", self.err_type))
7477 packed.append(struct.pack("!H", self.code))
7478 packed.append(self.data)
7479 length = sum([len(x) for x in packed])
7480 packed[2] = struct.pack("!H", length)
7481 return ''.join(packed)
7482
7483 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007484 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007485 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007486 _version = reader.read("!B")[0]
7487 assert(_version == 2)
7488 _type = reader.read("!B")[0]
7489 assert(_type == 1)
7490 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007491 orig_reader = reader
7492 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007493 obj.xid = reader.read("!L")[0]
7494 _err_type = reader.read("!H")[0]
7495 assert(_err_type == 10)
7496 obj.code = reader.read("!H")[0]
7497 obj.data = str(reader.read_all())
7498 return obj
7499
7500 def __eq__(self, other):
7501 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007502 if self.xid != other.xid: return False
7503 if self.code != other.code: return False
7504 if self.data != other.data: return False
7505 return True
7506
Rich Lane6f4978c2013-10-20 21:33:52 -07007507 def pretty_print(self, q):
7508 q.text("switch_config_failed_error_msg {")
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("code = ");
7519 q.text("%#x" % self.code)
7520 q.text(","); q.breakable()
7521 q.text("data = ");
7522 q.pp(self.data)
7523 q.breakable()
7524 q.text('}')
7525
Rich Lane7dcdf022013-12-11 14:45:27 -08007526error_msg.subtypes[10] = switch_config_failed_error_msg
7527
7528class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007529 version = 2
7530 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -07007531
7532 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007533 if xid != None:
7534 self.xid = xid
7535 else:
7536 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007537 if table_id != None:
7538 self.table_id = table_id
7539 else:
7540 self.table_id = 0
7541 if config != None:
7542 self.config = config
7543 else:
7544 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007545 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007546
7547 def pack(self):
7548 packed = []
7549 packed.append(struct.pack("!B", self.version))
7550 packed.append(struct.pack("!B", self.type))
7551 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7552 packed.append(struct.pack("!L", self.xid))
7553 packed.append(struct.pack("!B", self.table_id))
7554 packed.append('\x00' * 3)
7555 packed.append(struct.pack("!L", self.config))
7556 length = sum([len(x) for x in packed])
7557 packed[2] = struct.pack("!H", length)
7558 return ''.join(packed)
7559
7560 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007561 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007562 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007563 _version = reader.read("!B")[0]
7564 assert(_version == 2)
7565 _type = reader.read("!B")[0]
7566 assert(_type == 17)
7567 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007568 orig_reader = reader
7569 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007570 obj.xid = reader.read("!L")[0]
7571 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007572 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007573 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007574 return obj
7575
7576 def __eq__(self, other):
7577 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007578 if self.xid != other.xid: return False
7579 if self.table_id != other.table_id: return False
7580 if self.config != other.config: return False
7581 return True
7582
Rich Lanec2ee4b82013-04-24 17:12:38 -07007583 def pretty_print(self, q):
7584 q.text("table_mod {")
7585 with q.group():
7586 with q.indent(2):
7587 q.breakable()
7588 q.text("xid = ");
7589 if self.xid != None:
7590 q.text("%#x" % self.xid)
7591 else:
7592 q.text('None')
7593 q.text(","); q.breakable()
7594 q.text("table_id = ");
7595 q.text("%#x" % self.table_id)
7596 q.text(","); q.breakable()
7597 q.text("config = ");
7598 q.text("%#x" % self.config)
7599 q.breakable()
7600 q.text('}')
7601
Rich Lane7dcdf022013-12-11 14:45:27 -08007602message.subtypes[17] = table_mod
7603
7604class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007605 version = 2
7606 type = 1
7607 err_type = 8
7608
7609 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007610 if xid != None:
7611 self.xid = xid
7612 else:
7613 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007614 if code != None:
7615 self.code = code
7616 else:
7617 self.code = 0
7618 if data != None:
7619 self.data = data
7620 else:
7621 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007622 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007623
7624 def pack(self):
7625 packed = []
7626 packed.append(struct.pack("!B", self.version))
7627 packed.append(struct.pack("!B", self.type))
7628 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7629 packed.append(struct.pack("!L", self.xid))
7630 packed.append(struct.pack("!H", self.err_type))
7631 packed.append(struct.pack("!H", self.code))
7632 packed.append(self.data)
7633 length = sum([len(x) for x in packed])
7634 packed[2] = struct.pack("!H", length)
7635 return ''.join(packed)
7636
7637 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007638 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007639 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007640 _version = reader.read("!B")[0]
7641 assert(_version == 2)
7642 _type = reader.read("!B")[0]
7643 assert(_type == 1)
7644 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007645 orig_reader = reader
7646 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007647 obj.xid = reader.read("!L")[0]
7648 _err_type = reader.read("!H")[0]
7649 assert(_err_type == 8)
7650 obj.code = reader.read("!H")[0]
7651 obj.data = str(reader.read_all())
7652 return obj
7653
7654 def __eq__(self, other):
7655 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007656 if self.xid != other.xid: return False
7657 if self.code != other.code: return False
7658 if self.data != other.data: return False
7659 return True
7660
Rich Lane6f4978c2013-10-20 21:33:52 -07007661 def pretty_print(self, q):
7662 q.text("table_mod_failed_error_msg {")
7663 with q.group():
7664 with q.indent(2):
7665 q.breakable()
7666 q.text("xid = ");
7667 if self.xid != None:
7668 q.text("%#x" % self.xid)
7669 else:
7670 q.text('None')
7671 q.text(","); q.breakable()
7672 q.text("code = ");
7673 q.text("%#x" % self.code)
7674 q.text(","); q.breakable()
7675 q.text("data = ");
7676 q.pp(self.data)
7677 q.breakable()
7678 q.text('}')
7679
Rich Lane7dcdf022013-12-11 14:45:27 -08007680error_msg.subtypes[8] = table_mod_failed_error_msg
7681
7682class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007683 version = 2
7684 type = 19
7685 stats_type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007686
7687 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007688 if xid != None:
7689 self.xid = xid
7690 else:
7691 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007692 if flags != None:
7693 self.flags = flags
7694 else:
7695 self.flags = 0
7696 if entries != None:
7697 self.entries = entries
7698 else:
7699 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007700 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007701
7702 def pack(self):
7703 packed = []
7704 packed.append(struct.pack("!B", self.version))
7705 packed.append(struct.pack("!B", self.type))
7706 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7707 packed.append(struct.pack("!L", self.xid))
7708 packed.append(struct.pack("!H", self.stats_type))
7709 packed.append(struct.pack("!H", self.flags))
7710 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007711 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007712 length = sum([len(x) for x in packed])
7713 packed[2] = struct.pack("!H", length)
7714 return ''.join(packed)
7715
7716 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007717 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007718 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007719 _version = reader.read("!B")[0]
7720 assert(_version == 2)
7721 _type = reader.read("!B")[0]
7722 assert(_type == 19)
7723 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007724 orig_reader = reader
7725 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007726 obj.xid = reader.read("!L")[0]
7727 _stats_type = reader.read("!H")[0]
7728 assert(_stats_type == 3)
7729 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007730 reader.skip(4)
7731 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
7732 return obj
7733
7734 def __eq__(self, other):
7735 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007736 if self.xid != other.xid: return False
7737 if self.flags != other.flags: return False
7738 if self.entries != other.entries: return False
7739 return True
7740
Rich Lanec2ee4b82013-04-24 17:12:38 -07007741 def pretty_print(self, q):
7742 q.text("table_stats_reply {")
7743 with q.group():
7744 with q.indent(2):
7745 q.breakable()
7746 q.text("xid = ");
7747 if self.xid != None:
7748 q.text("%#x" % self.xid)
7749 else:
7750 q.text('None')
7751 q.text(","); q.breakable()
7752 q.text("flags = ");
7753 q.text("%#x" % self.flags)
7754 q.text(","); q.breakable()
7755 q.text("entries = ");
7756 q.pp(self.entries)
7757 q.breakable()
7758 q.text('}')
7759
Rich Lane7dcdf022013-12-11 14:45:27 -08007760stats_reply.subtypes[3] = table_stats_reply
7761
7762class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007763 version = 2
7764 type = 18
7765 stats_type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007766
7767 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007768 if xid != None:
7769 self.xid = xid
7770 else:
7771 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007772 if flags != None:
7773 self.flags = flags
7774 else:
7775 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007776 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007777
7778 def pack(self):
7779 packed = []
7780 packed.append(struct.pack("!B", self.version))
7781 packed.append(struct.pack("!B", self.type))
7782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7783 packed.append(struct.pack("!L", self.xid))
7784 packed.append(struct.pack("!H", self.stats_type))
7785 packed.append(struct.pack("!H", self.flags))
7786 packed.append('\x00' * 4)
7787 length = sum([len(x) for x in packed])
7788 packed[2] = struct.pack("!H", length)
7789 return ''.join(packed)
7790
7791 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007792 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007793 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007794 _version = reader.read("!B")[0]
7795 assert(_version == 2)
7796 _type = reader.read("!B")[0]
7797 assert(_type == 18)
7798 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007799 orig_reader = reader
7800 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007801 obj.xid = reader.read("!L")[0]
7802 _stats_type = reader.read("!H")[0]
7803 assert(_stats_type == 3)
7804 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007805 reader.skip(4)
7806 return obj
7807
7808 def __eq__(self, other):
7809 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007810 if self.xid != other.xid: return False
7811 if self.flags != other.flags: return False
7812 return True
7813
Rich Lanec2ee4b82013-04-24 17:12:38 -07007814 def pretty_print(self, q):
7815 q.text("table_stats_request {")
7816 with q.group():
7817 with q.indent(2):
7818 q.breakable()
7819 q.text("xid = ");
7820 if self.xid != None:
7821 q.text("%#x" % self.xid)
7822 else:
7823 q.text('None')
7824 q.text(","); q.breakable()
7825 q.text("flags = ");
7826 q.text("%#x" % self.flags)
7827 q.breakable()
7828 q.text('}')
7829
Rich Lane7dcdf022013-12-11 14:45:27 -08007830stats_request.subtypes[3] = table_stats_request
7831
Rich Lanec2ee4b82013-04-24 17:12:38 -07007832
7833def parse_header(buf):
7834 if len(buf) < 8:
7835 raise loxi.ProtocolError("too short to be an OpenFlow message")
7836 return struct.unpack_from("!BBHL", buf)
7837
7838def parse_message(buf):
7839 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -07007840 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
7841 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007842 if len(buf) != msg_len:
7843 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007844 return message.unpack(loxi.generic_util.OFReader(buf))