blob: 24b4e942680fcf61e721acd6ef1d760c6e7a72a1 [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 Laneb658ddd2013-03-12 10:15:10 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Laneb658ddd2013-03-12 10:15:10 -07007# Do not modify
8
9import struct
10import loxi
11import const
Rich Lane7dcdf022013-12-11 14:45:27 -080012import action
Harshmeet Singh1db46332014-10-14 16:29:13 -070013import message
14import common
Rich Laneb658ddd2013-03-12 10:15:10 -070015import util
Rich Lanec2ee4b82013-04-24 17:12:38 -070016import loxi.generic_util
Rich Laneb658ddd2013-03-12 10:15:10 -070017
Rich Lane7dcdf022013-12-11 14:45:27 -080018class message(loxi.OFObject):
19 subtypes = {}
Rich Laneb658ddd2013-03-12 10:15:10 -070020
Rich Lane95f7fc92014-01-27 17:08:16 -080021 version = 1
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 == 1)
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 = 1
85 type = 17
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 length = sum([len(x) for x in packed])
111 packed[2] = struct.pack("!H", length)
112 return ''.join(packed)
113
Rich Lane7dcdf022013-12-11 14:45:27 -0800114 @staticmethod
115 def unpack(reader):
116 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800117 subclass = stats_reply.subtypes.get(subtype)
118 if subclass:
119 return subclass.unpack(reader)
120
121 obj = stats_reply()
122 _version = reader.read("!B")[0]
123 assert(_version == 1)
124 _type = reader.read("!B")[0]
125 assert(_type == 17)
126 _length = reader.read("!H")[0]
127 orig_reader = reader
128 reader = orig_reader.slice(_length - (2 + 2))
129 obj.xid = reader.read("!L")[0]
130 obj.stats_type = reader.read("!H")[0]
131 obj.flags = reader.read("!H")[0]
132 return obj
133
134 def __eq__(self, other):
135 if type(self) != type(other): return False
136 if self.xid != other.xid: return False
137 if self.stats_type != other.stats_type: return False
138 if self.flags != other.flags: return False
139 return True
140
141 def pretty_print(self, q):
142 q.text("stats_reply {")
143 with q.group():
144 with q.indent(2):
145 q.breakable()
146 q.text("xid = ");
147 if self.xid != None:
148 q.text("%#x" % self.xid)
149 else:
150 q.text('None')
151 q.text(","); q.breakable()
152 q.text("flags = ");
153 q.text("%#x" % self.flags)
154 q.breakable()
155 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800156
157message.subtypes[17] = stats_reply
158
159class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700160 version = 1
161 type = 17
162 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700163
Rich Lanec2ee4b82013-04-24 17:12:38 -0700164 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800165 if xid != None:
166 self.xid = xid
167 else:
168 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700169 if flags != None:
170 self.flags = flags
171 else:
172 self.flags = 0
173 if packet_count != None:
174 self.packet_count = packet_count
175 else:
176 self.packet_count = 0
177 if byte_count != None:
178 self.byte_count = byte_count
179 else:
180 self.byte_count = 0
181 if flow_count != None:
182 self.flow_count = flow_count
183 else:
184 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800185 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700186
187 def pack(self):
188 packed = []
189 packed.append(struct.pack("!B", self.version))
190 packed.append(struct.pack("!B", self.type))
191 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
192 packed.append(struct.pack("!L", self.xid))
193 packed.append(struct.pack("!H", self.stats_type))
194 packed.append(struct.pack("!H", self.flags))
195 packed.append(struct.pack("!Q", self.packet_count))
196 packed.append(struct.pack("!Q", self.byte_count))
197 packed.append(struct.pack("!L", self.flow_count))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700198 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700199 length = sum([len(x) for x in packed])
200 packed[2] = struct.pack("!H", length)
201 return ''.join(packed)
202
203 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800204 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700205 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700206 _version = reader.read("!B")[0]
207 assert(_version == 1)
208 _type = reader.read("!B")[0]
209 assert(_type == 17)
210 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800211 orig_reader = reader
212 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700213 obj.xid = reader.read("!L")[0]
214 _stats_type = reader.read("!H")[0]
215 assert(_stats_type == 2)
216 obj.flags = reader.read("!H")[0]
217 obj.packet_count = reader.read("!Q")[0]
218 obj.byte_count = reader.read("!Q")[0]
219 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700220 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700221 return obj
222
223 def __eq__(self, other):
224 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700225 if self.xid != other.xid: return False
226 if self.flags != other.flags: return False
227 if self.packet_count != other.packet_count: return False
228 if self.byte_count != other.byte_count: return False
229 if self.flow_count != other.flow_count: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700230 return True
231
Rich Laneb658ddd2013-03-12 10:15:10 -0700232 def pretty_print(self, q):
233 q.text("aggregate_stats_reply {")
234 with q.group():
235 with q.indent(2):
236 q.breakable()
237 q.text("xid = ");
238 if self.xid != None:
239 q.text("%#x" % self.xid)
240 else:
241 q.text('None')
242 q.text(","); q.breakable()
243 q.text("flags = ");
244 q.text("%#x" % self.flags)
245 q.text(","); q.breakable()
246 q.text("packet_count = ");
247 q.text("%#x" % self.packet_count)
248 q.text(","); q.breakable()
249 q.text("byte_count = ");
250 q.text("%#x" % self.byte_count)
251 q.text(","); q.breakable()
252 q.text("flow_count = ");
253 q.text("%#x" % self.flow_count)
Rich Laneb658ddd2013-03-12 10:15:10 -0700254 q.breakable()
255 q.text('}')
256
Rich Lane7dcdf022013-12-11 14:45:27 -0800257stats_reply.subtypes[2] = aggregate_stats_reply
258
259class stats_request(message):
260 subtypes = {}
261
Rich Lane95f7fc92014-01-27 17:08:16 -0800262 version = 1
263 type = 16
264
265 def __init__(self, xid=None, stats_type=None, flags=None):
266 if xid != None:
267 self.xid = xid
268 else:
269 self.xid = None
270 if stats_type != None:
271 self.stats_type = stats_type
272 else:
273 self.stats_type = 0
274 if flags != None:
275 self.flags = flags
276 else:
277 self.flags = 0
278 return
279
280 def pack(self):
281 packed = []
282 packed.append(struct.pack("!B", self.version))
283 packed.append(struct.pack("!B", self.type))
284 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
285 packed.append(struct.pack("!L", self.xid))
286 packed.append(struct.pack("!H", self.stats_type))
287 packed.append(struct.pack("!H", self.flags))
288 length = sum([len(x) for x in packed])
289 packed[2] = struct.pack("!H", length)
290 return ''.join(packed)
291
Rich Lane7dcdf022013-12-11 14:45:27 -0800292 @staticmethod
293 def unpack(reader):
294 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800295 subclass = stats_request.subtypes.get(subtype)
296 if subclass:
297 return subclass.unpack(reader)
298
299 obj = stats_request()
300 _version = reader.read("!B")[0]
301 assert(_version == 1)
302 _type = reader.read("!B")[0]
303 assert(_type == 16)
304 _length = reader.read("!H")[0]
305 orig_reader = reader
306 reader = orig_reader.slice(_length - (2 + 2))
307 obj.xid = reader.read("!L")[0]
308 obj.stats_type = reader.read("!H")[0]
309 obj.flags = reader.read("!H")[0]
310 return obj
311
312 def __eq__(self, other):
313 if type(self) != type(other): return False
314 if self.xid != other.xid: return False
315 if self.stats_type != other.stats_type: return False
316 if self.flags != other.flags: return False
317 return True
318
319 def pretty_print(self, q):
320 q.text("stats_request {")
321 with q.group():
322 with q.indent(2):
323 q.breakable()
324 q.text("xid = ");
325 if self.xid != None:
326 q.text("%#x" % self.xid)
327 else:
328 q.text('None')
329 q.text(","); q.breakable()
330 q.text("flags = ");
331 q.text("%#x" % self.flags)
332 q.breakable()
333 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800334
335message.subtypes[16] = stats_request
336
337class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700338 version = 1
339 type = 16
340 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700341
Rich Lanec2ee4b82013-04-24 17:12:38 -0700342 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800343 if xid != None:
344 self.xid = xid
345 else:
346 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700347 if flags != None:
348 self.flags = flags
349 else:
350 self.flags = 0
351 if match != None:
352 self.match = match
353 else:
354 self.match = common.match()
355 if table_id != None:
356 self.table_id = table_id
357 else:
358 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -0700359 if out_port != None:
360 self.out_port = out_port
361 else:
362 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800363 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700364
365 def pack(self):
366 packed = []
367 packed.append(struct.pack("!B", self.version))
368 packed.append(struct.pack("!B", self.type))
369 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
370 packed.append(struct.pack("!L", self.xid))
371 packed.append(struct.pack("!H", self.stats_type))
372 packed.append(struct.pack("!H", self.flags))
373 packed.append(self.match.pack())
374 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700375 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700376 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -0700377 length = sum([len(x) for x in packed])
378 packed[2] = struct.pack("!H", length)
379 return ''.join(packed)
380
381 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800382 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700383 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700384 _version = reader.read("!B")[0]
385 assert(_version == 1)
386 _type = reader.read("!B")[0]
387 assert(_type == 16)
388 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800389 orig_reader = reader
390 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700391 obj.xid = reader.read("!L")[0]
392 _stats_type = reader.read("!H")[0]
393 assert(_stats_type == 2)
394 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700395 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -0700396 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700397 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700398 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -0700399 return obj
400
401 def __eq__(self, other):
402 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700403 if self.xid != other.xid: return False
404 if self.flags != other.flags: return False
405 if self.match != other.match: return False
406 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700407 if self.out_port != other.out_port: return False
408 return True
409
Rich Laneb658ddd2013-03-12 10:15:10 -0700410 def pretty_print(self, q):
411 q.text("aggregate_stats_request {")
412 with q.group():
413 with q.indent(2):
414 q.breakable()
415 q.text("xid = ");
416 if self.xid != None:
417 q.text("%#x" % self.xid)
418 else:
419 q.text('None')
420 q.text(","); q.breakable()
421 q.text("flags = ");
422 q.text("%#x" % self.flags)
423 q.text(","); q.breakable()
424 q.text("match = ");
425 q.pp(self.match)
426 q.text(","); q.breakable()
427 q.text("table_id = ");
428 q.text("%#x" % self.table_id)
429 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -0700430 q.text("out_port = ");
431 q.text(util.pretty_port(self.out_port))
432 q.breakable()
433 q.text('}')
434
Rich Lane7dcdf022013-12-11 14:45:27 -0800435stats_request.subtypes[2] = aggregate_stats_request
436
437class error_msg(message):
438 subtypes = {}
439
Rich Lane95f7fc92014-01-27 17:08:16 -0800440 version = 1
441 type = 1
442
443 def __init__(self, xid=None, err_type=None):
444 if xid != None:
445 self.xid = xid
446 else:
447 self.xid = None
448 if err_type != None:
449 self.err_type = err_type
450 else:
451 self.err_type = 0
452 return
453
454 def pack(self):
455 packed = []
456 packed.append(struct.pack("!B", self.version))
457 packed.append(struct.pack("!B", self.type))
458 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
459 packed.append(struct.pack("!L", self.xid))
460 packed.append(struct.pack("!H", self.err_type))
461 length = sum([len(x) for x in packed])
462 packed[2] = struct.pack("!H", length)
463 return ''.join(packed)
464
Rich Lane7dcdf022013-12-11 14:45:27 -0800465 @staticmethod
466 def unpack(reader):
467 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800468 subclass = error_msg.subtypes.get(subtype)
469 if subclass:
470 return subclass.unpack(reader)
471
472 obj = error_msg()
473 _version = reader.read("!B")[0]
474 assert(_version == 1)
475 _type = reader.read("!B")[0]
476 assert(_type == 1)
477 _length = reader.read("!H")[0]
478 orig_reader = reader
479 reader = orig_reader.slice(_length - (2 + 2))
480 obj.xid = reader.read("!L")[0]
481 obj.err_type = reader.read("!H")[0]
482 return obj
483
484 def __eq__(self, other):
485 if type(self) != type(other): return False
486 if self.xid != other.xid: return False
487 if self.err_type != other.err_type: return False
488 return True
489
490 def pretty_print(self, q):
491 q.text("error_msg {")
492 with q.group():
493 with q.indent(2):
494 q.breakable()
495 q.text("xid = ");
496 if self.xid != None:
497 q.text("%#x" % self.xid)
498 else:
499 q.text('None')
500 q.breakable()
501 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800502
503message.subtypes[1] = error_msg
504
505class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700506 version = 1
507 type = 1
508 err_type = 2
509
510 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800511 if xid != None:
512 self.xid = xid
513 else:
514 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700515 if code != None:
516 self.code = code
517 else:
518 self.code = 0
519 if data != None:
520 self.data = data
521 else:
522 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800523 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700524
525 def pack(self):
526 packed = []
527 packed.append(struct.pack("!B", self.version))
528 packed.append(struct.pack("!B", self.type))
529 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
530 packed.append(struct.pack("!L", self.xid))
531 packed.append(struct.pack("!H", self.err_type))
532 packed.append(struct.pack("!H", self.code))
533 packed.append(self.data)
534 length = sum([len(x) for x in packed])
535 packed[2] = struct.pack("!H", length)
536 return ''.join(packed)
537
538 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800539 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700540 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700541 _version = reader.read("!B")[0]
542 assert(_version == 1)
543 _type = reader.read("!B")[0]
544 assert(_type == 1)
545 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800546 orig_reader = reader
547 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700548 obj.xid = reader.read("!L")[0]
549 _err_type = reader.read("!H")[0]
550 assert(_err_type == 2)
551 obj.code = reader.read("!H")[0]
552 obj.data = str(reader.read_all())
553 return obj
554
555 def __eq__(self, other):
556 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700557 if self.xid != other.xid: return False
558 if self.code != other.code: return False
559 if self.data != other.data: return False
560 return True
561
Rich Lane6f4978c2013-10-20 21:33:52 -0700562 def pretty_print(self, q):
563 q.text("bad_action_error_msg {")
564 with q.group():
565 with q.indent(2):
566 q.breakable()
567 q.text("xid = ");
568 if self.xid != None:
569 q.text("%#x" % self.xid)
570 else:
571 q.text('None')
572 q.text(","); q.breakable()
573 q.text("code = ");
574 q.text("%#x" % self.code)
575 q.text(","); q.breakable()
576 q.text("data = ");
577 q.pp(self.data)
578 q.breakable()
579 q.text('}')
580
Rich Lane7dcdf022013-12-11 14:45:27 -0800581error_msg.subtypes[2] = bad_action_error_msg
582
583class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700584 version = 1
585 type = 1
586 err_type = 1
587
588 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800589 if xid != None:
590 self.xid = xid
591 else:
592 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700593 if code != None:
594 self.code = code
595 else:
596 self.code = 0
597 if data != None:
598 self.data = data
599 else:
600 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800601 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700602
603 def pack(self):
604 packed = []
605 packed.append(struct.pack("!B", self.version))
606 packed.append(struct.pack("!B", self.type))
607 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
608 packed.append(struct.pack("!L", self.xid))
609 packed.append(struct.pack("!H", self.err_type))
610 packed.append(struct.pack("!H", self.code))
611 packed.append(self.data)
612 length = sum([len(x) for x in packed])
613 packed[2] = struct.pack("!H", length)
614 return ''.join(packed)
615
616 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800617 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700618 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700619 _version = reader.read("!B")[0]
620 assert(_version == 1)
621 _type = reader.read("!B")[0]
622 assert(_type == 1)
623 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800624 orig_reader = reader
625 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700626 obj.xid = reader.read("!L")[0]
627 _err_type = reader.read("!H")[0]
628 assert(_err_type == 1)
629 obj.code = reader.read("!H")[0]
630 obj.data = str(reader.read_all())
631 return obj
632
633 def __eq__(self, other):
634 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700635 if self.xid != other.xid: return False
636 if self.code != other.code: return False
637 if self.data != other.data: return False
638 return True
639
Rich Lane6f4978c2013-10-20 21:33:52 -0700640 def pretty_print(self, q):
641 q.text("bad_request_error_msg {")
642 with q.group():
643 with q.indent(2):
644 q.breakable()
645 q.text("xid = ");
646 if self.xid != None:
647 q.text("%#x" % self.xid)
648 else:
649 q.text('None')
650 q.text(","); q.breakable()
651 q.text("code = ");
652 q.text("%#x" % self.code)
653 q.text(","); q.breakable()
654 q.text("data = ");
655 q.pp(self.data)
656 q.breakable()
657 q.text('}')
658
Rich Lane7dcdf022013-12-11 14:45:27 -0800659error_msg.subtypes[1] = bad_request_error_msg
660
661class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700662 version = 1
663 type = 19
Rich Laneb658ddd2013-03-12 10:15:10 -0700664
665 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800666 if xid != None:
667 self.xid = xid
668 else:
669 self.xid = None
670 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700671
672 def pack(self):
673 packed = []
674 packed.append(struct.pack("!B", self.version))
675 packed.append(struct.pack("!B", self.type))
676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
677 packed.append(struct.pack("!L", self.xid))
678 length = sum([len(x) for x in packed])
679 packed[2] = struct.pack("!H", length)
680 return ''.join(packed)
681
682 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800683 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700684 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700685 _version = reader.read("!B")[0]
686 assert(_version == 1)
687 _type = reader.read("!B")[0]
688 assert(_type == 19)
689 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800690 orig_reader = reader
691 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700692 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700693 return obj
694
695 def __eq__(self, other):
696 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700697 if self.xid != other.xid: return False
698 return True
699
Rich Laneb658ddd2013-03-12 10:15:10 -0700700 def pretty_print(self, q):
701 q.text("barrier_reply {")
702 with q.group():
703 with q.indent(2):
704 q.breakable()
705 q.text("xid = ");
706 if self.xid != None:
707 q.text("%#x" % self.xid)
708 else:
709 q.text('None')
710 q.breakable()
711 q.text('}')
712
Rich Lane7dcdf022013-12-11 14:45:27 -0800713message.subtypes[19] = barrier_reply
714
715class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700716 version = 1
717 type = 18
Rich Laneb658ddd2013-03-12 10:15:10 -0700718
719 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800720 if xid != None:
721 self.xid = xid
722 else:
723 self.xid = None
724 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700725
726 def pack(self):
727 packed = []
728 packed.append(struct.pack("!B", self.version))
729 packed.append(struct.pack("!B", self.type))
730 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
731 packed.append(struct.pack("!L", self.xid))
732 length = sum([len(x) for x in packed])
733 packed[2] = struct.pack("!H", length)
734 return ''.join(packed)
735
736 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800737 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700738 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700739 _version = reader.read("!B")[0]
740 assert(_version == 1)
741 _type = reader.read("!B")[0]
742 assert(_type == 18)
743 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800744 orig_reader = reader
745 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700746 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700747 return obj
748
749 def __eq__(self, other):
750 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700751 if self.xid != other.xid: return False
752 return True
753
Rich Laneb658ddd2013-03-12 10:15:10 -0700754 def pretty_print(self, q):
755 q.text("barrier_request {")
756 with q.group():
757 with q.indent(2):
758 q.breakable()
759 q.text("xid = ");
760 if self.xid != None:
761 q.text("%#x" % self.xid)
762 else:
763 q.text('None')
764 q.breakable()
765 q.text('}')
766
Rich Lane7dcdf022013-12-11 14:45:27 -0800767message.subtypes[18] = barrier_request
768
769class experimenter(message):
770 subtypes = {}
771
Rich Lane95f7fc92014-01-27 17:08:16 -0800772 version = 1
773 type = 4
774
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700775 def __init__(self, xid=None, experimenter=None, data=None):
Rich Lane95f7fc92014-01-27 17:08:16 -0800776 if xid != None:
777 self.xid = xid
778 else:
779 self.xid = None
780 if experimenter != None:
781 self.experimenter = experimenter
782 else:
783 self.experimenter = 0
Rich Lane95f7fc92014-01-27 17:08:16 -0800784 if data != None:
785 self.data = data
786 else:
787 self.data = ''
788 return
789
790 def pack(self):
791 packed = []
792 packed.append(struct.pack("!B", self.version))
793 packed.append(struct.pack("!B", self.type))
794 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
795 packed.append(struct.pack("!L", self.xid))
796 packed.append(struct.pack("!L", self.experimenter))
Rich Lane95f7fc92014-01-27 17:08:16 -0800797 packed.append(self.data)
798 length = sum([len(x) for x in packed])
799 packed[2] = struct.pack("!H", length)
800 return ''.join(packed)
801
Rich Lane7dcdf022013-12-11 14:45:27 -0800802 @staticmethod
803 def unpack(reader):
804 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800805 subclass = experimenter.subtypes.get(subtype)
806 if subclass:
807 return subclass.unpack(reader)
808
809 obj = experimenter()
810 _version = reader.read("!B")[0]
811 assert(_version == 1)
812 _type = reader.read("!B")[0]
813 assert(_type == 4)
814 _length = reader.read("!H")[0]
815 orig_reader = reader
816 reader = orig_reader.slice(_length - (2 + 2))
817 obj.xid = reader.read("!L")[0]
818 obj.experimenter = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800819 obj.data = str(reader.read_all())
820 return obj
821
822 def __eq__(self, other):
823 if type(self) != type(other): return False
824 if self.xid != other.xid: return False
825 if self.experimenter != other.experimenter: return False
Rich Lane95f7fc92014-01-27 17:08:16 -0800826 if self.data != other.data: return False
827 return True
828
829 def pretty_print(self, q):
830 q.text("experimenter {")
831 with q.group():
832 with q.indent(2):
833 q.breakable()
834 q.text("xid = ");
835 if self.xid != None:
836 q.text("%#x" % self.xid)
837 else:
838 q.text('None')
839 q.text(","); q.breakable()
Rich Lane95f7fc92014-01-27 17:08:16 -0800840 q.text("data = ");
841 q.pp(self.data)
842 q.breakable()
843 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800844
845message.subtypes[4] = experimenter
846
847class bsn_header(experimenter):
848 subtypes = {}
849
Rich Lane95f7fc92014-01-27 17:08:16 -0800850 version = 1
851 type = 4
852 experimenter = 6035143
853
854 def __init__(self, xid=None, subtype=None):
855 if xid != None:
856 self.xid = xid
857 else:
858 self.xid = None
859 if subtype != None:
860 self.subtype = subtype
861 else:
862 self.subtype = 0
863 return
864
865 def pack(self):
866 packed = []
867 packed.append(struct.pack("!B", self.version))
868 packed.append(struct.pack("!B", self.type))
869 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
870 packed.append(struct.pack("!L", self.xid))
871 packed.append(struct.pack("!L", self.experimenter))
872 packed.append(struct.pack("!L", self.subtype))
873 length = sum([len(x) for x in packed])
874 packed[2] = struct.pack("!H", length)
875 return ''.join(packed)
876
Rich Lane7dcdf022013-12-11 14:45:27 -0800877 @staticmethod
878 def unpack(reader):
879 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -0800880 subclass = bsn_header.subtypes.get(subtype)
881 if subclass:
882 return subclass.unpack(reader)
883
884 obj = bsn_header()
885 _version = reader.read("!B")[0]
886 assert(_version == 1)
887 _type = reader.read("!B")[0]
888 assert(_type == 4)
889 _length = reader.read("!H")[0]
890 orig_reader = reader
891 reader = orig_reader.slice(_length - (2 + 2))
892 obj.xid = reader.read("!L")[0]
893 _experimenter = reader.read("!L")[0]
894 assert(_experimenter == 6035143)
895 obj.subtype = reader.read("!L")[0]
896 return obj
897
898 def __eq__(self, other):
899 if type(self) != type(other): return False
900 if self.xid != other.xid: return False
901 if self.subtype != other.subtype: return False
902 return True
903
904 def pretty_print(self, q):
905 q.text("bsn_header {")
906 with q.group():
907 with q.indent(2):
908 q.breakable()
909 q.text("xid = ");
910 if self.xid != None:
911 q.text("%#x" % self.xid)
912 else:
913 q.text('None')
914 q.breakable()
915 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800916
917experimenter.subtypes[6035143] = bsn_header
918
919class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700920 version = 1
921 type = 4
922 experimenter = 6035143
923 subtype = 22
924
925 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800926 if xid != None:
927 self.xid = xid
928 else:
929 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700930 if status != None:
931 self.status = status
932 else:
933 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800934 return
Dan Talaycof6202252013-07-02 01:00:29 -0700935
936 def pack(self):
937 packed = []
938 packed.append(struct.pack("!B", self.version))
939 packed.append(struct.pack("!B", self.type))
940 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
941 packed.append(struct.pack("!L", self.xid))
942 packed.append(struct.pack("!L", self.experimenter))
943 packed.append(struct.pack("!L", self.subtype))
944 packed.append(struct.pack("!L", self.status))
945 length = sum([len(x) for x in packed])
946 packed[2] = struct.pack("!H", length)
947 return ''.join(packed)
948
949 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800950 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700951 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700952 _version = reader.read("!B")[0]
953 assert(_version == 1)
954 _type = reader.read("!B")[0]
955 assert(_type == 4)
956 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800957 orig_reader = reader
958 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700959 obj.xid = reader.read("!L")[0]
960 _experimenter = reader.read("!L")[0]
961 assert(_experimenter == 6035143)
962 _subtype = reader.read("!L")[0]
963 assert(_subtype == 22)
964 obj.status = reader.read("!L")[0]
965 return obj
966
967 def __eq__(self, other):
968 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700969 if self.xid != other.xid: return False
970 if self.status != other.status: return False
971 return True
972
Dan Talaycof6202252013-07-02 01:00:29 -0700973 def pretty_print(self, q):
974 q.text("bsn_bw_clear_data_reply {")
975 with q.group():
976 with q.indent(2):
977 q.breakable()
978 q.text("xid = ");
979 if self.xid != None:
980 q.text("%#x" % self.xid)
981 else:
982 q.text('None')
983 q.text(","); q.breakable()
984 q.text("status = ");
985 q.text("%#x" % self.status)
986 q.breakable()
987 q.text('}')
988
Rich Lane7dcdf022013-12-11 14:45:27 -0800989bsn_header.subtypes[22] = bsn_bw_clear_data_reply
990
991class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700992 version = 1
993 type = 4
994 experimenter = 6035143
995 subtype = 21
996
997 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800998 if xid != None:
999 self.xid = xid
1000 else:
1001 self.xid = None
1002 return
Dan Talaycof6202252013-07-02 01:00:29 -07001003
1004 def pack(self):
1005 packed = []
1006 packed.append(struct.pack("!B", self.version))
1007 packed.append(struct.pack("!B", self.type))
1008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1009 packed.append(struct.pack("!L", self.xid))
1010 packed.append(struct.pack("!L", self.experimenter))
1011 packed.append(struct.pack("!L", self.subtype))
1012 length = sum([len(x) for x in packed])
1013 packed[2] = struct.pack("!H", length)
1014 return ''.join(packed)
1015
1016 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001017 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001018 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001019 _version = reader.read("!B")[0]
1020 assert(_version == 1)
1021 _type = reader.read("!B")[0]
1022 assert(_type == 4)
1023 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001024 orig_reader = reader
1025 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001026 obj.xid = reader.read("!L")[0]
1027 _experimenter = reader.read("!L")[0]
1028 assert(_experimenter == 6035143)
1029 _subtype = reader.read("!L")[0]
1030 assert(_subtype == 21)
1031 return obj
1032
1033 def __eq__(self, other):
1034 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001035 if self.xid != other.xid: return False
1036 return True
1037
Dan Talaycof6202252013-07-02 01:00:29 -07001038 def pretty_print(self, q):
1039 q.text("bsn_bw_clear_data_request {")
1040 with q.group():
1041 with q.indent(2):
1042 q.breakable()
1043 q.text("xid = ");
1044 if self.xid != None:
1045 q.text("%#x" % self.xid)
1046 else:
1047 q.text('None')
1048 q.breakable()
1049 q.text('}')
1050
Rich Lane7dcdf022013-12-11 14:45:27 -08001051bsn_header.subtypes[21] = bsn_bw_clear_data_request
1052
1053class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001054 version = 1
1055 type = 4
1056 experimenter = 6035143
1057 subtype = 20
1058
1059 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001060 if xid != None:
1061 self.xid = xid
1062 else:
1063 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001064 if enabled != None:
1065 self.enabled = enabled
1066 else:
1067 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001068 return
Dan Talaycof6202252013-07-02 01:00:29 -07001069
1070 def pack(self):
1071 packed = []
1072 packed.append(struct.pack("!B", self.version))
1073 packed.append(struct.pack("!B", self.type))
1074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1075 packed.append(struct.pack("!L", self.xid))
1076 packed.append(struct.pack("!L", self.experimenter))
1077 packed.append(struct.pack("!L", self.subtype))
1078 packed.append(struct.pack("!L", self.enabled))
1079 length = sum([len(x) for x in packed])
1080 packed[2] = struct.pack("!H", length)
1081 return ''.join(packed)
1082
1083 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001084 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001085 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001086 _version = reader.read("!B")[0]
1087 assert(_version == 1)
1088 _type = reader.read("!B")[0]
1089 assert(_type == 4)
1090 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001091 orig_reader = reader
1092 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001093 obj.xid = reader.read("!L")[0]
1094 _experimenter = reader.read("!L")[0]
1095 assert(_experimenter == 6035143)
1096 _subtype = reader.read("!L")[0]
1097 assert(_subtype == 20)
1098 obj.enabled = reader.read("!L")[0]
1099 return obj
1100
1101 def __eq__(self, other):
1102 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001103 if self.xid != other.xid: return False
1104 if self.enabled != other.enabled: return False
1105 return True
1106
Dan Talaycof6202252013-07-02 01:00:29 -07001107 def pretty_print(self, q):
1108 q.text("bsn_bw_enable_get_reply {")
1109 with q.group():
1110 with q.indent(2):
1111 q.breakable()
1112 q.text("xid = ");
1113 if self.xid != None:
1114 q.text("%#x" % self.xid)
1115 else:
1116 q.text('None')
1117 q.text(","); q.breakable()
1118 q.text("enabled = ");
1119 q.text("%#x" % self.enabled)
1120 q.breakable()
1121 q.text('}')
1122
Rich Lane7dcdf022013-12-11 14:45:27 -08001123bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1124
1125class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001126 version = 1
1127 type = 4
1128 experimenter = 6035143
1129 subtype = 19
1130
1131 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001132 if xid != None:
1133 self.xid = xid
1134 else:
1135 self.xid = None
1136 return
Dan Talaycof6202252013-07-02 01:00:29 -07001137
1138 def pack(self):
1139 packed = []
1140 packed.append(struct.pack("!B", self.version))
1141 packed.append(struct.pack("!B", self.type))
1142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1143 packed.append(struct.pack("!L", self.xid))
1144 packed.append(struct.pack("!L", self.experimenter))
1145 packed.append(struct.pack("!L", self.subtype))
1146 length = sum([len(x) for x in packed])
1147 packed[2] = struct.pack("!H", length)
1148 return ''.join(packed)
1149
1150 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001151 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001152 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001153 _version = reader.read("!B")[0]
1154 assert(_version == 1)
1155 _type = reader.read("!B")[0]
1156 assert(_type == 4)
1157 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001158 orig_reader = reader
1159 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001160 obj.xid = reader.read("!L")[0]
1161 _experimenter = reader.read("!L")[0]
1162 assert(_experimenter == 6035143)
1163 _subtype = reader.read("!L")[0]
1164 assert(_subtype == 19)
1165 return obj
1166
1167 def __eq__(self, other):
1168 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001169 if self.xid != other.xid: return False
1170 return True
1171
Dan Talaycof6202252013-07-02 01:00:29 -07001172 def pretty_print(self, q):
1173 q.text("bsn_bw_enable_get_request {")
1174 with q.group():
1175 with q.indent(2):
1176 q.breakable()
1177 q.text("xid = ");
1178 if self.xid != None:
1179 q.text("%#x" % self.xid)
1180 else:
1181 q.text('None')
1182 q.breakable()
1183 q.text('}')
1184
Rich Lane7dcdf022013-12-11 14:45:27 -08001185bsn_header.subtypes[19] = bsn_bw_enable_get_request
1186
1187class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001188 version = 1
1189 type = 4
1190 experimenter = 6035143
1191 subtype = 23
1192
1193 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001194 if xid != None:
1195 self.xid = xid
1196 else:
1197 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001198 if enable != None:
1199 self.enable = enable
1200 else:
1201 self.enable = 0
1202 if status != None:
1203 self.status = status
1204 else:
1205 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001206 return
Dan Talaycof6202252013-07-02 01:00:29 -07001207
1208 def pack(self):
1209 packed = []
1210 packed.append(struct.pack("!B", self.version))
1211 packed.append(struct.pack("!B", self.type))
1212 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1213 packed.append(struct.pack("!L", self.xid))
1214 packed.append(struct.pack("!L", self.experimenter))
1215 packed.append(struct.pack("!L", self.subtype))
1216 packed.append(struct.pack("!L", self.enable))
1217 packed.append(struct.pack("!L", self.status))
1218 length = sum([len(x) for x in packed])
1219 packed[2] = struct.pack("!H", length)
1220 return ''.join(packed)
1221
1222 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001223 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001224 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001225 _version = reader.read("!B")[0]
1226 assert(_version == 1)
1227 _type = reader.read("!B")[0]
1228 assert(_type == 4)
1229 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001230 orig_reader = reader
1231 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001232 obj.xid = reader.read("!L")[0]
1233 _experimenter = reader.read("!L")[0]
1234 assert(_experimenter == 6035143)
1235 _subtype = reader.read("!L")[0]
1236 assert(_subtype == 23)
1237 obj.enable = reader.read("!L")[0]
1238 obj.status = reader.read("!L")[0]
1239 return obj
1240
1241 def __eq__(self, other):
1242 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001243 if self.xid != other.xid: return False
1244 if self.enable != other.enable: return False
1245 if self.status != other.status: return False
1246 return True
1247
Dan Talaycof6202252013-07-02 01:00:29 -07001248 def pretty_print(self, q):
1249 q.text("bsn_bw_enable_set_reply {")
1250 with q.group():
1251 with q.indent(2):
1252 q.breakable()
1253 q.text("xid = ");
1254 if self.xid != None:
1255 q.text("%#x" % self.xid)
1256 else:
1257 q.text('None')
1258 q.text(","); q.breakable()
1259 q.text("enable = ");
1260 q.text("%#x" % self.enable)
1261 q.text(","); q.breakable()
1262 q.text("status = ");
1263 q.text("%#x" % self.status)
1264 q.breakable()
1265 q.text('}')
1266
Rich Lane7dcdf022013-12-11 14:45:27 -08001267bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1268
1269class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001270 version = 1
1271 type = 4
1272 experimenter = 6035143
1273 subtype = 18
1274
1275 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001276 if xid != None:
1277 self.xid = xid
1278 else:
1279 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001280 if enable != None:
1281 self.enable = enable
1282 else:
1283 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001284 return
Dan Talaycof6202252013-07-02 01:00:29 -07001285
1286 def pack(self):
1287 packed = []
1288 packed.append(struct.pack("!B", self.version))
1289 packed.append(struct.pack("!B", self.type))
1290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1291 packed.append(struct.pack("!L", self.xid))
1292 packed.append(struct.pack("!L", self.experimenter))
1293 packed.append(struct.pack("!L", self.subtype))
1294 packed.append(struct.pack("!L", self.enable))
1295 length = sum([len(x) for x in packed])
1296 packed[2] = struct.pack("!H", length)
1297 return ''.join(packed)
1298
1299 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001300 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001301 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001302 _version = reader.read("!B")[0]
1303 assert(_version == 1)
1304 _type = reader.read("!B")[0]
1305 assert(_type == 4)
1306 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001307 orig_reader = reader
1308 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001309 obj.xid = reader.read("!L")[0]
1310 _experimenter = reader.read("!L")[0]
1311 assert(_experimenter == 6035143)
1312 _subtype = reader.read("!L")[0]
1313 assert(_subtype == 18)
1314 obj.enable = reader.read("!L")[0]
1315 return obj
1316
1317 def __eq__(self, other):
1318 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001319 if self.xid != other.xid: return False
1320 if self.enable != other.enable: return False
1321 return True
1322
Dan Talaycof6202252013-07-02 01:00:29 -07001323 def pretty_print(self, q):
1324 q.text("bsn_bw_enable_set_request {")
1325 with q.group():
1326 with q.indent(2):
1327 q.breakable()
1328 q.text("xid = ");
1329 if self.xid != None:
1330 q.text("%#x" % self.xid)
1331 else:
1332 q.text('None')
1333 q.text(","); q.breakable()
1334 q.text("enable = ");
1335 q.text("%#x" % self.enable)
1336 q.breakable()
1337 q.text('}')
1338
Rich Lane7dcdf022013-12-11 14:45:27 -08001339bsn_header.subtypes[18] = bsn_bw_enable_set_request
1340
1341class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001342 version = 1
1343 type = 4
1344 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001345 subtype = 10
1346
1347 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001348 if xid != None:
1349 self.xid = xid
1350 else:
1351 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001352 if interfaces != None:
1353 self.interfaces = interfaces
1354 else:
1355 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001356 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001357
1358 def pack(self):
1359 packed = []
1360 packed.append(struct.pack("!B", self.version))
1361 packed.append(struct.pack("!B", self.type))
1362 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1363 packed.append(struct.pack("!L", self.xid))
1364 packed.append(struct.pack("!L", self.experimenter))
1365 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001366 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Laneb658ddd2013-03-12 10:15:10 -07001367 length = sum([len(x) for x in packed])
1368 packed[2] = struct.pack("!H", length)
1369 return ''.join(packed)
1370
1371 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001372 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001373 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001374 _version = reader.read("!B")[0]
1375 assert(_version == 1)
1376 _type = reader.read("!B")[0]
1377 assert(_type == 4)
1378 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001379 orig_reader = reader
1380 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001381 obj.xid = reader.read("!L")[0]
1382 _experimenter = reader.read("!L")[0]
1383 assert(_experimenter == 6035143)
1384 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001385 assert(_subtype == 10)
1386 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07001387 return obj
1388
1389 def __eq__(self, other):
1390 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001391 if self.xid != other.xid: return False
1392 if self.interfaces != other.interfaces: return False
1393 return True
1394
Rich Laneb658ddd2013-03-12 10:15:10 -07001395 def pretty_print(self, q):
1396 q.text("bsn_get_interfaces_reply {")
1397 with q.group():
1398 with q.indent(2):
1399 q.breakable()
1400 q.text("xid = ");
1401 if self.xid != None:
1402 q.text("%#x" % self.xid)
1403 else:
1404 q.text('None')
1405 q.text(","); q.breakable()
1406 q.text("interfaces = ");
1407 q.pp(self.interfaces)
1408 q.breakable()
1409 q.text('}')
1410
Rich Lane7dcdf022013-12-11 14:45:27 -08001411bsn_header.subtypes[10] = bsn_get_interfaces_reply
1412
1413class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001414 version = 1
1415 type = 4
1416 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001417 subtype = 9
1418
1419 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001420 if xid != None:
1421 self.xid = xid
1422 else:
1423 self.xid = None
1424 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001425
1426 def pack(self):
1427 packed = []
1428 packed.append(struct.pack("!B", self.version))
1429 packed.append(struct.pack("!B", self.type))
1430 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1431 packed.append(struct.pack("!L", self.xid))
1432 packed.append(struct.pack("!L", self.experimenter))
1433 packed.append(struct.pack("!L", self.subtype))
1434 length = sum([len(x) for x in packed])
1435 packed[2] = struct.pack("!H", length)
1436 return ''.join(packed)
1437
1438 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001439 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001440 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001441 _version = reader.read("!B")[0]
1442 assert(_version == 1)
1443 _type = reader.read("!B")[0]
1444 assert(_type == 4)
1445 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001446 orig_reader = reader
1447 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001448 obj.xid = reader.read("!L")[0]
1449 _experimenter = reader.read("!L")[0]
1450 assert(_experimenter == 6035143)
1451 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001452 assert(_subtype == 9)
Rich Laneb658ddd2013-03-12 10:15:10 -07001453 return obj
1454
1455 def __eq__(self, other):
1456 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001457 if self.xid != other.xid: return False
1458 return True
1459
Rich Laneb658ddd2013-03-12 10:15:10 -07001460 def pretty_print(self, q):
1461 q.text("bsn_get_interfaces_request {")
1462 with q.group():
1463 with q.indent(2):
1464 q.breakable()
1465 q.text("xid = ");
1466 if self.xid != None:
1467 q.text("%#x" % self.xid)
1468 else:
1469 q.text('None')
1470 q.breakable()
1471 q.text('}')
1472
Rich Lane7dcdf022013-12-11 14:45:27 -08001473bsn_header.subtypes[9] = bsn_get_interfaces_request
1474
1475class bsn_get_ip_mask_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001476 version = 1
1477 type = 4
1478 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001479 subtype = 2
1480
Rich Lanec2ee4b82013-04-24 17:12:38 -07001481 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001482 if xid != None:
1483 self.xid = xid
1484 else:
1485 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001486 if index != None:
1487 self.index = index
1488 else:
1489 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07001490 if mask != None:
1491 self.mask = mask
1492 else:
1493 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001494 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001495
1496 def pack(self):
1497 packed = []
1498 packed.append(struct.pack("!B", self.version))
1499 packed.append(struct.pack("!B", self.type))
1500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1501 packed.append(struct.pack("!L", self.xid))
1502 packed.append(struct.pack("!L", self.experimenter))
1503 packed.append(struct.pack("!L", self.subtype))
1504 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001505 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001506 packed.append(struct.pack("!L", self.mask))
1507 length = sum([len(x) for x in packed])
1508 packed[2] = struct.pack("!H", length)
1509 return ''.join(packed)
1510
1511 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001512 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001513 obj = bsn_get_ip_mask_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001514 _version = reader.read("!B")[0]
1515 assert(_version == 1)
1516 _type = reader.read("!B")[0]
1517 assert(_type == 4)
1518 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001519 orig_reader = reader
1520 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001521 obj.xid = reader.read("!L")[0]
1522 _experimenter = reader.read("!L")[0]
1523 assert(_experimenter == 6035143)
1524 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001525 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -07001526 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001527 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07001528 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07001529 return obj
1530
1531 def __eq__(self, other):
1532 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001533 if self.xid != other.xid: return False
1534 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001535 if self.mask != other.mask: return False
1536 return True
1537
Rich Laneb658ddd2013-03-12 10:15:10 -07001538 def pretty_print(self, q):
1539 q.text("bsn_get_ip_mask_reply {")
1540 with q.group():
1541 with q.indent(2):
1542 q.breakable()
1543 q.text("xid = ");
1544 if self.xid != None:
1545 q.text("%#x" % self.xid)
1546 else:
1547 q.text('None')
1548 q.text(","); q.breakable()
1549 q.text("index = ");
1550 q.text("%#x" % self.index)
1551 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07001552 q.text("mask = ");
1553 q.text("%#x" % self.mask)
1554 q.breakable()
1555 q.text('}')
1556
Rich Lane7dcdf022013-12-11 14:45:27 -08001557bsn_header.subtypes[2] = bsn_get_ip_mask_reply
1558
1559class bsn_get_ip_mask_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001560 version = 1
1561 type = 4
1562 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001563 subtype = 1
1564
Rich Lanec2ee4b82013-04-24 17:12:38 -07001565 def __init__(self, xid=None, index=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001566 if xid != None:
1567 self.xid = xid
1568 else:
1569 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001570 if index != None:
1571 self.index = index
1572 else:
1573 self.index = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001574 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001575
1576 def pack(self):
1577 packed = []
1578 packed.append(struct.pack("!B", self.version))
1579 packed.append(struct.pack("!B", self.type))
1580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1581 packed.append(struct.pack("!L", self.xid))
1582 packed.append(struct.pack("!L", self.experimenter))
1583 packed.append(struct.pack("!L", self.subtype))
1584 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001585 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001586 length = sum([len(x) for x in packed])
1587 packed[2] = struct.pack("!H", length)
1588 return ''.join(packed)
1589
1590 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001591 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001592 obj = bsn_get_ip_mask_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001593 _version = reader.read("!B")[0]
1594 assert(_version == 1)
1595 _type = reader.read("!B")[0]
1596 assert(_type == 4)
1597 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001598 orig_reader = reader
1599 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001600 obj.xid = reader.read("!L")[0]
1601 _experimenter = reader.read("!L")[0]
1602 assert(_experimenter == 6035143)
1603 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001604 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001605 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001606 reader.skip(7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001607 return obj
1608
1609 def __eq__(self, other):
1610 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001611 if self.xid != other.xid: return False
1612 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001613 return True
1614
Rich Laneb658ddd2013-03-12 10:15:10 -07001615 def pretty_print(self, q):
1616 q.text("bsn_get_ip_mask_request {")
1617 with q.group():
1618 with q.indent(2):
1619 q.breakable()
1620 q.text("xid = ");
1621 if self.xid != None:
1622 q.text("%#x" % self.xid)
1623 else:
1624 q.text('None')
1625 q.text(","); q.breakable()
1626 q.text("index = ");
1627 q.text("%#x" % self.index)
Rich Laneb658ddd2013-03-12 10:15:10 -07001628 q.breakable()
1629 q.text('}')
1630
Rich Lane7dcdf022013-12-11 14:45:27 -08001631bsn_header.subtypes[1] = bsn_get_ip_mask_request
1632
1633class bsn_get_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001634 version = 1
1635 type = 4
1636 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001637 subtype = 14
1638
1639 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001640 if xid != None:
1641 self.xid = xid
1642 else:
1643 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07001644 if l2_table_enable != None:
1645 self.l2_table_enable = l2_table_enable
1646 else:
1647 self.l2_table_enable = 0
1648 if l2_table_priority != None:
1649 self.l2_table_priority = l2_table_priority
1650 else:
1651 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001652 return
Rich Lane90c961c2013-05-14 09:26:50 -07001653
1654 def pack(self):
1655 packed = []
1656 packed.append(struct.pack("!B", self.version))
1657 packed.append(struct.pack("!B", self.type))
1658 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1659 packed.append(struct.pack("!L", self.xid))
1660 packed.append(struct.pack("!L", self.experimenter))
1661 packed.append(struct.pack("!L", self.subtype))
1662 packed.append(struct.pack("!B", self.l2_table_enable))
1663 packed.append('\x00' * 1)
1664 packed.append(struct.pack("!H", self.l2_table_priority))
1665 packed.append('\x00' * 4)
1666 length = sum([len(x) for x in packed])
1667 packed[2] = struct.pack("!H", length)
1668 return ''.join(packed)
1669
1670 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001671 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001672 obj = bsn_get_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001673 _version = reader.read("!B")[0]
1674 assert(_version == 1)
1675 _type = reader.read("!B")[0]
1676 assert(_type == 4)
1677 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001678 orig_reader = reader
1679 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001680 obj.xid = reader.read("!L")[0]
1681 _experimenter = reader.read("!L")[0]
1682 assert(_experimenter == 6035143)
1683 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001684 assert(_subtype == 14)
Dan Talaycof6202252013-07-02 01:00:29 -07001685 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001686 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001687 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001688 reader.skip(4)
1689 return obj
1690
1691 def __eq__(self, other):
1692 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001693 if self.xid != other.xid: return False
1694 if self.l2_table_enable != other.l2_table_enable: return False
1695 if self.l2_table_priority != other.l2_table_priority: return False
1696 return True
1697
Rich Lane90c961c2013-05-14 09:26:50 -07001698 def pretty_print(self, q):
1699 q.text("bsn_get_l2_table_reply {")
1700 with q.group():
1701 with q.indent(2):
1702 q.breakable()
1703 q.text("xid = ");
1704 if self.xid != None:
1705 q.text("%#x" % self.xid)
1706 else:
1707 q.text('None')
1708 q.text(","); q.breakable()
1709 q.text("l2_table_enable = ");
1710 q.text("%#x" % self.l2_table_enable)
1711 q.text(","); q.breakable()
1712 q.text("l2_table_priority = ");
1713 q.text("%#x" % self.l2_table_priority)
1714 q.breakable()
1715 q.text('}')
1716
Rich Lane7dcdf022013-12-11 14:45:27 -08001717bsn_header.subtypes[14] = bsn_get_l2_table_reply
1718
1719class bsn_get_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001720 version = 1
1721 type = 4
1722 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001723 subtype = 13
1724
1725 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001726 if xid != None:
1727 self.xid = xid
1728 else:
1729 self.xid = None
1730 return
Rich Lane90c961c2013-05-14 09:26:50 -07001731
1732 def pack(self):
1733 packed = []
1734 packed.append(struct.pack("!B", self.version))
1735 packed.append(struct.pack("!B", self.type))
1736 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1737 packed.append(struct.pack("!L", self.xid))
1738 packed.append(struct.pack("!L", self.experimenter))
1739 packed.append(struct.pack("!L", self.subtype))
1740 length = sum([len(x) for x in packed])
1741 packed[2] = struct.pack("!H", length)
1742 return ''.join(packed)
1743
1744 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001745 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001746 obj = bsn_get_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001747 _version = reader.read("!B")[0]
1748 assert(_version == 1)
1749 _type = reader.read("!B")[0]
1750 assert(_type == 4)
1751 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001752 orig_reader = reader
1753 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001754 obj.xid = reader.read("!L")[0]
1755 _experimenter = reader.read("!L")[0]
1756 assert(_experimenter == 6035143)
1757 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001758 assert(_subtype == 13)
1759 return obj
1760
1761 def __eq__(self, other):
1762 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001763 if self.xid != other.xid: return False
1764 return True
1765
Rich Lane90c961c2013-05-14 09:26:50 -07001766 def pretty_print(self, q):
1767 q.text("bsn_get_l2_table_request {")
1768 with q.group():
1769 with q.indent(2):
1770 q.breakable()
1771 q.text("xid = ");
1772 if self.xid != None:
1773 q.text("%#x" % self.xid)
1774 else:
1775 q.text('None')
1776 q.breakable()
1777 q.text('}')
1778
Rich Lane7dcdf022013-12-11 14:45:27 -08001779bsn_header.subtypes[13] = bsn_get_l2_table_request
1780
1781class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001782 version = 1
1783 type = 4
1784 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001785 subtype = 5
1786
Rich Lanec2ee4b82013-04-24 17:12:38 -07001787 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001788 if xid != None:
1789 self.xid = xid
1790 else:
1791 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001792 if report_mirror_ports != None:
1793 self.report_mirror_ports = report_mirror_ports
1794 else:
1795 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001796 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001797
1798 def pack(self):
1799 packed = []
1800 packed.append(struct.pack("!B", self.version))
1801 packed.append(struct.pack("!B", self.type))
1802 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1803 packed.append(struct.pack("!L", self.xid))
1804 packed.append(struct.pack("!L", self.experimenter))
1805 packed.append(struct.pack("!L", self.subtype))
1806 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001807 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001808 length = sum([len(x) for x in packed])
1809 packed[2] = struct.pack("!H", length)
1810 return ''.join(packed)
1811
1812 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001813 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001814 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001815 _version = reader.read("!B")[0]
1816 assert(_version == 1)
1817 _type = reader.read("!B")[0]
1818 assert(_type == 4)
1819 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001820 orig_reader = reader
1821 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001822 obj.xid = reader.read("!L")[0]
1823 _experimenter = reader.read("!L")[0]
1824 assert(_experimenter == 6035143)
1825 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001826 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001827 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001828 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001829 return obj
1830
1831 def __eq__(self, other):
1832 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001833 if self.xid != other.xid: return False
1834 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001835 return True
1836
Rich Laneb658ddd2013-03-12 10:15:10 -07001837 def pretty_print(self, q):
1838 q.text("bsn_get_mirroring_reply {")
1839 with q.group():
1840 with q.indent(2):
1841 q.breakable()
1842 q.text("xid = ");
1843 if self.xid != None:
1844 q.text("%#x" % self.xid)
1845 else:
1846 q.text('None')
1847 q.text(","); q.breakable()
1848 q.text("report_mirror_ports = ");
1849 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001850 q.breakable()
1851 q.text('}')
1852
Rich Lane7dcdf022013-12-11 14:45:27 -08001853bsn_header.subtypes[5] = bsn_get_mirroring_reply
1854
1855class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001856 version = 1
1857 type = 4
1858 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001859 subtype = 4
1860
Rich Lanec2ee4b82013-04-24 17:12:38 -07001861 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001862 if xid != None:
1863 self.xid = xid
1864 else:
1865 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001866 if report_mirror_ports != None:
1867 self.report_mirror_ports = report_mirror_ports
1868 else:
1869 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001870 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001871
1872 def pack(self):
1873 packed = []
1874 packed.append(struct.pack("!B", self.version))
1875 packed.append(struct.pack("!B", self.type))
1876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1877 packed.append(struct.pack("!L", self.xid))
1878 packed.append(struct.pack("!L", self.experimenter))
1879 packed.append(struct.pack("!L", self.subtype))
1880 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001881 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001882 length = sum([len(x) for x in packed])
1883 packed[2] = struct.pack("!H", length)
1884 return ''.join(packed)
1885
1886 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001887 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001888 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001889 _version = reader.read("!B")[0]
1890 assert(_version == 1)
1891 _type = reader.read("!B")[0]
1892 assert(_type == 4)
1893 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001894 orig_reader = reader
1895 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001896 obj.xid = reader.read("!L")[0]
1897 _experimenter = reader.read("!L")[0]
1898 assert(_experimenter == 6035143)
1899 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001900 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001901 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001902 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001903 return obj
1904
1905 def __eq__(self, other):
1906 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001907 if self.xid != other.xid: return False
1908 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001909 return True
1910
Rich Laneb658ddd2013-03-12 10:15:10 -07001911 def pretty_print(self, q):
1912 q.text("bsn_get_mirroring_request {")
1913 with q.group():
1914 with q.indent(2):
1915 q.breakable()
1916 q.text("xid = ");
1917 if self.xid != None:
1918 q.text("%#x" % self.xid)
1919 else:
1920 q.text('None')
1921 q.text(","); q.breakable()
1922 q.text("report_mirror_ports = ");
1923 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001924 q.breakable()
1925 q.text('}')
1926
Rich Lane7dcdf022013-12-11 14:45:27 -08001927bsn_header.subtypes[4] = bsn_get_mirroring_request
1928
1929class bsn_hybrid_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001930 version = 1
1931 type = 4
1932 experimenter = 6035143
1933 subtype = 28
1934
1935 def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001936 if xid != None:
1937 self.xid = xid
1938 else:
1939 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001940 if hybrid_enable != None:
1941 self.hybrid_enable = hybrid_enable
1942 else:
1943 self.hybrid_enable = 0
1944 if hybrid_version != None:
1945 self.hybrid_version = hybrid_version
1946 else:
1947 self.hybrid_version = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001948 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001949
1950 def pack(self):
1951 packed = []
1952 packed.append(struct.pack("!B", self.version))
1953 packed.append(struct.pack("!B", self.type))
1954 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1955 packed.append(struct.pack("!L", self.xid))
1956 packed.append(struct.pack("!L", self.experimenter))
1957 packed.append(struct.pack("!L", self.subtype))
1958 packed.append(struct.pack("!B", self.hybrid_enable))
1959 packed.append('\x00' * 1)
1960 packed.append(struct.pack("!H", self.hybrid_version))
1961 packed.append('\x00' * 4)
1962 length = sum([len(x) for x in packed])
1963 packed[2] = struct.pack("!H", length)
1964 return ''.join(packed)
1965
1966 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001967 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001968 obj = bsn_hybrid_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001969 _version = reader.read("!B")[0]
1970 assert(_version == 1)
1971 _type = reader.read("!B")[0]
1972 assert(_type == 4)
1973 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001974 orig_reader = reader
1975 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001976 obj.xid = reader.read("!L")[0]
1977 _experimenter = reader.read("!L")[0]
1978 assert(_experimenter == 6035143)
1979 _subtype = reader.read("!L")[0]
1980 assert(_subtype == 28)
1981 obj.hybrid_enable = reader.read("!B")[0]
1982 reader.skip(1)
1983 obj.hybrid_version = reader.read("!H")[0]
1984 reader.skip(4)
1985 return obj
1986
1987 def __eq__(self, other):
1988 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001989 if self.xid != other.xid: return False
1990 if self.hybrid_enable != other.hybrid_enable: return False
1991 if self.hybrid_version != other.hybrid_version: return False
1992 return True
1993
Rich Lane6f4978c2013-10-20 21:33:52 -07001994 def pretty_print(self, q):
1995 q.text("bsn_hybrid_get_reply {")
1996 with q.group():
1997 with q.indent(2):
1998 q.breakable()
1999 q.text("xid = ");
2000 if self.xid != None:
2001 q.text("%#x" % self.xid)
2002 else:
2003 q.text('None')
2004 q.text(","); q.breakable()
2005 q.text("hybrid_enable = ");
2006 q.text("%#x" % self.hybrid_enable)
2007 q.text(","); q.breakable()
2008 q.text("hybrid_version = ");
2009 q.text("%#x" % self.hybrid_version)
2010 q.breakable()
2011 q.text('}')
2012
Rich Lane7dcdf022013-12-11 14:45:27 -08002013bsn_header.subtypes[28] = bsn_hybrid_get_reply
2014
2015class bsn_hybrid_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002016 version = 1
2017 type = 4
2018 experimenter = 6035143
2019 subtype = 27
2020
2021 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002022 if xid != None:
2023 self.xid = xid
2024 else:
2025 self.xid = None
2026 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002027
2028 def pack(self):
2029 packed = []
2030 packed.append(struct.pack("!B", self.version))
2031 packed.append(struct.pack("!B", self.type))
2032 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2033 packed.append(struct.pack("!L", self.xid))
2034 packed.append(struct.pack("!L", self.experimenter))
2035 packed.append(struct.pack("!L", self.subtype))
2036 length = sum([len(x) for x in packed])
2037 packed[2] = struct.pack("!H", length)
2038 return ''.join(packed)
2039
2040 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002041 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002042 obj = bsn_hybrid_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002043 _version = reader.read("!B")[0]
2044 assert(_version == 1)
2045 _type = reader.read("!B")[0]
2046 assert(_type == 4)
2047 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002048 orig_reader = reader
2049 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002050 obj.xid = reader.read("!L")[0]
2051 _experimenter = reader.read("!L")[0]
2052 assert(_experimenter == 6035143)
2053 _subtype = reader.read("!L")[0]
2054 assert(_subtype == 27)
2055 return obj
2056
2057 def __eq__(self, other):
2058 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002059 if self.xid != other.xid: return False
2060 return True
2061
Rich Lane6f4978c2013-10-20 21:33:52 -07002062 def pretty_print(self, q):
2063 q.text("bsn_hybrid_get_request {")
2064 with q.group():
2065 with q.indent(2):
2066 q.breakable()
2067 q.text("xid = ");
2068 if self.xid != None:
2069 q.text("%#x" % self.xid)
2070 else:
2071 q.text('None')
2072 q.breakable()
2073 q.text('}')
2074
Rich Lane7dcdf022013-12-11 14:45:27 -08002075bsn_header.subtypes[27] = bsn_hybrid_get_request
2076
2077class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002078 version = 1
2079 type = 4
2080 experimenter = 6035143
2081 subtype = 34
2082
Rich Lane7b0f2012013-11-22 14:15:26 -08002083 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002084 if xid != None:
2085 self.xid = xid
2086 else:
2087 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002088 if status != None:
2089 self.status = status
2090 else:
2091 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002092 if port_no != None:
2093 self.port_no = port_no
2094 else:
2095 self.port_no = 0
2096 if slot_num != None:
2097 self.slot_num = slot_num
2098 else:
2099 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002100 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002101
2102 def pack(self):
2103 packed = []
2104 packed.append(struct.pack("!B", self.version))
2105 packed.append(struct.pack("!B", self.type))
2106 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2107 packed.append(struct.pack("!L", self.xid))
2108 packed.append(struct.pack("!L", self.experimenter))
2109 packed.append(struct.pack("!L", self.subtype))
2110 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002111 packed.append(util.pack_port_no(self.port_no))
2112 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002113 length = sum([len(x) for x in packed])
2114 packed[2] = struct.pack("!H", length)
2115 return ''.join(packed)
2116
2117 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002118 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002119 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002120 _version = reader.read("!B")[0]
2121 assert(_version == 1)
2122 _type = reader.read("!B")[0]
2123 assert(_type == 4)
2124 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002125 orig_reader = reader
2126 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002127 obj.xid = reader.read("!L")[0]
2128 _experimenter = reader.read("!L")[0]
2129 assert(_experimenter == 6035143)
2130 _subtype = reader.read("!L")[0]
2131 assert(_subtype == 34)
2132 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002133 obj.port_no = util.unpack_port_no(reader)
2134 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002135 return obj
2136
2137 def __eq__(self, other):
2138 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002139 if self.xid != other.xid: return False
2140 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002141 if self.port_no != other.port_no: return False
2142 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002143 return True
2144
Rich Lane6f4978c2013-10-20 21:33:52 -07002145 def pretty_print(self, q):
2146 q.text("bsn_pdu_rx_reply {")
2147 with q.group():
2148 with q.indent(2):
2149 q.breakable()
2150 q.text("xid = ");
2151 if self.xid != None:
2152 q.text("%#x" % self.xid)
2153 else:
2154 q.text('None')
2155 q.text(","); q.breakable()
2156 q.text("status = ");
2157 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002158 q.text(","); q.breakable()
2159 q.text("port_no = ");
2160 q.text(util.pretty_port(self.port_no))
2161 q.text(","); q.breakable()
2162 q.text("slot_num = ");
2163 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002164 q.breakable()
2165 q.text('}')
2166
Rich Lane7dcdf022013-12-11 14:45:27 -08002167bsn_header.subtypes[34] = bsn_pdu_rx_reply
2168
2169class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002170 version = 1
2171 type = 4
2172 experimenter = 6035143
2173 subtype = 33
2174
2175 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002176 if xid != None:
2177 self.xid = xid
2178 else:
2179 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002180 if timeout_ms != None:
2181 self.timeout_ms = timeout_ms
2182 else:
2183 self.timeout_ms = 0
2184 if port_no != None:
2185 self.port_no = port_no
2186 else:
2187 self.port_no = 0
2188 if slot_num != None:
2189 self.slot_num = slot_num
2190 else:
2191 self.slot_num = 0
2192 if data != None:
2193 self.data = data
2194 else:
2195 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002196 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002197
2198 def pack(self):
2199 packed = []
2200 packed.append(struct.pack("!B", self.version))
2201 packed.append(struct.pack("!B", self.type))
2202 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2203 packed.append(struct.pack("!L", self.xid))
2204 packed.append(struct.pack("!L", self.experimenter))
2205 packed.append(struct.pack("!L", self.subtype))
2206 packed.append(struct.pack("!L", self.timeout_ms))
2207 packed.append(util.pack_port_no(self.port_no))
2208 packed.append(struct.pack("!B", self.slot_num))
2209 packed.append('\x00' * 3)
2210 packed.append(self.data)
2211 length = sum([len(x) for x in packed])
2212 packed[2] = struct.pack("!H", length)
2213 return ''.join(packed)
2214
2215 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002216 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002217 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002218 _version = reader.read("!B")[0]
2219 assert(_version == 1)
2220 _type = reader.read("!B")[0]
2221 assert(_type == 4)
2222 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002223 orig_reader = reader
2224 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002225 obj.xid = reader.read("!L")[0]
2226 _experimenter = reader.read("!L")[0]
2227 assert(_experimenter == 6035143)
2228 _subtype = reader.read("!L")[0]
2229 assert(_subtype == 33)
2230 obj.timeout_ms = reader.read("!L")[0]
2231 obj.port_no = util.unpack_port_no(reader)
2232 obj.slot_num = reader.read("!B")[0]
2233 reader.skip(3)
2234 obj.data = str(reader.read_all())
2235 return obj
2236
2237 def __eq__(self, other):
2238 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002239 if self.xid != other.xid: return False
2240 if self.timeout_ms != other.timeout_ms: return False
2241 if self.port_no != other.port_no: return False
2242 if self.slot_num != other.slot_num: return False
2243 if self.data != other.data: return False
2244 return True
2245
Rich Lane6f4978c2013-10-20 21:33:52 -07002246 def pretty_print(self, q):
2247 q.text("bsn_pdu_rx_request {")
2248 with q.group():
2249 with q.indent(2):
2250 q.breakable()
2251 q.text("xid = ");
2252 if self.xid != None:
2253 q.text("%#x" % self.xid)
2254 else:
2255 q.text('None')
2256 q.text(","); q.breakable()
2257 q.text("timeout_ms = ");
2258 q.text("%#x" % self.timeout_ms)
2259 q.text(","); q.breakable()
2260 q.text("port_no = ");
2261 q.text(util.pretty_port(self.port_no))
2262 q.text(","); q.breakable()
2263 q.text("slot_num = ");
2264 q.text("%#x" % self.slot_num)
2265 q.text(","); q.breakable()
2266 q.text("data = ");
2267 q.pp(self.data)
2268 q.breakable()
2269 q.text('}')
2270
Rich Lane7dcdf022013-12-11 14:45:27 -08002271bsn_header.subtypes[33] = bsn_pdu_rx_request
2272
2273class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002274 version = 1
2275 type = 4
2276 experimenter = 6035143
2277 subtype = 35
2278
2279 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002280 if xid != None:
2281 self.xid = xid
2282 else:
2283 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002284 if port_no != None:
2285 self.port_no = port_no
2286 else:
2287 self.port_no = 0
2288 if slot_num != None:
2289 self.slot_num = slot_num
2290 else:
2291 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002292 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002293
2294 def pack(self):
2295 packed = []
2296 packed.append(struct.pack("!B", self.version))
2297 packed.append(struct.pack("!B", self.type))
2298 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2299 packed.append(struct.pack("!L", self.xid))
2300 packed.append(struct.pack("!L", self.experimenter))
2301 packed.append(struct.pack("!L", self.subtype))
2302 packed.append(util.pack_port_no(self.port_no))
2303 packed.append(struct.pack("!B", self.slot_num))
2304 length = sum([len(x) for x in packed])
2305 packed[2] = struct.pack("!H", length)
2306 return ''.join(packed)
2307
2308 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002309 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002310 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002311 _version = reader.read("!B")[0]
2312 assert(_version == 1)
2313 _type = reader.read("!B")[0]
2314 assert(_type == 4)
2315 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002316 orig_reader = reader
2317 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002318 obj.xid = reader.read("!L")[0]
2319 _experimenter = reader.read("!L")[0]
2320 assert(_experimenter == 6035143)
2321 _subtype = reader.read("!L")[0]
2322 assert(_subtype == 35)
2323 obj.port_no = util.unpack_port_no(reader)
2324 obj.slot_num = reader.read("!B")[0]
2325 return obj
2326
2327 def __eq__(self, other):
2328 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002329 if self.xid != other.xid: return False
2330 if self.port_no != other.port_no: return False
2331 if self.slot_num != other.slot_num: return False
2332 return True
2333
Rich Lane6f4978c2013-10-20 21:33:52 -07002334 def pretty_print(self, q):
2335 q.text("bsn_pdu_rx_timeout {")
2336 with q.group():
2337 with q.indent(2):
2338 q.breakable()
2339 q.text("xid = ");
2340 if self.xid != None:
2341 q.text("%#x" % self.xid)
2342 else:
2343 q.text('None')
2344 q.text(","); q.breakable()
2345 q.text("port_no = ");
2346 q.text(util.pretty_port(self.port_no))
2347 q.text(","); q.breakable()
2348 q.text("slot_num = ");
2349 q.text("%#x" % self.slot_num)
2350 q.breakable()
2351 q.text('}')
2352
Rich Lane7dcdf022013-12-11 14:45:27 -08002353bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2354
2355class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002356 version = 1
2357 type = 4
2358 experimenter = 6035143
2359 subtype = 32
2360
Rich Lane7b0f2012013-11-22 14:15:26 -08002361 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002362 if xid != None:
2363 self.xid = xid
2364 else:
2365 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002366 if status != None:
2367 self.status = status
2368 else:
2369 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002370 if port_no != None:
2371 self.port_no = port_no
2372 else:
2373 self.port_no = 0
2374 if slot_num != None:
2375 self.slot_num = slot_num
2376 else:
2377 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002378 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002379
2380 def pack(self):
2381 packed = []
2382 packed.append(struct.pack("!B", self.version))
2383 packed.append(struct.pack("!B", self.type))
2384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2385 packed.append(struct.pack("!L", self.xid))
2386 packed.append(struct.pack("!L", self.experimenter))
2387 packed.append(struct.pack("!L", self.subtype))
2388 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002389 packed.append(util.pack_port_no(self.port_no))
2390 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002391 length = sum([len(x) for x in packed])
2392 packed[2] = struct.pack("!H", length)
2393 return ''.join(packed)
2394
2395 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002396 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002397 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002398 _version = reader.read("!B")[0]
2399 assert(_version == 1)
2400 _type = reader.read("!B")[0]
2401 assert(_type == 4)
2402 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002403 orig_reader = reader
2404 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002405 obj.xid = reader.read("!L")[0]
2406 _experimenter = reader.read("!L")[0]
2407 assert(_experimenter == 6035143)
2408 _subtype = reader.read("!L")[0]
2409 assert(_subtype == 32)
2410 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002411 obj.port_no = util.unpack_port_no(reader)
2412 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002413 return obj
2414
2415 def __eq__(self, other):
2416 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002417 if self.xid != other.xid: return False
2418 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002419 if self.port_no != other.port_no: return False
2420 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002421 return True
2422
Rich Lane6f4978c2013-10-20 21:33:52 -07002423 def pretty_print(self, q):
2424 q.text("bsn_pdu_tx_reply {")
2425 with q.group():
2426 with q.indent(2):
2427 q.breakable()
2428 q.text("xid = ");
2429 if self.xid != None:
2430 q.text("%#x" % self.xid)
2431 else:
2432 q.text('None')
2433 q.text(","); q.breakable()
2434 q.text("status = ");
2435 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002436 q.text(","); q.breakable()
2437 q.text("port_no = ");
2438 q.text(util.pretty_port(self.port_no))
2439 q.text(","); q.breakable()
2440 q.text("slot_num = ");
2441 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002442 q.breakable()
2443 q.text('}')
2444
Rich Lane7dcdf022013-12-11 14:45:27 -08002445bsn_header.subtypes[32] = bsn_pdu_tx_reply
2446
2447class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002448 version = 1
2449 type = 4
2450 experimenter = 6035143
2451 subtype = 31
2452
2453 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002454 if xid != None:
2455 self.xid = xid
2456 else:
2457 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002458 if tx_interval_ms != None:
2459 self.tx_interval_ms = tx_interval_ms
2460 else:
2461 self.tx_interval_ms = 0
2462 if port_no != None:
2463 self.port_no = port_no
2464 else:
2465 self.port_no = 0
2466 if slot_num != None:
2467 self.slot_num = slot_num
2468 else:
2469 self.slot_num = 0
2470 if data != None:
2471 self.data = data
2472 else:
2473 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002474 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002475
2476 def pack(self):
2477 packed = []
2478 packed.append(struct.pack("!B", self.version))
2479 packed.append(struct.pack("!B", self.type))
2480 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2481 packed.append(struct.pack("!L", self.xid))
2482 packed.append(struct.pack("!L", self.experimenter))
2483 packed.append(struct.pack("!L", self.subtype))
2484 packed.append(struct.pack("!L", self.tx_interval_ms))
2485 packed.append(util.pack_port_no(self.port_no))
2486 packed.append(struct.pack("!B", self.slot_num))
2487 packed.append('\x00' * 3)
2488 packed.append(self.data)
2489 length = sum([len(x) for x in packed])
2490 packed[2] = struct.pack("!H", length)
2491 return ''.join(packed)
2492
2493 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002494 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002495 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002496 _version = reader.read("!B")[0]
2497 assert(_version == 1)
2498 _type = reader.read("!B")[0]
2499 assert(_type == 4)
2500 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002501 orig_reader = reader
2502 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002503 obj.xid = reader.read("!L")[0]
2504 _experimenter = reader.read("!L")[0]
2505 assert(_experimenter == 6035143)
2506 _subtype = reader.read("!L")[0]
2507 assert(_subtype == 31)
2508 obj.tx_interval_ms = reader.read("!L")[0]
2509 obj.port_no = util.unpack_port_no(reader)
2510 obj.slot_num = reader.read("!B")[0]
2511 reader.skip(3)
2512 obj.data = str(reader.read_all())
2513 return obj
2514
2515 def __eq__(self, other):
2516 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002517 if self.xid != other.xid: return False
2518 if self.tx_interval_ms != other.tx_interval_ms: return False
2519 if self.port_no != other.port_no: return False
2520 if self.slot_num != other.slot_num: return False
2521 if self.data != other.data: return False
2522 return True
2523
Rich Lane6f4978c2013-10-20 21:33:52 -07002524 def pretty_print(self, q):
2525 q.text("bsn_pdu_tx_request {")
2526 with q.group():
2527 with q.indent(2):
2528 q.breakable()
2529 q.text("xid = ");
2530 if self.xid != None:
2531 q.text("%#x" % self.xid)
2532 else:
2533 q.text('None')
2534 q.text(","); q.breakable()
2535 q.text("tx_interval_ms = ");
2536 q.text("%#x" % self.tx_interval_ms)
2537 q.text(","); q.breakable()
2538 q.text("port_no = ");
2539 q.text(util.pretty_port(self.port_no))
2540 q.text(","); q.breakable()
2541 q.text("slot_num = ");
2542 q.text("%#x" % self.slot_num)
2543 q.text(","); q.breakable()
2544 q.text("data = ");
2545 q.pp(self.data)
2546 q.breakable()
2547 q.text('}')
2548
Rich Lane7dcdf022013-12-11 14:45:27 -08002549bsn_header.subtypes[31] = bsn_pdu_tx_request
2550
2551class bsn_set_ip_mask(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002552 version = 1
2553 type = 4
2554 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002555 subtype = 0
2556
Rich Lanec2ee4b82013-04-24 17:12:38 -07002557 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002558 if xid != None:
2559 self.xid = xid
2560 else:
2561 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002562 if index != None:
2563 self.index = index
2564 else:
2565 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07002566 if mask != None:
2567 self.mask = mask
2568 else:
2569 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002570 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002571
2572 def pack(self):
2573 packed = []
2574 packed.append(struct.pack("!B", self.version))
2575 packed.append(struct.pack("!B", self.type))
2576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2577 packed.append(struct.pack("!L", self.xid))
2578 packed.append(struct.pack("!L", self.experimenter))
2579 packed.append(struct.pack("!L", self.subtype))
2580 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002581 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002582 packed.append(struct.pack("!L", self.mask))
2583 length = sum([len(x) for x in packed])
2584 packed[2] = struct.pack("!H", length)
2585 return ''.join(packed)
2586
2587 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002588 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002589 obj = bsn_set_ip_mask()
Dan Talaycof6202252013-07-02 01:00:29 -07002590 _version = reader.read("!B")[0]
2591 assert(_version == 1)
2592 _type = reader.read("!B")[0]
2593 assert(_type == 4)
2594 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002595 orig_reader = reader
2596 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002597 obj.xid = reader.read("!L")[0]
2598 _experimenter = reader.read("!L")[0]
2599 assert(_experimenter == 6035143)
2600 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002601 assert(_subtype == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07002602 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002603 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07002604 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002605 return obj
2606
2607 def __eq__(self, other):
2608 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002609 if self.xid != other.xid: return False
2610 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002611 if self.mask != other.mask: return False
2612 return True
2613
Rich Laneb658ddd2013-03-12 10:15:10 -07002614 def pretty_print(self, q):
2615 q.text("bsn_set_ip_mask {")
2616 with q.group():
2617 with q.indent(2):
2618 q.breakable()
2619 q.text("xid = ");
2620 if self.xid != None:
2621 q.text("%#x" % self.xid)
2622 else:
2623 q.text('None')
2624 q.text(","); q.breakable()
2625 q.text("index = ");
2626 q.text("%#x" % self.index)
2627 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07002628 q.text("mask = ");
2629 q.text("%#x" % self.mask)
2630 q.breakable()
2631 q.text('}')
2632
Rich Lane7dcdf022013-12-11 14:45:27 -08002633bsn_header.subtypes[0] = bsn_set_ip_mask
2634
2635class bsn_set_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002636 version = 1
2637 type = 4
2638 experimenter = 6035143
2639 subtype = 24
2640
2641 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002642 if xid != None:
2643 self.xid = xid
2644 else:
2645 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002646 if l2_table_enable != None:
2647 self.l2_table_enable = l2_table_enable
2648 else:
2649 self.l2_table_enable = 0
2650 if l2_table_priority != None:
2651 self.l2_table_priority = l2_table_priority
2652 else:
2653 self.l2_table_priority = 0
2654 if status != None:
2655 self.status = status
2656 else:
2657 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002658 return
Dan Talaycof6202252013-07-02 01:00:29 -07002659
2660 def pack(self):
2661 packed = []
2662 packed.append(struct.pack("!B", self.version))
2663 packed.append(struct.pack("!B", self.type))
2664 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2665 packed.append(struct.pack("!L", self.xid))
2666 packed.append(struct.pack("!L", self.experimenter))
2667 packed.append(struct.pack("!L", self.subtype))
2668 packed.append(struct.pack("!B", self.l2_table_enable))
2669 packed.append('\x00' * 1)
2670 packed.append(struct.pack("!H", self.l2_table_priority))
2671 packed.append(struct.pack("!L", self.status))
2672 length = sum([len(x) for x in packed])
2673 packed[2] = struct.pack("!H", length)
2674 return ''.join(packed)
2675
2676 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002677 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002678 obj = bsn_set_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002679 _version = reader.read("!B")[0]
2680 assert(_version == 1)
2681 _type = reader.read("!B")[0]
2682 assert(_type == 4)
2683 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002684 orig_reader = reader
2685 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002686 obj.xid = reader.read("!L")[0]
2687 _experimenter = reader.read("!L")[0]
2688 assert(_experimenter == 6035143)
2689 _subtype = reader.read("!L")[0]
2690 assert(_subtype == 24)
2691 obj.l2_table_enable = reader.read("!B")[0]
2692 reader.skip(1)
2693 obj.l2_table_priority = reader.read("!H")[0]
2694 obj.status = reader.read("!L")[0]
2695 return obj
2696
2697 def __eq__(self, other):
2698 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002699 if self.xid != other.xid: return False
2700 if self.l2_table_enable != other.l2_table_enable: return False
2701 if self.l2_table_priority != other.l2_table_priority: return False
2702 if self.status != other.status: return False
2703 return True
2704
Dan Talaycof6202252013-07-02 01:00:29 -07002705 def pretty_print(self, q):
2706 q.text("bsn_set_l2_table_reply {")
2707 with q.group():
2708 with q.indent(2):
2709 q.breakable()
2710 q.text("xid = ");
2711 if self.xid != None:
2712 q.text("%#x" % self.xid)
2713 else:
2714 q.text('None')
2715 q.text(","); q.breakable()
2716 q.text("l2_table_enable = ");
2717 q.text("%#x" % self.l2_table_enable)
2718 q.text(","); q.breakable()
2719 q.text("l2_table_priority = ");
2720 q.text("%#x" % self.l2_table_priority)
2721 q.text(","); q.breakable()
2722 q.text("status = ");
2723 q.text("%#x" % self.status)
2724 q.breakable()
2725 q.text('}')
2726
Rich Lane7dcdf022013-12-11 14:45:27 -08002727bsn_header.subtypes[24] = bsn_set_l2_table_reply
2728
2729class bsn_set_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002730 version = 1
2731 type = 4
2732 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07002733 subtype = 12
2734
2735 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002736 if xid != None:
2737 self.xid = xid
2738 else:
2739 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07002740 if l2_table_enable != None:
2741 self.l2_table_enable = l2_table_enable
2742 else:
2743 self.l2_table_enable = 0
2744 if l2_table_priority != None:
2745 self.l2_table_priority = l2_table_priority
2746 else:
2747 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002748 return
Rich Lane90c961c2013-05-14 09:26:50 -07002749
2750 def pack(self):
2751 packed = []
2752 packed.append(struct.pack("!B", self.version))
2753 packed.append(struct.pack("!B", self.type))
2754 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2755 packed.append(struct.pack("!L", self.xid))
2756 packed.append(struct.pack("!L", self.experimenter))
2757 packed.append(struct.pack("!L", self.subtype))
2758 packed.append(struct.pack("!B", self.l2_table_enable))
2759 packed.append('\x00' * 1)
2760 packed.append(struct.pack("!H", self.l2_table_priority))
2761 packed.append('\x00' * 4)
2762 length = sum([len(x) for x in packed])
2763 packed[2] = struct.pack("!H", length)
2764 return ''.join(packed)
2765
2766 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002767 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002768 obj = bsn_set_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002769 _version = reader.read("!B")[0]
2770 assert(_version == 1)
2771 _type = reader.read("!B")[0]
2772 assert(_type == 4)
2773 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002774 orig_reader = reader
2775 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002776 obj.xid = reader.read("!L")[0]
2777 _experimenter = reader.read("!L")[0]
2778 assert(_experimenter == 6035143)
2779 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002780 assert(_subtype == 12)
Dan Talaycof6202252013-07-02 01:00:29 -07002781 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002782 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002783 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002784 reader.skip(4)
2785 return obj
2786
2787 def __eq__(self, other):
2788 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07002789 if self.xid != other.xid: return False
2790 if self.l2_table_enable != other.l2_table_enable: return False
2791 if self.l2_table_priority != other.l2_table_priority: return False
2792 return True
2793
Rich Lane90c961c2013-05-14 09:26:50 -07002794 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002795 q.text("bsn_set_l2_table_request {")
Rich Lane90c961c2013-05-14 09:26:50 -07002796 with q.group():
2797 with q.indent(2):
2798 q.breakable()
2799 q.text("xid = ");
2800 if self.xid != None:
2801 q.text("%#x" % self.xid)
2802 else:
2803 q.text('None')
2804 q.text(","); q.breakable()
2805 q.text("l2_table_enable = ");
2806 q.text("%#x" % self.l2_table_enable)
2807 q.text(","); q.breakable()
2808 q.text("l2_table_priority = ");
2809 q.text("%#x" % self.l2_table_priority)
2810 q.breakable()
2811 q.text('}')
2812
Rich Lane7dcdf022013-12-11 14:45:27 -08002813bsn_header.subtypes[12] = bsn_set_l2_table_request
2814
2815class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002816 version = 1
2817 type = 4
2818 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002819 subtype = 3
2820
Rich Lanec2ee4b82013-04-24 17:12:38 -07002821 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002822 if xid != None:
2823 self.xid = xid
2824 else:
2825 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002826 if report_mirror_ports != None:
2827 self.report_mirror_ports = report_mirror_ports
2828 else:
2829 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002830 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002831
2832 def pack(self):
2833 packed = []
2834 packed.append(struct.pack("!B", self.version))
2835 packed.append(struct.pack("!B", self.type))
2836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2837 packed.append(struct.pack("!L", self.xid))
2838 packed.append(struct.pack("!L", self.experimenter))
2839 packed.append(struct.pack("!L", self.subtype))
2840 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002841 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002842 length = sum([len(x) for x in packed])
2843 packed[2] = struct.pack("!H", length)
2844 return ''.join(packed)
2845
2846 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002847 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002848 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002849 _version = reader.read("!B")[0]
2850 assert(_version == 1)
2851 _type = reader.read("!B")[0]
2852 assert(_type == 4)
2853 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002854 orig_reader = reader
2855 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002856 obj.xid = reader.read("!L")[0]
2857 _experimenter = reader.read("!L")[0]
2858 assert(_experimenter == 6035143)
2859 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002860 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002861 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002862 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002863 return obj
2864
2865 def __eq__(self, other):
2866 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002867 if self.xid != other.xid: return False
2868 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002869 return True
2870
Rich Laneb658ddd2013-03-12 10:15:10 -07002871 def pretty_print(self, q):
2872 q.text("bsn_set_mirroring {")
2873 with q.group():
2874 with q.indent(2):
2875 q.breakable()
2876 q.text("xid = ");
2877 if self.xid != None:
2878 q.text("%#x" % self.xid)
2879 else:
2880 q.text('None')
2881 q.text(","); q.breakable()
2882 q.text("report_mirror_ports = ");
2883 q.text("%#x" % self.report_mirror_ports)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002884 q.breakable()
2885 q.text('}')
2886
Rich Lane7dcdf022013-12-11 14:45:27 -08002887bsn_header.subtypes[3] = bsn_set_mirroring
2888
2889class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002890 version = 1
2891 type = 4
2892 experimenter = 6035143
2893 subtype = 25
2894
2895 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002896 if xid != None:
2897 self.xid = xid
2898 else:
2899 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002900 if status != None:
2901 self.status = status
2902 else:
2903 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002904 return
Dan Talaycof6202252013-07-02 01:00:29 -07002905
2906 def pack(self):
2907 packed = []
2908 packed.append(struct.pack("!B", self.version))
2909 packed.append(struct.pack("!B", self.type))
2910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2911 packed.append(struct.pack("!L", self.xid))
2912 packed.append(struct.pack("!L", self.experimenter))
2913 packed.append(struct.pack("!L", self.subtype))
2914 packed.append(struct.pack("!L", self.status))
2915 length = sum([len(x) for x in packed])
2916 packed[2] = struct.pack("!H", length)
2917 return ''.join(packed)
2918
2919 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002920 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002921 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002922 _version = reader.read("!B")[0]
2923 assert(_version == 1)
2924 _type = reader.read("!B")[0]
2925 assert(_type == 4)
2926 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002927 orig_reader = reader
2928 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002929 obj.xid = reader.read("!L")[0]
2930 _experimenter = reader.read("!L")[0]
2931 assert(_experimenter == 6035143)
2932 _subtype = reader.read("!L")[0]
2933 assert(_subtype == 25)
2934 obj.status = reader.read("!L")[0]
2935 return obj
2936
2937 def __eq__(self, other):
2938 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002939 if self.xid != other.xid: return False
2940 if self.status != other.status: return False
2941 return True
2942
Dan Talaycof6202252013-07-02 01:00:29 -07002943 def pretty_print(self, q):
2944 q.text("bsn_set_pktin_suppression_reply {")
2945 with q.group():
2946 with q.indent(2):
2947 q.breakable()
2948 q.text("xid = ");
2949 if self.xid != None:
2950 q.text("%#x" % self.xid)
2951 else:
2952 q.text('None')
2953 q.text(","); q.breakable()
2954 q.text("status = ");
2955 q.text("%#x" % self.status)
2956 q.breakable()
2957 q.text('}')
2958
Rich Lane7dcdf022013-12-11 14:45:27 -08002959bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2960
2961class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002962 version = 1
2963 type = 4
2964 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002965 subtype = 11
2966
2967 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002968 if xid != None:
2969 self.xid = xid
2970 else:
2971 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002972 if enabled != None:
2973 self.enabled = enabled
2974 else:
2975 self.enabled = 0
2976 if idle_timeout != None:
2977 self.idle_timeout = idle_timeout
2978 else:
2979 self.idle_timeout = 0
2980 if hard_timeout != None:
2981 self.hard_timeout = hard_timeout
2982 else:
2983 self.hard_timeout = 0
2984 if priority != None:
2985 self.priority = priority
2986 else:
2987 self.priority = 0
2988 if cookie != None:
2989 self.cookie = cookie
2990 else:
2991 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002992 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002993
2994 def pack(self):
2995 packed = []
2996 packed.append(struct.pack("!B", self.version))
2997 packed.append(struct.pack("!B", self.type))
2998 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2999 packed.append(struct.pack("!L", self.xid))
3000 packed.append(struct.pack("!L", self.experimenter))
3001 packed.append(struct.pack("!L", self.subtype))
3002 packed.append(struct.pack("!B", self.enabled))
3003 packed.append('\x00' * 1)
3004 packed.append(struct.pack("!H", self.idle_timeout))
3005 packed.append(struct.pack("!H", self.hard_timeout))
3006 packed.append(struct.pack("!H", self.priority))
3007 packed.append(struct.pack("!Q", self.cookie))
3008 length = sum([len(x) for x in packed])
3009 packed[2] = struct.pack("!H", length)
3010 return ''.join(packed)
3011
3012 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003013 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003014 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003015 _version = reader.read("!B")[0]
3016 assert(_version == 1)
3017 _type = reader.read("!B")[0]
3018 assert(_type == 4)
3019 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003020 orig_reader = reader
3021 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003022 obj.xid = reader.read("!L")[0]
3023 _experimenter = reader.read("!L")[0]
3024 assert(_experimenter == 6035143)
3025 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003026 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07003027 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003028 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07003029 obj.idle_timeout = reader.read("!H")[0]
3030 obj.hard_timeout = reader.read("!H")[0]
3031 obj.priority = reader.read("!H")[0]
3032 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003033 return obj
3034
3035 def __eq__(self, other):
3036 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003037 if self.xid != other.xid: return False
3038 if self.enabled != other.enabled: return False
3039 if self.idle_timeout != other.idle_timeout: return False
3040 if self.hard_timeout != other.hard_timeout: return False
3041 if self.priority != other.priority: return False
3042 if self.cookie != other.cookie: return False
3043 return True
3044
Rich Lanec2ee4b82013-04-24 17:12:38 -07003045 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07003046 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07003047 with q.group():
3048 with q.indent(2):
3049 q.breakable()
3050 q.text("xid = ");
3051 if self.xid != None:
3052 q.text("%#x" % self.xid)
3053 else:
3054 q.text('None')
Rich Laneb658ddd2013-03-12 10:15:10 -07003055 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003056 q.text("enabled = ");
3057 q.text("%#x" % self.enabled)
3058 q.text(","); q.breakable()
3059 q.text("idle_timeout = ");
3060 q.text("%#x" % self.idle_timeout)
3061 q.text(","); q.breakable()
3062 q.text("hard_timeout = ");
3063 q.text("%#x" % self.hard_timeout)
3064 q.text(","); q.breakable()
3065 q.text("priority = ");
3066 q.text("%#x" % self.priority)
3067 q.text(","); q.breakable()
3068 q.text("cookie = ");
3069 q.text("%#x" % self.cookie)
Rich Laneb658ddd2013-03-12 10:15:10 -07003070 q.breakable()
3071 q.text('}')
3072
Rich Lane7dcdf022013-12-11 14:45:27 -08003073bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
3074
3075class bsn_shell_command(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003076 version = 1
3077 type = 4
3078 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003079 subtype = 6
3080
3081 def __init__(self, xid=None, service=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003082 if xid != None:
3083 self.xid = xid
3084 else:
3085 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003086 if service != None:
3087 self.service = service
3088 else:
3089 self.service = 0
3090 if data != None:
3091 self.data = data
3092 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003093 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003094 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003095
3096 def pack(self):
3097 packed = []
3098 packed.append(struct.pack("!B", self.version))
3099 packed.append(struct.pack("!B", self.type))
3100 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3101 packed.append(struct.pack("!L", self.xid))
3102 packed.append(struct.pack("!L", self.experimenter))
3103 packed.append(struct.pack("!L", self.subtype))
3104 packed.append(struct.pack("!L", self.service))
3105 packed.append(self.data)
3106 length = sum([len(x) for x in packed])
3107 packed[2] = struct.pack("!H", length)
3108 return ''.join(packed)
3109
3110 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003111 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003112 obj = bsn_shell_command()
Dan Talaycof6202252013-07-02 01:00:29 -07003113 _version = reader.read("!B")[0]
3114 assert(_version == 1)
3115 _type = reader.read("!B")[0]
3116 assert(_type == 4)
3117 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003118 orig_reader = reader
3119 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003120 obj.xid = reader.read("!L")[0]
3121 _experimenter = reader.read("!L")[0]
3122 assert(_experimenter == 6035143)
3123 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003124 assert(_subtype == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07003125 obj.service = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003126 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003127 return obj
3128
3129 def __eq__(self, other):
3130 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003131 if self.xid != other.xid: return False
3132 if self.service != other.service: return False
3133 if self.data != other.data: return False
3134 return True
3135
Rich Laneb658ddd2013-03-12 10:15:10 -07003136 def pretty_print(self, q):
3137 q.text("bsn_shell_command {")
3138 with q.group():
3139 with q.indent(2):
3140 q.breakable()
3141 q.text("xid = ");
3142 if self.xid != None:
3143 q.text("%#x" % self.xid)
3144 else:
3145 q.text('None')
3146 q.text(","); q.breakable()
3147 q.text("service = ");
3148 q.text("%#x" % self.service)
3149 q.text(","); q.breakable()
3150 q.text("data = ");
3151 q.pp(self.data)
3152 q.breakable()
3153 q.text('}')
3154
Rich Lane7dcdf022013-12-11 14:45:27 -08003155bsn_header.subtypes[6] = bsn_shell_command
3156
3157class bsn_shell_output(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003158 version = 1
3159 type = 4
3160 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003161 subtype = 7
3162
3163 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003164 if xid != None:
3165 self.xid = xid
3166 else:
3167 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003168 if data != None:
3169 self.data = data
3170 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003171 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003172 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003173
3174 def pack(self):
3175 packed = []
3176 packed.append(struct.pack("!B", self.version))
3177 packed.append(struct.pack("!B", self.type))
3178 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3179 packed.append(struct.pack("!L", self.xid))
3180 packed.append(struct.pack("!L", self.experimenter))
3181 packed.append(struct.pack("!L", self.subtype))
3182 packed.append(self.data)
3183 length = sum([len(x) for x in packed])
3184 packed[2] = struct.pack("!H", length)
3185 return ''.join(packed)
3186
3187 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003188 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003189 obj = bsn_shell_output()
Dan Talaycof6202252013-07-02 01:00:29 -07003190 _version = reader.read("!B")[0]
3191 assert(_version == 1)
3192 _type = reader.read("!B")[0]
3193 assert(_type == 4)
3194 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003195 orig_reader = reader
3196 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003197 obj.xid = reader.read("!L")[0]
3198 _experimenter = reader.read("!L")[0]
3199 assert(_experimenter == 6035143)
3200 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003201 assert(_subtype == 7)
3202 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003203 return obj
3204
3205 def __eq__(self, other):
3206 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003207 if self.xid != other.xid: return False
3208 if self.data != other.data: return False
3209 return True
3210
Rich Laneb658ddd2013-03-12 10:15:10 -07003211 def pretty_print(self, q):
3212 q.text("bsn_shell_output {")
3213 with q.group():
3214 with q.indent(2):
3215 q.breakable()
3216 q.text("xid = ");
3217 if self.xid != None:
3218 q.text("%#x" % self.xid)
3219 else:
3220 q.text('None')
3221 q.text(","); q.breakable()
3222 q.text("data = ");
3223 q.pp(self.data)
3224 q.breakable()
3225 q.text('}')
3226
Rich Lane7dcdf022013-12-11 14:45:27 -08003227bsn_header.subtypes[7] = bsn_shell_output
3228
3229class bsn_shell_status(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003230 version = 1
3231 type = 4
3232 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003233 subtype = 8
3234
3235 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003236 if xid != None:
3237 self.xid = xid
3238 else:
3239 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003240 if status != None:
3241 self.status = status
3242 else:
3243 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003244 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003245
3246 def pack(self):
3247 packed = []
3248 packed.append(struct.pack("!B", self.version))
3249 packed.append(struct.pack("!B", self.type))
3250 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3251 packed.append(struct.pack("!L", self.xid))
3252 packed.append(struct.pack("!L", self.experimenter))
3253 packed.append(struct.pack("!L", self.subtype))
3254 packed.append(struct.pack("!L", self.status))
3255 length = sum([len(x) for x in packed])
3256 packed[2] = struct.pack("!H", length)
3257 return ''.join(packed)
3258
3259 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003260 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003261 obj = bsn_shell_status()
Dan Talaycof6202252013-07-02 01:00:29 -07003262 _version = reader.read("!B")[0]
3263 assert(_version == 1)
3264 _type = reader.read("!B")[0]
3265 assert(_type == 4)
3266 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003267 orig_reader = reader
3268 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003269 obj.xid = reader.read("!L")[0]
3270 _experimenter = reader.read("!L")[0]
3271 assert(_experimenter == 6035143)
3272 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003273 assert(_subtype == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07003274 obj.status = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003275 return obj
3276
3277 def __eq__(self, other):
3278 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003279 if self.xid != other.xid: return False
3280 if self.status != other.status: return False
3281 return True
3282
Rich Laneb658ddd2013-03-12 10:15:10 -07003283 def pretty_print(self, q):
3284 q.text("bsn_shell_status {")
3285 with q.group():
3286 with q.indent(2):
3287 q.breakable()
3288 q.text("xid = ");
3289 if self.xid != None:
3290 q.text("%#x" % self.xid)
3291 else:
3292 q.text('None')
3293 q.text(","); q.breakable()
3294 q.text("status = ");
3295 q.text("%#x" % self.status)
3296 q.breakable()
3297 q.text('}')
3298
Rich Lane7dcdf022013-12-11 14:45:27 -08003299bsn_header.subtypes[8] = bsn_shell_status
3300
3301class experimenter_stats_reply(stats_reply):
3302 subtypes = {}
3303
Rich Lane95f7fc92014-01-27 17:08:16 -08003304 version = 1
3305 type = 17
3306 stats_type = 65535
3307
3308 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3309 if xid != None:
3310 self.xid = xid
3311 else:
3312 self.xid = None
3313 if flags != None:
3314 self.flags = flags
3315 else:
3316 self.flags = 0
3317 if experimenter != None:
3318 self.experimenter = experimenter
3319 else:
3320 self.experimenter = 0
3321 if data != None:
3322 self.data = data
3323 else:
3324 self.data = ''
3325 return
3326
3327 def pack(self):
3328 packed = []
3329 packed.append(struct.pack("!B", self.version))
3330 packed.append(struct.pack("!B", self.type))
3331 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3332 packed.append(struct.pack("!L", self.xid))
3333 packed.append(struct.pack("!H", self.stats_type))
3334 packed.append(struct.pack("!H", self.flags))
3335 packed.append(struct.pack("!L", self.experimenter))
3336 packed.append(self.data)
3337 length = sum([len(x) for x in packed])
3338 packed[2] = struct.pack("!H", length)
3339 return ''.join(packed)
3340
Rich Lane7dcdf022013-12-11 14:45:27 -08003341 @staticmethod
3342 def unpack(reader):
3343 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003344 subclass = experimenter_stats_reply.subtypes.get(subtype)
3345 if subclass:
3346 return subclass.unpack(reader)
3347
3348 obj = experimenter_stats_reply()
3349 _version = reader.read("!B")[0]
3350 assert(_version == 1)
3351 _type = reader.read("!B")[0]
3352 assert(_type == 17)
3353 _length = reader.read("!H")[0]
3354 orig_reader = reader
3355 reader = orig_reader.slice(_length - (2 + 2))
3356 obj.xid = reader.read("!L")[0]
3357 _stats_type = reader.read("!H")[0]
3358 assert(_stats_type == 65535)
3359 obj.flags = reader.read("!H")[0]
3360 obj.experimenter = reader.read("!L")[0]
3361 obj.data = str(reader.read_all())
3362 return obj
3363
3364 def __eq__(self, other):
3365 if type(self) != type(other): return False
3366 if self.xid != other.xid: return False
3367 if self.flags != other.flags: return False
3368 if self.experimenter != other.experimenter: return False
3369 if self.data != other.data: return False
3370 return True
3371
3372 def pretty_print(self, q):
3373 q.text("experimenter_stats_reply {")
3374 with q.group():
3375 with q.indent(2):
3376 q.breakable()
3377 q.text("xid = ");
3378 if self.xid != None:
3379 q.text("%#x" % self.xid)
3380 else:
3381 q.text('None')
3382 q.text(","); q.breakable()
3383 q.text("flags = ");
3384 q.text("%#x" % self.flags)
3385 q.text(","); q.breakable()
3386 q.text("data = ");
3387 q.pp(self.data)
3388 q.breakable()
3389 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003390
3391stats_reply.subtypes[65535] = experimenter_stats_reply
3392
3393class bsn_stats_reply(experimenter_stats_reply):
3394 subtypes = {}
3395
Rich Lane95f7fc92014-01-27 17:08:16 -08003396 version = 1
3397 type = 19
3398 stats_type = 65535
3399 experimenter = 6035143
3400
3401 def __init__(self, xid=None, flags=None, subtype=None):
3402 if xid != None:
3403 self.xid = xid
3404 else:
3405 self.xid = None
3406 if flags != None:
3407 self.flags = flags
3408 else:
3409 self.flags = 0
3410 if subtype != None:
3411 self.subtype = subtype
3412 else:
3413 self.subtype = 0
3414 return
3415
3416 def pack(self):
3417 packed = []
3418 packed.append(struct.pack("!B", self.version))
3419 packed.append(struct.pack("!B", self.type))
3420 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3421 packed.append(struct.pack("!L", self.xid))
3422 packed.append(struct.pack("!H", self.stats_type))
3423 packed.append(struct.pack("!H", self.flags))
3424 packed.append('\x00' * 4)
3425 packed.append(struct.pack("!L", self.experimenter))
3426 packed.append(struct.pack("!L", self.subtype))
3427 length = sum([len(x) for x in packed])
3428 packed[2] = struct.pack("!H", length)
3429 return ''.join(packed)
3430
Rich Lane7dcdf022013-12-11 14:45:27 -08003431 @staticmethod
3432 def unpack(reader):
3433 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003434 subclass = bsn_stats_reply.subtypes.get(subtype)
3435 if subclass:
3436 return subclass.unpack(reader)
3437
3438 obj = bsn_stats_reply()
3439 _version = reader.read("!B")[0]
3440 assert(_version == 1)
3441 _type = reader.read("!B")[0]
3442 assert(_type == 19)
3443 _length = reader.read("!H")[0]
3444 orig_reader = reader
3445 reader = orig_reader.slice(_length - (2 + 2))
3446 obj.xid = reader.read("!L")[0]
3447 _stats_type = reader.read("!H")[0]
3448 assert(_stats_type == 65535)
3449 obj.flags = reader.read("!H")[0]
3450 reader.skip(4)
3451 _experimenter = reader.read("!L")[0]
3452 assert(_experimenter == 6035143)
3453 obj.subtype = reader.read("!L")[0]
3454 return obj
3455
3456 def __eq__(self, other):
3457 if type(self) != type(other): return False
3458 if self.xid != other.xid: return False
3459 if self.flags != other.flags: return False
3460 if self.subtype != other.subtype: return False
3461 return True
3462
3463 def pretty_print(self, q):
3464 q.text("bsn_stats_reply {")
3465 with q.group():
3466 with q.indent(2):
3467 q.breakable()
3468 q.text("xid = ");
3469 if self.xid != None:
3470 q.text("%#x" % self.xid)
3471 else:
3472 q.text('None')
3473 q.text(","); q.breakable()
3474 q.text("flags = ");
3475 q.text("%#x" % self.flags)
3476 q.breakable()
3477 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003478
3479experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
3480
3481class experimenter_stats_request(stats_request):
3482 subtypes = {}
3483
Rich Lane95f7fc92014-01-27 17:08:16 -08003484 version = 1
3485 type = 16
3486 stats_type = 65535
3487
3488 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3489 if xid != None:
3490 self.xid = xid
3491 else:
3492 self.xid = None
3493 if flags != None:
3494 self.flags = flags
3495 else:
3496 self.flags = 0
3497 if experimenter != None:
3498 self.experimenter = experimenter
3499 else:
3500 self.experimenter = 0
3501 if data != None:
3502 self.data = data
3503 else:
3504 self.data = ''
3505 return
3506
3507 def pack(self):
3508 packed = []
3509 packed.append(struct.pack("!B", self.version))
3510 packed.append(struct.pack("!B", self.type))
3511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3512 packed.append(struct.pack("!L", self.xid))
3513 packed.append(struct.pack("!H", self.stats_type))
3514 packed.append(struct.pack("!H", self.flags))
3515 packed.append(struct.pack("!L", self.experimenter))
3516 packed.append(self.data)
3517 length = sum([len(x) for x in packed])
3518 packed[2] = struct.pack("!H", length)
3519 return ''.join(packed)
3520
Rich Lane7dcdf022013-12-11 14:45:27 -08003521 @staticmethod
3522 def unpack(reader):
3523 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003524 subclass = experimenter_stats_request.subtypes.get(subtype)
3525 if subclass:
3526 return subclass.unpack(reader)
3527
3528 obj = experimenter_stats_request()
3529 _version = reader.read("!B")[0]
3530 assert(_version == 1)
3531 _type = reader.read("!B")[0]
3532 assert(_type == 16)
3533 _length = reader.read("!H")[0]
3534 orig_reader = reader
3535 reader = orig_reader.slice(_length - (2 + 2))
3536 obj.xid = reader.read("!L")[0]
3537 _stats_type = reader.read("!H")[0]
3538 assert(_stats_type == 65535)
3539 obj.flags = reader.read("!H")[0]
3540 obj.experimenter = reader.read("!L")[0]
3541 obj.data = str(reader.read_all())
3542 return obj
3543
3544 def __eq__(self, other):
3545 if type(self) != type(other): return False
3546 if self.xid != other.xid: return False
3547 if self.flags != other.flags: return False
3548 if self.experimenter != other.experimenter: return False
3549 if self.data != other.data: return False
3550 return True
3551
3552 def pretty_print(self, q):
3553 q.text("experimenter_stats_request {")
3554 with q.group():
3555 with q.indent(2):
3556 q.breakable()
3557 q.text("xid = ");
3558 if self.xid != None:
3559 q.text("%#x" % self.xid)
3560 else:
3561 q.text('None')
3562 q.text(","); q.breakable()
3563 q.text("flags = ");
3564 q.text("%#x" % self.flags)
3565 q.text(","); q.breakable()
3566 q.text("data = ");
3567 q.pp(self.data)
3568 q.breakable()
3569 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003570
3571stats_request.subtypes[65535] = experimenter_stats_request
3572
3573class bsn_stats_request(experimenter_stats_request):
3574 subtypes = {}
3575
Rich Lane95f7fc92014-01-27 17:08:16 -08003576 version = 1
3577 type = 18
3578 stats_type = 65535
3579 experimenter = 6035143
3580
3581 def __init__(self, xid=None, flags=None, subtype=None):
3582 if xid != None:
3583 self.xid = xid
3584 else:
3585 self.xid = None
3586 if flags != None:
3587 self.flags = flags
3588 else:
3589 self.flags = 0
3590 if subtype != None:
3591 self.subtype = subtype
3592 else:
3593 self.subtype = 0
3594 return
3595
3596 def pack(self):
3597 packed = []
3598 packed.append(struct.pack("!B", self.version))
3599 packed.append(struct.pack("!B", self.type))
3600 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3601 packed.append(struct.pack("!L", self.xid))
3602 packed.append(struct.pack("!H", self.stats_type))
3603 packed.append(struct.pack("!H", self.flags))
3604 packed.append('\x00' * 4)
3605 packed.append(struct.pack("!L", self.experimenter))
3606 packed.append(struct.pack("!L", self.subtype))
3607 length = sum([len(x) for x in packed])
3608 packed[2] = struct.pack("!H", length)
3609 return ''.join(packed)
3610
Rich Lane7dcdf022013-12-11 14:45:27 -08003611 @staticmethod
3612 def unpack(reader):
3613 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003614 subclass = bsn_stats_request.subtypes.get(subtype)
3615 if subclass:
3616 return subclass.unpack(reader)
3617
3618 obj = bsn_stats_request()
3619 _version = reader.read("!B")[0]
3620 assert(_version == 1)
3621 _type = reader.read("!B")[0]
3622 assert(_type == 18)
3623 _length = reader.read("!H")[0]
3624 orig_reader = reader
3625 reader = orig_reader.slice(_length - (2 + 2))
3626 obj.xid = reader.read("!L")[0]
3627 _stats_type = reader.read("!H")[0]
3628 assert(_stats_type == 65535)
3629 obj.flags = reader.read("!H")[0]
3630 reader.skip(4)
3631 _experimenter = reader.read("!L")[0]
3632 assert(_experimenter == 6035143)
3633 obj.subtype = reader.read("!L")[0]
3634 return obj
3635
3636 def __eq__(self, other):
3637 if type(self) != type(other): return False
3638 if self.xid != other.xid: return False
3639 if self.flags != other.flags: return False
3640 if self.subtype != other.subtype: return False
3641 return True
3642
3643 def pretty_print(self, q):
3644 q.text("bsn_stats_request {")
3645 with q.group():
3646 with q.indent(2):
3647 q.breakable()
3648 q.text("xid = ");
3649 if self.xid != None:
3650 q.text("%#x" % self.xid)
3651 else:
3652 q.text('None')
3653 q.text(","); q.breakable()
3654 q.text("flags = ");
3655 q.text("%#x" % self.flags)
3656 q.breakable()
3657 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003658
3659experimenter_stats_request.subtypes[6035143] = bsn_stats_request
3660
3661class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003662 version = 1
3663 type = 4
3664 experimenter = 6035143
3665 subtype = 16
3666
3667 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003668 if xid != None:
3669 self.xid = xid
3670 else:
3671 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003672 if status != None:
3673 self.status = status
3674 else:
3675 self.status = 0
3676 if vport_no != None:
3677 self.vport_no = vport_no
3678 else:
3679 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003680 return
Dan Talaycof6202252013-07-02 01:00:29 -07003681
3682 def pack(self):
3683 packed = []
3684 packed.append(struct.pack("!B", self.version))
3685 packed.append(struct.pack("!B", self.type))
3686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3687 packed.append(struct.pack("!L", self.xid))
3688 packed.append(struct.pack("!L", self.experimenter))
3689 packed.append(struct.pack("!L", self.subtype))
3690 packed.append(struct.pack("!L", self.status))
3691 packed.append(struct.pack("!L", self.vport_no))
3692 length = sum([len(x) for x in packed])
3693 packed[2] = struct.pack("!H", length)
3694 return ''.join(packed)
3695
3696 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003697 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003698 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003699 _version = reader.read("!B")[0]
3700 assert(_version == 1)
3701 _type = reader.read("!B")[0]
3702 assert(_type == 4)
3703 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003704 orig_reader = reader
3705 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003706 obj.xid = reader.read("!L")[0]
3707 _experimenter = reader.read("!L")[0]
3708 assert(_experimenter == 6035143)
3709 _subtype = reader.read("!L")[0]
3710 assert(_subtype == 16)
3711 obj.status = reader.read("!L")[0]
3712 obj.vport_no = reader.read("!L")[0]
3713 return obj
3714
3715 def __eq__(self, other):
3716 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003717 if self.xid != other.xid: return False
3718 if self.status != other.status: return False
3719 if self.vport_no != other.vport_no: return False
3720 return True
3721
Dan Talaycof6202252013-07-02 01:00:29 -07003722 def pretty_print(self, q):
3723 q.text("bsn_virtual_port_create_reply {")
3724 with q.group():
3725 with q.indent(2):
3726 q.breakable()
3727 q.text("xid = ");
3728 if self.xid != None:
3729 q.text("%#x" % self.xid)
3730 else:
3731 q.text('None')
3732 q.text(","); q.breakable()
3733 q.text("status = ");
3734 q.text("%#x" % self.status)
3735 q.text(","); q.breakable()
3736 q.text("vport_no = ");
3737 q.text("%#x" % self.vport_no)
3738 q.breakable()
3739 q.text('}')
3740
Rich Lane7dcdf022013-12-11 14:45:27 -08003741bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3742
3743class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003744 version = 1
3745 type = 4
3746 experimenter = 6035143
3747 subtype = 15
3748
3749 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003750 if xid != None:
3751 self.xid = xid
3752 else:
3753 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003754 if vport != None:
3755 self.vport = vport
3756 else:
Rich Lane93b33132014-04-21 12:20:58 -07003757 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003758 return
Dan Talaycof6202252013-07-02 01:00:29 -07003759
3760 def pack(self):
3761 packed = []
3762 packed.append(struct.pack("!B", self.version))
3763 packed.append(struct.pack("!B", self.type))
3764 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3765 packed.append(struct.pack("!L", self.xid))
3766 packed.append(struct.pack("!L", self.experimenter))
3767 packed.append(struct.pack("!L", self.subtype))
3768 packed.append(self.vport.pack())
3769 length = sum([len(x) for x in packed])
3770 packed[2] = struct.pack("!H", length)
3771 return ''.join(packed)
3772
3773 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003774 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003775 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003776 _version = reader.read("!B")[0]
3777 assert(_version == 1)
3778 _type = reader.read("!B")[0]
3779 assert(_type == 4)
3780 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003781 orig_reader = reader
3782 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003783 obj.xid = reader.read("!L")[0]
3784 _experimenter = reader.read("!L")[0]
3785 assert(_experimenter == 6035143)
3786 _subtype = reader.read("!L")[0]
3787 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07003788 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003789 return obj
3790
3791 def __eq__(self, other):
3792 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003793 if self.xid != other.xid: return False
3794 if self.vport != other.vport: return False
3795 return True
3796
Dan Talaycof6202252013-07-02 01:00:29 -07003797 def pretty_print(self, q):
3798 q.text("bsn_virtual_port_create_request {")
3799 with q.group():
3800 with q.indent(2):
3801 q.breakable()
3802 q.text("xid = ");
3803 if self.xid != None:
3804 q.text("%#x" % self.xid)
3805 else:
3806 q.text('None')
3807 q.text(","); q.breakable()
3808 q.text("vport = ");
3809 q.pp(self.vport)
3810 q.breakable()
3811 q.text('}')
3812
Rich Lane7dcdf022013-12-11 14:45:27 -08003813bsn_header.subtypes[15] = bsn_virtual_port_create_request
3814
3815class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003816 version = 1
3817 type = 4
3818 experimenter = 6035143
3819 subtype = 26
3820
3821 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003822 if xid != None:
3823 self.xid = xid
3824 else:
3825 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003826 if status != None:
3827 self.status = status
3828 else:
3829 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003830 return
Dan Talaycof6202252013-07-02 01:00:29 -07003831
3832 def pack(self):
3833 packed = []
3834 packed.append(struct.pack("!B", self.version))
3835 packed.append(struct.pack("!B", self.type))
3836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3837 packed.append(struct.pack("!L", self.xid))
3838 packed.append(struct.pack("!L", self.experimenter))
3839 packed.append(struct.pack("!L", self.subtype))
3840 packed.append(struct.pack("!L", self.status))
3841 length = sum([len(x) for x in packed])
3842 packed[2] = struct.pack("!H", length)
3843 return ''.join(packed)
3844
3845 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003846 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003847 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003848 _version = reader.read("!B")[0]
3849 assert(_version == 1)
3850 _type = reader.read("!B")[0]
3851 assert(_type == 4)
3852 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003853 orig_reader = reader
3854 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003855 obj.xid = reader.read("!L")[0]
3856 _experimenter = reader.read("!L")[0]
3857 assert(_experimenter == 6035143)
3858 _subtype = reader.read("!L")[0]
3859 assert(_subtype == 26)
3860 obj.status = reader.read("!L")[0]
3861 return obj
3862
3863 def __eq__(self, other):
3864 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003865 if self.xid != other.xid: return False
3866 if self.status != other.status: return False
3867 return True
3868
Dan Talaycof6202252013-07-02 01:00:29 -07003869 def pretty_print(self, q):
3870 q.text("bsn_virtual_port_remove_reply {")
3871 with q.group():
3872 with q.indent(2):
3873 q.breakable()
3874 q.text("xid = ");
3875 if self.xid != None:
3876 q.text("%#x" % self.xid)
3877 else:
3878 q.text('None')
3879 q.text(","); q.breakable()
3880 q.text("status = ");
3881 q.text("%#x" % self.status)
3882 q.breakable()
3883 q.text('}')
3884
Rich Lane7dcdf022013-12-11 14:45:27 -08003885bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3886
3887class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003888 version = 1
3889 type = 4
3890 experimenter = 6035143
3891 subtype = 17
3892
3893 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003894 if xid != None:
3895 self.xid = xid
3896 else:
3897 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003898 if vport_no != None:
3899 self.vport_no = vport_no
3900 else:
3901 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003902 return
Dan Talaycof6202252013-07-02 01:00:29 -07003903
3904 def pack(self):
3905 packed = []
3906 packed.append(struct.pack("!B", self.version))
3907 packed.append(struct.pack("!B", self.type))
3908 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3909 packed.append(struct.pack("!L", self.xid))
3910 packed.append(struct.pack("!L", self.experimenter))
3911 packed.append(struct.pack("!L", self.subtype))
3912 packed.append(struct.pack("!L", self.vport_no))
3913 length = sum([len(x) for x in packed])
3914 packed[2] = struct.pack("!H", length)
3915 return ''.join(packed)
3916
3917 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003918 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003919 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003920 _version = reader.read("!B")[0]
3921 assert(_version == 1)
3922 _type = reader.read("!B")[0]
3923 assert(_type == 4)
3924 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003925 orig_reader = reader
3926 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003927 obj.xid = reader.read("!L")[0]
3928 _experimenter = reader.read("!L")[0]
3929 assert(_experimenter == 6035143)
3930 _subtype = reader.read("!L")[0]
3931 assert(_subtype == 17)
3932 obj.vport_no = reader.read("!L")[0]
3933 return obj
3934
3935 def __eq__(self, other):
3936 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003937 if self.xid != other.xid: return False
3938 if self.vport_no != other.vport_no: return False
3939 return True
3940
Dan Talaycof6202252013-07-02 01:00:29 -07003941 def pretty_print(self, q):
3942 q.text("bsn_virtual_port_remove_request {")
3943 with q.group():
3944 with q.indent(2):
3945 q.breakable()
3946 q.text("xid = ");
3947 if self.xid != None:
3948 q.text("%#x" % self.xid)
3949 else:
3950 q.text('None')
3951 q.text(","); q.breakable()
3952 q.text("vport_no = ");
3953 q.text("%#x" % self.vport_no)
3954 q.breakable()
3955 q.text('}')
3956
Rich Lane7dcdf022013-12-11 14:45:27 -08003957bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3958
3959class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003960 version = 1
3961 type = 17
3962 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003963
3964 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 -08003965 if xid != None:
3966 self.xid = xid
3967 else:
3968 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003969 if flags != None:
3970 self.flags = flags
3971 else:
3972 self.flags = 0
3973 if mfr_desc != None:
3974 self.mfr_desc = mfr_desc
3975 else:
3976 self.mfr_desc = ""
3977 if hw_desc != None:
3978 self.hw_desc = hw_desc
3979 else:
3980 self.hw_desc = ""
3981 if sw_desc != None:
3982 self.sw_desc = sw_desc
3983 else:
3984 self.sw_desc = ""
3985 if serial_num != None:
3986 self.serial_num = serial_num
3987 else:
3988 self.serial_num = ""
3989 if dp_desc != None:
3990 self.dp_desc = dp_desc
3991 else:
3992 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08003993 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003994
3995 def pack(self):
3996 packed = []
3997 packed.append(struct.pack("!B", self.version))
3998 packed.append(struct.pack("!B", self.type))
3999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4000 packed.append(struct.pack("!L", self.xid))
4001 packed.append(struct.pack("!H", self.stats_type))
4002 packed.append(struct.pack("!H", self.flags))
4003 packed.append(struct.pack("!256s", self.mfr_desc))
4004 packed.append(struct.pack("!256s", self.hw_desc))
4005 packed.append(struct.pack("!256s", self.sw_desc))
4006 packed.append(struct.pack("!32s", self.serial_num))
4007 packed.append(struct.pack("!256s", self.dp_desc))
4008 length = sum([len(x) for x in packed])
4009 packed[2] = struct.pack("!H", length)
4010 return ''.join(packed)
4011
4012 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004013 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004014 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004015 _version = reader.read("!B")[0]
4016 assert(_version == 1)
4017 _type = reader.read("!B")[0]
4018 assert(_type == 17)
4019 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004020 orig_reader = reader
4021 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004022 obj.xid = reader.read("!L")[0]
4023 _stats_type = reader.read("!H")[0]
4024 assert(_stats_type == 0)
4025 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004026 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
4027 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
4028 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
4029 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
4030 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
Rich Laneb658ddd2013-03-12 10:15:10 -07004031 return obj
4032
4033 def __eq__(self, other):
4034 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004035 if self.xid != other.xid: return False
4036 if self.flags != other.flags: return False
4037 if self.mfr_desc != other.mfr_desc: return False
4038 if self.hw_desc != other.hw_desc: return False
4039 if self.sw_desc != other.sw_desc: return False
4040 if self.serial_num != other.serial_num: return False
4041 if self.dp_desc != other.dp_desc: return False
4042 return True
4043
Rich Laneb658ddd2013-03-12 10:15:10 -07004044 def pretty_print(self, q):
4045 q.text("desc_stats_reply {")
4046 with q.group():
4047 with q.indent(2):
4048 q.breakable()
4049 q.text("xid = ");
4050 if self.xid != None:
4051 q.text("%#x" % self.xid)
4052 else:
4053 q.text('None')
4054 q.text(","); q.breakable()
4055 q.text("flags = ");
4056 q.text("%#x" % self.flags)
4057 q.text(","); q.breakable()
4058 q.text("mfr_desc = ");
4059 q.pp(self.mfr_desc)
4060 q.text(","); q.breakable()
4061 q.text("hw_desc = ");
4062 q.pp(self.hw_desc)
4063 q.text(","); q.breakable()
4064 q.text("sw_desc = ");
4065 q.pp(self.sw_desc)
4066 q.text(","); q.breakable()
4067 q.text("serial_num = ");
4068 q.pp(self.serial_num)
4069 q.text(","); q.breakable()
4070 q.text("dp_desc = ");
4071 q.pp(self.dp_desc)
4072 q.breakable()
4073 q.text('}')
4074
Rich Lane7dcdf022013-12-11 14:45:27 -08004075stats_reply.subtypes[0] = desc_stats_reply
4076
4077class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004078 version = 1
4079 type = 16
4080 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004081
4082 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004083 if xid != None:
4084 self.xid = xid
4085 else:
4086 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004087 if flags != None:
4088 self.flags = flags
4089 else:
4090 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004091 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004092
4093 def pack(self):
4094 packed = []
4095 packed.append(struct.pack("!B", self.version))
4096 packed.append(struct.pack("!B", self.type))
4097 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4098 packed.append(struct.pack("!L", self.xid))
4099 packed.append(struct.pack("!H", self.stats_type))
4100 packed.append(struct.pack("!H", self.flags))
4101 length = sum([len(x) for x in packed])
4102 packed[2] = struct.pack("!H", length)
4103 return ''.join(packed)
4104
4105 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004106 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004107 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004108 _version = reader.read("!B")[0]
4109 assert(_version == 1)
4110 _type = reader.read("!B")[0]
4111 assert(_type == 16)
4112 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004113 orig_reader = reader
4114 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004115 obj.xid = reader.read("!L")[0]
4116 _stats_type = reader.read("!H")[0]
4117 assert(_stats_type == 0)
4118 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004119 return obj
4120
4121 def __eq__(self, other):
4122 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004123 if self.xid != other.xid: return False
4124 if self.flags != other.flags: return False
4125 return True
4126
Rich Laneb658ddd2013-03-12 10:15:10 -07004127 def pretty_print(self, q):
4128 q.text("desc_stats_request {")
4129 with q.group():
4130 with q.indent(2):
4131 q.breakable()
4132 q.text("xid = ");
4133 if self.xid != None:
4134 q.text("%#x" % self.xid)
4135 else:
4136 q.text('None')
4137 q.text(","); q.breakable()
4138 q.text("flags = ");
4139 q.text("%#x" % self.flags)
4140 q.breakable()
4141 q.text('}')
4142
Rich Lane7dcdf022013-12-11 14:45:27 -08004143stats_request.subtypes[0] = desc_stats_request
4144
4145class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004146 version = 1
4147 type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004148
4149 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004150 if xid != None:
4151 self.xid = xid
4152 else:
4153 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004154 if data != None:
4155 self.data = data
4156 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004157 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004158 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004159
4160 def pack(self):
4161 packed = []
4162 packed.append(struct.pack("!B", self.version))
4163 packed.append(struct.pack("!B", self.type))
4164 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4165 packed.append(struct.pack("!L", self.xid))
4166 packed.append(self.data)
4167 length = sum([len(x) for x in packed])
4168 packed[2] = struct.pack("!H", length)
4169 return ''.join(packed)
4170
4171 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004172 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004173 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004174 _version = reader.read("!B")[0]
4175 assert(_version == 1)
4176 _type = reader.read("!B")[0]
4177 assert(_type == 3)
4178 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004179 orig_reader = reader
4180 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004181 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004182 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004183 return obj
4184
4185 def __eq__(self, other):
4186 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004187 if self.xid != other.xid: return False
4188 if self.data != other.data: return False
4189 return True
4190
Rich Laneb658ddd2013-03-12 10:15:10 -07004191 def pretty_print(self, q):
4192 q.text("echo_reply {")
4193 with q.group():
4194 with q.indent(2):
4195 q.breakable()
4196 q.text("xid = ");
4197 if self.xid != None:
4198 q.text("%#x" % self.xid)
4199 else:
4200 q.text('None')
4201 q.text(","); q.breakable()
4202 q.text("data = ");
4203 q.pp(self.data)
4204 q.breakable()
4205 q.text('}')
4206
Rich Lane7dcdf022013-12-11 14:45:27 -08004207message.subtypes[3] = echo_reply
4208
4209class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004210 version = 1
4211 type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07004212
4213 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004214 if xid != None:
4215 self.xid = xid
4216 else:
4217 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004218 if data != None:
4219 self.data = data
4220 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004221 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004222 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004223
4224 def pack(self):
4225 packed = []
4226 packed.append(struct.pack("!B", self.version))
4227 packed.append(struct.pack("!B", self.type))
4228 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4229 packed.append(struct.pack("!L", self.xid))
4230 packed.append(self.data)
4231 length = sum([len(x) for x in packed])
4232 packed[2] = struct.pack("!H", length)
4233 return ''.join(packed)
4234
4235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004236 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004237 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004238 _version = reader.read("!B")[0]
4239 assert(_version == 1)
4240 _type = reader.read("!B")[0]
4241 assert(_type == 2)
4242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004243 orig_reader = reader
4244 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004245 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004246 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004247 return obj
4248
4249 def __eq__(self, other):
4250 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004251 if self.xid != other.xid: return False
4252 if self.data != other.data: return False
4253 return True
4254
Rich Laneb658ddd2013-03-12 10:15:10 -07004255 def pretty_print(self, q):
4256 q.text("echo_request {")
4257 with q.group():
4258 with q.indent(2):
4259 q.breakable()
4260 q.text("xid = ");
4261 if self.xid != None:
4262 q.text("%#x" % self.xid)
4263 else:
4264 q.text('None')
4265 q.text(","); q.breakable()
4266 q.text("data = ");
4267 q.pp(self.data)
4268 q.breakable()
4269 q.text('}')
4270
Rich Lane7dcdf022013-12-11 14:45:27 -08004271message.subtypes[2] = echo_request
4272
4273class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004274 version = 1
4275 type = 6
Rich Laneb658ddd2013-03-12 10:15:10 -07004276
Rich Lanec2ee4b82013-04-24 17:12:38 -07004277 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004278 if xid != None:
4279 self.xid = xid
4280 else:
4281 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004282 if datapath_id != None:
4283 self.datapath_id = datapath_id
4284 else:
4285 self.datapath_id = 0
4286 if n_buffers != None:
4287 self.n_buffers = n_buffers
4288 else:
4289 self.n_buffers = 0
4290 if n_tables != None:
4291 self.n_tables = n_tables
4292 else:
4293 self.n_tables = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004294 if capabilities != None:
4295 self.capabilities = capabilities
4296 else:
4297 self.capabilities = 0
4298 if actions != None:
4299 self.actions = actions
4300 else:
4301 self.actions = 0
4302 if ports != None:
4303 self.ports = ports
4304 else:
4305 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004306 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004307
4308 def pack(self):
4309 packed = []
4310 packed.append(struct.pack("!B", self.version))
4311 packed.append(struct.pack("!B", self.type))
4312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4313 packed.append(struct.pack("!L", self.xid))
4314 packed.append(struct.pack("!Q", self.datapath_id))
4315 packed.append(struct.pack("!L", self.n_buffers))
4316 packed.append(struct.pack("!B", self.n_tables))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004317 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07004318 packed.append(struct.pack("!L", self.capabilities))
4319 packed.append(struct.pack("!L", self.actions))
Rich Lane7dcdf022013-12-11 14:45:27 -08004320 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Laneb658ddd2013-03-12 10:15:10 -07004321 length = sum([len(x) for x in packed])
4322 packed[2] = struct.pack("!H", length)
4323 return ''.join(packed)
4324
4325 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004326 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004327 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004328 _version = reader.read("!B")[0]
4329 assert(_version == 1)
4330 _type = reader.read("!B")[0]
4331 assert(_type == 6)
4332 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004333 orig_reader = reader
4334 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004335 obj.xid = reader.read("!L")[0]
4336 obj.datapath_id = reader.read("!Q")[0]
4337 obj.n_buffers = reader.read("!L")[0]
4338 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004339 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07004340 obj.capabilities = reader.read("!L")[0]
4341 obj.actions = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004342 obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004343 return obj
4344
4345 def __eq__(self, other):
4346 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004347 if self.xid != other.xid: return False
4348 if self.datapath_id != other.datapath_id: return False
4349 if self.n_buffers != other.n_buffers: return False
4350 if self.n_tables != other.n_tables: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004351 if self.capabilities != other.capabilities: return False
4352 if self.actions != other.actions: return False
4353 if self.ports != other.ports: return False
4354 return True
4355
Rich Laneb658ddd2013-03-12 10:15:10 -07004356 def pretty_print(self, q):
4357 q.text("features_reply {")
4358 with q.group():
4359 with q.indent(2):
4360 q.breakable()
4361 q.text("xid = ");
4362 if self.xid != None:
4363 q.text("%#x" % self.xid)
4364 else:
4365 q.text('None')
4366 q.text(","); q.breakable()
4367 q.text("datapath_id = ");
4368 q.text("%#x" % self.datapath_id)
4369 q.text(","); q.breakable()
4370 q.text("n_buffers = ");
4371 q.text("%#x" % self.n_buffers)
4372 q.text(","); q.breakable()
4373 q.text("n_tables = ");
4374 q.text("%#x" % self.n_tables)
4375 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004376 q.text("capabilities = ");
4377 q.text("%#x" % self.capabilities)
4378 q.text(","); q.breakable()
4379 q.text("actions = ");
4380 q.text("%#x" % self.actions)
4381 q.text(","); q.breakable()
4382 q.text("ports = ");
4383 q.pp(self.ports)
4384 q.breakable()
4385 q.text('}')
4386
Rich Lane7dcdf022013-12-11 14:45:27 -08004387message.subtypes[6] = features_reply
4388
4389class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004390 version = 1
4391 type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07004392
4393 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004394 if xid != None:
4395 self.xid = xid
4396 else:
4397 self.xid = None
4398 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004399
4400 def pack(self):
4401 packed = []
4402 packed.append(struct.pack("!B", self.version))
4403 packed.append(struct.pack("!B", self.type))
4404 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4405 packed.append(struct.pack("!L", self.xid))
4406 length = sum([len(x) for x in packed])
4407 packed[2] = struct.pack("!H", length)
4408 return ''.join(packed)
4409
4410 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004411 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004412 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004413 _version = reader.read("!B")[0]
4414 assert(_version == 1)
4415 _type = reader.read("!B")[0]
4416 assert(_type == 5)
4417 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004418 orig_reader = reader
4419 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004420 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004421 return obj
4422
4423 def __eq__(self, other):
4424 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004425 if self.xid != other.xid: return False
4426 return True
4427
Rich Laneb658ddd2013-03-12 10:15:10 -07004428 def pretty_print(self, q):
4429 q.text("features_request {")
4430 with q.group():
4431 with q.indent(2):
4432 q.breakable()
4433 q.text("xid = ");
4434 if self.xid != None:
4435 q.text("%#x" % self.xid)
4436 else:
4437 q.text('None')
4438 q.breakable()
4439 q.text('}')
4440
Rich Lane7dcdf022013-12-11 14:45:27 -08004441message.subtypes[5] = features_request
4442
4443class flow_mod(message):
4444 subtypes = {}
4445
Rich Lane95f7fc92014-01-27 17:08:16 -08004446 version = 1
4447 type = 14
4448
4449 def __init__(self, xid=None, match=None, cookie=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
4450 if xid != None:
4451 self.xid = xid
4452 else:
4453 self.xid = None
4454 if match != None:
4455 self.match = match
4456 else:
4457 self.match = common.match()
4458 if cookie != None:
4459 self.cookie = cookie
4460 else:
4461 self.cookie = 0
4462 if _command != None:
4463 self._command = _command
4464 else:
4465 self._command = 0
4466 if idle_timeout != None:
4467 self.idle_timeout = idle_timeout
4468 else:
4469 self.idle_timeout = 0
4470 if hard_timeout != None:
4471 self.hard_timeout = hard_timeout
4472 else:
4473 self.hard_timeout = 0
4474 if priority != None:
4475 self.priority = priority
4476 else:
4477 self.priority = 0
4478 if buffer_id != None:
4479 self.buffer_id = buffer_id
4480 else:
4481 self.buffer_id = 0
4482 if out_port != None:
4483 self.out_port = out_port
4484 else:
4485 self.out_port = 0
4486 if flags != None:
4487 self.flags = flags
4488 else:
4489 self.flags = 0
4490 if actions != None:
4491 self.actions = actions
4492 else:
4493 self.actions = []
4494 return
4495
4496 def pack(self):
4497 packed = []
4498 packed.append(struct.pack("!B", self.version))
4499 packed.append(struct.pack("!B", self.type))
4500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4501 packed.append(struct.pack("!L", self.xid))
4502 packed.append(self.match.pack())
4503 packed.append(struct.pack("!Q", self.cookie))
4504 packed.append(util.pack_fm_cmd(self._command))
4505 packed.append(struct.pack("!H", self.idle_timeout))
4506 packed.append(struct.pack("!H", self.hard_timeout))
4507 packed.append(struct.pack("!H", self.priority))
4508 packed.append(struct.pack("!L", self.buffer_id))
4509 packed.append(util.pack_port_no(self.out_port))
4510 packed.append(struct.pack("!H", self.flags))
4511 packed.append(loxi.generic_util.pack_list(self.actions))
4512 length = sum([len(x) for x in packed])
4513 packed[2] = struct.pack("!H", length)
4514 return ''.join(packed)
4515
Rich Lane7dcdf022013-12-11 14:45:27 -08004516 @staticmethod
4517 def unpack(reader):
4518 subtype, = reader.peek('!H', 56)
Rich Lane95f7fc92014-01-27 17:08:16 -08004519 subclass = flow_mod.subtypes.get(subtype)
4520 if subclass:
4521 return subclass.unpack(reader)
4522
4523 obj = flow_mod()
4524 _version = reader.read("!B")[0]
4525 assert(_version == 1)
4526 _type = reader.read("!B")[0]
4527 assert(_type == 14)
4528 _length = reader.read("!H")[0]
4529 orig_reader = reader
4530 reader = orig_reader.slice(_length - (2 + 2))
4531 obj.xid = reader.read("!L")[0]
4532 obj.match = common.match.unpack(reader)
4533 obj.cookie = reader.read("!Q")[0]
4534 obj._command = util.unpack_fm_cmd(reader)
4535 obj.idle_timeout = reader.read("!H")[0]
4536 obj.hard_timeout = reader.read("!H")[0]
4537 obj.priority = reader.read("!H")[0]
4538 obj.buffer_id = reader.read("!L")[0]
4539 obj.out_port = util.unpack_port_no(reader)
4540 obj.flags = reader.read("!H")[0]
4541 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
4542 return obj
4543
4544 def __eq__(self, other):
4545 if type(self) != type(other): return False
4546 if self.xid != other.xid: return False
4547 if self.match != other.match: return False
4548 if self.cookie != other.cookie: return False
4549 if self._command != other._command: return False
4550 if self.idle_timeout != other.idle_timeout: return False
4551 if self.hard_timeout != other.hard_timeout: return False
4552 if self.priority != other.priority: return False
4553 if self.buffer_id != other.buffer_id: return False
4554 if self.out_port != other.out_port: return False
4555 if self.flags != other.flags: return False
4556 if self.actions != other.actions: return False
4557 return True
4558
4559 def pretty_print(self, q):
4560 q.text("flow_mod {")
4561 with q.group():
4562 with q.indent(2):
4563 q.breakable()
4564 q.text("xid = ");
4565 if self.xid != None:
4566 q.text("%#x" % self.xid)
4567 else:
4568 q.text('None')
4569 q.text(","); q.breakable()
4570 q.text("match = ");
4571 q.pp(self.match)
4572 q.text(","); q.breakable()
4573 q.text("cookie = ");
4574 q.text("%#x" % self.cookie)
4575 q.text(","); q.breakable()
4576 q.text("idle_timeout = ");
4577 q.text("%#x" % self.idle_timeout)
4578 q.text(","); q.breakable()
4579 q.text("hard_timeout = ");
4580 q.text("%#x" % self.hard_timeout)
4581 q.text(","); q.breakable()
4582 q.text("priority = ");
4583 q.text("%#x" % self.priority)
4584 q.text(","); q.breakable()
4585 q.text("buffer_id = ");
4586 q.text("%#x" % self.buffer_id)
4587 q.text(","); q.breakable()
4588 q.text("out_port = ");
4589 q.text(util.pretty_port(self.out_port))
4590 q.text(","); q.breakable()
4591 q.text("flags = ");
4592 q.text("%#x" % self.flags)
4593 q.text(","); q.breakable()
4594 q.text("actions = ");
4595 q.pp(self.actions)
4596 q.breakable()
4597 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08004598
4599message.subtypes[14] = flow_mod
4600
4601class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004602 version = 1
4603 type = 14
4604 _command = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004605
4606 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004607 if xid != None:
4608 self.xid = xid
4609 else:
4610 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004611 if match != None:
4612 self.match = match
4613 else:
4614 self.match = common.match()
4615 if cookie != None:
4616 self.cookie = cookie
4617 else:
4618 self.cookie = 0
4619 if idle_timeout != None:
4620 self.idle_timeout = idle_timeout
4621 else:
4622 self.idle_timeout = 0
4623 if hard_timeout != None:
4624 self.hard_timeout = hard_timeout
4625 else:
4626 self.hard_timeout = 0
4627 if priority != None:
4628 self.priority = priority
4629 else:
4630 self.priority = 0
4631 if buffer_id != None:
4632 self.buffer_id = buffer_id
4633 else:
4634 self.buffer_id = 0
4635 if out_port != None:
4636 self.out_port = out_port
4637 else:
4638 self.out_port = 0
4639 if flags != None:
4640 self.flags = flags
4641 else:
4642 self.flags = 0
4643 if actions != None:
4644 self.actions = actions
4645 else:
4646 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004647 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004648
4649 def pack(self):
4650 packed = []
4651 packed.append(struct.pack("!B", self.version))
4652 packed.append(struct.pack("!B", self.type))
4653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4654 packed.append(struct.pack("!L", self.xid))
4655 packed.append(self.match.pack())
4656 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004657 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004658 packed.append(struct.pack("!H", self.idle_timeout))
4659 packed.append(struct.pack("!H", self.hard_timeout))
4660 packed.append(struct.pack("!H", self.priority))
4661 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004662 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004663 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004664 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004665 length = sum([len(x) for x in packed])
4666 packed[2] = struct.pack("!H", length)
4667 return ''.join(packed)
4668
4669 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004670 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004671 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07004672 _version = reader.read("!B")[0]
4673 assert(_version == 1)
4674 _type = reader.read("!B")[0]
4675 assert(_type == 14)
4676 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004677 orig_reader = reader
4678 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004679 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004680 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004681 obj.cookie = reader.read("!Q")[0]
4682 __command = util.unpack_fm_cmd(reader)
4683 assert(__command == 0)
4684 obj.idle_timeout = reader.read("!H")[0]
4685 obj.hard_timeout = reader.read("!H")[0]
4686 obj.priority = reader.read("!H")[0]
4687 obj.buffer_id = reader.read("!L")[0]
4688 obj.out_port = util.unpack_port_no(reader)
4689 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004690 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004691 return obj
4692
4693 def __eq__(self, other):
4694 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004695 if self.xid != other.xid: return False
4696 if self.match != other.match: return False
4697 if self.cookie != other.cookie: return False
4698 if self.idle_timeout != other.idle_timeout: return False
4699 if self.hard_timeout != other.hard_timeout: return False
4700 if self.priority != other.priority: return False
4701 if self.buffer_id != other.buffer_id: return False
4702 if self.out_port != other.out_port: return False
4703 if self.flags != other.flags: return False
4704 if self.actions != other.actions: return False
4705 return True
4706
Rich Laneb658ddd2013-03-12 10:15:10 -07004707 def pretty_print(self, q):
4708 q.text("flow_add {")
4709 with q.group():
4710 with q.indent(2):
4711 q.breakable()
4712 q.text("xid = ");
4713 if self.xid != None:
4714 q.text("%#x" % self.xid)
4715 else:
4716 q.text('None')
4717 q.text(","); q.breakable()
4718 q.text("match = ");
4719 q.pp(self.match)
4720 q.text(","); q.breakable()
4721 q.text("cookie = ");
4722 q.text("%#x" % self.cookie)
4723 q.text(","); q.breakable()
4724 q.text("idle_timeout = ");
4725 q.text("%#x" % self.idle_timeout)
4726 q.text(","); q.breakable()
4727 q.text("hard_timeout = ");
4728 q.text("%#x" % self.hard_timeout)
4729 q.text(","); q.breakable()
4730 q.text("priority = ");
4731 q.text("%#x" % self.priority)
4732 q.text(","); q.breakable()
4733 q.text("buffer_id = ");
4734 q.text("%#x" % self.buffer_id)
4735 q.text(","); q.breakable()
4736 q.text("out_port = ");
4737 q.text(util.pretty_port(self.out_port))
4738 q.text(","); q.breakable()
4739 q.text("flags = ");
4740 q.text("%#x" % self.flags)
4741 q.text(","); q.breakable()
4742 q.text("actions = ");
4743 q.pp(self.actions)
4744 q.breakable()
4745 q.text('}')
4746
Rich Lane7dcdf022013-12-11 14:45:27 -08004747flow_mod.subtypes[0] = flow_add
4748
4749class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004750 version = 1
4751 type = 14
4752 _command = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004753
4754 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004755 if xid != None:
4756 self.xid = xid
4757 else:
4758 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004759 if match != None:
4760 self.match = match
4761 else:
4762 self.match = common.match()
4763 if cookie != None:
4764 self.cookie = cookie
4765 else:
4766 self.cookie = 0
4767 if idle_timeout != None:
4768 self.idle_timeout = idle_timeout
4769 else:
4770 self.idle_timeout = 0
4771 if hard_timeout != None:
4772 self.hard_timeout = hard_timeout
4773 else:
4774 self.hard_timeout = 0
4775 if priority != None:
4776 self.priority = priority
4777 else:
4778 self.priority = 0
4779 if buffer_id != None:
4780 self.buffer_id = buffer_id
4781 else:
4782 self.buffer_id = 0
4783 if out_port != None:
4784 self.out_port = out_port
4785 else:
4786 self.out_port = 0
4787 if flags != None:
4788 self.flags = flags
4789 else:
4790 self.flags = 0
4791 if actions != None:
4792 self.actions = actions
4793 else:
4794 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004795 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004796
4797 def pack(self):
4798 packed = []
4799 packed.append(struct.pack("!B", self.version))
4800 packed.append(struct.pack("!B", self.type))
4801 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4802 packed.append(struct.pack("!L", self.xid))
4803 packed.append(self.match.pack())
4804 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004805 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004806 packed.append(struct.pack("!H", self.idle_timeout))
4807 packed.append(struct.pack("!H", self.hard_timeout))
4808 packed.append(struct.pack("!H", self.priority))
4809 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004810 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004811 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004812 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004813 length = sum([len(x) for x in packed])
4814 packed[2] = struct.pack("!H", length)
4815 return ''.join(packed)
4816
4817 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004818 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004819 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004820 _version = reader.read("!B")[0]
4821 assert(_version == 1)
4822 _type = reader.read("!B")[0]
4823 assert(_type == 14)
4824 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004825 orig_reader = reader
4826 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004827 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004828 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004829 obj.cookie = reader.read("!Q")[0]
4830 __command = util.unpack_fm_cmd(reader)
4831 assert(__command == 3)
4832 obj.idle_timeout = reader.read("!H")[0]
4833 obj.hard_timeout = reader.read("!H")[0]
4834 obj.priority = reader.read("!H")[0]
4835 obj.buffer_id = reader.read("!L")[0]
4836 obj.out_port = util.unpack_port_no(reader)
4837 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004838 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004839 return obj
4840
4841 def __eq__(self, other):
4842 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004843 if self.xid != other.xid: return False
4844 if self.match != other.match: return False
4845 if self.cookie != other.cookie: return False
4846 if self.idle_timeout != other.idle_timeout: return False
4847 if self.hard_timeout != other.hard_timeout: return False
4848 if self.priority != other.priority: return False
4849 if self.buffer_id != other.buffer_id: return False
4850 if self.out_port != other.out_port: return False
4851 if self.flags != other.flags: return False
4852 if self.actions != other.actions: return False
4853 return True
4854
Rich Laneb658ddd2013-03-12 10:15:10 -07004855 def pretty_print(self, q):
4856 q.text("flow_delete {")
4857 with q.group():
4858 with q.indent(2):
4859 q.breakable()
4860 q.text("xid = ");
4861 if self.xid != None:
4862 q.text("%#x" % self.xid)
4863 else:
4864 q.text('None')
4865 q.text(","); q.breakable()
4866 q.text("match = ");
4867 q.pp(self.match)
4868 q.text(","); q.breakable()
4869 q.text("cookie = ");
4870 q.text("%#x" % self.cookie)
4871 q.text(","); q.breakable()
4872 q.text("idle_timeout = ");
4873 q.text("%#x" % self.idle_timeout)
4874 q.text(","); q.breakable()
4875 q.text("hard_timeout = ");
4876 q.text("%#x" % self.hard_timeout)
4877 q.text(","); q.breakable()
4878 q.text("priority = ");
4879 q.text("%#x" % self.priority)
4880 q.text(","); q.breakable()
4881 q.text("buffer_id = ");
4882 q.text("%#x" % self.buffer_id)
4883 q.text(","); q.breakable()
4884 q.text("out_port = ");
4885 q.text(util.pretty_port(self.out_port))
4886 q.text(","); q.breakable()
4887 q.text("flags = ");
4888 q.text("%#x" % self.flags)
4889 q.text(","); q.breakable()
4890 q.text("actions = ");
4891 q.pp(self.actions)
4892 q.breakable()
4893 q.text('}')
4894
Rich Lane7dcdf022013-12-11 14:45:27 -08004895flow_mod.subtypes[3] = flow_delete
4896
4897class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004898 version = 1
4899 type = 14
4900 _command = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07004901
4902 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004903 if xid != None:
4904 self.xid = xid
4905 else:
4906 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004907 if match != None:
4908 self.match = match
4909 else:
4910 self.match = common.match()
4911 if cookie != None:
4912 self.cookie = cookie
4913 else:
4914 self.cookie = 0
4915 if idle_timeout != None:
4916 self.idle_timeout = idle_timeout
4917 else:
4918 self.idle_timeout = 0
4919 if hard_timeout != None:
4920 self.hard_timeout = hard_timeout
4921 else:
4922 self.hard_timeout = 0
4923 if priority != None:
4924 self.priority = priority
4925 else:
4926 self.priority = 0
4927 if buffer_id != None:
4928 self.buffer_id = buffer_id
4929 else:
4930 self.buffer_id = 0
4931 if out_port != None:
4932 self.out_port = out_port
4933 else:
4934 self.out_port = 0
4935 if flags != None:
4936 self.flags = flags
4937 else:
4938 self.flags = 0
4939 if actions != None:
4940 self.actions = actions
4941 else:
4942 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004943 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004944
4945 def pack(self):
4946 packed = []
4947 packed.append(struct.pack("!B", self.version))
4948 packed.append(struct.pack("!B", self.type))
4949 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4950 packed.append(struct.pack("!L", self.xid))
4951 packed.append(self.match.pack())
4952 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004953 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004954 packed.append(struct.pack("!H", self.idle_timeout))
4955 packed.append(struct.pack("!H", self.hard_timeout))
4956 packed.append(struct.pack("!H", self.priority))
4957 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004958 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004959 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004960 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004961 length = sum([len(x) for x in packed])
4962 packed[2] = struct.pack("!H", length)
4963 return ''.join(packed)
4964
4965 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004966 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004967 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004968 _version = reader.read("!B")[0]
4969 assert(_version == 1)
4970 _type = reader.read("!B")[0]
4971 assert(_type == 14)
4972 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004973 orig_reader = reader
4974 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004975 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004976 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004977 obj.cookie = reader.read("!Q")[0]
4978 __command = util.unpack_fm_cmd(reader)
4979 assert(__command == 4)
4980 obj.idle_timeout = reader.read("!H")[0]
4981 obj.hard_timeout = reader.read("!H")[0]
4982 obj.priority = reader.read("!H")[0]
4983 obj.buffer_id = reader.read("!L")[0]
4984 obj.out_port = util.unpack_port_no(reader)
4985 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004986 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004987 return obj
4988
4989 def __eq__(self, other):
4990 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004991 if self.xid != other.xid: return False
4992 if self.match != other.match: return False
4993 if self.cookie != other.cookie: return False
4994 if self.idle_timeout != other.idle_timeout: return False
4995 if self.hard_timeout != other.hard_timeout: return False
4996 if self.priority != other.priority: return False
4997 if self.buffer_id != other.buffer_id: return False
4998 if self.out_port != other.out_port: return False
4999 if self.flags != other.flags: return False
5000 if self.actions != other.actions: return False
5001 return True
5002
Rich Laneb658ddd2013-03-12 10:15:10 -07005003 def pretty_print(self, q):
5004 q.text("flow_delete_strict {")
5005 with q.group():
5006 with q.indent(2):
5007 q.breakable()
5008 q.text("xid = ");
5009 if self.xid != None:
5010 q.text("%#x" % self.xid)
5011 else:
5012 q.text('None')
5013 q.text(","); q.breakable()
5014 q.text("match = ");
5015 q.pp(self.match)
5016 q.text(","); q.breakable()
5017 q.text("cookie = ");
5018 q.text("%#x" % self.cookie)
5019 q.text(","); q.breakable()
5020 q.text("idle_timeout = ");
5021 q.text("%#x" % self.idle_timeout)
5022 q.text(","); q.breakable()
5023 q.text("hard_timeout = ");
5024 q.text("%#x" % self.hard_timeout)
5025 q.text(","); q.breakable()
5026 q.text("priority = ");
5027 q.text("%#x" % self.priority)
5028 q.text(","); q.breakable()
5029 q.text("buffer_id = ");
5030 q.text("%#x" % self.buffer_id)
5031 q.text(","); q.breakable()
5032 q.text("out_port = ");
5033 q.text(util.pretty_port(self.out_port))
5034 q.text(","); q.breakable()
5035 q.text("flags = ");
5036 q.text("%#x" % self.flags)
5037 q.text(","); q.breakable()
5038 q.text("actions = ");
5039 q.pp(self.actions)
5040 q.breakable()
5041 q.text('}')
5042
Rich Lane7dcdf022013-12-11 14:45:27 -08005043flow_mod.subtypes[4] = flow_delete_strict
5044
5045class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005046 version = 1
5047 type = 1
5048 err_type = 3
5049
5050 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005051 if xid != None:
5052 self.xid = xid
5053 else:
5054 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005055 if code != None:
5056 self.code = code
5057 else:
5058 self.code = 0
5059 if data != None:
5060 self.data = data
5061 else:
5062 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005063 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005064
5065 def pack(self):
5066 packed = []
5067 packed.append(struct.pack("!B", self.version))
5068 packed.append(struct.pack("!B", self.type))
5069 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5070 packed.append(struct.pack("!L", self.xid))
5071 packed.append(struct.pack("!H", self.err_type))
5072 packed.append(struct.pack("!H", self.code))
5073 packed.append(self.data)
5074 length = sum([len(x) for x in packed])
5075 packed[2] = struct.pack("!H", length)
5076 return ''.join(packed)
5077
5078 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005079 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005080 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005081 _version = reader.read("!B")[0]
5082 assert(_version == 1)
5083 _type = reader.read("!B")[0]
5084 assert(_type == 1)
5085 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005086 orig_reader = reader
5087 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005088 obj.xid = reader.read("!L")[0]
5089 _err_type = reader.read("!H")[0]
5090 assert(_err_type == 3)
5091 obj.code = reader.read("!H")[0]
5092 obj.data = str(reader.read_all())
5093 return obj
5094
5095 def __eq__(self, other):
5096 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005097 if self.xid != other.xid: return False
5098 if self.code != other.code: return False
5099 if self.data != other.data: return False
5100 return True
5101
Rich Lane6f4978c2013-10-20 21:33:52 -07005102 def pretty_print(self, q):
5103 q.text("flow_mod_failed_error_msg {")
5104 with q.group():
5105 with q.indent(2):
5106 q.breakable()
5107 q.text("xid = ");
5108 if self.xid != None:
5109 q.text("%#x" % self.xid)
5110 else:
5111 q.text('None')
5112 q.text(","); q.breakable()
5113 q.text("code = ");
5114 q.text("%#x" % self.code)
5115 q.text(","); q.breakable()
5116 q.text("data = ");
5117 q.pp(self.data)
5118 q.breakable()
5119 q.text('}')
5120
Rich Lane7dcdf022013-12-11 14:45:27 -08005121error_msg.subtypes[3] = flow_mod_failed_error_msg
5122
5123class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005124 version = 1
5125 type = 14
5126 _command = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005127
5128 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005129 if xid != None:
5130 self.xid = xid
5131 else:
5132 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005133 if match != None:
5134 self.match = match
5135 else:
5136 self.match = common.match()
5137 if cookie != None:
5138 self.cookie = cookie
5139 else:
5140 self.cookie = 0
5141 if idle_timeout != None:
5142 self.idle_timeout = idle_timeout
5143 else:
5144 self.idle_timeout = 0
5145 if hard_timeout != None:
5146 self.hard_timeout = hard_timeout
5147 else:
5148 self.hard_timeout = 0
5149 if priority != None:
5150 self.priority = priority
5151 else:
5152 self.priority = 0
5153 if buffer_id != None:
5154 self.buffer_id = buffer_id
5155 else:
5156 self.buffer_id = 0
5157 if out_port != None:
5158 self.out_port = out_port
5159 else:
5160 self.out_port = 0
5161 if flags != None:
5162 self.flags = flags
5163 else:
5164 self.flags = 0
5165 if actions != None:
5166 self.actions = actions
5167 else:
5168 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005169 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005170
5171 def pack(self):
5172 packed = []
5173 packed.append(struct.pack("!B", self.version))
5174 packed.append(struct.pack("!B", self.type))
5175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5176 packed.append(struct.pack("!L", self.xid))
5177 packed.append(self.match.pack())
5178 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005179 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005180 packed.append(struct.pack("!H", self.idle_timeout))
5181 packed.append(struct.pack("!H", self.hard_timeout))
5182 packed.append(struct.pack("!H", self.priority))
5183 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005184 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005185 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005186 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005187 length = sum([len(x) for x in packed])
5188 packed[2] = struct.pack("!H", length)
5189 return ''.join(packed)
5190
5191 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005192 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005193 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07005194 _version = reader.read("!B")[0]
5195 assert(_version == 1)
5196 _type = reader.read("!B")[0]
5197 assert(_type == 14)
5198 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005199 orig_reader = reader
5200 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005201 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005202 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005203 obj.cookie = reader.read("!Q")[0]
5204 __command = util.unpack_fm_cmd(reader)
5205 assert(__command == 1)
5206 obj.idle_timeout = reader.read("!H")[0]
5207 obj.hard_timeout = reader.read("!H")[0]
5208 obj.priority = reader.read("!H")[0]
5209 obj.buffer_id = reader.read("!L")[0]
5210 obj.out_port = util.unpack_port_no(reader)
5211 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005212 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005213 return obj
5214
5215 def __eq__(self, other):
5216 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005217 if self.xid != other.xid: return False
5218 if self.match != other.match: return False
5219 if self.cookie != other.cookie: return False
5220 if self.idle_timeout != other.idle_timeout: return False
5221 if self.hard_timeout != other.hard_timeout: return False
5222 if self.priority != other.priority: return False
5223 if self.buffer_id != other.buffer_id: return False
5224 if self.out_port != other.out_port: return False
5225 if self.flags != other.flags: return False
5226 if self.actions != other.actions: return False
5227 return True
5228
Rich Laneb658ddd2013-03-12 10:15:10 -07005229 def pretty_print(self, q):
5230 q.text("flow_modify {")
5231 with q.group():
5232 with q.indent(2):
5233 q.breakable()
5234 q.text("xid = ");
5235 if self.xid != None:
5236 q.text("%#x" % self.xid)
5237 else:
5238 q.text('None')
5239 q.text(","); q.breakable()
5240 q.text("match = ");
5241 q.pp(self.match)
5242 q.text(","); q.breakable()
5243 q.text("cookie = ");
5244 q.text("%#x" % self.cookie)
5245 q.text(","); q.breakable()
5246 q.text("idle_timeout = ");
5247 q.text("%#x" % self.idle_timeout)
5248 q.text(","); q.breakable()
5249 q.text("hard_timeout = ");
5250 q.text("%#x" % self.hard_timeout)
5251 q.text(","); q.breakable()
5252 q.text("priority = ");
5253 q.text("%#x" % self.priority)
5254 q.text(","); q.breakable()
5255 q.text("buffer_id = ");
5256 q.text("%#x" % self.buffer_id)
5257 q.text(","); q.breakable()
5258 q.text("out_port = ");
5259 q.text(util.pretty_port(self.out_port))
5260 q.text(","); q.breakable()
5261 q.text("flags = ");
5262 q.text("%#x" % self.flags)
5263 q.text(","); q.breakable()
5264 q.text("actions = ");
5265 q.pp(self.actions)
5266 q.breakable()
5267 q.text('}')
5268
Rich Lane7dcdf022013-12-11 14:45:27 -08005269flow_mod.subtypes[1] = flow_modify
5270
5271class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005272 version = 1
5273 type = 14
5274 _command = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07005275
5276 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005277 if xid != None:
5278 self.xid = xid
5279 else:
5280 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005281 if match != None:
5282 self.match = match
5283 else:
5284 self.match = common.match()
5285 if cookie != None:
5286 self.cookie = cookie
5287 else:
5288 self.cookie = 0
5289 if idle_timeout != None:
5290 self.idle_timeout = idle_timeout
5291 else:
5292 self.idle_timeout = 0
5293 if hard_timeout != None:
5294 self.hard_timeout = hard_timeout
5295 else:
5296 self.hard_timeout = 0
5297 if priority != None:
5298 self.priority = priority
5299 else:
5300 self.priority = 0
5301 if buffer_id != None:
5302 self.buffer_id = buffer_id
5303 else:
5304 self.buffer_id = 0
5305 if out_port != None:
5306 self.out_port = out_port
5307 else:
5308 self.out_port = 0
5309 if flags != None:
5310 self.flags = flags
5311 else:
5312 self.flags = 0
5313 if actions != None:
5314 self.actions = actions
5315 else:
5316 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005317 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005318
5319 def pack(self):
5320 packed = []
5321 packed.append(struct.pack("!B", self.version))
5322 packed.append(struct.pack("!B", self.type))
5323 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5324 packed.append(struct.pack("!L", self.xid))
5325 packed.append(self.match.pack())
5326 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005327 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005328 packed.append(struct.pack("!H", self.idle_timeout))
5329 packed.append(struct.pack("!H", self.hard_timeout))
5330 packed.append(struct.pack("!H", self.priority))
5331 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005332 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005333 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005334 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005335 length = sum([len(x) for x in packed])
5336 packed[2] = struct.pack("!H", length)
5337 return ''.join(packed)
5338
5339 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005340 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005341 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07005342 _version = reader.read("!B")[0]
5343 assert(_version == 1)
5344 _type = reader.read("!B")[0]
5345 assert(_type == 14)
5346 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005347 orig_reader = reader
5348 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005349 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005350 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005351 obj.cookie = reader.read("!Q")[0]
5352 __command = util.unpack_fm_cmd(reader)
5353 assert(__command == 2)
5354 obj.idle_timeout = reader.read("!H")[0]
5355 obj.hard_timeout = reader.read("!H")[0]
5356 obj.priority = reader.read("!H")[0]
5357 obj.buffer_id = reader.read("!L")[0]
5358 obj.out_port = util.unpack_port_no(reader)
5359 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005360 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005361 return obj
5362
5363 def __eq__(self, other):
5364 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005365 if self.xid != other.xid: return False
5366 if self.match != other.match: return False
5367 if self.cookie != other.cookie: return False
5368 if self.idle_timeout != other.idle_timeout: return False
5369 if self.hard_timeout != other.hard_timeout: return False
5370 if self.priority != other.priority: return False
5371 if self.buffer_id != other.buffer_id: return False
5372 if self.out_port != other.out_port: return False
5373 if self.flags != other.flags: return False
5374 if self.actions != other.actions: return False
5375 return True
5376
Rich Laneb658ddd2013-03-12 10:15:10 -07005377 def pretty_print(self, q):
5378 q.text("flow_modify_strict {")
5379 with q.group():
5380 with q.indent(2):
5381 q.breakable()
5382 q.text("xid = ");
5383 if self.xid != None:
5384 q.text("%#x" % self.xid)
5385 else:
5386 q.text('None')
5387 q.text(","); q.breakable()
5388 q.text("match = ");
5389 q.pp(self.match)
5390 q.text(","); q.breakable()
5391 q.text("cookie = ");
5392 q.text("%#x" % self.cookie)
5393 q.text(","); q.breakable()
5394 q.text("idle_timeout = ");
5395 q.text("%#x" % self.idle_timeout)
5396 q.text(","); q.breakable()
5397 q.text("hard_timeout = ");
5398 q.text("%#x" % self.hard_timeout)
5399 q.text(","); q.breakable()
5400 q.text("priority = ");
5401 q.text("%#x" % self.priority)
5402 q.text(","); q.breakable()
5403 q.text("buffer_id = ");
5404 q.text("%#x" % self.buffer_id)
5405 q.text(","); q.breakable()
5406 q.text("out_port = ");
5407 q.text(util.pretty_port(self.out_port))
5408 q.text(","); q.breakable()
5409 q.text("flags = ");
5410 q.text("%#x" % self.flags)
5411 q.text(","); q.breakable()
5412 q.text("actions = ");
5413 q.pp(self.actions)
5414 q.breakable()
5415 q.text('}')
5416
Rich Lane7dcdf022013-12-11 14:45:27 -08005417flow_mod.subtypes[2] = flow_modify_strict
5418
5419class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005420 version = 1
5421 type = 11
Rich Laneb658ddd2013-03-12 10:15:10 -07005422
Rich Lanec2ee4b82013-04-24 17:12:38 -07005423 def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005424 if xid != None:
5425 self.xid = xid
5426 else:
5427 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005428 if match != None:
5429 self.match = match
5430 else:
5431 self.match = common.match()
5432 if cookie != None:
5433 self.cookie = cookie
5434 else:
5435 self.cookie = 0
5436 if priority != None:
5437 self.priority = priority
5438 else:
5439 self.priority = 0
5440 if reason != None:
5441 self.reason = reason
5442 else:
5443 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005444 if duration_sec != None:
5445 self.duration_sec = duration_sec
5446 else:
5447 self.duration_sec = 0
5448 if duration_nsec != None:
5449 self.duration_nsec = duration_nsec
5450 else:
5451 self.duration_nsec = 0
5452 if idle_timeout != None:
5453 self.idle_timeout = idle_timeout
5454 else:
5455 self.idle_timeout = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005456 if packet_count != None:
5457 self.packet_count = packet_count
5458 else:
5459 self.packet_count = 0
5460 if byte_count != None:
5461 self.byte_count = byte_count
5462 else:
5463 self.byte_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005464 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005465
5466 def pack(self):
5467 packed = []
5468 packed.append(struct.pack("!B", self.version))
5469 packed.append(struct.pack("!B", self.type))
5470 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5471 packed.append(struct.pack("!L", self.xid))
5472 packed.append(self.match.pack())
5473 packed.append(struct.pack("!Q", self.cookie))
5474 packed.append(struct.pack("!H", self.priority))
5475 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005476 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07005477 packed.append(struct.pack("!L", self.duration_sec))
5478 packed.append(struct.pack("!L", self.duration_nsec))
5479 packed.append(struct.pack("!H", self.idle_timeout))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005480 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07005481 packed.append(struct.pack("!Q", self.packet_count))
5482 packed.append(struct.pack("!Q", self.byte_count))
5483 length = sum([len(x) for x in packed])
5484 packed[2] = struct.pack("!H", length)
5485 return ''.join(packed)
5486
5487 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005488 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005489 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07005490 _version = reader.read("!B")[0]
5491 assert(_version == 1)
5492 _type = reader.read("!B")[0]
5493 assert(_type == 11)
5494 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005495 orig_reader = reader
5496 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005497 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005498 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005499 obj.cookie = reader.read("!Q")[0]
5500 obj.priority = reader.read("!H")[0]
5501 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005502 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005503 obj.duration_sec = reader.read("!L")[0]
5504 obj.duration_nsec = reader.read("!L")[0]
5505 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005506 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07005507 obj.packet_count = reader.read("!Q")[0]
5508 obj.byte_count = reader.read("!Q")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005509 return obj
5510
5511 def __eq__(self, other):
5512 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005513 if self.xid != other.xid: return False
5514 if self.match != other.match: return False
5515 if self.cookie != other.cookie: return False
5516 if self.priority != other.priority: return False
5517 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005518 if self.duration_sec != other.duration_sec: return False
5519 if self.duration_nsec != other.duration_nsec: return False
5520 if self.idle_timeout != other.idle_timeout: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005521 if self.packet_count != other.packet_count: return False
5522 if self.byte_count != other.byte_count: return False
5523 return True
5524
Rich Laneb658ddd2013-03-12 10:15:10 -07005525 def pretty_print(self, q):
5526 q.text("flow_removed {")
5527 with q.group():
5528 with q.indent(2):
5529 q.breakable()
5530 q.text("xid = ");
5531 if self.xid != None:
5532 q.text("%#x" % self.xid)
5533 else:
5534 q.text('None')
5535 q.text(","); q.breakable()
5536 q.text("match = ");
5537 q.pp(self.match)
5538 q.text(","); q.breakable()
5539 q.text("cookie = ");
5540 q.text("%#x" % self.cookie)
5541 q.text(","); q.breakable()
5542 q.text("priority = ");
5543 q.text("%#x" % self.priority)
5544 q.text(","); q.breakable()
5545 q.text("reason = ");
5546 q.text("%#x" % self.reason)
5547 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005548 q.text("duration_sec = ");
5549 q.text("%#x" % self.duration_sec)
5550 q.text(","); q.breakable()
5551 q.text("duration_nsec = ");
5552 q.text("%#x" % self.duration_nsec)
5553 q.text(","); q.breakable()
5554 q.text("idle_timeout = ");
5555 q.text("%#x" % self.idle_timeout)
5556 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005557 q.text("packet_count = ");
5558 q.text("%#x" % self.packet_count)
5559 q.text(","); q.breakable()
5560 q.text("byte_count = ");
5561 q.text("%#x" % self.byte_count)
5562 q.breakable()
5563 q.text('}')
5564
Rich Lane7dcdf022013-12-11 14:45:27 -08005565message.subtypes[11] = flow_removed
5566
5567class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005568 version = 1
5569 type = 17
5570 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005571
5572 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005573 if xid != None:
5574 self.xid = xid
5575 else:
5576 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005577 if flags != None:
5578 self.flags = flags
5579 else:
5580 self.flags = 0
5581 if entries != None:
5582 self.entries = entries
5583 else:
5584 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005585 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005586
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.stats_type))
5594 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005595 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07005596 length = sum([len(x) for x in packed])
5597 packed[2] = struct.pack("!H", length)
5598 return ''.join(packed)
5599
5600 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005601 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005602 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005603 _version = reader.read("!B")[0]
5604 assert(_version == 1)
5605 _type = reader.read("!B")[0]
5606 assert(_type == 17)
5607 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005608 orig_reader = reader
5609 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005610 obj.xid = reader.read("!L")[0]
5611 _stats_type = reader.read("!H")[0]
5612 assert(_stats_type == 1)
5613 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005614 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005615 return obj
5616
5617 def __eq__(self, other):
5618 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005619 if self.xid != other.xid: return False
5620 if self.flags != other.flags: return False
5621 if self.entries != other.entries: return False
5622 return True
5623
Rich Laneb658ddd2013-03-12 10:15:10 -07005624 def pretty_print(self, q):
5625 q.text("flow_stats_reply {")
5626 with q.group():
5627 with q.indent(2):
5628 q.breakable()
5629 q.text("xid = ");
5630 if self.xid != None:
5631 q.text("%#x" % self.xid)
5632 else:
5633 q.text('None')
5634 q.text(","); q.breakable()
5635 q.text("flags = ");
5636 q.text("%#x" % self.flags)
5637 q.text(","); q.breakable()
5638 q.text("entries = ");
5639 q.pp(self.entries)
5640 q.breakable()
5641 q.text('}')
5642
Rich Lane7dcdf022013-12-11 14:45:27 -08005643stats_reply.subtypes[1] = flow_stats_reply
5644
5645class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005646 version = 1
5647 type = 16
5648 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005649
Rich Lanec2ee4b82013-04-24 17:12:38 -07005650 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005651 if xid != None:
5652 self.xid = xid
5653 else:
5654 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005655 if flags != None:
5656 self.flags = flags
5657 else:
5658 self.flags = 0
5659 if match != None:
5660 self.match = match
5661 else:
5662 self.match = common.match()
5663 if table_id != None:
5664 self.table_id = table_id
5665 else:
5666 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005667 if out_port != None:
5668 self.out_port = out_port
5669 else:
5670 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005671 return
Rich Laneb658ddd2013-03-12 10:15:10 -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(self.match.pack())
5682 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005683 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -07005684 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005685 length = sum([len(x) for x in packed])
5686 packed[2] = struct.pack("!H", length)
5687 return ''.join(packed)
5688
5689 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005690 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005691 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005692 _version = reader.read("!B")[0]
5693 assert(_version == 1)
5694 _type = reader.read("!B")[0]
5695 assert(_type == 16)
5696 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005697 orig_reader = reader
5698 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005699 obj.xid = reader.read("!L")[0]
5700 _stats_type = reader.read("!H")[0]
5701 assert(_stats_type == 1)
5702 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005703 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005704 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005705 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005706 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07005707 return obj
5708
5709 def __eq__(self, other):
5710 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005711 if self.xid != other.xid: return False
5712 if self.flags != other.flags: return False
5713 if self.match != other.match: return False
5714 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005715 if self.out_port != other.out_port: return False
5716 return True
5717
Rich Laneb658ddd2013-03-12 10:15:10 -07005718 def pretty_print(self, q):
5719 q.text("flow_stats_request {")
5720 with q.group():
5721 with q.indent(2):
5722 q.breakable()
5723 q.text("xid = ");
5724 if self.xid != None:
5725 q.text("%#x" % self.xid)
5726 else:
5727 q.text('None')
5728 q.text(","); q.breakable()
5729 q.text("flags = ");
5730 q.text("%#x" % self.flags)
5731 q.text(","); q.breakable()
5732 q.text("match = ");
5733 q.pp(self.match)
5734 q.text(","); q.breakable()
5735 q.text("table_id = ");
5736 q.text("%#x" % self.table_id)
5737 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005738 q.text("out_port = ");
5739 q.text(util.pretty_port(self.out_port))
5740 q.breakable()
5741 q.text('}')
5742
Rich Lane7dcdf022013-12-11 14:45:27 -08005743stats_request.subtypes[1] = flow_stats_request
5744
5745class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005746 version = 1
5747 type = 8
Rich Laneb658ddd2013-03-12 10:15:10 -07005748
5749 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005750 if xid != None:
5751 self.xid = xid
5752 else:
5753 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005754 if flags != None:
5755 self.flags = flags
5756 else:
5757 self.flags = 0
5758 if miss_send_len != None:
5759 self.miss_send_len = miss_send_len
5760 else:
5761 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005762 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005763
5764 def pack(self):
5765 packed = []
5766 packed.append(struct.pack("!B", self.version))
5767 packed.append(struct.pack("!B", self.type))
5768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5769 packed.append(struct.pack("!L", self.xid))
5770 packed.append(struct.pack("!H", self.flags))
5771 packed.append(struct.pack("!H", self.miss_send_len))
5772 length = sum([len(x) for x in packed])
5773 packed[2] = struct.pack("!H", length)
5774 return ''.join(packed)
5775
5776 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005777 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005778 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005779 _version = reader.read("!B")[0]
5780 assert(_version == 1)
5781 _type = reader.read("!B")[0]
5782 assert(_type == 8)
5783 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005784 orig_reader = reader
5785 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005786 obj.xid = reader.read("!L")[0]
5787 obj.flags = reader.read("!H")[0]
5788 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005789 return obj
5790
5791 def __eq__(self, other):
5792 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005793 if self.xid != other.xid: return False
5794 if self.flags != other.flags: return False
5795 if self.miss_send_len != other.miss_send_len: return False
5796 return True
5797
Rich Laneb658ddd2013-03-12 10:15:10 -07005798 def pretty_print(self, q):
5799 q.text("get_config_reply {")
5800 with q.group():
5801 with q.indent(2):
5802 q.breakable()
5803 q.text("xid = ");
5804 if self.xid != None:
5805 q.text("%#x" % self.xid)
5806 else:
5807 q.text('None')
5808 q.text(","); q.breakable()
5809 q.text("flags = ");
5810 q.text("%#x" % self.flags)
5811 q.text(","); q.breakable()
5812 q.text("miss_send_len = ");
5813 q.text("%#x" % self.miss_send_len)
5814 q.breakable()
5815 q.text('}')
5816
Rich Lane7dcdf022013-12-11 14:45:27 -08005817message.subtypes[8] = get_config_reply
5818
5819class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005820 version = 1
5821 type = 7
Rich Laneb658ddd2013-03-12 10:15:10 -07005822
5823 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005824 if xid != None:
5825 self.xid = xid
5826 else:
5827 self.xid = None
5828 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005829
5830 def pack(self):
5831 packed = []
5832 packed.append(struct.pack("!B", self.version))
5833 packed.append(struct.pack("!B", self.type))
5834 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5835 packed.append(struct.pack("!L", self.xid))
5836 length = sum([len(x) for x in packed])
5837 packed[2] = struct.pack("!H", length)
5838 return ''.join(packed)
5839
5840 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005841 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005842 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005843 _version = reader.read("!B")[0]
5844 assert(_version == 1)
5845 _type = reader.read("!B")[0]
5846 assert(_type == 7)
5847 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005848 orig_reader = reader
5849 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005850 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005851 return obj
5852
5853 def __eq__(self, other):
5854 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005855 if self.xid != other.xid: return False
5856 return True
5857
Rich Laneb658ddd2013-03-12 10:15:10 -07005858 def pretty_print(self, q):
5859 q.text("get_config_request {")
5860 with q.group():
5861 with q.indent(2):
5862 q.breakable()
5863 q.text("xid = ");
5864 if self.xid != None:
5865 q.text("%#x" % self.xid)
5866 else:
5867 q.text('None')
5868 q.breakable()
5869 q.text('}')
5870
Rich Lane7dcdf022013-12-11 14:45:27 -08005871message.subtypes[7] = get_config_request
5872
5873class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005874 version = 1
5875 type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005876
5877 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005878 if xid != None:
5879 self.xid = xid
5880 else:
5881 self.xid = None
5882 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005883
5884 def pack(self):
5885 packed = []
5886 packed.append(struct.pack("!B", self.version))
5887 packed.append(struct.pack("!B", self.type))
5888 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5889 packed.append(struct.pack("!L", self.xid))
5890 length = sum([len(x) for x in packed])
5891 packed[2] = struct.pack("!H", length)
5892 return ''.join(packed)
5893
5894 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005895 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005896 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07005897 _version = reader.read("!B")[0]
5898 assert(_version == 1)
5899 _type = reader.read("!B")[0]
5900 assert(_type == 0)
5901 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005902 orig_reader = reader
5903 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005904 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005905 return obj
5906
5907 def __eq__(self, other):
5908 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005909 if self.xid != other.xid: return False
5910 return True
5911
Rich Laneb658ddd2013-03-12 10:15:10 -07005912 def pretty_print(self, q):
5913 q.text("hello {")
5914 with q.group():
5915 with q.indent(2):
5916 q.breakable()
5917 q.text("xid = ");
5918 if self.xid != None:
5919 q.text("%#x" % self.xid)
5920 else:
5921 q.text('None')
5922 q.breakable()
5923 q.text('}')
5924
Rich Lane7dcdf022013-12-11 14:45:27 -08005925message.subtypes[0] = hello
5926
5927class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005928 version = 1
5929 type = 1
5930 err_type = 0
5931
5932 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005933 if xid != None:
5934 self.xid = xid
5935 else:
5936 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005937 if code != None:
5938 self.code = code
5939 else:
5940 self.code = 0
5941 if data != None:
5942 self.data = data
5943 else:
5944 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005945 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005946
5947 def pack(self):
5948 packed = []
5949 packed.append(struct.pack("!B", self.version))
5950 packed.append(struct.pack("!B", self.type))
5951 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5952 packed.append(struct.pack("!L", self.xid))
5953 packed.append(struct.pack("!H", self.err_type))
5954 packed.append(struct.pack("!H", self.code))
5955 packed.append(self.data)
5956 length = sum([len(x) for x in packed])
5957 packed[2] = struct.pack("!H", length)
5958 return ''.join(packed)
5959
5960 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005961 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005962 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005963 _version = reader.read("!B")[0]
5964 assert(_version == 1)
5965 _type = reader.read("!B")[0]
5966 assert(_type == 1)
5967 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005968 orig_reader = reader
5969 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005970 obj.xid = reader.read("!L")[0]
5971 _err_type = reader.read("!H")[0]
5972 assert(_err_type == 0)
5973 obj.code = reader.read("!H")[0]
5974 obj.data = str(reader.read_all())
5975 return obj
5976
5977 def __eq__(self, other):
5978 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005979 if self.xid != other.xid: return False
5980 if self.code != other.code: return False
5981 if self.data != other.data: return False
5982 return True
5983
Rich Lane6f4978c2013-10-20 21:33:52 -07005984 def pretty_print(self, q):
5985 q.text("hello_failed_error_msg {")
5986 with q.group():
5987 with q.indent(2):
5988 q.breakable()
5989 q.text("xid = ");
5990 if self.xid != None:
5991 q.text("%#x" % self.xid)
5992 else:
5993 q.text('None')
5994 q.text(","); q.breakable()
5995 q.text("code = ");
5996 q.text("%#x" % self.code)
5997 q.text(","); q.breakable()
5998 q.text("data = ");
5999 q.pp(self.data)
6000 q.breakable()
6001 q.text('}')
6002
Rich Lane7dcdf022013-12-11 14:45:27 -08006003error_msg.subtypes[0] = hello_failed_error_msg
6004
6005class nicira_header(experimenter):
6006 subtypes = {}
6007
Rich Lane95f7fc92014-01-27 17:08:16 -08006008 version = 1
6009 type = 4
6010 experimenter = 8992
6011
6012 def __init__(self, xid=None, subtype=None):
6013 if xid != None:
6014 self.xid = xid
6015 else:
6016 self.xid = None
6017 if subtype != None:
6018 self.subtype = subtype
6019 else:
6020 self.subtype = 0
6021 return
6022
6023 def pack(self):
6024 packed = []
6025 packed.append(struct.pack("!B", self.version))
6026 packed.append(struct.pack("!B", self.type))
6027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6028 packed.append(struct.pack("!L", self.xid))
6029 packed.append(struct.pack("!L", self.experimenter))
6030 packed.append(struct.pack("!L", self.subtype))
6031 length = sum([len(x) for x in packed])
6032 packed[2] = struct.pack("!H", length)
6033 return ''.join(packed)
6034
Rich Lane7dcdf022013-12-11 14:45:27 -08006035 @staticmethod
6036 def unpack(reader):
6037 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006038 subclass = nicira_header.subtypes.get(subtype)
6039 if subclass:
6040 return subclass.unpack(reader)
6041
6042 obj = nicira_header()
6043 _version = reader.read("!B")[0]
6044 assert(_version == 1)
6045 _type = reader.read("!B")[0]
6046 assert(_type == 4)
6047 _length = reader.read("!H")[0]
6048 orig_reader = reader
6049 reader = orig_reader.slice(_length - (2 + 2))
6050 obj.xid = reader.read("!L")[0]
6051 _experimenter = reader.read("!L")[0]
6052 assert(_experimenter == 8992)
6053 obj.subtype = reader.read("!L")[0]
6054 return obj
6055
6056 def __eq__(self, other):
6057 if type(self) != type(other): return False
6058 if self.xid != other.xid: return False
6059 if self.subtype != other.subtype: return False
6060 return True
6061
6062 def pretty_print(self, q):
6063 q.text("nicira_header {")
6064 with q.group():
6065 with q.indent(2):
6066 q.breakable()
6067 q.text("xid = ");
6068 if self.xid != None:
6069 q.text("%#x" % self.xid)
6070 else:
6071 q.text('None')
6072 q.breakable()
6073 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006074
6075experimenter.subtypes[8992] = nicira_header
6076
6077class nicira_controller_role_reply(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006078 version = 1
6079 type = 4
6080 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006081 subtype = 11
6082
6083 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006084 if xid != None:
6085 self.xid = xid
6086 else:
6087 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006088 if role != None:
6089 self.role = role
6090 else:
6091 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006092 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006093
6094 def pack(self):
6095 packed = []
6096 packed.append(struct.pack("!B", self.version))
6097 packed.append(struct.pack("!B", self.type))
6098 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6099 packed.append(struct.pack("!L", self.xid))
6100 packed.append(struct.pack("!L", self.experimenter))
6101 packed.append(struct.pack("!L", self.subtype))
6102 packed.append(struct.pack("!L", self.role))
6103 length = sum([len(x) for x in packed])
6104 packed[2] = struct.pack("!H", length)
6105 return ''.join(packed)
6106
6107 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006108 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006109 obj = nicira_controller_role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006110 _version = reader.read("!B")[0]
6111 assert(_version == 1)
6112 _type = reader.read("!B")[0]
6113 assert(_type == 4)
6114 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006115 orig_reader = reader
6116 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006117 obj.xid = reader.read("!L")[0]
6118 _experimenter = reader.read("!L")[0]
6119 assert(_experimenter == 8992)
6120 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006121 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006122 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006123 return obj
6124
6125 def __eq__(self, other):
6126 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006127 if self.xid != other.xid: return False
6128 if self.role != other.role: return False
6129 return True
6130
Rich Laneb658ddd2013-03-12 10:15:10 -07006131 def pretty_print(self, q):
6132 q.text("nicira_controller_role_reply {")
6133 with q.group():
6134 with q.indent(2):
6135 q.breakable()
6136 q.text("xid = ");
6137 if self.xid != None:
6138 q.text("%#x" % self.xid)
6139 else:
6140 q.text('None')
6141 q.text(","); q.breakable()
6142 q.text("role = ");
6143 q.text("%#x" % self.role)
6144 q.breakable()
6145 q.text('}')
6146
Rich Lane7dcdf022013-12-11 14:45:27 -08006147nicira_header.subtypes[11] = nicira_controller_role_reply
6148
6149class nicira_controller_role_request(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006150 version = 1
6151 type = 4
6152 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006153 subtype = 10
6154
6155 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006156 if xid != None:
6157 self.xid = xid
6158 else:
6159 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006160 if role != None:
6161 self.role = role
6162 else:
6163 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006164 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006165
6166 def pack(self):
6167 packed = []
6168 packed.append(struct.pack("!B", self.version))
6169 packed.append(struct.pack("!B", self.type))
6170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6171 packed.append(struct.pack("!L", self.xid))
6172 packed.append(struct.pack("!L", self.experimenter))
6173 packed.append(struct.pack("!L", self.subtype))
6174 packed.append(struct.pack("!L", self.role))
6175 length = sum([len(x) for x in packed])
6176 packed[2] = struct.pack("!H", length)
6177 return ''.join(packed)
6178
6179 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006180 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006181 obj = nicira_controller_role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006182 _version = reader.read("!B")[0]
6183 assert(_version == 1)
6184 _type = reader.read("!B")[0]
6185 assert(_type == 4)
6186 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006187 orig_reader = reader
6188 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006189 obj.xid = reader.read("!L")[0]
6190 _experimenter = reader.read("!L")[0]
6191 assert(_experimenter == 8992)
6192 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006193 assert(_subtype == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07006194 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006195 return obj
6196
6197 def __eq__(self, other):
6198 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006199 if self.xid != other.xid: return False
6200 if self.role != other.role: return False
6201 return True
6202
Rich Laneb658ddd2013-03-12 10:15:10 -07006203 def pretty_print(self, q):
6204 q.text("nicira_controller_role_request {")
6205 with q.group():
6206 with q.indent(2):
6207 q.breakable()
6208 q.text("xid = ");
6209 if self.xid != None:
6210 q.text("%#x" % self.xid)
6211 else:
6212 q.text('None')
6213 q.text(","); q.breakable()
6214 q.text("role = ");
6215 q.text("%#x" % self.role)
6216 q.breakable()
6217 q.text('}')
6218
Rich Lane7dcdf022013-12-11 14:45:27 -08006219nicira_header.subtypes[10] = nicira_controller_role_request
6220
6221class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006222 version = 1
6223 type = 10
Rich Laneb658ddd2013-03-12 10:15:10 -07006224
Rich Lanec2ee4b82013-04-24 17:12:38 -07006225 def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006226 if xid != None:
6227 self.xid = xid
6228 else:
6229 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006230 if buffer_id != None:
6231 self.buffer_id = buffer_id
6232 else:
6233 self.buffer_id = 0
6234 if total_len != None:
6235 self.total_len = total_len
6236 else:
6237 self.total_len = 0
6238 if in_port != None:
6239 self.in_port = in_port
6240 else:
6241 self.in_port = 0
6242 if reason != None:
6243 self.reason = reason
6244 else:
6245 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006246 if data != None:
6247 self.data = data
6248 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006249 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006250 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006251
6252 def pack(self):
6253 packed = []
6254 packed.append(struct.pack("!B", self.version))
6255 packed.append(struct.pack("!B", self.type))
6256 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6257 packed.append(struct.pack("!L", self.xid))
6258 packed.append(struct.pack("!L", self.buffer_id))
6259 packed.append(struct.pack("!H", self.total_len))
Dan Talaycof6202252013-07-02 01:00:29 -07006260 packed.append(util.pack_port_no(self.in_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006261 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006262 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07006263 packed.append(self.data)
6264 length = sum([len(x) for x in packed])
6265 packed[2] = struct.pack("!H", length)
6266 return ''.join(packed)
6267
6268 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006269 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006270 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006271 _version = reader.read("!B")[0]
6272 assert(_version == 1)
6273 _type = reader.read("!B")[0]
6274 assert(_type == 10)
6275 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006276 orig_reader = reader
6277 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006278 obj.xid = reader.read("!L")[0]
6279 obj.buffer_id = reader.read("!L")[0]
6280 obj.total_len = reader.read("!H")[0]
6281 obj.in_port = util.unpack_port_no(reader)
6282 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006283 reader.skip(1)
6284 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006285 return obj
6286
6287 def __eq__(self, other):
6288 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006289 if self.xid != other.xid: return False
6290 if self.buffer_id != other.buffer_id: return False
6291 if self.total_len != other.total_len: return False
6292 if self.in_port != other.in_port: return False
6293 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006294 if self.data != other.data: return False
6295 return True
6296
Rich Laneb658ddd2013-03-12 10:15:10 -07006297 def pretty_print(self, q):
6298 q.text("packet_in {")
6299 with q.group():
6300 with q.indent(2):
6301 q.breakable()
6302 q.text("xid = ");
6303 if self.xid != None:
6304 q.text("%#x" % self.xid)
6305 else:
6306 q.text('None')
6307 q.text(","); q.breakable()
6308 q.text("buffer_id = ");
6309 q.text("%#x" % self.buffer_id)
6310 q.text(","); q.breakable()
6311 q.text("total_len = ");
6312 q.text("%#x" % self.total_len)
6313 q.text(","); q.breakable()
6314 q.text("in_port = ");
6315 q.text(util.pretty_port(self.in_port))
6316 q.text(","); q.breakable()
6317 q.text("reason = ");
6318 q.text("%#x" % self.reason)
6319 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006320 q.text("data = ");
6321 q.pp(self.data)
6322 q.breakable()
6323 q.text('}')
6324
Rich Lane7dcdf022013-12-11 14:45:27 -08006325message.subtypes[10] = packet_in
6326
6327class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006328 version = 1
6329 type = 13
Rich Laneb658ddd2013-03-12 10:15:10 -07006330
6331 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006332 if xid != None:
6333 self.xid = xid
6334 else:
6335 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006336 if buffer_id != None:
6337 self.buffer_id = buffer_id
6338 else:
Rich Laneff637c92013-04-04 13:57:09 -07006339 self.buffer_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006340 if in_port != None:
6341 self.in_port = in_port
6342 else:
6343 self.in_port = 0
6344 if actions != None:
6345 self.actions = actions
6346 else:
6347 self.actions = []
6348 if data != None:
6349 self.data = data
6350 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006351 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006352 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006353
6354 def pack(self):
6355 packed = []
6356 packed.append(struct.pack("!B", self.version))
6357 packed.append(struct.pack("!B", self.type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006358 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
Rich Laneb658ddd2013-03-12 10:15:10 -07006359 packed.append(struct.pack("!L", self.xid))
6360 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006361 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006362 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
Rich Lane7dcdf022013-12-11 14:45:27 -08006363 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006364 packed[6] = struct.pack("!H", len(packed[-1]))
Rich Laneb658ddd2013-03-12 10:15:10 -07006365 packed.append(self.data)
6366 length = sum([len(x) for x in packed])
6367 packed[2] = struct.pack("!H", length)
6368 return ''.join(packed)
6369
6370 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006371 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006372 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006373 _version = reader.read("!B")[0]
6374 assert(_version == 1)
6375 _type = reader.read("!B")[0]
6376 assert(_type == 13)
6377 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006378 orig_reader = reader
6379 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006380 obj.xid = reader.read("!L")[0]
6381 obj.buffer_id = reader.read("!L")[0]
6382 obj.in_port = util.unpack_port_no(reader)
6383 _actions_len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006384 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006385 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006386 return obj
6387
6388 def __eq__(self, other):
6389 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006390 if self.xid != other.xid: return False
6391 if self.buffer_id != other.buffer_id: return False
6392 if self.in_port != other.in_port: return False
6393 if self.actions != other.actions: return False
6394 if self.data != other.data: return False
6395 return True
6396
Rich Laneb658ddd2013-03-12 10:15:10 -07006397 def pretty_print(self, q):
6398 q.text("packet_out {")
6399 with q.group():
6400 with q.indent(2):
6401 q.breakable()
6402 q.text("xid = ");
6403 if self.xid != None:
6404 q.text("%#x" % self.xid)
6405 else:
6406 q.text('None')
6407 q.text(","); q.breakable()
6408 q.text("buffer_id = ");
6409 q.text("%#x" % self.buffer_id)
6410 q.text(","); q.breakable()
6411 q.text("in_port = ");
6412 q.text(util.pretty_port(self.in_port))
6413 q.text(","); q.breakable()
6414 q.text("actions = ");
6415 q.pp(self.actions)
6416 q.text(","); q.breakable()
6417 q.text("data = ");
6418 q.pp(self.data)
6419 q.breakable()
6420 q.text('}')
6421
Rich Lane7dcdf022013-12-11 14:45:27 -08006422message.subtypes[13] = packet_out
6423
6424class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006425 version = 1
6426 type = 15
Rich Laneb658ddd2013-03-12 10:15:10 -07006427
Rich Lanec2ee4b82013-04-24 17:12:38 -07006428 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006429 if xid != None:
6430 self.xid = xid
6431 else:
6432 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006433 if port_no != None:
6434 self.port_no = port_no
6435 else:
6436 self.port_no = 0
6437 if hw_addr != None:
6438 self.hw_addr = hw_addr
6439 else:
6440 self.hw_addr = [0,0,0,0,0,0]
6441 if config != None:
6442 self.config = config
6443 else:
6444 self.config = 0
6445 if mask != None:
6446 self.mask = mask
6447 else:
6448 self.mask = 0
6449 if advertise != None:
6450 self.advertise = advertise
6451 else:
6452 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006453 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006454
6455 def pack(self):
6456 packed = []
6457 packed.append(struct.pack("!B", self.version))
6458 packed.append(struct.pack("!B", self.type))
6459 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6460 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006461 packed.append(util.pack_port_no(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006462 packed.append(struct.pack("!6B", *self.hw_addr))
6463 packed.append(struct.pack("!L", self.config))
6464 packed.append(struct.pack("!L", self.mask))
6465 packed.append(struct.pack("!L", self.advertise))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006466 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006467 length = sum([len(x) for x in packed])
6468 packed[2] = struct.pack("!H", length)
6469 return ''.join(packed)
6470
6471 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006472 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006473 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006474 _version = reader.read("!B")[0]
6475 assert(_version == 1)
6476 _type = reader.read("!B")[0]
6477 assert(_type == 15)
6478 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006479 orig_reader = reader
6480 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006481 obj.xid = reader.read("!L")[0]
6482 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006483 obj.hw_addr = list(reader.read('!6B'))
Dan Talaycof6202252013-07-02 01:00:29 -07006484 obj.config = reader.read("!L")[0]
6485 obj.mask = reader.read("!L")[0]
6486 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006487 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006488 return obj
6489
6490 def __eq__(self, other):
6491 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006492 if self.xid != other.xid: return False
6493 if self.port_no != other.port_no: return False
6494 if self.hw_addr != other.hw_addr: return False
6495 if self.config != other.config: return False
6496 if self.mask != other.mask: return False
6497 if self.advertise != other.advertise: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006498 return True
6499
Rich Laneb658ddd2013-03-12 10:15:10 -07006500 def pretty_print(self, q):
6501 q.text("port_mod {")
6502 with q.group():
6503 with q.indent(2):
6504 q.breakable()
6505 q.text("xid = ");
6506 if self.xid != None:
6507 q.text("%#x" % self.xid)
6508 else:
6509 q.text('None')
6510 q.text(","); q.breakable()
6511 q.text("port_no = ");
6512 q.text(util.pretty_port(self.port_no))
6513 q.text(","); q.breakable()
6514 q.text("hw_addr = ");
6515 q.text(util.pretty_mac(self.hw_addr))
6516 q.text(","); q.breakable()
6517 q.text("config = ");
6518 q.text("%#x" % self.config)
6519 q.text(","); q.breakable()
6520 q.text("mask = ");
6521 q.text("%#x" % self.mask)
6522 q.text(","); q.breakable()
6523 q.text("advertise = ");
6524 q.text("%#x" % self.advertise)
Rich Laneb658ddd2013-03-12 10:15:10 -07006525 q.breakable()
6526 q.text('}')
6527
Rich Lane7dcdf022013-12-11 14:45:27 -08006528message.subtypes[15] = port_mod
6529
6530class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006531 version = 1
6532 type = 1
6533 err_type = 4
6534
6535 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006536 if xid != None:
6537 self.xid = xid
6538 else:
6539 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006540 if code != None:
6541 self.code = code
6542 else:
6543 self.code = 0
6544 if data != None:
6545 self.data = data
6546 else:
6547 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006548 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006549
6550 def pack(self):
6551 packed = []
6552 packed.append(struct.pack("!B", self.version))
6553 packed.append(struct.pack("!B", self.type))
6554 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6555 packed.append(struct.pack("!L", self.xid))
6556 packed.append(struct.pack("!H", self.err_type))
6557 packed.append(struct.pack("!H", self.code))
6558 packed.append(self.data)
6559 length = sum([len(x) for x in packed])
6560 packed[2] = struct.pack("!H", length)
6561 return ''.join(packed)
6562
6563 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006564 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006565 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006566 _version = reader.read("!B")[0]
6567 assert(_version == 1)
6568 _type = reader.read("!B")[0]
6569 assert(_type == 1)
6570 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006571 orig_reader = reader
6572 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006573 obj.xid = reader.read("!L")[0]
6574 _err_type = reader.read("!H")[0]
6575 assert(_err_type == 4)
6576 obj.code = reader.read("!H")[0]
6577 obj.data = str(reader.read_all())
6578 return obj
6579
6580 def __eq__(self, other):
6581 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006582 if self.xid != other.xid: return False
6583 if self.code != other.code: return False
6584 if self.data != other.data: return False
6585 return True
6586
Rich Lane6f4978c2013-10-20 21:33:52 -07006587 def pretty_print(self, q):
6588 q.text("port_mod_failed_error_msg {")
6589 with q.group():
6590 with q.indent(2):
6591 q.breakable()
6592 q.text("xid = ");
6593 if self.xid != None:
6594 q.text("%#x" % self.xid)
6595 else:
6596 q.text('None')
6597 q.text(","); q.breakable()
6598 q.text("code = ");
6599 q.text("%#x" % self.code)
6600 q.text(","); q.breakable()
6601 q.text("data = ");
6602 q.pp(self.data)
6603 q.breakable()
6604 q.text('}')
6605
Rich Lane7dcdf022013-12-11 14:45:27 -08006606error_msg.subtypes[4] = port_mod_failed_error_msg
6607
6608class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006609 version = 1
6610 type = 17
6611 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006612
6613 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006614 if xid != None:
6615 self.xid = xid
6616 else:
6617 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006618 if flags != None:
6619 self.flags = flags
6620 else:
6621 self.flags = 0
6622 if entries != None:
6623 self.entries = entries
6624 else:
6625 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006626 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006627
6628 def pack(self):
6629 packed = []
6630 packed.append(struct.pack("!B", self.version))
6631 packed.append(struct.pack("!B", self.type))
6632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6633 packed.append(struct.pack("!L", self.xid))
6634 packed.append(struct.pack("!H", self.stats_type))
6635 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006636 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006637 length = sum([len(x) for x in packed])
6638 packed[2] = struct.pack("!H", length)
6639 return ''.join(packed)
6640
6641 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006642 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006643 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006644 _version = reader.read("!B")[0]
6645 assert(_version == 1)
6646 _type = reader.read("!B")[0]
6647 assert(_type == 17)
6648 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006649 orig_reader = reader
6650 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006651 obj.xid = reader.read("!L")[0]
6652 _stats_type = reader.read("!H")[0]
6653 assert(_stats_type == 4)
6654 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006655 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006656 return obj
6657
6658 def __eq__(self, other):
6659 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006660 if self.xid != other.xid: return False
6661 if self.flags != other.flags: return False
6662 if self.entries != other.entries: return False
6663 return True
6664
Rich Laneb658ddd2013-03-12 10:15:10 -07006665 def pretty_print(self, q):
6666 q.text("port_stats_reply {")
6667 with q.group():
6668 with q.indent(2):
6669 q.breakable()
6670 q.text("xid = ");
6671 if self.xid != None:
6672 q.text("%#x" % self.xid)
6673 else:
6674 q.text('None')
6675 q.text(","); q.breakable()
6676 q.text("flags = ");
6677 q.text("%#x" % self.flags)
6678 q.text(","); q.breakable()
6679 q.text("entries = ");
6680 q.pp(self.entries)
6681 q.breakable()
6682 q.text('}')
6683
Rich Lane7dcdf022013-12-11 14:45:27 -08006684stats_reply.subtypes[4] = port_stats_reply
6685
6686class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006687 version = 1
6688 type = 16
6689 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006690
Rich Lanec2ee4b82013-04-24 17:12:38 -07006691 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006692 if xid != None:
6693 self.xid = xid
6694 else:
6695 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006696 if flags != None:
6697 self.flags = flags
6698 else:
6699 self.flags = 0
6700 if port_no != None:
6701 self.port_no = port_no
6702 else:
6703 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006704 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006705
6706 def pack(self):
6707 packed = []
6708 packed.append(struct.pack("!B", self.version))
6709 packed.append(struct.pack("!B", self.type))
6710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6711 packed.append(struct.pack("!L", self.xid))
6712 packed.append(struct.pack("!H", self.stats_type))
6713 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07006714 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006715 packed.append('\x00' * 6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006716 length = sum([len(x) for x in packed])
6717 packed[2] = struct.pack("!H", length)
6718 return ''.join(packed)
6719
6720 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006721 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006722 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006723 _version = reader.read("!B")[0]
6724 assert(_version == 1)
6725 _type = reader.read("!B")[0]
6726 assert(_type == 16)
6727 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006728 orig_reader = reader
6729 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006730 obj.xid = reader.read("!L")[0]
6731 _stats_type = reader.read("!H")[0]
6732 assert(_stats_type == 4)
6733 obj.flags = reader.read("!H")[0]
6734 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006735 reader.skip(6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006736 return obj
6737
6738 def __eq__(self, other):
6739 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006740 if self.xid != other.xid: return False
6741 if self.flags != other.flags: return False
6742 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006743 return True
6744
Rich Laneb658ddd2013-03-12 10:15:10 -07006745 def pretty_print(self, q):
6746 q.text("port_stats_request {")
6747 with q.group():
6748 with q.indent(2):
6749 q.breakable()
6750 q.text("xid = ");
6751 if self.xid != None:
6752 q.text("%#x" % self.xid)
6753 else:
6754 q.text('None')
6755 q.text(","); q.breakable()
6756 q.text("flags = ");
6757 q.text("%#x" % self.flags)
6758 q.text(","); q.breakable()
6759 q.text("port_no = ");
6760 q.text(util.pretty_port(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006761 q.breakable()
6762 q.text('}')
6763
Rich Lane7dcdf022013-12-11 14:45:27 -08006764stats_request.subtypes[4] = port_stats_request
6765
6766class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006767 version = 1
6768 type = 12
Rich Laneb658ddd2013-03-12 10:15:10 -07006769
Rich Lanec2ee4b82013-04-24 17:12:38 -07006770 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006771 if xid != None:
6772 self.xid = xid
6773 else:
6774 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006775 if reason != None:
6776 self.reason = reason
6777 else:
6778 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006779 if desc != None:
6780 self.desc = desc
6781 else:
6782 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006783 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006784
6785 def pack(self):
6786 packed = []
6787 packed.append(struct.pack("!B", self.version))
6788 packed.append(struct.pack("!B", self.type))
6789 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6790 packed.append(struct.pack("!L", self.xid))
6791 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006792 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07006793 packed.append(self.desc.pack())
6794 length = sum([len(x) for x in packed])
6795 packed[2] = struct.pack("!H", length)
6796 return ''.join(packed)
6797
6798 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006799 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006800 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006801 _version = reader.read("!B")[0]
6802 assert(_version == 1)
6803 _type = reader.read("!B")[0]
6804 assert(_type == 12)
6805 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006806 orig_reader = reader
6807 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006808 obj.xid = reader.read("!L")[0]
6809 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006810 reader.skip(7)
6811 obj.desc = common.port_desc.unpack(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07006812 return obj
6813
6814 def __eq__(self, other):
6815 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006816 if self.xid != other.xid: return False
6817 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006818 if self.desc != other.desc: return False
6819 return True
6820
Rich Laneb658ddd2013-03-12 10:15:10 -07006821 def pretty_print(self, q):
6822 q.text("port_status {")
6823 with q.group():
6824 with q.indent(2):
6825 q.breakable()
6826 q.text("xid = ");
6827 if self.xid != None:
6828 q.text("%#x" % self.xid)
6829 else:
6830 q.text('None')
6831 q.text(","); q.breakable()
6832 q.text("reason = ");
6833 q.text("%#x" % self.reason)
6834 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006835 q.text("desc = ");
6836 q.pp(self.desc)
6837 q.breakable()
6838 q.text('}')
6839
Rich Lane7dcdf022013-12-11 14:45:27 -08006840message.subtypes[12] = port_status
6841
6842class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006843 version = 1
6844 type = 21
Rich Laneb658ddd2013-03-12 10:15:10 -07006845
Rich Lanec2ee4b82013-04-24 17:12:38 -07006846 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006847 if xid != None:
6848 self.xid = xid
6849 else:
6850 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006851 if port != None:
6852 self.port = port
6853 else:
6854 self.port = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006855 if queues != None:
6856 self.queues = queues
6857 else:
6858 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006859 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006860
6861 def pack(self):
6862 packed = []
6863 packed.append(struct.pack("!B", self.version))
6864 packed.append(struct.pack("!B", self.type))
6865 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6866 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006867 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006868 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006869 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Laneb658ddd2013-03-12 10:15:10 -07006870 length = sum([len(x) for x in packed])
6871 packed[2] = struct.pack("!H", length)
6872 return ''.join(packed)
6873
6874 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006875 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006876 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006877 _version = reader.read("!B")[0]
6878 assert(_version == 1)
6879 _type = reader.read("!B")[0]
6880 assert(_type == 21)
6881 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006882 orig_reader = reader
6883 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006884 obj.xid = reader.read("!L")[0]
6885 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006886 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006887 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006888 return obj
6889
6890 def __eq__(self, other):
6891 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006892 if self.xid != other.xid: return False
6893 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006894 if self.queues != other.queues: return False
6895 return True
6896
Rich Laneb658ddd2013-03-12 10:15:10 -07006897 def pretty_print(self, q):
6898 q.text("queue_get_config_reply {")
6899 with q.group():
6900 with q.indent(2):
6901 q.breakable()
6902 q.text("xid = ");
6903 if self.xid != None:
6904 q.text("%#x" % self.xid)
6905 else:
6906 q.text('None')
6907 q.text(","); q.breakable()
6908 q.text("port = ");
6909 q.text(util.pretty_port(self.port))
6910 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006911 q.text("queues = ");
6912 q.pp(self.queues)
6913 q.breakable()
6914 q.text('}')
6915
Rich Lane7dcdf022013-12-11 14:45:27 -08006916message.subtypes[21] = queue_get_config_reply
6917
6918class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006919 version = 1
6920 type = 20
Rich Laneb658ddd2013-03-12 10:15:10 -07006921
Rich Lanec2ee4b82013-04-24 17:12:38 -07006922 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006923 if xid != None:
6924 self.xid = xid
6925 else:
6926 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006927 if port != None:
6928 self.port = port
6929 else:
6930 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006931 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006932
6933 def pack(self):
6934 packed = []
6935 packed.append(struct.pack("!B", self.version))
6936 packed.append(struct.pack("!B", self.type))
6937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6938 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006939 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006940 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006941 length = sum([len(x) for x in packed])
6942 packed[2] = struct.pack("!H", length)
6943 return ''.join(packed)
6944
6945 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006946 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006947 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006948 _version = reader.read("!B")[0]
6949 assert(_version == 1)
6950 _type = reader.read("!B")[0]
6951 assert(_type == 20)
6952 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006953 orig_reader = reader
6954 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006955 obj.xid = reader.read("!L")[0]
6956 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006957 reader.skip(2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006958 return obj
6959
6960 def __eq__(self, other):
6961 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006962 if self.xid != other.xid: return False
6963 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006964 return True
6965
Rich Laneb658ddd2013-03-12 10:15:10 -07006966 def pretty_print(self, q):
6967 q.text("queue_get_config_request {")
6968 with q.group():
6969 with q.indent(2):
6970 q.breakable()
6971 q.text("xid = ");
6972 if self.xid != None:
6973 q.text("%#x" % self.xid)
6974 else:
6975 q.text('None')
6976 q.text(","); q.breakable()
6977 q.text("port = ");
6978 q.text(util.pretty_port(self.port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006979 q.breakable()
6980 q.text('}')
6981
Rich Lane7dcdf022013-12-11 14:45:27 -08006982message.subtypes[20] = queue_get_config_request
6983
6984class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006985 version = 1
6986 type = 1
6987 err_type = 5
6988
6989 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006990 if xid != None:
6991 self.xid = xid
6992 else:
6993 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006994 if code != None:
6995 self.code = code
6996 else:
6997 self.code = 0
6998 if data != None:
6999 self.data = data
7000 else:
7001 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007002 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007003
7004 def pack(self):
7005 packed = []
7006 packed.append(struct.pack("!B", self.version))
7007 packed.append(struct.pack("!B", self.type))
7008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7009 packed.append(struct.pack("!L", self.xid))
7010 packed.append(struct.pack("!H", self.err_type))
7011 packed.append(struct.pack("!H", self.code))
7012 packed.append(self.data)
7013 length = sum([len(x) for x in packed])
7014 packed[2] = struct.pack("!H", length)
7015 return ''.join(packed)
7016
7017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007018 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007019 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007020 _version = reader.read("!B")[0]
7021 assert(_version == 1)
7022 _type = reader.read("!B")[0]
7023 assert(_type == 1)
7024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007025 orig_reader = reader
7026 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007027 obj.xid = reader.read("!L")[0]
7028 _err_type = reader.read("!H")[0]
7029 assert(_err_type == 5)
7030 obj.code = reader.read("!H")[0]
7031 obj.data = str(reader.read_all())
7032 return obj
7033
7034 def __eq__(self, other):
7035 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007036 if self.xid != other.xid: return False
7037 if self.code != other.code: return False
7038 if self.data != other.data: return False
7039 return True
7040
Rich Lane6f4978c2013-10-20 21:33:52 -07007041 def pretty_print(self, q):
7042 q.text("queue_op_failed_error_msg {")
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("code = ");
7053 q.text("%#x" % self.code)
7054 q.text(","); q.breakable()
7055 q.text("data = ");
7056 q.pp(self.data)
7057 q.breakable()
7058 q.text('}')
7059
Rich Lane7dcdf022013-12-11 14:45:27 -08007060error_msg.subtypes[5] = queue_op_failed_error_msg
7061
7062class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007063 version = 1
7064 type = 17
7065 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007066
7067 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007068 if xid != None:
7069 self.xid = xid
7070 else:
7071 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007072 if flags != None:
7073 self.flags = flags
7074 else:
7075 self.flags = 0
7076 if entries != None:
7077 self.entries = entries
7078 else:
7079 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007080 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007081
7082 def pack(self):
7083 packed = []
7084 packed.append(struct.pack("!B", self.version))
7085 packed.append(struct.pack("!B", self.type))
7086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7087 packed.append(struct.pack("!L", self.xid))
7088 packed.append(struct.pack("!H", self.stats_type))
7089 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007090 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007091 length = sum([len(x) for x in packed])
7092 packed[2] = struct.pack("!H", length)
7093 return ''.join(packed)
7094
7095 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007096 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007097 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007098 _version = reader.read("!B")[0]
7099 assert(_version == 1)
7100 _type = reader.read("!B")[0]
7101 assert(_type == 17)
7102 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007103 orig_reader = reader
7104 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007105 obj.xid = reader.read("!L")[0]
7106 _stats_type = reader.read("!H")[0]
7107 assert(_stats_type == 5)
7108 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007109 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007110 return obj
7111
7112 def __eq__(self, other):
7113 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007114 if self.xid != other.xid: return False
7115 if self.flags != other.flags: return False
7116 if self.entries != other.entries: return False
7117 return True
7118
Rich Laneb658ddd2013-03-12 10:15:10 -07007119 def pretty_print(self, q):
7120 q.text("queue_stats_reply {")
7121 with q.group():
7122 with q.indent(2):
7123 q.breakable()
7124 q.text("xid = ");
7125 if self.xid != None:
7126 q.text("%#x" % self.xid)
7127 else:
7128 q.text('None')
7129 q.text(","); q.breakable()
7130 q.text("flags = ");
7131 q.text("%#x" % self.flags)
7132 q.text(","); q.breakable()
7133 q.text("entries = ");
7134 q.pp(self.entries)
7135 q.breakable()
7136 q.text('}')
7137
Rich Lane7dcdf022013-12-11 14:45:27 -08007138stats_reply.subtypes[5] = queue_stats_reply
7139
7140class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007141 version = 1
7142 type = 16
7143 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007144
Rich Lanec2ee4b82013-04-24 17:12:38 -07007145 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007146 if xid != None:
7147 self.xid = xid
7148 else:
7149 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007150 if flags != None:
7151 self.flags = flags
7152 else:
7153 self.flags = 0
7154 if port_no != None:
7155 self.port_no = port_no
7156 else:
7157 self.port_no = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007158 if queue_id != None:
7159 self.queue_id = queue_id
7160 else:
7161 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007162 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007163
7164 def pack(self):
7165 packed = []
7166 packed.append(struct.pack("!B", self.version))
7167 packed.append(struct.pack("!B", self.type))
7168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7169 packed.append(struct.pack("!L", self.xid))
7170 packed.append(struct.pack("!H", self.stats_type))
7171 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07007172 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007173 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07007174 packed.append(struct.pack("!L", self.queue_id))
7175 length = sum([len(x) for x in packed])
7176 packed[2] = struct.pack("!H", length)
7177 return ''.join(packed)
7178
7179 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007180 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007181 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007182 _version = reader.read("!B")[0]
7183 assert(_version == 1)
7184 _type = reader.read("!B")[0]
7185 assert(_type == 16)
7186 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007187 orig_reader = reader
7188 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007189 obj.xid = reader.read("!L")[0]
7190 _stats_type = reader.read("!H")[0]
7191 assert(_stats_type == 5)
7192 obj.flags = reader.read("!H")[0]
7193 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007194 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007195 obj.queue_id = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007196 return obj
7197
7198 def __eq__(self, other):
7199 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007200 if self.xid != other.xid: return False
7201 if self.flags != other.flags: return False
7202 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007203 if self.queue_id != other.queue_id: return False
7204 return True
7205
Rich Laneb658ddd2013-03-12 10:15:10 -07007206 def pretty_print(self, q):
7207 q.text("queue_stats_request {")
7208 with q.group():
7209 with q.indent(2):
7210 q.breakable()
7211 q.text("xid = ");
7212 if self.xid != None:
7213 q.text("%#x" % self.xid)
7214 else:
7215 q.text('None')
7216 q.text(","); q.breakable()
7217 q.text("flags = ");
7218 q.text("%#x" % self.flags)
7219 q.text(","); q.breakable()
7220 q.text("port_no = ");
7221 q.text(util.pretty_port(self.port_no))
7222 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007223 q.text("queue_id = ");
7224 q.text("%#x" % self.queue_id)
7225 q.breakable()
7226 q.text('}')
7227
Rich Lane7dcdf022013-12-11 14:45:27 -08007228stats_request.subtypes[5] = queue_stats_request
7229
7230class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007231 version = 1
7232 type = 9
Rich Laneb658ddd2013-03-12 10:15:10 -07007233
7234 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007235 if xid != None:
7236 self.xid = xid
7237 else:
7238 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007239 if flags != None:
7240 self.flags = flags
7241 else:
7242 self.flags = 0
7243 if miss_send_len != None:
7244 self.miss_send_len = miss_send_len
7245 else:
7246 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007247 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007248
7249 def pack(self):
7250 packed = []
7251 packed.append(struct.pack("!B", self.version))
7252 packed.append(struct.pack("!B", self.type))
7253 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7254 packed.append(struct.pack("!L", self.xid))
7255 packed.append(struct.pack("!H", self.flags))
7256 packed.append(struct.pack("!H", self.miss_send_len))
7257 length = sum([len(x) for x in packed])
7258 packed[2] = struct.pack("!H", length)
7259 return ''.join(packed)
7260
7261 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007262 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007263 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007264 _version = reader.read("!B")[0]
7265 assert(_version == 1)
7266 _type = reader.read("!B")[0]
7267 assert(_type == 9)
7268 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007269 orig_reader = reader
7270 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007271 obj.xid = reader.read("!L")[0]
7272 obj.flags = reader.read("!H")[0]
7273 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007274 return obj
7275
7276 def __eq__(self, other):
7277 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007278 if self.xid != other.xid: return False
7279 if self.flags != other.flags: return False
7280 if self.miss_send_len != other.miss_send_len: return False
7281 return True
7282
Rich Laneb658ddd2013-03-12 10:15:10 -07007283 def pretty_print(self, q):
7284 q.text("set_config {")
7285 with q.group():
7286 with q.indent(2):
7287 q.breakable()
7288 q.text("xid = ");
7289 if self.xid != None:
7290 q.text("%#x" % self.xid)
7291 else:
7292 q.text('None')
7293 q.text(","); q.breakable()
7294 q.text("flags = ");
7295 q.text("%#x" % self.flags)
7296 q.text(","); q.breakable()
7297 q.text("miss_send_len = ");
7298 q.text("%#x" % self.miss_send_len)
7299 q.breakable()
7300 q.text('}')
7301
Rich Lane7dcdf022013-12-11 14:45:27 -08007302message.subtypes[9] = set_config
7303
7304class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007305 version = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07007306 type = 22
7307
Rich Lanec2ee4b82013-04-24 17:12:38 -07007308 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007309 if xid != None:
7310 self.xid = xid
7311 else:
7312 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007313 if table_id != None:
7314 self.table_id = table_id
7315 else:
7316 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007317 if config != None:
7318 self.config = config
7319 else:
7320 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007321 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007322
7323 def pack(self):
7324 packed = []
7325 packed.append(struct.pack("!B", self.version))
7326 packed.append(struct.pack("!B", self.type))
7327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7328 packed.append(struct.pack("!L", self.xid))
7329 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007330 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07007331 packed.append(struct.pack("!L", self.config))
7332 length = sum([len(x) for x in packed])
7333 packed[2] = struct.pack("!H", length)
7334 return ''.join(packed)
7335
7336 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007337 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007338 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007339 _version = reader.read("!B")[0]
7340 assert(_version == 1)
7341 _type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007342 assert(_type == 22)
Dan Talaycof6202252013-07-02 01:00:29 -07007343 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007344 orig_reader = reader
7345 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007346 obj.xid = reader.read("!L")[0]
7347 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007348 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007349 obj.config = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007350 return obj
7351
7352 def __eq__(self, other):
7353 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007354 if self.xid != other.xid: return False
7355 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007356 if self.config != other.config: return False
7357 return True
7358
Rich Laneb658ddd2013-03-12 10:15:10 -07007359 def pretty_print(self, q):
7360 q.text("table_mod {")
7361 with q.group():
7362 with q.indent(2):
7363 q.breakable()
7364 q.text("xid = ");
7365 if self.xid != None:
7366 q.text("%#x" % self.xid)
7367 else:
7368 q.text('None')
7369 q.text(","); q.breakable()
7370 q.text("table_id = ");
7371 q.text("%#x" % self.table_id)
7372 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007373 q.text("config = ");
7374 q.text("%#x" % self.config)
7375 q.breakable()
7376 q.text('}')
7377
Rich Lane7dcdf022013-12-11 14:45:27 -08007378message.subtypes[22] = table_mod
7379
7380class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007381 version = 1
7382 type = 17
7383 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007384
7385 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007386 if xid != None:
7387 self.xid = xid
7388 else:
7389 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007390 if flags != None:
7391 self.flags = flags
7392 else:
7393 self.flags = 0
7394 if entries != None:
7395 self.entries = entries
7396 else:
7397 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007398 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007399
7400 def pack(self):
7401 packed = []
7402 packed.append(struct.pack("!B", self.version))
7403 packed.append(struct.pack("!B", self.type))
7404 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7405 packed.append(struct.pack("!L", self.xid))
7406 packed.append(struct.pack("!H", self.stats_type))
7407 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007408 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007409 length = sum([len(x) for x in packed])
7410 packed[2] = struct.pack("!H", length)
7411 return ''.join(packed)
7412
7413 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007414 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007415 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007416 _version = reader.read("!B")[0]
7417 assert(_version == 1)
7418 _type = reader.read("!B")[0]
7419 assert(_type == 17)
7420 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007421 orig_reader = reader
7422 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007423 obj.xid = reader.read("!L")[0]
7424 _stats_type = reader.read("!H")[0]
7425 assert(_stats_type == 3)
7426 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007427 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007428 return obj
7429
7430 def __eq__(self, other):
7431 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007432 if self.xid != other.xid: return False
7433 if self.flags != other.flags: return False
7434 if self.entries != other.entries: return False
7435 return True
7436
Rich Laneb658ddd2013-03-12 10:15:10 -07007437 def pretty_print(self, q):
7438 q.text("table_stats_reply {")
7439 with q.group():
7440 with q.indent(2):
7441 q.breakable()
7442 q.text("xid = ");
7443 if self.xid != None:
7444 q.text("%#x" % self.xid)
7445 else:
7446 q.text('None')
7447 q.text(","); q.breakable()
7448 q.text("flags = ");
7449 q.text("%#x" % self.flags)
7450 q.text(","); q.breakable()
7451 q.text("entries = ");
7452 q.pp(self.entries)
7453 q.breakable()
7454 q.text('}')
7455
Rich Lane7dcdf022013-12-11 14:45:27 -08007456stats_reply.subtypes[3] = table_stats_reply
7457
7458class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007459 version = 1
7460 type = 16
7461 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007462
7463 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007464 if xid != None:
7465 self.xid = xid
7466 else:
7467 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007468 if flags != None:
7469 self.flags = flags
7470 else:
7471 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007472 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007473
7474 def pack(self):
7475 packed = []
7476 packed.append(struct.pack("!B", self.version))
7477 packed.append(struct.pack("!B", self.type))
7478 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7479 packed.append(struct.pack("!L", self.xid))
7480 packed.append(struct.pack("!H", self.stats_type))
7481 packed.append(struct.pack("!H", self.flags))
7482 length = sum([len(x) for x in packed])
7483 packed[2] = struct.pack("!H", length)
7484 return ''.join(packed)
7485
7486 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007487 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007488 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007489 _version = reader.read("!B")[0]
7490 assert(_version == 1)
7491 _type = reader.read("!B")[0]
7492 assert(_type == 16)
7493 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007494 orig_reader = reader
7495 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007496 obj.xid = reader.read("!L")[0]
7497 _stats_type = reader.read("!H")[0]
7498 assert(_stats_type == 3)
7499 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007500 return obj
7501
7502 def __eq__(self, other):
7503 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007504 if self.xid != other.xid: return False
7505 if self.flags != other.flags: return False
7506 return True
7507
Rich Laneb658ddd2013-03-12 10:15:10 -07007508 def pretty_print(self, q):
7509 q.text("table_stats_request {")
7510 with q.group():
7511 with q.indent(2):
7512 q.breakable()
7513 q.text("xid = ");
7514 if self.xid != None:
7515 q.text("%#x" % self.xid)
7516 else:
7517 q.text('None')
7518 q.text(","); q.breakable()
7519 q.text("flags = ");
7520 q.text("%#x" % self.flags)
7521 q.breakable()
7522 q.text('}')
7523
Rich Lane7dcdf022013-12-11 14:45:27 -08007524stats_request.subtypes[3] = table_stats_request
7525
Rich Laneb658ddd2013-03-12 10:15:10 -07007526
7527def parse_header(buf):
7528 if len(buf) < 8:
7529 raise loxi.ProtocolError("too short to be an OpenFlow message")
7530 return struct.unpack_from("!BBHL", buf)
7531
7532def parse_message(buf):
7533 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -07007534 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
7535 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Laneb658ddd2013-03-12 10:15:10 -07007536 if len(buf) != msg_len:
7537 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007538 return message.unpack(loxi.generic_util.OFReader(buf))