blob: 76511f0799e99adfe6e8a7471fa9173f91969821 [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
12import common
Rich Lane7dcdf022013-12-11 14:45:27 -080013import action
Rich Laneb658ddd2013-03-12 10:15:10 -070014import util
Rich Lanec2ee4b82013-04-24 17:12:38 -070015import loxi.generic_util
Rich Laneb658ddd2013-03-12 10:15:10 -070016
Rich Lane7dcdf022013-12-11 14:45:27 -080017class message(loxi.OFObject):
18 subtypes = {}
Rich Laneb658ddd2013-03-12 10:15:10 -070019
Rich Lane95f7fc92014-01-27 17:08:16 -080020 version = 1
21
22 def __init__(self, type=None, xid=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 if xid != None:
28 self.xid = xid
29 else:
30 self.xid = None
31 return
32
33 def pack(self):
34 packed = []
35 packed.append(struct.pack("!B", self.version))
36 packed.append(struct.pack("!B", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
38 packed.append(struct.pack("!L", self.xid))
39 length = sum([len(x) for x in packed])
40 packed[2] = struct.pack("!H", length)
41 return ''.join(packed)
42
Rich Lane7dcdf022013-12-11 14:45:27 -080043 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080046 subclass = message.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = message()
51 _version = reader.read("!B")[0]
52 assert(_version == 1)
53 obj.type = reader.read("!B")[0]
54 _length = reader.read("!H")[0]
55 orig_reader = reader
56 reader = orig_reader.slice(_length - (2 + 2))
57 obj.xid = reader.read("!L")[0]
58 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.type != other.type: return False
63 if self.xid != other.xid: return False
64 return True
65
66 def pretty_print(self, q):
67 q.text("message {")
68 with q.group():
69 with q.indent(2):
70 q.breakable()
71 q.text("xid = ");
72 if self.xid != None:
73 q.text("%#x" % self.xid)
74 else:
75 q.text('None')
76 q.breakable()
77 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080078
79
80class stats_reply(message):
81 subtypes = {}
82
Rich Lane95f7fc92014-01-27 17:08:16 -080083 version = 1
84 type = 17
85
86 def __init__(self, xid=None, stats_type=None, flags=None):
87 if xid != None:
88 self.xid = xid
89 else:
90 self.xid = None
91 if stats_type != None:
92 self.stats_type = stats_type
93 else:
94 self.stats_type = 0
95 if flags != None:
96 self.flags = flags
97 else:
98 self.flags = 0
99 return
100
101 def pack(self):
102 packed = []
103 packed.append(struct.pack("!B", self.version))
104 packed.append(struct.pack("!B", self.type))
105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
106 packed.append(struct.pack("!L", self.xid))
107 packed.append(struct.pack("!H", self.stats_type))
108 packed.append(struct.pack("!H", self.flags))
109 length = sum([len(x) for x in packed])
110 packed[2] = struct.pack("!H", length)
111 return ''.join(packed)
112
Rich Lane7dcdf022013-12-11 14:45:27 -0800113 @staticmethod
114 def unpack(reader):
115 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800116 subclass = stats_reply.subtypes.get(subtype)
117 if subclass:
118 return subclass.unpack(reader)
119
120 obj = stats_reply()
121 _version = reader.read("!B")[0]
122 assert(_version == 1)
123 _type = reader.read("!B")[0]
124 assert(_type == 17)
125 _length = reader.read("!H")[0]
126 orig_reader = reader
127 reader = orig_reader.slice(_length - (2 + 2))
128 obj.xid = reader.read("!L")[0]
129 obj.stats_type = reader.read("!H")[0]
130 obj.flags = reader.read("!H")[0]
131 return obj
132
133 def __eq__(self, other):
134 if type(self) != type(other): return False
135 if self.xid != other.xid: return False
136 if self.stats_type != other.stats_type: return False
137 if self.flags != other.flags: return False
138 return True
139
140 def pretty_print(self, q):
141 q.text("stats_reply {")
142 with q.group():
143 with q.indent(2):
144 q.breakable()
145 q.text("xid = ");
146 if self.xid != None:
147 q.text("%#x" % self.xid)
148 else:
149 q.text('None')
150 q.text(","); q.breakable()
151 q.text("flags = ");
152 q.text("%#x" % self.flags)
153 q.breakable()
154 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800155
156message.subtypes[17] = stats_reply
157
158class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700159 version = 1
160 type = 17
161 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700162
Rich Lanec2ee4b82013-04-24 17:12:38 -0700163 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800164 if xid != None:
165 self.xid = xid
166 else:
167 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700168 if flags != None:
169 self.flags = flags
170 else:
171 self.flags = 0
172 if packet_count != None:
173 self.packet_count = packet_count
174 else:
175 self.packet_count = 0
176 if byte_count != None:
177 self.byte_count = byte_count
178 else:
179 self.byte_count = 0
180 if flow_count != None:
181 self.flow_count = flow_count
182 else:
183 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800184 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700185
186 def pack(self):
187 packed = []
188 packed.append(struct.pack("!B", self.version))
189 packed.append(struct.pack("!B", self.type))
190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
191 packed.append(struct.pack("!L", self.xid))
192 packed.append(struct.pack("!H", self.stats_type))
193 packed.append(struct.pack("!H", self.flags))
194 packed.append(struct.pack("!Q", self.packet_count))
195 packed.append(struct.pack("!Q", self.byte_count))
196 packed.append(struct.pack("!L", self.flow_count))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700197 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700198 length = sum([len(x) for x in packed])
199 packed[2] = struct.pack("!H", length)
200 return ''.join(packed)
201
202 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800203 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700204 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700205 _version = reader.read("!B")[0]
206 assert(_version == 1)
207 _type = reader.read("!B")[0]
208 assert(_type == 17)
209 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800210 orig_reader = reader
211 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700212 obj.xid = reader.read("!L")[0]
213 _stats_type = reader.read("!H")[0]
214 assert(_stats_type == 2)
215 obj.flags = reader.read("!H")[0]
216 obj.packet_count = reader.read("!Q")[0]
217 obj.byte_count = reader.read("!Q")[0]
218 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700219 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700220 return obj
221
222 def __eq__(self, other):
223 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700224 if self.xid != other.xid: return False
225 if self.flags != other.flags: return False
226 if self.packet_count != other.packet_count: return False
227 if self.byte_count != other.byte_count: return False
228 if self.flow_count != other.flow_count: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700229 return True
230
Rich Laneb658ddd2013-03-12 10:15:10 -0700231 def pretty_print(self, q):
232 q.text("aggregate_stats_reply {")
233 with q.group():
234 with q.indent(2):
235 q.breakable()
236 q.text("xid = ");
237 if self.xid != None:
238 q.text("%#x" % self.xid)
239 else:
240 q.text('None')
241 q.text(","); q.breakable()
242 q.text("flags = ");
243 q.text("%#x" % self.flags)
244 q.text(","); q.breakable()
245 q.text("packet_count = ");
246 q.text("%#x" % self.packet_count)
247 q.text(","); q.breakable()
248 q.text("byte_count = ");
249 q.text("%#x" % self.byte_count)
250 q.text(","); q.breakable()
251 q.text("flow_count = ");
252 q.text("%#x" % self.flow_count)
Rich Laneb658ddd2013-03-12 10:15:10 -0700253 q.breakable()
254 q.text('}')
255
Rich Lane7dcdf022013-12-11 14:45:27 -0800256stats_reply.subtypes[2] = aggregate_stats_reply
257
258class stats_request(message):
259 subtypes = {}
260
Rich Lane95f7fc92014-01-27 17:08:16 -0800261 version = 1
262 type = 16
263
264 def __init__(self, xid=None, stats_type=None, flags=None):
265 if xid != None:
266 self.xid = xid
267 else:
268 self.xid = None
269 if stats_type != None:
270 self.stats_type = stats_type
271 else:
272 self.stats_type = 0
273 if flags != None:
274 self.flags = flags
275 else:
276 self.flags = 0
277 return
278
279 def pack(self):
280 packed = []
281 packed.append(struct.pack("!B", self.version))
282 packed.append(struct.pack("!B", self.type))
283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
284 packed.append(struct.pack("!L", self.xid))
285 packed.append(struct.pack("!H", self.stats_type))
286 packed.append(struct.pack("!H", self.flags))
287 length = sum([len(x) for x in packed])
288 packed[2] = struct.pack("!H", length)
289 return ''.join(packed)
290
Rich Lane7dcdf022013-12-11 14:45:27 -0800291 @staticmethod
292 def unpack(reader):
293 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800294 subclass = stats_request.subtypes.get(subtype)
295 if subclass:
296 return subclass.unpack(reader)
297
298 obj = stats_request()
299 _version = reader.read("!B")[0]
300 assert(_version == 1)
301 _type = reader.read("!B")[0]
302 assert(_type == 16)
303 _length = reader.read("!H")[0]
304 orig_reader = reader
305 reader = orig_reader.slice(_length - (2 + 2))
306 obj.xid = reader.read("!L")[0]
307 obj.stats_type = reader.read("!H")[0]
308 obj.flags = reader.read("!H")[0]
309 return obj
310
311 def __eq__(self, other):
312 if type(self) != type(other): return False
313 if self.xid != other.xid: return False
314 if self.stats_type != other.stats_type: return False
315 if self.flags != other.flags: return False
316 return True
317
318 def pretty_print(self, q):
319 q.text("stats_request {")
320 with q.group():
321 with q.indent(2):
322 q.breakable()
323 q.text("xid = ");
324 if self.xid != None:
325 q.text("%#x" % self.xid)
326 else:
327 q.text('None')
328 q.text(","); q.breakable()
329 q.text("flags = ");
330 q.text("%#x" % self.flags)
331 q.breakable()
332 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800333
334message.subtypes[16] = stats_request
335
336class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700337 version = 1
338 type = 16
339 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700340
Rich Lanec2ee4b82013-04-24 17:12:38 -0700341 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800342 if xid != None:
343 self.xid = xid
344 else:
345 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700346 if flags != None:
347 self.flags = flags
348 else:
349 self.flags = 0
350 if match != None:
351 self.match = match
352 else:
353 self.match = common.match()
354 if table_id != None:
355 self.table_id = table_id
356 else:
357 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -0700358 if out_port != None:
359 self.out_port = out_port
360 else:
361 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800362 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700363
364 def pack(self):
365 packed = []
366 packed.append(struct.pack("!B", self.version))
367 packed.append(struct.pack("!B", self.type))
368 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
369 packed.append(struct.pack("!L", self.xid))
370 packed.append(struct.pack("!H", self.stats_type))
371 packed.append(struct.pack("!H", self.flags))
372 packed.append(self.match.pack())
373 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700374 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700375 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -0700376 length = sum([len(x) for x in packed])
377 packed[2] = struct.pack("!H", length)
378 return ''.join(packed)
379
380 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800381 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700382 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700383 _version = reader.read("!B")[0]
384 assert(_version == 1)
385 _type = reader.read("!B")[0]
386 assert(_type == 16)
387 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800388 orig_reader = reader
389 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700390 obj.xid = reader.read("!L")[0]
391 _stats_type = reader.read("!H")[0]
392 assert(_stats_type == 2)
393 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700394 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -0700395 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700396 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700397 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -0700398 return obj
399
400 def __eq__(self, other):
401 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700402 if self.xid != other.xid: return False
403 if self.flags != other.flags: return False
404 if self.match != other.match: return False
405 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700406 if self.out_port != other.out_port: return False
407 return True
408
Rich Laneb658ddd2013-03-12 10:15:10 -0700409 def pretty_print(self, q):
410 q.text("aggregate_stats_request {")
411 with q.group():
412 with q.indent(2):
413 q.breakable()
414 q.text("xid = ");
415 if self.xid != None:
416 q.text("%#x" % self.xid)
417 else:
418 q.text('None')
419 q.text(","); q.breakable()
420 q.text("flags = ");
421 q.text("%#x" % self.flags)
422 q.text(","); q.breakable()
423 q.text("match = ");
424 q.pp(self.match)
425 q.text(","); q.breakable()
426 q.text("table_id = ");
427 q.text("%#x" % self.table_id)
428 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -0700429 q.text("out_port = ");
430 q.text(util.pretty_port(self.out_port))
431 q.breakable()
432 q.text('}')
433
Rich Lane7dcdf022013-12-11 14:45:27 -0800434stats_request.subtypes[2] = aggregate_stats_request
435
436class error_msg(message):
437 subtypes = {}
438
Rich Lane95f7fc92014-01-27 17:08:16 -0800439 version = 1
440 type = 1
441
442 def __init__(self, xid=None, err_type=None):
443 if xid != None:
444 self.xid = xid
445 else:
446 self.xid = None
447 if err_type != None:
448 self.err_type = err_type
449 else:
450 self.err_type = 0
451 return
452
453 def pack(self):
454 packed = []
455 packed.append(struct.pack("!B", self.version))
456 packed.append(struct.pack("!B", self.type))
457 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
458 packed.append(struct.pack("!L", self.xid))
459 packed.append(struct.pack("!H", self.err_type))
460 length = sum([len(x) for x in packed])
461 packed[2] = struct.pack("!H", length)
462 return ''.join(packed)
463
Rich Lane7dcdf022013-12-11 14:45:27 -0800464 @staticmethod
465 def unpack(reader):
466 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800467 subclass = error_msg.subtypes.get(subtype)
468 if subclass:
469 return subclass.unpack(reader)
470
471 obj = error_msg()
472 _version = reader.read("!B")[0]
473 assert(_version == 1)
474 _type = reader.read("!B")[0]
475 assert(_type == 1)
476 _length = reader.read("!H")[0]
477 orig_reader = reader
478 reader = orig_reader.slice(_length - (2 + 2))
479 obj.xid = reader.read("!L")[0]
480 obj.err_type = reader.read("!H")[0]
481 return obj
482
483 def __eq__(self, other):
484 if type(self) != type(other): return False
485 if self.xid != other.xid: return False
486 if self.err_type != other.err_type: return False
487 return True
488
489 def pretty_print(self, q):
490 q.text("error_msg {")
491 with q.group():
492 with q.indent(2):
493 q.breakable()
494 q.text("xid = ");
495 if self.xid != None:
496 q.text("%#x" % self.xid)
497 else:
498 q.text('None')
499 q.breakable()
500 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800501
502message.subtypes[1] = error_msg
503
504class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700505 version = 1
506 type = 1
507 err_type = 2
508
509 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800510 if xid != None:
511 self.xid = xid
512 else:
513 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700514 if code != None:
515 self.code = code
516 else:
517 self.code = 0
518 if data != None:
519 self.data = data
520 else:
521 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800522 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700523
524 def pack(self):
525 packed = []
526 packed.append(struct.pack("!B", self.version))
527 packed.append(struct.pack("!B", self.type))
528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
529 packed.append(struct.pack("!L", self.xid))
530 packed.append(struct.pack("!H", self.err_type))
531 packed.append(struct.pack("!H", self.code))
532 packed.append(self.data)
533 length = sum([len(x) for x in packed])
534 packed[2] = struct.pack("!H", length)
535 return ''.join(packed)
536
537 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800538 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700539 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700540 _version = reader.read("!B")[0]
541 assert(_version == 1)
542 _type = reader.read("!B")[0]
543 assert(_type == 1)
544 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800545 orig_reader = reader
546 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700547 obj.xid = reader.read("!L")[0]
548 _err_type = reader.read("!H")[0]
549 assert(_err_type == 2)
550 obj.code = reader.read("!H")[0]
551 obj.data = str(reader.read_all())
552 return obj
553
554 def __eq__(self, other):
555 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700556 if self.xid != other.xid: return False
557 if self.code != other.code: return False
558 if self.data != other.data: return False
559 return True
560
Rich Lane6f4978c2013-10-20 21:33:52 -0700561 def pretty_print(self, q):
562 q.text("bad_action_error_msg {")
563 with q.group():
564 with q.indent(2):
565 q.breakable()
566 q.text("xid = ");
567 if self.xid != None:
568 q.text("%#x" % self.xid)
569 else:
570 q.text('None')
571 q.text(","); q.breakable()
572 q.text("code = ");
573 q.text("%#x" % self.code)
574 q.text(","); q.breakable()
575 q.text("data = ");
576 q.pp(self.data)
577 q.breakable()
578 q.text('}')
579
Rich Lane7dcdf022013-12-11 14:45:27 -0800580error_msg.subtypes[2] = bad_action_error_msg
581
582class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700583 version = 1
584 type = 1
585 err_type = 1
586
587 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800588 if xid != None:
589 self.xid = xid
590 else:
591 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700592 if code != None:
593 self.code = code
594 else:
595 self.code = 0
596 if data != None:
597 self.data = data
598 else:
599 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800600 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700601
602 def pack(self):
603 packed = []
604 packed.append(struct.pack("!B", self.version))
605 packed.append(struct.pack("!B", self.type))
606 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
607 packed.append(struct.pack("!L", self.xid))
608 packed.append(struct.pack("!H", self.err_type))
609 packed.append(struct.pack("!H", self.code))
610 packed.append(self.data)
611 length = sum([len(x) for x in packed])
612 packed[2] = struct.pack("!H", length)
613 return ''.join(packed)
614
615 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800616 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700617 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700618 _version = reader.read("!B")[0]
619 assert(_version == 1)
620 _type = reader.read("!B")[0]
621 assert(_type == 1)
622 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800623 orig_reader = reader
624 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700625 obj.xid = reader.read("!L")[0]
626 _err_type = reader.read("!H")[0]
627 assert(_err_type == 1)
628 obj.code = reader.read("!H")[0]
629 obj.data = str(reader.read_all())
630 return obj
631
632 def __eq__(self, other):
633 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700634 if self.xid != other.xid: return False
635 if self.code != other.code: return False
636 if self.data != other.data: return False
637 return True
638
Rich Lane6f4978c2013-10-20 21:33:52 -0700639 def pretty_print(self, q):
640 q.text("bad_request_error_msg {")
641 with q.group():
642 with q.indent(2):
643 q.breakable()
644 q.text("xid = ");
645 if self.xid != None:
646 q.text("%#x" % self.xid)
647 else:
648 q.text('None')
649 q.text(","); q.breakable()
650 q.text("code = ");
651 q.text("%#x" % self.code)
652 q.text(","); q.breakable()
653 q.text("data = ");
654 q.pp(self.data)
655 q.breakable()
656 q.text('}')
657
Rich Lane7dcdf022013-12-11 14:45:27 -0800658error_msg.subtypes[1] = bad_request_error_msg
659
660class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700661 version = 1
662 type = 19
Rich Laneb658ddd2013-03-12 10:15:10 -0700663
664 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800665 if xid != None:
666 self.xid = xid
667 else:
668 self.xid = None
669 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700670
671 def pack(self):
672 packed = []
673 packed.append(struct.pack("!B", self.version))
674 packed.append(struct.pack("!B", self.type))
675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
676 packed.append(struct.pack("!L", self.xid))
677 length = sum([len(x) for x in packed])
678 packed[2] = struct.pack("!H", length)
679 return ''.join(packed)
680
681 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800682 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700683 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700684 _version = reader.read("!B")[0]
685 assert(_version == 1)
686 _type = reader.read("!B")[0]
687 assert(_type == 19)
688 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800689 orig_reader = reader
690 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700691 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700692 return obj
693
694 def __eq__(self, other):
695 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700696 if self.xid != other.xid: return False
697 return True
698
Rich Laneb658ddd2013-03-12 10:15:10 -0700699 def pretty_print(self, q):
700 q.text("barrier_reply {")
701 with q.group():
702 with q.indent(2):
703 q.breakable()
704 q.text("xid = ");
705 if self.xid != None:
706 q.text("%#x" % self.xid)
707 else:
708 q.text('None')
709 q.breakable()
710 q.text('}')
711
Rich Lane7dcdf022013-12-11 14:45:27 -0800712message.subtypes[19] = barrier_reply
713
714class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700715 version = 1
716 type = 18
Rich Laneb658ddd2013-03-12 10:15:10 -0700717
718 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800719 if xid != None:
720 self.xid = xid
721 else:
722 self.xid = None
723 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700724
725 def pack(self):
726 packed = []
727 packed.append(struct.pack("!B", self.version))
728 packed.append(struct.pack("!B", self.type))
729 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
730 packed.append(struct.pack("!L", self.xid))
731 length = sum([len(x) for x in packed])
732 packed[2] = struct.pack("!H", length)
733 return ''.join(packed)
734
735 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800736 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700737 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700738 _version = reader.read("!B")[0]
739 assert(_version == 1)
740 _type = reader.read("!B")[0]
741 assert(_type == 18)
742 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800743 orig_reader = reader
744 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700745 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700746 return obj
747
748 def __eq__(self, other):
749 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700750 if self.xid != other.xid: return False
751 return True
752
Rich Laneb658ddd2013-03-12 10:15:10 -0700753 def pretty_print(self, q):
754 q.text("barrier_request {")
755 with q.group():
756 with q.indent(2):
757 q.breakable()
758 q.text("xid = ");
759 if self.xid != None:
760 q.text("%#x" % self.xid)
761 else:
762 q.text('None')
763 q.breakable()
764 q.text('}')
765
Rich Lane7dcdf022013-12-11 14:45:27 -0800766message.subtypes[18] = barrier_request
767
768class experimenter(message):
769 subtypes = {}
770
Rich Lane95f7fc92014-01-27 17:08:16 -0800771 version = 1
772 type = 4
773
774 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
775 if xid != None:
776 self.xid = xid
777 else:
778 self.xid = None
779 if experimenter != None:
780 self.experimenter = experimenter
781 else:
782 self.experimenter = 0
783 if subtype != None:
784 self.subtype = subtype
785 else:
786 self.subtype = 0
787 if data != None:
788 self.data = data
789 else:
790 self.data = ''
791 return
792
793 def pack(self):
794 packed = []
795 packed.append(struct.pack("!B", self.version))
796 packed.append(struct.pack("!B", self.type))
797 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
798 packed.append(struct.pack("!L", self.xid))
799 packed.append(struct.pack("!L", self.experimenter))
800 packed.append(struct.pack("!L", self.subtype))
801 packed.append(self.data)
802 length = sum([len(x) for x in packed])
803 packed[2] = struct.pack("!H", length)
804 return ''.join(packed)
805
Rich Lane7dcdf022013-12-11 14:45:27 -0800806 @staticmethod
807 def unpack(reader):
808 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800809 subclass = experimenter.subtypes.get(subtype)
810 if subclass:
811 return subclass.unpack(reader)
812
813 obj = experimenter()
814 _version = reader.read("!B")[0]
815 assert(_version == 1)
816 _type = reader.read("!B")[0]
817 assert(_type == 4)
818 _length = reader.read("!H")[0]
819 orig_reader = reader
820 reader = orig_reader.slice(_length - (2 + 2))
821 obj.xid = reader.read("!L")[0]
822 obj.experimenter = reader.read("!L")[0]
823 obj.subtype = reader.read("!L")[0]
824 obj.data = str(reader.read_all())
825 return obj
826
827 def __eq__(self, other):
828 if type(self) != type(other): return False
829 if self.xid != other.xid: return False
830 if self.experimenter != other.experimenter: return False
831 if self.subtype != other.subtype: return False
832 if self.data != other.data: return False
833 return True
834
835 def pretty_print(self, q):
836 q.text("experimenter {")
837 with q.group():
838 with q.indent(2):
839 q.breakable()
840 q.text("xid = ");
841 if self.xid != None:
842 q.text("%#x" % self.xid)
843 else:
844 q.text('None')
845 q.text(","); q.breakable()
846 q.text("subtype = ");
847 q.text("%#x" % self.subtype)
848 q.text(","); q.breakable()
849 q.text("data = ");
850 q.pp(self.data)
851 q.breakable()
852 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800853
854message.subtypes[4] = experimenter
855
856class bsn_header(experimenter):
857 subtypes = {}
858
Rich Lane95f7fc92014-01-27 17:08:16 -0800859 version = 1
860 type = 4
861 experimenter = 6035143
862
863 def __init__(self, xid=None, subtype=None):
864 if xid != None:
865 self.xid = xid
866 else:
867 self.xid = None
868 if subtype != None:
869 self.subtype = subtype
870 else:
871 self.subtype = 0
872 return
873
874 def pack(self):
875 packed = []
876 packed.append(struct.pack("!B", self.version))
877 packed.append(struct.pack("!B", self.type))
878 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
879 packed.append(struct.pack("!L", self.xid))
880 packed.append(struct.pack("!L", self.experimenter))
881 packed.append(struct.pack("!L", self.subtype))
882 length = sum([len(x) for x in packed])
883 packed[2] = struct.pack("!H", length)
884 return ''.join(packed)
885
Rich Lane7dcdf022013-12-11 14:45:27 -0800886 @staticmethod
887 def unpack(reader):
888 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -0800889 subclass = bsn_header.subtypes.get(subtype)
890 if subclass:
891 return subclass.unpack(reader)
892
893 obj = bsn_header()
894 _version = reader.read("!B")[0]
895 assert(_version == 1)
896 _type = reader.read("!B")[0]
897 assert(_type == 4)
898 _length = reader.read("!H")[0]
899 orig_reader = reader
900 reader = orig_reader.slice(_length - (2 + 2))
901 obj.xid = reader.read("!L")[0]
902 _experimenter = reader.read("!L")[0]
903 assert(_experimenter == 6035143)
904 obj.subtype = reader.read("!L")[0]
905 return obj
906
907 def __eq__(self, other):
908 if type(self) != type(other): return False
909 if self.xid != other.xid: return False
910 if self.subtype != other.subtype: return False
911 return True
912
913 def pretty_print(self, q):
914 q.text("bsn_header {")
915 with q.group():
916 with q.indent(2):
917 q.breakable()
918 q.text("xid = ");
919 if self.xid != None:
920 q.text("%#x" % self.xid)
921 else:
922 q.text('None')
923 q.breakable()
924 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800925
926experimenter.subtypes[6035143] = bsn_header
927
928class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700929 version = 1
930 type = 4
931 experimenter = 6035143
932 subtype = 22
933
934 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800935 if xid != None:
936 self.xid = xid
937 else:
938 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700939 if status != None:
940 self.status = status
941 else:
942 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800943 return
Dan Talaycof6202252013-07-02 01:00:29 -0700944
945 def pack(self):
946 packed = []
947 packed.append(struct.pack("!B", self.version))
948 packed.append(struct.pack("!B", self.type))
949 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
950 packed.append(struct.pack("!L", self.xid))
951 packed.append(struct.pack("!L", self.experimenter))
952 packed.append(struct.pack("!L", self.subtype))
953 packed.append(struct.pack("!L", self.status))
954 length = sum([len(x) for x in packed])
955 packed[2] = struct.pack("!H", length)
956 return ''.join(packed)
957
958 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800959 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700960 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700961 _version = reader.read("!B")[0]
962 assert(_version == 1)
963 _type = reader.read("!B")[0]
964 assert(_type == 4)
965 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800966 orig_reader = reader
967 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700968 obj.xid = reader.read("!L")[0]
969 _experimenter = reader.read("!L")[0]
970 assert(_experimenter == 6035143)
971 _subtype = reader.read("!L")[0]
972 assert(_subtype == 22)
973 obj.status = reader.read("!L")[0]
974 return obj
975
976 def __eq__(self, other):
977 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700978 if self.xid != other.xid: return False
979 if self.status != other.status: return False
980 return True
981
Dan Talaycof6202252013-07-02 01:00:29 -0700982 def pretty_print(self, q):
983 q.text("bsn_bw_clear_data_reply {")
984 with q.group():
985 with q.indent(2):
986 q.breakable()
987 q.text("xid = ");
988 if self.xid != None:
989 q.text("%#x" % self.xid)
990 else:
991 q.text('None')
992 q.text(","); q.breakable()
993 q.text("status = ");
994 q.text("%#x" % self.status)
995 q.breakable()
996 q.text('}')
997
Rich Lane7dcdf022013-12-11 14:45:27 -0800998bsn_header.subtypes[22] = bsn_bw_clear_data_reply
999
1000class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001001 version = 1
1002 type = 4
1003 experimenter = 6035143
1004 subtype = 21
1005
1006 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001007 if xid != None:
1008 self.xid = xid
1009 else:
1010 self.xid = None
1011 return
Dan Talaycof6202252013-07-02 01:00:29 -07001012
1013 def pack(self):
1014 packed = []
1015 packed.append(struct.pack("!B", self.version))
1016 packed.append(struct.pack("!B", self.type))
1017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1018 packed.append(struct.pack("!L", self.xid))
1019 packed.append(struct.pack("!L", self.experimenter))
1020 packed.append(struct.pack("!L", self.subtype))
1021 length = sum([len(x) for x in packed])
1022 packed[2] = struct.pack("!H", length)
1023 return ''.join(packed)
1024
1025 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001026 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001027 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001028 _version = reader.read("!B")[0]
1029 assert(_version == 1)
1030 _type = reader.read("!B")[0]
1031 assert(_type == 4)
1032 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001033 orig_reader = reader
1034 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001035 obj.xid = reader.read("!L")[0]
1036 _experimenter = reader.read("!L")[0]
1037 assert(_experimenter == 6035143)
1038 _subtype = reader.read("!L")[0]
1039 assert(_subtype == 21)
1040 return obj
1041
1042 def __eq__(self, other):
1043 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001044 if self.xid != other.xid: return False
1045 return True
1046
Dan Talaycof6202252013-07-02 01:00:29 -07001047 def pretty_print(self, q):
1048 q.text("bsn_bw_clear_data_request {")
1049 with q.group():
1050 with q.indent(2):
1051 q.breakable()
1052 q.text("xid = ");
1053 if self.xid != None:
1054 q.text("%#x" % self.xid)
1055 else:
1056 q.text('None')
1057 q.breakable()
1058 q.text('}')
1059
Rich Lane7dcdf022013-12-11 14:45:27 -08001060bsn_header.subtypes[21] = bsn_bw_clear_data_request
1061
1062class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001063 version = 1
1064 type = 4
1065 experimenter = 6035143
1066 subtype = 20
1067
1068 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001069 if xid != None:
1070 self.xid = xid
1071 else:
1072 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001073 if enabled != None:
1074 self.enabled = enabled
1075 else:
1076 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001077 return
Dan Talaycof6202252013-07-02 01:00:29 -07001078
1079 def pack(self):
1080 packed = []
1081 packed.append(struct.pack("!B", self.version))
1082 packed.append(struct.pack("!B", self.type))
1083 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1084 packed.append(struct.pack("!L", self.xid))
1085 packed.append(struct.pack("!L", self.experimenter))
1086 packed.append(struct.pack("!L", self.subtype))
1087 packed.append(struct.pack("!L", self.enabled))
1088 length = sum([len(x) for x in packed])
1089 packed[2] = struct.pack("!H", length)
1090 return ''.join(packed)
1091
1092 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001093 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001094 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001095 _version = reader.read("!B")[0]
1096 assert(_version == 1)
1097 _type = reader.read("!B")[0]
1098 assert(_type == 4)
1099 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001100 orig_reader = reader
1101 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001102 obj.xid = reader.read("!L")[0]
1103 _experimenter = reader.read("!L")[0]
1104 assert(_experimenter == 6035143)
1105 _subtype = reader.read("!L")[0]
1106 assert(_subtype == 20)
1107 obj.enabled = reader.read("!L")[0]
1108 return obj
1109
1110 def __eq__(self, other):
1111 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001112 if self.xid != other.xid: return False
1113 if self.enabled != other.enabled: return False
1114 return True
1115
Dan Talaycof6202252013-07-02 01:00:29 -07001116 def pretty_print(self, q):
1117 q.text("bsn_bw_enable_get_reply {")
1118 with q.group():
1119 with q.indent(2):
1120 q.breakable()
1121 q.text("xid = ");
1122 if self.xid != None:
1123 q.text("%#x" % self.xid)
1124 else:
1125 q.text('None')
1126 q.text(","); q.breakable()
1127 q.text("enabled = ");
1128 q.text("%#x" % self.enabled)
1129 q.breakable()
1130 q.text('}')
1131
Rich Lane7dcdf022013-12-11 14:45:27 -08001132bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1133
1134class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001135 version = 1
1136 type = 4
1137 experimenter = 6035143
1138 subtype = 19
1139
1140 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001141 if xid != None:
1142 self.xid = xid
1143 else:
1144 self.xid = None
1145 return
Dan Talaycof6202252013-07-02 01:00:29 -07001146
1147 def pack(self):
1148 packed = []
1149 packed.append(struct.pack("!B", self.version))
1150 packed.append(struct.pack("!B", self.type))
1151 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1152 packed.append(struct.pack("!L", self.xid))
1153 packed.append(struct.pack("!L", self.experimenter))
1154 packed.append(struct.pack("!L", self.subtype))
1155 length = sum([len(x) for x in packed])
1156 packed[2] = struct.pack("!H", length)
1157 return ''.join(packed)
1158
1159 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001160 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001161 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001162 _version = reader.read("!B")[0]
1163 assert(_version == 1)
1164 _type = reader.read("!B")[0]
1165 assert(_type == 4)
1166 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001167 orig_reader = reader
1168 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001169 obj.xid = reader.read("!L")[0]
1170 _experimenter = reader.read("!L")[0]
1171 assert(_experimenter == 6035143)
1172 _subtype = reader.read("!L")[0]
1173 assert(_subtype == 19)
1174 return obj
1175
1176 def __eq__(self, other):
1177 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001178 if self.xid != other.xid: return False
1179 return True
1180
Dan Talaycof6202252013-07-02 01:00:29 -07001181 def pretty_print(self, q):
1182 q.text("bsn_bw_enable_get_request {")
1183 with q.group():
1184 with q.indent(2):
1185 q.breakable()
1186 q.text("xid = ");
1187 if self.xid != None:
1188 q.text("%#x" % self.xid)
1189 else:
1190 q.text('None')
1191 q.breakable()
1192 q.text('}')
1193
Rich Lane7dcdf022013-12-11 14:45:27 -08001194bsn_header.subtypes[19] = bsn_bw_enable_get_request
1195
1196class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001197 version = 1
1198 type = 4
1199 experimenter = 6035143
1200 subtype = 23
1201
1202 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001203 if xid != None:
1204 self.xid = xid
1205 else:
1206 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001207 if enable != None:
1208 self.enable = enable
1209 else:
1210 self.enable = 0
1211 if status != None:
1212 self.status = status
1213 else:
1214 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001215 return
Dan Talaycof6202252013-07-02 01:00:29 -07001216
1217 def pack(self):
1218 packed = []
1219 packed.append(struct.pack("!B", self.version))
1220 packed.append(struct.pack("!B", self.type))
1221 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1222 packed.append(struct.pack("!L", self.xid))
1223 packed.append(struct.pack("!L", self.experimenter))
1224 packed.append(struct.pack("!L", self.subtype))
1225 packed.append(struct.pack("!L", self.enable))
1226 packed.append(struct.pack("!L", self.status))
1227 length = sum([len(x) for x in packed])
1228 packed[2] = struct.pack("!H", length)
1229 return ''.join(packed)
1230
1231 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001232 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001233 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001234 _version = reader.read("!B")[0]
1235 assert(_version == 1)
1236 _type = reader.read("!B")[0]
1237 assert(_type == 4)
1238 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001239 orig_reader = reader
1240 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001241 obj.xid = reader.read("!L")[0]
1242 _experimenter = reader.read("!L")[0]
1243 assert(_experimenter == 6035143)
1244 _subtype = reader.read("!L")[0]
1245 assert(_subtype == 23)
1246 obj.enable = reader.read("!L")[0]
1247 obj.status = reader.read("!L")[0]
1248 return obj
1249
1250 def __eq__(self, other):
1251 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001252 if self.xid != other.xid: return False
1253 if self.enable != other.enable: return False
1254 if self.status != other.status: return False
1255 return True
1256
Dan Talaycof6202252013-07-02 01:00:29 -07001257 def pretty_print(self, q):
1258 q.text("bsn_bw_enable_set_reply {")
1259 with q.group():
1260 with q.indent(2):
1261 q.breakable()
1262 q.text("xid = ");
1263 if self.xid != None:
1264 q.text("%#x" % self.xid)
1265 else:
1266 q.text('None')
1267 q.text(","); q.breakable()
1268 q.text("enable = ");
1269 q.text("%#x" % self.enable)
1270 q.text(","); q.breakable()
1271 q.text("status = ");
1272 q.text("%#x" % self.status)
1273 q.breakable()
1274 q.text('}')
1275
Rich Lane7dcdf022013-12-11 14:45:27 -08001276bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1277
1278class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001279 version = 1
1280 type = 4
1281 experimenter = 6035143
1282 subtype = 18
1283
1284 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001285 if xid != None:
1286 self.xid = xid
1287 else:
1288 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001289 if enable != None:
1290 self.enable = enable
1291 else:
1292 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001293 return
Dan Talaycof6202252013-07-02 01:00:29 -07001294
1295 def pack(self):
1296 packed = []
1297 packed.append(struct.pack("!B", self.version))
1298 packed.append(struct.pack("!B", self.type))
1299 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1300 packed.append(struct.pack("!L", self.xid))
1301 packed.append(struct.pack("!L", self.experimenter))
1302 packed.append(struct.pack("!L", self.subtype))
1303 packed.append(struct.pack("!L", self.enable))
1304 length = sum([len(x) for x in packed])
1305 packed[2] = struct.pack("!H", length)
1306 return ''.join(packed)
1307
1308 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001309 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001310 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001311 _version = reader.read("!B")[0]
1312 assert(_version == 1)
1313 _type = reader.read("!B")[0]
1314 assert(_type == 4)
1315 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001316 orig_reader = reader
1317 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001318 obj.xid = reader.read("!L")[0]
1319 _experimenter = reader.read("!L")[0]
1320 assert(_experimenter == 6035143)
1321 _subtype = reader.read("!L")[0]
1322 assert(_subtype == 18)
1323 obj.enable = reader.read("!L")[0]
1324 return obj
1325
1326 def __eq__(self, other):
1327 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001328 if self.xid != other.xid: return False
1329 if self.enable != other.enable: return False
1330 return True
1331
Dan Talaycof6202252013-07-02 01:00:29 -07001332 def pretty_print(self, q):
1333 q.text("bsn_bw_enable_set_request {")
1334 with q.group():
1335 with q.indent(2):
1336 q.breakable()
1337 q.text("xid = ");
1338 if self.xid != None:
1339 q.text("%#x" % self.xid)
1340 else:
1341 q.text('None')
1342 q.text(","); q.breakable()
1343 q.text("enable = ");
1344 q.text("%#x" % self.enable)
1345 q.breakable()
1346 q.text('}')
1347
Rich Lane7dcdf022013-12-11 14:45:27 -08001348bsn_header.subtypes[18] = bsn_bw_enable_set_request
1349
1350class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001351 version = 1
1352 type = 4
1353 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001354 subtype = 10
1355
1356 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001357 if xid != None:
1358 self.xid = xid
1359 else:
1360 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001361 if interfaces != None:
1362 self.interfaces = interfaces
1363 else:
1364 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001365 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001366
1367 def pack(self):
1368 packed = []
1369 packed.append(struct.pack("!B", self.version))
1370 packed.append(struct.pack("!B", self.type))
1371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1372 packed.append(struct.pack("!L", self.xid))
1373 packed.append(struct.pack("!L", self.experimenter))
1374 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001375 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Laneb658ddd2013-03-12 10:15:10 -07001376 length = sum([len(x) for x in packed])
1377 packed[2] = struct.pack("!H", length)
1378 return ''.join(packed)
1379
1380 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001381 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001382 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001383 _version = reader.read("!B")[0]
1384 assert(_version == 1)
1385 _type = reader.read("!B")[0]
1386 assert(_type == 4)
1387 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001388 orig_reader = reader
1389 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001390 obj.xid = reader.read("!L")[0]
1391 _experimenter = reader.read("!L")[0]
1392 assert(_experimenter == 6035143)
1393 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001394 assert(_subtype == 10)
1395 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07001396 return obj
1397
1398 def __eq__(self, other):
1399 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001400 if self.xid != other.xid: return False
1401 if self.interfaces != other.interfaces: return False
1402 return True
1403
Rich Laneb658ddd2013-03-12 10:15:10 -07001404 def pretty_print(self, q):
1405 q.text("bsn_get_interfaces_reply {")
1406 with q.group():
1407 with q.indent(2):
1408 q.breakable()
1409 q.text("xid = ");
1410 if self.xid != None:
1411 q.text("%#x" % self.xid)
1412 else:
1413 q.text('None')
1414 q.text(","); q.breakable()
1415 q.text("interfaces = ");
1416 q.pp(self.interfaces)
1417 q.breakable()
1418 q.text('}')
1419
Rich Lane7dcdf022013-12-11 14:45:27 -08001420bsn_header.subtypes[10] = bsn_get_interfaces_reply
1421
1422class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001423 version = 1
1424 type = 4
1425 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001426 subtype = 9
1427
1428 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001429 if xid != None:
1430 self.xid = xid
1431 else:
1432 self.xid = None
1433 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001434
1435 def pack(self):
1436 packed = []
1437 packed.append(struct.pack("!B", self.version))
1438 packed.append(struct.pack("!B", self.type))
1439 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1440 packed.append(struct.pack("!L", self.xid))
1441 packed.append(struct.pack("!L", self.experimenter))
1442 packed.append(struct.pack("!L", self.subtype))
1443 length = sum([len(x) for x in packed])
1444 packed[2] = struct.pack("!H", length)
1445 return ''.join(packed)
1446
1447 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001448 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001449 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001450 _version = reader.read("!B")[0]
1451 assert(_version == 1)
1452 _type = reader.read("!B")[0]
1453 assert(_type == 4)
1454 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001455 orig_reader = reader
1456 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001457 obj.xid = reader.read("!L")[0]
1458 _experimenter = reader.read("!L")[0]
1459 assert(_experimenter == 6035143)
1460 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001461 assert(_subtype == 9)
Rich Laneb658ddd2013-03-12 10:15:10 -07001462 return obj
1463
1464 def __eq__(self, other):
1465 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001466 if self.xid != other.xid: return False
1467 return True
1468
Rich Laneb658ddd2013-03-12 10:15:10 -07001469 def pretty_print(self, q):
1470 q.text("bsn_get_interfaces_request {")
1471 with q.group():
1472 with q.indent(2):
1473 q.breakable()
1474 q.text("xid = ");
1475 if self.xid != None:
1476 q.text("%#x" % self.xid)
1477 else:
1478 q.text('None')
1479 q.breakable()
1480 q.text('}')
1481
Rich Lane7dcdf022013-12-11 14:45:27 -08001482bsn_header.subtypes[9] = bsn_get_interfaces_request
1483
1484class bsn_get_ip_mask_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001485 version = 1
1486 type = 4
1487 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001488 subtype = 2
1489
Rich Lanec2ee4b82013-04-24 17:12:38 -07001490 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001491 if xid != None:
1492 self.xid = xid
1493 else:
1494 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001495 if index != None:
1496 self.index = index
1497 else:
1498 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07001499 if mask != None:
1500 self.mask = mask
1501 else:
1502 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001503 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001504
1505 def pack(self):
1506 packed = []
1507 packed.append(struct.pack("!B", self.version))
1508 packed.append(struct.pack("!B", self.type))
1509 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1510 packed.append(struct.pack("!L", self.xid))
1511 packed.append(struct.pack("!L", self.experimenter))
1512 packed.append(struct.pack("!L", self.subtype))
1513 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001514 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001515 packed.append(struct.pack("!L", self.mask))
1516 length = sum([len(x) for x in packed])
1517 packed[2] = struct.pack("!H", length)
1518 return ''.join(packed)
1519
1520 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001521 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001522 obj = bsn_get_ip_mask_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001523 _version = reader.read("!B")[0]
1524 assert(_version == 1)
1525 _type = reader.read("!B")[0]
1526 assert(_type == 4)
1527 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001528 orig_reader = reader
1529 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001530 obj.xid = reader.read("!L")[0]
1531 _experimenter = reader.read("!L")[0]
1532 assert(_experimenter == 6035143)
1533 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001534 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -07001535 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001536 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07001537 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07001538 return obj
1539
1540 def __eq__(self, other):
1541 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001542 if self.xid != other.xid: return False
1543 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001544 if self.mask != other.mask: return False
1545 return True
1546
Rich Laneb658ddd2013-03-12 10:15:10 -07001547 def pretty_print(self, q):
1548 q.text("bsn_get_ip_mask_reply {")
1549 with q.group():
1550 with q.indent(2):
1551 q.breakable()
1552 q.text("xid = ");
1553 if self.xid != None:
1554 q.text("%#x" % self.xid)
1555 else:
1556 q.text('None')
1557 q.text(","); q.breakable()
1558 q.text("index = ");
1559 q.text("%#x" % self.index)
1560 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07001561 q.text("mask = ");
1562 q.text("%#x" % self.mask)
1563 q.breakable()
1564 q.text('}')
1565
Rich Lane7dcdf022013-12-11 14:45:27 -08001566bsn_header.subtypes[2] = bsn_get_ip_mask_reply
1567
1568class bsn_get_ip_mask_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001569 version = 1
1570 type = 4
1571 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001572 subtype = 1
1573
Rich Lanec2ee4b82013-04-24 17:12:38 -07001574 def __init__(self, xid=None, index=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001575 if xid != None:
1576 self.xid = xid
1577 else:
1578 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001579 if index != None:
1580 self.index = index
1581 else:
1582 self.index = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001583 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001584
1585 def pack(self):
1586 packed = []
1587 packed.append(struct.pack("!B", self.version))
1588 packed.append(struct.pack("!B", self.type))
1589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1590 packed.append(struct.pack("!L", self.xid))
1591 packed.append(struct.pack("!L", self.experimenter))
1592 packed.append(struct.pack("!L", self.subtype))
1593 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001594 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001595 length = sum([len(x) for x in packed])
1596 packed[2] = struct.pack("!H", length)
1597 return ''.join(packed)
1598
1599 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001600 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001601 obj = bsn_get_ip_mask_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001602 _version = reader.read("!B")[0]
1603 assert(_version == 1)
1604 _type = reader.read("!B")[0]
1605 assert(_type == 4)
1606 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001607 orig_reader = reader
1608 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001609 obj.xid = reader.read("!L")[0]
1610 _experimenter = reader.read("!L")[0]
1611 assert(_experimenter == 6035143)
1612 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001613 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001614 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001615 reader.skip(7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001616 return obj
1617
1618 def __eq__(self, other):
1619 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001620 if self.xid != other.xid: return False
1621 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001622 return True
1623
Rich Laneb658ddd2013-03-12 10:15:10 -07001624 def pretty_print(self, q):
1625 q.text("bsn_get_ip_mask_request {")
1626 with q.group():
1627 with q.indent(2):
1628 q.breakable()
1629 q.text("xid = ");
1630 if self.xid != None:
1631 q.text("%#x" % self.xid)
1632 else:
1633 q.text('None')
1634 q.text(","); q.breakable()
1635 q.text("index = ");
1636 q.text("%#x" % self.index)
Rich Laneb658ddd2013-03-12 10:15:10 -07001637 q.breakable()
1638 q.text('}')
1639
Rich Lane7dcdf022013-12-11 14:45:27 -08001640bsn_header.subtypes[1] = bsn_get_ip_mask_request
1641
1642class bsn_get_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001643 version = 1
1644 type = 4
1645 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001646 subtype = 14
1647
1648 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001649 if xid != None:
1650 self.xid = xid
1651 else:
1652 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07001653 if l2_table_enable != None:
1654 self.l2_table_enable = l2_table_enable
1655 else:
1656 self.l2_table_enable = 0
1657 if l2_table_priority != None:
1658 self.l2_table_priority = l2_table_priority
1659 else:
1660 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001661 return
Rich Lane90c961c2013-05-14 09:26:50 -07001662
1663 def pack(self):
1664 packed = []
1665 packed.append(struct.pack("!B", self.version))
1666 packed.append(struct.pack("!B", self.type))
1667 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1668 packed.append(struct.pack("!L", self.xid))
1669 packed.append(struct.pack("!L", self.experimenter))
1670 packed.append(struct.pack("!L", self.subtype))
1671 packed.append(struct.pack("!B", self.l2_table_enable))
1672 packed.append('\x00' * 1)
1673 packed.append(struct.pack("!H", self.l2_table_priority))
1674 packed.append('\x00' * 4)
1675 length = sum([len(x) for x in packed])
1676 packed[2] = struct.pack("!H", length)
1677 return ''.join(packed)
1678
1679 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001680 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001681 obj = bsn_get_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001682 _version = reader.read("!B")[0]
1683 assert(_version == 1)
1684 _type = reader.read("!B")[0]
1685 assert(_type == 4)
1686 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001687 orig_reader = reader
1688 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001689 obj.xid = reader.read("!L")[0]
1690 _experimenter = reader.read("!L")[0]
1691 assert(_experimenter == 6035143)
1692 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001693 assert(_subtype == 14)
Dan Talaycof6202252013-07-02 01:00:29 -07001694 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001695 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001696 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001697 reader.skip(4)
1698 return obj
1699
1700 def __eq__(self, other):
1701 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001702 if self.xid != other.xid: return False
1703 if self.l2_table_enable != other.l2_table_enable: return False
1704 if self.l2_table_priority != other.l2_table_priority: return False
1705 return True
1706
Rich Lane90c961c2013-05-14 09:26:50 -07001707 def pretty_print(self, q):
1708 q.text("bsn_get_l2_table_reply {")
1709 with q.group():
1710 with q.indent(2):
1711 q.breakable()
1712 q.text("xid = ");
1713 if self.xid != None:
1714 q.text("%#x" % self.xid)
1715 else:
1716 q.text('None')
1717 q.text(","); q.breakable()
1718 q.text("l2_table_enable = ");
1719 q.text("%#x" % self.l2_table_enable)
1720 q.text(","); q.breakable()
1721 q.text("l2_table_priority = ");
1722 q.text("%#x" % self.l2_table_priority)
1723 q.breakable()
1724 q.text('}')
1725
Rich Lane7dcdf022013-12-11 14:45:27 -08001726bsn_header.subtypes[14] = bsn_get_l2_table_reply
1727
1728class bsn_get_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001729 version = 1
1730 type = 4
1731 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001732 subtype = 13
1733
1734 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001735 if xid != None:
1736 self.xid = xid
1737 else:
1738 self.xid = None
1739 return
Rich Lane90c961c2013-05-14 09:26:50 -07001740
1741 def pack(self):
1742 packed = []
1743 packed.append(struct.pack("!B", self.version))
1744 packed.append(struct.pack("!B", self.type))
1745 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1746 packed.append(struct.pack("!L", self.xid))
1747 packed.append(struct.pack("!L", self.experimenter))
1748 packed.append(struct.pack("!L", self.subtype))
1749 length = sum([len(x) for x in packed])
1750 packed[2] = struct.pack("!H", length)
1751 return ''.join(packed)
1752
1753 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001754 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001755 obj = bsn_get_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001756 _version = reader.read("!B")[0]
1757 assert(_version == 1)
1758 _type = reader.read("!B")[0]
1759 assert(_type == 4)
1760 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001761 orig_reader = reader
1762 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001763 obj.xid = reader.read("!L")[0]
1764 _experimenter = reader.read("!L")[0]
1765 assert(_experimenter == 6035143)
1766 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001767 assert(_subtype == 13)
1768 return obj
1769
1770 def __eq__(self, other):
1771 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001772 if self.xid != other.xid: return False
1773 return True
1774
Rich Lane90c961c2013-05-14 09:26:50 -07001775 def pretty_print(self, q):
1776 q.text("bsn_get_l2_table_request {")
1777 with q.group():
1778 with q.indent(2):
1779 q.breakable()
1780 q.text("xid = ");
1781 if self.xid != None:
1782 q.text("%#x" % self.xid)
1783 else:
1784 q.text('None')
1785 q.breakable()
1786 q.text('}')
1787
Rich Lane7dcdf022013-12-11 14:45:27 -08001788bsn_header.subtypes[13] = bsn_get_l2_table_request
1789
1790class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001791 version = 1
1792 type = 4
1793 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001794 subtype = 5
1795
Rich Lanec2ee4b82013-04-24 17:12:38 -07001796 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001797 if xid != None:
1798 self.xid = xid
1799 else:
1800 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001801 if report_mirror_ports != None:
1802 self.report_mirror_ports = report_mirror_ports
1803 else:
1804 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001805 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001806
1807 def pack(self):
1808 packed = []
1809 packed.append(struct.pack("!B", self.version))
1810 packed.append(struct.pack("!B", self.type))
1811 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1812 packed.append(struct.pack("!L", self.xid))
1813 packed.append(struct.pack("!L", self.experimenter))
1814 packed.append(struct.pack("!L", self.subtype))
1815 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001816 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001817 length = sum([len(x) for x in packed])
1818 packed[2] = struct.pack("!H", length)
1819 return ''.join(packed)
1820
1821 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001822 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001823 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001824 _version = reader.read("!B")[0]
1825 assert(_version == 1)
1826 _type = reader.read("!B")[0]
1827 assert(_type == 4)
1828 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001829 orig_reader = reader
1830 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001831 obj.xid = reader.read("!L")[0]
1832 _experimenter = reader.read("!L")[0]
1833 assert(_experimenter == 6035143)
1834 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001835 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001836 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001837 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001838 return obj
1839
1840 def __eq__(self, other):
1841 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001842 if self.xid != other.xid: return False
1843 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001844 return True
1845
Rich Laneb658ddd2013-03-12 10:15:10 -07001846 def pretty_print(self, q):
1847 q.text("bsn_get_mirroring_reply {")
1848 with q.group():
1849 with q.indent(2):
1850 q.breakable()
1851 q.text("xid = ");
1852 if self.xid != None:
1853 q.text("%#x" % self.xid)
1854 else:
1855 q.text('None')
1856 q.text(","); q.breakable()
1857 q.text("report_mirror_ports = ");
1858 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001859 q.breakable()
1860 q.text('}')
1861
Rich Lane7dcdf022013-12-11 14:45:27 -08001862bsn_header.subtypes[5] = bsn_get_mirroring_reply
1863
1864class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001865 version = 1
1866 type = 4
1867 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001868 subtype = 4
1869
Rich Lanec2ee4b82013-04-24 17:12:38 -07001870 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001871 if xid != None:
1872 self.xid = xid
1873 else:
1874 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001875 if report_mirror_ports != None:
1876 self.report_mirror_ports = report_mirror_ports
1877 else:
1878 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001879 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001880
1881 def pack(self):
1882 packed = []
1883 packed.append(struct.pack("!B", self.version))
1884 packed.append(struct.pack("!B", self.type))
1885 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1886 packed.append(struct.pack("!L", self.xid))
1887 packed.append(struct.pack("!L", self.experimenter))
1888 packed.append(struct.pack("!L", self.subtype))
1889 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001890 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001891 length = sum([len(x) for x in packed])
1892 packed[2] = struct.pack("!H", length)
1893 return ''.join(packed)
1894
1895 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001896 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001897 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001898 _version = reader.read("!B")[0]
1899 assert(_version == 1)
1900 _type = reader.read("!B")[0]
1901 assert(_type == 4)
1902 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001903 orig_reader = reader
1904 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001905 obj.xid = reader.read("!L")[0]
1906 _experimenter = reader.read("!L")[0]
1907 assert(_experimenter == 6035143)
1908 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001909 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001910 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001911 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001912 return obj
1913
1914 def __eq__(self, other):
1915 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001916 if self.xid != other.xid: return False
1917 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001918 return True
1919
Rich Laneb658ddd2013-03-12 10:15:10 -07001920 def pretty_print(self, q):
1921 q.text("bsn_get_mirroring_request {")
1922 with q.group():
1923 with q.indent(2):
1924 q.breakable()
1925 q.text("xid = ");
1926 if self.xid != None:
1927 q.text("%#x" % self.xid)
1928 else:
1929 q.text('None')
1930 q.text(","); q.breakable()
1931 q.text("report_mirror_ports = ");
1932 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001933 q.breakable()
1934 q.text('}')
1935
Rich Lane7dcdf022013-12-11 14:45:27 -08001936bsn_header.subtypes[4] = bsn_get_mirroring_request
1937
1938class bsn_hybrid_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001939 version = 1
1940 type = 4
1941 experimenter = 6035143
1942 subtype = 28
1943
1944 def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001945 if xid != None:
1946 self.xid = xid
1947 else:
1948 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001949 if hybrid_enable != None:
1950 self.hybrid_enable = hybrid_enable
1951 else:
1952 self.hybrid_enable = 0
1953 if hybrid_version != None:
1954 self.hybrid_version = hybrid_version
1955 else:
1956 self.hybrid_version = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001957 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001958
1959 def pack(self):
1960 packed = []
1961 packed.append(struct.pack("!B", self.version))
1962 packed.append(struct.pack("!B", self.type))
1963 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1964 packed.append(struct.pack("!L", self.xid))
1965 packed.append(struct.pack("!L", self.experimenter))
1966 packed.append(struct.pack("!L", self.subtype))
1967 packed.append(struct.pack("!B", self.hybrid_enable))
1968 packed.append('\x00' * 1)
1969 packed.append(struct.pack("!H", self.hybrid_version))
1970 packed.append('\x00' * 4)
1971 length = sum([len(x) for x in packed])
1972 packed[2] = struct.pack("!H", length)
1973 return ''.join(packed)
1974
1975 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001976 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001977 obj = bsn_hybrid_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001978 _version = reader.read("!B")[0]
1979 assert(_version == 1)
1980 _type = reader.read("!B")[0]
1981 assert(_type == 4)
1982 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001983 orig_reader = reader
1984 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001985 obj.xid = reader.read("!L")[0]
1986 _experimenter = reader.read("!L")[0]
1987 assert(_experimenter == 6035143)
1988 _subtype = reader.read("!L")[0]
1989 assert(_subtype == 28)
1990 obj.hybrid_enable = reader.read("!B")[0]
1991 reader.skip(1)
1992 obj.hybrid_version = reader.read("!H")[0]
1993 reader.skip(4)
1994 return obj
1995
1996 def __eq__(self, other):
1997 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001998 if self.xid != other.xid: return False
1999 if self.hybrid_enable != other.hybrid_enable: return False
2000 if self.hybrid_version != other.hybrid_version: return False
2001 return True
2002
Rich Lane6f4978c2013-10-20 21:33:52 -07002003 def pretty_print(self, q):
2004 q.text("bsn_hybrid_get_reply {")
2005 with q.group():
2006 with q.indent(2):
2007 q.breakable()
2008 q.text("xid = ");
2009 if self.xid != None:
2010 q.text("%#x" % self.xid)
2011 else:
2012 q.text('None')
2013 q.text(","); q.breakable()
2014 q.text("hybrid_enable = ");
2015 q.text("%#x" % self.hybrid_enable)
2016 q.text(","); q.breakable()
2017 q.text("hybrid_version = ");
2018 q.text("%#x" % self.hybrid_version)
2019 q.breakable()
2020 q.text('}')
2021
Rich Lane7dcdf022013-12-11 14:45:27 -08002022bsn_header.subtypes[28] = bsn_hybrid_get_reply
2023
2024class bsn_hybrid_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002025 version = 1
2026 type = 4
2027 experimenter = 6035143
2028 subtype = 27
2029
2030 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002031 if xid != None:
2032 self.xid = xid
2033 else:
2034 self.xid = None
2035 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002036
2037 def pack(self):
2038 packed = []
2039 packed.append(struct.pack("!B", self.version))
2040 packed.append(struct.pack("!B", self.type))
2041 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2042 packed.append(struct.pack("!L", self.xid))
2043 packed.append(struct.pack("!L", self.experimenter))
2044 packed.append(struct.pack("!L", self.subtype))
2045 length = sum([len(x) for x in packed])
2046 packed[2] = struct.pack("!H", length)
2047 return ''.join(packed)
2048
2049 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002050 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002051 obj = bsn_hybrid_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002052 _version = reader.read("!B")[0]
2053 assert(_version == 1)
2054 _type = reader.read("!B")[0]
2055 assert(_type == 4)
2056 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002057 orig_reader = reader
2058 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002059 obj.xid = reader.read("!L")[0]
2060 _experimenter = reader.read("!L")[0]
2061 assert(_experimenter == 6035143)
2062 _subtype = reader.read("!L")[0]
2063 assert(_subtype == 27)
2064 return obj
2065
2066 def __eq__(self, other):
2067 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002068 if self.xid != other.xid: return False
2069 return True
2070
Rich Lane6f4978c2013-10-20 21:33:52 -07002071 def pretty_print(self, q):
2072 q.text("bsn_hybrid_get_request {")
2073 with q.group():
2074 with q.indent(2):
2075 q.breakable()
2076 q.text("xid = ");
2077 if self.xid != None:
2078 q.text("%#x" % self.xid)
2079 else:
2080 q.text('None')
2081 q.breakable()
2082 q.text('}')
2083
Rich Lane7dcdf022013-12-11 14:45:27 -08002084bsn_header.subtypes[27] = bsn_hybrid_get_request
2085
2086class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002087 version = 1
2088 type = 4
2089 experimenter = 6035143
2090 subtype = 34
2091
Rich Lane7b0f2012013-11-22 14:15:26 -08002092 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002093 if xid != None:
2094 self.xid = xid
2095 else:
2096 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002097 if status != None:
2098 self.status = status
2099 else:
2100 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002101 if port_no != None:
2102 self.port_no = port_no
2103 else:
2104 self.port_no = 0
2105 if slot_num != None:
2106 self.slot_num = slot_num
2107 else:
2108 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002109 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002110
2111 def pack(self):
2112 packed = []
2113 packed.append(struct.pack("!B", self.version))
2114 packed.append(struct.pack("!B", self.type))
2115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2116 packed.append(struct.pack("!L", self.xid))
2117 packed.append(struct.pack("!L", self.experimenter))
2118 packed.append(struct.pack("!L", self.subtype))
2119 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002120 packed.append(util.pack_port_no(self.port_no))
2121 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002122 length = sum([len(x) for x in packed])
2123 packed[2] = struct.pack("!H", length)
2124 return ''.join(packed)
2125
2126 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002127 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002128 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002129 _version = reader.read("!B")[0]
2130 assert(_version == 1)
2131 _type = reader.read("!B")[0]
2132 assert(_type == 4)
2133 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002134 orig_reader = reader
2135 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002136 obj.xid = reader.read("!L")[0]
2137 _experimenter = reader.read("!L")[0]
2138 assert(_experimenter == 6035143)
2139 _subtype = reader.read("!L")[0]
2140 assert(_subtype == 34)
2141 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002142 obj.port_no = util.unpack_port_no(reader)
2143 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002144 return obj
2145
2146 def __eq__(self, other):
2147 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002148 if self.xid != other.xid: return False
2149 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002150 if self.port_no != other.port_no: return False
2151 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002152 return True
2153
Rich Lane6f4978c2013-10-20 21:33:52 -07002154 def pretty_print(self, q):
2155 q.text("bsn_pdu_rx_reply {")
2156 with q.group():
2157 with q.indent(2):
2158 q.breakable()
2159 q.text("xid = ");
2160 if self.xid != None:
2161 q.text("%#x" % self.xid)
2162 else:
2163 q.text('None')
2164 q.text(","); q.breakable()
2165 q.text("status = ");
2166 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002167 q.text(","); q.breakable()
2168 q.text("port_no = ");
2169 q.text(util.pretty_port(self.port_no))
2170 q.text(","); q.breakable()
2171 q.text("slot_num = ");
2172 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002173 q.breakable()
2174 q.text('}')
2175
Rich Lane7dcdf022013-12-11 14:45:27 -08002176bsn_header.subtypes[34] = bsn_pdu_rx_reply
2177
2178class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002179 version = 1
2180 type = 4
2181 experimenter = 6035143
2182 subtype = 33
2183
2184 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002185 if xid != None:
2186 self.xid = xid
2187 else:
2188 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002189 if timeout_ms != None:
2190 self.timeout_ms = timeout_ms
2191 else:
2192 self.timeout_ms = 0
2193 if port_no != None:
2194 self.port_no = port_no
2195 else:
2196 self.port_no = 0
2197 if slot_num != None:
2198 self.slot_num = slot_num
2199 else:
2200 self.slot_num = 0
2201 if data != None:
2202 self.data = data
2203 else:
2204 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002205 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002206
2207 def pack(self):
2208 packed = []
2209 packed.append(struct.pack("!B", self.version))
2210 packed.append(struct.pack("!B", self.type))
2211 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2212 packed.append(struct.pack("!L", self.xid))
2213 packed.append(struct.pack("!L", self.experimenter))
2214 packed.append(struct.pack("!L", self.subtype))
2215 packed.append(struct.pack("!L", self.timeout_ms))
2216 packed.append(util.pack_port_no(self.port_no))
2217 packed.append(struct.pack("!B", self.slot_num))
2218 packed.append('\x00' * 3)
2219 packed.append(self.data)
2220 length = sum([len(x) for x in packed])
2221 packed[2] = struct.pack("!H", length)
2222 return ''.join(packed)
2223
2224 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002225 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002226 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002227 _version = reader.read("!B")[0]
2228 assert(_version == 1)
2229 _type = reader.read("!B")[0]
2230 assert(_type == 4)
2231 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002232 orig_reader = reader
2233 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002234 obj.xid = reader.read("!L")[0]
2235 _experimenter = reader.read("!L")[0]
2236 assert(_experimenter == 6035143)
2237 _subtype = reader.read("!L")[0]
2238 assert(_subtype == 33)
2239 obj.timeout_ms = reader.read("!L")[0]
2240 obj.port_no = util.unpack_port_no(reader)
2241 obj.slot_num = reader.read("!B")[0]
2242 reader.skip(3)
2243 obj.data = str(reader.read_all())
2244 return obj
2245
2246 def __eq__(self, other):
2247 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002248 if self.xid != other.xid: return False
2249 if self.timeout_ms != other.timeout_ms: return False
2250 if self.port_no != other.port_no: return False
2251 if self.slot_num != other.slot_num: return False
2252 if self.data != other.data: return False
2253 return True
2254
Rich Lane6f4978c2013-10-20 21:33:52 -07002255 def pretty_print(self, q):
2256 q.text("bsn_pdu_rx_request {")
2257 with q.group():
2258 with q.indent(2):
2259 q.breakable()
2260 q.text("xid = ");
2261 if self.xid != None:
2262 q.text("%#x" % self.xid)
2263 else:
2264 q.text('None')
2265 q.text(","); q.breakable()
2266 q.text("timeout_ms = ");
2267 q.text("%#x" % self.timeout_ms)
2268 q.text(","); q.breakable()
2269 q.text("port_no = ");
2270 q.text(util.pretty_port(self.port_no))
2271 q.text(","); q.breakable()
2272 q.text("slot_num = ");
2273 q.text("%#x" % self.slot_num)
2274 q.text(","); q.breakable()
2275 q.text("data = ");
2276 q.pp(self.data)
2277 q.breakable()
2278 q.text('}')
2279
Rich Lane7dcdf022013-12-11 14:45:27 -08002280bsn_header.subtypes[33] = bsn_pdu_rx_request
2281
2282class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002283 version = 1
2284 type = 4
2285 experimenter = 6035143
2286 subtype = 35
2287
2288 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002289 if xid != None:
2290 self.xid = xid
2291 else:
2292 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002293 if port_no != None:
2294 self.port_no = port_no
2295 else:
2296 self.port_no = 0
2297 if slot_num != None:
2298 self.slot_num = slot_num
2299 else:
2300 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002301 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002302
2303 def pack(self):
2304 packed = []
2305 packed.append(struct.pack("!B", self.version))
2306 packed.append(struct.pack("!B", self.type))
2307 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2308 packed.append(struct.pack("!L", self.xid))
2309 packed.append(struct.pack("!L", self.experimenter))
2310 packed.append(struct.pack("!L", self.subtype))
2311 packed.append(util.pack_port_no(self.port_no))
2312 packed.append(struct.pack("!B", self.slot_num))
2313 length = sum([len(x) for x in packed])
2314 packed[2] = struct.pack("!H", length)
2315 return ''.join(packed)
2316
2317 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002318 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002319 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002320 _version = reader.read("!B")[0]
2321 assert(_version == 1)
2322 _type = reader.read("!B")[0]
2323 assert(_type == 4)
2324 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002325 orig_reader = reader
2326 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002327 obj.xid = reader.read("!L")[0]
2328 _experimenter = reader.read("!L")[0]
2329 assert(_experimenter == 6035143)
2330 _subtype = reader.read("!L")[0]
2331 assert(_subtype == 35)
2332 obj.port_no = util.unpack_port_no(reader)
2333 obj.slot_num = reader.read("!B")[0]
2334 return obj
2335
2336 def __eq__(self, other):
2337 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002338 if self.xid != other.xid: return False
2339 if self.port_no != other.port_no: return False
2340 if self.slot_num != other.slot_num: return False
2341 return True
2342
Rich Lane6f4978c2013-10-20 21:33:52 -07002343 def pretty_print(self, q):
2344 q.text("bsn_pdu_rx_timeout {")
2345 with q.group():
2346 with q.indent(2):
2347 q.breakable()
2348 q.text("xid = ");
2349 if self.xid != None:
2350 q.text("%#x" % self.xid)
2351 else:
2352 q.text('None')
2353 q.text(","); q.breakable()
2354 q.text("port_no = ");
2355 q.text(util.pretty_port(self.port_no))
2356 q.text(","); q.breakable()
2357 q.text("slot_num = ");
2358 q.text("%#x" % self.slot_num)
2359 q.breakable()
2360 q.text('}')
2361
Rich Lane7dcdf022013-12-11 14:45:27 -08002362bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2363
2364class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002365 version = 1
2366 type = 4
2367 experimenter = 6035143
2368 subtype = 32
2369
Rich Lane7b0f2012013-11-22 14:15:26 -08002370 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002371 if xid != None:
2372 self.xid = xid
2373 else:
2374 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002375 if status != None:
2376 self.status = status
2377 else:
2378 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002379 if port_no != None:
2380 self.port_no = port_no
2381 else:
2382 self.port_no = 0
2383 if slot_num != None:
2384 self.slot_num = slot_num
2385 else:
2386 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002387 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002388
2389 def pack(self):
2390 packed = []
2391 packed.append(struct.pack("!B", self.version))
2392 packed.append(struct.pack("!B", self.type))
2393 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2394 packed.append(struct.pack("!L", self.xid))
2395 packed.append(struct.pack("!L", self.experimenter))
2396 packed.append(struct.pack("!L", self.subtype))
2397 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002398 packed.append(util.pack_port_no(self.port_no))
2399 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002400 length = sum([len(x) for x in packed])
2401 packed[2] = struct.pack("!H", length)
2402 return ''.join(packed)
2403
2404 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002405 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002406 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002407 _version = reader.read("!B")[0]
2408 assert(_version == 1)
2409 _type = reader.read("!B")[0]
2410 assert(_type == 4)
2411 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002412 orig_reader = reader
2413 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002414 obj.xid = reader.read("!L")[0]
2415 _experimenter = reader.read("!L")[0]
2416 assert(_experimenter == 6035143)
2417 _subtype = reader.read("!L")[0]
2418 assert(_subtype == 32)
2419 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002420 obj.port_no = util.unpack_port_no(reader)
2421 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002422 return obj
2423
2424 def __eq__(self, other):
2425 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002426 if self.xid != other.xid: return False
2427 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002428 if self.port_no != other.port_no: return False
2429 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002430 return True
2431
Rich Lane6f4978c2013-10-20 21:33:52 -07002432 def pretty_print(self, q):
2433 q.text("bsn_pdu_tx_reply {")
2434 with q.group():
2435 with q.indent(2):
2436 q.breakable()
2437 q.text("xid = ");
2438 if self.xid != None:
2439 q.text("%#x" % self.xid)
2440 else:
2441 q.text('None')
2442 q.text(","); q.breakable()
2443 q.text("status = ");
2444 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002445 q.text(","); q.breakable()
2446 q.text("port_no = ");
2447 q.text(util.pretty_port(self.port_no))
2448 q.text(","); q.breakable()
2449 q.text("slot_num = ");
2450 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002451 q.breakable()
2452 q.text('}')
2453
Rich Lane7dcdf022013-12-11 14:45:27 -08002454bsn_header.subtypes[32] = bsn_pdu_tx_reply
2455
2456class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002457 version = 1
2458 type = 4
2459 experimenter = 6035143
2460 subtype = 31
2461
2462 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002463 if xid != None:
2464 self.xid = xid
2465 else:
2466 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002467 if tx_interval_ms != None:
2468 self.tx_interval_ms = tx_interval_ms
2469 else:
2470 self.tx_interval_ms = 0
2471 if port_no != None:
2472 self.port_no = port_no
2473 else:
2474 self.port_no = 0
2475 if slot_num != None:
2476 self.slot_num = slot_num
2477 else:
2478 self.slot_num = 0
2479 if data != None:
2480 self.data = data
2481 else:
2482 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002483 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002484
2485 def pack(self):
2486 packed = []
2487 packed.append(struct.pack("!B", self.version))
2488 packed.append(struct.pack("!B", self.type))
2489 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2490 packed.append(struct.pack("!L", self.xid))
2491 packed.append(struct.pack("!L", self.experimenter))
2492 packed.append(struct.pack("!L", self.subtype))
2493 packed.append(struct.pack("!L", self.tx_interval_ms))
2494 packed.append(util.pack_port_no(self.port_no))
2495 packed.append(struct.pack("!B", self.slot_num))
2496 packed.append('\x00' * 3)
2497 packed.append(self.data)
2498 length = sum([len(x) for x in packed])
2499 packed[2] = struct.pack("!H", length)
2500 return ''.join(packed)
2501
2502 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002503 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002504 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002505 _version = reader.read("!B")[0]
2506 assert(_version == 1)
2507 _type = reader.read("!B")[0]
2508 assert(_type == 4)
2509 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002510 orig_reader = reader
2511 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002512 obj.xid = reader.read("!L")[0]
2513 _experimenter = reader.read("!L")[0]
2514 assert(_experimenter == 6035143)
2515 _subtype = reader.read("!L")[0]
2516 assert(_subtype == 31)
2517 obj.tx_interval_ms = reader.read("!L")[0]
2518 obj.port_no = util.unpack_port_no(reader)
2519 obj.slot_num = reader.read("!B")[0]
2520 reader.skip(3)
2521 obj.data = str(reader.read_all())
2522 return obj
2523
2524 def __eq__(self, other):
2525 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002526 if self.xid != other.xid: return False
2527 if self.tx_interval_ms != other.tx_interval_ms: return False
2528 if self.port_no != other.port_no: return False
2529 if self.slot_num != other.slot_num: return False
2530 if self.data != other.data: return False
2531 return True
2532
Rich Lane6f4978c2013-10-20 21:33:52 -07002533 def pretty_print(self, q):
2534 q.text("bsn_pdu_tx_request {")
2535 with q.group():
2536 with q.indent(2):
2537 q.breakable()
2538 q.text("xid = ");
2539 if self.xid != None:
2540 q.text("%#x" % self.xid)
2541 else:
2542 q.text('None')
2543 q.text(","); q.breakable()
2544 q.text("tx_interval_ms = ");
2545 q.text("%#x" % self.tx_interval_ms)
2546 q.text(","); q.breakable()
2547 q.text("port_no = ");
2548 q.text(util.pretty_port(self.port_no))
2549 q.text(","); q.breakable()
2550 q.text("slot_num = ");
2551 q.text("%#x" % self.slot_num)
2552 q.text(","); q.breakable()
2553 q.text("data = ");
2554 q.pp(self.data)
2555 q.breakable()
2556 q.text('}')
2557
Rich Lane7dcdf022013-12-11 14:45:27 -08002558bsn_header.subtypes[31] = bsn_pdu_tx_request
2559
2560class bsn_set_ip_mask(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002561 version = 1
2562 type = 4
2563 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002564 subtype = 0
2565
Rich Lanec2ee4b82013-04-24 17:12:38 -07002566 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002567 if xid != None:
2568 self.xid = xid
2569 else:
2570 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002571 if index != None:
2572 self.index = index
2573 else:
2574 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07002575 if mask != None:
2576 self.mask = mask
2577 else:
2578 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002579 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002580
2581 def pack(self):
2582 packed = []
2583 packed.append(struct.pack("!B", self.version))
2584 packed.append(struct.pack("!B", self.type))
2585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2586 packed.append(struct.pack("!L", self.xid))
2587 packed.append(struct.pack("!L", self.experimenter))
2588 packed.append(struct.pack("!L", self.subtype))
2589 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002590 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002591 packed.append(struct.pack("!L", self.mask))
2592 length = sum([len(x) for x in packed])
2593 packed[2] = struct.pack("!H", length)
2594 return ''.join(packed)
2595
2596 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002597 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002598 obj = bsn_set_ip_mask()
Dan Talaycof6202252013-07-02 01:00:29 -07002599 _version = reader.read("!B")[0]
2600 assert(_version == 1)
2601 _type = reader.read("!B")[0]
2602 assert(_type == 4)
2603 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002604 orig_reader = reader
2605 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002606 obj.xid = reader.read("!L")[0]
2607 _experimenter = reader.read("!L")[0]
2608 assert(_experimenter == 6035143)
2609 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002610 assert(_subtype == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07002611 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002612 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07002613 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002614 return obj
2615
2616 def __eq__(self, other):
2617 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002618 if self.xid != other.xid: return False
2619 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002620 if self.mask != other.mask: return False
2621 return True
2622
Rich Laneb658ddd2013-03-12 10:15:10 -07002623 def pretty_print(self, q):
2624 q.text("bsn_set_ip_mask {")
2625 with q.group():
2626 with q.indent(2):
2627 q.breakable()
2628 q.text("xid = ");
2629 if self.xid != None:
2630 q.text("%#x" % self.xid)
2631 else:
2632 q.text('None')
2633 q.text(","); q.breakable()
2634 q.text("index = ");
2635 q.text("%#x" % self.index)
2636 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07002637 q.text("mask = ");
2638 q.text("%#x" % self.mask)
2639 q.breakable()
2640 q.text('}')
2641
Rich Lane7dcdf022013-12-11 14:45:27 -08002642bsn_header.subtypes[0] = bsn_set_ip_mask
2643
2644class bsn_set_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002645 version = 1
2646 type = 4
2647 experimenter = 6035143
2648 subtype = 24
2649
2650 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002651 if xid != None:
2652 self.xid = xid
2653 else:
2654 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002655 if l2_table_enable != None:
2656 self.l2_table_enable = l2_table_enable
2657 else:
2658 self.l2_table_enable = 0
2659 if l2_table_priority != None:
2660 self.l2_table_priority = l2_table_priority
2661 else:
2662 self.l2_table_priority = 0
2663 if status != None:
2664 self.status = status
2665 else:
2666 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002667 return
Dan Talaycof6202252013-07-02 01:00:29 -07002668
2669 def pack(self):
2670 packed = []
2671 packed.append(struct.pack("!B", self.version))
2672 packed.append(struct.pack("!B", self.type))
2673 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2674 packed.append(struct.pack("!L", self.xid))
2675 packed.append(struct.pack("!L", self.experimenter))
2676 packed.append(struct.pack("!L", self.subtype))
2677 packed.append(struct.pack("!B", self.l2_table_enable))
2678 packed.append('\x00' * 1)
2679 packed.append(struct.pack("!H", self.l2_table_priority))
2680 packed.append(struct.pack("!L", self.status))
2681 length = sum([len(x) for x in packed])
2682 packed[2] = struct.pack("!H", length)
2683 return ''.join(packed)
2684
2685 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002686 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002687 obj = bsn_set_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002688 _version = reader.read("!B")[0]
2689 assert(_version == 1)
2690 _type = reader.read("!B")[0]
2691 assert(_type == 4)
2692 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002693 orig_reader = reader
2694 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002695 obj.xid = reader.read("!L")[0]
2696 _experimenter = reader.read("!L")[0]
2697 assert(_experimenter == 6035143)
2698 _subtype = reader.read("!L")[0]
2699 assert(_subtype == 24)
2700 obj.l2_table_enable = reader.read("!B")[0]
2701 reader.skip(1)
2702 obj.l2_table_priority = reader.read("!H")[0]
2703 obj.status = reader.read("!L")[0]
2704 return obj
2705
2706 def __eq__(self, other):
2707 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002708 if self.xid != other.xid: return False
2709 if self.l2_table_enable != other.l2_table_enable: return False
2710 if self.l2_table_priority != other.l2_table_priority: return False
2711 if self.status != other.status: return False
2712 return True
2713
Dan Talaycof6202252013-07-02 01:00:29 -07002714 def pretty_print(self, q):
2715 q.text("bsn_set_l2_table_reply {")
2716 with q.group():
2717 with q.indent(2):
2718 q.breakable()
2719 q.text("xid = ");
2720 if self.xid != None:
2721 q.text("%#x" % self.xid)
2722 else:
2723 q.text('None')
2724 q.text(","); q.breakable()
2725 q.text("l2_table_enable = ");
2726 q.text("%#x" % self.l2_table_enable)
2727 q.text(","); q.breakable()
2728 q.text("l2_table_priority = ");
2729 q.text("%#x" % self.l2_table_priority)
2730 q.text(","); q.breakable()
2731 q.text("status = ");
2732 q.text("%#x" % self.status)
2733 q.breakable()
2734 q.text('}')
2735
Rich Lane7dcdf022013-12-11 14:45:27 -08002736bsn_header.subtypes[24] = bsn_set_l2_table_reply
2737
2738class bsn_set_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002739 version = 1
2740 type = 4
2741 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07002742 subtype = 12
2743
2744 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002745 if xid != None:
2746 self.xid = xid
2747 else:
2748 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07002749 if l2_table_enable != None:
2750 self.l2_table_enable = l2_table_enable
2751 else:
2752 self.l2_table_enable = 0
2753 if l2_table_priority != None:
2754 self.l2_table_priority = l2_table_priority
2755 else:
2756 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002757 return
Rich Lane90c961c2013-05-14 09:26:50 -07002758
2759 def pack(self):
2760 packed = []
2761 packed.append(struct.pack("!B", self.version))
2762 packed.append(struct.pack("!B", self.type))
2763 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2764 packed.append(struct.pack("!L", self.xid))
2765 packed.append(struct.pack("!L", self.experimenter))
2766 packed.append(struct.pack("!L", self.subtype))
2767 packed.append(struct.pack("!B", self.l2_table_enable))
2768 packed.append('\x00' * 1)
2769 packed.append(struct.pack("!H", self.l2_table_priority))
2770 packed.append('\x00' * 4)
2771 length = sum([len(x) for x in packed])
2772 packed[2] = struct.pack("!H", length)
2773 return ''.join(packed)
2774
2775 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002776 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002777 obj = bsn_set_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002778 _version = reader.read("!B")[0]
2779 assert(_version == 1)
2780 _type = reader.read("!B")[0]
2781 assert(_type == 4)
2782 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002783 orig_reader = reader
2784 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002785 obj.xid = reader.read("!L")[0]
2786 _experimenter = reader.read("!L")[0]
2787 assert(_experimenter == 6035143)
2788 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002789 assert(_subtype == 12)
Dan Talaycof6202252013-07-02 01:00:29 -07002790 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002791 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002792 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002793 reader.skip(4)
2794 return obj
2795
2796 def __eq__(self, other):
2797 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07002798 if self.xid != other.xid: return False
2799 if self.l2_table_enable != other.l2_table_enable: return False
2800 if self.l2_table_priority != other.l2_table_priority: return False
2801 return True
2802
Rich Lane90c961c2013-05-14 09:26:50 -07002803 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002804 q.text("bsn_set_l2_table_request {")
Rich Lane90c961c2013-05-14 09:26:50 -07002805 with q.group():
2806 with q.indent(2):
2807 q.breakable()
2808 q.text("xid = ");
2809 if self.xid != None:
2810 q.text("%#x" % self.xid)
2811 else:
2812 q.text('None')
2813 q.text(","); q.breakable()
2814 q.text("l2_table_enable = ");
2815 q.text("%#x" % self.l2_table_enable)
2816 q.text(","); q.breakable()
2817 q.text("l2_table_priority = ");
2818 q.text("%#x" % self.l2_table_priority)
2819 q.breakable()
2820 q.text('}')
2821
Rich Lane7dcdf022013-12-11 14:45:27 -08002822bsn_header.subtypes[12] = bsn_set_l2_table_request
2823
2824class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002825 version = 1
2826 type = 4
2827 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002828 subtype = 3
2829
Rich Lanec2ee4b82013-04-24 17:12:38 -07002830 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002831 if xid != None:
2832 self.xid = xid
2833 else:
2834 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002835 if report_mirror_ports != None:
2836 self.report_mirror_ports = report_mirror_ports
2837 else:
2838 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002839 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002840
2841 def pack(self):
2842 packed = []
2843 packed.append(struct.pack("!B", self.version))
2844 packed.append(struct.pack("!B", self.type))
2845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2846 packed.append(struct.pack("!L", self.xid))
2847 packed.append(struct.pack("!L", self.experimenter))
2848 packed.append(struct.pack("!L", self.subtype))
2849 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002850 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002851 length = sum([len(x) for x in packed])
2852 packed[2] = struct.pack("!H", length)
2853 return ''.join(packed)
2854
2855 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002856 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002857 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002858 _version = reader.read("!B")[0]
2859 assert(_version == 1)
2860 _type = reader.read("!B")[0]
2861 assert(_type == 4)
2862 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002863 orig_reader = reader
2864 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002865 obj.xid = reader.read("!L")[0]
2866 _experimenter = reader.read("!L")[0]
2867 assert(_experimenter == 6035143)
2868 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002869 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002870 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002871 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002872 return obj
2873
2874 def __eq__(self, other):
2875 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002876 if self.xid != other.xid: return False
2877 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002878 return True
2879
Rich Laneb658ddd2013-03-12 10:15:10 -07002880 def pretty_print(self, q):
2881 q.text("bsn_set_mirroring {")
2882 with q.group():
2883 with q.indent(2):
2884 q.breakable()
2885 q.text("xid = ");
2886 if self.xid != None:
2887 q.text("%#x" % self.xid)
2888 else:
2889 q.text('None')
2890 q.text(","); q.breakable()
2891 q.text("report_mirror_ports = ");
2892 q.text("%#x" % self.report_mirror_ports)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002893 q.breakable()
2894 q.text('}')
2895
Rich Lane7dcdf022013-12-11 14:45:27 -08002896bsn_header.subtypes[3] = bsn_set_mirroring
2897
2898class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002899 version = 1
2900 type = 4
2901 experimenter = 6035143
2902 subtype = 25
2903
2904 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002905 if xid != None:
2906 self.xid = xid
2907 else:
2908 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002909 if status != None:
2910 self.status = status
2911 else:
2912 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002913 return
Dan Talaycof6202252013-07-02 01:00:29 -07002914
2915 def pack(self):
2916 packed = []
2917 packed.append(struct.pack("!B", self.version))
2918 packed.append(struct.pack("!B", self.type))
2919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2920 packed.append(struct.pack("!L", self.xid))
2921 packed.append(struct.pack("!L", self.experimenter))
2922 packed.append(struct.pack("!L", self.subtype))
2923 packed.append(struct.pack("!L", self.status))
2924 length = sum([len(x) for x in packed])
2925 packed[2] = struct.pack("!H", length)
2926 return ''.join(packed)
2927
2928 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002929 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002930 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002931 _version = reader.read("!B")[0]
2932 assert(_version == 1)
2933 _type = reader.read("!B")[0]
2934 assert(_type == 4)
2935 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002936 orig_reader = reader
2937 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002938 obj.xid = reader.read("!L")[0]
2939 _experimenter = reader.read("!L")[0]
2940 assert(_experimenter == 6035143)
2941 _subtype = reader.read("!L")[0]
2942 assert(_subtype == 25)
2943 obj.status = reader.read("!L")[0]
2944 return obj
2945
2946 def __eq__(self, other):
2947 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002948 if self.xid != other.xid: return False
2949 if self.status != other.status: return False
2950 return True
2951
Dan Talaycof6202252013-07-02 01:00:29 -07002952 def pretty_print(self, q):
2953 q.text("bsn_set_pktin_suppression_reply {")
2954 with q.group():
2955 with q.indent(2):
2956 q.breakable()
2957 q.text("xid = ");
2958 if self.xid != None:
2959 q.text("%#x" % self.xid)
2960 else:
2961 q.text('None')
2962 q.text(","); q.breakable()
2963 q.text("status = ");
2964 q.text("%#x" % self.status)
2965 q.breakable()
2966 q.text('}')
2967
Rich Lane7dcdf022013-12-11 14:45:27 -08002968bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2969
2970class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002971 version = 1
2972 type = 4
2973 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002974 subtype = 11
2975
2976 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002977 if xid != None:
2978 self.xid = xid
2979 else:
2980 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002981 if enabled != None:
2982 self.enabled = enabled
2983 else:
2984 self.enabled = 0
2985 if idle_timeout != None:
2986 self.idle_timeout = idle_timeout
2987 else:
2988 self.idle_timeout = 0
2989 if hard_timeout != None:
2990 self.hard_timeout = hard_timeout
2991 else:
2992 self.hard_timeout = 0
2993 if priority != None:
2994 self.priority = priority
2995 else:
2996 self.priority = 0
2997 if cookie != None:
2998 self.cookie = cookie
2999 else:
3000 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003001 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003002
3003 def pack(self):
3004 packed = []
3005 packed.append(struct.pack("!B", self.version))
3006 packed.append(struct.pack("!B", self.type))
3007 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3008 packed.append(struct.pack("!L", self.xid))
3009 packed.append(struct.pack("!L", self.experimenter))
3010 packed.append(struct.pack("!L", self.subtype))
3011 packed.append(struct.pack("!B", self.enabled))
3012 packed.append('\x00' * 1)
3013 packed.append(struct.pack("!H", self.idle_timeout))
3014 packed.append(struct.pack("!H", self.hard_timeout))
3015 packed.append(struct.pack("!H", self.priority))
3016 packed.append(struct.pack("!Q", self.cookie))
3017 length = sum([len(x) for x in packed])
3018 packed[2] = struct.pack("!H", length)
3019 return ''.join(packed)
3020
3021 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003022 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003023 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003024 _version = reader.read("!B")[0]
3025 assert(_version == 1)
3026 _type = reader.read("!B")[0]
3027 assert(_type == 4)
3028 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003029 orig_reader = reader
3030 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003031 obj.xid = reader.read("!L")[0]
3032 _experimenter = reader.read("!L")[0]
3033 assert(_experimenter == 6035143)
3034 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003035 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07003036 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003037 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07003038 obj.idle_timeout = reader.read("!H")[0]
3039 obj.hard_timeout = reader.read("!H")[0]
3040 obj.priority = reader.read("!H")[0]
3041 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003042 return obj
3043
3044 def __eq__(self, other):
3045 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003046 if self.xid != other.xid: return False
3047 if self.enabled != other.enabled: return False
3048 if self.idle_timeout != other.idle_timeout: return False
3049 if self.hard_timeout != other.hard_timeout: return False
3050 if self.priority != other.priority: return False
3051 if self.cookie != other.cookie: return False
3052 return True
3053
Rich Lanec2ee4b82013-04-24 17:12:38 -07003054 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07003055 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07003056 with q.group():
3057 with q.indent(2):
3058 q.breakable()
3059 q.text("xid = ");
3060 if self.xid != None:
3061 q.text("%#x" % self.xid)
3062 else:
3063 q.text('None')
Rich Laneb658ddd2013-03-12 10:15:10 -07003064 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003065 q.text("enabled = ");
3066 q.text("%#x" % self.enabled)
3067 q.text(","); q.breakable()
3068 q.text("idle_timeout = ");
3069 q.text("%#x" % self.idle_timeout)
3070 q.text(","); q.breakable()
3071 q.text("hard_timeout = ");
3072 q.text("%#x" % self.hard_timeout)
3073 q.text(","); q.breakable()
3074 q.text("priority = ");
3075 q.text("%#x" % self.priority)
3076 q.text(","); q.breakable()
3077 q.text("cookie = ");
3078 q.text("%#x" % self.cookie)
Rich Laneb658ddd2013-03-12 10:15:10 -07003079 q.breakable()
3080 q.text('}')
3081
Rich Lane7dcdf022013-12-11 14:45:27 -08003082bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
3083
3084class bsn_shell_command(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003085 version = 1
3086 type = 4
3087 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003088 subtype = 6
3089
3090 def __init__(self, xid=None, service=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003091 if xid != None:
3092 self.xid = xid
3093 else:
3094 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003095 if service != None:
3096 self.service = service
3097 else:
3098 self.service = 0
3099 if data != None:
3100 self.data = data
3101 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003102 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003103 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003104
3105 def pack(self):
3106 packed = []
3107 packed.append(struct.pack("!B", self.version))
3108 packed.append(struct.pack("!B", self.type))
3109 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3110 packed.append(struct.pack("!L", self.xid))
3111 packed.append(struct.pack("!L", self.experimenter))
3112 packed.append(struct.pack("!L", self.subtype))
3113 packed.append(struct.pack("!L", self.service))
3114 packed.append(self.data)
3115 length = sum([len(x) for x in packed])
3116 packed[2] = struct.pack("!H", length)
3117 return ''.join(packed)
3118
3119 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003120 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003121 obj = bsn_shell_command()
Dan Talaycof6202252013-07-02 01:00:29 -07003122 _version = reader.read("!B")[0]
3123 assert(_version == 1)
3124 _type = reader.read("!B")[0]
3125 assert(_type == 4)
3126 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003127 orig_reader = reader
3128 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003129 obj.xid = reader.read("!L")[0]
3130 _experimenter = reader.read("!L")[0]
3131 assert(_experimenter == 6035143)
3132 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003133 assert(_subtype == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07003134 obj.service = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003135 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003136 return obj
3137
3138 def __eq__(self, other):
3139 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003140 if self.xid != other.xid: return False
3141 if self.service != other.service: return False
3142 if self.data != other.data: return False
3143 return True
3144
Rich Laneb658ddd2013-03-12 10:15:10 -07003145 def pretty_print(self, q):
3146 q.text("bsn_shell_command {")
3147 with q.group():
3148 with q.indent(2):
3149 q.breakable()
3150 q.text("xid = ");
3151 if self.xid != None:
3152 q.text("%#x" % self.xid)
3153 else:
3154 q.text('None')
3155 q.text(","); q.breakable()
3156 q.text("service = ");
3157 q.text("%#x" % self.service)
3158 q.text(","); q.breakable()
3159 q.text("data = ");
3160 q.pp(self.data)
3161 q.breakable()
3162 q.text('}')
3163
Rich Lane7dcdf022013-12-11 14:45:27 -08003164bsn_header.subtypes[6] = bsn_shell_command
3165
3166class bsn_shell_output(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003167 version = 1
3168 type = 4
3169 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003170 subtype = 7
3171
3172 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003173 if xid != None:
3174 self.xid = xid
3175 else:
3176 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003177 if data != None:
3178 self.data = data
3179 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003180 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003181 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003182
3183 def pack(self):
3184 packed = []
3185 packed.append(struct.pack("!B", self.version))
3186 packed.append(struct.pack("!B", self.type))
3187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3188 packed.append(struct.pack("!L", self.xid))
3189 packed.append(struct.pack("!L", self.experimenter))
3190 packed.append(struct.pack("!L", self.subtype))
3191 packed.append(self.data)
3192 length = sum([len(x) for x in packed])
3193 packed[2] = struct.pack("!H", length)
3194 return ''.join(packed)
3195
3196 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003197 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003198 obj = bsn_shell_output()
Dan Talaycof6202252013-07-02 01:00:29 -07003199 _version = reader.read("!B")[0]
3200 assert(_version == 1)
3201 _type = reader.read("!B")[0]
3202 assert(_type == 4)
3203 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003204 orig_reader = reader
3205 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003206 obj.xid = reader.read("!L")[0]
3207 _experimenter = reader.read("!L")[0]
3208 assert(_experimenter == 6035143)
3209 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003210 assert(_subtype == 7)
3211 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003212 return obj
3213
3214 def __eq__(self, other):
3215 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003216 if self.xid != other.xid: return False
3217 if self.data != other.data: return False
3218 return True
3219
Rich Laneb658ddd2013-03-12 10:15:10 -07003220 def pretty_print(self, q):
3221 q.text("bsn_shell_output {")
3222 with q.group():
3223 with q.indent(2):
3224 q.breakable()
3225 q.text("xid = ");
3226 if self.xid != None:
3227 q.text("%#x" % self.xid)
3228 else:
3229 q.text('None')
3230 q.text(","); q.breakable()
3231 q.text("data = ");
3232 q.pp(self.data)
3233 q.breakable()
3234 q.text('}')
3235
Rich Lane7dcdf022013-12-11 14:45:27 -08003236bsn_header.subtypes[7] = bsn_shell_output
3237
3238class bsn_shell_status(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003239 version = 1
3240 type = 4
3241 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003242 subtype = 8
3243
3244 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003245 if xid != None:
3246 self.xid = xid
3247 else:
3248 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003249 if status != None:
3250 self.status = status
3251 else:
3252 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003253 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003254
3255 def pack(self):
3256 packed = []
3257 packed.append(struct.pack("!B", self.version))
3258 packed.append(struct.pack("!B", self.type))
3259 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3260 packed.append(struct.pack("!L", self.xid))
3261 packed.append(struct.pack("!L", self.experimenter))
3262 packed.append(struct.pack("!L", self.subtype))
3263 packed.append(struct.pack("!L", self.status))
3264 length = sum([len(x) for x in packed])
3265 packed[2] = struct.pack("!H", length)
3266 return ''.join(packed)
3267
3268 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003269 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003270 obj = bsn_shell_status()
Dan Talaycof6202252013-07-02 01:00:29 -07003271 _version = reader.read("!B")[0]
3272 assert(_version == 1)
3273 _type = reader.read("!B")[0]
3274 assert(_type == 4)
3275 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003276 orig_reader = reader
3277 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003278 obj.xid = reader.read("!L")[0]
3279 _experimenter = reader.read("!L")[0]
3280 assert(_experimenter == 6035143)
3281 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003282 assert(_subtype == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07003283 obj.status = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003284 return obj
3285
3286 def __eq__(self, other):
3287 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003288 if self.xid != other.xid: return False
3289 if self.status != other.status: return False
3290 return True
3291
Rich Laneb658ddd2013-03-12 10:15:10 -07003292 def pretty_print(self, q):
3293 q.text("bsn_shell_status {")
3294 with q.group():
3295 with q.indent(2):
3296 q.breakable()
3297 q.text("xid = ");
3298 if self.xid != None:
3299 q.text("%#x" % self.xid)
3300 else:
3301 q.text('None')
3302 q.text(","); q.breakable()
3303 q.text("status = ");
3304 q.text("%#x" % self.status)
3305 q.breakable()
3306 q.text('}')
3307
Rich Lane7dcdf022013-12-11 14:45:27 -08003308bsn_header.subtypes[8] = bsn_shell_status
3309
3310class experimenter_stats_reply(stats_reply):
3311 subtypes = {}
3312
Rich Lane95f7fc92014-01-27 17:08:16 -08003313 version = 1
3314 type = 17
3315 stats_type = 65535
3316
3317 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3318 if xid != None:
3319 self.xid = xid
3320 else:
3321 self.xid = None
3322 if flags != None:
3323 self.flags = flags
3324 else:
3325 self.flags = 0
3326 if experimenter != None:
3327 self.experimenter = experimenter
3328 else:
3329 self.experimenter = 0
3330 if data != None:
3331 self.data = data
3332 else:
3333 self.data = ''
3334 return
3335
3336 def pack(self):
3337 packed = []
3338 packed.append(struct.pack("!B", self.version))
3339 packed.append(struct.pack("!B", self.type))
3340 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3341 packed.append(struct.pack("!L", self.xid))
3342 packed.append(struct.pack("!H", self.stats_type))
3343 packed.append(struct.pack("!H", self.flags))
3344 packed.append(struct.pack("!L", self.experimenter))
3345 packed.append(self.data)
3346 length = sum([len(x) for x in packed])
3347 packed[2] = struct.pack("!H", length)
3348 return ''.join(packed)
3349
Rich Lane7dcdf022013-12-11 14:45:27 -08003350 @staticmethod
3351 def unpack(reader):
3352 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003353 subclass = experimenter_stats_reply.subtypes.get(subtype)
3354 if subclass:
3355 return subclass.unpack(reader)
3356
3357 obj = experimenter_stats_reply()
3358 _version = reader.read("!B")[0]
3359 assert(_version == 1)
3360 _type = reader.read("!B")[0]
3361 assert(_type == 17)
3362 _length = reader.read("!H")[0]
3363 orig_reader = reader
3364 reader = orig_reader.slice(_length - (2 + 2))
3365 obj.xid = reader.read("!L")[0]
3366 _stats_type = reader.read("!H")[0]
3367 assert(_stats_type == 65535)
3368 obj.flags = reader.read("!H")[0]
3369 obj.experimenter = reader.read("!L")[0]
3370 obj.data = str(reader.read_all())
3371 return obj
3372
3373 def __eq__(self, other):
3374 if type(self) != type(other): return False
3375 if self.xid != other.xid: return False
3376 if self.flags != other.flags: return False
3377 if self.experimenter != other.experimenter: return False
3378 if self.data != other.data: return False
3379 return True
3380
3381 def pretty_print(self, q):
3382 q.text("experimenter_stats_reply {")
3383 with q.group():
3384 with q.indent(2):
3385 q.breakable()
3386 q.text("xid = ");
3387 if self.xid != None:
3388 q.text("%#x" % self.xid)
3389 else:
3390 q.text('None')
3391 q.text(","); q.breakable()
3392 q.text("flags = ");
3393 q.text("%#x" % self.flags)
3394 q.text(","); q.breakable()
3395 q.text("data = ");
3396 q.pp(self.data)
3397 q.breakable()
3398 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003399
3400stats_reply.subtypes[65535] = experimenter_stats_reply
3401
3402class bsn_stats_reply(experimenter_stats_reply):
3403 subtypes = {}
3404
Rich Lane95f7fc92014-01-27 17:08:16 -08003405 version = 1
3406 type = 19
3407 stats_type = 65535
3408 experimenter = 6035143
3409
3410 def __init__(self, xid=None, flags=None, subtype=None):
3411 if xid != None:
3412 self.xid = xid
3413 else:
3414 self.xid = None
3415 if flags != None:
3416 self.flags = flags
3417 else:
3418 self.flags = 0
3419 if subtype != None:
3420 self.subtype = subtype
3421 else:
3422 self.subtype = 0
3423 return
3424
3425 def pack(self):
3426 packed = []
3427 packed.append(struct.pack("!B", self.version))
3428 packed.append(struct.pack("!B", self.type))
3429 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3430 packed.append(struct.pack("!L", self.xid))
3431 packed.append(struct.pack("!H", self.stats_type))
3432 packed.append(struct.pack("!H", self.flags))
3433 packed.append('\x00' * 4)
3434 packed.append(struct.pack("!L", self.experimenter))
3435 packed.append(struct.pack("!L", self.subtype))
3436 length = sum([len(x) for x in packed])
3437 packed[2] = struct.pack("!H", length)
3438 return ''.join(packed)
3439
Rich Lane7dcdf022013-12-11 14:45:27 -08003440 @staticmethod
3441 def unpack(reader):
3442 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003443 subclass = bsn_stats_reply.subtypes.get(subtype)
3444 if subclass:
3445 return subclass.unpack(reader)
3446
3447 obj = bsn_stats_reply()
3448 _version = reader.read("!B")[0]
3449 assert(_version == 1)
3450 _type = reader.read("!B")[0]
3451 assert(_type == 19)
3452 _length = reader.read("!H")[0]
3453 orig_reader = reader
3454 reader = orig_reader.slice(_length - (2 + 2))
3455 obj.xid = reader.read("!L")[0]
3456 _stats_type = reader.read("!H")[0]
3457 assert(_stats_type == 65535)
3458 obj.flags = reader.read("!H")[0]
3459 reader.skip(4)
3460 _experimenter = reader.read("!L")[0]
3461 assert(_experimenter == 6035143)
3462 obj.subtype = reader.read("!L")[0]
3463 return obj
3464
3465 def __eq__(self, other):
3466 if type(self) != type(other): return False
3467 if self.xid != other.xid: return False
3468 if self.flags != other.flags: return False
3469 if self.subtype != other.subtype: return False
3470 return True
3471
3472 def pretty_print(self, q):
3473 q.text("bsn_stats_reply {")
3474 with q.group():
3475 with q.indent(2):
3476 q.breakable()
3477 q.text("xid = ");
3478 if self.xid != None:
3479 q.text("%#x" % self.xid)
3480 else:
3481 q.text('None')
3482 q.text(","); q.breakable()
3483 q.text("flags = ");
3484 q.text("%#x" % self.flags)
3485 q.breakable()
3486 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003487
3488experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
3489
3490class experimenter_stats_request(stats_request):
3491 subtypes = {}
3492
Rich Lane95f7fc92014-01-27 17:08:16 -08003493 version = 1
3494 type = 16
3495 stats_type = 65535
3496
3497 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3498 if xid != None:
3499 self.xid = xid
3500 else:
3501 self.xid = None
3502 if flags != None:
3503 self.flags = flags
3504 else:
3505 self.flags = 0
3506 if experimenter != None:
3507 self.experimenter = experimenter
3508 else:
3509 self.experimenter = 0
3510 if data != None:
3511 self.data = data
3512 else:
3513 self.data = ''
3514 return
3515
3516 def pack(self):
3517 packed = []
3518 packed.append(struct.pack("!B", self.version))
3519 packed.append(struct.pack("!B", self.type))
3520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3521 packed.append(struct.pack("!L", self.xid))
3522 packed.append(struct.pack("!H", self.stats_type))
3523 packed.append(struct.pack("!H", self.flags))
3524 packed.append(struct.pack("!L", self.experimenter))
3525 packed.append(self.data)
3526 length = sum([len(x) for x in packed])
3527 packed[2] = struct.pack("!H", length)
3528 return ''.join(packed)
3529
Rich Lane7dcdf022013-12-11 14:45:27 -08003530 @staticmethod
3531 def unpack(reader):
3532 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003533 subclass = experimenter_stats_request.subtypes.get(subtype)
3534 if subclass:
3535 return subclass.unpack(reader)
3536
3537 obj = experimenter_stats_request()
3538 _version = reader.read("!B")[0]
3539 assert(_version == 1)
3540 _type = reader.read("!B")[0]
3541 assert(_type == 16)
3542 _length = reader.read("!H")[0]
3543 orig_reader = reader
3544 reader = orig_reader.slice(_length - (2 + 2))
3545 obj.xid = reader.read("!L")[0]
3546 _stats_type = reader.read("!H")[0]
3547 assert(_stats_type == 65535)
3548 obj.flags = reader.read("!H")[0]
3549 obj.experimenter = reader.read("!L")[0]
3550 obj.data = str(reader.read_all())
3551 return obj
3552
3553 def __eq__(self, other):
3554 if type(self) != type(other): return False
3555 if self.xid != other.xid: return False
3556 if self.flags != other.flags: return False
3557 if self.experimenter != other.experimenter: return False
3558 if self.data != other.data: return False
3559 return True
3560
3561 def pretty_print(self, q):
3562 q.text("experimenter_stats_request {")
3563 with q.group():
3564 with q.indent(2):
3565 q.breakable()
3566 q.text("xid = ");
3567 if self.xid != None:
3568 q.text("%#x" % self.xid)
3569 else:
3570 q.text('None')
3571 q.text(","); q.breakable()
3572 q.text("flags = ");
3573 q.text("%#x" % self.flags)
3574 q.text(","); q.breakable()
3575 q.text("data = ");
3576 q.pp(self.data)
3577 q.breakable()
3578 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003579
3580stats_request.subtypes[65535] = experimenter_stats_request
3581
3582class bsn_stats_request(experimenter_stats_request):
3583 subtypes = {}
3584
Rich Lane95f7fc92014-01-27 17:08:16 -08003585 version = 1
3586 type = 18
3587 stats_type = 65535
3588 experimenter = 6035143
3589
3590 def __init__(self, xid=None, flags=None, subtype=None):
3591 if xid != None:
3592 self.xid = xid
3593 else:
3594 self.xid = None
3595 if flags != None:
3596 self.flags = flags
3597 else:
3598 self.flags = 0
3599 if subtype != None:
3600 self.subtype = subtype
3601 else:
3602 self.subtype = 0
3603 return
3604
3605 def pack(self):
3606 packed = []
3607 packed.append(struct.pack("!B", self.version))
3608 packed.append(struct.pack("!B", self.type))
3609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3610 packed.append(struct.pack("!L", self.xid))
3611 packed.append(struct.pack("!H", self.stats_type))
3612 packed.append(struct.pack("!H", self.flags))
3613 packed.append('\x00' * 4)
3614 packed.append(struct.pack("!L", self.experimenter))
3615 packed.append(struct.pack("!L", self.subtype))
3616 length = sum([len(x) for x in packed])
3617 packed[2] = struct.pack("!H", length)
3618 return ''.join(packed)
3619
Rich Lane7dcdf022013-12-11 14:45:27 -08003620 @staticmethod
3621 def unpack(reader):
3622 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003623 subclass = bsn_stats_request.subtypes.get(subtype)
3624 if subclass:
3625 return subclass.unpack(reader)
3626
3627 obj = bsn_stats_request()
3628 _version = reader.read("!B")[0]
3629 assert(_version == 1)
3630 _type = reader.read("!B")[0]
3631 assert(_type == 18)
3632 _length = reader.read("!H")[0]
3633 orig_reader = reader
3634 reader = orig_reader.slice(_length - (2 + 2))
3635 obj.xid = reader.read("!L")[0]
3636 _stats_type = reader.read("!H")[0]
3637 assert(_stats_type == 65535)
3638 obj.flags = reader.read("!H")[0]
3639 reader.skip(4)
3640 _experimenter = reader.read("!L")[0]
3641 assert(_experimenter == 6035143)
3642 obj.subtype = reader.read("!L")[0]
3643 return obj
3644
3645 def __eq__(self, other):
3646 if type(self) != type(other): return False
3647 if self.xid != other.xid: return False
3648 if self.flags != other.flags: return False
3649 if self.subtype != other.subtype: return False
3650 return True
3651
3652 def pretty_print(self, q):
3653 q.text("bsn_stats_request {")
3654 with q.group():
3655 with q.indent(2):
3656 q.breakable()
3657 q.text("xid = ");
3658 if self.xid != None:
3659 q.text("%#x" % self.xid)
3660 else:
3661 q.text('None')
3662 q.text(","); q.breakable()
3663 q.text("flags = ");
3664 q.text("%#x" % self.flags)
3665 q.breakable()
3666 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003667
3668experimenter_stats_request.subtypes[6035143] = bsn_stats_request
3669
3670class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003671 version = 1
3672 type = 4
3673 experimenter = 6035143
3674 subtype = 16
3675
3676 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003677 if xid != None:
3678 self.xid = xid
3679 else:
3680 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003681 if status != None:
3682 self.status = status
3683 else:
3684 self.status = 0
3685 if vport_no != None:
3686 self.vport_no = vport_no
3687 else:
3688 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003689 return
Dan Talaycof6202252013-07-02 01:00:29 -07003690
3691 def pack(self):
3692 packed = []
3693 packed.append(struct.pack("!B", self.version))
3694 packed.append(struct.pack("!B", self.type))
3695 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3696 packed.append(struct.pack("!L", self.xid))
3697 packed.append(struct.pack("!L", self.experimenter))
3698 packed.append(struct.pack("!L", self.subtype))
3699 packed.append(struct.pack("!L", self.status))
3700 packed.append(struct.pack("!L", self.vport_no))
3701 length = sum([len(x) for x in packed])
3702 packed[2] = struct.pack("!H", length)
3703 return ''.join(packed)
3704
3705 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003706 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003707 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003708 _version = reader.read("!B")[0]
3709 assert(_version == 1)
3710 _type = reader.read("!B")[0]
3711 assert(_type == 4)
3712 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003713 orig_reader = reader
3714 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003715 obj.xid = reader.read("!L")[0]
3716 _experimenter = reader.read("!L")[0]
3717 assert(_experimenter == 6035143)
3718 _subtype = reader.read("!L")[0]
3719 assert(_subtype == 16)
3720 obj.status = reader.read("!L")[0]
3721 obj.vport_no = reader.read("!L")[0]
3722 return obj
3723
3724 def __eq__(self, other):
3725 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003726 if self.xid != other.xid: return False
3727 if self.status != other.status: return False
3728 if self.vport_no != other.vport_no: return False
3729 return True
3730
Dan Talaycof6202252013-07-02 01:00:29 -07003731 def pretty_print(self, q):
3732 q.text("bsn_virtual_port_create_reply {")
3733 with q.group():
3734 with q.indent(2):
3735 q.breakable()
3736 q.text("xid = ");
3737 if self.xid != None:
3738 q.text("%#x" % self.xid)
3739 else:
3740 q.text('None')
3741 q.text(","); q.breakable()
3742 q.text("status = ");
3743 q.text("%#x" % self.status)
3744 q.text(","); q.breakable()
3745 q.text("vport_no = ");
3746 q.text("%#x" % self.vport_no)
3747 q.breakable()
3748 q.text('}')
3749
Rich Lane7dcdf022013-12-11 14:45:27 -08003750bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3751
3752class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003753 version = 1
3754 type = 4
3755 experimenter = 6035143
3756 subtype = 15
3757
3758 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003759 if xid != None:
3760 self.xid = xid
3761 else:
3762 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003763 if vport != None:
3764 self.vport = vport
3765 else:
Rich Lane93b33132014-04-21 12:20:58 -07003766 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003767 return
Dan Talaycof6202252013-07-02 01:00:29 -07003768
3769 def pack(self):
3770 packed = []
3771 packed.append(struct.pack("!B", self.version))
3772 packed.append(struct.pack("!B", self.type))
3773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3774 packed.append(struct.pack("!L", self.xid))
3775 packed.append(struct.pack("!L", self.experimenter))
3776 packed.append(struct.pack("!L", self.subtype))
3777 packed.append(self.vport.pack())
3778 length = sum([len(x) for x in packed])
3779 packed[2] = struct.pack("!H", length)
3780 return ''.join(packed)
3781
3782 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003783 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003784 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003785 _version = reader.read("!B")[0]
3786 assert(_version == 1)
3787 _type = reader.read("!B")[0]
3788 assert(_type == 4)
3789 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003790 orig_reader = reader
3791 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003792 obj.xid = reader.read("!L")[0]
3793 _experimenter = reader.read("!L")[0]
3794 assert(_experimenter == 6035143)
3795 _subtype = reader.read("!L")[0]
3796 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07003797 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003798 return obj
3799
3800 def __eq__(self, other):
3801 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003802 if self.xid != other.xid: return False
3803 if self.vport != other.vport: return False
3804 return True
3805
Dan Talaycof6202252013-07-02 01:00:29 -07003806 def pretty_print(self, q):
3807 q.text("bsn_virtual_port_create_request {")
3808 with q.group():
3809 with q.indent(2):
3810 q.breakable()
3811 q.text("xid = ");
3812 if self.xid != None:
3813 q.text("%#x" % self.xid)
3814 else:
3815 q.text('None')
3816 q.text(","); q.breakable()
3817 q.text("vport = ");
3818 q.pp(self.vport)
3819 q.breakable()
3820 q.text('}')
3821
Rich Lane7dcdf022013-12-11 14:45:27 -08003822bsn_header.subtypes[15] = bsn_virtual_port_create_request
3823
3824class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003825 version = 1
3826 type = 4
3827 experimenter = 6035143
3828 subtype = 26
3829
3830 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003831 if xid != None:
3832 self.xid = xid
3833 else:
3834 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003835 if status != None:
3836 self.status = status
3837 else:
3838 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003839 return
Dan Talaycof6202252013-07-02 01:00:29 -07003840
3841 def pack(self):
3842 packed = []
3843 packed.append(struct.pack("!B", self.version))
3844 packed.append(struct.pack("!B", self.type))
3845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3846 packed.append(struct.pack("!L", self.xid))
3847 packed.append(struct.pack("!L", self.experimenter))
3848 packed.append(struct.pack("!L", self.subtype))
3849 packed.append(struct.pack("!L", self.status))
3850 length = sum([len(x) for x in packed])
3851 packed[2] = struct.pack("!H", length)
3852 return ''.join(packed)
3853
3854 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003855 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003856 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003857 _version = reader.read("!B")[0]
3858 assert(_version == 1)
3859 _type = reader.read("!B")[0]
3860 assert(_type == 4)
3861 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003862 orig_reader = reader
3863 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003864 obj.xid = reader.read("!L")[0]
3865 _experimenter = reader.read("!L")[0]
3866 assert(_experimenter == 6035143)
3867 _subtype = reader.read("!L")[0]
3868 assert(_subtype == 26)
3869 obj.status = reader.read("!L")[0]
3870 return obj
3871
3872 def __eq__(self, other):
3873 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003874 if self.xid != other.xid: return False
3875 if self.status != other.status: return False
3876 return True
3877
Dan Talaycof6202252013-07-02 01:00:29 -07003878 def pretty_print(self, q):
3879 q.text("bsn_virtual_port_remove_reply {")
3880 with q.group():
3881 with q.indent(2):
3882 q.breakable()
3883 q.text("xid = ");
3884 if self.xid != None:
3885 q.text("%#x" % self.xid)
3886 else:
3887 q.text('None')
3888 q.text(","); q.breakable()
3889 q.text("status = ");
3890 q.text("%#x" % self.status)
3891 q.breakable()
3892 q.text('}')
3893
Rich Lane7dcdf022013-12-11 14:45:27 -08003894bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3895
3896class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003897 version = 1
3898 type = 4
3899 experimenter = 6035143
3900 subtype = 17
3901
3902 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003903 if xid != None:
3904 self.xid = xid
3905 else:
3906 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003907 if vport_no != None:
3908 self.vport_no = vport_no
3909 else:
3910 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003911 return
Dan Talaycof6202252013-07-02 01:00:29 -07003912
3913 def pack(self):
3914 packed = []
3915 packed.append(struct.pack("!B", self.version))
3916 packed.append(struct.pack("!B", self.type))
3917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3918 packed.append(struct.pack("!L", self.xid))
3919 packed.append(struct.pack("!L", self.experimenter))
3920 packed.append(struct.pack("!L", self.subtype))
3921 packed.append(struct.pack("!L", self.vport_no))
3922 length = sum([len(x) for x in packed])
3923 packed[2] = struct.pack("!H", length)
3924 return ''.join(packed)
3925
3926 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003927 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003928 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003929 _version = reader.read("!B")[0]
3930 assert(_version == 1)
3931 _type = reader.read("!B")[0]
3932 assert(_type == 4)
3933 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003934 orig_reader = reader
3935 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003936 obj.xid = reader.read("!L")[0]
3937 _experimenter = reader.read("!L")[0]
3938 assert(_experimenter == 6035143)
3939 _subtype = reader.read("!L")[0]
3940 assert(_subtype == 17)
3941 obj.vport_no = reader.read("!L")[0]
3942 return obj
3943
3944 def __eq__(self, other):
3945 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003946 if self.xid != other.xid: return False
3947 if self.vport_no != other.vport_no: return False
3948 return True
3949
Dan Talaycof6202252013-07-02 01:00:29 -07003950 def pretty_print(self, q):
3951 q.text("bsn_virtual_port_remove_request {")
3952 with q.group():
3953 with q.indent(2):
3954 q.breakable()
3955 q.text("xid = ");
3956 if self.xid != None:
3957 q.text("%#x" % self.xid)
3958 else:
3959 q.text('None')
3960 q.text(","); q.breakable()
3961 q.text("vport_no = ");
3962 q.text("%#x" % self.vport_no)
3963 q.breakable()
3964 q.text('}')
3965
Rich Lane7dcdf022013-12-11 14:45:27 -08003966bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3967
3968class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003969 version = 1
3970 type = 17
3971 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003972
3973 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 -08003974 if xid != None:
3975 self.xid = xid
3976 else:
3977 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003978 if flags != None:
3979 self.flags = flags
3980 else:
3981 self.flags = 0
3982 if mfr_desc != None:
3983 self.mfr_desc = mfr_desc
3984 else:
3985 self.mfr_desc = ""
3986 if hw_desc != None:
3987 self.hw_desc = hw_desc
3988 else:
3989 self.hw_desc = ""
3990 if sw_desc != None:
3991 self.sw_desc = sw_desc
3992 else:
3993 self.sw_desc = ""
3994 if serial_num != None:
3995 self.serial_num = serial_num
3996 else:
3997 self.serial_num = ""
3998 if dp_desc != None:
3999 self.dp_desc = dp_desc
4000 else:
4001 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08004002 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004003
4004 def pack(self):
4005 packed = []
4006 packed.append(struct.pack("!B", self.version))
4007 packed.append(struct.pack("!B", self.type))
4008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4009 packed.append(struct.pack("!L", self.xid))
4010 packed.append(struct.pack("!H", self.stats_type))
4011 packed.append(struct.pack("!H", self.flags))
4012 packed.append(struct.pack("!256s", self.mfr_desc))
4013 packed.append(struct.pack("!256s", self.hw_desc))
4014 packed.append(struct.pack("!256s", self.sw_desc))
4015 packed.append(struct.pack("!32s", self.serial_num))
4016 packed.append(struct.pack("!256s", self.dp_desc))
4017 length = sum([len(x) for x in packed])
4018 packed[2] = struct.pack("!H", length)
4019 return ''.join(packed)
4020
4021 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004022 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004023 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004024 _version = reader.read("!B")[0]
4025 assert(_version == 1)
4026 _type = reader.read("!B")[0]
4027 assert(_type == 17)
4028 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004029 orig_reader = reader
4030 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004031 obj.xid = reader.read("!L")[0]
4032 _stats_type = reader.read("!H")[0]
4033 assert(_stats_type == 0)
4034 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004035 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
4036 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
4037 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
4038 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
4039 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
Rich Laneb658ddd2013-03-12 10:15:10 -07004040 return obj
4041
4042 def __eq__(self, other):
4043 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004044 if self.xid != other.xid: return False
4045 if self.flags != other.flags: return False
4046 if self.mfr_desc != other.mfr_desc: return False
4047 if self.hw_desc != other.hw_desc: return False
4048 if self.sw_desc != other.sw_desc: return False
4049 if self.serial_num != other.serial_num: return False
4050 if self.dp_desc != other.dp_desc: return False
4051 return True
4052
Rich Laneb658ddd2013-03-12 10:15:10 -07004053 def pretty_print(self, q):
4054 q.text("desc_stats_reply {")
4055 with q.group():
4056 with q.indent(2):
4057 q.breakable()
4058 q.text("xid = ");
4059 if self.xid != None:
4060 q.text("%#x" % self.xid)
4061 else:
4062 q.text('None')
4063 q.text(","); q.breakable()
4064 q.text("flags = ");
4065 q.text("%#x" % self.flags)
4066 q.text(","); q.breakable()
4067 q.text("mfr_desc = ");
4068 q.pp(self.mfr_desc)
4069 q.text(","); q.breakable()
4070 q.text("hw_desc = ");
4071 q.pp(self.hw_desc)
4072 q.text(","); q.breakable()
4073 q.text("sw_desc = ");
4074 q.pp(self.sw_desc)
4075 q.text(","); q.breakable()
4076 q.text("serial_num = ");
4077 q.pp(self.serial_num)
4078 q.text(","); q.breakable()
4079 q.text("dp_desc = ");
4080 q.pp(self.dp_desc)
4081 q.breakable()
4082 q.text('}')
4083
Rich Lane7dcdf022013-12-11 14:45:27 -08004084stats_reply.subtypes[0] = desc_stats_reply
4085
4086class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004087 version = 1
4088 type = 16
4089 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004090
4091 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004092 if xid != None:
4093 self.xid = xid
4094 else:
4095 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004096 if flags != None:
4097 self.flags = flags
4098 else:
4099 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004100 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004101
4102 def pack(self):
4103 packed = []
4104 packed.append(struct.pack("!B", self.version))
4105 packed.append(struct.pack("!B", self.type))
4106 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4107 packed.append(struct.pack("!L", self.xid))
4108 packed.append(struct.pack("!H", self.stats_type))
4109 packed.append(struct.pack("!H", self.flags))
4110 length = sum([len(x) for x in packed])
4111 packed[2] = struct.pack("!H", length)
4112 return ''.join(packed)
4113
4114 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004115 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004116 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004117 _version = reader.read("!B")[0]
4118 assert(_version == 1)
4119 _type = reader.read("!B")[0]
4120 assert(_type == 16)
4121 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004122 orig_reader = reader
4123 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004124 obj.xid = reader.read("!L")[0]
4125 _stats_type = reader.read("!H")[0]
4126 assert(_stats_type == 0)
4127 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004128 return obj
4129
4130 def __eq__(self, other):
4131 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004132 if self.xid != other.xid: return False
4133 if self.flags != other.flags: return False
4134 return True
4135
Rich Laneb658ddd2013-03-12 10:15:10 -07004136 def pretty_print(self, q):
4137 q.text("desc_stats_request {")
4138 with q.group():
4139 with q.indent(2):
4140 q.breakable()
4141 q.text("xid = ");
4142 if self.xid != None:
4143 q.text("%#x" % self.xid)
4144 else:
4145 q.text('None')
4146 q.text(","); q.breakable()
4147 q.text("flags = ");
4148 q.text("%#x" % self.flags)
4149 q.breakable()
4150 q.text('}')
4151
Rich Lane7dcdf022013-12-11 14:45:27 -08004152stats_request.subtypes[0] = desc_stats_request
4153
4154class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004155 version = 1
4156 type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004157
4158 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004159 if xid != None:
4160 self.xid = xid
4161 else:
4162 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004163 if data != None:
4164 self.data = data
4165 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004166 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004167 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004168
4169 def pack(self):
4170 packed = []
4171 packed.append(struct.pack("!B", self.version))
4172 packed.append(struct.pack("!B", self.type))
4173 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4174 packed.append(struct.pack("!L", self.xid))
4175 packed.append(self.data)
4176 length = sum([len(x) for x in packed])
4177 packed[2] = struct.pack("!H", length)
4178 return ''.join(packed)
4179
4180 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004181 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004182 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004183 _version = reader.read("!B")[0]
4184 assert(_version == 1)
4185 _type = reader.read("!B")[0]
4186 assert(_type == 3)
4187 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004188 orig_reader = reader
4189 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004190 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004191 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004192 return obj
4193
4194 def __eq__(self, other):
4195 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004196 if self.xid != other.xid: return False
4197 if self.data != other.data: return False
4198 return True
4199
Rich Laneb658ddd2013-03-12 10:15:10 -07004200 def pretty_print(self, q):
4201 q.text("echo_reply {")
4202 with q.group():
4203 with q.indent(2):
4204 q.breakable()
4205 q.text("xid = ");
4206 if self.xid != None:
4207 q.text("%#x" % self.xid)
4208 else:
4209 q.text('None')
4210 q.text(","); q.breakable()
4211 q.text("data = ");
4212 q.pp(self.data)
4213 q.breakable()
4214 q.text('}')
4215
Rich Lane7dcdf022013-12-11 14:45:27 -08004216message.subtypes[3] = echo_reply
4217
4218class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004219 version = 1
4220 type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07004221
4222 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004223 if xid != None:
4224 self.xid = xid
4225 else:
4226 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004227 if data != None:
4228 self.data = data
4229 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004230 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004231 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004232
4233 def pack(self):
4234 packed = []
4235 packed.append(struct.pack("!B", self.version))
4236 packed.append(struct.pack("!B", self.type))
4237 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4238 packed.append(struct.pack("!L", self.xid))
4239 packed.append(self.data)
4240 length = sum([len(x) for x in packed])
4241 packed[2] = struct.pack("!H", length)
4242 return ''.join(packed)
4243
4244 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004245 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004246 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004247 _version = reader.read("!B")[0]
4248 assert(_version == 1)
4249 _type = reader.read("!B")[0]
4250 assert(_type == 2)
4251 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004252 orig_reader = reader
4253 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004254 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004255 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004256 return obj
4257
4258 def __eq__(self, other):
4259 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004260 if self.xid != other.xid: return False
4261 if self.data != other.data: return False
4262 return True
4263
Rich Laneb658ddd2013-03-12 10:15:10 -07004264 def pretty_print(self, q):
4265 q.text("echo_request {")
4266 with q.group():
4267 with q.indent(2):
4268 q.breakable()
4269 q.text("xid = ");
4270 if self.xid != None:
4271 q.text("%#x" % self.xid)
4272 else:
4273 q.text('None')
4274 q.text(","); q.breakable()
4275 q.text("data = ");
4276 q.pp(self.data)
4277 q.breakable()
4278 q.text('}')
4279
Rich Lane7dcdf022013-12-11 14:45:27 -08004280message.subtypes[2] = echo_request
4281
4282class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004283 version = 1
4284 type = 6
Rich Laneb658ddd2013-03-12 10:15:10 -07004285
Rich Lanec2ee4b82013-04-24 17:12:38 -07004286 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 -08004287 if xid != None:
4288 self.xid = xid
4289 else:
4290 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004291 if datapath_id != None:
4292 self.datapath_id = datapath_id
4293 else:
4294 self.datapath_id = 0
4295 if n_buffers != None:
4296 self.n_buffers = n_buffers
4297 else:
4298 self.n_buffers = 0
4299 if n_tables != None:
4300 self.n_tables = n_tables
4301 else:
4302 self.n_tables = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004303 if capabilities != None:
4304 self.capabilities = capabilities
4305 else:
4306 self.capabilities = 0
4307 if actions != None:
4308 self.actions = actions
4309 else:
4310 self.actions = 0
4311 if ports != None:
4312 self.ports = ports
4313 else:
4314 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004315 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004316
4317 def pack(self):
4318 packed = []
4319 packed.append(struct.pack("!B", self.version))
4320 packed.append(struct.pack("!B", self.type))
4321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4322 packed.append(struct.pack("!L", self.xid))
4323 packed.append(struct.pack("!Q", self.datapath_id))
4324 packed.append(struct.pack("!L", self.n_buffers))
4325 packed.append(struct.pack("!B", self.n_tables))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004326 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07004327 packed.append(struct.pack("!L", self.capabilities))
4328 packed.append(struct.pack("!L", self.actions))
Rich Lane7dcdf022013-12-11 14:45:27 -08004329 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Laneb658ddd2013-03-12 10:15:10 -07004330 length = sum([len(x) for x in packed])
4331 packed[2] = struct.pack("!H", length)
4332 return ''.join(packed)
4333
4334 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004335 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004336 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004337 _version = reader.read("!B")[0]
4338 assert(_version == 1)
4339 _type = reader.read("!B")[0]
4340 assert(_type == 6)
4341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004342 orig_reader = reader
4343 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004344 obj.xid = reader.read("!L")[0]
4345 obj.datapath_id = reader.read("!Q")[0]
4346 obj.n_buffers = reader.read("!L")[0]
4347 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004348 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07004349 obj.capabilities = reader.read("!L")[0]
4350 obj.actions = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004351 obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004352 return obj
4353
4354 def __eq__(self, other):
4355 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004356 if self.xid != other.xid: return False
4357 if self.datapath_id != other.datapath_id: return False
4358 if self.n_buffers != other.n_buffers: return False
4359 if self.n_tables != other.n_tables: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004360 if self.capabilities != other.capabilities: return False
4361 if self.actions != other.actions: return False
4362 if self.ports != other.ports: return False
4363 return True
4364
Rich Laneb658ddd2013-03-12 10:15:10 -07004365 def pretty_print(self, q):
4366 q.text("features_reply {")
4367 with q.group():
4368 with q.indent(2):
4369 q.breakable()
4370 q.text("xid = ");
4371 if self.xid != None:
4372 q.text("%#x" % self.xid)
4373 else:
4374 q.text('None')
4375 q.text(","); q.breakable()
4376 q.text("datapath_id = ");
4377 q.text("%#x" % self.datapath_id)
4378 q.text(","); q.breakable()
4379 q.text("n_buffers = ");
4380 q.text("%#x" % self.n_buffers)
4381 q.text(","); q.breakable()
4382 q.text("n_tables = ");
4383 q.text("%#x" % self.n_tables)
4384 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004385 q.text("capabilities = ");
4386 q.text("%#x" % self.capabilities)
4387 q.text(","); q.breakable()
4388 q.text("actions = ");
4389 q.text("%#x" % self.actions)
4390 q.text(","); q.breakable()
4391 q.text("ports = ");
4392 q.pp(self.ports)
4393 q.breakable()
4394 q.text('}')
4395
Rich Lane7dcdf022013-12-11 14:45:27 -08004396message.subtypes[6] = features_reply
4397
4398class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004399 version = 1
4400 type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07004401
4402 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004403 if xid != None:
4404 self.xid = xid
4405 else:
4406 self.xid = None
4407 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004408
4409 def pack(self):
4410 packed = []
4411 packed.append(struct.pack("!B", self.version))
4412 packed.append(struct.pack("!B", self.type))
4413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4414 packed.append(struct.pack("!L", self.xid))
4415 length = sum([len(x) for x in packed])
4416 packed[2] = struct.pack("!H", length)
4417 return ''.join(packed)
4418
4419 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004420 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004421 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004422 _version = reader.read("!B")[0]
4423 assert(_version == 1)
4424 _type = reader.read("!B")[0]
4425 assert(_type == 5)
4426 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004427 orig_reader = reader
4428 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004429 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004430 return obj
4431
4432 def __eq__(self, other):
4433 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004434 if self.xid != other.xid: return False
4435 return True
4436
Rich Laneb658ddd2013-03-12 10:15:10 -07004437 def pretty_print(self, q):
4438 q.text("features_request {")
4439 with q.group():
4440 with q.indent(2):
4441 q.breakable()
4442 q.text("xid = ");
4443 if self.xid != None:
4444 q.text("%#x" % self.xid)
4445 else:
4446 q.text('None')
4447 q.breakable()
4448 q.text('}')
4449
Rich Lane7dcdf022013-12-11 14:45:27 -08004450message.subtypes[5] = features_request
4451
4452class flow_mod(message):
4453 subtypes = {}
4454
Rich Lane95f7fc92014-01-27 17:08:16 -08004455 version = 1
4456 type = 14
4457
4458 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):
4459 if xid != None:
4460 self.xid = xid
4461 else:
4462 self.xid = None
4463 if match != None:
4464 self.match = match
4465 else:
4466 self.match = common.match()
4467 if cookie != None:
4468 self.cookie = cookie
4469 else:
4470 self.cookie = 0
4471 if _command != None:
4472 self._command = _command
4473 else:
4474 self._command = 0
4475 if idle_timeout != None:
4476 self.idle_timeout = idle_timeout
4477 else:
4478 self.idle_timeout = 0
4479 if hard_timeout != None:
4480 self.hard_timeout = hard_timeout
4481 else:
4482 self.hard_timeout = 0
4483 if priority != None:
4484 self.priority = priority
4485 else:
4486 self.priority = 0
4487 if buffer_id != None:
4488 self.buffer_id = buffer_id
4489 else:
4490 self.buffer_id = 0
4491 if out_port != None:
4492 self.out_port = out_port
4493 else:
4494 self.out_port = 0
4495 if flags != None:
4496 self.flags = flags
4497 else:
4498 self.flags = 0
4499 if actions != None:
4500 self.actions = actions
4501 else:
4502 self.actions = []
4503 return
4504
4505 def pack(self):
4506 packed = []
4507 packed.append(struct.pack("!B", self.version))
4508 packed.append(struct.pack("!B", self.type))
4509 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4510 packed.append(struct.pack("!L", self.xid))
4511 packed.append(self.match.pack())
4512 packed.append(struct.pack("!Q", self.cookie))
4513 packed.append(util.pack_fm_cmd(self._command))
4514 packed.append(struct.pack("!H", self.idle_timeout))
4515 packed.append(struct.pack("!H", self.hard_timeout))
4516 packed.append(struct.pack("!H", self.priority))
4517 packed.append(struct.pack("!L", self.buffer_id))
4518 packed.append(util.pack_port_no(self.out_port))
4519 packed.append(struct.pack("!H", self.flags))
4520 packed.append(loxi.generic_util.pack_list(self.actions))
4521 length = sum([len(x) for x in packed])
4522 packed[2] = struct.pack("!H", length)
4523 return ''.join(packed)
4524
Rich Lane7dcdf022013-12-11 14:45:27 -08004525 @staticmethod
4526 def unpack(reader):
4527 subtype, = reader.peek('!H', 56)
Rich Lane95f7fc92014-01-27 17:08:16 -08004528 subclass = flow_mod.subtypes.get(subtype)
4529 if subclass:
4530 return subclass.unpack(reader)
4531
4532 obj = flow_mod()
4533 _version = reader.read("!B")[0]
4534 assert(_version == 1)
4535 _type = reader.read("!B")[0]
4536 assert(_type == 14)
4537 _length = reader.read("!H")[0]
4538 orig_reader = reader
4539 reader = orig_reader.slice(_length - (2 + 2))
4540 obj.xid = reader.read("!L")[0]
4541 obj.match = common.match.unpack(reader)
4542 obj.cookie = reader.read("!Q")[0]
4543 obj._command = util.unpack_fm_cmd(reader)
4544 obj.idle_timeout = reader.read("!H")[0]
4545 obj.hard_timeout = reader.read("!H")[0]
4546 obj.priority = reader.read("!H")[0]
4547 obj.buffer_id = reader.read("!L")[0]
4548 obj.out_port = util.unpack_port_no(reader)
4549 obj.flags = reader.read("!H")[0]
4550 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
4551 return obj
4552
4553 def __eq__(self, other):
4554 if type(self) != type(other): return False
4555 if self.xid != other.xid: return False
4556 if self.match != other.match: return False
4557 if self.cookie != other.cookie: return False
4558 if self._command != other._command: return False
4559 if self.idle_timeout != other.idle_timeout: return False
4560 if self.hard_timeout != other.hard_timeout: return False
4561 if self.priority != other.priority: return False
4562 if self.buffer_id != other.buffer_id: return False
4563 if self.out_port != other.out_port: return False
4564 if self.flags != other.flags: return False
4565 if self.actions != other.actions: return False
4566 return True
4567
4568 def pretty_print(self, q):
4569 q.text("flow_mod {")
4570 with q.group():
4571 with q.indent(2):
4572 q.breakable()
4573 q.text("xid = ");
4574 if self.xid != None:
4575 q.text("%#x" % self.xid)
4576 else:
4577 q.text('None')
4578 q.text(","); q.breakable()
4579 q.text("match = ");
4580 q.pp(self.match)
4581 q.text(","); q.breakable()
4582 q.text("cookie = ");
4583 q.text("%#x" % self.cookie)
4584 q.text(","); q.breakable()
4585 q.text("idle_timeout = ");
4586 q.text("%#x" % self.idle_timeout)
4587 q.text(","); q.breakable()
4588 q.text("hard_timeout = ");
4589 q.text("%#x" % self.hard_timeout)
4590 q.text(","); q.breakable()
4591 q.text("priority = ");
4592 q.text("%#x" % self.priority)
4593 q.text(","); q.breakable()
4594 q.text("buffer_id = ");
4595 q.text("%#x" % self.buffer_id)
4596 q.text(","); q.breakable()
4597 q.text("out_port = ");
4598 q.text(util.pretty_port(self.out_port))
4599 q.text(","); q.breakable()
4600 q.text("flags = ");
4601 q.text("%#x" % self.flags)
4602 q.text(","); q.breakable()
4603 q.text("actions = ");
4604 q.pp(self.actions)
4605 q.breakable()
4606 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08004607
4608message.subtypes[14] = flow_mod
4609
4610class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004611 version = 1
4612 type = 14
4613 _command = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004614
4615 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 -08004616 if xid != None:
4617 self.xid = xid
4618 else:
4619 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004620 if match != None:
4621 self.match = match
4622 else:
4623 self.match = common.match()
4624 if cookie != None:
4625 self.cookie = cookie
4626 else:
4627 self.cookie = 0
4628 if idle_timeout != None:
4629 self.idle_timeout = idle_timeout
4630 else:
4631 self.idle_timeout = 0
4632 if hard_timeout != None:
4633 self.hard_timeout = hard_timeout
4634 else:
4635 self.hard_timeout = 0
4636 if priority != None:
4637 self.priority = priority
4638 else:
4639 self.priority = 0
4640 if buffer_id != None:
4641 self.buffer_id = buffer_id
4642 else:
4643 self.buffer_id = 0
4644 if out_port != None:
4645 self.out_port = out_port
4646 else:
4647 self.out_port = 0
4648 if flags != None:
4649 self.flags = flags
4650 else:
4651 self.flags = 0
4652 if actions != None:
4653 self.actions = actions
4654 else:
4655 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004656 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004657
4658 def pack(self):
4659 packed = []
4660 packed.append(struct.pack("!B", self.version))
4661 packed.append(struct.pack("!B", self.type))
4662 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4663 packed.append(struct.pack("!L", self.xid))
4664 packed.append(self.match.pack())
4665 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004666 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004667 packed.append(struct.pack("!H", self.idle_timeout))
4668 packed.append(struct.pack("!H", self.hard_timeout))
4669 packed.append(struct.pack("!H", self.priority))
4670 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004671 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004672 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004673 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004674 length = sum([len(x) for x in packed])
4675 packed[2] = struct.pack("!H", length)
4676 return ''.join(packed)
4677
4678 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004679 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004680 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07004681 _version = reader.read("!B")[0]
4682 assert(_version == 1)
4683 _type = reader.read("!B")[0]
4684 assert(_type == 14)
4685 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004686 orig_reader = reader
4687 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004688 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004689 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004690 obj.cookie = reader.read("!Q")[0]
4691 __command = util.unpack_fm_cmd(reader)
4692 assert(__command == 0)
4693 obj.idle_timeout = reader.read("!H")[0]
4694 obj.hard_timeout = reader.read("!H")[0]
4695 obj.priority = reader.read("!H")[0]
4696 obj.buffer_id = reader.read("!L")[0]
4697 obj.out_port = util.unpack_port_no(reader)
4698 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004699 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004700 return obj
4701
4702 def __eq__(self, other):
4703 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004704 if self.xid != other.xid: return False
4705 if self.match != other.match: return False
4706 if self.cookie != other.cookie: return False
4707 if self.idle_timeout != other.idle_timeout: return False
4708 if self.hard_timeout != other.hard_timeout: return False
4709 if self.priority != other.priority: return False
4710 if self.buffer_id != other.buffer_id: return False
4711 if self.out_port != other.out_port: return False
4712 if self.flags != other.flags: return False
4713 if self.actions != other.actions: return False
4714 return True
4715
Rich Laneb658ddd2013-03-12 10:15:10 -07004716 def pretty_print(self, q):
4717 q.text("flow_add {")
4718 with q.group():
4719 with q.indent(2):
4720 q.breakable()
4721 q.text("xid = ");
4722 if self.xid != None:
4723 q.text("%#x" % self.xid)
4724 else:
4725 q.text('None')
4726 q.text(","); q.breakable()
4727 q.text("match = ");
4728 q.pp(self.match)
4729 q.text(","); q.breakable()
4730 q.text("cookie = ");
4731 q.text("%#x" % self.cookie)
4732 q.text(","); q.breakable()
4733 q.text("idle_timeout = ");
4734 q.text("%#x" % self.idle_timeout)
4735 q.text(","); q.breakable()
4736 q.text("hard_timeout = ");
4737 q.text("%#x" % self.hard_timeout)
4738 q.text(","); q.breakable()
4739 q.text("priority = ");
4740 q.text("%#x" % self.priority)
4741 q.text(","); q.breakable()
4742 q.text("buffer_id = ");
4743 q.text("%#x" % self.buffer_id)
4744 q.text(","); q.breakable()
4745 q.text("out_port = ");
4746 q.text(util.pretty_port(self.out_port))
4747 q.text(","); q.breakable()
4748 q.text("flags = ");
4749 q.text("%#x" % self.flags)
4750 q.text(","); q.breakable()
4751 q.text("actions = ");
4752 q.pp(self.actions)
4753 q.breakable()
4754 q.text('}')
4755
Rich Lane7dcdf022013-12-11 14:45:27 -08004756flow_mod.subtypes[0] = flow_add
4757
4758class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004759 version = 1
4760 type = 14
4761 _command = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004762
4763 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 -08004764 if xid != None:
4765 self.xid = xid
4766 else:
4767 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004768 if match != None:
4769 self.match = match
4770 else:
4771 self.match = common.match()
4772 if cookie != None:
4773 self.cookie = cookie
4774 else:
4775 self.cookie = 0
4776 if idle_timeout != None:
4777 self.idle_timeout = idle_timeout
4778 else:
4779 self.idle_timeout = 0
4780 if hard_timeout != None:
4781 self.hard_timeout = hard_timeout
4782 else:
4783 self.hard_timeout = 0
4784 if priority != None:
4785 self.priority = priority
4786 else:
4787 self.priority = 0
4788 if buffer_id != None:
4789 self.buffer_id = buffer_id
4790 else:
4791 self.buffer_id = 0
4792 if out_port != None:
4793 self.out_port = out_port
4794 else:
4795 self.out_port = 0
4796 if flags != None:
4797 self.flags = flags
4798 else:
4799 self.flags = 0
4800 if actions != None:
4801 self.actions = actions
4802 else:
4803 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004804 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004805
4806 def pack(self):
4807 packed = []
4808 packed.append(struct.pack("!B", self.version))
4809 packed.append(struct.pack("!B", self.type))
4810 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4811 packed.append(struct.pack("!L", self.xid))
4812 packed.append(self.match.pack())
4813 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004814 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004815 packed.append(struct.pack("!H", self.idle_timeout))
4816 packed.append(struct.pack("!H", self.hard_timeout))
4817 packed.append(struct.pack("!H", self.priority))
4818 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004819 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004820 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004821 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004822 length = sum([len(x) for x in packed])
4823 packed[2] = struct.pack("!H", length)
4824 return ''.join(packed)
4825
4826 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004827 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004828 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004829 _version = reader.read("!B")[0]
4830 assert(_version == 1)
4831 _type = reader.read("!B")[0]
4832 assert(_type == 14)
4833 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004834 orig_reader = reader
4835 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004836 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004837 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004838 obj.cookie = reader.read("!Q")[0]
4839 __command = util.unpack_fm_cmd(reader)
4840 assert(__command == 3)
4841 obj.idle_timeout = reader.read("!H")[0]
4842 obj.hard_timeout = reader.read("!H")[0]
4843 obj.priority = reader.read("!H")[0]
4844 obj.buffer_id = reader.read("!L")[0]
4845 obj.out_port = util.unpack_port_no(reader)
4846 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004847 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004848 return obj
4849
4850 def __eq__(self, other):
4851 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004852 if self.xid != other.xid: return False
4853 if self.match != other.match: return False
4854 if self.cookie != other.cookie: return False
4855 if self.idle_timeout != other.idle_timeout: return False
4856 if self.hard_timeout != other.hard_timeout: return False
4857 if self.priority != other.priority: return False
4858 if self.buffer_id != other.buffer_id: return False
4859 if self.out_port != other.out_port: return False
4860 if self.flags != other.flags: return False
4861 if self.actions != other.actions: return False
4862 return True
4863
Rich Laneb658ddd2013-03-12 10:15:10 -07004864 def pretty_print(self, q):
4865 q.text("flow_delete {")
4866 with q.group():
4867 with q.indent(2):
4868 q.breakable()
4869 q.text("xid = ");
4870 if self.xid != None:
4871 q.text("%#x" % self.xid)
4872 else:
4873 q.text('None')
4874 q.text(","); q.breakable()
4875 q.text("match = ");
4876 q.pp(self.match)
4877 q.text(","); q.breakable()
4878 q.text("cookie = ");
4879 q.text("%#x" % self.cookie)
4880 q.text(","); q.breakable()
4881 q.text("idle_timeout = ");
4882 q.text("%#x" % self.idle_timeout)
4883 q.text(","); q.breakable()
4884 q.text("hard_timeout = ");
4885 q.text("%#x" % self.hard_timeout)
4886 q.text(","); q.breakable()
4887 q.text("priority = ");
4888 q.text("%#x" % self.priority)
4889 q.text(","); q.breakable()
4890 q.text("buffer_id = ");
4891 q.text("%#x" % self.buffer_id)
4892 q.text(","); q.breakable()
4893 q.text("out_port = ");
4894 q.text(util.pretty_port(self.out_port))
4895 q.text(","); q.breakable()
4896 q.text("flags = ");
4897 q.text("%#x" % self.flags)
4898 q.text(","); q.breakable()
4899 q.text("actions = ");
4900 q.pp(self.actions)
4901 q.breakable()
4902 q.text('}')
4903
Rich Lane7dcdf022013-12-11 14:45:27 -08004904flow_mod.subtypes[3] = flow_delete
4905
4906class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004907 version = 1
4908 type = 14
4909 _command = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07004910
4911 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 -08004912 if xid != None:
4913 self.xid = xid
4914 else:
4915 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004916 if match != None:
4917 self.match = match
4918 else:
4919 self.match = common.match()
4920 if cookie != None:
4921 self.cookie = cookie
4922 else:
4923 self.cookie = 0
4924 if idle_timeout != None:
4925 self.idle_timeout = idle_timeout
4926 else:
4927 self.idle_timeout = 0
4928 if hard_timeout != None:
4929 self.hard_timeout = hard_timeout
4930 else:
4931 self.hard_timeout = 0
4932 if priority != None:
4933 self.priority = priority
4934 else:
4935 self.priority = 0
4936 if buffer_id != None:
4937 self.buffer_id = buffer_id
4938 else:
4939 self.buffer_id = 0
4940 if out_port != None:
4941 self.out_port = out_port
4942 else:
4943 self.out_port = 0
4944 if flags != None:
4945 self.flags = flags
4946 else:
4947 self.flags = 0
4948 if actions != None:
4949 self.actions = actions
4950 else:
4951 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004952 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004953
4954 def pack(self):
4955 packed = []
4956 packed.append(struct.pack("!B", self.version))
4957 packed.append(struct.pack("!B", self.type))
4958 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4959 packed.append(struct.pack("!L", self.xid))
4960 packed.append(self.match.pack())
4961 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004962 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004963 packed.append(struct.pack("!H", self.idle_timeout))
4964 packed.append(struct.pack("!H", self.hard_timeout))
4965 packed.append(struct.pack("!H", self.priority))
4966 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004967 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004968 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004969 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004970 length = sum([len(x) for x in packed])
4971 packed[2] = struct.pack("!H", length)
4972 return ''.join(packed)
4973
4974 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004975 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004976 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004977 _version = reader.read("!B")[0]
4978 assert(_version == 1)
4979 _type = reader.read("!B")[0]
4980 assert(_type == 14)
4981 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004982 orig_reader = reader
4983 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004984 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004985 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004986 obj.cookie = reader.read("!Q")[0]
4987 __command = util.unpack_fm_cmd(reader)
4988 assert(__command == 4)
4989 obj.idle_timeout = reader.read("!H")[0]
4990 obj.hard_timeout = reader.read("!H")[0]
4991 obj.priority = reader.read("!H")[0]
4992 obj.buffer_id = reader.read("!L")[0]
4993 obj.out_port = util.unpack_port_no(reader)
4994 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004995 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004996 return obj
4997
4998 def __eq__(self, other):
4999 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005000 if self.xid != other.xid: return False
5001 if self.match != other.match: return False
5002 if self.cookie != other.cookie: return False
5003 if self.idle_timeout != other.idle_timeout: return False
5004 if self.hard_timeout != other.hard_timeout: return False
5005 if self.priority != other.priority: return False
5006 if self.buffer_id != other.buffer_id: return False
5007 if self.out_port != other.out_port: return False
5008 if self.flags != other.flags: return False
5009 if self.actions != other.actions: return False
5010 return True
5011
Rich Laneb658ddd2013-03-12 10:15:10 -07005012 def pretty_print(self, q):
5013 q.text("flow_delete_strict {")
5014 with q.group():
5015 with q.indent(2):
5016 q.breakable()
5017 q.text("xid = ");
5018 if self.xid != None:
5019 q.text("%#x" % self.xid)
5020 else:
5021 q.text('None')
5022 q.text(","); q.breakable()
5023 q.text("match = ");
5024 q.pp(self.match)
5025 q.text(","); q.breakable()
5026 q.text("cookie = ");
5027 q.text("%#x" % self.cookie)
5028 q.text(","); q.breakable()
5029 q.text("idle_timeout = ");
5030 q.text("%#x" % self.idle_timeout)
5031 q.text(","); q.breakable()
5032 q.text("hard_timeout = ");
5033 q.text("%#x" % self.hard_timeout)
5034 q.text(","); q.breakable()
5035 q.text("priority = ");
5036 q.text("%#x" % self.priority)
5037 q.text(","); q.breakable()
5038 q.text("buffer_id = ");
5039 q.text("%#x" % self.buffer_id)
5040 q.text(","); q.breakable()
5041 q.text("out_port = ");
5042 q.text(util.pretty_port(self.out_port))
5043 q.text(","); q.breakable()
5044 q.text("flags = ");
5045 q.text("%#x" % self.flags)
5046 q.text(","); q.breakable()
5047 q.text("actions = ");
5048 q.pp(self.actions)
5049 q.breakable()
5050 q.text('}')
5051
Rich Lane7dcdf022013-12-11 14:45:27 -08005052flow_mod.subtypes[4] = flow_delete_strict
5053
5054class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005055 version = 1
5056 type = 1
5057 err_type = 3
5058
5059 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005060 if xid != None:
5061 self.xid = xid
5062 else:
5063 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005064 if code != None:
5065 self.code = code
5066 else:
5067 self.code = 0
5068 if data != None:
5069 self.data = data
5070 else:
5071 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005072 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005073
5074 def pack(self):
5075 packed = []
5076 packed.append(struct.pack("!B", self.version))
5077 packed.append(struct.pack("!B", self.type))
5078 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5079 packed.append(struct.pack("!L", self.xid))
5080 packed.append(struct.pack("!H", self.err_type))
5081 packed.append(struct.pack("!H", self.code))
5082 packed.append(self.data)
5083 length = sum([len(x) for x in packed])
5084 packed[2] = struct.pack("!H", length)
5085 return ''.join(packed)
5086
5087 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005088 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005089 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005090 _version = reader.read("!B")[0]
5091 assert(_version == 1)
5092 _type = reader.read("!B")[0]
5093 assert(_type == 1)
5094 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005095 orig_reader = reader
5096 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005097 obj.xid = reader.read("!L")[0]
5098 _err_type = reader.read("!H")[0]
5099 assert(_err_type == 3)
5100 obj.code = reader.read("!H")[0]
5101 obj.data = str(reader.read_all())
5102 return obj
5103
5104 def __eq__(self, other):
5105 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005106 if self.xid != other.xid: return False
5107 if self.code != other.code: return False
5108 if self.data != other.data: return False
5109 return True
5110
Rich Lane6f4978c2013-10-20 21:33:52 -07005111 def pretty_print(self, q):
5112 q.text("flow_mod_failed_error_msg {")
5113 with q.group():
5114 with q.indent(2):
5115 q.breakable()
5116 q.text("xid = ");
5117 if self.xid != None:
5118 q.text("%#x" % self.xid)
5119 else:
5120 q.text('None')
5121 q.text(","); q.breakable()
5122 q.text("code = ");
5123 q.text("%#x" % self.code)
5124 q.text(","); q.breakable()
5125 q.text("data = ");
5126 q.pp(self.data)
5127 q.breakable()
5128 q.text('}')
5129
Rich Lane7dcdf022013-12-11 14:45:27 -08005130error_msg.subtypes[3] = flow_mod_failed_error_msg
5131
5132class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005133 version = 1
5134 type = 14
5135 _command = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005136
5137 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 -08005138 if xid != None:
5139 self.xid = xid
5140 else:
5141 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005142 if match != None:
5143 self.match = match
5144 else:
5145 self.match = common.match()
5146 if cookie != None:
5147 self.cookie = cookie
5148 else:
5149 self.cookie = 0
5150 if idle_timeout != None:
5151 self.idle_timeout = idle_timeout
5152 else:
5153 self.idle_timeout = 0
5154 if hard_timeout != None:
5155 self.hard_timeout = hard_timeout
5156 else:
5157 self.hard_timeout = 0
5158 if priority != None:
5159 self.priority = priority
5160 else:
5161 self.priority = 0
5162 if buffer_id != None:
5163 self.buffer_id = buffer_id
5164 else:
5165 self.buffer_id = 0
5166 if out_port != None:
5167 self.out_port = out_port
5168 else:
5169 self.out_port = 0
5170 if flags != None:
5171 self.flags = flags
5172 else:
5173 self.flags = 0
5174 if actions != None:
5175 self.actions = actions
5176 else:
5177 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005178 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005179
5180 def pack(self):
5181 packed = []
5182 packed.append(struct.pack("!B", self.version))
5183 packed.append(struct.pack("!B", self.type))
5184 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5185 packed.append(struct.pack("!L", self.xid))
5186 packed.append(self.match.pack())
5187 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005188 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005189 packed.append(struct.pack("!H", self.idle_timeout))
5190 packed.append(struct.pack("!H", self.hard_timeout))
5191 packed.append(struct.pack("!H", self.priority))
5192 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005193 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005194 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005195 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005196 length = sum([len(x) for x in packed])
5197 packed[2] = struct.pack("!H", length)
5198 return ''.join(packed)
5199
5200 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005201 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005202 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07005203 _version = reader.read("!B")[0]
5204 assert(_version == 1)
5205 _type = reader.read("!B")[0]
5206 assert(_type == 14)
5207 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005208 orig_reader = reader
5209 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005210 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005211 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005212 obj.cookie = reader.read("!Q")[0]
5213 __command = util.unpack_fm_cmd(reader)
5214 assert(__command == 1)
5215 obj.idle_timeout = reader.read("!H")[0]
5216 obj.hard_timeout = reader.read("!H")[0]
5217 obj.priority = reader.read("!H")[0]
5218 obj.buffer_id = reader.read("!L")[0]
5219 obj.out_port = util.unpack_port_no(reader)
5220 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005221 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005222 return obj
5223
5224 def __eq__(self, other):
5225 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005226 if self.xid != other.xid: return False
5227 if self.match != other.match: return False
5228 if self.cookie != other.cookie: return False
5229 if self.idle_timeout != other.idle_timeout: return False
5230 if self.hard_timeout != other.hard_timeout: return False
5231 if self.priority != other.priority: return False
5232 if self.buffer_id != other.buffer_id: return False
5233 if self.out_port != other.out_port: return False
5234 if self.flags != other.flags: return False
5235 if self.actions != other.actions: return False
5236 return True
5237
Rich Laneb658ddd2013-03-12 10:15:10 -07005238 def pretty_print(self, q):
5239 q.text("flow_modify {")
5240 with q.group():
5241 with q.indent(2):
5242 q.breakable()
5243 q.text("xid = ");
5244 if self.xid != None:
5245 q.text("%#x" % self.xid)
5246 else:
5247 q.text('None')
5248 q.text(","); q.breakable()
5249 q.text("match = ");
5250 q.pp(self.match)
5251 q.text(","); q.breakable()
5252 q.text("cookie = ");
5253 q.text("%#x" % self.cookie)
5254 q.text(","); q.breakable()
5255 q.text("idle_timeout = ");
5256 q.text("%#x" % self.idle_timeout)
5257 q.text(","); q.breakable()
5258 q.text("hard_timeout = ");
5259 q.text("%#x" % self.hard_timeout)
5260 q.text(","); q.breakable()
5261 q.text("priority = ");
5262 q.text("%#x" % self.priority)
5263 q.text(","); q.breakable()
5264 q.text("buffer_id = ");
5265 q.text("%#x" % self.buffer_id)
5266 q.text(","); q.breakable()
5267 q.text("out_port = ");
5268 q.text(util.pretty_port(self.out_port))
5269 q.text(","); q.breakable()
5270 q.text("flags = ");
5271 q.text("%#x" % self.flags)
5272 q.text(","); q.breakable()
5273 q.text("actions = ");
5274 q.pp(self.actions)
5275 q.breakable()
5276 q.text('}')
5277
Rich Lane7dcdf022013-12-11 14:45:27 -08005278flow_mod.subtypes[1] = flow_modify
5279
5280class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005281 version = 1
5282 type = 14
5283 _command = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07005284
5285 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 -08005286 if xid != None:
5287 self.xid = xid
5288 else:
5289 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005290 if match != None:
5291 self.match = match
5292 else:
5293 self.match = common.match()
5294 if cookie != None:
5295 self.cookie = cookie
5296 else:
5297 self.cookie = 0
5298 if idle_timeout != None:
5299 self.idle_timeout = idle_timeout
5300 else:
5301 self.idle_timeout = 0
5302 if hard_timeout != None:
5303 self.hard_timeout = hard_timeout
5304 else:
5305 self.hard_timeout = 0
5306 if priority != None:
5307 self.priority = priority
5308 else:
5309 self.priority = 0
5310 if buffer_id != None:
5311 self.buffer_id = buffer_id
5312 else:
5313 self.buffer_id = 0
5314 if out_port != None:
5315 self.out_port = out_port
5316 else:
5317 self.out_port = 0
5318 if flags != None:
5319 self.flags = flags
5320 else:
5321 self.flags = 0
5322 if actions != None:
5323 self.actions = actions
5324 else:
5325 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005326 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005327
5328 def pack(self):
5329 packed = []
5330 packed.append(struct.pack("!B", self.version))
5331 packed.append(struct.pack("!B", self.type))
5332 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5333 packed.append(struct.pack("!L", self.xid))
5334 packed.append(self.match.pack())
5335 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005336 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005337 packed.append(struct.pack("!H", self.idle_timeout))
5338 packed.append(struct.pack("!H", self.hard_timeout))
5339 packed.append(struct.pack("!H", self.priority))
5340 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005341 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005342 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005343 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005344 length = sum([len(x) for x in packed])
5345 packed[2] = struct.pack("!H", length)
5346 return ''.join(packed)
5347
5348 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005349 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005350 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07005351 _version = reader.read("!B")[0]
5352 assert(_version == 1)
5353 _type = reader.read("!B")[0]
5354 assert(_type == 14)
5355 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005356 orig_reader = reader
5357 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005358 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005359 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005360 obj.cookie = reader.read("!Q")[0]
5361 __command = util.unpack_fm_cmd(reader)
5362 assert(__command == 2)
5363 obj.idle_timeout = reader.read("!H")[0]
5364 obj.hard_timeout = reader.read("!H")[0]
5365 obj.priority = reader.read("!H")[0]
5366 obj.buffer_id = reader.read("!L")[0]
5367 obj.out_port = util.unpack_port_no(reader)
5368 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005369 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005370 return obj
5371
5372 def __eq__(self, other):
5373 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005374 if self.xid != other.xid: return False
5375 if self.match != other.match: return False
5376 if self.cookie != other.cookie: return False
5377 if self.idle_timeout != other.idle_timeout: return False
5378 if self.hard_timeout != other.hard_timeout: return False
5379 if self.priority != other.priority: return False
5380 if self.buffer_id != other.buffer_id: return False
5381 if self.out_port != other.out_port: return False
5382 if self.flags != other.flags: return False
5383 if self.actions != other.actions: return False
5384 return True
5385
Rich Laneb658ddd2013-03-12 10:15:10 -07005386 def pretty_print(self, q):
5387 q.text("flow_modify_strict {")
5388 with q.group():
5389 with q.indent(2):
5390 q.breakable()
5391 q.text("xid = ");
5392 if self.xid != None:
5393 q.text("%#x" % self.xid)
5394 else:
5395 q.text('None')
5396 q.text(","); q.breakable()
5397 q.text("match = ");
5398 q.pp(self.match)
5399 q.text(","); q.breakable()
5400 q.text("cookie = ");
5401 q.text("%#x" % self.cookie)
5402 q.text(","); q.breakable()
5403 q.text("idle_timeout = ");
5404 q.text("%#x" % self.idle_timeout)
5405 q.text(","); q.breakable()
5406 q.text("hard_timeout = ");
5407 q.text("%#x" % self.hard_timeout)
5408 q.text(","); q.breakable()
5409 q.text("priority = ");
5410 q.text("%#x" % self.priority)
5411 q.text(","); q.breakable()
5412 q.text("buffer_id = ");
5413 q.text("%#x" % self.buffer_id)
5414 q.text(","); q.breakable()
5415 q.text("out_port = ");
5416 q.text(util.pretty_port(self.out_port))
5417 q.text(","); q.breakable()
5418 q.text("flags = ");
5419 q.text("%#x" % self.flags)
5420 q.text(","); q.breakable()
5421 q.text("actions = ");
5422 q.pp(self.actions)
5423 q.breakable()
5424 q.text('}')
5425
Rich Lane7dcdf022013-12-11 14:45:27 -08005426flow_mod.subtypes[2] = flow_modify_strict
5427
5428class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005429 version = 1
5430 type = 11
Rich Laneb658ddd2013-03-12 10:15:10 -07005431
Rich Lanec2ee4b82013-04-24 17:12:38 -07005432 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 -08005433 if xid != None:
5434 self.xid = xid
5435 else:
5436 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005437 if match != None:
5438 self.match = match
5439 else:
5440 self.match = common.match()
5441 if cookie != None:
5442 self.cookie = cookie
5443 else:
5444 self.cookie = 0
5445 if priority != None:
5446 self.priority = priority
5447 else:
5448 self.priority = 0
5449 if reason != None:
5450 self.reason = reason
5451 else:
5452 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005453 if duration_sec != None:
5454 self.duration_sec = duration_sec
5455 else:
5456 self.duration_sec = 0
5457 if duration_nsec != None:
5458 self.duration_nsec = duration_nsec
5459 else:
5460 self.duration_nsec = 0
5461 if idle_timeout != None:
5462 self.idle_timeout = idle_timeout
5463 else:
5464 self.idle_timeout = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005465 if packet_count != None:
5466 self.packet_count = packet_count
5467 else:
5468 self.packet_count = 0
5469 if byte_count != None:
5470 self.byte_count = byte_count
5471 else:
5472 self.byte_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005473 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005474
5475 def pack(self):
5476 packed = []
5477 packed.append(struct.pack("!B", self.version))
5478 packed.append(struct.pack("!B", self.type))
5479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5480 packed.append(struct.pack("!L", self.xid))
5481 packed.append(self.match.pack())
5482 packed.append(struct.pack("!Q", self.cookie))
5483 packed.append(struct.pack("!H", self.priority))
5484 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005485 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07005486 packed.append(struct.pack("!L", self.duration_sec))
5487 packed.append(struct.pack("!L", self.duration_nsec))
5488 packed.append(struct.pack("!H", self.idle_timeout))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005489 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07005490 packed.append(struct.pack("!Q", self.packet_count))
5491 packed.append(struct.pack("!Q", self.byte_count))
5492 length = sum([len(x) for x in packed])
5493 packed[2] = struct.pack("!H", length)
5494 return ''.join(packed)
5495
5496 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005497 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005498 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07005499 _version = reader.read("!B")[0]
5500 assert(_version == 1)
5501 _type = reader.read("!B")[0]
5502 assert(_type == 11)
5503 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005504 orig_reader = reader
5505 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005506 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005507 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005508 obj.cookie = reader.read("!Q")[0]
5509 obj.priority = reader.read("!H")[0]
5510 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005511 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005512 obj.duration_sec = reader.read("!L")[0]
5513 obj.duration_nsec = reader.read("!L")[0]
5514 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005515 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07005516 obj.packet_count = reader.read("!Q")[0]
5517 obj.byte_count = reader.read("!Q")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005518 return obj
5519
5520 def __eq__(self, other):
5521 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005522 if self.xid != other.xid: return False
5523 if self.match != other.match: return False
5524 if self.cookie != other.cookie: return False
5525 if self.priority != other.priority: return False
5526 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005527 if self.duration_sec != other.duration_sec: return False
5528 if self.duration_nsec != other.duration_nsec: return False
5529 if self.idle_timeout != other.idle_timeout: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005530 if self.packet_count != other.packet_count: return False
5531 if self.byte_count != other.byte_count: return False
5532 return True
5533
Rich Laneb658ddd2013-03-12 10:15:10 -07005534 def pretty_print(self, q):
5535 q.text("flow_removed {")
5536 with q.group():
5537 with q.indent(2):
5538 q.breakable()
5539 q.text("xid = ");
5540 if self.xid != None:
5541 q.text("%#x" % self.xid)
5542 else:
5543 q.text('None')
5544 q.text(","); q.breakable()
5545 q.text("match = ");
5546 q.pp(self.match)
5547 q.text(","); q.breakable()
5548 q.text("cookie = ");
5549 q.text("%#x" % self.cookie)
5550 q.text(","); q.breakable()
5551 q.text("priority = ");
5552 q.text("%#x" % self.priority)
5553 q.text(","); q.breakable()
5554 q.text("reason = ");
5555 q.text("%#x" % self.reason)
5556 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005557 q.text("duration_sec = ");
5558 q.text("%#x" % self.duration_sec)
5559 q.text(","); q.breakable()
5560 q.text("duration_nsec = ");
5561 q.text("%#x" % self.duration_nsec)
5562 q.text(","); q.breakable()
5563 q.text("idle_timeout = ");
5564 q.text("%#x" % self.idle_timeout)
5565 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005566 q.text("packet_count = ");
5567 q.text("%#x" % self.packet_count)
5568 q.text(","); q.breakable()
5569 q.text("byte_count = ");
5570 q.text("%#x" % self.byte_count)
5571 q.breakable()
5572 q.text('}')
5573
Rich Lane7dcdf022013-12-11 14:45:27 -08005574message.subtypes[11] = flow_removed
5575
5576class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005577 version = 1
5578 type = 17
5579 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005580
5581 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005582 if xid != None:
5583 self.xid = xid
5584 else:
5585 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005586 if flags != None:
5587 self.flags = flags
5588 else:
5589 self.flags = 0
5590 if entries != None:
5591 self.entries = entries
5592 else:
5593 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005594 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005595
5596 def pack(self):
5597 packed = []
5598 packed.append(struct.pack("!B", self.version))
5599 packed.append(struct.pack("!B", self.type))
5600 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5601 packed.append(struct.pack("!L", self.xid))
5602 packed.append(struct.pack("!H", self.stats_type))
5603 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005604 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07005605 length = sum([len(x) for x in packed])
5606 packed[2] = struct.pack("!H", length)
5607 return ''.join(packed)
5608
5609 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005610 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005611 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005612 _version = reader.read("!B")[0]
5613 assert(_version == 1)
5614 _type = reader.read("!B")[0]
5615 assert(_type == 17)
5616 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005617 orig_reader = reader
5618 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005619 obj.xid = reader.read("!L")[0]
5620 _stats_type = reader.read("!H")[0]
5621 assert(_stats_type == 1)
5622 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005623 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005624 return obj
5625
5626 def __eq__(self, other):
5627 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005628 if self.xid != other.xid: return False
5629 if self.flags != other.flags: return False
5630 if self.entries != other.entries: return False
5631 return True
5632
Rich Laneb658ddd2013-03-12 10:15:10 -07005633 def pretty_print(self, q):
5634 q.text("flow_stats_reply {")
5635 with q.group():
5636 with q.indent(2):
5637 q.breakable()
5638 q.text("xid = ");
5639 if self.xid != None:
5640 q.text("%#x" % self.xid)
5641 else:
5642 q.text('None')
5643 q.text(","); q.breakable()
5644 q.text("flags = ");
5645 q.text("%#x" % self.flags)
5646 q.text(","); q.breakable()
5647 q.text("entries = ");
5648 q.pp(self.entries)
5649 q.breakable()
5650 q.text('}')
5651
Rich Lane7dcdf022013-12-11 14:45:27 -08005652stats_reply.subtypes[1] = flow_stats_reply
5653
5654class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005655 version = 1
5656 type = 16
5657 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005658
Rich Lanec2ee4b82013-04-24 17:12:38 -07005659 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005660 if xid != None:
5661 self.xid = xid
5662 else:
5663 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005664 if flags != None:
5665 self.flags = flags
5666 else:
5667 self.flags = 0
5668 if match != None:
5669 self.match = match
5670 else:
5671 self.match = common.match()
5672 if table_id != None:
5673 self.table_id = table_id
5674 else:
5675 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005676 if out_port != None:
5677 self.out_port = out_port
5678 else:
5679 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005680 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005681
5682 def pack(self):
5683 packed = []
5684 packed.append(struct.pack("!B", self.version))
5685 packed.append(struct.pack("!B", self.type))
5686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5687 packed.append(struct.pack("!L", self.xid))
5688 packed.append(struct.pack("!H", self.stats_type))
5689 packed.append(struct.pack("!H", self.flags))
5690 packed.append(self.match.pack())
5691 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005692 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -07005693 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005694 length = sum([len(x) for x in packed])
5695 packed[2] = struct.pack("!H", length)
5696 return ''.join(packed)
5697
5698 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005699 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005700 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005701 _version = reader.read("!B")[0]
5702 assert(_version == 1)
5703 _type = reader.read("!B")[0]
5704 assert(_type == 16)
5705 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005706 orig_reader = reader
5707 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005708 obj.xid = reader.read("!L")[0]
5709 _stats_type = reader.read("!H")[0]
5710 assert(_stats_type == 1)
5711 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005712 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005713 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005714 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005715 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07005716 return obj
5717
5718 def __eq__(self, other):
5719 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005720 if self.xid != other.xid: return False
5721 if self.flags != other.flags: return False
5722 if self.match != other.match: return False
5723 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005724 if self.out_port != other.out_port: return False
5725 return True
5726
Rich Laneb658ddd2013-03-12 10:15:10 -07005727 def pretty_print(self, q):
5728 q.text("flow_stats_request {")
5729 with q.group():
5730 with q.indent(2):
5731 q.breakable()
5732 q.text("xid = ");
5733 if self.xid != None:
5734 q.text("%#x" % self.xid)
5735 else:
5736 q.text('None')
5737 q.text(","); q.breakable()
5738 q.text("flags = ");
5739 q.text("%#x" % self.flags)
5740 q.text(","); q.breakable()
5741 q.text("match = ");
5742 q.pp(self.match)
5743 q.text(","); q.breakable()
5744 q.text("table_id = ");
5745 q.text("%#x" % self.table_id)
5746 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005747 q.text("out_port = ");
5748 q.text(util.pretty_port(self.out_port))
5749 q.breakable()
5750 q.text('}')
5751
Rich Lane7dcdf022013-12-11 14:45:27 -08005752stats_request.subtypes[1] = flow_stats_request
5753
5754class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005755 version = 1
5756 type = 8
Rich Laneb658ddd2013-03-12 10:15:10 -07005757
5758 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005759 if xid != None:
5760 self.xid = xid
5761 else:
5762 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005763 if flags != None:
5764 self.flags = flags
5765 else:
5766 self.flags = 0
5767 if miss_send_len != None:
5768 self.miss_send_len = miss_send_len
5769 else:
5770 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005771 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005772
5773 def pack(self):
5774 packed = []
5775 packed.append(struct.pack("!B", self.version))
5776 packed.append(struct.pack("!B", self.type))
5777 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5778 packed.append(struct.pack("!L", self.xid))
5779 packed.append(struct.pack("!H", self.flags))
5780 packed.append(struct.pack("!H", self.miss_send_len))
5781 length = sum([len(x) for x in packed])
5782 packed[2] = struct.pack("!H", length)
5783 return ''.join(packed)
5784
5785 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005786 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005787 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005788 _version = reader.read("!B")[0]
5789 assert(_version == 1)
5790 _type = reader.read("!B")[0]
5791 assert(_type == 8)
5792 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005793 orig_reader = reader
5794 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005795 obj.xid = reader.read("!L")[0]
5796 obj.flags = reader.read("!H")[0]
5797 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005798 return obj
5799
5800 def __eq__(self, other):
5801 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005802 if self.xid != other.xid: return False
5803 if self.flags != other.flags: return False
5804 if self.miss_send_len != other.miss_send_len: return False
5805 return True
5806
Rich Laneb658ddd2013-03-12 10:15:10 -07005807 def pretty_print(self, q):
5808 q.text("get_config_reply {")
5809 with q.group():
5810 with q.indent(2):
5811 q.breakable()
5812 q.text("xid = ");
5813 if self.xid != None:
5814 q.text("%#x" % self.xid)
5815 else:
5816 q.text('None')
5817 q.text(","); q.breakable()
5818 q.text("flags = ");
5819 q.text("%#x" % self.flags)
5820 q.text(","); q.breakable()
5821 q.text("miss_send_len = ");
5822 q.text("%#x" % self.miss_send_len)
5823 q.breakable()
5824 q.text('}')
5825
Rich Lane7dcdf022013-12-11 14:45:27 -08005826message.subtypes[8] = get_config_reply
5827
5828class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005829 version = 1
5830 type = 7
Rich Laneb658ddd2013-03-12 10:15:10 -07005831
5832 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005833 if xid != None:
5834 self.xid = xid
5835 else:
5836 self.xid = None
5837 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005838
5839 def pack(self):
5840 packed = []
5841 packed.append(struct.pack("!B", self.version))
5842 packed.append(struct.pack("!B", self.type))
5843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5844 packed.append(struct.pack("!L", self.xid))
5845 length = sum([len(x) for x in packed])
5846 packed[2] = struct.pack("!H", length)
5847 return ''.join(packed)
5848
5849 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005850 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005851 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005852 _version = reader.read("!B")[0]
5853 assert(_version == 1)
5854 _type = reader.read("!B")[0]
5855 assert(_type == 7)
5856 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005857 orig_reader = reader
5858 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005859 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005860 return obj
5861
5862 def __eq__(self, other):
5863 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005864 if self.xid != other.xid: return False
5865 return True
5866
Rich Laneb658ddd2013-03-12 10:15:10 -07005867 def pretty_print(self, q):
5868 q.text("get_config_request {")
5869 with q.group():
5870 with q.indent(2):
5871 q.breakable()
5872 q.text("xid = ");
5873 if self.xid != None:
5874 q.text("%#x" % self.xid)
5875 else:
5876 q.text('None')
5877 q.breakable()
5878 q.text('}')
5879
Rich Lane7dcdf022013-12-11 14:45:27 -08005880message.subtypes[7] = get_config_request
5881
5882class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005883 version = 1
5884 type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005885
5886 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005887 if xid != None:
5888 self.xid = xid
5889 else:
5890 self.xid = None
5891 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005892
5893 def pack(self):
5894 packed = []
5895 packed.append(struct.pack("!B", self.version))
5896 packed.append(struct.pack("!B", self.type))
5897 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5898 packed.append(struct.pack("!L", self.xid))
5899 length = sum([len(x) for x in packed])
5900 packed[2] = struct.pack("!H", length)
5901 return ''.join(packed)
5902
5903 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005904 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005905 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07005906 _version = reader.read("!B")[0]
5907 assert(_version == 1)
5908 _type = reader.read("!B")[0]
5909 assert(_type == 0)
5910 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005911 orig_reader = reader
5912 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005913 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005914 return obj
5915
5916 def __eq__(self, other):
5917 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005918 if self.xid != other.xid: return False
5919 return True
5920
Rich Laneb658ddd2013-03-12 10:15:10 -07005921 def pretty_print(self, q):
5922 q.text("hello {")
5923 with q.group():
5924 with q.indent(2):
5925 q.breakable()
5926 q.text("xid = ");
5927 if self.xid != None:
5928 q.text("%#x" % self.xid)
5929 else:
5930 q.text('None')
5931 q.breakable()
5932 q.text('}')
5933
Rich Lane7dcdf022013-12-11 14:45:27 -08005934message.subtypes[0] = hello
5935
5936class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005937 version = 1
5938 type = 1
5939 err_type = 0
5940
5941 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005942 if xid != None:
5943 self.xid = xid
5944 else:
5945 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005946 if code != None:
5947 self.code = code
5948 else:
5949 self.code = 0
5950 if data != None:
5951 self.data = data
5952 else:
5953 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005954 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005955
5956 def pack(self):
5957 packed = []
5958 packed.append(struct.pack("!B", self.version))
5959 packed.append(struct.pack("!B", self.type))
5960 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5961 packed.append(struct.pack("!L", self.xid))
5962 packed.append(struct.pack("!H", self.err_type))
5963 packed.append(struct.pack("!H", self.code))
5964 packed.append(self.data)
5965 length = sum([len(x) for x in packed])
5966 packed[2] = struct.pack("!H", length)
5967 return ''.join(packed)
5968
5969 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005970 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005971 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005972 _version = reader.read("!B")[0]
5973 assert(_version == 1)
5974 _type = reader.read("!B")[0]
5975 assert(_type == 1)
5976 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005977 orig_reader = reader
5978 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005979 obj.xid = reader.read("!L")[0]
5980 _err_type = reader.read("!H")[0]
5981 assert(_err_type == 0)
5982 obj.code = reader.read("!H")[0]
5983 obj.data = str(reader.read_all())
5984 return obj
5985
5986 def __eq__(self, other):
5987 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005988 if self.xid != other.xid: return False
5989 if self.code != other.code: return False
5990 if self.data != other.data: return False
5991 return True
5992
Rich Lane6f4978c2013-10-20 21:33:52 -07005993 def pretty_print(self, q):
5994 q.text("hello_failed_error_msg {")
5995 with q.group():
5996 with q.indent(2):
5997 q.breakable()
5998 q.text("xid = ");
5999 if self.xid != None:
6000 q.text("%#x" % self.xid)
6001 else:
6002 q.text('None')
6003 q.text(","); q.breakable()
6004 q.text("code = ");
6005 q.text("%#x" % self.code)
6006 q.text(","); q.breakable()
6007 q.text("data = ");
6008 q.pp(self.data)
6009 q.breakable()
6010 q.text('}')
6011
Rich Lane7dcdf022013-12-11 14:45:27 -08006012error_msg.subtypes[0] = hello_failed_error_msg
6013
6014class nicira_header(experimenter):
6015 subtypes = {}
6016
Rich Lane95f7fc92014-01-27 17:08:16 -08006017 version = 1
6018 type = 4
6019 experimenter = 8992
6020
6021 def __init__(self, xid=None, subtype=None):
6022 if xid != None:
6023 self.xid = xid
6024 else:
6025 self.xid = None
6026 if subtype != None:
6027 self.subtype = subtype
6028 else:
6029 self.subtype = 0
6030 return
6031
6032 def pack(self):
6033 packed = []
6034 packed.append(struct.pack("!B", self.version))
6035 packed.append(struct.pack("!B", self.type))
6036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6037 packed.append(struct.pack("!L", self.xid))
6038 packed.append(struct.pack("!L", self.experimenter))
6039 packed.append(struct.pack("!L", self.subtype))
6040 length = sum([len(x) for x in packed])
6041 packed[2] = struct.pack("!H", length)
6042 return ''.join(packed)
6043
Rich Lane7dcdf022013-12-11 14:45:27 -08006044 @staticmethod
6045 def unpack(reader):
6046 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006047 subclass = nicira_header.subtypes.get(subtype)
6048 if subclass:
6049 return subclass.unpack(reader)
6050
6051 obj = nicira_header()
6052 _version = reader.read("!B")[0]
6053 assert(_version == 1)
6054 _type = reader.read("!B")[0]
6055 assert(_type == 4)
6056 _length = reader.read("!H")[0]
6057 orig_reader = reader
6058 reader = orig_reader.slice(_length - (2 + 2))
6059 obj.xid = reader.read("!L")[0]
6060 _experimenter = reader.read("!L")[0]
6061 assert(_experimenter == 8992)
6062 obj.subtype = reader.read("!L")[0]
6063 return obj
6064
6065 def __eq__(self, other):
6066 if type(self) != type(other): return False
6067 if self.xid != other.xid: return False
6068 if self.subtype != other.subtype: return False
6069 return True
6070
6071 def pretty_print(self, q):
6072 q.text("nicira_header {")
6073 with q.group():
6074 with q.indent(2):
6075 q.breakable()
6076 q.text("xid = ");
6077 if self.xid != None:
6078 q.text("%#x" % self.xid)
6079 else:
6080 q.text('None')
6081 q.breakable()
6082 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006083
6084experimenter.subtypes[8992] = nicira_header
6085
6086class nicira_controller_role_reply(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006087 version = 1
6088 type = 4
6089 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006090 subtype = 11
6091
6092 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006093 if xid != None:
6094 self.xid = xid
6095 else:
6096 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006097 if role != None:
6098 self.role = role
6099 else:
6100 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006101 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006102
6103 def pack(self):
6104 packed = []
6105 packed.append(struct.pack("!B", self.version))
6106 packed.append(struct.pack("!B", self.type))
6107 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6108 packed.append(struct.pack("!L", self.xid))
6109 packed.append(struct.pack("!L", self.experimenter))
6110 packed.append(struct.pack("!L", self.subtype))
6111 packed.append(struct.pack("!L", self.role))
6112 length = sum([len(x) for x in packed])
6113 packed[2] = struct.pack("!H", length)
6114 return ''.join(packed)
6115
6116 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006117 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006118 obj = nicira_controller_role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006119 _version = reader.read("!B")[0]
6120 assert(_version == 1)
6121 _type = reader.read("!B")[0]
6122 assert(_type == 4)
6123 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006124 orig_reader = reader
6125 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006126 obj.xid = reader.read("!L")[0]
6127 _experimenter = reader.read("!L")[0]
6128 assert(_experimenter == 8992)
6129 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006130 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006131 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006132 return obj
6133
6134 def __eq__(self, other):
6135 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006136 if self.xid != other.xid: return False
6137 if self.role != other.role: return False
6138 return True
6139
Rich Laneb658ddd2013-03-12 10:15:10 -07006140 def pretty_print(self, q):
6141 q.text("nicira_controller_role_reply {")
6142 with q.group():
6143 with q.indent(2):
6144 q.breakable()
6145 q.text("xid = ");
6146 if self.xid != None:
6147 q.text("%#x" % self.xid)
6148 else:
6149 q.text('None')
6150 q.text(","); q.breakable()
6151 q.text("role = ");
6152 q.text("%#x" % self.role)
6153 q.breakable()
6154 q.text('}')
6155
Rich Lane7dcdf022013-12-11 14:45:27 -08006156nicira_header.subtypes[11] = nicira_controller_role_reply
6157
6158class nicira_controller_role_request(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006159 version = 1
6160 type = 4
6161 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006162 subtype = 10
6163
6164 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006165 if xid != None:
6166 self.xid = xid
6167 else:
6168 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006169 if role != None:
6170 self.role = role
6171 else:
6172 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006173 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006174
6175 def pack(self):
6176 packed = []
6177 packed.append(struct.pack("!B", self.version))
6178 packed.append(struct.pack("!B", self.type))
6179 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6180 packed.append(struct.pack("!L", self.xid))
6181 packed.append(struct.pack("!L", self.experimenter))
6182 packed.append(struct.pack("!L", self.subtype))
6183 packed.append(struct.pack("!L", self.role))
6184 length = sum([len(x) for x in packed])
6185 packed[2] = struct.pack("!H", length)
6186 return ''.join(packed)
6187
6188 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006189 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006190 obj = nicira_controller_role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006191 _version = reader.read("!B")[0]
6192 assert(_version == 1)
6193 _type = reader.read("!B")[0]
6194 assert(_type == 4)
6195 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006196 orig_reader = reader
6197 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006198 obj.xid = reader.read("!L")[0]
6199 _experimenter = reader.read("!L")[0]
6200 assert(_experimenter == 8992)
6201 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006202 assert(_subtype == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07006203 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006204 return obj
6205
6206 def __eq__(self, other):
6207 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006208 if self.xid != other.xid: return False
6209 if self.role != other.role: return False
6210 return True
6211
Rich Laneb658ddd2013-03-12 10:15:10 -07006212 def pretty_print(self, q):
6213 q.text("nicira_controller_role_request {")
6214 with q.group():
6215 with q.indent(2):
6216 q.breakable()
6217 q.text("xid = ");
6218 if self.xid != None:
6219 q.text("%#x" % self.xid)
6220 else:
6221 q.text('None')
6222 q.text(","); q.breakable()
6223 q.text("role = ");
6224 q.text("%#x" % self.role)
6225 q.breakable()
6226 q.text('}')
6227
Rich Lane7dcdf022013-12-11 14:45:27 -08006228nicira_header.subtypes[10] = nicira_controller_role_request
6229
6230class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006231 version = 1
6232 type = 10
Rich Laneb658ddd2013-03-12 10:15:10 -07006233
Rich Lanec2ee4b82013-04-24 17:12:38 -07006234 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 -08006235 if xid != None:
6236 self.xid = xid
6237 else:
6238 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006239 if buffer_id != None:
6240 self.buffer_id = buffer_id
6241 else:
6242 self.buffer_id = 0
6243 if total_len != None:
6244 self.total_len = total_len
6245 else:
6246 self.total_len = 0
6247 if in_port != None:
6248 self.in_port = in_port
6249 else:
6250 self.in_port = 0
6251 if reason != None:
6252 self.reason = reason
6253 else:
6254 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006255 if data != None:
6256 self.data = data
6257 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006258 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006259 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006260
6261 def pack(self):
6262 packed = []
6263 packed.append(struct.pack("!B", self.version))
6264 packed.append(struct.pack("!B", self.type))
6265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6266 packed.append(struct.pack("!L", self.xid))
6267 packed.append(struct.pack("!L", self.buffer_id))
6268 packed.append(struct.pack("!H", self.total_len))
Dan Talaycof6202252013-07-02 01:00:29 -07006269 packed.append(util.pack_port_no(self.in_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006270 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006271 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07006272 packed.append(self.data)
6273 length = sum([len(x) for x in packed])
6274 packed[2] = struct.pack("!H", length)
6275 return ''.join(packed)
6276
6277 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006278 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006279 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006280 _version = reader.read("!B")[0]
6281 assert(_version == 1)
6282 _type = reader.read("!B")[0]
6283 assert(_type == 10)
6284 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006285 orig_reader = reader
6286 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006287 obj.xid = reader.read("!L")[0]
6288 obj.buffer_id = reader.read("!L")[0]
6289 obj.total_len = reader.read("!H")[0]
6290 obj.in_port = util.unpack_port_no(reader)
6291 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006292 reader.skip(1)
6293 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006294 return obj
6295
6296 def __eq__(self, other):
6297 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006298 if self.xid != other.xid: return False
6299 if self.buffer_id != other.buffer_id: return False
6300 if self.total_len != other.total_len: return False
6301 if self.in_port != other.in_port: return False
6302 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006303 if self.data != other.data: return False
6304 return True
6305
Rich Laneb658ddd2013-03-12 10:15:10 -07006306 def pretty_print(self, q):
6307 q.text("packet_in {")
6308 with q.group():
6309 with q.indent(2):
6310 q.breakable()
6311 q.text("xid = ");
6312 if self.xid != None:
6313 q.text("%#x" % self.xid)
6314 else:
6315 q.text('None')
6316 q.text(","); q.breakable()
6317 q.text("buffer_id = ");
6318 q.text("%#x" % self.buffer_id)
6319 q.text(","); q.breakable()
6320 q.text("total_len = ");
6321 q.text("%#x" % self.total_len)
6322 q.text(","); q.breakable()
6323 q.text("in_port = ");
6324 q.text(util.pretty_port(self.in_port))
6325 q.text(","); q.breakable()
6326 q.text("reason = ");
6327 q.text("%#x" % self.reason)
6328 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006329 q.text("data = ");
6330 q.pp(self.data)
6331 q.breakable()
6332 q.text('}')
6333
Rich Lane7dcdf022013-12-11 14:45:27 -08006334message.subtypes[10] = packet_in
6335
6336class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006337 version = 1
6338 type = 13
Rich Laneb658ddd2013-03-12 10:15:10 -07006339
6340 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006341 if xid != None:
6342 self.xid = xid
6343 else:
6344 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006345 if buffer_id != None:
6346 self.buffer_id = buffer_id
6347 else:
Rich Laneff637c92013-04-04 13:57:09 -07006348 self.buffer_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006349 if in_port != None:
6350 self.in_port = in_port
6351 else:
6352 self.in_port = 0
6353 if actions != None:
6354 self.actions = actions
6355 else:
6356 self.actions = []
6357 if data != None:
6358 self.data = data
6359 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006360 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006361 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006362
6363 def pack(self):
6364 packed = []
6365 packed.append(struct.pack("!B", self.version))
6366 packed.append(struct.pack("!B", self.type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006367 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
Rich Laneb658ddd2013-03-12 10:15:10 -07006368 packed.append(struct.pack("!L", self.xid))
6369 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006370 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006371 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
Rich Lane7dcdf022013-12-11 14:45:27 -08006372 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006373 packed[6] = struct.pack("!H", len(packed[-1]))
Rich Laneb658ddd2013-03-12 10:15:10 -07006374 packed.append(self.data)
6375 length = sum([len(x) for x in packed])
6376 packed[2] = struct.pack("!H", length)
6377 return ''.join(packed)
6378
6379 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006380 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006381 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006382 _version = reader.read("!B")[0]
6383 assert(_version == 1)
6384 _type = reader.read("!B")[0]
6385 assert(_type == 13)
6386 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006387 orig_reader = reader
6388 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006389 obj.xid = reader.read("!L")[0]
6390 obj.buffer_id = reader.read("!L")[0]
6391 obj.in_port = util.unpack_port_no(reader)
6392 _actions_len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006393 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006394 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006395 return obj
6396
6397 def __eq__(self, other):
6398 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006399 if self.xid != other.xid: return False
6400 if self.buffer_id != other.buffer_id: return False
6401 if self.in_port != other.in_port: return False
6402 if self.actions != other.actions: return False
6403 if self.data != other.data: return False
6404 return True
6405
Rich Laneb658ddd2013-03-12 10:15:10 -07006406 def pretty_print(self, q):
6407 q.text("packet_out {")
6408 with q.group():
6409 with q.indent(2):
6410 q.breakable()
6411 q.text("xid = ");
6412 if self.xid != None:
6413 q.text("%#x" % self.xid)
6414 else:
6415 q.text('None')
6416 q.text(","); q.breakable()
6417 q.text("buffer_id = ");
6418 q.text("%#x" % self.buffer_id)
6419 q.text(","); q.breakable()
6420 q.text("in_port = ");
6421 q.text(util.pretty_port(self.in_port))
6422 q.text(","); q.breakable()
6423 q.text("actions = ");
6424 q.pp(self.actions)
6425 q.text(","); q.breakable()
6426 q.text("data = ");
6427 q.pp(self.data)
6428 q.breakable()
6429 q.text('}')
6430
Rich Lane7dcdf022013-12-11 14:45:27 -08006431message.subtypes[13] = packet_out
6432
6433class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006434 version = 1
6435 type = 15
Rich Laneb658ddd2013-03-12 10:15:10 -07006436
Rich Lanec2ee4b82013-04-24 17:12:38 -07006437 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006438 if xid != None:
6439 self.xid = xid
6440 else:
6441 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006442 if port_no != None:
6443 self.port_no = port_no
6444 else:
6445 self.port_no = 0
6446 if hw_addr != None:
6447 self.hw_addr = hw_addr
6448 else:
6449 self.hw_addr = [0,0,0,0,0,0]
6450 if config != None:
6451 self.config = config
6452 else:
6453 self.config = 0
6454 if mask != None:
6455 self.mask = mask
6456 else:
6457 self.mask = 0
6458 if advertise != None:
6459 self.advertise = advertise
6460 else:
6461 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006462 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006463
6464 def pack(self):
6465 packed = []
6466 packed.append(struct.pack("!B", self.version))
6467 packed.append(struct.pack("!B", self.type))
6468 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6469 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006470 packed.append(util.pack_port_no(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006471 packed.append(struct.pack("!6B", *self.hw_addr))
6472 packed.append(struct.pack("!L", self.config))
6473 packed.append(struct.pack("!L", self.mask))
6474 packed.append(struct.pack("!L", self.advertise))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006475 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006476 length = sum([len(x) for x in packed])
6477 packed[2] = struct.pack("!H", length)
6478 return ''.join(packed)
6479
6480 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006481 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006482 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006483 _version = reader.read("!B")[0]
6484 assert(_version == 1)
6485 _type = reader.read("!B")[0]
6486 assert(_type == 15)
6487 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006488 orig_reader = reader
6489 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006490 obj.xid = reader.read("!L")[0]
6491 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006492 obj.hw_addr = list(reader.read('!6B'))
Dan Talaycof6202252013-07-02 01:00:29 -07006493 obj.config = reader.read("!L")[0]
6494 obj.mask = reader.read("!L")[0]
6495 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006496 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006497 return obj
6498
6499 def __eq__(self, other):
6500 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006501 if self.xid != other.xid: return False
6502 if self.port_no != other.port_no: return False
6503 if self.hw_addr != other.hw_addr: return False
6504 if self.config != other.config: return False
6505 if self.mask != other.mask: return False
6506 if self.advertise != other.advertise: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006507 return True
6508
Rich Laneb658ddd2013-03-12 10:15:10 -07006509 def pretty_print(self, q):
6510 q.text("port_mod {")
6511 with q.group():
6512 with q.indent(2):
6513 q.breakable()
6514 q.text("xid = ");
6515 if self.xid != None:
6516 q.text("%#x" % self.xid)
6517 else:
6518 q.text('None')
6519 q.text(","); q.breakable()
6520 q.text("port_no = ");
6521 q.text(util.pretty_port(self.port_no))
6522 q.text(","); q.breakable()
6523 q.text("hw_addr = ");
6524 q.text(util.pretty_mac(self.hw_addr))
6525 q.text(","); q.breakable()
6526 q.text("config = ");
6527 q.text("%#x" % self.config)
6528 q.text(","); q.breakable()
6529 q.text("mask = ");
6530 q.text("%#x" % self.mask)
6531 q.text(","); q.breakable()
6532 q.text("advertise = ");
6533 q.text("%#x" % self.advertise)
Rich Laneb658ddd2013-03-12 10:15:10 -07006534 q.breakable()
6535 q.text('}')
6536
Rich Lane7dcdf022013-12-11 14:45:27 -08006537message.subtypes[15] = port_mod
6538
6539class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006540 version = 1
6541 type = 1
6542 err_type = 4
6543
6544 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006545 if xid != None:
6546 self.xid = xid
6547 else:
6548 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006549 if code != None:
6550 self.code = code
6551 else:
6552 self.code = 0
6553 if data != None:
6554 self.data = data
6555 else:
6556 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006557 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006558
6559 def pack(self):
6560 packed = []
6561 packed.append(struct.pack("!B", self.version))
6562 packed.append(struct.pack("!B", self.type))
6563 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6564 packed.append(struct.pack("!L", self.xid))
6565 packed.append(struct.pack("!H", self.err_type))
6566 packed.append(struct.pack("!H", self.code))
6567 packed.append(self.data)
6568 length = sum([len(x) for x in packed])
6569 packed[2] = struct.pack("!H", length)
6570 return ''.join(packed)
6571
6572 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006573 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006574 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006575 _version = reader.read("!B")[0]
6576 assert(_version == 1)
6577 _type = reader.read("!B")[0]
6578 assert(_type == 1)
6579 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006580 orig_reader = reader
6581 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006582 obj.xid = reader.read("!L")[0]
6583 _err_type = reader.read("!H")[0]
6584 assert(_err_type == 4)
6585 obj.code = reader.read("!H")[0]
6586 obj.data = str(reader.read_all())
6587 return obj
6588
6589 def __eq__(self, other):
6590 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006591 if self.xid != other.xid: return False
6592 if self.code != other.code: return False
6593 if self.data != other.data: return False
6594 return True
6595
Rich Lane6f4978c2013-10-20 21:33:52 -07006596 def pretty_print(self, q):
6597 q.text("port_mod_failed_error_msg {")
6598 with q.group():
6599 with q.indent(2):
6600 q.breakable()
6601 q.text("xid = ");
6602 if self.xid != None:
6603 q.text("%#x" % self.xid)
6604 else:
6605 q.text('None')
6606 q.text(","); q.breakable()
6607 q.text("code = ");
6608 q.text("%#x" % self.code)
6609 q.text(","); q.breakable()
6610 q.text("data = ");
6611 q.pp(self.data)
6612 q.breakable()
6613 q.text('}')
6614
Rich Lane7dcdf022013-12-11 14:45:27 -08006615error_msg.subtypes[4] = port_mod_failed_error_msg
6616
6617class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006618 version = 1
6619 type = 17
6620 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006621
6622 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006623 if xid != None:
6624 self.xid = xid
6625 else:
6626 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006627 if flags != None:
6628 self.flags = flags
6629 else:
6630 self.flags = 0
6631 if entries != None:
6632 self.entries = entries
6633 else:
6634 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006635 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006636
6637 def pack(self):
6638 packed = []
6639 packed.append(struct.pack("!B", self.version))
6640 packed.append(struct.pack("!B", self.type))
6641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6642 packed.append(struct.pack("!L", self.xid))
6643 packed.append(struct.pack("!H", self.stats_type))
6644 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006645 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006646 length = sum([len(x) for x in packed])
6647 packed[2] = struct.pack("!H", length)
6648 return ''.join(packed)
6649
6650 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006651 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006652 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006653 _version = reader.read("!B")[0]
6654 assert(_version == 1)
6655 _type = reader.read("!B")[0]
6656 assert(_type == 17)
6657 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006658 orig_reader = reader
6659 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006660 obj.xid = reader.read("!L")[0]
6661 _stats_type = reader.read("!H")[0]
6662 assert(_stats_type == 4)
6663 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006664 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006665 return obj
6666
6667 def __eq__(self, other):
6668 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006669 if self.xid != other.xid: return False
6670 if self.flags != other.flags: return False
6671 if self.entries != other.entries: return False
6672 return True
6673
Rich Laneb658ddd2013-03-12 10:15:10 -07006674 def pretty_print(self, q):
6675 q.text("port_stats_reply {")
6676 with q.group():
6677 with q.indent(2):
6678 q.breakable()
6679 q.text("xid = ");
6680 if self.xid != None:
6681 q.text("%#x" % self.xid)
6682 else:
6683 q.text('None')
6684 q.text(","); q.breakable()
6685 q.text("flags = ");
6686 q.text("%#x" % self.flags)
6687 q.text(","); q.breakable()
6688 q.text("entries = ");
6689 q.pp(self.entries)
6690 q.breakable()
6691 q.text('}')
6692
Rich Lane7dcdf022013-12-11 14:45:27 -08006693stats_reply.subtypes[4] = port_stats_reply
6694
6695class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006696 version = 1
6697 type = 16
6698 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006699
Rich Lanec2ee4b82013-04-24 17:12:38 -07006700 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006701 if xid != None:
6702 self.xid = xid
6703 else:
6704 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006705 if flags != None:
6706 self.flags = flags
6707 else:
6708 self.flags = 0
6709 if port_no != None:
6710 self.port_no = port_no
6711 else:
6712 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006713 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006714
6715 def pack(self):
6716 packed = []
6717 packed.append(struct.pack("!B", self.version))
6718 packed.append(struct.pack("!B", self.type))
6719 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6720 packed.append(struct.pack("!L", self.xid))
6721 packed.append(struct.pack("!H", self.stats_type))
6722 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07006723 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006724 packed.append('\x00' * 6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006725 length = sum([len(x) for x in packed])
6726 packed[2] = struct.pack("!H", length)
6727 return ''.join(packed)
6728
6729 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006730 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006731 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006732 _version = reader.read("!B")[0]
6733 assert(_version == 1)
6734 _type = reader.read("!B")[0]
6735 assert(_type == 16)
6736 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006737 orig_reader = reader
6738 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006739 obj.xid = reader.read("!L")[0]
6740 _stats_type = reader.read("!H")[0]
6741 assert(_stats_type == 4)
6742 obj.flags = reader.read("!H")[0]
6743 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006744 reader.skip(6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006745 return obj
6746
6747 def __eq__(self, other):
6748 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006749 if self.xid != other.xid: return False
6750 if self.flags != other.flags: return False
6751 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006752 return True
6753
Rich Laneb658ddd2013-03-12 10:15:10 -07006754 def pretty_print(self, q):
6755 q.text("port_stats_request {")
6756 with q.group():
6757 with q.indent(2):
6758 q.breakable()
6759 q.text("xid = ");
6760 if self.xid != None:
6761 q.text("%#x" % self.xid)
6762 else:
6763 q.text('None')
6764 q.text(","); q.breakable()
6765 q.text("flags = ");
6766 q.text("%#x" % self.flags)
6767 q.text(","); q.breakable()
6768 q.text("port_no = ");
6769 q.text(util.pretty_port(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006770 q.breakable()
6771 q.text('}')
6772
Rich Lane7dcdf022013-12-11 14:45:27 -08006773stats_request.subtypes[4] = port_stats_request
6774
6775class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006776 version = 1
6777 type = 12
Rich Laneb658ddd2013-03-12 10:15:10 -07006778
Rich Lanec2ee4b82013-04-24 17:12:38 -07006779 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006780 if xid != None:
6781 self.xid = xid
6782 else:
6783 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006784 if reason != None:
6785 self.reason = reason
6786 else:
6787 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006788 if desc != None:
6789 self.desc = desc
6790 else:
6791 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006792 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006793
6794 def pack(self):
6795 packed = []
6796 packed.append(struct.pack("!B", self.version))
6797 packed.append(struct.pack("!B", self.type))
6798 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6799 packed.append(struct.pack("!L", self.xid))
6800 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006801 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07006802 packed.append(self.desc.pack())
6803 length = sum([len(x) for x in packed])
6804 packed[2] = struct.pack("!H", length)
6805 return ''.join(packed)
6806
6807 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006808 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006809 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006810 _version = reader.read("!B")[0]
6811 assert(_version == 1)
6812 _type = reader.read("!B")[0]
6813 assert(_type == 12)
6814 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006815 orig_reader = reader
6816 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006817 obj.xid = reader.read("!L")[0]
6818 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006819 reader.skip(7)
6820 obj.desc = common.port_desc.unpack(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07006821 return obj
6822
6823 def __eq__(self, other):
6824 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006825 if self.xid != other.xid: return False
6826 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006827 if self.desc != other.desc: return False
6828 return True
6829
Rich Laneb658ddd2013-03-12 10:15:10 -07006830 def pretty_print(self, q):
6831 q.text("port_status {")
6832 with q.group():
6833 with q.indent(2):
6834 q.breakable()
6835 q.text("xid = ");
6836 if self.xid != None:
6837 q.text("%#x" % self.xid)
6838 else:
6839 q.text('None')
6840 q.text(","); q.breakable()
6841 q.text("reason = ");
6842 q.text("%#x" % self.reason)
6843 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006844 q.text("desc = ");
6845 q.pp(self.desc)
6846 q.breakable()
6847 q.text('}')
6848
Rich Lane7dcdf022013-12-11 14:45:27 -08006849message.subtypes[12] = port_status
6850
6851class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006852 version = 1
6853 type = 21
Rich Laneb658ddd2013-03-12 10:15:10 -07006854
Rich Lanec2ee4b82013-04-24 17:12:38 -07006855 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006856 if xid != None:
6857 self.xid = xid
6858 else:
6859 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006860 if port != None:
6861 self.port = port
6862 else:
6863 self.port = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006864 if queues != None:
6865 self.queues = queues
6866 else:
6867 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006868 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006869
6870 def pack(self):
6871 packed = []
6872 packed.append(struct.pack("!B", self.version))
6873 packed.append(struct.pack("!B", self.type))
6874 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6875 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006876 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006877 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006878 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Laneb658ddd2013-03-12 10:15:10 -07006879 length = sum([len(x) for x in packed])
6880 packed[2] = struct.pack("!H", length)
6881 return ''.join(packed)
6882
6883 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006884 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006885 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006886 _version = reader.read("!B")[0]
6887 assert(_version == 1)
6888 _type = reader.read("!B")[0]
6889 assert(_type == 21)
6890 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006891 orig_reader = reader
6892 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006893 obj.xid = reader.read("!L")[0]
6894 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006895 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006896 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006897 return obj
6898
6899 def __eq__(self, other):
6900 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006901 if self.xid != other.xid: return False
6902 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006903 if self.queues != other.queues: return False
6904 return True
6905
Rich Laneb658ddd2013-03-12 10:15:10 -07006906 def pretty_print(self, q):
6907 q.text("queue_get_config_reply {")
6908 with q.group():
6909 with q.indent(2):
6910 q.breakable()
6911 q.text("xid = ");
6912 if self.xid != None:
6913 q.text("%#x" % self.xid)
6914 else:
6915 q.text('None')
6916 q.text(","); q.breakable()
6917 q.text("port = ");
6918 q.text(util.pretty_port(self.port))
6919 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006920 q.text("queues = ");
6921 q.pp(self.queues)
6922 q.breakable()
6923 q.text('}')
6924
Rich Lane7dcdf022013-12-11 14:45:27 -08006925message.subtypes[21] = queue_get_config_reply
6926
6927class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006928 version = 1
6929 type = 20
Rich Laneb658ddd2013-03-12 10:15:10 -07006930
Rich Lanec2ee4b82013-04-24 17:12:38 -07006931 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006932 if xid != None:
6933 self.xid = xid
6934 else:
6935 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006936 if port != None:
6937 self.port = port
6938 else:
6939 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006940 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006941
6942 def pack(self):
6943 packed = []
6944 packed.append(struct.pack("!B", self.version))
6945 packed.append(struct.pack("!B", self.type))
6946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6947 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006948 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006949 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006950 length = sum([len(x) for x in packed])
6951 packed[2] = struct.pack("!H", length)
6952 return ''.join(packed)
6953
6954 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006955 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006956 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006957 _version = reader.read("!B")[0]
6958 assert(_version == 1)
6959 _type = reader.read("!B")[0]
6960 assert(_type == 20)
6961 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006962 orig_reader = reader
6963 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006964 obj.xid = reader.read("!L")[0]
6965 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006966 reader.skip(2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006967 return obj
6968
6969 def __eq__(self, other):
6970 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006971 if self.xid != other.xid: return False
6972 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006973 return True
6974
Rich Laneb658ddd2013-03-12 10:15:10 -07006975 def pretty_print(self, q):
6976 q.text("queue_get_config_request {")
6977 with q.group():
6978 with q.indent(2):
6979 q.breakable()
6980 q.text("xid = ");
6981 if self.xid != None:
6982 q.text("%#x" % self.xid)
6983 else:
6984 q.text('None')
6985 q.text(","); q.breakable()
6986 q.text("port = ");
6987 q.text(util.pretty_port(self.port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006988 q.breakable()
6989 q.text('}')
6990
Rich Lane7dcdf022013-12-11 14:45:27 -08006991message.subtypes[20] = queue_get_config_request
6992
6993class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006994 version = 1
6995 type = 1
6996 err_type = 5
6997
6998 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006999 if xid != None:
7000 self.xid = xid
7001 else:
7002 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007003 if code != None:
7004 self.code = code
7005 else:
7006 self.code = 0
7007 if data != None:
7008 self.data = data
7009 else:
7010 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007011 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007012
7013 def pack(self):
7014 packed = []
7015 packed.append(struct.pack("!B", self.version))
7016 packed.append(struct.pack("!B", self.type))
7017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7018 packed.append(struct.pack("!L", self.xid))
7019 packed.append(struct.pack("!H", self.err_type))
7020 packed.append(struct.pack("!H", self.code))
7021 packed.append(self.data)
7022 length = sum([len(x) for x in packed])
7023 packed[2] = struct.pack("!H", length)
7024 return ''.join(packed)
7025
7026 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007027 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007028 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007029 _version = reader.read("!B")[0]
7030 assert(_version == 1)
7031 _type = reader.read("!B")[0]
7032 assert(_type == 1)
7033 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007034 orig_reader = reader
7035 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007036 obj.xid = reader.read("!L")[0]
7037 _err_type = reader.read("!H")[0]
7038 assert(_err_type == 5)
7039 obj.code = reader.read("!H")[0]
7040 obj.data = str(reader.read_all())
7041 return obj
7042
7043 def __eq__(self, other):
7044 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007045 if self.xid != other.xid: return False
7046 if self.code != other.code: return False
7047 if self.data != other.data: return False
7048 return True
7049
Rich Lane6f4978c2013-10-20 21:33:52 -07007050 def pretty_print(self, q):
7051 q.text("queue_op_failed_error_msg {")
7052 with q.group():
7053 with q.indent(2):
7054 q.breakable()
7055 q.text("xid = ");
7056 if self.xid != None:
7057 q.text("%#x" % self.xid)
7058 else:
7059 q.text('None')
7060 q.text(","); q.breakable()
7061 q.text("code = ");
7062 q.text("%#x" % self.code)
7063 q.text(","); q.breakable()
7064 q.text("data = ");
7065 q.pp(self.data)
7066 q.breakable()
7067 q.text('}')
7068
Rich Lane7dcdf022013-12-11 14:45:27 -08007069error_msg.subtypes[5] = queue_op_failed_error_msg
7070
7071class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007072 version = 1
7073 type = 17
7074 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007075
7076 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007077 if xid != None:
7078 self.xid = xid
7079 else:
7080 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007081 if flags != None:
7082 self.flags = flags
7083 else:
7084 self.flags = 0
7085 if entries != None:
7086 self.entries = entries
7087 else:
7088 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007089 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007090
7091 def pack(self):
7092 packed = []
7093 packed.append(struct.pack("!B", self.version))
7094 packed.append(struct.pack("!B", self.type))
7095 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7096 packed.append(struct.pack("!L", self.xid))
7097 packed.append(struct.pack("!H", self.stats_type))
7098 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007099 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007100 length = sum([len(x) for x in packed])
7101 packed[2] = struct.pack("!H", length)
7102 return ''.join(packed)
7103
7104 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007105 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007106 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007107 _version = reader.read("!B")[0]
7108 assert(_version == 1)
7109 _type = reader.read("!B")[0]
7110 assert(_type == 17)
7111 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007112 orig_reader = reader
7113 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007114 obj.xid = reader.read("!L")[0]
7115 _stats_type = reader.read("!H")[0]
7116 assert(_stats_type == 5)
7117 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007118 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007119 return obj
7120
7121 def __eq__(self, other):
7122 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007123 if self.xid != other.xid: return False
7124 if self.flags != other.flags: return False
7125 if self.entries != other.entries: return False
7126 return True
7127
Rich Laneb658ddd2013-03-12 10:15:10 -07007128 def pretty_print(self, q):
7129 q.text("queue_stats_reply {")
7130 with q.group():
7131 with q.indent(2):
7132 q.breakable()
7133 q.text("xid = ");
7134 if self.xid != None:
7135 q.text("%#x" % self.xid)
7136 else:
7137 q.text('None')
7138 q.text(","); q.breakable()
7139 q.text("flags = ");
7140 q.text("%#x" % self.flags)
7141 q.text(","); q.breakable()
7142 q.text("entries = ");
7143 q.pp(self.entries)
7144 q.breakable()
7145 q.text('}')
7146
Rich Lane7dcdf022013-12-11 14:45:27 -08007147stats_reply.subtypes[5] = queue_stats_reply
7148
7149class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007150 version = 1
7151 type = 16
7152 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007153
Rich Lanec2ee4b82013-04-24 17:12:38 -07007154 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007155 if xid != None:
7156 self.xid = xid
7157 else:
7158 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007159 if flags != None:
7160 self.flags = flags
7161 else:
7162 self.flags = 0
7163 if port_no != None:
7164 self.port_no = port_no
7165 else:
7166 self.port_no = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007167 if queue_id != None:
7168 self.queue_id = queue_id
7169 else:
7170 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007171 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007172
7173 def pack(self):
7174 packed = []
7175 packed.append(struct.pack("!B", self.version))
7176 packed.append(struct.pack("!B", self.type))
7177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7178 packed.append(struct.pack("!L", self.xid))
7179 packed.append(struct.pack("!H", self.stats_type))
7180 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07007181 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007182 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07007183 packed.append(struct.pack("!L", self.queue_id))
7184 length = sum([len(x) for x in packed])
7185 packed[2] = struct.pack("!H", length)
7186 return ''.join(packed)
7187
7188 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007189 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007190 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007191 _version = reader.read("!B")[0]
7192 assert(_version == 1)
7193 _type = reader.read("!B")[0]
7194 assert(_type == 16)
7195 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007196 orig_reader = reader
7197 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007198 obj.xid = reader.read("!L")[0]
7199 _stats_type = reader.read("!H")[0]
7200 assert(_stats_type == 5)
7201 obj.flags = reader.read("!H")[0]
7202 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007203 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007204 obj.queue_id = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007205 return obj
7206
7207 def __eq__(self, other):
7208 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007209 if self.xid != other.xid: return False
7210 if self.flags != other.flags: return False
7211 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007212 if self.queue_id != other.queue_id: return False
7213 return True
7214
Rich Laneb658ddd2013-03-12 10:15:10 -07007215 def pretty_print(self, q):
7216 q.text("queue_stats_request {")
7217 with q.group():
7218 with q.indent(2):
7219 q.breakable()
7220 q.text("xid = ");
7221 if self.xid != None:
7222 q.text("%#x" % self.xid)
7223 else:
7224 q.text('None')
7225 q.text(","); q.breakable()
7226 q.text("flags = ");
7227 q.text("%#x" % self.flags)
7228 q.text(","); q.breakable()
7229 q.text("port_no = ");
7230 q.text(util.pretty_port(self.port_no))
7231 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007232 q.text("queue_id = ");
7233 q.text("%#x" % self.queue_id)
7234 q.breakable()
7235 q.text('}')
7236
Rich Lane7dcdf022013-12-11 14:45:27 -08007237stats_request.subtypes[5] = queue_stats_request
7238
7239class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007240 version = 1
7241 type = 9
Rich Laneb658ddd2013-03-12 10:15:10 -07007242
7243 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007244 if xid != None:
7245 self.xid = xid
7246 else:
7247 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007248 if flags != None:
7249 self.flags = flags
7250 else:
7251 self.flags = 0
7252 if miss_send_len != None:
7253 self.miss_send_len = miss_send_len
7254 else:
7255 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007256 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007257
7258 def pack(self):
7259 packed = []
7260 packed.append(struct.pack("!B", self.version))
7261 packed.append(struct.pack("!B", self.type))
7262 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7263 packed.append(struct.pack("!L", self.xid))
7264 packed.append(struct.pack("!H", self.flags))
7265 packed.append(struct.pack("!H", self.miss_send_len))
7266 length = sum([len(x) for x in packed])
7267 packed[2] = struct.pack("!H", length)
7268 return ''.join(packed)
7269
7270 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007271 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007272 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007273 _version = reader.read("!B")[0]
7274 assert(_version == 1)
7275 _type = reader.read("!B")[0]
7276 assert(_type == 9)
7277 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007278 orig_reader = reader
7279 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007280 obj.xid = reader.read("!L")[0]
7281 obj.flags = reader.read("!H")[0]
7282 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007283 return obj
7284
7285 def __eq__(self, other):
7286 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007287 if self.xid != other.xid: return False
7288 if self.flags != other.flags: return False
7289 if self.miss_send_len != other.miss_send_len: return False
7290 return True
7291
Rich Laneb658ddd2013-03-12 10:15:10 -07007292 def pretty_print(self, q):
7293 q.text("set_config {")
7294 with q.group():
7295 with q.indent(2):
7296 q.breakable()
7297 q.text("xid = ");
7298 if self.xid != None:
7299 q.text("%#x" % self.xid)
7300 else:
7301 q.text('None')
7302 q.text(","); q.breakable()
7303 q.text("flags = ");
7304 q.text("%#x" % self.flags)
7305 q.text(","); q.breakable()
7306 q.text("miss_send_len = ");
7307 q.text("%#x" % self.miss_send_len)
7308 q.breakable()
7309 q.text('}')
7310
Rich Lane7dcdf022013-12-11 14:45:27 -08007311message.subtypes[9] = set_config
7312
7313class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007314 version = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07007315 type = 22
7316
Rich Lanec2ee4b82013-04-24 17:12:38 -07007317 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007318 if xid != None:
7319 self.xid = xid
7320 else:
7321 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007322 if table_id != None:
7323 self.table_id = table_id
7324 else:
7325 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007326 if config != None:
7327 self.config = config
7328 else:
7329 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007330 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007331
7332 def pack(self):
7333 packed = []
7334 packed.append(struct.pack("!B", self.version))
7335 packed.append(struct.pack("!B", self.type))
7336 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7337 packed.append(struct.pack("!L", self.xid))
7338 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007339 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07007340 packed.append(struct.pack("!L", self.config))
7341 length = sum([len(x) for x in packed])
7342 packed[2] = struct.pack("!H", length)
7343 return ''.join(packed)
7344
7345 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007346 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007347 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007348 _version = reader.read("!B")[0]
7349 assert(_version == 1)
7350 _type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007351 assert(_type == 22)
Dan Talaycof6202252013-07-02 01:00:29 -07007352 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007353 orig_reader = reader
7354 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007355 obj.xid = reader.read("!L")[0]
7356 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007357 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007358 obj.config = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007359 return obj
7360
7361 def __eq__(self, other):
7362 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007363 if self.xid != other.xid: return False
7364 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007365 if self.config != other.config: return False
7366 return True
7367
Rich Laneb658ddd2013-03-12 10:15:10 -07007368 def pretty_print(self, q):
7369 q.text("table_mod {")
7370 with q.group():
7371 with q.indent(2):
7372 q.breakable()
7373 q.text("xid = ");
7374 if self.xid != None:
7375 q.text("%#x" % self.xid)
7376 else:
7377 q.text('None')
7378 q.text(","); q.breakable()
7379 q.text("table_id = ");
7380 q.text("%#x" % self.table_id)
7381 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007382 q.text("config = ");
7383 q.text("%#x" % self.config)
7384 q.breakable()
7385 q.text('}')
7386
Rich Lane7dcdf022013-12-11 14:45:27 -08007387message.subtypes[22] = table_mod
7388
7389class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007390 version = 1
7391 type = 17
7392 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007393
7394 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007395 if xid != None:
7396 self.xid = xid
7397 else:
7398 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007399 if flags != None:
7400 self.flags = flags
7401 else:
7402 self.flags = 0
7403 if entries != None:
7404 self.entries = entries
7405 else:
7406 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007407 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007408
7409 def pack(self):
7410 packed = []
7411 packed.append(struct.pack("!B", self.version))
7412 packed.append(struct.pack("!B", self.type))
7413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7414 packed.append(struct.pack("!L", self.xid))
7415 packed.append(struct.pack("!H", self.stats_type))
7416 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007417 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007418 length = sum([len(x) for x in packed])
7419 packed[2] = struct.pack("!H", length)
7420 return ''.join(packed)
7421
7422 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007423 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007424 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007425 _version = reader.read("!B")[0]
7426 assert(_version == 1)
7427 _type = reader.read("!B")[0]
7428 assert(_type == 17)
7429 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007430 orig_reader = reader
7431 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007432 obj.xid = reader.read("!L")[0]
7433 _stats_type = reader.read("!H")[0]
7434 assert(_stats_type == 3)
7435 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007436 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007437 return obj
7438
7439 def __eq__(self, other):
7440 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007441 if self.xid != other.xid: return False
7442 if self.flags != other.flags: return False
7443 if self.entries != other.entries: return False
7444 return True
7445
Rich Laneb658ddd2013-03-12 10:15:10 -07007446 def pretty_print(self, q):
7447 q.text("table_stats_reply {")
7448 with q.group():
7449 with q.indent(2):
7450 q.breakable()
7451 q.text("xid = ");
7452 if self.xid != None:
7453 q.text("%#x" % self.xid)
7454 else:
7455 q.text('None')
7456 q.text(","); q.breakable()
7457 q.text("flags = ");
7458 q.text("%#x" % self.flags)
7459 q.text(","); q.breakable()
7460 q.text("entries = ");
7461 q.pp(self.entries)
7462 q.breakable()
7463 q.text('}')
7464
Rich Lane7dcdf022013-12-11 14:45:27 -08007465stats_reply.subtypes[3] = table_stats_reply
7466
7467class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007468 version = 1
7469 type = 16
7470 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007471
7472 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007473 if xid != None:
7474 self.xid = xid
7475 else:
7476 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007477 if flags != None:
7478 self.flags = flags
7479 else:
7480 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007481 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007482
7483 def pack(self):
7484 packed = []
7485 packed.append(struct.pack("!B", self.version))
7486 packed.append(struct.pack("!B", self.type))
7487 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7488 packed.append(struct.pack("!L", self.xid))
7489 packed.append(struct.pack("!H", self.stats_type))
7490 packed.append(struct.pack("!H", self.flags))
7491 length = sum([len(x) for x in packed])
7492 packed[2] = struct.pack("!H", length)
7493 return ''.join(packed)
7494
7495 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007496 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007497 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007498 _version = reader.read("!B")[0]
7499 assert(_version == 1)
7500 _type = reader.read("!B")[0]
7501 assert(_type == 16)
7502 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007503 orig_reader = reader
7504 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007505 obj.xid = reader.read("!L")[0]
7506 _stats_type = reader.read("!H")[0]
7507 assert(_stats_type == 3)
7508 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007509 return obj
7510
7511 def __eq__(self, other):
7512 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007513 if self.xid != other.xid: return False
7514 if self.flags != other.flags: return False
7515 return True
7516
Rich Laneb658ddd2013-03-12 10:15:10 -07007517 def pretty_print(self, q):
7518 q.text("table_stats_request {")
7519 with q.group():
7520 with q.indent(2):
7521 q.breakable()
7522 q.text("xid = ");
7523 if self.xid != None:
7524 q.text("%#x" % self.xid)
7525 else:
7526 q.text('None')
7527 q.text(","); q.breakable()
7528 q.text("flags = ");
7529 q.text("%#x" % self.flags)
7530 q.breakable()
7531 q.text('}')
7532
Rich Lane7dcdf022013-12-11 14:45:27 -08007533stats_request.subtypes[3] = table_stats_request
7534
Rich Laneb658ddd2013-03-12 10:15:10 -07007535
7536def parse_header(buf):
7537 if len(buf) < 8:
7538 raise loxi.ProtocolError("too short to be an OpenFlow message")
7539 return struct.unpack_from("!BBHL", buf)
7540
7541def parse_message(buf):
7542 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -07007543 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
7544 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Laneb658ddd2013-03-12 10:15:10 -07007545 if len(buf) != msg_len:
7546 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007547 return message.unpack(loxi.generic_util.OFReader(buf))