blob: eee4f6eb9e8e00e1248d8347ec909f1ac34b8454 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
10import loxi
11import const
Rich Lane7dcdf022013-12-11 14:45:27 -080012import action
Harshmeet Singh1db46332014-10-14 16:29:13 -070013import message
Rich Lane7dcdf022013-12-11 14:45:27 -080014import instruction
Harshmeet Singh1db46332014-10-14 16:29:13 -070015import common
Rich Lanec2ee4b82013-04-24 17:12:38 -070016import util
17import loxi.generic_util
18
Rich Lane7dcdf022013-12-11 14:45:27 -080019class message(loxi.OFObject):
20 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070021
Rich Lane95f7fc92014-01-27 17:08:16 -080022 version = 2
23
24 def __init__(self, type=None, xid=None):
25 if type != None:
26 self.type = type
27 else:
28 self.type = 0
29 if xid != None:
30 self.xid = xid
31 else:
32 self.xid = None
33 return
34
35 def pack(self):
36 packed = []
37 packed.append(struct.pack("!B", self.version))
38 packed.append(struct.pack("!B", self.type))
39 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
40 packed.append(struct.pack("!L", self.xid))
41 length = sum([len(x) for x in packed])
42 packed[2] = struct.pack("!H", length)
43 return ''.join(packed)
44
Rich Lane7dcdf022013-12-11 14:45:27 -080045 @staticmethod
46 def unpack(reader):
47 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080048 subclass = message.subtypes.get(subtype)
49 if subclass:
50 return subclass.unpack(reader)
51
52 obj = message()
53 _version = reader.read("!B")[0]
54 assert(_version == 2)
55 obj.type = reader.read("!B")[0]
56 _length = reader.read("!H")[0]
57 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080058 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080059 obj.xid = reader.read("!L")[0]
60 return obj
61
62 def __eq__(self, other):
63 if type(self) != type(other): return False
64 if self.type != other.type: return False
65 if self.xid != other.xid: return False
66 return True
67
68 def pretty_print(self, q):
69 q.text("message {")
70 with q.group():
71 with q.indent(2):
72 q.breakable()
73 q.text("xid = ");
74 if self.xid != None:
75 q.text("%#x" % self.xid)
76 else:
77 q.text('None')
78 q.breakable()
79 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080080
81
82class stats_reply(message):
83 subtypes = {}
84
Rich Lane95f7fc92014-01-27 17:08:16 -080085 version = 2
86 type = 19
87
88 def __init__(self, xid=None, stats_type=None, flags=None):
89 if xid != None:
90 self.xid = xid
91 else:
92 self.xid = None
93 if stats_type != None:
94 self.stats_type = stats_type
95 else:
96 self.stats_type = 0
97 if flags != None:
98 self.flags = flags
99 else:
100 self.flags = 0
101 return
102
103 def pack(self):
104 packed = []
105 packed.append(struct.pack("!B", self.version))
106 packed.append(struct.pack("!B", self.type))
107 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
108 packed.append(struct.pack("!L", self.xid))
109 packed.append(struct.pack("!H", self.stats_type))
110 packed.append(struct.pack("!H", self.flags))
111 packed.append('\x00' * 4)
112 length = sum([len(x) for x in packed])
113 packed[2] = struct.pack("!H", length)
114 return ''.join(packed)
115
Rich Lane7dcdf022013-12-11 14:45:27 -0800116 @staticmethod
117 def unpack(reader):
118 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800119 subclass = stats_reply.subtypes.get(subtype)
120 if subclass:
121 return subclass.unpack(reader)
122
123 obj = stats_reply()
124 _version = reader.read("!B")[0]
125 assert(_version == 2)
126 _type = reader.read("!B")[0]
127 assert(_type == 19)
128 _length = reader.read("!H")[0]
129 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800130 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800131 obj.xid = reader.read("!L")[0]
132 obj.stats_type = reader.read("!H")[0]
133 obj.flags = reader.read("!H")[0]
134 reader.skip(4)
135 return obj
136
137 def __eq__(self, other):
138 if type(self) != type(other): return False
139 if self.xid != other.xid: return False
140 if self.stats_type != other.stats_type: return False
141 if self.flags != other.flags: return False
142 return True
143
144 def pretty_print(self, q):
145 q.text("stats_reply {")
146 with q.group():
147 with q.indent(2):
148 q.breakable()
149 q.text("xid = ");
150 if self.xid != None:
151 q.text("%#x" % self.xid)
152 else:
153 q.text('None')
154 q.text(","); q.breakable()
155 q.text("flags = ");
156 q.text("%#x" % self.flags)
157 q.breakable()
158 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800159
160message.subtypes[19] = stats_reply
161
162class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700163 version = 2
164 type = 19
165 stats_type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -0700166
167 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800168 if xid != None:
169 self.xid = xid
170 else:
171 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700172 if flags != None:
173 self.flags = flags
174 else:
175 self.flags = 0
176 if packet_count != None:
177 self.packet_count = packet_count
178 else:
179 self.packet_count = 0
180 if byte_count != None:
181 self.byte_count = byte_count
182 else:
183 self.byte_count = 0
184 if flow_count != None:
185 self.flow_count = flow_count
186 else:
187 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800188 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700189
190 def pack(self):
191 packed = []
192 packed.append(struct.pack("!B", self.version))
193 packed.append(struct.pack("!B", self.type))
194 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
195 packed.append(struct.pack("!L", self.xid))
196 packed.append(struct.pack("!H", self.stats_type))
197 packed.append(struct.pack("!H", self.flags))
198 packed.append('\x00' * 4)
199 packed.append(struct.pack("!Q", self.packet_count))
200 packed.append(struct.pack("!Q", self.byte_count))
201 packed.append(struct.pack("!L", self.flow_count))
202 packed.append('\x00' * 4)
203 length = sum([len(x) for x in packed])
204 packed[2] = struct.pack("!H", length)
205 return ''.join(packed)
206
207 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800208 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700209 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700210 _version = reader.read("!B")[0]
211 assert(_version == 2)
212 _type = reader.read("!B")[0]
213 assert(_type == 19)
214 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800215 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800216 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700217 obj.xid = reader.read("!L")[0]
218 _stats_type = reader.read("!H")[0]
219 assert(_stats_type == 2)
220 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700221 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700222 obj.packet_count = reader.read("!Q")[0]
223 obj.byte_count = reader.read("!Q")[0]
224 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700225 reader.skip(4)
226 return obj
227
228 def __eq__(self, other):
229 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700230 if self.xid != other.xid: return False
231 if self.flags != other.flags: return False
232 if self.packet_count != other.packet_count: return False
233 if self.byte_count != other.byte_count: return False
234 if self.flow_count != other.flow_count: return False
235 return True
236
Rich Lanec2ee4b82013-04-24 17:12:38 -0700237 def pretty_print(self, q):
238 q.text("aggregate_stats_reply {")
239 with q.group():
240 with q.indent(2):
241 q.breakable()
242 q.text("xid = ");
243 if self.xid != None:
244 q.text("%#x" % self.xid)
245 else:
246 q.text('None')
247 q.text(","); q.breakable()
248 q.text("flags = ");
249 q.text("%#x" % self.flags)
250 q.text(","); q.breakable()
251 q.text("packet_count = ");
252 q.text("%#x" % self.packet_count)
253 q.text(","); q.breakable()
254 q.text("byte_count = ");
255 q.text("%#x" % self.byte_count)
256 q.text(","); q.breakable()
257 q.text("flow_count = ");
258 q.text("%#x" % self.flow_count)
259 q.breakable()
260 q.text('}')
261
Rich Lane7dcdf022013-12-11 14:45:27 -0800262stats_reply.subtypes[2] = aggregate_stats_reply
263
264class stats_request(message):
265 subtypes = {}
266
Rich Lane95f7fc92014-01-27 17:08:16 -0800267 version = 2
268 type = 18
269
270 def __init__(self, xid=None, stats_type=None, flags=None):
271 if xid != None:
272 self.xid = xid
273 else:
274 self.xid = None
275 if stats_type != None:
276 self.stats_type = stats_type
277 else:
278 self.stats_type = 0
279 if flags != None:
280 self.flags = flags
281 else:
282 self.flags = 0
283 return
284
285 def pack(self):
286 packed = []
287 packed.append(struct.pack("!B", self.version))
288 packed.append(struct.pack("!B", self.type))
289 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
290 packed.append(struct.pack("!L", self.xid))
291 packed.append(struct.pack("!H", self.stats_type))
292 packed.append(struct.pack("!H", self.flags))
293 packed.append('\x00' * 4)
294 length = sum([len(x) for x in packed])
295 packed[2] = struct.pack("!H", length)
296 return ''.join(packed)
297
Rich Lane7dcdf022013-12-11 14:45:27 -0800298 @staticmethod
299 def unpack(reader):
300 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800301 subclass = stats_request.subtypes.get(subtype)
302 if subclass:
303 return subclass.unpack(reader)
304
305 obj = stats_request()
306 _version = reader.read("!B")[0]
307 assert(_version == 2)
308 _type = reader.read("!B")[0]
309 assert(_type == 18)
310 _length = reader.read("!H")[0]
311 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800312 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800313 obj.xid = reader.read("!L")[0]
314 obj.stats_type = reader.read("!H")[0]
315 obj.flags = reader.read("!H")[0]
316 reader.skip(4)
317 return obj
318
319 def __eq__(self, other):
320 if type(self) != type(other): return False
321 if self.xid != other.xid: return False
322 if self.stats_type != other.stats_type: return False
323 if self.flags != other.flags: return False
324 return True
325
326 def pretty_print(self, q):
327 q.text("stats_request {")
328 with q.group():
329 with q.indent(2):
330 q.breakable()
331 q.text("xid = ");
332 if self.xid != None:
333 q.text("%#x" % self.xid)
334 else:
335 q.text('None')
336 q.text(","); q.breakable()
337 q.text("flags = ");
338 q.text("%#x" % self.flags)
339 q.breakable()
340 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800341
342message.subtypes[18] = stats_request
343
344class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700345 version = 2
346 type = 18
347 stats_type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -0700348
349 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800350 if xid != None:
351 self.xid = xid
352 else:
353 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700354 if flags != None:
355 self.flags = flags
356 else:
357 self.flags = 0
358 if table_id != None:
359 self.table_id = table_id
360 else:
361 self.table_id = 0
362 if out_port != None:
363 self.out_port = out_port
364 else:
365 self.out_port = 0
366 if out_group != None:
367 self.out_group = out_group
368 else:
369 self.out_group = 0
370 if cookie != None:
371 self.cookie = cookie
372 else:
373 self.cookie = 0
374 if cookie_mask != None:
375 self.cookie_mask = cookie_mask
376 else:
377 self.cookie_mask = 0
378 if match != None:
379 self.match = match
380 else:
381 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800382 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700383
384 def pack(self):
385 packed = []
386 packed.append(struct.pack("!B", self.version))
387 packed.append(struct.pack("!B", self.type))
388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
389 packed.append(struct.pack("!L", self.xid))
390 packed.append(struct.pack("!H", self.stats_type))
391 packed.append(struct.pack("!H", self.flags))
392 packed.append('\x00' * 4)
393 packed.append(struct.pack("!B", self.table_id))
394 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700395 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700396 packed.append(struct.pack("!L", self.out_group))
397 packed.append('\x00' * 4)
398 packed.append(struct.pack("!Q", self.cookie))
399 packed.append(struct.pack("!Q", self.cookie_mask))
400 packed.append(self.match.pack())
401 length = sum([len(x) for x in packed])
402 packed[2] = struct.pack("!H", length)
403 return ''.join(packed)
404
405 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800406 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700407 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700408 _version = reader.read("!B")[0]
409 assert(_version == 2)
410 _type = reader.read("!B")[0]
411 assert(_type == 18)
412 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800413 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800414 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700415 obj.xid = reader.read("!L")[0]
416 _stats_type = reader.read("!H")[0]
417 assert(_stats_type == 2)
418 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700419 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700420 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700421 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700422 obj.out_port = util.unpack_port_no(reader)
423 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700424 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700425 obj.cookie = reader.read("!Q")[0]
426 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700427 obj.match = common.match.unpack(reader)
428 return obj
429
430 def __eq__(self, other):
431 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700432 if self.xid != other.xid: return False
433 if self.flags != other.flags: return False
434 if self.table_id != other.table_id: return False
435 if self.out_port != other.out_port: return False
436 if self.out_group != other.out_group: return False
437 if self.cookie != other.cookie: return False
438 if self.cookie_mask != other.cookie_mask: return False
439 if self.match != other.match: return False
440 return True
441
Rich Lanec2ee4b82013-04-24 17:12:38 -0700442 def pretty_print(self, q):
443 q.text("aggregate_stats_request {")
444 with q.group():
445 with q.indent(2):
446 q.breakable()
447 q.text("xid = ");
448 if self.xid != None:
449 q.text("%#x" % self.xid)
450 else:
451 q.text('None')
452 q.text(","); q.breakable()
453 q.text("flags = ");
454 q.text("%#x" % self.flags)
455 q.text(","); q.breakable()
456 q.text("table_id = ");
457 q.text("%#x" % self.table_id)
458 q.text(","); q.breakable()
459 q.text("out_port = ");
460 q.text(util.pretty_port(self.out_port))
461 q.text(","); q.breakable()
462 q.text("out_group = ");
463 q.text("%#x" % self.out_group)
464 q.text(","); q.breakable()
465 q.text("cookie = ");
466 q.text("%#x" % self.cookie)
467 q.text(","); q.breakable()
468 q.text("cookie_mask = ");
469 q.text("%#x" % self.cookie_mask)
470 q.text(","); q.breakable()
471 q.text("match = ");
472 q.pp(self.match)
473 q.breakable()
474 q.text('}')
475
Rich Lane7dcdf022013-12-11 14:45:27 -0800476stats_request.subtypes[2] = aggregate_stats_request
477
478class error_msg(message):
479 subtypes = {}
480
Rich Lane95f7fc92014-01-27 17:08:16 -0800481 version = 2
482 type = 1
483
484 def __init__(self, xid=None, err_type=None):
485 if xid != None:
486 self.xid = xid
487 else:
488 self.xid = None
489 if err_type != None:
490 self.err_type = err_type
491 else:
492 self.err_type = 0
493 return
494
495 def pack(self):
496 packed = []
497 packed.append(struct.pack("!B", self.version))
498 packed.append(struct.pack("!B", self.type))
499 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
500 packed.append(struct.pack("!L", self.xid))
501 packed.append(struct.pack("!H", self.err_type))
502 length = sum([len(x) for x in packed])
503 packed[2] = struct.pack("!H", length)
504 return ''.join(packed)
505
Rich Lane7dcdf022013-12-11 14:45:27 -0800506 @staticmethod
507 def unpack(reader):
508 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800509 subclass = error_msg.subtypes.get(subtype)
510 if subclass:
511 return subclass.unpack(reader)
512
513 obj = error_msg()
514 _version = reader.read("!B")[0]
515 assert(_version == 2)
516 _type = reader.read("!B")[0]
517 assert(_type == 1)
518 _length = reader.read("!H")[0]
519 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800520 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800521 obj.xid = reader.read("!L")[0]
522 obj.err_type = reader.read("!H")[0]
523 return obj
524
525 def __eq__(self, other):
526 if type(self) != type(other): return False
527 if self.xid != other.xid: return False
528 if self.err_type != other.err_type: return False
529 return True
530
531 def pretty_print(self, q):
532 q.text("error_msg {")
533 with q.group():
534 with q.indent(2):
535 q.breakable()
536 q.text("xid = ");
537 if self.xid != None:
538 q.text("%#x" % self.xid)
539 else:
540 q.text('None')
541 q.breakable()
542 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800543
544message.subtypes[1] = error_msg
545
546class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700547 version = 2
548 type = 1
549 err_type = 2
550
551 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800552 if xid != None:
553 self.xid = xid
554 else:
555 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700556 if code != None:
557 self.code = code
558 else:
559 self.code = 0
560 if data != None:
561 self.data = data
562 else:
563 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800564 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700565
566 def pack(self):
567 packed = []
568 packed.append(struct.pack("!B", self.version))
569 packed.append(struct.pack("!B", self.type))
570 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
571 packed.append(struct.pack("!L", self.xid))
572 packed.append(struct.pack("!H", self.err_type))
573 packed.append(struct.pack("!H", self.code))
574 packed.append(self.data)
575 length = sum([len(x) for x in packed])
576 packed[2] = struct.pack("!H", length)
577 return ''.join(packed)
578
579 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800580 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700581 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700582 _version = reader.read("!B")[0]
583 assert(_version == 2)
584 _type = reader.read("!B")[0]
585 assert(_type == 1)
586 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800587 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800588 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700589 obj.xid = reader.read("!L")[0]
590 _err_type = reader.read("!H")[0]
591 assert(_err_type == 2)
592 obj.code = reader.read("!H")[0]
593 obj.data = str(reader.read_all())
594 return obj
595
596 def __eq__(self, other):
597 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700598 if self.xid != other.xid: return False
599 if self.code != other.code: return False
600 if self.data != other.data: return False
601 return True
602
Rich Lane6f4978c2013-10-20 21:33:52 -0700603 def pretty_print(self, q):
604 q.text("bad_action_error_msg {")
605 with q.group():
606 with q.indent(2):
607 q.breakable()
608 q.text("xid = ");
609 if self.xid != None:
610 q.text("%#x" % self.xid)
611 else:
612 q.text('None')
613 q.text(","); q.breakable()
614 q.text("code = ");
615 q.text("%#x" % self.code)
616 q.text(","); q.breakable()
617 q.text("data = ");
618 q.pp(self.data)
619 q.breakable()
620 q.text('}')
621
Rich Lane7dcdf022013-12-11 14:45:27 -0800622error_msg.subtypes[2] = bad_action_error_msg
623
624class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700625 version = 2
626 type = 1
627 err_type = 3
628
629 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800630 if xid != None:
631 self.xid = xid
632 else:
633 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700634 if code != None:
635 self.code = code
636 else:
637 self.code = 0
638 if data != None:
639 self.data = data
640 else:
641 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800642 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700643
644 def pack(self):
645 packed = []
646 packed.append(struct.pack("!B", self.version))
647 packed.append(struct.pack("!B", self.type))
648 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
649 packed.append(struct.pack("!L", self.xid))
650 packed.append(struct.pack("!H", self.err_type))
651 packed.append(struct.pack("!H", self.code))
652 packed.append(self.data)
653 length = sum([len(x) for x in packed])
654 packed[2] = struct.pack("!H", length)
655 return ''.join(packed)
656
657 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800658 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700659 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700660 _version = reader.read("!B")[0]
661 assert(_version == 2)
662 _type = reader.read("!B")[0]
663 assert(_type == 1)
664 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800665 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800666 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700667 obj.xid = reader.read("!L")[0]
668 _err_type = reader.read("!H")[0]
669 assert(_err_type == 3)
670 obj.code = reader.read("!H")[0]
671 obj.data = str(reader.read_all())
672 return obj
673
674 def __eq__(self, other):
675 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700676 if self.xid != other.xid: return False
677 if self.code != other.code: return False
678 if self.data != other.data: return False
679 return True
680
Rich Lane6f4978c2013-10-20 21:33:52 -0700681 def pretty_print(self, q):
682 q.text("bad_instruction_error_msg {")
683 with q.group():
684 with q.indent(2):
685 q.breakable()
686 q.text("xid = ");
687 if self.xid != None:
688 q.text("%#x" % self.xid)
689 else:
690 q.text('None')
691 q.text(","); q.breakable()
692 q.text("code = ");
693 q.text("%#x" % self.code)
694 q.text(","); q.breakable()
695 q.text("data = ");
696 q.pp(self.data)
697 q.breakable()
698 q.text('}')
699
Rich Lane7dcdf022013-12-11 14:45:27 -0800700error_msg.subtypes[3] = bad_instruction_error_msg
701
702class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700703 version = 2
704 type = 1
705 err_type = 4
706
707 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800708 if xid != None:
709 self.xid = xid
710 else:
711 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700712 if code != None:
713 self.code = code
714 else:
715 self.code = 0
716 if data != None:
717 self.data = data
718 else:
719 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800720 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700721
722 def pack(self):
723 packed = []
724 packed.append(struct.pack("!B", self.version))
725 packed.append(struct.pack("!B", self.type))
726 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
727 packed.append(struct.pack("!L", self.xid))
728 packed.append(struct.pack("!H", self.err_type))
729 packed.append(struct.pack("!H", self.code))
730 packed.append(self.data)
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 Lane6f4978c2013-10-20 21:33:52 -0700737 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700738 _version = reader.read("!B")[0]
739 assert(_version == 2)
740 _type = reader.read("!B")[0]
741 assert(_type == 1)
742 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800743 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800744 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700745 obj.xid = reader.read("!L")[0]
746 _err_type = reader.read("!H")[0]
747 assert(_err_type == 4)
748 obj.code = reader.read("!H")[0]
749 obj.data = str(reader.read_all())
750 return obj
751
752 def __eq__(self, other):
753 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700754 if self.xid != other.xid: return False
755 if self.code != other.code: return False
756 if self.data != other.data: return False
757 return True
758
Rich Lane6f4978c2013-10-20 21:33:52 -0700759 def pretty_print(self, q):
760 q.text("bad_match_error_msg {")
761 with q.group():
762 with q.indent(2):
763 q.breakable()
764 q.text("xid = ");
765 if self.xid != None:
766 q.text("%#x" % self.xid)
767 else:
768 q.text('None')
769 q.text(","); q.breakable()
770 q.text("code = ");
771 q.text("%#x" % self.code)
772 q.text(","); q.breakable()
773 q.text("data = ");
774 q.pp(self.data)
775 q.breakable()
776 q.text('}')
777
Rich Lane7dcdf022013-12-11 14:45:27 -0800778error_msg.subtypes[4] = bad_match_error_msg
779
780class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700781 version = 2
782 type = 1
783 err_type = 1
784
785 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800786 if xid != None:
787 self.xid = xid
788 else:
789 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700790 if code != None:
791 self.code = code
792 else:
793 self.code = 0
794 if data != None:
795 self.data = data
796 else:
797 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800798 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700799
800 def pack(self):
801 packed = []
802 packed.append(struct.pack("!B", self.version))
803 packed.append(struct.pack("!B", self.type))
804 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
805 packed.append(struct.pack("!L", self.xid))
806 packed.append(struct.pack("!H", self.err_type))
807 packed.append(struct.pack("!H", self.code))
808 packed.append(self.data)
809 length = sum([len(x) for x in packed])
810 packed[2] = struct.pack("!H", length)
811 return ''.join(packed)
812
813 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800814 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700815 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700816 _version = reader.read("!B")[0]
817 assert(_version == 2)
818 _type = reader.read("!B")[0]
819 assert(_type == 1)
820 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800821 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800822 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700823 obj.xid = reader.read("!L")[0]
824 _err_type = reader.read("!H")[0]
825 assert(_err_type == 1)
826 obj.code = reader.read("!H")[0]
827 obj.data = str(reader.read_all())
828 return obj
829
830 def __eq__(self, other):
831 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700832 if self.xid != other.xid: return False
833 if self.code != other.code: return False
834 if self.data != other.data: return False
835 return True
836
Rich Lane6f4978c2013-10-20 21:33:52 -0700837 def pretty_print(self, q):
838 q.text("bad_request_error_msg {")
839 with q.group():
840 with q.indent(2):
841 q.breakable()
842 q.text("xid = ");
843 if self.xid != None:
844 q.text("%#x" % self.xid)
845 else:
846 q.text('None')
847 q.text(","); q.breakable()
848 q.text("code = ");
849 q.text("%#x" % self.code)
850 q.text(","); q.breakable()
851 q.text("data = ");
852 q.pp(self.data)
853 q.breakable()
854 q.text('}')
855
Rich Lane7dcdf022013-12-11 14:45:27 -0800856error_msg.subtypes[1] = bad_request_error_msg
857
858class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700859 version = 2
860 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -0700861
862 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800863 if xid != None:
864 self.xid = xid
865 else:
866 self.xid = None
867 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700868
869 def pack(self):
870 packed = []
871 packed.append(struct.pack("!B", self.version))
872 packed.append(struct.pack("!B", self.type))
873 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
874 packed.append(struct.pack("!L", self.xid))
875 length = sum([len(x) for x in packed])
876 packed[2] = struct.pack("!H", length)
877 return ''.join(packed)
878
879 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800880 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700881 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700882 _version = reader.read("!B")[0]
883 assert(_version == 2)
884 _type = reader.read("!B")[0]
885 assert(_type == 21)
886 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800887 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800888 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700889 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700890 return obj
891
892 def __eq__(self, other):
893 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700894 if self.xid != other.xid: return False
895 return True
896
Rich Lanec2ee4b82013-04-24 17:12:38 -0700897 def pretty_print(self, q):
898 q.text("barrier_reply {")
899 with q.group():
900 with q.indent(2):
901 q.breakable()
902 q.text("xid = ");
903 if self.xid != None:
904 q.text("%#x" % self.xid)
905 else:
906 q.text('None')
907 q.breakable()
908 q.text('}')
909
Rich Lane7dcdf022013-12-11 14:45:27 -0800910message.subtypes[21] = barrier_reply
911
912class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700913 version = 2
914 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700915
916 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800917 if xid != None:
918 self.xid = xid
919 else:
920 self.xid = None
921 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700922
923 def pack(self):
924 packed = []
925 packed.append(struct.pack("!B", self.version))
926 packed.append(struct.pack("!B", self.type))
927 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
928 packed.append(struct.pack("!L", self.xid))
929 length = sum([len(x) for x in packed])
930 packed[2] = struct.pack("!H", length)
931 return ''.join(packed)
932
933 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800934 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700935 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700936 _version = reader.read("!B")[0]
937 assert(_version == 2)
938 _type = reader.read("!B")[0]
939 assert(_type == 20)
940 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800941 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800942 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700943 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700944 return obj
945
946 def __eq__(self, other):
947 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700948 if self.xid != other.xid: return False
949 return True
950
Rich Lanec2ee4b82013-04-24 17:12:38 -0700951 def pretty_print(self, q):
952 q.text("barrier_request {")
953 with q.group():
954 with q.indent(2):
955 q.breakable()
956 q.text("xid = ");
957 if self.xid != None:
958 q.text("%#x" % self.xid)
959 else:
960 q.text('None')
961 q.breakable()
962 q.text('}')
963
Rich Lane7dcdf022013-12-11 14:45:27 -0800964message.subtypes[20] = barrier_request
965
966class experimenter(message):
967 subtypes = {}
968
Rich Lane95f7fc92014-01-27 17:08:16 -0800969 version = 2
970 type = 4
971
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700972 def __init__(self, xid=None, experimenter=None, data=None):
Rich Lane95f7fc92014-01-27 17:08:16 -0800973 if xid != None:
974 self.xid = xid
975 else:
976 self.xid = None
977 if experimenter != None:
978 self.experimenter = experimenter
979 else:
980 self.experimenter = 0
Rich Lane95f7fc92014-01-27 17:08:16 -0800981 if data != None:
982 self.data = data
983 else:
984 self.data = ''
985 return
986
987 def pack(self):
988 packed = []
989 packed.append(struct.pack("!B", self.version))
990 packed.append(struct.pack("!B", self.type))
991 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
992 packed.append(struct.pack("!L", self.xid))
993 packed.append(struct.pack("!L", self.experimenter))
Rich Lane95f7fc92014-01-27 17:08:16 -0800994 packed.append(self.data)
995 length = sum([len(x) for x in packed])
996 packed[2] = struct.pack("!H", length)
997 return ''.join(packed)
998
Rich Lane7dcdf022013-12-11 14:45:27 -0800999 @staticmethod
1000 def unpack(reader):
1001 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001002 subclass = experimenter.subtypes.get(subtype)
1003 if subclass:
1004 return subclass.unpack(reader)
1005
1006 obj = experimenter()
1007 _version = reader.read("!B")[0]
1008 assert(_version == 2)
1009 _type = reader.read("!B")[0]
1010 assert(_type == 4)
1011 _length = reader.read("!H")[0]
1012 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001013 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001014 obj.xid = reader.read("!L")[0]
1015 obj.experimenter = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -08001016 obj.data = str(reader.read_all())
1017 return obj
1018
1019 def __eq__(self, other):
1020 if type(self) != type(other): return False
1021 if self.xid != other.xid: return False
1022 if self.experimenter != other.experimenter: return False
Rich Lane95f7fc92014-01-27 17:08:16 -08001023 if self.data != other.data: return False
1024 return True
1025
1026 def pretty_print(self, q):
1027 q.text("experimenter {")
1028 with q.group():
1029 with q.indent(2):
1030 q.breakable()
1031 q.text("xid = ");
1032 if self.xid != None:
1033 q.text("%#x" % self.xid)
1034 else:
1035 q.text('None')
1036 q.text(","); q.breakable()
Rich Lane95f7fc92014-01-27 17:08:16 -08001037 q.text("data = ");
1038 q.pp(self.data)
1039 q.breakable()
1040 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001041
1042message.subtypes[4] = experimenter
1043
1044class bsn_header(experimenter):
1045 subtypes = {}
1046
Rich Lane95f7fc92014-01-27 17:08:16 -08001047 version = 2
1048 type = 4
1049 experimenter = 6035143
1050
1051 def __init__(self, xid=None, subtype=None):
1052 if xid != None:
1053 self.xid = xid
1054 else:
1055 self.xid = None
1056 if subtype != None:
1057 self.subtype = subtype
1058 else:
1059 self.subtype = 0
1060 return
1061
1062 def pack(self):
1063 packed = []
1064 packed.append(struct.pack("!B", self.version))
1065 packed.append(struct.pack("!B", self.type))
1066 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1067 packed.append(struct.pack("!L", self.xid))
1068 packed.append(struct.pack("!L", self.experimenter))
1069 packed.append(struct.pack("!L", self.subtype))
1070 length = sum([len(x) for x in packed])
1071 packed[2] = struct.pack("!H", length)
1072 return ''.join(packed)
1073
Rich Lane7dcdf022013-12-11 14:45:27 -08001074 @staticmethod
1075 def unpack(reader):
1076 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001077 subclass = bsn_header.subtypes.get(subtype)
1078 if subclass:
1079 return subclass.unpack(reader)
1080
1081 obj = bsn_header()
1082 _version = reader.read("!B")[0]
1083 assert(_version == 2)
1084 _type = reader.read("!B")[0]
1085 assert(_type == 4)
1086 _length = reader.read("!H")[0]
1087 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001088 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001089 obj.xid = reader.read("!L")[0]
1090 _experimenter = reader.read("!L")[0]
1091 assert(_experimenter == 6035143)
1092 obj.subtype = reader.read("!L")[0]
1093 return obj
1094
1095 def __eq__(self, other):
1096 if type(self) != type(other): return False
1097 if self.xid != other.xid: return False
1098 if self.subtype != other.subtype: return False
1099 return True
1100
1101 def pretty_print(self, q):
1102 q.text("bsn_header {")
1103 with q.group():
1104 with q.indent(2):
1105 q.breakable()
1106 q.text("xid = ");
1107 if self.xid != None:
1108 q.text("%#x" % self.xid)
1109 else:
1110 q.text('None')
1111 q.breakable()
1112 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001113
1114experimenter.subtypes[6035143] = bsn_header
1115
1116class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001117 version = 2
1118 type = 4
1119 experimenter = 6035143
1120 subtype = 22
1121
1122 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001123 if xid != None:
1124 self.xid = xid
1125 else:
1126 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001127 if status != None:
1128 self.status = status
1129 else:
1130 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001131 return
Dan Talaycof6202252013-07-02 01:00:29 -07001132
1133 def pack(self):
1134 packed = []
1135 packed.append(struct.pack("!B", self.version))
1136 packed.append(struct.pack("!B", self.type))
1137 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1138 packed.append(struct.pack("!L", self.xid))
1139 packed.append(struct.pack("!L", self.experimenter))
1140 packed.append(struct.pack("!L", self.subtype))
1141 packed.append(struct.pack("!L", self.status))
1142 length = sum([len(x) for x in packed])
1143 packed[2] = struct.pack("!H", length)
1144 return ''.join(packed)
1145
1146 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001147 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001148 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001149 _version = reader.read("!B")[0]
1150 assert(_version == 2)
1151 _type = reader.read("!B")[0]
1152 assert(_type == 4)
1153 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001154 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001155 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001156 obj.xid = reader.read("!L")[0]
1157 _experimenter = reader.read("!L")[0]
1158 assert(_experimenter == 6035143)
1159 _subtype = reader.read("!L")[0]
1160 assert(_subtype == 22)
1161 obj.status = reader.read("!L")[0]
1162 return obj
1163
1164 def __eq__(self, other):
1165 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001166 if self.xid != other.xid: return False
1167 if self.status != other.status: return False
1168 return True
1169
Dan Talaycof6202252013-07-02 01:00:29 -07001170 def pretty_print(self, q):
1171 q.text("bsn_bw_clear_data_reply {")
1172 with q.group():
1173 with q.indent(2):
1174 q.breakable()
1175 q.text("xid = ");
1176 if self.xid != None:
1177 q.text("%#x" % self.xid)
1178 else:
1179 q.text('None')
1180 q.text(","); q.breakable()
1181 q.text("status = ");
1182 q.text("%#x" % self.status)
1183 q.breakable()
1184 q.text('}')
1185
Rich Lane7dcdf022013-12-11 14:45:27 -08001186bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1187
1188class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001189 version = 2
1190 type = 4
1191 experimenter = 6035143
1192 subtype = 21
1193
1194 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001195 if xid != None:
1196 self.xid = xid
1197 else:
1198 self.xid = None
1199 return
Dan Talaycof6202252013-07-02 01:00:29 -07001200
1201 def pack(self):
1202 packed = []
1203 packed.append(struct.pack("!B", self.version))
1204 packed.append(struct.pack("!B", self.type))
1205 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1206 packed.append(struct.pack("!L", self.xid))
1207 packed.append(struct.pack("!L", self.experimenter))
1208 packed.append(struct.pack("!L", self.subtype))
1209 length = sum([len(x) for x in packed])
1210 packed[2] = struct.pack("!H", length)
1211 return ''.join(packed)
1212
1213 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001214 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001215 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001216 _version = reader.read("!B")[0]
1217 assert(_version == 2)
1218 _type = reader.read("!B")[0]
1219 assert(_type == 4)
1220 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001221 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001222 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001223 obj.xid = reader.read("!L")[0]
1224 _experimenter = reader.read("!L")[0]
1225 assert(_experimenter == 6035143)
1226 _subtype = reader.read("!L")[0]
1227 assert(_subtype == 21)
1228 return obj
1229
1230 def __eq__(self, other):
1231 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001232 if self.xid != other.xid: return False
1233 return True
1234
Dan Talaycof6202252013-07-02 01:00:29 -07001235 def pretty_print(self, q):
1236 q.text("bsn_bw_clear_data_request {")
1237 with q.group():
1238 with q.indent(2):
1239 q.breakable()
1240 q.text("xid = ");
1241 if self.xid != None:
1242 q.text("%#x" % self.xid)
1243 else:
1244 q.text('None')
1245 q.breakable()
1246 q.text('}')
1247
Rich Lane7dcdf022013-12-11 14:45:27 -08001248bsn_header.subtypes[21] = bsn_bw_clear_data_request
1249
1250class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001251 version = 2
1252 type = 4
1253 experimenter = 6035143
1254 subtype = 20
1255
1256 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001257 if xid != None:
1258 self.xid = xid
1259 else:
1260 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001261 if enabled != None:
1262 self.enabled = enabled
1263 else:
1264 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001265 return
Dan Talaycof6202252013-07-02 01:00:29 -07001266
1267 def pack(self):
1268 packed = []
1269 packed.append(struct.pack("!B", self.version))
1270 packed.append(struct.pack("!B", self.type))
1271 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1272 packed.append(struct.pack("!L", self.xid))
1273 packed.append(struct.pack("!L", self.experimenter))
1274 packed.append(struct.pack("!L", self.subtype))
1275 packed.append(struct.pack("!L", self.enabled))
1276 length = sum([len(x) for x in packed])
1277 packed[2] = struct.pack("!H", length)
1278 return ''.join(packed)
1279
1280 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001281 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001282 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001283 _version = reader.read("!B")[0]
1284 assert(_version == 2)
1285 _type = reader.read("!B")[0]
1286 assert(_type == 4)
1287 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001288 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001289 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001290 obj.xid = reader.read("!L")[0]
1291 _experimenter = reader.read("!L")[0]
1292 assert(_experimenter == 6035143)
1293 _subtype = reader.read("!L")[0]
1294 assert(_subtype == 20)
1295 obj.enabled = reader.read("!L")[0]
1296 return obj
1297
1298 def __eq__(self, other):
1299 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001300 if self.xid != other.xid: return False
1301 if self.enabled != other.enabled: return False
1302 return True
1303
Dan Talaycof6202252013-07-02 01:00:29 -07001304 def pretty_print(self, q):
1305 q.text("bsn_bw_enable_get_reply {")
1306 with q.group():
1307 with q.indent(2):
1308 q.breakable()
1309 q.text("xid = ");
1310 if self.xid != None:
1311 q.text("%#x" % self.xid)
1312 else:
1313 q.text('None')
1314 q.text(","); q.breakable()
1315 q.text("enabled = ");
1316 q.text("%#x" % self.enabled)
1317 q.breakable()
1318 q.text('}')
1319
Rich Lane7dcdf022013-12-11 14:45:27 -08001320bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1321
1322class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001323 version = 2
1324 type = 4
1325 experimenter = 6035143
1326 subtype = 19
1327
1328 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001329 if xid != None:
1330 self.xid = xid
1331 else:
1332 self.xid = None
1333 return
Dan Talaycof6202252013-07-02 01:00:29 -07001334
1335 def pack(self):
1336 packed = []
1337 packed.append(struct.pack("!B", self.version))
1338 packed.append(struct.pack("!B", self.type))
1339 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1340 packed.append(struct.pack("!L", self.xid))
1341 packed.append(struct.pack("!L", self.experimenter))
1342 packed.append(struct.pack("!L", self.subtype))
1343 length = sum([len(x) for x in packed])
1344 packed[2] = struct.pack("!H", length)
1345 return ''.join(packed)
1346
1347 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001348 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001349 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001350 _version = reader.read("!B")[0]
1351 assert(_version == 2)
1352 _type = reader.read("!B")[0]
1353 assert(_type == 4)
1354 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001355 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001356 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001357 obj.xid = reader.read("!L")[0]
1358 _experimenter = reader.read("!L")[0]
1359 assert(_experimenter == 6035143)
1360 _subtype = reader.read("!L")[0]
1361 assert(_subtype == 19)
1362 return obj
1363
1364 def __eq__(self, other):
1365 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001366 if self.xid != other.xid: return False
1367 return True
1368
Dan Talaycof6202252013-07-02 01:00:29 -07001369 def pretty_print(self, q):
1370 q.text("bsn_bw_enable_get_request {")
1371 with q.group():
1372 with q.indent(2):
1373 q.breakable()
1374 q.text("xid = ");
1375 if self.xid != None:
1376 q.text("%#x" % self.xid)
1377 else:
1378 q.text('None')
1379 q.breakable()
1380 q.text('}')
1381
Rich Lane7dcdf022013-12-11 14:45:27 -08001382bsn_header.subtypes[19] = bsn_bw_enable_get_request
1383
1384class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001385 version = 2
1386 type = 4
1387 experimenter = 6035143
1388 subtype = 23
1389
1390 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001391 if xid != None:
1392 self.xid = xid
1393 else:
1394 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001395 if enable != None:
1396 self.enable = enable
1397 else:
1398 self.enable = 0
1399 if status != None:
1400 self.status = status
1401 else:
1402 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001403 return
Dan Talaycof6202252013-07-02 01:00:29 -07001404
1405 def pack(self):
1406 packed = []
1407 packed.append(struct.pack("!B", self.version))
1408 packed.append(struct.pack("!B", self.type))
1409 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1410 packed.append(struct.pack("!L", self.xid))
1411 packed.append(struct.pack("!L", self.experimenter))
1412 packed.append(struct.pack("!L", self.subtype))
1413 packed.append(struct.pack("!L", self.enable))
1414 packed.append(struct.pack("!L", self.status))
1415 length = sum([len(x) for x in packed])
1416 packed[2] = struct.pack("!H", length)
1417 return ''.join(packed)
1418
1419 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001420 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001421 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001422 _version = reader.read("!B")[0]
1423 assert(_version == 2)
1424 _type = reader.read("!B")[0]
1425 assert(_type == 4)
1426 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001427 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001428 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001429 obj.xid = reader.read("!L")[0]
1430 _experimenter = reader.read("!L")[0]
1431 assert(_experimenter == 6035143)
1432 _subtype = reader.read("!L")[0]
1433 assert(_subtype == 23)
1434 obj.enable = reader.read("!L")[0]
1435 obj.status = reader.read("!L")[0]
1436 return obj
1437
1438 def __eq__(self, other):
1439 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001440 if self.xid != other.xid: return False
1441 if self.enable != other.enable: return False
1442 if self.status != other.status: return False
1443 return True
1444
Dan Talaycof6202252013-07-02 01:00:29 -07001445 def pretty_print(self, q):
1446 q.text("bsn_bw_enable_set_reply {")
1447 with q.group():
1448 with q.indent(2):
1449 q.breakable()
1450 q.text("xid = ");
1451 if self.xid != None:
1452 q.text("%#x" % self.xid)
1453 else:
1454 q.text('None')
1455 q.text(","); q.breakable()
1456 q.text("enable = ");
1457 q.text("%#x" % self.enable)
1458 q.text(","); q.breakable()
1459 q.text("status = ");
1460 q.text("%#x" % self.status)
1461 q.breakable()
1462 q.text('}')
1463
Rich Lane7dcdf022013-12-11 14:45:27 -08001464bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1465
1466class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001467 version = 2
1468 type = 4
1469 experimenter = 6035143
1470 subtype = 18
1471
1472 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001473 if xid != None:
1474 self.xid = xid
1475 else:
1476 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001477 if enable != None:
1478 self.enable = enable
1479 else:
1480 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001481 return
Dan Talaycof6202252013-07-02 01:00:29 -07001482
1483 def pack(self):
1484 packed = []
1485 packed.append(struct.pack("!B", self.version))
1486 packed.append(struct.pack("!B", self.type))
1487 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1488 packed.append(struct.pack("!L", self.xid))
1489 packed.append(struct.pack("!L", self.experimenter))
1490 packed.append(struct.pack("!L", self.subtype))
1491 packed.append(struct.pack("!L", self.enable))
1492 length = sum([len(x) for x in packed])
1493 packed[2] = struct.pack("!H", length)
1494 return ''.join(packed)
1495
1496 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001497 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001498 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001499 _version = reader.read("!B")[0]
1500 assert(_version == 2)
1501 _type = reader.read("!B")[0]
1502 assert(_type == 4)
1503 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001504 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001505 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001506 obj.xid = reader.read("!L")[0]
1507 _experimenter = reader.read("!L")[0]
1508 assert(_experimenter == 6035143)
1509 _subtype = reader.read("!L")[0]
1510 assert(_subtype == 18)
1511 obj.enable = reader.read("!L")[0]
1512 return obj
1513
1514 def __eq__(self, other):
1515 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001516 if self.xid != other.xid: return False
1517 if self.enable != other.enable: return False
1518 return True
1519
Dan Talaycof6202252013-07-02 01:00:29 -07001520 def pretty_print(self, q):
1521 q.text("bsn_bw_enable_set_request {")
1522 with q.group():
1523 with q.indent(2):
1524 q.breakable()
1525 q.text("xid = ");
1526 if self.xid != None:
1527 q.text("%#x" % self.xid)
1528 else:
1529 q.text('None')
1530 q.text(","); q.breakable()
1531 q.text("enable = ");
1532 q.text("%#x" % self.enable)
1533 q.breakable()
1534 q.text('}')
1535
Rich Lane7dcdf022013-12-11 14:45:27 -08001536bsn_header.subtypes[18] = bsn_bw_enable_set_request
1537
1538class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001539 version = 2
1540 type = 4
1541 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001542 subtype = 10
1543
1544 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001545 if xid != None:
1546 self.xid = xid
1547 else:
1548 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001549 if interfaces != None:
1550 self.interfaces = interfaces
1551 else:
1552 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001553 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001554
1555 def pack(self):
1556 packed = []
1557 packed.append(struct.pack("!B", self.version))
1558 packed.append(struct.pack("!B", self.type))
1559 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1560 packed.append(struct.pack("!L", self.xid))
1561 packed.append(struct.pack("!L", self.experimenter))
1562 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001563 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001564 length = sum([len(x) for x in packed])
1565 packed[2] = struct.pack("!H", length)
1566 return ''.join(packed)
1567
1568 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001569 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001570 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001571 _version = reader.read("!B")[0]
1572 assert(_version == 2)
1573 _type = reader.read("!B")[0]
1574 assert(_type == 4)
1575 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001576 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001577 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001578 obj.xid = reader.read("!L")[0]
1579 _experimenter = reader.read("!L")[0]
1580 assert(_experimenter == 6035143)
1581 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001582 assert(_subtype == 10)
1583 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
1584 return obj
1585
1586 def __eq__(self, other):
1587 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001588 if self.xid != other.xid: return False
1589 if self.interfaces != other.interfaces: return False
1590 return True
1591
Rich Lanec2ee4b82013-04-24 17:12:38 -07001592 def pretty_print(self, q):
1593 q.text("bsn_get_interfaces_reply {")
1594 with q.group():
1595 with q.indent(2):
1596 q.breakable()
1597 q.text("xid = ");
1598 if self.xid != None:
1599 q.text("%#x" % self.xid)
1600 else:
1601 q.text('None')
1602 q.text(","); q.breakable()
1603 q.text("interfaces = ");
1604 q.pp(self.interfaces)
1605 q.breakable()
1606 q.text('}')
1607
Rich Lane7dcdf022013-12-11 14:45:27 -08001608bsn_header.subtypes[10] = bsn_get_interfaces_reply
1609
1610class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001611 version = 2
1612 type = 4
1613 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001614 subtype = 9
1615
1616 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001617 if xid != None:
1618 self.xid = xid
1619 else:
1620 self.xid = None
1621 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001622
1623 def pack(self):
1624 packed = []
1625 packed.append(struct.pack("!B", self.version))
1626 packed.append(struct.pack("!B", self.type))
1627 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1628 packed.append(struct.pack("!L", self.xid))
1629 packed.append(struct.pack("!L", self.experimenter))
1630 packed.append(struct.pack("!L", self.subtype))
1631 length = sum([len(x) for x in packed])
1632 packed[2] = struct.pack("!H", length)
1633 return ''.join(packed)
1634
1635 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001636 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001637 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001638 _version = reader.read("!B")[0]
1639 assert(_version == 2)
1640 _type = reader.read("!B")[0]
1641 assert(_type == 4)
1642 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001643 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001644 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001645 obj.xid = reader.read("!L")[0]
1646 _experimenter = reader.read("!L")[0]
1647 assert(_experimenter == 6035143)
1648 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001649 assert(_subtype == 9)
1650 return obj
1651
1652 def __eq__(self, other):
1653 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001654 if self.xid != other.xid: return False
1655 return True
1656
Rich Lanec2ee4b82013-04-24 17:12:38 -07001657 def pretty_print(self, q):
1658 q.text("bsn_get_interfaces_request {")
1659 with q.group():
1660 with q.indent(2):
1661 q.breakable()
1662 q.text("xid = ");
1663 if self.xid != None:
1664 q.text("%#x" % self.xid)
1665 else:
1666 q.text('None')
1667 q.breakable()
1668 q.text('}')
1669
Rich Lane7dcdf022013-12-11 14:45:27 -08001670bsn_header.subtypes[9] = bsn_get_interfaces_request
1671
1672class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001673 version = 2
1674 type = 4
1675 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001676 subtype = 5
1677
1678 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001679 if xid != None:
1680 self.xid = xid
1681 else:
1682 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001683 if report_mirror_ports != None:
1684 self.report_mirror_ports = report_mirror_ports
1685 else:
1686 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001687 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001688
1689 def pack(self):
1690 packed = []
1691 packed.append(struct.pack("!B", self.version))
1692 packed.append(struct.pack("!B", self.type))
1693 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1694 packed.append(struct.pack("!L", self.xid))
1695 packed.append(struct.pack("!L", self.experimenter))
1696 packed.append(struct.pack("!L", self.subtype))
1697 packed.append(struct.pack("!B", self.report_mirror_ports))
1698 packed.append('\x00' * 3)
1699 length = sum([len(x) for x in packed])
1700 packed[2] = struct.pack("!H", length)
1701 return ''.join(packed)
1702
1703 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001704 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001705 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001706 _version = reader.read("!B")[0]
1707 assert(_version == 2)
1708 _type = reader.read("!B")[0]
1709 assert(_type == 4)
1710 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001711 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001712 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001713 obj.xid = reader.read("!L")[0]
1714 _experimenter = reader.read("!L")[0]
1715 assert(_experimenter == 6035143)
1716 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001717 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001718 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001719 reader.skip(3)
1720 return obj
1721
1722 def __eq__(self, other):
1723 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001724 if self.xid != other.xid: return False
1725 if self.report_mirror_ports != other.report_mirror_ports: return False
1726 return True
1727
Rich Lanec2ee4b82013-04-24 17:12:38 -07001728 def pretty_print(self, q):
1729 q.text("bsn_get_mirroring_reply {")
1730 with q.group():
1731 with q.indent(2):
1732 q.breakable()
1733 q.text("xid = ");
1734 if self.xid != None:
1735 q.text("%#x" % self.xid)
1736 else:
1737 q.text('None')
1738 q.text(","); q.breakable()
1739 q.text("report_mirror_ports = ");
1740 q.text("%#x" % self.report_mirror_ports)
1741 q.breakable()
1742 q.text('}')
1743
Rich Lane7dcdf022013-12-11 14:45:27 -08001744bsn_header.subtypes[5] = bsn_get_mirroring_reply
1745
1746class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001747 version = 2
1748 type = 4
1749 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001750 subtype = 4
1751
1752 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001753 if xid != None:
1754 self.xid = xid
1755 else:
1756 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001757 if report_mirror_ports != None:
1758 self.report_mirror_ports = report_mirror_ports
1759 else:
1760 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001761 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001762
1763 def pack(self):
1764 packed = []
1765 packed.append(struct.pack("!B", self.version))
1766 packed.append(struct.pack("!B", self.type))
1767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1768 packed.append(struct.pack("!L", self.xid))
1769 packed.append(struct.pack("!L", self.experimenter))
1770 packed.append(struct.pack("!L", self.subtype))
1771 packed.append(struct.pack("!B", self.report_mirror_ports))
1772 packed.append('\x00' * 3)
1773 length = sum([len(x) for x in packed])
1774 packed[2] = struct.pack("!H", length)
1775 return ''.join(packed)
1776
1777 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001778 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001779 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001780 _version = reader.read("!B")[0]
1781 assert(_version == 2)
1782 _type = reader.read("!B")[0]
1783 assert(_type == 4)
1784 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001785 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001786 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001787 obj.xid = reader.read("!L")[0]
1788 _experimenter = reader.read("!L")[0]
1789 assert(_experimenter == 6035143)
1790 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001791 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001792 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001793 reader.skip(3)
1794 return obj
1795
1796 def __eq__(self, other):
1797 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001798 if self.xid != other.xid: return False
1799 if self.report_mirror_ports != other.report_mirror_ports: return False
1800 return True
1801
Rich Lanec2ee4b82013-04-24 17:12:38 -07001802 def pretty_print(self, q):
1803 q.text("bsn_get_mirroring_request {")
1804 with q.group():
1805 with q.indent(2):
1806 q.breakable()
1807 q.text("xid = ");
1808 if self.xid != None:
1809 q.text("%#x" % self.xid)
1810 else:
1811 q.text('None')
1812 q.text(","); q.breakable()
1813 q.text("report_mirror_ports = ");
1814 q.text("%#x" % self.report_mirror_ports)
1815 q.breakable()
1816 q.text('}')
1817
Rich Lane7dcdf022013-12-11 14:45:27 -08001818bsn_header.subtypes[4] = bsn_get_mirroring_request
1819
1820class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001821 version = 2
1822 type = 4
1823 experimenter = 6035143
1824 subtype = 34
1825
Rich Lane7b0f2012013-11-22 14:15:26 -08001826 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001827 if xid != None:
1828 self.xid = xid
1829 else:
1830 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001831 if status != None:
1832 self.status = status
1833 else:
1834 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08001835 if port_no != None:
1836 self.port_no = port_no
1837 else:
1838 self.port_no = 0
1839 if slot_num != None:
1840 self.slot_num = slot_num
1841 else:
1842 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001843 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001844
1845 def pack(self):
1846 packed = []
1847 packed.append(struct.pack("!B", self.version))
1848 packed.append(struct.pack("!B", self.type))
1849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1850 packed.append(struct.pack("!L", self.xid))
1851 packed.append(struct.pack("!L", self.experimenter))
1852 packed.append(struct.pack("!L", self.subtype))
1853 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08001854 packed.append(util.pack_port_no(self.port_no))
1855 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07001856 length = sum([len(x) for x in packed])
1857 packed[2] = struct.pack("!H", length)
1858 return ''.join(packed)
1859
1860 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001861 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001862 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001863 _version = reader.read("!B")[0]
1864 assert(_version == 2)
1865 _type = reader.read("!B")[0]
1866 assert(_type == 4)
1867 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001868 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001869 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001870 obj.xid = reader.read("!L")[0]
1871 _experimenter = reader.read("!L")[0]
1872 assert(_experimenter == 6035143)
1873 _subtype = reader.read("!L")[0]
1874 assert(_subtype == 34)
1875 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08001876 obj.port_no = util.unpack_port_no(reader)
1877 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07001878 return obj
1879
1880 def __eq__(self, other):
1881 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001882 if self.xid != other.xid: return False
1883 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08001884 if self.port_no != other.port_no: return False
1885 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001886 return True
1887
Rich Lane6f4978c2013-10-20 21:33:52 -07001888 def pretty_print(self, q):
1889 q.text("bsn_pdu_rx_reply {")
1890 with q.group():
1891 with q.indent(2):
1892 q.breakable()
1893 q.text("xid = ");
1894 if self.xid != None:
1895 q.text("%#x" % self.xid)
1896 else:
1897 q.text('None')
1898 q.text(","); q.breakable()
1899 q.text("status = ");
1900 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08001901 q.text(","); q.breakable()
1902 q.text("port_no = ");
1903 q.text(util.pretty_port(self.port_no))
1904 q.text(","); q.breakable()
1905 q.text("slot_num = ");
1906 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07001907 q.breakable()
1908 q.text('}')
1909
Rich Lane7dcdf022013-12-11 14:45:27 -08001910bsn_header.subtypes[34] = bsn_pdu_rx_reply
1911
1912class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001913 version = 2
1914 type = 4
1915 experimenter = 6035143
1916 subtype = 33
1917
1918 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001919 if xid != None:
1920 self.xid = xid
1921 else:
1922 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001923 if timeout_ms != None:
1924 self.timeout_ms = timeout_ms
1925 else:
1926 self.timeout_ms = 0
1927 if port_no != None:
1928 self.port_no = port_no
1929 else:
1930 self.port_no = 0
1931 if slot_num != None:
1932 self.slot_num = slot_num
1933 else:
1934 self.slot_num = 0
1935 if data != None:
1936 self.data = data
1937 else:
1938 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001939 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001940
1941 def pack(self):
1942 packed = []
1943 packed.append(struct.pack("!B", self.version))
1944 packed.append(struct.pack("!B", self.type))
1945 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1946 packed.append(struct.pack("!L", self.xid))
1947 packed.append(struct.pack("!L", self.experimenter))
1948 packed.append(struct.pack("!L", self.subtype))
1949 packed.append(struct.pack("!L", self.timeout_ms))
1950 packed.append(util.pack_port_no(self.port_no))
1951 packed.append(struct.pack("!B", self.slot_num))
1952 packed.append('\x00' * 3)
1953 packed.append(self.data)
1954 length = sum([len(x) for x in packed])
1955 packed[2] = struct.pack("!H", length)
1956 return ''.join(packed)
1957
1958 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001959 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001960 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001961 _version = reader.read("!B")[0]
1962 assert(_version == 2)
1963 _type = reader.read("!B")[0]
1964 assert(_type == 4)
1965 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001967 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001968 obj.xid = reader.read("!L")[0]
1969 _experimenter = reader.read("!L")[0]
1970 assert(_experimenter == 6035143)
1971 _subtype = reader.read("!L")[0]
1972 assert(_subtype == 33)
1973 obj.timeout_ms = reader.read("!L")[0]
1974 obj.port_no = util.unpack_port_no(reader)
1975 obj.slot_num = reader.read("!B")[0]
1976 reader.skip(3)
1977 obj.data = str(reader.read_all())
1978 return obj
1979
1980 def __eq__(self, other):
1981 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001982 if self.xid != other.xid: return False
1983 if self.timeout_ms != other.timeout_ms: return False
1984 if self.port_no != other.port_no: return False
1985 if self.slot_num != other.slot_num: return False
1986 if self.data != other.data: return False
1987 return True
1988
Rich Lane6f4978c2013-10-20 21:33:52 -07001989 def pretty_print(self, q):
1990 q.text("bsn_pdu_rx_request {")
1991 with q.group():
1992 with q.indent(2):
1993 q.breakable()
1994 q.text("xid = ");
1995 if self.xid != None:
1996 q.text("%#x" % self.xid)
1997 else:
1998 q.text('None')
1999 q.text(","); q.breakable()
2000 q.text("timeout_ms = ");
2001 q.text("%#x" % self.timeout_ms)
2002 q.text(","); q.breakable()
2003 q.text("port_no = ");
2004 q.text(util.pretty_port(self.port_no))
2005 q.text(","); q.breakable()
2006 q.text("slot_num = ");
2007 q.text("%#x" % self.slot_num)
2008 q.text(","); q.breakable()
2009 q.text("data = ");
2010 q.pp(self.data)
2011 q.breakable()
2012 q.text('}')
2013
Rich Lane7dcdf022013-12-11 14:45:27 -08002014bsn_header.subtypes[33] = bsn_pdu_rx_request
2015
2016class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002017 version = 2
2018 type = 4
2019 experimenter = 6035143
2020 subtype = 35
2021
2022 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002023 if xid != None:
2024 self.xid = xid
2025 else:
2026 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002027 if port_no != None:
2028 self.port_no = port_no
2029 else:
2030 self.port_no = 0
2031 if slot_num != None:
2032 self.slot_num = slot_num
2033 else:
2034 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002035 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 packed.append(util.pack_port_no(self.port_no))
2046 packed.append(struct.pack("!B", self.slot_num))
2047 length = sum([len(x) for x in packed])
2048 packed[2] = struct.pack("!H", length)
2049 return ''.join(packed)
2050
2051 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002052 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002053 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002054 _version = reader.read("!B")[0]
2055 assert(_version == 2)
2056 _type = reader.read("!B")[0]
2057 assert(_type == 4)
2058 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002059 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002060 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002061 obj.xid = reader.read("!L")[0]
2062 _experimenter = reader.read("!L")[0]
2063 assert(_experimenter == 6035143)
2064 _subtype = reader.read("!L")[0]
2065 assert(_subtype == 35)
2066 obj.port_no = util.unpack_port_no(reader)
2067 obj.slot_num = reader.read("!B")[0]
2068 return obj
2069
2070 def __eq__(self, other):
2071 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002072 if self.xid != other.xid: return False
2073 if self.port_no != other.port_no: return False
2074 if self.slot_num != other.slot_num: return False
2075 return True
2076
Rich Lane6f4978c2013-10-20 21:33:52 -07002077 def pretty_print(self, q):
2078 q.text("bsn_pdu_rx_timeout {")
2079 with q.group():
2080 with q.indent(2):
2081 q.breakable()
2082 q.text("xid = ");
2083 if self.xid != None:
2084 q.text("%#x" % self.xid)
2085 else:
2086 q.text('None')
2087 q.text(","); q.breakable()
2088 q.text("port_no = ");
2089 q.text(util.pretty_port(self.port_no))
2090 q.text(","); q.breakable()
2091 q.text("slot_num = ");
2092 q.text("%#x" % self.slot_num)
2093 q.breakable()
2094 q.text('}')
2095
Rich Lane7dcdf022013-12-11 14:45:27 -08002096bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2097
2098class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002099 version = 2
2100 type = 4
2101 experimenter = 6035143
2102 subtype = 32
2103
Rich Lane7b0f2012013-11-22 14:15:26 -08002104 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002105 if xid != None:
2106 self.xid = xid
2107 else:
2108 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002109 if status != None:
2110 self.status = status
2111 else:
2112 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002113 if port_no != None:
2114 self.port_no = port_no
2115 else:
2116 self.port_no = 0
2117 if slot_num != None:
2118 self.slot_num = slot_num
2119 else:
2120 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002121 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002122
2123 def pack(self):
2124 packed = []
2125 packed.append(struct.pack("!B", self.version))
2126 packed.append(struct.pack("!B", self.type))
2127 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2128 packed.append(struct.pack("!L", self.xid))
2129 packed.append(struct.pack("!L", self.experimenter))
2130 packed.append(struct.pack("!L", self.subtype))
2131 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002132 packed.append(util.pack_port_no(self.port_no))
2133 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002134 length = sum([len(x) for x in packed])
2135 packed[2] = struct.pack("!H", length)
2136 return ''.join(packed)
2137
2138 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002139 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002140 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002141 _version = reader.read("!B")[0]
2142 assert(_version == 2)
2143 _type = reader.read("!B")[0]
2144 assert(_type == 4)
2145 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002147 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002148 obj.xid = reader.read("!L")[0]
2149 _experimenter = reader.read("!L")[0]
2150 assert(_experimenter == 6035143)
2151 _subtype = reader.read("!L")[0]
2152 assert(_subtype == 32)
2153 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002154 obj.port_no = util.unpack_port_no(reader)
2155 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002156 return obj
2157
2158 def __eq__(self, other):
2159 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002160 if self.xid != other.xid: return False
2161 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002162 if self.port_no != other.port_no: return False
2163 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002164 return True
2165
Rich Lane6f4978c2013-10-20 21:33:52 -07002166 def pretty_print(self, q):
2167 q.text("bsn_pdu_tx_reply {")
2168 with q.group():
2169 with q.indent(2):
2170 q.breakable()
2171 q.text("xid = ");
2172 if self.xid != None:
2173 q.text("%#x" % self.xid)
2174 else:
2175 q.text('None')
2176 q.text(","); q.breakable()
2177 q.text("status = ");
2178 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002179 q.text(","); q.breakable()
2180 q.text("port_no = ");
2181 q.text(util.pretty_port(self.port_no))
2182 q.text(","); q.breakable()
2183 q.text("slot_num = ");
2184 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002185 q.breakable()
2186 q.text('}')
2187
Rich Lane7dcdf022013-12-11 14:45:27 -08002188bsn_header.subtypes[32] = bsn_pdu_tx_reply
2189
2190class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002191 version = 2
2192 type = 4
2193 experimenter = 6035143
2194 subtype = 31
2195
2196 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002197 if xid != None:
2198 self.xid = xid
2199 else:
2200 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002201 if tx_interval_ms != None:
2202 self.tx_interval_ms = tx_interval_ms
2203 else:
2204 self.tx_interval_ms = 0
2205 if port_no != None:
2206 self.port_no = port_no
2207 else:
2208 self.port_no = 0
2209 if slot_num != None:
2210 self.slot_num = slot_num
2211 else:
2212 self.slot_num = 0
2213 if data != None:
2214 self.data = data
2215 else:
2216 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002217 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002218
2219 def pack(self):
2220 packed = []
2221 packed.append(struct.pack("!B", self.version))
2222 packed.append(struct.pack("!B", self.type))
2223 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2224 packed.append(struct.pack("!L", self.xid))
2225 packed.append(struct.pack("!L", self.experimenter))
2226 packed.append(struct.pack("!L", self.subtype))
2227 packed.append(struct.pack("!L", self.tx_interval_ms))
2228 packed.append(util.pack_port_no(self.port_no))
2229 packed.append(struct.pack("!B", self.slot_num))
2230 packed.append('\x00' * 3)
2231 packed.append(self.data)
2232 length = sum([len(x) for x in packed])
2233 packed[2] = struct.pack("!H", length)
2234 return ''.join(packed)
2235
2236 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002237 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002238 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002239 _version = reader.read("!B")[0]
2240 assert(_version == 2)
2241 _type = reader.read("!B")[0]
2242 assert(_type == 4)
2243 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002244 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002245 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002246 obj.xid = reader.read("!L")[0]
2247 _experimenter = reader.read("!L")[0]
2248 assert(_experimenter == 6035143)
2249 _subtype = reader.read("!L")[0]
2250 assert(_subtype == 31)
2251 obj.tx_interval_ms = reader.read("!L")[0]
2252 obj.port_no = util.unpack_port_no(reader)
2253 obj.slot_num = reader.read("!B")[0]
2254 reader.skip(3)
2255 obj.data = str(reader.read_all())
2256 return obj
2257
2258 def __eq__(self, other):
2259 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002260 if self.xid != other.xid: return False
2261 if self.tx_interval_ms != other.tx_interval_ms: return False
2262 if self.port_no != other.port_no: return False
2263 if self.slot_num != other.slot_num: return False
2264 if self.data != other.data: return False
2265 return True
2266
Rich Lane6f4978c2013-10-20 21:33:52 -07002267 def pretty_print(self, q):
2268 q.text("bsn_pdu_tx_request {")
2269 with q.group():
2270 with q.indent(2):
2271 q.breakable()
2272 q.text("xid = ");
2273 if self.xid != None:
2274 q.text("%#x" % self.xid)
2275 else:
2276 q.text('None')
2277 q.text(","); q.breakable()
2278 q.text("tx_interval_ms = ");
2279 q.text("%#x" % self.tx_interval_ms)
2280 q.text(","); q.breakable()
2281 q.text("port_no = ");
2282 q.text(util.pretty_port(self.port_no))
2283 q.text(","); q.breakable()
2284 q.text("slot_num = ");
2285 q.text("%#x" % self.slot_num)
2286 q.text(","); q.breakable()
2287 q.text("data = ");
2288 q.pp(self.data)
2289 q.breakable()
2290 q.text('}')
2291
Rich Lane7dcdf022013-12-11 14:45:27 -08002292bsn_header.subtypes[31] = bsn_pdu_tx_request
2293
2294class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002295 version = 2
2296 type = 4
2297 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002298 subtype = 3
2299
2300 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002301 if xid != None:
2302 self.xid = xid
2303 else:
2304 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002305 if report_mirror_ports != None:
2306 self.report_mirror_ports = report_mirror_ports
2307 else:
2308 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002309 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002310
2311 def pack(self):
2312 packed = []
2313 packed.append(struct.pack("!B", self.version))
2314 packed.append(struct.pack("!B", self.type))
2315 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2316 packed.append(struct.pack("!L", self.xid))
2317 packed.append(struct.pack("!L", self.experimenter))
2318 packed.append(struct.pack("!L", self.subtype))
2319 packed.append(struct.pack("!B", self.report_mirror_ports))
2320 packed.append('\x00' * 3)
2321 length = sum([len(x) for x in packed])
2322 packed[2] = struct.pack("!H", length)
2323 return ''.join(packed)
2324
2325 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002326 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002327 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002328 _version = reader.read("!B")[0]
2329 assert(_version == 2)
2330 _type = reader.read("!B")[0]
2331 assert(_type == 4)
2332 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002333 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002334 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002335 obj.xid = reader.read("!L")[0]
2336 _experimenter = reader.read("!L")[0]
2337 assert(_experimenter == 6035143)
2338 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002339 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002340 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002341 reader.skip(3)
2342 return obj
2343
2344 def __eq__(self, other):
2345 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002346 if self.xid != other.xid: return False
2347 if self.report_mirror_ports != other.report_mirror_ports: return False
2348 return True
2349
Rich Lanec2ee4b82013-04-24 17:12:38 -07002350 def pretty_print(self, q):
2351 q.text("bsn_set_mirroring {")
2352 with q.group():
2353 with q.indent(2):
2354 q.breakable()
2355 q.text("xid = ");
2356 if self.xid != None:
2357 q.text("%#x" % self.xid)
2358 else:
2359 q.text('None')
2360 q.text(","); q.breakable()
2361 q.text("report_mirror_ports = ");
2362 q.text("%#x" % self.report_mirror_ports)
2363 q.breakable()
2364 q.text('}')
2365
Rich Lane7dcdf022013-12-11 14:45:27 -08002366bsn_header.subtypes[3] = bsn_set_mirroring
2367
2368class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002369 version = 2
2370 type = 4
2371 experimenter = 6035143
2372 subtype = 25
2373
2374 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002375 if xid != None:
2376 self.xid = xid
2377 else:
2378 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002379 if status != None:
2380 self.status = status
2381 else:
2382 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002383 return
Dan Talaycof6202252013-07-02 01:00:29 -07002384
2385 def pack(self):
2386 packed = []
2387 packed.append(struct.pack("!B", self.version))
2388 packed.append(struct.pack("!B", self.type))
2389 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2390 packed.append(struct.pack("!L", self.xid))
2391 packed.append(struct.pack("!L", self.experimenter))
2392 packed.append(struct.pack("!L", self.subtype))
2393 packed.append(struct.pack("!L", self.status))
2394 length = sum([len(x) for x in packed])
2395 packed[2] = struct.pack("!H", length)
2396 return ''.join(packed)
2397
2398 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002399 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002400 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002401 _version = reader.read("!B")[0]
2402 assert(_version == 2)
2403 _type = reader.read("!B")[0]
2404 assert(_type == 4)
2405 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002406 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002407 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002408 obj.xid = reader.read("!L")[0]
2409 _experimenter = reader.read("!L")[0]
2410 assert(_experimenter == 6035143)
2411 _subtype = reader.read("!L")[0]
2412 assert(_subtype == 25)
2413 obj.status = reader.read("!L")[0]
2414 return obj
2415
2416 def __eq__(self, other):
2417 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002418 if self.xid != other.xid: return False
2419 if self.status != other.status: return False
2420 return True
2421
Dan Talaycof6202252013-07-02 01:00:29 -07002422 def pretty_print(self, q):
2423 q.text("bsn_set_pktin_suppression_reply {")
2424 with q.group():
2425 with q.indent(2):
2426 q.breakable()
2427 q.text("xid = ");
2428 if self.xid != None:
2429 q.text("%#x" % self.xid)
2430 else:
2431 q.text('None')
2432 q.text(","); q.breakable()
2433 q.text("status = ");
2434 q.text("%#x" % self.status)
2435 q.breakable()
2436 q.text('}')
2437
Rich Lane7dcdf022013-12-11 14:45:27 -08002438bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2439
2440class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002441 version = 2
2442 type = 4
2443 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002444 subtype = 11
2445
2446 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002447 if xid != None:
2448 self.xid = xid
2449 else:
2450 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002451 if enabled != None:
2452 self.enabled = enabled
2453 else:
2454 self.enabled = 0
2455 if idle_timeout != None:
2456 self.idle_timeout = idle_timeout
2457 else:
2458 self.idle_timeout = 0
2459 if hard_timeout != None:
2460 self.hard_timeout = hard_timeout
2461 else:
2462 self.hard_timeout = 0
2463 if priority != None:
2464 self.priority = priority
2465 else:
2466 self.priority = 0
2467 if cookie != None:
2468 self.cookie = cookie
2469 else:
2470 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002471 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002472
2473 def pack(self):
2474 packed = []
2475 packed.append(struct.pack("!B", self.version))
2476 packed.append(struct.pack("!B", self.type))
2477 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2478 packed.append(struct.pack("!L", self.xid))
2479 packed.append(struct.pack("!L", self.experimenter))
2480 packed.append(struct.pack("!L", self.subtype))
2481 packed.append(struct.pack("!B", self.enabled))
2482 packed.append('\x00' * 1)
2483 packed.append(struct.pack("!H", self.idle_timeout))
2484 packed.append(struct.pack("!H", self.hard_timeout))
2485 packed.append(struct.pack("!H", self.priority))
2486 packed.append(struct.pack("!Q", self.cookie))
2487 length = sum([len(x) for x in packed])
2488 packed[2] = struct.pack("!H", length)
2489 return ''.join(packed)
2490
2491 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002492 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002493 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002494 _version = reader.read("!B")[0]
2495 assert(_version == 2)
2496 _type = reader.read("!B")[0]
2497 assert(_type == 4)
2498 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002499 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002500 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002501 obj.xid = reader.read("!L")[0]
2502 _experimenter = reader.read("!L")[0]
2503 assert(_experimenter == 6035143)
2504 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002505 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07002506 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002507 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002508 obj.idle_timeout = reader.read("!H")[0]
2509 obj.hard_timeout = reader.read("!H")[0]
2510 obj.priority = reader.read("!H")[0]
2511 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002512 return obj
2513
2514 def __eq__(self, other):
2515 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002516 if self.xid != other.xid: return False
2517 if self.enabled != other.enabled: return False
2518 if self.idle_timeout != other.idle_timeout: return False
2519 if self.hard_timeout != other.hard_timeout: return False
2520 if self.priority != other.priority: return False
2521 if self.cookie != other.cookie: return False
2522 return True
2523
Rich Lanec2ee4b82013-04-24 17:12:38 -07002524 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002525 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07002526 with q.group():
2527 with q.indent(2):
2528 q.breakable()
2529 q.text("xid = ");
2530 if self.xid != None:
2531 q.text("%#x" % self.xid)
2532 else:
2533 q.text('None')
2534 q.text(","); q.breakable()
2535 q.text("enabled = ");
2536 q.text("%#x" % self.enabled)
2537 q.text(","); q.breakable()
2538 q.text("idle_timeout = ");
2539 q.text("%#x" % self.idle_timeout)
2540 q.text(","); q.breakable()
2541 q.text("hard_timeout = ");
2542 q.text("%#x" % self.hard_timeout)
2543 q.text(","); q.breakable()
2544 q.text("priority = ");
2545 q.text("%#x" % self.priority)
2546 q.text(","); q.breakable()
2547 q.text("cookie = ");
2548 q.text("%#x" % self.cookie)
2549 q.breakable()
2550 q.text('}')
2551
Rich Lane7dcdf022013-12-11 14:45:27 -08002552bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
2553
2554class experimenter_stats_reply(stats_reply):
2555 subtypes = {}
2556
Rich Lane95f7fc92014-01-27 17:08:16 -08002557 version = 2
2558 type = 19
2559 stats_type = 65535
2560
2561 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
2562 if xid != None:
2563 self.xid = xid
2564 else:
2565 self.xid = None
2566 if flags != None:
2567 self.flags = flags
2568 else:
2569 self.flags = 0
2570 if experimenter != None:
2571 self.experimenter = experimenter
2572 else:
2573 self.experimenter = 0
2574 if data != None:
2575 self.data = data
2576 else:
2577 self.data = ''
2578 return
2579
2580 def pack(self):
2581 packed = []
2582 packed.append(struct.pack("!B", self.version))
2583 packed.append(struct.pack("!B", self.type))
2584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2585 packed.append(struct.pack("!L", self.xid))
2586 packed.append(struct.pack("!H", self.stats_type))
2587 packed.append(struct.pack("!H", self.flags))
2588 packed.append('\x00' * 4)
2589 packed.append(struct.pack("!L", self.experimenter))
2590 packed.append('\x00' * 4)
2591 packed.append(self.data)
2592 length = sum([len(x) for x in packed])
2593 packed[2] = struct.pack("!H", length)
2594 return ''.join(packed)
2595
Rich Lane7dcdf022013-12-11 14:45:27 -08002596 @staticmethod
2597 def unpack(reader):
2598 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002599 subclass = experimenter_stats_reply.subtypes.get(subtype)
2600 if subclass:
2601 return subclass.unpack(reader)
2602
2603 obj = experimenter_stats_reply()
2604 _version = reader.read("!B")[0]
2605 assert(_version == 2)
2606 _type = reader.read("!B")[0]
2607 assert(_type == 19)
2608 _length = reader.read("!H")[0]
2609 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002610 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002611 obj.xid = reader.read("!L")[0]
2612 _stats_type = reader.read("!H")[0]
2613 assert(_stats_type == 65535)
2614 obj.flags = reader.read("!H")[0]
2615 reader.skip(4)
2616 obj.experimenter = reader.read("!L")[0]
2617 reader.skip(4)
2618 obj.data = str(reader.read_all())
2619 return obj
2620
2621 def __eq__(self, other):
2622 if type(self) != type(other): return False
2623 if self.xid != other.xid: return False
2624 if self.flags != other.flags: return False
2625 if self.experimenter != other.experimenter: return False
2626 if self.data != other.data: return False
2627 return True
2628
2629 def pretty_print(self, q):
2630 q.text("experimenter_stats_reply {")
2631 with q.group():
2632 with q.indent(2):
2633 q.breakable()
2634 q.text("xid = ");
2635 if self.xid != None:
2636 q.text("%#x" % self.xid)
2637 else:
2638 q.text('None')
2639 q.text(","); q.breakable()
2640 q.text("flags = ");
2641 q.text("%#x" % self.flags)
2642 q.text(","); q.breakable()
2643 q.text("data = ");
2644 q.pp(self.data)
2645 q.breakable()
2646 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002647
2648stats_reply.subtypes[65535] = experimenter_stats_reply
2649
2650class bsn_stats_reply(experimenter_stats_reply):
2651 subtypes = {}
2652
Rich Lane95f7fc92014-01-27 17:08:16 -08002653 version = 2
2654 type = 19
2655 stats_type = 65535
2656 experimenter = 6035143
2657
2658 def __init__(self, xid=None, flags=None, subtype=None):
2659 if xid != None:
2660 self.xid = xid
2661 else:
2662 self.xid = None
2663 if flags != None:
2664 self.flags = flags
2665 else:
2666 self.flags = 0
2667 if subtype != None:
2668 self.subtype = subtype
2669 else:
2670 self.subtype = 0
2671 return
2672
2673 def pack(self):
2674 packed = []
2675 packed.append(struct.pack("!B", self.version))
2676 packed.append(struct.pack("!B", self.type))
2677 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2678 packed.append(struct.pack("!L", self.xid))
2679 packed.append(struct.pack("!H", self.stats_type))
2680 packed.append(struct.pack("!H", self.flags))
2681 packed.append('\x00' * 4)
2682 packed.append(struct.pack("!L", self.experimenter))
2683 packed.append(struct.pack("!L", self.subtype))
2684 length = sum([len(x) for x in packed])
2685 packed[2] = struct.pack("!H", length)
2686 return ''.join(packed)
2687
Rich Lane7dcdf022013-12-11 14:45:27 -08002688 @staticmethod
2689 def unpack(reader):
2690 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002691 subclass = bsn_stats_reply.subtypes.get(subtype)
2692 if subclass:
2693 return subclass.unpack(reader)
2694
2695 obj = bsn_stats_reply()
2696 _version = reader.read("!B")[0]
2697 assert(_version == 2)
2698 _type = reader.read("!B")[0]
2699 assert(_type == 19)
2700 _length = reader.read("!H")[0]
2701 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002702 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002703 obj.xid = reader.read("!L")[0]
2704 _stats_type = reader.read("!H")[0]
2705 assert(_stats_type == 65535)
2706 obj.flags = reader.read("!H")[0]
2707 reader.skip(4)
2708 _experimenter = reader.read("!L")[0]
2709 assert(_experimenter == 6035143)
2710 obj.subtype = reader.read("!L")[0]
2711 return obj
2712
2713 def __eq__(self, other):
2714 if type(self) != type(other): return False
2715 if self.xid != other.xid: return False
2716 if self.flags != other.flags: return False
2717 if self.subtype != other.subtype: return False
2718 return True
2719
2720 def pretty_print(self, q):
2721 q.text("bsn_stats_reply {")
2722 with q.group():
2723 with q.indent(2):
2724 q.breakable()
2725 q.text("xid = ");
2726 if self.xid != None:
2727 q.text("%#x" % self.xid)
2728 else:
2729 q.text('None')
2730 q.text(","); q.breakable()
2731 q.text("flags = ");
2732 q.text("%#x" % self.flags)
2733 q.breakable()
2734 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002735
2736experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2737
2738class experimenter_stats_request(stats_request):
2739 subtypes = {}
2740
Rich Lane95f7fc92014-01-27 17:08:16 -08002741 version = 2
2742 type = 18
2743 stats_type = 65535
2744
2745 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
2746 if xid != None:
2747 self.xid = xid
2748 else:
2749 self.xid = None
2750 if flags != None:
2751 self.flags = flags
2752 else:
2753 self.flags = 0
2754 if experimenter != None:
2755 self.experimenter = experimenter
2756 else:
2757 self.experimenter = 0
2758 if data != None:
2759 self.data = data
2760 else:
2761 self.data = ''
2762 return
2763
2764 def pack(self):
2765 packed = []
2766 packed.append(struct.pack("!B", self.version))
2767 packed.append(struct.pack("!B", self.type))
2768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2769 packed.append(struct.pack("!L", self.xid))
2770 packed.append(struct.pack("!H", self.stats_type))
2771 packed.append(struct.pack("!H", self.flags))
2772 packed.append('\x00' * 4)
2773 packed.append(struct.pack("!L", self.experimenter))
2774 packed.append('\x00' * 4)
2775 packed.append(self.data)
2776 length = sum([len(x) for x in packed])
2777 packed[2] = struct.pack("!H", length)
2778 return ''.join(packed)
2779
Rich Lane7dcdf022013-12-11 14:45:27 -08002780 @staticmethod
2781 def unpack(reader):
2782 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002783 subclass = experimenter_stats_request.subtypes.get(subtype)
2784 if subclass:
2785 return subclass.unpack(reader)
2786
2787 obj = experimenter_stats_request()
2788 _version = reader.read("!B")[0]
2789 assert(_version == 2)
2790 _type = reader.read("!B")[0]
2791 assert(_type == 18)
2792 _length = reader.read("!H")[0]
2793 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002794 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002795 obj.xid = reader.read("!L")[0]
2796 _stats_type = reader.read("!H")[0]
2797 assert(_stats_type == 65535)
2798 obj.flags = reader.read("!H")[0]
2799 reader.skip(4)
2800 obj.experimenter = reader.read("!L")[0]
2801 reader.skip(4)
2802 obj.data = str(reader.read_all())
2803 return obj
2804
2805 def __eq__(self, other):
2806 if type(self) != type(other): return False
2807 if self.xid != other.xid: return False
2808 if self.flags != other.flags: return False
2809 if self.experimenter != other.experimenter: return False
2810 if self.data != other.data: return False
2811 return True
2812
2813 def pretty_print(self, q):
2814 q.text("experimenter_stats_request {")
2815 with q.group():
2816 with q.indent(2):
2817 q.breakable()
2818 q.text("xid = ");
2819 if self.xid != None:
2820 q.text("%#x" % self.xid)
2821 else:
2822 q.text('None')
2823 q.text(","); q.breakable()
2824 q.text("flags = ");
2825 q.text("%#x" % self.flags)
2826 q.text(","); q.breakable()
2827 q.text("data = ");
2828 q.pp(self.data)
2829 q.breakable()
2830 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002831
2832stats_request.subtypes[65535] = experimenter_stats_request
2833
2834class bsn_stats_request(experimenter_stats_request):
2835 subtypes = {}
2836
Rich Lane95f7fc92014-01-27 17:08:16 -08002837 version = 2
2838 type = 18
2839 stats_type = 65535
2840 experimenter = 6035143
2841
2842 def __init__(self, xid=None, flags=None, subtype=None):
2843 if xid != None:
2844 self.xid = xid
2845 else:
2846 self.xid = None
2847 if flags != None:
2848 self.flags = flags
2849 else:
2850 self.flags = 0
2851 if subtype != None:
2852 self.subtype = subtype
2853 else:
2854 self.subtype = 0
2855 return
2856
2857 def pack(self):
2858 packed = []
2859 packed.append(struct.pack("!B", self.version))
2860 packed.append(struct.pack("!B", self.type))
2861 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2862 packed.append(struct.pack("!L", self.xid))
2863 packed.append(struct.pack("!H", self.stats_type))
2864 packed.append(struct.pack("!H", self.flags))
2865 packed.append('\x00' * 4)
2866 packed.append(struct.pack("!L", self.experimenter))
2867 packed.append(struct.pack("!L", self.subtype))
2868 length = sum([len(x) for x in packed])
2869 packed[2] = struct.pack("!H", length)
2870 return ''.join(packed)
2871
Rich Lane7dcdf022013-12-11 14:45:27 -08002872 @staticmethod
2873 def unpack(reader):
2874 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002875 subclass = bsn_stats_request.subtypes.get(subtype)
2876 if subclass:
2877 return subclass.unpack(reader)
2878
2879 obj = bsn_stats_request()
2880 _version = reader.read("!B")[0]
2881 assert(_version == 2)
2882 _type = reader.read("!B")[0]
2883 assert(_type == 18)
2884 _length = reader.read("!H")[0]
2885 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002886 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002887 obj.xid = reader.read("!L")[0]
2888 _stats_type = reader.read("!H")[0]
2889 assert(_stats_type == 65535)
2890 obj.flags = reader.read("!H")[0]
2891 reader.skip(4)
2892 _experimenter = reader.read("!L")[0]
2893 assert(_experimenter == 6035143)
2894 obj.subtype = reader.read("!L")[0]
2895 return obj
2896
2897 def __eq__(self, other):
2898 if type(self) != type(other): return False
2899 if self.xid != other.xid: return False
2900 if self.flags != other.flags: return False
2901 if self.subtype != other.subtype: return False
2902 return True
2903
2904 def pretty_print(self, q):
2905 q.text("bsn_stats_request {")
2906 with q.group():
2907 with q.indent(2):
2908 q.breakable()
2909 q.text("xid = ");
2910 if self.xid != None:
2911 q.text("%#x" % self.xid)
2912 else:
2913 q.text('None')
2914 q.text(","); q.breakable()
2915 q.text("flags = ");
2916 q.text("%#x" % self.flags)
2917 q.breakable()
2918 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002919
2920experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2921
2922class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002923 version = 2
2924 type = 4
2925 experimenter = 6035143
2926 subtype = 16
2927
2928 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002929 if xid != None:
2930 self.xid = xid
2931 else:
2932 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002933 if status != None:
2934 self.status = status
2935 else:
2936 self.status = 0
2937 if vport_no != None:
2938 self.vport_no = vport_no
2939 else:
2940 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002941 return
Dan Talaycof6202252013-07-02 01:00:29 -07002942
2943 def pack(self):
2944 packed = []
2945 packed.append(struct.pack("!B", self.version))
2946 packed.append(struct.pack("!B", self.type))
2947 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2948 packed.append(struct.pack("!L", self.xid))
2949 packed.append(struct.pack("!L", self.experimenter))
2950 packed.append(struct.pack("!L", self.subtype))
2951 packed.append(struct.pack("!L", self.status))
2952 packed.append(struct.pack("!L", self.vport_no))
2953 length = sum([len(x) for x in packed])
2954 packed[2] = struct.pack("!H", length)
2955 return ''.join(packed)
2956
2957 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002958 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002959 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002960 _version = reader.read("!B")[0]
2961 assert(_version == 2)
2962 _type = reader.read("!B")[0]
2963 assert(_type == 4)
2964 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002965 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002966 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002967 obj.xid = reader.read("!L")[0]
2968 _experimenter = reader.read("!L")[0]
2969 assert(_experimenter == 6035143)
2970 _subtype = reader.read("!L")[0]
2971 assert(_subtype == 16)
2972 obj.status = reader.read("!L")[0]
2973 obj.vport_no = reader.read("!L")[0]
2974 return obj
2975
2976 def __eq__(self, other):
2977 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002978 if self.xid != other.xid: return False
2979 if self.status != other.status: return False
2980 if self.vport_no != other.vport_no: return False
2981 return True
2982
Dan Talaycof6202252013-07-02 01:00:29 -07002983 def pretty_print(self, q):
2984 q.text("bsn_virtual_port_create_reply {")
2985 with q.group():
2986 with q.indent(2):
2987 q.breakable()
2988 q.text("xid = ");
2989 if self.xid != None:
2990 q.text("%#x" % self.xid)
2991 else:
2992 q.text('None')
2993 q.text(","); q.breakable()
2994 q.text("status = ");
2995 q.text("%#x" % self.status)
2996 q.text(","); q.breakable()
2997 q.text("vport_no = ");
2998 q.text("%#x" % self.vport_no)
2999 q.breakable()
3000 q.text('}')
3001
Rich Lane7dcdf022013-12-11 14:45:27 -08003002bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3003
3004class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003005 version = 2
3006 type = 4
3007 experimenter = 6035143
3008 subtype = 15
3009
3010 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003011 if xid != None:
3012 self.xid = xid
3013 else:
3014 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003015 if vport != None:
3016 self.vport = vport
3017 else:
Rich Lane93b33132014-04-21 12:20:58 -07003018 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003019 return
Dan Talaycof6202252013-07-02 01:00:29 -07003020
3021 def pack(self):
3022 packed = []
3023 packed.append(struct.pack("!B", self.version))
3024 packed.append(struct.pack("!B", self.type))
3025 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3026 packed.append(struct.pack("!L", self.xid))
3027 packed.append(struct.pack("!L", self.experimenter))
3028 packed.append(struct.pack("!L", self.subtype))
3029 packed.append(self.vport.pack())
3030 length = sum([len(x) for x in packed])
3031 packed[2] = struct.pack("!H", length)
3032 return ''.join(packed)
3033
3034 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003035 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003036 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003037 _version = reader.read("!B")[0]
3038 assert(_version == 2)
3039 _type = reader.read("!B")[0]
3040 assert(_type == 4)
3041 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003042 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003043 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003044 obj.xid = reader.read("!L")[0]
3045 _experimenter = reader.read("!L")[0]
3046 assert(_experimenter == 6035143)
3047 _subtype = reader.read("!L")[0]
3048 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07003049 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003050 return obj
3051
3052 def __eq__(self, other):
3053 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003054 if self.xid != other.xid: return False
3055 if self.vport != other.vport: return False
3056 return True
3057
Dan Talaycof6202252013-07-02 01:00:29 -07003058 def pretty_print(self, q):
3059 q.text("bsn_virtual_port_create_request {")
3060 with q.group():
3061 with q.indent(2):
3062 q.breakable()
3063 q.text("xid = ");
3064 if self.xid != None:
3065 q.text("%#x" % self.xid)
3066 else:
3067 q.text('None')
3068 q.text(","); q.breakable()
3069 q.text("vport = ");
3070 q.pp(self.vport)
3071 q.breakable()
3072 q.text('}')
3073
Rich Lane7dcdf022013-12-11 14:45:27 -08003074bsn_header.subtypes[15] = bsn_virtual_port_create_request
3075
3076class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003077 version = 2
3078 type = 4
3079 experimenter = 6035143
3080 subtype = 26
3081
3082 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003083 if xid != None:
3084 self.xid = xid
3085 else:
3086 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003087 if status != None:
3088 self.status = status
3089 else:
3090 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003091 return
Dan Talaycof6202252013-07-02 01:00:29 -07003092
3093 def pack(self):
3094 packed = []
3095 packed.append(struct.pack("!B", self.version))
3096 packed.append(struct.pack("!B", self.type))
3097 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3098 packed.append(struct.pack("!L", self.xid))
3099 packed.append(struct.pack("!L", self.experimenter))
3100 packed.append(struct.pack("!L", self.subtype))
3101 packed.append(struct.pack("!L", self.status))
3102 length = sum([len(x) for x in packed])
3103 packed[2] = struct.pack("!H", length)
3104 return ''.join(packed)
3105
3106 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003107 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003108 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003109 _version = reader.read("!B")[0]
3110 assert(_version == 2)
3111 _type = reader.read("!B")[0]
3112 assert(_type == 4)
3113 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003114 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003115 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003116 obj.xid = reader.read("!L")[0]
3117 _experimenter = reader.read("!L")[0]
3118 assert(_experimenter == 6035143)
3119 _subtype = reader.read("!L")[0]
3120 assert(_subtype == 26)
3121 obj.status = reader.read("!L")[0]
3122 return obj
3123
3124 def __eq__(self, other):
3125 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003126 if self.xid != other.xid: return False
3127 if self.status != other.status: return False
3128 return True
3129
Dan Talaycof6202252013-07-02 01:00:29 -07003130 def pretty_print(self, q):
3131 q.text("bsn_virtual_port_remove_reply {")
3132 with q.group():
3133 with q.indent(2):
3134 q.breakable()
3135 q.text("xid = ");
3136 if self.xid != None:
3137 q.text("%#x" % self.xid)
3138 else:
3139 q.text('None')
3140 q.text(","); q.breakable()
3141 q.text("status = ");
3142 q.text("%#x" % self.status)
3143 q.breakable()
3144 q.text('}')
3145
Rich Lane7dcdf022013-12-11 14:45:27 -08003146bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3147
3148class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003149 version = 2
3150 type = 4
3151 experimenter = 6035143
3152 subtype = 17
3153
3154 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003155 if xid != None:
3156 self.xid = xid
3157 else:
3158 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003159 if vport_no != None:
3160 self.vport_no = vport_no
3161 else:
3162 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003163 return
Dan Talaycof6202252013-07-02 01:00:29 -07003164
3165 def pack(self):
3166 packed = []
3167 packed.append(struct.pack("!B", self.version))
3168 packed.append(struct.pack("!B", self.type))
3169 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3170 packed.append(struct.pack("!L", self.xid))
3171 packed.append(struct.pack("!L", self.experimenter))
3172 packed.append(struct.pack("!L", self.subtype))
3173 packed.append(struct.pack("!L", self.vport_no))
3174 length = sum([len(x) for x in packed])
3175 packed[2] = struct.pack("!H", length)
3176 return ''.join(packed)
3177
3178 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003179 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003180 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003181 _version = reader.read("!B")[0]
3182 assert(_version == 2)
3183 _type = reader.read("!B")[0]
3184 assert(_type == 4)
3185 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003186 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003187 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003188 obj.xid = reader.read("!L")[0]
3189 _experimenter = reader.read("!L")[0]
3190 assert(_experimenter == 6035143)
3191 _subtype = reader.read("!L")[0]
3192 assert(_subtype == 17)
3193 obj.vport_no = reader.read("!L")[0]
3194 return obj
3195
3196 def __eq__(self, other):
3197 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003198 if self.xid != other.xid: return False
3199 if self.vport_no != other.vport_no: return False
3200 return True
3201
Dan Talaycof6202252013-07-02 01:00:29 -07003202 def pretty_print(self, q):
3203 q.text("bsn_virtual_port_remove_request {")
3204 with q.group():
3205 with q.indent(2):
3206 q.breakable()
3207 q.text("xid = ");
3208 if self.xid != None:
3209 q.text("%#x" % self.xid)
3210 else:
3211 q.text('None')
3212 q.text(","); q.breakable()
3213 q.text("vport_no = ");
3214 q.text("%#x" % self.vport_no)
3215 q.breakable()
3216 q.text('}')
3217
Rich Lane7dcdf022013-12-11 14:45:27 -08003218bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3219
3220class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003221 version = 2
3222 type = 19
3223 stats_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003224
3225 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 -08003226 if xid != None:
3227 self.xid = xid
3228 else:
3229 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003230 if flags != None:
3231 self.flags = flags
3232 else:
3233 self.flags = 0
3234 if mfr_desc != None:
3235 self.mfr_desc = mfr_desc
3236 else:
3237 self.mfr_desc = ""
3238 if hw_desc != None:
3239 self.hw_desc = hw_desc
3240 else:
3241 self.hw_desc = ""
3242 if sw_desc != None:
3243 self.sw_desc = sw_desc
3244 else:
3245 self.sw_desc = ""
3246 if serial_num != None:
3247 self.serial_num = serial_num
3248 else:
3249 self.serial_num = ""
3250 if dp_desc != None:
3251 self.dp_desc = dp_desc
3252 else:
3253 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08003254 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003255
3256 def pack(self):
3257 packed = []
3258 packed.append(struct.pack("!B", self.version))
3259 packed.append(struct.pack("!B", self.type))
3260 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3261 packed.append(struct.pack("!L", self.xid))
3262 packed.append(struct.pack("!H", self.stats_type))
3263 packed.append(struct.pack("!H", self.flags))
3264 packed.append('\x00' * 4)
3265 packed.append(struct.pack("!256s", self.mfr_desc))
3266 packed.append(struct.pack("!256s", self.hw_desc))
3267 packed.append(struct.pack("!256s", self.sw_desc))
3268 packed.append(struct.pack("!32s", self.serial_num))
3269 packed.append(struct.pack("!256s", self.dp_desc))
3270 length = sum([len(x) for x in packed])
3271 packed[2] = struct.pack("!H", length)
3272 return ''.join(packed)
3273
3274 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003275 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003276 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003277 _version = reader.read("!B")[0]
3278 assert(_version == 2)
3279 _type = reader.read("!B")[0]
3280 assert(_type == 19)
3281 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003282 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003283 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003284 obj.xid = reader.read("!L")[0]
3285 _stats_type = reader.read("!H")[0]
3286 assert(_stats_type == 0)
3287 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003288 reader.skip(4)
3289 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
3290 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
3291 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
3292 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
3293 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
3294 return obj
3295
3296 def __eq__(self, other):
3297 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003298 if self.xid != other.xid: return False
3299 if self.flags != other.flags: return False
3300 if self.mfr_desc != other.mfr_desc: return False
3301 if self.hw_desc != other.hw_desc: return False
3302 if self.sw_desc != other.sw_desc: return False
3303 if self.serial_num != other.serial_num: return False
3304 if self.dp_desc != other.dp_desc: return False
3305 return True
3306
Rich Lanec2ee4b82013-04-24 17:12:38 -07003307 def pretty_print(self, q):
3308 q.text("desc_stats_reply {")
3309 with q.group():
3310 with q.indent(2):
3311 q.breakable()
3312 q.text("xid = ");
3313 if self.xid != None:
3314 q.text("%#x" % self.xid)
3315 else:
3316 q.text('None')
3317 q.text(","); q.breakable()
3318 q.text("flags = ");
3319 q.text("%#x" % self.flags)
3320 q.text(","); q.breakable()
3321 q.text("mfr_desc = ");
3322 q.pp(self.mfr_desc)
3323 q.text(","); q.breakable()
3324 q.text("hw_desc = ");
3325 q.pp(self.hw_desc)
3326 q.text(","); q.breakable()
3327 q.text("sw_desc = ");
3328 q.pp(self.sw_desc)
3329 q.text(","); q.breakable()
3330 q.text("serial_num = ");
3331 q.pp(self.serial_num)
3332 q.text(","); q.breakable()
3333 q.text("dp_desc = ");
3334 q.pp(self.dp_desc)
3335 q.breakable()
3336 q.text('}')
3337
Rich Lane7dcdf022013-12-11 14:45:27 -08003338stats_reply.subtypes[0] = desc_stats_reply
3339
3340class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07003341 version = 2
3342 type = 18
3343 stats_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003344
3345 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003346 if xid != None:
3347 self.xid = xid
3348 else:
3349 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003350 if flags != None:
3351 self.flags = flags
3352 else:
3353 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003354 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003355
3356 def pack(self):
3357 packed = []
3358 packed.append(struct.pack("!B", self.version))
3359 packed.append(struct.pack("!B", self.type))
3360 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3361 packed.append(struct.pack("!L", self.xid))
3362 packed.append(struct.pack("!H", self.stats_type))
3363 packed.append(struct.pack("!H", self.flags))
3364 packed.append('\x00' * 4)
3365 length = sum([len(x) for x in packed])
3366 packed[2] = struct.pack("!H", length)
3367 return ''.join(packed)
3368
3369 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003370 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003371 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003372 _version = reader.read("!B")[0]
3373 assert(_version == 2)
3374 _type = reader.read("!B")[0]
3375 assert(_type == 18)
3376 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003377 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003378 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003379 obj.xid = reader.read("!L")[0]
3380 _stats_type = reader.read("!H")[0]
3381 assert(_stats_type == 0)
3382 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003383 reader.skip(4)
3384 return obj
3385
3386 def __eq__(self, other):
3387 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003388 if self.xid != other.xid: return False
3389 if self.flags != other.flags: return False
3390 return True
3391
Rich Lanec2ee4b82013-04-24 17:12:38 -07003392 def pretty_print(self, q):
3393 q.text("desc_stats_request {")
3394 with q.group():
3395 with q.indent(2):
3396 q.breakable()
3397 q.text("xid = ");
3398 if self.xid != None:
3399 q.text("%#x" % self.xid)
3400 else:
3401 q.text('None')
3402 q.text(","); q.breakable()
3403 q.text("flags = ");
3404 q.text("%#x" % self.flags)
3405 q.breakable()
3406 q.text('}')
3407
Rich Lane7dcdf022013-12-11 14:45:27 -08003408stats_request.subtypes[0] = desc_stats_request
3409
3410class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003411 version = 2
3412 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07003413
3414 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003415 if xid != None:
3416 self.xid = xid
3417 else:
3418 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003419 if data != None:
3420 self.data = data
3421 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003422 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003423 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003424
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(self.data)
3432 length = sum([len(x) for x in packed])
3433 packed[2] = struct.pack("!H", length)
3434 return ''.join(packed)
3435
3436 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003437 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003438 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003439 _version = reader.read("!B")[0]
3440 assert(_version == 2)
3441 _type = reader.read("!B")[0]
3442 assert(_type == 3)
3443 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003444 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003445 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003446 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003447 obj.data = str(reader.read_all())
3448 return obj
3449
3450 def __eq__(self, other):
3451 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003452 if self.xid != other.xid: return False
3453 if self.data != other.data: return False
3454 return True
3455
Rich Lanec2ee4b82013-04-24 17:12:38 -07003456 def pretty_print(self, q):
3457 q.text("echo_reply {")
3458 with q.group():
3459 with q.indent(2):
3460 q.breakable()
3461 q.text("xid = ");
3462 if self.xid != None:
3463 q.text("%#x" % self.xid)
3464 else:
3465 q.text('None')
3466 q.text(","); q.breakable()
3467 q.text("data = ");
3468 q.pp(self.data)
3469 q.breakable()
3470 q.text('}')
3471
Rich Lane7dcdf022013-12-11 14:45:27 -08003472message.subtypes[3] = echo_reply
3473
3474class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003475 version = 2
3476 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07003477
3478 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003479 if xid != None:
3480 self.xid = xid
3481 else:
3482 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003483 if data != None:
3484 self.data = data
3485 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003486 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003487 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003488
3489 def pack(self):
3490 packed = []
3491 packed.append(struct.pack("!B", self.version))
3492 packed.append(struct.pack("!B", self.type))
3493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3494 packed.append(struct.pack("!L", self.xid))
3495 packed.append(self.data)
3496 length = sum([len(x) for x in packed])
3497 packed[2] = struct.pack("!H", length)
3498 return ''.join(packed)
3499
3500 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003501 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003502 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003503 _version = reader.read("!B")[0]
3504 assert(_version == 2)
3505 _type = reader.read("!B")[0]
3506 assert(_type == 2)
3507 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003508 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003509 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003510 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003511 obj.data = str(reader.read_all())
3512 return obj
3513
3514 def __eq__(self, other):
3515 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003516 if self.xid != other.xid: return False
3517 if self.data != other.data: return False
3518 return True
3519
Rich Lanec2ee4b82013-04-24 17:12:38 -07003520 def pretty_print(self, q):
3521 q.text("echo_request {")
3522 with q.group():
3523 with q.indent(2):
3524 q.breakable()
3525 q.text("xid = ");
3526 if self.xid != None:
3527 q.text("%#x" % self.xid)
3528 else:
3529 q.text('None')
3530 q.text(","); q.breakable()
3531 q.text("data = ");
3532 q.pp(self.data)
3533 q.breakable()
3534 q.text('}')
3535
Rich Lane7dcdf022013-12-11 14:45:27 -08003536message.subtypes[2] = echo_request
3537
3538class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003539 version = 2
3540 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07003541
3542 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003543 if xid != None:
3544 self.xid = xid
3545 else:
3546 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003547 if datapath_id != None:
3548 self.datapath_id = datapath_id
3549 else:
3550 self.datapath_id = 0
3551 if n_buffers != None:
3552 self.n_buffers = n_buffers
3553 else:
3554 self.n_buffers = 0
3555 if n_tables != None:
3556 self.n_tables = n_tables
3557 else:
3558 self.n_tables = 0
3559 if capabilities != None:
3560 self.capabilities = capabilities
3561 else:
3562 self.capabilities = 0
3563 if reserved != None:
3564 self.reserved = reserved
3565 else:
3566 self.reserved = 0
3567 if ports != None:
3568 self.ports = ports
3569 else:
3570 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003571 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003572
3573 def pack(self):
3574 packed = []
3575 packed.append(struct.pack("!B", self.version))
3576 packed.append(struct.pack("!B", self.type))
3577 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3578 packed.append(struct.pack("!L", self.xid))
3579 packed.append(struct.pack("!Q", self.datapath_id))
3580 packed.append(struct.pack("!L", self.n_buffers))
3581 packed.append(struct.pack("!B", self.n_tables))
3582 packed.append('\x00' * 3)
3583 packed.append(struct.pack("!L", self.capabilities))
3584 packed.append(struct.pack("!L", self.reserved))
Rich Lane7dcdf022013-12-11 14:45:27 -08003585 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003586 length = sum([len(x) for x in packed])
3587 packed[2] = struct.pack("!H", length)
3588 return ''.join(packed)
3589
3590 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003591 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003592 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003593 _version = reader.read("!B")[0]
3594 assert(_version == 2)
3595 _type = reader.read("!B")[0]
3596 assert(_type == 6)
3597 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003598 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003599 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003600 obj.xid = reader.read("!L")[0]
3601 obj.datapath_id = reader.read("!Q")[0]
3602 obj.n_buffers = reader.read("!L")[0]
3603 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003604 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07003605 obj.capabilities = reader.read("!L")[0]
3606 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003607 obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
3608 return obj
3609
3610 def __eq__(self, other):
3611 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003612 if self.xid != other.xid: return False
3613 if self.datapath_id != other.datapath_id: return False
3614 if self.n_buffers != other.n_buffers: return False
3615 if self.n_tables != other.n_tables: return False
3616 if self.capabilities != other.capabilities: return False
3617 if self.reserved != other.reserved: return False
3618 if self.ports != other.ports: return False
3619 return True
3620
Rich Lanec2ee4b82013-04-24 17:12:38 -07003621 def pretty_print(self, q):
3622 q.text("features_reply {")
3623 with q.group():
3624 with q.indent(2):
3625 q.breakable()
3626 q.text("xid = ");
3627 if self.xid != None:
3628 q.text("%#x" % self.xid)
3629 else:
3630 q.text('None')
3631 q.text(","); q.breakable()
3632 q.text("datapath_id = ");
3633 q.text("%#x" % self.datapath_id)
3634 q.text(","); q.breakable()
3635 q.text("n_buffers = ");
3636 q.text("%#x" % self.n_buffers)
3637 q.text(","); q.breakable()
3638 q.text("n_tables = ");
3639 q.text("%#x" % self.n_tables)
3640 q.text(","); q.breakable()
3641 q.text("capabilities = ");
3642 q.text("%#x" % self.capabilities)
3643 q.text(","); q.breakable()
3644 q.text("reserved = ");
3645 q.text("%#x" % self.reserved)
3646 q.text(","); q.breakable()
3647 q.text("ports = ");
3648 q.pp(self.ports)
3649 q.breakable()
3650 q.text('}')
3651
Rich Lane7dcdf022013-12-11 14:45:27 -08003652message.subtypes[6] = features_reply
3653
3654class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003655 version = 2
3656 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07003657
3658 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003659 if xid != None:
3660 self.xid = xid
3661 else:
3662 self.xid = None
3663 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003664
3665 def pack(self):
3666 packed = []
3667 packed.append(struct.pack("!B", self.version))
3668 packed.append(struct.pack("!B", self.type))
3669 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3670 packed.append(struct.pack("!L", self.xid))
3671 length = sum([len(x) for x in packed])
3672 packed[2] = struct.pack("!H", length)
3673 return ''.join(packed)
3674
3675 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003676 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003677 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003678 _version = reader.read("!B")[0]
3679 assert(_version == 2)
3680 _type = reader.read("!B")[0]
3681 assert(_type == 5)
3682 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003683 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003684 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003685 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003686 return obj
3687
3688 def __eq__(self, other):
3689 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003690 if self.xid != other.xid: return False
3691 return True
3692
Rich Lanec2ee4b82013-04-24 17:12:38 -07003693 def pretty_print(self, q):
3694 q.text("features_request {")
3695 with q.group():
3696 with q.indent(2):
3697 q.breakable()
3698 q.text("xid = ");
3699 if self.xid != None:
3700 q.text("%#x" % self.xid)
3701 else:
3702 q.text('None')
3703 q.breakable()
3704 q.text('}')
3705
Rich Lane7dcdf022013-12-11 14:45:27 -08003706message.subtypes[5] = features_request
3707
3708class flow_mod(message):
3709 subtypes = {}
3710
Rich Lane95f7fc92014-01-27 17:08:16 -08003711 version = 2
3712 type = 14
3713
3714 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
3715 if xid != None:
3716 self.xid = xid
3717 else:
3718 self.xid = None
3719 if cookie != None:
3720 self.cookie = cookie
3721 else:
3722 self.cookie = 0
3723 if cookie_mask != None:
3724 self.cookie_mask = cookie_mask
3725 else:
3726 self.cookie_mask = 0
3727 if table_id != None:
3728 self.table_id = table_id
3729 else:
3730 self.table_id = 0
3731 if _command != None:
3732 self._command = _command
3733 else:
3734 self._command = 0
3735 if idle_timeout != None:
3736 self.idle_timeout = idle_timeout
3737 else:
3738 self.idle_timeout = 0
3739 if hard_timeout != None:
3740 self.hard_timeout = hard_timeout
3741 else:
3742 self.hard_timeout = 0
3743 if priority != None:
3744 self.priority = priority
3745 else:
3746 self.priority = 0
3747 if buffer_id != None:
3748 self.buffer_id = buffer_id
3749 else:
3750 self.buffer_id = 0
3751 if out_port != None:
3752 self.out_port = out_port
3753 else:
3754 self.out_port = 0
3755 if out_group != None:
3756 self.out_group = out_group
3757 else:
3758 self.out_group = 0
3759 if flags != None:
3760 self.flags = flags
3761 else:
3762 self.flags = 0
3763 if match != None:
3764 self.match = match
3765 else:
3766 self.match = common.match()
3767 if instructions != None:
3768 self.instructions = instructions
3769 else:
3770 self.instructions = []
3771 return
3772
3773 def pack(self):
3774 packed = []
3775 packed.append(struct.pack("!B", self.version))
3776 packed.append(struct.pack("!B", self.type))
3777 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3778 packed.append(struct.pack("!L", self.xid))
3779 packed.append(struct.pack("!Q", self.cookie))
3780 packed.append(struct.pack("!Q", self.cookie_mask))
3781 packed.append(struct.pack("!B", self.table_id))
3782 packed.append(util.pack_fm_cmd(self._command))
3783 packed.append(struct.pack("!H", self.idle_timeout))
3784 packed.append(struct.pack("!H", self.hard_timeout))
3785 packed.append(struct.pack("!H", self.priority))
3786 packed.append(struct.pack("!L", self.buffer_id))
3787 packed.append(util.pack_port_no(self.out_port))
3788 packed.append(struct.pack("!L", self.out_group))
3789 packed.append(struct.pack("!H", self.flags))
3790 packed.append('\x00' * 2)
3791 packed.append(self.match.pack())
3792 packed.append(loxi.generic_util.pack_list(self.instructions))
3793 length = sum([len(x) for x in packed])
3794 packed[2] = struct.pack("!H", length)
3795 return ''.join(packed)
3796
Rich Lane7dcdf022013-12-11 14:45:27 -08003797 @staticmethod
3798 def unpack(reader):
3799 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08003800 subclass = flow_mod.subtypes.get(subtype)
3801 if subclass:
3802 return subclass.unpack(reader)
3803
3804 obj = flow_mod()
3805 _version = reader.read("!B")[0]
3806 assert(_version == 2)
3807 _type = reader.read("!B")[0]
3808 assert(_type == 14)
3809 _length = reader.read("!H")[0]
3810 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003811 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003812 obj.xid = reader.read("!L")[0]
3813 obj.cookie = reader.read("!Q")[0]
3814 obj.cookie_mask = reader.read("!Q")[0]
3815 obj.table_id = reader.read("!B")[0]
3816 obj._command = util.unpack_fm_cmd(reader)
3817 obj.idle_timeout = reader.read("!H")[0]
3818 obj.hard_timeout = reader.read("!H")[0]
3819 obj.priority = reader.read("!H")[0]
3820 obj.buffer_id = reader.read("!L")[0]
3821 obj.out_port = util.unpack_port_no(reader)
3822 obj.out_group = reader.read("!L")[0]
3823 obj.flags = reader.read("!H")[0]
3824 reader.skip(2)
3825 obj.match = common.match.unpack(reader)
3826 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
3827 return obj
3828
3829 def __eq__(self, other):
3830 if type(self) != type(other): return False
3831 if self.xid != other.xid: return False
3832 if self.cookie != other.cookie: return False
3833 if self.cookie_mask != other.cookie_mask: return False
3834 if self.table_id != other.table_id: return False
3835 if self._command != other._command: return False
3836 if self.idle_timeout != other.idle_timeout: return False
3837 if self.hard_timeout != other.hard_timeout: return False
3838 if self.priority != other.priority: return False
3839 if self.buffer_id != other.buffer_id: return False
3840 if self.out_port != other.out_port: return False
3841 if self.out_group != other.out_group: return False
3842 if self.flags != other.flags: return False
3843 if self.match != other.match: return False
3844 if self.instructions != other.instructions: return False
3845 return True
3846
3847 def pretty_print(self, q):
3848 q.text("flow_mod {")
3849 with q.group():
3850 with q.indent(2):
3851 q.breakable()
3852 q.text("xid = ");
3853 if self.xid != None:
3854 q.text("%#x" % self.xid)
3855 else:
3856 q.text('None')
3857 q.text(","); q.breakable()
3858 q.text("cookie = ");
3859 q.text("%#x" % self.cookie)
3860 q.text(","); q.breakable()
3861 q.text("cookie_mask = ");
3862 q.text("%#x" % self.cookie_mask)
3863 q.text(","); q.breakable()
3864 q.text("table_id = ");
3865 q.text("%#x" % self.table_id)
3866 q.text(","); q.breakable()
3867 q.text("idle_timeout = ");
3868 q.text("%#x" % self.idle_timeout)
3869 q.text(","); q.breakable()
3870 q.text("hard_timeout = ");
3871 q.text("%#x" % self.hard_timeout)
3872 q.text(","); q.breakable()
3873 q.text("priority = ");
3874 q.text("%#x" % self.priority)
3875 q.text(","); q.breakable()
3876 q.text("buffer_id = ");
3877 q.text("%#x" % self.buffer_id)
3878 q.text(","); q.breakable()
3879 q.text("out_port = ");
3880 q.text(util.pretty_port(self.out_port))
3881 q.text(","); q.breakable()
3882 q.text("out_group = ");
3883 q.text("%#x" % self.out_group)
3884 q.text(","); q.breakable()
3885 q.text("flags = ");
3886 q.text("%#x" % self.flags)
3887 q.text(","); q.breakable()
3888 q.text("match = ");
3889 q.pp(self.match)
3890 q.text(","); q.breakable()
3891 q.text("instructions = ");
3892 q.pp(self.instructions)
3893 q.breakable()
3894 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003895
3896message.subtypes[14] = flow_mod
3897
3898class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07003899 version = 2
3900 type = 14
3901 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003902
3903 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003904 if xid != None:
3905 self.xid = xid
3906 else:
3907 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003908 if cookie != None:
3909 self.cookie = cookie
3910 else:
3911 self.cookie = 0
3912 if cookie_mask != None:
3913 self.cookie_mask = cookie_mask
3914 else:
3915 self.cookie_mask = 0
3916 if table_id != None:
3917 self.table_id = table_id
3918 else:
3919 self.table_id = 0
3920 if idle_timeout != None:
3921 self.idle_timeout = idle_timeout
3922 else:
3923 self.idle_timeout = 0
3924 if hard_timeout != None:
3925 self.hard_timeout = hard_timeout
3926 else:
3927 self.hard_timeout = 0
3928 if priority != None:
3929 self.priority = priority
3930 else:
3931 self.priority = 0
3932 if buffer_id != None:
3933 self.buffer_id = buffer_id
3934 else:
3935 self.buffer_id = 0
3936 if out_port != None:
3937 self.out_port = out_port
3938 else:
3939 self.out_port = 0
3940 if out_group != None:
3941 self.out_group = out_group
3942 else:
3943 self.out_group = 0
3944 if flags != None:
3945 self.flags = flags
3946 else:
3947 self.flags = 0
3948 if match != None:
3949 self.match = match
3950 else:
3951 self.match = common.match()
3952 if instructions != None:
3953 self.instructions = instructions
3954 else:
3955 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003956 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003957
3958 def pack(self):
3959 packed = []
3960 packed.append(struct.pack("!B", self.version))
3961 packed.append(struct.pack("!B", self.type))
3962 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3963 packed.append(struct.pack("!L", self.xid))
3964 packed.append(struct.pack("!Q", self.cookie))
3965 packed.append(struct.pack("!Q", self.cookie_mask))
3966 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07003967 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003968 packed.append(struct.pack("!H", self.idle_timeout))
3969 packed.append(struct.pack("!H", self.hard_timeout))
3970 packed.append(struct.pack("!H", self.priority))
3971 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07003972 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003973 packed.append(struct.pack("!L", self.out_group))
3974 packed.append(struct.pack("!H", self.flags))
3975 packed.append('\x00' * 2)
3976 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08003977 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003978 length = sum([len(x) for x in packed])
3979 packed[2] = struct.pack("!H", length)
3980 return ''.join(packed)
3981
3982 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003983 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003984 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07003985 _version = reader.read("!B")[0]
3986 assert(_version == 2)
3987 _type = reader.read("!B")[0]
3988 assert(_type == 14)
3989 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003990 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003991 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003992 obj.xid = reader.read("!L")[0]
3993 obj.cookie = reader.read("!Q")[0]
3994 obj.cookie_mask = reader.read("!Q")[0]
3995 obj.table_id = reader.read("!B")[0]
3996 __command = util.unpack_fm_cmd(reader)
3997 assert(__command == 0)
3998 obj.idle_timeout = reader.read("!H")[0]
3999 obj.hard_timeout = reader.read("!H")[0]
4000 obj.priority = reader.read("!H")[0]
4001 obj.buffer_id = reader.read("!L")[0]
4002 obj.out_port = util.unpack_port_no(reader)
4003 obj.out_group = reader.read("!L")[0]
4004 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004005 reader.skip(2)
4006 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004007 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004008 return obj
4009
4010 def __eq__(self, other):
4011 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004012 if self.xid != other.xid: return False
4013 if self.cookie != other.cookie: return False
4014 if self.cookie_mask != other.cookie_mask: return False
4015 if self.table_id != other.table_id: return False
4016 if self.idle_timeout != other.idle_timeout: return False
4017 if self.hard_timeout != other.hard_timeout: return False
4018 if self.priority != other.priority: return False
4019 if self.buffer_id != other.buffer_id: return False
4020 if self.out_port != other.out_port: return False
4021 if self.out_group != other.out_group: return False
4022 if self.flags != other.flags: return False
4023 if self.match != other.match: return False
4024 if self.instructions != other.instructions: return False
4025 return True
4026
Rich Lanec2ee4b82013-04-24 17:12:38 -07004027 def pretty_print(self, q):
4028 q.text("flow_add {")
4029 with q.group():
4030 with q.indent(2):
4031 q.breakable()
4032 q.text("xid = ");
4033 if self.xid != None:
4034 q.text("%#x" % self.xid)
4035 else:
4036 q.text('None')
4037 q.text(","); q.breakable()
4038 q.text("cookie = ");
4039 q.text("%#x" % self.cookie)
4040 q.text(","); q.breakable()
4041 q.text("cookie_mask = ");
4042 q.text("%#x" % self.cookie_mask)
4043 q.text(","); q.breakable()
4044 q.text("table_id = ");
4045 q.text("%#x" % self.table_id)
4046 q.text(","); q.breakable()
4047 q.text("idle_timeout = ");
4048 q.text("%#x" % self.idle_timeout)
4049 q.text(","); q.breakable()
4050 q.text("hard_timeout = ");
4051 q.text("%#x" % self.hard_timeout)
4052 q.text(","); q.breakable()
4053 q.text("priority = ");
4054 q.text("%#x" % self.priority)
4055 q.text(","); q.breakable()
4056 q.text("buffer_id = ");
4057 q.text("%#x" % self.buffer_id)
4058 q.text(","); q.breakable()
4059 q.text("out_port = ");
4060 q.text(util.pretty_port(self.out_port))
4061 q.text(","); q.breakable()
4062 q.text("out_group = ");
4063 q.text("%#x" % self.out_group)
4064 q.text(","); q.breakable()
4065 q.text("flags = ");
4066 q.text("%#x" % self.flags)
4067 q.text(","); q.breakable()
4068 q.text("match = ");
4069 q.pp(self.match)
4070 q.text(","); q.breakable()
4071 q.text("instructions = ");
4072 q.pp(self.instructions)
4073 q.breakable()
4074 q.text('}')
4075
Rich Lane7dcdf022013-12-11 14:45:27 -08004076flow_mod.subtypes[0] = flow_add
4077
4078class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004079 version = 2
4080 type = 14
4081 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07004082
4083 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004084 if xid != None:
4085 self.xid = xid
4086 else:
4087 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004088 if cookie != None:
4089 self.cookie = cookie
4090 else:
4091 self.cookie = 0
4092 if cookie_mask != None:
4093 self.cookie_mask = cookie_mask
4094 else:
4095 self.cookie_mask = 0
4096 if table_id != None:
4097 self.table_id = table_id
4098 else:
4099 self.table_id = 0
4100 if idle_timeout != None:
4101 self.idle_timeout = idle_timeout
4102 else:
4103 self.idle_timeout = 0
4104 if hard_timeout != None:
4105 self.hard_timeout = hard_timeout
4106 else:
4107 self.hard_timeout = 0
4108 if priority != None:
4109 self.priority = priority
4110 else:
4111 self.priority = 0
4112 if buffer_id != None:
4113 self.buffer_id = buffer_id
4114 else:
4115 self.buffer_id = 0
4116 if out_port != None:
4117 self.out_port = out_port
4118 else:
4119 self.out_port = 0
4120 if out_group != None:
4121 self.out_group = out_group
4122 else:
4123 self.out_group = 0
4124 if flags != None:
4125 self.flags = flags
4126 else:
4127 self.flags = 0
4128 if match != None:
4129 self.match = match
4130 else:
4131 self.match = common.match()
4132 if instructions != None:
4133 self.instructions = instructions
4134 else:
4135 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004136 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004137
4138 def pack(self):
4139 packed = []
4140 packed.append(struct.pack("!B", self.version))
4141 packed.append(struct.pack("!B", self.type))
4142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4143 packed.append(struct.pack("!L", self.xid))
4144 packed.append(struct.pack("!Q", self.cookie))
4145 packed.append(struct.pack("!Q", self.cookie_mask))
4146 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004147 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004148 packed.append(struct.pack("!H", self.idle_timeout))
4149 packed.append(struct.pack("!H", self.hard_timeout))
4150 packed.append(struct.pack("!H", self.priority))
4151 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004152 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004153 packed.append(struct.pack("!L", self.out_group))
4154 packed.append(struct.pack("!H", self.flags))
4155 packed.append('\x00' * 2)
4156 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004157 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004158 length = sum([len(x) for x in packed])
4159 packed[2] = struct.pack("!H", length)
4160 return ''.join(packed)
4161
4162 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004163 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004164 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004165 _version = reader.read("!B")[0]
4166 assert(_version == 2)
4167 _type = reader.read("!B")[0]
4168 assert(_type == 14)
4169 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004170 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004171 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004172 obj.xid = reader.read("!L")[0]
4173 obj.cookie = reader.read("!Q")[0]
4174 obj.cookie_mask = reader.read("!Q")[0]
4175 obj.table_id = reader.read("!B")[0]
4176 __command = util.unpack_fm_cmd(reader)
4177 assert(__command == 3)
4178 obj.idle_timeout = reader.read("!H")[0]
4179 obj.hard_timeout = reader.read("!H")[0]
4180 obj.priority = reader.read("!H")[0]
4181 obj.buffer_id = reader.read("!L")[0]
4182 obj.out_port = util.unpack_port_no(reader)
4183 obj.out_group = reader.read("!L")[0]
4184 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004185 reader.skip(2)
4186 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004187 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004188 return obj
4189
4190 def __eq__(self, other):
4191 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004192 if self.xid != other.xid: return False
4193 if self.cookie != other.cookie: return False
4194 if self.cookie_mask != other.cookie_mask: return False
4195 if self.table_id != other.table_id: return False
4196 if self.idle_timeout != other.idle_timeout: return False
4197 if self.hard_timeout != other.hard_timeout: return False
4198 if self.priority != other.priority: return False
4199 if self.buffer_id != other.buffer_id: return False
4200 if self.out_port != other.out_port: return False
4201 if self.out_group != other.out_group: return False
4202 if self.flags != other.flags: return False
4203 if self.match != other.match: return False
4204 if self.instructions != other.instructions: return False
4205 return True
4206
Rich Lanec2ee4b82013-04-24 17:12:38 -07004207 def pretty_print(self, q):
4208 q.text("flow_delete {")
4209 with q.group():
4210 with q.indent(2):
4211 q.breakable()
4212 q.text("xid = ");
4213 if self.xid != None:
4214 q.text("%#x" % self.xid)
4215 else:
4216 q.text('None')
4217 q.text(","); q.breakable()
4218 q.text("cookie = ");
4219 q.text("%#x" % self.cookie)
4220 q.text(","); q.breakable()
4221 q.text("cookie_mask = ");
4222 q.text("%#x" % self.cookie_mask)
4223 q.text(","); q.breakable()
4224 q.text("table_id = ");
4225 q.text("%#x" % self.table_id)
4226 q.text(","); q.breakable()
4227 q.text("idle_timeout = ");
4228 q.text("%#x" % self.idle_timeout)
4229 q.text(","); q.breakable()
4230 q.text("hard_timeout = ");
4231 q.text("%#x" % self.hard_timeout)
4232 q.text(","); q.breakable()
4233 q.text("priority = ");
4234 q.text("%#x" % self.priority)
4235 q.text(","); q.breakable()
4236 q.text("buffer_id = ");
4237 q.text("%#x" % self.buffer_id)
4238 q.text(","); q.breakable()
4239 q.text("out_port = ");
4240 q.text(util.pretty_port(self.out_port))
4241 q.text(","); q.breakable()
4242 q.text("out_group = ");
4243 q.text("%#x" % self.out_group)
4244 q.text(","); q.breakable()
4245 q.text("flags = ");
4246 q.text("%#x" % self.flags)
4247 q.text(","); q.breakable()
4248 q.text("match = ");
4249 q.pp(self.match)
4250 q.text(","); q.breakable()
4251 q.text("instructions = ");
4252 q.pp(self.instructions)
4253 q.breakable()
4254 q.text('}')
4255
Rich Lane7dcdf022013-12-11 14:45:27 -08004256flow_mod.subtypes[3] = flow_delete
4257
4258class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004259 version = 2
4260 type = 14
4261 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07004262
4263 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004264 if xid != None:
4265 self.xid = xid
4266 else:
4267 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004268 if cookie != None:
4269 self.cookie = cookie
4270 else:
4271 self.cookie = 0
4272 if cookie_mask != None:
4273 self.cookie_mask = cookie_mask
4274 else:
4275 self.cookie_mask = 0
4276 if table_id != None:
4277 self.table_id = table_id
4278 else:
4279 self.table_id = 0
4280 if idle_timeout != None:
4281 self.idle_timeout = idle_timeout
4282 else:
4283 self.idle_timeout = 0
4284 if hard_timeout != None:
4285 self.hard_timeout = hard_timeout
4286 else:
4287 self.hard_timeout = 0
4288 if priority != None:
4289 self.priority = priority
4290 else:
4291 self.priority = 0
4292 if buffer_id != None:
4293 self.buffer_id = buffer_id
4294 else:
4295 self.buffer_id = 0
4296 if out_port != None:
4297 self.out_port = out_port
4298 else:
4299 self.out_port = 0
4300 if out_group != None:
4301 self.out_group = out_group
4302 else:
4303 self.out_group = 0
4304 if flags != None:
4305 self.flags = flags
4306 else:
4307 self.flags = 0
4308 if match != None:
4309 self.match = match
4310 else:
4311 self.match = common.match()
4312 if instructions != None:
4313 self.instructions = instructions
4314 else:
4315 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004316 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004317
4318 def pack(self):
4319 packed = []
4320 packed.append(struct.pack("!B", self.version))
4321 packed.append(struct.pack("!B", self.type))
4322 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4323 packed.append(struct.pack("!L", self.xid))
4324 packed.append(struct.pack("!Q", self.cookie))
4325 packed.append(struct.pack("!Q", self.cookie_mask))
4326 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004327 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004328 packed.append(struct.pack("!H", self.idle_timeout))
4329 packed.append(struct.pack("!H", self.hard_timeout))
4330 packed.append(struct.pack("!H", self.priority))
4331 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004332 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004333 packed.append(struct.pack("!L", self.out_group))
4334 packed.append(struct.pack("!H", self.flags))
4335 packed.append('\x00' * 2)
4336 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004337 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004338 length = sum([len(x) for x in packed])
4339 packed[2] = struct.pack("!H", length)
4340 return ''.join(packed)
4341
4342 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004343 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004344 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004345 _version = reader.read("!B")[0]
4346 assert(_version == 2)
4347 _type = reader.read("!B")[0]
4348 assert(_type == 14)
4349 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004350 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004351 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004352 obj.xid = reader.read("!L")[0]
4353 obj.cookie = reader.read("!Q")[0]
4354 obj.cookie_mask = reader.read("!Q")[0]
4355 obj.table_id = reader.read("!B")[0]
4356 __command = util.unpack_fm_cmd(reader)
4357 assert(__command == 4)
4358 obj.idle_timeout = reader.read("!H")[0]
4359 obj.hard_timeout = reader.read("!H")[0]
4360 obj.priority = reader.read("!H")[0]
4361 obj.buffer_id = reader.read("!L")[0]
4362 obj.out_port = util.unpack_port_no(reader)
4363 obj.out_group = reader.read("!L")[0]
4364 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004365 reader.skip(2)
4366 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004367 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004368 return obj
4369
4370 def __eq__(self, other):
4371 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004372 if self.xid != other.xid: return False
4373 if self.cookie != other.cookie: return False
4374 if self.cookie_mask != other.cookie_mask: return False
4375 if self.table_id != other.table_id: return False
4376 if self.idle_timeout != other.idle_timeout: return False
4377 if self.hard_timeout != other.hard_timeout: return False
4378 if self.priority != other.priority: return False
4379 if self.buffer_id != other.buffer_id: return False
4380 if self.out_port != other.out_port: return False
4381 if self.out_group != other.out_group: return False
4382 if self.flags != other.flags: return False
4383 if self.match != other.match: return False
4384 if self.instructions != other.instructions: return False
4385 return True
4386
Rich Lanec2ee4b82013-04-24 17:12:38 -07004387 def pretty_print(self, q):
4388 q.text("flow_delete_strict {")
4389 with q.group():
4390 with q.indent(2):
4391 q.breakable()
4392 q.text("xid = ");
4393 if self.xid != None:
4394 q.text("%#x" % self.xid)
4395 else:
4396 q.text('None')
4397 q.text(","); q.breakable()
4398 q.text("cookie = ");
4399 q.text("%#x" % self.cookie)
4400 q.text(","); q.breakable()
4401 q.text("cookie_mask = ");
4402 q.text("%#x" % self.cookie_mask)
4403 q.text(","); q.breakable()
4404 q.text("table_id = ");
4405 q.text("%#x" % self.table_id)
4406 q.text(","); q.breakable()
4407 q.text("idle_timeout = ");
4408 q.text("%#x" % self.idle_timeout)
4409 q.text(","); q.breakable()
4410 q.text("hard_timeout = ");
4411 q.text("%#x" % self.hard_timeout)
4412 q.text(","); q.breakable()
4413 q.text("priority = ");
4414 q.text("%#x" % self.priority)
4415 q.text(","); q.breakable()
4416 q.text("buffer_id = ");
4417 q.text("%#x" % self.buffer_id)
4418 q.text(","); q.breakable()
4419 q.text("out_port = ");
4420 q.text(util.pretty_port(self.out_port))
4421 q.text(","); q.breakable()
4422 q.text("out_group = ");
4423 q.text("%#x" % self.out_group)
4424 q.text(","); q.breakable()
4425 q.text("flags = ");
4426 q.text("%#x" % self.flags)
4427 q.text(","); q.breakable()
4428 q.text("match = ");
4429 q.pp(self.match)
4430 q.text(","); q.breakable()
4431 q.text("instructions = ");
4432 q.pp(self.instructions)
4433 q.breakable()
4434 q.text('}')
4435
Rich Lane7dcdf022013-12-11 14:45:27 -08004436flow_mod.subtypes[4] = flow_delete_strict
4437
4438class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07004439 version = 2
4440 type = 1
4441 err_type = 5
4442
4443 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004444 if xid != None:
4445 self.xid = xid
4446 else:
4447 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07004448 if code != None:
4449 self.code = code
4450 else:
4451 self.code = 0
4452 if data != None:
4453 self.data = data
4454 else:
4455 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004456 return
Rich Lane6f4978c2013-10-20 21:33:52 -07004457
4458 def pack(self):
4459 packed = []
4460 packed.append(struct.pack("!B", self.version))
4461 packed.append(struct.pack("!B", self.type))
4462 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4463 packed.append(struct.pack("!L", self.xid))
4464 packed.append(struct.pack("!H", self.err_type))
4465 packed.append(struct.pack("!H", self.code))
4466 packed.append(self.data)
4467 length = sum([len(x) for x in packed])
4468 packed[2] = struct.pack("!H", length)
4469 return ''.join(packed)
4470
4471 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004472 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07004473 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07004474 _version = reader.read("!B")[0]
4475 assert(_version == 2)
4476 _type = reader.read("!B")[0]
4477 assert(_type == 1)
4478 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004479 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004480 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07004481 obj.xid = reader.read("!L")[0]
4482 _err_type = reader.read("!H")[0]
4483 assert(_err_type == 5)
4484 obj.code = reader.read("!H")[0]
4485 obj.data = str(reader.read_all())
4486 return obj
4487
4488 def __eq__(self, other):
4489 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07004490 if self.xid != other.xid: return False
4491 if self.code != other.code: return False
4492 if self.data != other.data: return False
4493 return True
4494
Rich Lane6f4978c2013-10-20 21:33:52 -07004495 def pretty_print(self, q):
4496 q.text("flow_mod_failed_error_msg {")
4497 with q.group():
4498 with q.indent(2):
4499 q.breakable()
4500 q.text("xid = ");
4501 if self.xid != None:
4502 q.text("%#x" % self.xid)
4503 else:
4504 q.text('None')
4505 q.text(","); q.breakable()
4506 q.text("code = ");
4507 q.text("%#x" % self.code)
4508 q.text(","); q.breakable()
4509 q.text("data = ");
4510 q.pp(self.data)
4511 q.breakable()
4512 q.text('}')
4513
Rich Lane7dcdf022013-12-11 14:45:27 -08004514error_msg.subtypes[5] = flow_mod_failed_error_msg
4515
4516class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004517 version = 2
4518 type = 14
4519 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07004520
4521 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004522 if xid != None:
4523 self.xid = xid
4524 else:
4525 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004526 if cookie != None:
4527 self.cookie = cookie
4528 else:
4529 self.cookie = 0
4530 if cookie_mask != None:
4531 self.cookie_mask = cookie_mask
4532 else:
4533 self.cookie_mask = 0
4534 if table_id != None:
4535 self.table_id = table_id
4536 else:
4537 self.table_id = 0
4538 if idle_timeout != None:
4539 self.idle_timeout = idle_timeout
4540 else:
4541 self.idle_timeout = 0
4542 if hard_timeout != None:
4543 self.hard_timeout = hard_timeout
4544 else:
4545 self.hard_timeout = 0
4546 if priority != None:
4547 self.priority = priority
4548 else:
4549 self.priority = 0
4550 if buffer_id != None:
4551 self.buffer_id = buffer_id
4552 else:
4553 self.buffer_id = 0
4554 if out_port != None:
4555 self.out_port = out_port
4556 else:
4557 self.out_port = 0
4558 if out_group != None:
4559 self.out_group = out_group
4560 else:
4561 self.out_group = 0
4562 if flags != None:
4563 self.flags = flags
4564 else:
4565 self.flags = 0
4566 if match != None:
4567 self.match = match
4568 else:
4569 self.match = common.match()
4570 if instructions != None:
4571 self.instructions = instructions
4572 else:
4573 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004574 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004575
4576 def pack(self):
4577 packed = []
4578 packed.append(struct.pack("!B", self.version))
4579 packed.append(struct.pack("!B", self.type))
4580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4581 packed.append(struct.pack("!L", self.xid))
4582 packed.append(struct.pack("!Q", self.cookie))
4583 packed.append(struct.pack("!Q", self.cookie_mask))
4584 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004585 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004586 packed.append(struct.pack("!H", self.idle_timeout))
4587 packed.append(struct.pack("!H", self.hard_timeout))
4588 packed.append(struct.pack("!H", self.priority))
4589 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004590 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004591 packed.append(struct.pack("!L", self.out_group))
4592 packed.append(struct.pack("!H", self.flags))
4593 packed.append('\x00' * 2)
4594 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004595 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004596 length = sum([len(x) for x in packed])
4597 packed[2] = struct.pack("!H", length)
4598 return ''.join(packed)
4599
4600 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004601 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004602 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07004603 _version = reader.read("!B")[0]
4604 assert(_version == 2)
4605 _type = reader.read("!B")[0]
4606 assert(_type == 14)
4607 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004608 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004609 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004610 obj.xid = reader.read("!L")[0]
4611 obj.cookie = reader.read("!Q")[0]
4612 obj.cookie_mask = reader.read("!Q")[0]
4613 obj.table_id = reader.read("!B")[0]
4614 __command = util.unpack_fm_cmd(reader)
4615 assert(__command == 1)
4616 obj.idle_timeout = reader.read("!H")[0]
4617 obj.hard_timeout = reader.read("!H")[0]
4618 obj.priority = reader.read("!H")[0]
4619 obj.buffer_id = reader.read("!L")[0]
4620 obj.out_port = util.unpack_port_no(reader)
4621 obj.out_group = reader.read("!L")[0]
4622 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004623 reader.skip(2)
4624 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004625 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004626 return obj
4627
4628 def __eq__(self, other):
4629 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004630 if self.xid != other.xid: return False
4631 if self.cookie != other.cookie: return False
4632 if self.cookie_mask != other.cookie_mask: return False
4633 if self.table_id != other.table_id: return False
4634 if self.idle_timeout != other.idle_timeout: return False
4635 if self.hard_timeout != other.hard_timeout: return False
4636 if self.priority != other.priority: return False
4637 if self.buffer_id != other.buffer_id: return False
4638 if self.out_port != other.out_port: return False
4639 if self.out_group != other.out_group: return False
4640 if self.flags != other.flags: return False
4641 if self.match != other.match: return False
4642 if self.instructions != other.instructions: return False
4643 return True
4644
Rich Lanec2ee4b82013-04-24 17:12:38 -07004645 def pretty_print(self, q):
4646 q.text("flow_modify {")
4647 with q.group():
4648 with q.indent(2):
4649 q.breakable()
4650 q.text("xid = ");
4651 if self.xid != None:
4652 q.text("%#x" % self.xid)
4653 else:
4654 q.text('None')
4655 q.text(","); q.breakable()
4656 q.text("cookie = ");
4657 q.text("%#x" % self.cookie)
4658 q.text(","); q.breakable()
4659 q.text("cookie_mask = ");
4660 q.text("%#x" % self.cookie_mask)
4661 q.text(","); q.breakable()
4662 q.text("table_id = ");
4663 q.text("%#x" % self.table_id)
4664 q.text(","); q.breakable()
4665 q.text("idle_timeout = ");
4666 q.text("%#x" % self.idle_timeout)
4667 q.text(","); q.breakable()
4668 q.text("hard_timeout = ");
4669 q.text("%#x" % self.hard_timeout)
4670 q.text(","); q.breakable()
4671 q.text("priority = ");
4672 q.text("%#x" % self.priority)
4673 q.text(","); q.breakable()
4674 q.text("buffer_id = ");
4675 q.text("%#x" % self.buffer_id)
4676 q.text(","); q.breakable()
4677 q.text("out_port = ");
4678 q.text(util.pretty_port(self.out_port))
4679 q.text(","); q.breakable()
4680 q.text("out_group = ");
4681 q.text("%#x" % self.out_group)
4682 q.text(","); q.breakable()
4683 q.text("flags = ");
4684 q.text("%#x" % self.flags)
4685 q.text(","); q.breakable()
4686 q.text("match = ");
4687 q.pp(self.match)
4688 q.text(","); q.breakable()
4689 q.text("instructions = ");
4690 q.pp(self.instructions)
4691 q.breakable()
4692 q.text('}')
4693
Rich Lane7dcdf022013-12-11 14:45:27 -08004694flow_mod.subtypes[1] = flow_modify
4695
4696class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004697 version = 2
4698 type = 14
4699 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07004700
4701 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004702 if xid != None:
4703 self.xid = xid
4704 else:
4705 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004706 if cookie != None:
4707 self.cookie = cookie
4708 else:
4709 self.cookie = 0
4710 if cookie_mask != None:
4711 self.cookie_mask = cookie_mask
4712 else:
4713 self.cookie_mask = 0
4714 if table_id != None:
4715 self.table_id = table_id
4716 else:
4717 self.table_id = 0
4718 if idle_timeout != None:
4719 self.idle_timeout = idle_timeout
4720 else:
4721 self.idle_timeout = 0
4722 if hard_timeout != None:
4723 self.hard_timeout = hard_timeout
4724 else:
4725 self.hard_timeout = 0
4726 if priority != None:
4727 self.priority = priority
4728 else:
4729 self.priority = 0
4730 if buffer_id != None:
4731 self.buffer_id = buffer_id
4732 else:
4733 self.buffer_id = 0
4734 if out_port != None:
4735 self.out_port = out_port
4736 else:
4737 self.out_port = 0
4738 if out_group != None:
4739 self.out_group = out_group
4740 else:
4741 self.out_group = 0
4742 if flags != None:
4743 self.flags = flags
4744 else:
4745 self.flags = 0
4746 if match != None:
4747 self.match = match
4748 else:
4749 self.match = common.match()
4750 if instructions != None:
4751 self.instructions = instructions
4752 else:
4753 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004754 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004755
4756 def pack(self):
4757 packed = []
4758 packed.append(struct.pack("!B", self.version))
4759 packed.append(struct.pack("!B", self.type))
4760 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4761 packed.append(struct.pack("!L", self.xid))
4762 packed.append(struct.pack("!Q", self.cookie))
4763 packed.append(struct.pack("!Q", self.cookie_mask))
4764 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004765 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004766 packed.append(struct.pack("!H", self.idle_timeout))
4767 packed.append(struct.pack("!H", self.hard_timeout))
4768 packed.append(struct.pack("!H", self.priority))
4769 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004770 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004771 packed.append(struct.pack("!L", self.out_group))
4772 packed.append(struct.pack("!H", self.flags))
4773 packed.append('\x00' * 2)
4774 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08004775 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004776 length = sum([len(x) for x in packed])
4777 packed[2] = struct.pack("!H", length)
4778 return ''.join(packed)
4779
4780 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004781 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004782 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004783 _version = reader.read("!B")[0]
4784 assert(_version == 2)
4785 _type = reader.read("!B")[0]
4786 assert(_type == 14)
4787 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004788 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004789 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004790 obj.xid = reader.read("!L")[0]
4791 obj.cookie = reader.read("!Q")[0]
4792 obj.cookie_mask = reader.read("!Q")[0]
4793 obj.table_id = reader.read("!B")[0]
4794 __command = util.unpack_fm_cmd(reader)
4795 assert(__command == 2)
4796 obj.idle_timeout = reader.read("!H")[0]
4797 obj.hard_timeout = reader.read("!H")[0]
4798 obj.priority = reader.read("!H")[0]
4799 obj.buffer_id = reader.read("!L")[0]
4800 obj.out_port = util.unpack_port_no(reader)
4801 obj.out_group = reader.read("!L")[0]
4802 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004803 reader.skip(2)
4804 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08004805 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004806 return obj
4807
4808 def __eq__(self, other):
4809 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004810 if self.xid != other.xid: return False
4811 if self.cookie != other.cookie: return False
4812 if self.cookie_mask != other.cookie_mask: return False
4813 if self.table_id != other.table_id: return False
4814 if self.idle_timeout != other.idle_timeout: return False
4815 if self.hard_timeout != other.hard_timeout: return False
4816 if self.priority != other.priority: return False
4817 if self.buffer_id != other.buffer_id: return False
4818 if self.out_port != other.out_port: return False
4819 if self.out_group != other.out_group: return False
4820 if self.flags != other.flags: return False
4821 if self.match != other.match: return False
4822 if self.instructions != other.instructions: return False
4823 return True
4824
Rich Lanec2ee4b82013-04-24 17:12:38 -07004825 def pretty_print(self, q):
4826 q.text("flow_modify_strict {")
4827 with q.group():
4828 with q.indent(2):
4829 q.breakable()
4830 q.text("xid = ");
4831 if self.xid != None:
4832 q.text("%#x" % self.xid)
4833 else:
4834 q.text('None')
4835 q.text(","); q.breakable()
4836 q.text("cookie = ");
4837 q.text("%#x" % self.cookie)
4838 q.text(","); q.breakable()
4839 q.text("cookie_mask = ");
4840 q.text("%#x" % self.cookie_mask)
4841 q.text(","); q.breakable()
4842 q.text("table_id = ");
4843 q.text("%#x" % self.table_id)
4844 q.text(","); q.breakable()
4845 q.text("idle_timeout = ");
4846 q.text("%#x" % self.idle_timeout)
4847 q.text(","); q.breakable()
4848 q.text("hard_timeout = ");
4849 q.text("%#x" % self.hard_timeout)
4850 q.text(","); q.breakable()
4851 q.text("priority = ");
4852 q.text("%#x" % self.priority)
4853 q.text(","); q.breakable()
4854 q.text("buffer_id = ");
4855 q.text("%#x" % self.buffer_id)
4856 q.text(","); q.breakable()
4857 q.text("out_port = ");
4858 q.text(util.pretty_port(self.out_port))
4859 q.text(","); q.breakable()
4860 q.text("out_group = ");
4861 q.text("%#x" % self.out_group)
4862 q.text(","); q.breakable()
4863 q.text("flags = ");
4864 q.text("%#x" % self.flags)
4865 q.text(","); q.breakable()
4866 q.text("match = ");
4867 q.pp(self.match)
4868 q.text(","); q.breakable()
4869 q.text("instructions = ");
4870 q.pp(self.instructions)
4871 q.breakable()
4872 q.text('}')
4873
Rich Lane7dcdf022013-12-11 14:45:27 -08004874flow_mod.subtypes[2] = flow_modify_strict
4875
4876class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004877 version = 2
4878 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07004879
4880 def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004881 if xid != None:
4882 self.xid = xid
4883 else:
4884 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004885 if cookie != None:
4886 self.cookie = cookie
4887 else:
4888 self.cookie = 0
4889 if priority != None:
4890 self.priority = priority
4891 else:
4892 self.priority = 0
4893 if reason != None:
4894 self.reason = reason
4895 else:
4896 self.reason = 0
4897 if table_id != None:
4898 self.table_id = table_id
4899 else:
4900 self.table_id = 0
4901 if duration_sec != None:
4902 self.duration_sec = duration_sec
4903 else:
4904 self.duration_sec = 0
4905 if duration_nsec != None:
4906 self.duration_nsec = duration_nsec
4907 else:
4908 self.duration_nsec = 0
4909 if idle_timeout != None:
4910 self.idle_timeout = idle_timeout
4911 else:
4912 self.idle_timeout = 0
4913 if packet_count != None:
4914 self.packet_count = packet_count
4915 else:
4916 self.packet_count = 0
4917 if byte_count != None:
4918 self.byte_count = byte_count
4919 else:
4920 self.byte_count = 0
4921 if match != None:
4922 self.match = match
4923 else:
4924 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08004925 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004926
4927 def pack(self):
4928 packed = []
4929 packed.append(struct.pack("!B", self.version))
4930 packed.append(struct.pack("!B", self.type))
4931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4932 packed.append(struct.pack("!L", self.xid))
4933 packed.append(struct.pack("!Q", self.cookie))
4934 packed.append(struct.pack("!H", self.priority))
4935 packed.append(struct.pack("!B", self.reason))
4936 packed.append(struct.pack("!B", self.table_id))
4937 packed.append(struct.pack("!L", self.duration_sec))
4938 packed.append(struct.pack("!L", self.duration_nsec))
4939 packed.append(struct.pack("!H", self.idle_timeout))
4940 packed.append('\x00' * 2)
4941 packed.append(struct.pack("!Q", self.packet_count))
4942 packed.append(struct.pack("!Q", self.byte_count))
4943 packed.append(self.match.pack())
4944 length = sum([len(x) for x in packed])
4945 packed[2] = struct.pack("!H", length)
4946 return ''.join(packed)
4947
4948 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004949 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004950 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07004951 _version = reader.read("!B")[0]
4952 assert(_version == 2)
4953 _type = reader.read("!B")[0]
4954 assert(_type == 11)
4955 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004956 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004957 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004958 obj.xid = reader.read("!L")[0]
4959 obj.cookie = reader.read("!Q")[0]
4960 obj.priority = reader.read("!H")[0]
4961 obj.reason = reader.read("!B")[0]
4962 obj.table_id = reader.read("!B")[0]
4963 obj.duration_sec = reader.read("!L")[0]
4964 obj.duration_nsec = reader.read("!L")[0]
4965 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004966 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07004967 obj.packet_count = reader.read("!Q")[0]
4968 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004969 obj.match = common.match.unpack(reader)
4970 return obj
4971
4972 def __eq__(self, other):
4973 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004974 if self.xid != other.xid: return False
4975 if self.cookie != other.cookie: return False
4976 if self.priority != other.priority: return False
4977 if self.reason != other.reason: return False
4978 if self.table_id != other.table_id: return False
4979 if self.duration_sec != other.duration_sec: return False
4980 if self.duration_nsec != other.duration_nsec: return False
4981 if self.idle_timeout != other.idle_timeout: return False
4982 if self.packet_count != other.packet_count: return False
4983 if self.byte_count != other.byte_count: return False
4984 if self.match != other.match: return False
4985 return True
4986
Rich Lanec2ee4b82013-04-24 17:12:38 -07004987 def pretty_print(self, q):
4988 q.text("flow_removed {")
4989 with q.group():
4990 with q.indent(2):
4991 q.breakable()
4992 q.text("xid = ");
4993 if self.xid != None:
4994 q.text("%#x" % self.xid)
4995 else:
4996 q.text('None')
4997 q.text(","); q.breakable()
4998 q.text("cookie = ");
4999 q.text("%#x" % self.cookie)
5000 q.text(","); q.breakable()
5001 q.text("priority = ");
5002 q.text("%#x" % self.priority)
5003 q.text(","); q.breakable()
5004 q.text("reason = ");
5005 q.text("%#x" % self.reason)
5006 q.text(","); q.breakable()
5007 q.text("table_id = ");
5008 q.text("%#x" % self.table_id)
5009 q.text(","); q.breakable()
5010 q.text("duration_sec = ");
5011 q.text("%#x" % self.duration_sec)
5012 q.text(","); q.breakable()
5013 q.text("duration_nsec = ");
5014 q.text("%#x" % self.duration_nsec)
5015 q.text(","); q.breakable()
5016 q.text("idle_timeout = ");
5017 q.text("%#x" % self.idle_timeout)
5018 q.text(","); q.breakable()
5019 q.text("packet_count = ");
5020 q.text("%#x" % self.packet_count)
5021 q.text(","); q.breakable()
5022 q.text("byte_count = ");
5023 q.text("%#x" % self.byte_count)
5024 q.text(","); q.breakable()
5025 q.text("match = ");
5026 q.pp(self.match)
5027 q.breakable()
5028 q.text('}')
5029
Rich Lane7dcdf022013-12-11 14:45:27 -08005030message.subtypes[11] = flow_removed
5031
5032class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005033 version = 2
5034 type = 19
5035 stats_type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07005036
5037 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005038 if xid != None:
5039 self.xid = xid
5040 else:
5041 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005042 if flags != None:
5043 self.flags = flags
5044 else:
5045 self.flags = 0
5046 if entries != None:
5047 self.entries = entries
5048 else:
5049 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005050 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005051
5052 def pack(self):
5053 packed = []
5054 packed.append(struct.pack("!B", self.version))
5055 packed.append(struct.pack("!B", self.type))
5056 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5057 packed.append(struct.pack("!L", self.xid))
5058 packed.append(struct.pack("!H", self.stats_type))
5059 packed.append(struct.pack("!H", self.flags))
5060 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005061 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005062 length = sum([len(x) for x in packed])
5063 packed[2] = struct.pack("!H", length)
5064 return ''.join(packed)
5065
5066 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005067 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005068 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005069 _version = reader.read("!B")[0]
5070 assert(_version == 2)
5071 _type = reader.read("!B")[0]
5072 assert(_type == 19)
5073 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005074 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005075 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005076 obj.xid = reader.read("!L")[0]
5077 _stats_type = reader.read("!H")[0]
5078 assert(_stats_type == 1)
5079 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005080 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005081 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005082 return obj
5083
5084 def __eq__(self, other):
5085 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005086 if self.xid != other.xid: return False
5087 if self.flags != other.flags: return False
5088 if self.entries != other.entries: return False
5089 return True
5090
Rich Lanec2ee4b82013-04-24 17:12:38 -07005091 def pretty_print(self, q):
5092 q.text("flow_stats_reply {")
5093 with q.group():
5094 with q.indent(2):
5095 q.breakable()
5096 q.text("xid = ");
5097 if self.xid != None:
5098 q.text("%#x" % self.xid)
5099 else:
5100 q.text('None')
5101 q.text(","); q.breakable()
5102 q.text("flags = ");
5103 q.text("%#x" % self.flags)
5104 q.text(","); q.breakable()
5105 q.text("entries = ");
5106 q.pp(self.entries)
5107 q.breakable()
5108 q.text('}')
5109
Rich Lane7dcdf022013-12-11 14:45:27 -08005110stats_reply.subtypes[1] = flow_stats_reply
5111
5112class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005113 version = 2
5114 type = 18
5115 stats_type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07005116
5117 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005118 if xid != None:
5119 self.xid = xid
5120 else:
5121 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005122 if flags != None:
5123 self.flags = flags
5124 else:
5125 self.flags = 0
5126 if table_id != None:
5127 self.table_id = table_id
5128 else:
5129 self.table_id = 0
5130 if out_port != None:
5131 self.out_port = out_port
5132 else:
5133 self.out_port = 0
5134 if out_group != None:
5135 self.out_group = out_group
5136 else:
5137 self.out_group = 0
5138 if cookie != None:
5139 self.cookie = cookie
5140 else:
5141 self.cookie = 0
5142 if cookie_mask != None:
5143 self.cookie_mask = cookie_mask
5144 else:
5145 self.cookie_mask = 0
5146 if match != None:
5147 self.match = match
5148 else:
5149 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08005150 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005151
5152 def pack(self):
5153 packed = []
5154 packed.append(struct.pack("!B", self.version))
5155 packed.append(struct.pack("!B", self.type))
5156 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5157 packed.append(struct.pack("!L", self.xid))
5158 packed.append(struct.pack("!H", self.stats_type))
5159 packed.append(struct.pack("!H", self.flags))
5160 packed.append('\x00' * 4)
5161 packed.append(struct.pack("!B", self.table_id))
5162 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07005163 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005164 packed.append(struct.pack("!L", self.out_group))
5165 packed.append('\x00' * 4)
5166 packed.append(struct.pack("!Q", self.cookie))
5167 packed.append(struct.pack("!Q", self.cookie_mask))
5168 packed.append(self.match.pack())
5169 length = sum([len(x) for x in packed])
5170 packed[2] = struct.pack("!H", length)
5171 return ''.join(packed)
5172
5173 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005174 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005175 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005176 _version = reader.read("!B")[0]
5177 assert(_version == 2)
5178 _type = reader.read("!B")[0]
5179 assert(_type == 18)
5180 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005181 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005182 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005183 obj.xid = reader.read("!L")[0]
5184 _stats_type = reader.read("!H")[0]
5185 assert(_stats_type == 1)
5186 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005187 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07005188 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005189 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07005190 obj.out_port = util.unpack_port_no(reader)
5191 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005192 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07005193 obj.cookie = reader.read("!Q")[0]
5194 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005195 obj.match = common.match.unpack(reader)
5196 return obj
5197
5198 def __eq__(self, other):
5199 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005200 if self.xid != other.xid: return False
5201 if self.flags != other.flags: return False
5202 if self.table_id != other.table_id: return False
5203 if self.out_port != other.out_port: return False
5204 if self.out_group != other.out_group: return False
5205 if self.cookie != other.cookie: return False
5206 if self.cookie_mask != other.cookie_mask: return False
5207 if self.match != other.match: return False
5208 return True
5209
Rich Lanec2ee4b82013-04-24 17:12:38 -07005210 def pretty_print(self, q):
5211 q.text("flow_stats_request {")
5212 with q.group():
5213 with q.indent(2):
5214 q.breakable()
5215 q.text("xid = ");
5216 if self.xid != None:
5217 q.text("%#x" % self.xid)
5218 else:
5219 q.text('None')
5220 q.text(","); q.breakable()
5221 q.text("flags = ");
5222 q.text("%#x" % self.flags)
5223 q.text(","); q.breakable()
5224 q.text("table_id = ");
5225 q.text("%#x" % self.table_id)
5226 q.text(","); q.breakable()
5227 q.text("out_port = ");
5228 q.text(util.pretty_port(self.out_port))
5229 q.text(","); q.breakable()
5230 q.text("out_group = ");
5231 q.text("%#x" % self.out_group)
5232 q.text(","); q.breakable()
5233 q.text("cookie = ");
5234 q.text("%#x" % self.cookie)
5235 q.text(","); q.breakable()
5236 q.text("cookie_mask = ");
5237 q.text("%#x" % self.cookie_mask)
5238 q.text(","); q.breakable()
5239 q.text("match = ");
5240 q.pp(self.match)
5241 q.breakable()
5242 q.text('}')
5243
Rich Lane7dcdf022013-12-11 14:45:27 -08005244stats_request.subtypes[1] = flow_stats_request
5245
5246class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005247 version = 2
5248 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07005249
5250 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005251 if xid != None:
5252 self.xid = xid
5253 else:
5254 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005255 if flags != None:
5256 self.flags = flags
5257 else:
5258 self.flags = 0
5259 if miss_send_len != None:
5260 self.miss_send_len = miss_send_len
5261 else:
5262 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005263 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005264
5265 def pack(self):
5266 packed = []
5267 packed.append(struct.pack("!B", self.version))
5268 packed.append(struct.pack("!B", self.type))
5269 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5270 packed.append(struct.pack("!L", self.xid))
5271 packed.append(struct.pack("!H", self.flags))
5272 packed.append(struct.pack("!H", self.miss_send_len))
5273 length = sum([len(x) for x in packed])
5274 packed[2] = struct.pack("!H", length)
5275 return ''.join(packed)
5276
5277 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005278 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005279 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005280 _version = reader.read("!B")[0]
5281 assert(_version == 2)
5282 _type = reader.read("!B")[0]
5283 assert(_type == 8)
5284 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005285 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005286 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005287 obj.xid = reader.read("!L")[0]
5288 obj.flags = reader.read("!H")[0]
5289 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005290 return obj
5291
5292 def __eq__(self, other):
5293 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005294 if self.xid != other.xid: return False
5295 if self.flags != other.flags: return False
5296 if self.miss_send_len != other.miss_send_len: return False
5297 return True
5298
Rich Lanec2ee4b82013-04-24 17:12:38 -07005299 def pretty_print(self, q):
5300 q.text("get_config_reply {")
5301 with q.group():
5302 with q.indent(2):
5303 q.breakable()
5304 q.text("xid = ");
5305 if self.xid != None:
5306 q.text("%#x" % self.xid)
5307 else:
5308 q.text('None')
5309 q.text(","); q.breakable()
5310 q.text("flags = ");
5311 q.text("%#x" % self.flags)
5312 q.text(","); q.breakable()
5313 q.text("miss_send_len = ");
5314 q.text("%#x" % self.miss_send_len)
5315 q.breakable()
5316 q.text('}')
5317
Rich Lane7dcdf022013-12-11 14:45:27 -08005318message.subtypes[8] = get_config_reply
5319
5320class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005321 version = 2
5322 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005323
5324 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005325 if xid != None:
5326 self.xid = xid
5327 else:
5328 self.xid = None
5329 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005330
5331 def pack(self):
5332 packed = []
5333 packed.append(struct.pack("!B", self.version))
5334 packed.append(struct.pack("!B", self.type))
5335 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5336 packed.append(struct.pack("!L", self.xid))
5337 length = sum([len(x) for x in packed])
5338 packed[2] = struct.pack("!H", length)
5339 return ''.join(packed)
5340
5341 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005342 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005343 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005344 _version = reader.read("!B")[0]
5345 assert(_version == 2)
5346 _type = reader.read("!B")[0]
5347 assert(_type == 7)
5348 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005349 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005350 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005351 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005352 return obj
5353
5354 def __eq__(self, other):
5355 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005356 if self.xid != other.xid: return False
5357 return True
5358
Rich Lanec2ee4b82013-04-24 17:12:38 -07005359 def pretty_print(self, q):
5360 q.text("get_config_request {")
5361 with q.group():
5362 with q.indent(2):
5363 q.breakable()
5364 q.text("xid = ");
5365 if self.xid != None:
5366 q.text("%#x" % self.xid)
5367 else:
5368 q.text('None')
5369 q.breakable()
5370 q.text('}')
5371
Rich Lane7dcdf022013-12-11 14:45:27 -08005372message.subtypes[7] = get_config_request
5373
5374class group_mod(message):
5375 subtypes = {}
5376
Rich Lane95f7fc92014-01-27 17:08:16 -08005377 version = 2
5378 type = 15
5379
5380 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
5381 if xid != None:
5382 self.xid = xid
5383 else:
5384 self.xid = None
5385 if command != None:
5386 self.command = command
5387 else:
5388 self.command = 0
5389 if group_type != None:
5390 self.group_type = group_type
5391 else:
5392 self.group_type = 0
5393 if group_id != None:
5394 self.group_id = group_id
5395 else:
5396 self.group_id = 0
5397 if buckets != None:
5398 self.buckets = buckets
5399 else:
5400 self.buckets = []
5401 return
5402
5403 def pack(self):
5404 packed = []
5405 packed.append(struct.pack("!B", self.version))
5406 packed.append(struct.pack("!B", self.type))
5407 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5408 packed.append(struct.pack("!L", self.xid))
5409 packed.append(struct.pack("!H", self.command))
5410 packed.append(struct.pack("!B", self.group_type))
5411 packed.append('\x00' * 1)
5412 packed.append(struct.pack("!L", self.group_id))
5413 packed.append(loxi.generic_util.pack_list(self.buckets))
5414 length = sum([len(x) for x in packed])
5415 packed[2] = struct.pack("!H", length)
5416 return ''.join(packed)
5417
Rich Lane7dcdf022013-12-11 14:45:27 -08005418 @staticmethod
5419 def unpack(reader):
5420 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08005421 subclass = group_mod.subtypes.get(subtype)
5422 if subclass:
5423 return subclass.unpack(reader)
5424
5425 obj = group_mod()
5426 _version = reader.read("!B")[0]
5427 assert(_version == 2)
5428 _type = reader.read("!B")[0]
5429 assert(_type == 15)
5430 _length = reader.read("!H")[0]
5431 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005432 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08005433 obj.xid = reader.read("!L")[0]
5434 obj.command = reader.read("!H")[0]
5435 obj.group_type = reader.read("!B")[0]
5436 reader.skip(1)
5437 obj.group_id = reader.read("!L")[0]
5438 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
5439 return obj
5440
5441 def __eq__(self, other):
5442 if type(self) != type(other): return False
5443 if self.xid != other.xid: return False
5444 if self.command != other.command: return False
5445 if self.group_type != other.group_type: return False
5446 if self.group_id != other.group_id: return False
5447 if self.buckets != other.buckets: return False
5448 return True
5449
5450 def pretty_print(self, q):
5451 q.text("group_mod {")
5452 with q.group():
5453 with q.indent(2):
5454 q.breakable()
5455 q.text("xid = ");
5456 if self.xid != None:
5457 q.text("%#x" % self.xid)
5458 else:
5459 q.text('None')
5460 q.text(","); q.breakable()
5461 q.text("group_type = ");
5462 q.text("%#x" % self.group_type)
5463 q.text(","); q.breakable()
5464 q.text("group_id = ");
5465 q.text("%#x" % self.group_id)
5466 q.text(","); q.breakable()
5467 q.text("buckets = ");
5468 q.pp(self.buckets)
5469 q.breakable()
5470 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08005471
5472message.subtypes[15] = group_mod
5473
5474class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005475 version = 2
5476 type = 15
5477 command = 0
5478
5479 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005480 if xid != None:
5481 self.xid = xid
5482 else:
5483 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005484 if group_type != None:
5485 self.group_type = group_type
5486 else:
5487 self.group_type = 0
5488 if group_id != None:
5489 self.group_id = group_id
5490 else:
5491 self.group_id = 0
5492 if buckets != None:
5493 self.buckets = buckets
5494 else:
5495 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005496 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005497
5498 def pack(self):
5499 packed = []
5500 packed.append(struct.pack("!B", self.version))
5501 packed.append(struct.pack("!B", self.type))
5502 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5503 packed.append(struct.pack("!L", self.xid))
5504 packed.append(struct.pack("!H", self.command))
5505 packed.append(struct.pack("!B", self.group_type))
5506 packed.append('\x00' * 1)
5507 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005508 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005509 length = sum([len(x) for x in packed])
5510 packed[2] = struct.pack("!H", length)
5511 return ''.join(packed)
5512
5513 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005514 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005515 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -08005516 _version = reader.read("!B")[0]
5517 assert(_version == 2)
5518 _type = reader.read("!B")[0]
5519 assert(_type == 15)
5520 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005521 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005522 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005523 obj.xid = reader.read("!L")[0]
5524 _command = reader.read("!H")[0]
5525 assert(_command == 0)
5526 obj.group_type = reader.read("!B")[0]
5527 reader.skip(1)
5528 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005529 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005530 return obj
5531
5532 def __eq__(self, other):
5533 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005534 if self.xid != other.xid: return False
5535 if self.group_type != other.group_type: return False
5536 if self.group_id != other.group_id: return False
5537 if self.buckets != other.buckets: return False
5538 return True
5539
Rich Lane7b0f2012013-11-22 14:15:26 -08005540 def pretty_print(self, q):
5541 q.text("group_add {")
5542 with q.group():
5543 with q.indent(2):
5544 q.breakable()
5545 q.text("xid = ");
5546 if self.xid != None:
5547 q.text("%#x" % self.xid)
5548 else:
5549 q.text('None')
5550 q.text(","); q.breakable()
5551 q.text("group_type = ");
5552 q.text("%#x" % self.group_type)
5553 q.text(","); q.breakable()
5554 q.text("group_id = ");
5555 q.text("%#x" % self.group_id)
5556 q.text(","); q.breakable()
5557 q.text("buckets = ");
5558 q.pp(self.buckets)
5559 q.breakable()
5560 q.text('}')
5561
Rich Lane7dcdf022013-12-11 14:45:27 -08005562group_mod.subtypes[0] = group_add
5563
5564class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005565 version = 2
5566 type = 15
5567 command = 2
5568
5569 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005570 if xid != None:
5571 self.xid = xid
5572 else:
5573 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005574 if group_type != None:
5575 self.group_type = group_type
5576 else:
5577 self.group_type = 0
5578 if group_id != None:
5579 self.group_id = group_id
5580 else:
5581 self.group_id = 0
5582 if buckets != None:
5583 self.buckets = buckets
5584 else:
5585 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005586 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005587
5588 def pack(self):
5589 packed = []
5590 packed.append(struct.pack("!B", self.version))
5591 packed.append(struct.pack("!B", self.type))
5592 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5593 packed.append(struct.pack("!L", self.xid))
5594 packed.append(struct.pack("!H", self.command))
5595 packed.append(struct.pack("!B", self.group_type))
5596 packed.append('\x00' * 1)
5597 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005598 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005599 length = sum([len(x) for x in packed])
5600 packed[2] = struct.pack("!H", length)
5601 return ''.join(packed)
5602
5603 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005604 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005605 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -08005606 _version = reader.read("!B")[0]
5607 assert(_version == 2)
5608 _type = reader.read("!B")[0]
5609 assert(_type == 15)
5610 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005611 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005612 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005613 obj.xid = reader.read("!L")[0]
5614 _command = reader.read("!H")[0]
5615 assert(_command == 2)
5616 obj.group_type = reader.read("!B")[0]
5617 reader.skip(1)
5618 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005619 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005620 return obj
5621
5622 def __eq__(self, other):
5623 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005624 if self.xid != other.xid: return False
5625 if self.group_type != other.group_type: return False
5626 if self.group_id != other.group_id: return False
5627 if self.buckets != other.buckets: return False
5628 return True
5629
Rich Lane7b0f2012013-11-22 14:15:26 -08005630 def pretty_print(self, q):
5631 q.text("group_delete {")
5632 with q.group():
5633 with q.indent(2):
5634 q.breakable()
5635 q.text("xid = ");
5636 if self.xid != None:
5637 q.text("%#x" % self.xid)
5638 else:
5639 q.text('None')
5640 q.text(","); q.breakable()
5641 q.text("group_type = ");
5642 q.text("%#x" % self.group_type)
5643 q.text(","); q.breakable()
5644 q.text("group_id = ");
5645 q.text("%#x" % self.group_id)
5646 q.text(","); q.breakable()
5647 q.text("buckets = ");
5648 q.pp(self.buckets)
5649 q.breakable()
5650 q.text('}')
5651
Rich Lane7dcdf022013-12-11 14:45:27 -08005652group_mod.subtypes[2] = group_delete
5653
5654class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005655 version = 2
5656 type = 19
5657 stats_type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005658
5659 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005660 if xid != None:
5661 self.xid = xid
5662 else:
5663 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005664 if flags != None:
5665 self.flags = flags
5666 else:
5667 self.flags = 0
5668 if entries != None:
5669 self.entries = entries
5670 else:
5671 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005672 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005673
5674 def pack(self):
5675 packed = []
5676 packed.append(struct.pack("!B", self.version))
5677 packed.append(struct.pack("!B", self.type))
5678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5679 packed.append(struct.pack("!L", self.xid))
5680 packed.append(struct.pack("!H", self.stats_type))
5681 packed.append(struct.pack("!H", self.flags))
5682 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005683 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005684 length = sum([len(x) for x in packed])
5685 packed[2] = struct.pack("!H", length)
5686 return ''.join(packed)
5687
5688 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005689 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005690 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005691 _version = reader.read("!B")[0]
5692 assert(_version == 2)
5693 _type = reader.read("!B")[0]
5694 assert(_type == 19)
5695 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005696 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005697 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005698 obj.xid = reader.read("!L")[0]
5699 _stats_type = reader.read("!H")[0]
5700 assert(_stats_type == 7)
5701 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005702 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005703 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005704 return obj
5705
5706 def __eq__(self, other):
5707 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005708 if self.xid != other.xid: return False
5709 if self.flags != other.flags: return False
5710 if self.entries != other.entries: return False
5711 return True
5712
Rich Lanec2ee4b82013-04-24 17:12:38 -07005713 def pretty_print(self, q):
5714 q.text("group_desc_stats_reply {")
5715 with q.group():
5716 with q.indent(2):
5717 q.breakable()
5718 q.text("xid = ");
5719 if self.xid != None:
5720 q.text("%#x" % self.xid)
5721 else:
5722 q.text('None')
5723 q.text(","); q.breakable()
5724 q.text("flags = ");
5725 q.text("%#x" % self.flags)
5726 q.text(","); q.breakable()
5727 q.text("entries = ");
5728 q.pp(self.entries)
5729 q.breakable()
5730 q.text('}')
5731
Rich Lane7dcdf022013-12-11 14:45:27 -08005732stats_reply.subtypes[7] = group_desc_stats_reply
5733
5734class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005735 version = 2
5736 type = 18
5737 stats_type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07005738
5739 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005740 if xid != None:
5741 self.xid = xid
5742 else:
5743 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005744 if flags != None:
5745 self.flags = flags
5746 else:
5747 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005748 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005749
5750 def pack(self):
5751 packed = []
5752 packed.append(struct.pack("!B", self.version))
5753 packed.append(struct.pack("!B", self.type))
5754 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5755 packed.append(struct.pack("!L", self.xid))
5756 packed.append(struct.pack("!H", self.stats_type))
5757 packed.append(struct.pack("!H", self.flags))
5758 packed.append('\x00' * 4)
5759 length = sum([len(x) for x in packed])
5760 packed[2] = struct.pack("!H", length)
5761 return ''.join(packed)
5762
5763 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005764 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005765 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005766 _version = reader.read("!B")[0]
5767 assert(_version == 2)
5768 _type = reader.read("!B")[0]
5769 assert(_type == 18)
5770 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005771 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005772 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005773 obj.xid = reader.read("!L")[0]
5774 _stats_type = reader.read("!H")[0]
5775 assert(_stats_type == 7)
5776 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005777 reader.skip(4)
5778 return obj
5779
5780 def __eq__(self, other):
5781 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005782 if self.xid != other.xid: return False
5783 if self.flags != other.flags: return False
5784 return True
5785
Rich Lanec2ee4b82013-04-24 17:12:38 -07005786 def pretty_print(self, q):
5787 q.text("group_desc_stats_request {")
5788 with q.group():
5789 with q.indent(2):
5790 q.breakable()
5791 q.text("xid = ");
5792 if self.xid != None:
5793 q.text("%#x" % self.xid)
5794 else:
5795 q.text('None')
5796 q.text(","); q.breakable()
5797 q.text("flags = ");
5798 q.text("%#x" % self.flags)
5799 q.breakable()
5800 q.text('}')
5801
Rich Lane7dcdf022013-12-11 14:45:27 -08005802stats_request.subtypes[7] = group_desc_stats_request
5803
5804class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005805 version = 2
5806 type = 1
5807 err_type = 6
5808
5809 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005810 if xid != None:
5811 self.xid = xid
5812 else:
5813 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005814 if code != None:
5815 self.code = code
5816 else:
5817 self.code = 0
5818 if data != None:
5819 self.data = data
5820 else:
5821 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005822 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005823
5824 def pack(self):
5825 packed = []
5826 packed.append(struct.pack("!B", self.version))
5827 packed.append(struct.pack("!B", self.type))
5828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5829 packed.append(struct.pack("!L", self.xid))
5830 packed.append(struct.pack("!H", self.err_type))
5831 packed.append(struct.pack("!H", self.code))
5832 packed.append(self.data)
5833 length = sum([len(x) for x in packed])
5834 packed[2] = struct.pack("!H", length)
5835 return ''.join(packed)
5836
5837 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005838 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005839 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005840 _version = reader.read("!B")[0]
5841 assert(_version == 2)
5842 _type = reader.read("!B")[0]
5843 assert(_type == 1)
5844 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005845 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005846 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07005847 obj.xid = reader.read("!L")[0]
5848 _err_type = reader.read("!H")[0]
5849 assert(_err_type == 6)
5850 obj.code = reader.read("!H")[0]
5851 obj.data = str(reader.read_all())
5852 return obj
5853
5854 def __eq__(self, other):
5855 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005856 if self.xid != other.xid: return False
5857 if self.code != other.code: return False
5858 if self.data != other.data: return False
5859 return True
5860
Rich Lane6f4978c2013-10-20 21:33:52 -07005861 def pretty_print(self, q):
5862 q.text("group_mod_failed_error_msg {")
5863 with q.group():
5864 with q.indent(2):
5865 q.breakable()
5866 q.text("xid = ");
5867 if self.xid != None:
5868 q.text("%#x" % self.xid)
5869 else:
5870 q.text('None')
5871 q.text(","); q.breakable()
5872 q.text("code = ");
5873 q.text("%#x" % self.code)
5874 q.text(","); q.breakable()
5875 q.text("data = ");
5876 q.pp(self.data)
5877 q.breakable()
5878 q.text('}')
5879
Rich Lane7dcdf022013-12-11 14:45:27 -08005880error_msg.subtypes[6] = group_mod_failed_error_msg
5881
5882class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08005883 version = 2
5884 type = 15
5885 command = 1
5886
5887 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005888 if xid != None:
5889 self.xid = xid
5890 else:
5891 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005892 if group_type != None:
5893 self.group_type = group_type
5894 else:
5895 self.group_type = 0
5896 if group_id != None:
5897 self.group_id = group_id
5898 else:
5899 self.group_id = 0
5900 if buckets != None:
5901 self.buckets = buckets
5902 else:
5903 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005904 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005905
5906 def pack(self):
5907 packed = []
5908 packed.append(struct.pack("!B", self.version))
5909 packed.append(struct.pack("!B", self.type))
5910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5911 packed.append(struct.pack("!L", self.xid))
5912 packed.append(struct.pack("!H", self.command))
5913 packed.append(struct.pack("!B", self.group_type))
5914 packed.append('\x00' * 1)
5915 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08005916 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08005917 length = sum([len(x) for x in packed])
5918 packed[2] = struct.pack("!H", length)
5919 return ''.join(packed)
5920
5921 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005922 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005923 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -08005924 _version = reader.read("!B")[0]
5925 assert(_version == 2)
5926 _type = reader.read("!B")[0]
5927 assert(_type == 15)
5928 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005929 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005930 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005931 obj.xid = reader.read("!L")[0]
5932 _command = reader.read("!H")[0]
5933 assert(_command == 1)
5934 obj.group_type = reader.read("!B")[0]
5935 reader.skip(1)
5936 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005937 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005938 return obj
5939
5940 def __eq__(self, other):
5941 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005942 if self.xid != other.xid: return False
5943 if self.group_type != other.group_type: return False
5944 if self.group_id != other.group_id: return False
5945 if self.buckets != other.buckets: return False
5946 return True
5947
Rich Lane7b0f2012013-11-22 14:15:26 -08005948 def pretty_print(self, q):
5949 q.text("group_modify {")
5950 with q.group():
5951 with q.indent(2):
5952 q.breakable()
5953 q.text("xid = ");
5954 if self.xid != None:
5955 q.text("%#x" % self.xid)
5956 else:
5957 q.text('None')
5958 q.text(","); q.breakable()
5959 q.text("group_type = ");
5960 q.text("%#x" % self.group_type)
5961 q.text(","); q.breakable()
5962 q.text("group_id = ");
5963 q.text("%#x" % self.group_id)
5964 q.text(","); q.breakable()
5965 q.text("buckets = ");
5966 q.pp(self.buckets)
5967 q.breakable()
5968 q.text('}')
5969
Rich Lane7dcdf022013-12-11 14:45:27 -08005970group_mod.subtypes[1] = group_modify
5971
5972class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005973 version = 2
5974 type = 19
5975 stats_type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07005976
5977 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005978 if xid != None:
5979 self.xid = xid
5980 else:
5981 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005982 if flags != None:
5983 self.flags = flags
5984 else:
5985 self.flags = 0
5986 if entries != None:
5987 self.entries = entries
5988 else:
5989 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005990 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005991
5992 def pack(self):
5993 packed = []
5994 packed.append(struct.pack("!B", self.version))
5995 packed.append(struct.pack("!B", self.type))
5996 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5997 packed.append(struct.pack("!L", self.xid))
5998 packed.append(struct.pack("!H", self.stats_type))
5999 packed.append(struct.pack("!H", self.flags))
6000 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006001 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006002 length = sum([len(x) for x in packed])
6003 packed[2] = struct.pack("!H", length)
6004 return ''.join(packed)
6005
6006 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006007 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006008 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006009 _version = reader.read("!B")[0]
6010 assert(_version == 2)
6011 _type = reader.read("!B")[0]
6012 assert(_type == 19)
6013 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006014 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006015 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006016 obj.xid = reader.read("!L")[0]
6017 _stats_type = reader.read("!H")[0]
6018 assert(_stats_type == 6)
6019 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006020 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006021 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006022 return obj
6023
6024 def __eq__(self, other):
6025 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006026 if self.xid != other.xid: return False
6027 if self.flags != other.flags: return False
6028 if self.entries != other.entries: return False
6029 return True
6030
Rich Lanec2ee4b82013-04-24 17:12:38 -07006031 def pretty_print(self, q):
6032 q.text("group_stats_reply {")
6033 with q.group():
6034 with q.indent(2):
6035 q.breakable()
6036 q.text("xid = ");
6037 if self.xid != None:
6038 q.text("%#x" % self.xid)
6039 else:
6040 q.text('None')
6041 q.text(","); q.breakable()
6042 q.text("flags = ");
6043 q.text("%#x" % self.flags)
6044 q.text(","); q.breakable()
6045 q.text("entries = ");
6046 q.pp(self.entries)
6047 q.breakable()
6048 q.text('}')
6049
Rich Lane7dcdf022013-12-11 14:45:27 -08006050stats_reply.subtypes[6] = group_stats_reply
6051
6052class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006053 version = 2
6054 type = 18
6055 stats_type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07006056
6057 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006058 if xid != None:
6059 self.xid = xid
6060 else:
6061 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006062 if flags != None:
6063 self.flags = flags
6064 else:
6065 self.flags = 0
6066 if group_id != None:
6067 self.group_id = group_id
6068 else:
6069 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006070 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006071
6072 def pack(self):
6073 packed = []
6074 packed.append(struct.pack("!B", self.version))
6075 packed.append(struct.pack("!B", self.type))
6076 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6077 packed.append(struct.pack("!L", self.xid))
6078 packed.append(struct.pack("!H", self.stats_type))
6079 packed.append(struct.pack("!H", self.flags))
6080 packed.append('\x00' * 4)
6081 packed.append(struct.pack("!L", self.group_id))
6082 packed.append('\x00' * 4)
6083 length = sum([len(x) for x in packed])
6084 packed[2] = struct.pack("!H", length)
6085 return ''.join(packed)
6086
6087 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006088 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006089 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006090 _version = reader.read("!B")[0]
6091 assert(_version == 2)
6092 _type = reader.read("!B")[0]
6093 assert(_type == 18)
6094 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006095 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006096 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006097 obj.xid = reader.read("!L")[0]
6098 _stats_type = reader.read("!H")[0]
6099 assert(_stats_type == 6)
6100 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006101 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006102 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006103 reader.skip(4)
6104 return obj
6105
6106 def __eq__(self, other):
6107 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006108 if self.xid != other.xid: return False
6109 if self.flags != other.flags: return False
6110 if self.group_id != other.group_id: return False
6111 return True
6112
Rich Lanec2ee4b82013-04-24 17:12:38 -07006113 def pretty_print(self, q):
6114 q.text("group_stats_request {")
6115 with q.group():
6116 with q.indent(2):
6117 q.breakable()
6118 q.text("xid = ");
6119 if self.xid != None:
6120 q.text("%#x" % self.xid)
6121 else:
6122 q.text('None')
6123 q.text(","); q.breakable()
6124 q.text("flags = ");
6125 q.text("%#x" % self.flags)
6126 q.text(","); q.breakable()
6127 q.text("group_id = ");
6128 q.text("%#x" % self.group_id)
6129 q.breakable()
6130 q.text('}')
6131
Rich Lane7dcdf022013-12-11 14:45:27 -08006132stats_request.subtypes[6] = group_stats_request
6133
6134class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006135 version = 2
6136 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07006137
6138 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006139 if xid != None:
6140 self.xid = xid
6141 else:
6142 self.xid = None
6143 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006144
6145 def pack(self):
6146 packed = []
6147 packed.append(struct.pack("!B", self.version))
6148 packed.append(struct.pack("!B", self.type))
6149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6150 packed.append(struct.pack("!L", self.xid))
6151 length = sum([len(x) for x in packed])
6152 packed[2] = struct.pack("!H", length)
6153 return ''.join(packed)
6154
6155 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006156 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006157 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07006158 _version = reader.read("!B")[0]
6159 assert(_version == 2)
6160 _type = reader.read("!B")[0]
6161 assert(_type == 0)
6162 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006163 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006164 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006165 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006166 return obj
6167
6168 def __eq__(self, other):
6169 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006170 if self.xid != other.xid: return False
6171 return True
6172
Rich Lanec2ee4b82013-04-24 17:12:38 -07006173 def pretty_print(self, q):
6174 q.text("hello {")
6175 with q.group():
6176 with q.indent(2):
6177 q.breakable()
6178 q.text("xid = ");
6179 if self.xid != None:
6180 q.text("%#x" % self.xid)
6181 else:
6182 q.text('None')
6183 q.breakable()
6184 q.text('}')
6185
Rich Lane7dcdf022013-12-11 14:45:27 -08006186message.subtypes[0] = hello
6187
6188class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006189 version = 2
6190 type = 1
6191 err_type = 0
6192
6193 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006194 if xid != None:
6195 self.xid = xid
6196 else:
6197 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006198 if code != None:
6199 self.code = code
6200 else:
6201 self.code = 0
6202 if data != None:
6203 self.data = data
6204 else:
6205 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006206 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006207
6208 def pack(self):
6209 packed = []
6210 packed.append(struct.pack("!B", self.version))
6211 packed.append(struct.pack("!B", self.type))
6212 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6213 packed.append(struct.pack("!L", self.xid))
6214 packed.append(struct.pack("!H", self.err_type))
6215 packed.append(struct.pack("!H", self.code))
6216 packed.append(self.data)
6217 length = sum([len(x) for x in packed])
6218 packed[2] = struct.pack("!H", length)
6219 return ''.join(packed)
6220
6221 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006222 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006223 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006224 _version = reader.read("!B")[0]
6225 assert(_version == 2)
6226 _type = reader.read("!B")[0]
6227 assert(_type == 1)
6228 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006229 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006230 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006231 obj.xid = reader.read("!L")[0]
6232 _err_type = reader.read("!H")[0]
6233 assert(_err_type == 0)
6234 obj.code = reader.read("!H")[0]
6235 obj.data = str(reader.read_all())
6236 return obj
6237
6238 def __eq__(self, other):
6239 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006240 if self.xid != other.xid: return False
6241 if self.code != other.code: return False
6242 if self.data != other.data: return False
6243 return True
6244
Rich Lane6f4978c2013-10-20 21:33:52 -07006245 def pretty_print(self, q):
6246 q.text("hello_failed_error_msg {")
6247 with q.group():
6248 with q.indent(2):
6249 q.breakable()
6250 q.text("xid = ");
6251 if self.xid != None:
6252 q.text("%#x" % self.xid)
6253 else:
6254 q.text('None')
6255 q.text(","); q.breakable()
6256 q.text("code = ");
6257 q.text("%#x" % self.code)
6258 q.text(","); q.breakable()
6259 q.text("data = ");
6260 q.pp(self.data)
6261 q.breakable()
6262 q.text('}')
6263
Rich Lane7dcdf022013-12-11 14:45:27 -08006264error_msg.subtypes[0] = hello_failed_error_msg
6265
6266class nicira_header(experimenter):
6267 subtypes = {}
6268
Rich Lane95f7fc92014-01-27 17:08:16 -08006269 version = 2
6270 type = 4
6271 experimenter = 8992
6272
6273 def __init__(self, xid=None, subtype=None):
6274 if xid != None:
6275 self.xid = xid
6276 else:
6277 self.xid = None
6278 if subtype != None:
6279 self.subtype = subtype
6280 else:
6281 self.subtype = 0
6282 return
6283
6284 def pack(self):
6285 packed = []
6286 packed.append(struct.pack("!B", self.version))
6287 packed.append(struct.pack("!B", self.type))
6288 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6289 packed.append(struct.pack("!L", self.xid))
6290 packed.append(struct.pack("!L", self.experimenter))
6291 packed.append(struct.pack("!L", self.subtype))
6292 length = sum([len(x) for x in packed])
6293 packed[2] = struct.pack("!H", length)
6294 return ''.join(packed)
6295
Rich Lane7dcdf022013-12-11 14:45:27 -08006296 @staticmethod
6297 def unpack(reader):
6298 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006299 subclass = nicira_header.subtypes.get(subtype)
6300 if subclass:
6301 return subclass.unpack(reader)
6302
6303 obj = nicira_header()
6304 _version = reader.read("!B")[0]
6305 assert(_version == 2)
6306 _type = reader.read("!B")[0]
6307 assert(_type == 4)
6308 _length = reader.read("!H")[0]
6309 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006310 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08006311 obj.xid = reader.read("!L")[0]
6312 _experimenter = reader.read("!L")[0]
6313 assert(_experimenter == 8992)
6314 obj.subtype = reader.read("!L")[0]
6315 return obj
6316
6317 def __eq__(self, other):
6318 if type(self) != type(other): return False
6319 if self.xid != other.xid: return False
6320 if self.subtype != other.subtype: return False
6321 return True
6322
6323 def pretty_print(self, q):
6324 q.text("nicira_header {")
6325 with q.group():
6326 with q.indent(2):
6327 q.breakable()
6328 q.text("xid = ");
6329 if self.xid != None:
6330 q.text("%#x" % self.xid)
6331 else:
6332 q.text('None')
6333 q.breakable()
6334 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006335
6336experimenter.subtypes[8992] = nicira_header
6337
6338class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006339 version = 2
6340 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -07006341
6342 def __init__(self, xid=None, buffer_id=None, in_port=None, in_phy_port=None, total_len=None, reason=None, table_id=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006343 if xid != None:
6344 self.xid = xid
6345 else:
6346 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006347 if buffer_id != None:
6348 self.buffer_id = buffer_id
6349 else:
6350 self.buffer_id = 0
6351 if in_port != None:
6352 self.in_port = in_port
6353 else:
6354 self.in_port = 0
6355 if in_phy_port != None:
6356 self.in_phy_port = in_phy_port
6357 else:
6358 self.in_phy_port = 0
6359 if total_len != None:
6360 self.total_len = total_len
6361 else:
6362 self.total_len = 0
6363 if reason != None:
6364 self.reason = reason
6365 else:
6366 self.reason = 0
6367 if table_id != None:
6368 self.table_id = table_id
6369 else:
6370 self.table_id = 0
6371 if data != None:
6372 self.data = data
6373 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006374 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006375 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006376
6377 def pack(self):
6378 packed = []
6379 packed.append(struct.pack("!B", self.version))
6380 packed.append(struct.pack("!B", self.type))
6381 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6382 packed.append(struct.pack("!L", self.xid))
6383 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006384 packed.append(util.pack_port_no(self.in_port))
6385 packed.append(util.pack_port_no(self.in_phy_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006386 packed.append(struct.pack("!H", self.total_len))
6387 packed.append(struct.pack("!B", self.reason))
6388 packed.append(struct.pack("!B", self.table_id))
6389 packed.append(self.data)
6390 length = sum([len(x) for x in packed])
6391 packed[2] = struct.pack("!H", length)
6392 return ''.join(packed)
6393
6394 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006395 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006396 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006397 _version = reader.read("!B")[0]
6398 assert(_version == 2)
6399 _type = reader.read("!B")[0]
6400 assert(_type == 10)
6401 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006402 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006403 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006404 obj.xid = reader.read("!L")[0]
6405 obj.buffer_id = reader.read("!L")[0]
6406 obj.in_port = util.unpack_port_no(reader)
6407 obj.in_phy_port = util.unpack_port_no(reader)
6408 obj.total_len = reader.read("!H")[0]
6409 obj.reason = reader.read("!B")[0]
6410 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006411 obj.data = str(reader.read_all())
6412 return obj
6413
6414 def __eq__(self, other):
6415 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006416 if self.xid != other.xid: return False
6417 if self.buffer_id != other.buffer_id: return False
6418 if self.in_port != other.in_port: return False
6419 if self.in_phy_port != other.in_phy_port: return False
6420 if self.total_len != other.total_len: return False
6421 if self.reason != other.reason: return False
6422 if self.table_id != other.table_id: return False
6423 if self.data != other.data: return False
6424 return True
6425
Rich Lanec2ee4b82013-04-24 17:12:38 -07006426 def pretty_print(self, q):
6427 q.text("packet_in {")
6428 with q.group():
6429 with q.indent(2):
6430 q.breakable()
6431 q.text("xid = ");
6432 if self.xid != None:
6433 q.text("%#x" % self.xid)
6434 else:
6435 q.text('None')
6436 q.text(","); q.breakable()
6437 q.text("buffer_id = ");
6438 q.text("%#x" % self.buffer_id)
6439 q.text(","); q.breakable()
6440 q.text("in_port = ");
6441 q.text(util.pretty_port(self.in_port))
6442 q.text(","); q.breakable()
6443 q.text("in_phy_port = ");
6444 q.text(util.pretty_port(self.in_phy_port))
6445 q.text(","); q.breakable()
6446 q.text("total_len = ");
6447 q.text("%#x" % self.total_len)
6448 q.text(","); q.breakable()
6449 q.text("reason = ");
6450 q.text("%#x" % self.reason)
6451 q.text(","); q.breakable()
6452 q.text("table_id = ");
6453 q.text("%#x" % self.table_id)
6454 q.text(","); q.breakable()
6455 q.text("data = ");
6456 q.pp(self.data)
6457 q.breakable()
6458 q.text('}')
6459
Rich Lane7dcdf022013-12-11 14:45:27 -08006460message.subtypes[10] = packet_in
6461
6462class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006463 version = 2
6464 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -07006465
6466 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006467 if xid != None:
6468 self.xid = xid
6469 else:
6470 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006471 if buffer_id != None:
6472 self.buffer_id = buffer_id
6473 else:
6474 self.buffer_id = 0
6475 if in_port != None:
6476 self.in_port = in_port
6477 else:
6478 self.in_port = 0
6479 if actions != None:
6480 self.actions = actions
6481 else:
6482 self.actions = []
6483 if data != None:
6484 self.data = data
6485 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006486 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006487 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006488
6489 def pack(self):
6490 packed = []
6491 packed.append(struct.pack("!B", self.version))
6492 packed.append(struct.pack("!B", self.type))
6493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6494 packed.append(struct.pack("!L", self.xid))
6495 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006496 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006497 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
6498 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006499 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006500 packed[6] = struct.pack("!H", len(packed[-1]))
6501 packed.append(self.data)
6502 length = sum([len(x) for x in packed])
6503 packed[2] = struct.pack("!H", length)
6504 return ''.join(packed)
6505
6506 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006507 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006508 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006509 _version = reader.read("!B")[0]
6510 assert(_version == 2)
6511 _type = reader.read("!B")[0]
6512 assert(_type == 13)
6513 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006514 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006515 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006516 obj.xid = reader.read("!L")[0]
6517 obj.buffer_id = reader.read("!L")[0]
6518 obj.in_port = util.unpack_port_no(reader)
6519 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006520 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006521 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006522 obj.data = str(reader.read_all())
6523 return obj
6524
6525 def __eq__(self, other):
6526 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006527 if self.xid != other.xid: return False
6528 if self.buffer_id != other.buffer_id: return False
6529 if self.in_port != other.in_port: return False
6530 if self.actions != other.actions: return False
6531 if self.data != other.data: return False
6532 return True
6533
Rich Lanec2ee4b82013-04-24 17:12:38 -07006534 def pretty_print(self, q):
6535 q.text("packet_out {")
6536 with q.group():
6537 with q.indent(2):
6538 q.breakable()
6539 q.text("xid = ");
6540 if self.xid != None:
6541 q.text("%#x" % self.xid)
6542 else:
6543 q.text('None')
6544 q.text(","); q.breakable()
6545 q.text("buffer_id = ");
6546 q.text("%#x" % self.buffer_id)
6547 q.text(","); q.breakable()
6548 q.text("in_port = ");
6549 q.text(util.pretty_port(self.in_port))
6550 q.text(","); q.breakable()
6551 q.text("actions = ");
6552 q.pp(self.actions)
6553 q.text(","); q.breakable()
6554 q.text("data = ");
6555 q.pp(self.data)
6556 q.breakable()
6557 q.text('}')
6558
Rich Lane7dcdf022013-12-11 14:45:27 -08006559message.subtypes[13] = packet_out
6560
6561class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006562 version = 2
6563 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -07006564
6565 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006566 if xid != None:
6567 self.xid = xid
6568 else:
6569 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006570 if port_no != None:
6571 self.port_no = port_no
6572 else:
6573 self.port_no = 0
6574 if hw_addr != None:
6575 self.hw_addr = hw_addr
6576 else:
6577 self.hw_addr = [0,0,0,0,0,0]
6578 if config != None:
6579 self.config = config
6580 else:
6581 self.config = 0
6582 if mask != None:
6583 self.mask = mask
6584 else:
6585 self.mask = 0
6586 if advertise != None:
6587 self.advertise = advertise
6588 else:
6589 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006590 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006591
6592 def pack(self):
6593 packed = []
6594 packed.append(struct.pack("!B", self.version))
6595 packed.append(struct.pack("!B", self.type))
6596 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6597 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006598 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006599 packed.append('\x00' * 4)
6600 packed.append(struct.pack("!6B", *self.hw_addr))
6601 packed.append('\x00' * 2)
6602 packed.append(struct.pack("!L", self.config))
6603 packed.append(struct.pack("!L", self.mask))
6604 packed.append(struct.pack("!L", self.advertise))
6605 packed.append('\x00' * 4)
6606 length = sum([len(x) for x in packed])
6607 packed[2] = struct.pack("!H", length)
6608 return ''.join(packed)
6609
6610 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006611 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006612 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006613 _version = reader.read("!B")[0]
6614 assert(_version == 2)
6615 _type = reader.read("!B")[0]
6616 assert(_type == 16)
6617 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006618 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006619 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006620 obj.xid = reader.read("!L")[0]
6621 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006622 reader.skip(4)
6623 obj.hw_addr = list(reader.read('!6B'))
6624 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07006625 obj.config = reader.read("!L")[0]
6626 obj.mask = reader.read("!L")[0]
6627 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006628 reader.skip(4)
6629 return obj
6630
6631 def __eq__(self, other):
6632 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006633 if self.xid != other.xid: return False
6634 if self.port_no != other.port_no: return False
6635 if self.hw_addr != other.hw_addr: return False
6636 if self.config != other.config: return False
6637 if self.mask != other.mask: return False
6638 if self.advertise != other.advertise: return False
6639 return True
6640
Rich Lanec2ee4b82013-04-24 17:12:38 -07006641 def pretty_print(self, q):
6642 q.text("port_mod {")
6643 with q.group():
6644 with q.indent(2):
6645 q.breakable()
6646 q.text("xid = ");
6647 if self.xid != None:
6648 q.text("%#x" % self.xid)
6649 else:
6650 q.text('None')
6651 q.text(","); q.breakable()
6652 q.text("port_no = ");
6653 q.text(util.pretty_port(self.port_no))
6654 q.text(","); q.breakable()
6655 q.text("hw_addr = ");
6656 q.text(util.pretty_mac(self.hw_addr))
6657 q.text(","); q.breakable()
6658 q.text("config = ");
6659 q.text("%#x" % self.config)
6660 q.text(","); q.breakable()
6661 q.text("mask = ");
6662 q.text("%#x" % self.mask)
6663 q.text(","); q.breakable()
6664 q.text("advertise = ");
6665 q.text("%#x" % self.advertise)
6666 q.breakable()
6667 q.text('}')
6668
Rich Lane7dcdf022013-12-11 14:45:27 -08006669message.subtypes[16] = port_mod
6670
6671class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006672 version = 2
6673 type = 1
6674 err_type = 7
6675
6676 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006677 if xid != None:
6678 self.xid = xid
6679 else:
6680 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006681 if code != None:
6682 self.code = code
6683 else:
6684 self.code = 0
6685 if data != None:
6686 self.data = data
6687 else:
6688 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006689 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006690
6691 def pack(self):
6692 packed = []
6693 packed.append(struct.pack("!B", self.version))
6694 packed.append(struct.pack("!B", self.type))
6695 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6696 packed.append(struct.pack("!L", self.xid))
6697 packed.append(struct.pack("!H", self.err_type))
6698 packed.append(struct.pack("!H", self.code))
6699 packed.append(self.data)
6700 length = sum([len(x) for x in packed])
6701 packed[2] = struct.pack("!H", length)
6702 return ''.join(packed)
6703
6704 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006705 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006706 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006707 _version = reader.read("!B")[0]
6708 assert(_version == 2)
6709 _type = reader.read("!B")[0]
6710 assert(_type == 1)
6711 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006712 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006713 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006714 obj.xid = reader.read("!L")[0]
6715 _err_type = reader.read("!H")[0]
6716 assert(_err_type == 7)
6717 obj.code = reader.read("!H")[0]
6718 obj.data = str(reader.read_all())
6719 return obj
6720
6721 def __eq__(self, other):
6722 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006723 if self.xid != other.xid: return False
6724 if self.code != other.code: return False
6725 if self.data != other.data: return False
6726 return True
6727
Rich Lane6f4978c2013-10-20 21:33:52 -07006728 def pretty_print(self, q):
6729 q.text("port_mod_failed_error_msg {")
6730 with q.group():
6731 with q.indent(2):
6732 q.breakable()
6733 q.text("xid = ");
6734 if self.xid != None:
6735 q.text("%#x" % self.xid)
6736 else:
6737 q.text('None')
6738 q.text(","); q.breakable()
6739 q.text("code = ");
6740 q.text("%#x" % self.code)
6741 q.text(","); q.breakable()
6742 q.text("data = ");
6743 q.pp(self.data)
6744 q.breakable()
6745 q.text('}')
6746
Rich Lane7dcdf022013-12-11 14:45:27 -08006747error_msg.subtypes[7] = port_mod_failed_error_msg
6748
6749class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006750 version = 2
6751 type = 19
6752 stats_type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07006753
6754 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006755 if xid != None:
6756 self.xid = xid
6757 else:
6758 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006759 if flags != None:
6760 self.flags = flags
6761 else:
6762 self.flags = 0
6763 if entries != None:
6764 self.entries = entries
6765 else:
6766 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006767 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006768
6769 def pack(self):
6770 packed = []
6771 packed.append(struct.pack("!B", self.version))
6772 packed.append(struct.pack("!B", self.type))
6773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6774 packed.append(struct.pack("!L", self.xid))
6775 packed.append(struct.pack("!H", self.stats_type))
6776 packed.append(struct.pack("!H", self.flags))
6777 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006778 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006779 length = sum([len(x) for x in packed])
6780 packed[2] = struct.pack("!H", length)
6781 return ''.join(packed)
6782
6783 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006784 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006785 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006786 _version = reader.read("!B")[0]
6787 assert(_version == 2)
6788 _type = reader.read("!B")[0]
6789 assert(_type == 19)
6790 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006791 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006792 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006793 obj.xid = reader.read("!L")[0]
6794 _stats_type = reader.read("!H")[0]
6795 assert(_stats_type == 4)
6796 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006797 reader.skip(4)
6798 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
6799 return obj
6800
6801 def __eq__(self, other):
6802 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006803 if self.xid != other.xid: return False
6804 if self.flags != other.flags: return False
6805 if self.entries != other.entries: return False
6806 return True
6807
Rich Lanec2ee4b82013-04-24 17:12:38 -07006808 def pretty_print(self, q):
6809 q.text("port_stats_reply {")
6810 with q.group():
6811 with q.indent(2):
6812 q.breakable()
6813 q.text("xid = ");
6814 if self.xid != None:
6815 q.text("%#x" % self.xid)
6816 else:
6817 q.text('None')
6818 q.text(","); q.breakable()
6819 q.text("flags = ");
6820 q.text("%#x" % self.flags)
6821 q.text(","); q.breakable()
6822 q.text("entries = ");
6823 q.pp(self.entries)
6824 q.breakable()
6825 q.text('}')
6826
Rich Lane7dcdf022013-12-11 14:45:27 -08006827stats_reply.subtypes[4] = port_stats_reply
6828
6829class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006830 version = 2
6831 type = 18
6832 stats_type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07006833
6834 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006835 if xid != None:
6836 self.xid = xid
6837 else:
6838 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006839 if flags != None:
6840 self.flags = flags
6841 else:
6842 self.flags = 0
6843 if port_no != None:
6844 self.port_no = port_no
6845 else:
6846 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006847 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006848
6849 def pack(self):
6850 packed = []
6851 packed.append(struct.pack("!B", self.version))
6852 packed.append(struct.pack("!B", self.type))
6853 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6854 packed.append(struct.pack("!L", self.xid))
6855 packed.append(struct.pack("!H", self.stats_type))
6856 packed.append(struct.pack("!H", self.flags))
6857 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006858 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006859 packed.append('\x00' * 4)
6860 length = sum([len(x) for x in packed])
6861 packed[2] = struct.pack("!H", length)
6862 return ''.join(packed)
6863
6864 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006865 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006866 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006867 _version = reader.read("!B")[0]
6868 assert(_version == 2)
6869 _type = reader.read("!B")[0]
6870 assert(_type == 18)
6871 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006872 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006873 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006874 obj.xid = reader.read("!L")[0]
6875 _stats_type = reader.read("!H")[0]
6876 assert(_stats_type == 4)
6877 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006878 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006879 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006880 reader.skip(4)
6881 return obj
6882
6883 def __eq__(self, other):
6884 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006885 if self.xid != other.xid: return False
6886 if self.flags != other.flags: return False
6887 if self.port_no != other.port_no: return False
6888 return True
6889
Rich Lanec2ee4b82013-04-24 17:12:38 -07006890 def pretty_print(self, q):
6891 q.text("port_stats_request {")
6892 with q.group():
6893 with q.indent(2):
6894 q.breakable()
6895 q.text("xid = ");
6896 if self.xid != None:
6897 q.text("%#x" % self.xid)
6898 else:
6899 q.text('None')
6900 q.text(","); q.breakable()
6901 q.text("flags = ");
6902 q.text("%#x" % self.flags)
6903 q.text(","); q.breakable()
6904 q.text("port_no = ");
6905 q.text(util.pretty_port(self.port_no))
6906 q.breakable()
6907 q.text('}')
6908
Rich Lane7dcdf022013-12-11 14:45:27 -08006909stats_request.subtypes[4] = port_stats_request
6910
6911class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006912 version = 2
6913 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -07006914
6915 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006916 if xid != None:
6917 self.xid = xid
6918 else:
6919 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006920 if reason != None:
6921 self.reason = reason
6922 else:
6923 self.reason = 0
6924 if desc != None:
6925 self.desc = desc
6926 else:
6927 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006928 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006929
6930 def pack(self):
6931 packed = []
6932 packed.append(struct.pack("!B", self.version))
6933 packed.append(struct.pack("!B", self.type))
6934 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6935 packed.append(struct.pack("!L", self.xid))
6936 packed.append(struct.pack("!B", self.reason))
6937 packed.append('\x00' * 7)
6938 packed.append(self.desc.pack())
6939 length = sum([len(x) for x in packed])
6940 packed[2] = struct.pack("!H", length)
6941 return ''.join(packed)
6942
6943 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006944 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006945 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006946 _version = reader.read("!B")[0]
6947 assert(_version == 2)
6948 _type = reader.read("!B")[0]
6949 assert(_type == 12)
6950 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006951 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006952 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006953 obj.xid = reader.read("!L")[0]
6954 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006955 reader.skip(7)
6956 obj.desc = common.port_desc.unpack(reader)
6957 return obj
6958
6959 def __eq__(self, other):
6960 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006961 if self.xid != other.xid: return False
6962 if self.reason != other.reason: return False
6963 if self.desc != other.desc: return False
6964 return True
6965
Rich Lanec2ee4b82013-04-24 17:12:38 -07006966 def pretty_print(self, q):
6967 q.text("port_status {")
6968 with q.group():
6969 with q.indent(2):
6970 q.breakable()
6971 q.text("xid = ");
6972 if self.xid != None:
6973 q.text("%#x" % self.xid)
6974 else:
6975 q.text('None')
6976 q.text(","); q.breakable()
6977 q.text("reason = ");
6978 q.text("%#x" % self.reason)
6979 q.text(","); q.breakable()
6980 q.text("desc = ");
6981 q.pp(self.desc)
6982 q.breakable()
6983 q.text('}')
6984
Rich Lane7dcdf022013-12-11 14:45:27 -08006985message.subtypes[12] = port_status
6986
6987class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006988 version = 2
6989 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07006990
6991 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006992 if xid != None:
6993 self.xid = xid
6994 else:
6995 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006996 if port != None:
6997 self.port = port
6998 else:
6999 self.port = 0
7000 if queues != None:
7001 self.queues = queues
7002 else:
7003 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007004 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007005
7006 def pack(self):
7007 packed = []
7008 packed.append(struct.pack("!B", self.version))
7009 packed.append(struct.pack("!B", self.type))
7010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7011 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07007012 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007013 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007014 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007015 length = sum([len(x) for x in packed])
7016 packed[2] = struct.pack("!H", length)
7017 return ''.join(packed)
7018
7019 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007020 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007021 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007022 _version = reader.read("!B")[0]
7023 assert(_version == 2)
7024 _type = reader.read("!B")[0]
7025 assert(_type == 23)
7026 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007027 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007028 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007029 obj.xid = reader.read("!L")[0]
7030 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007031 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007032 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007033 return obj
7034
7035 def __eq__(self, other):
7036 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007037 if self.xid != other.xid: return False
7038 if self.port != other.port: return False
7039 if self.queues != other.queues: return False
7040 return True
7041
Rich Lanec2ee4b82013-04-24 17:12:38 -07007042 def pretty_print(self, q):
7043 q.text("queue_get_config_reply {")
7044 with q.group():
7045 with q.indent(2):
7046 q.breakable()
7047 q.text("xid = ");
7048 if self.xid != None:
7049 q.text("%#x" % self.xid)
7050 else:
7051 q.text('None')
7052 q.text(","); q.breakable()
7053 q.text("port = ");
7054 q.text(util.pretty_port(self.port))
7055 q.text(","); q.breakable()
7056 q.text("queues = ");
7057 q.pp(self.queues)
7058 q.breakable()
7059 q.text('}')
7060
Rich Lane7dcdf022013-12-11 14:45:27 -08007061message.subtypes[23] = queue_get_config_reply
7062
7063class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007064 version = 2
7065 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -07007066
7067 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007068 if xid != None:
7069 self.xid = xid
7070 else:
7071 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007072 if port != None:
7073 self.port = port
7074 else:
7075 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007076 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007077
7078 def pack(self):
7079 packed = []
7080 packed.append(struct.pack("!B", self.version))
7081 packed.append(struct.pack("!B", self.type))
7082 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7083 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07007084 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007085 packed.append('\x00' * 4)
7086 length = sum([len(x) for x in packed])
7087 packed[2] = struct.pack("!H", length)
7088 return ''.join(packed)
7089
7090 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007091 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007092 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007093 _version = reader.read("!B")[0]
7094 assert(_version == 2)
7095 _type = reader.read("!B")[0]
7096 assert(_type == 22)
7097 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007098 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007099 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007100 obj.xid = reader.read("!L")[0]
7101 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007102 reader.skip(4)
7103 return obj
7104
7105 def __eq__(self, other):
7106 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007107 if self.xid != other.xid: return False
7108 if self.port != other.port: return False
7109 return True
7110
Rich Lanec2ee4b82013-04-24 17:12:38 -07007111 def pretty_print(self, q):
7112 q.text("queue_get_config_request {")
7113 with q.group():
7114 with q.indent(2):
7115 q.breakable()
7116 q.text("xid = ");
7117 if self.xid != None:
7118 q.text("%#x" % self.xid)
7119 else:
7120 q.text('None')
7121 q.text(","); q.breakable()
7122 q.text("port = ");
7123 q.text(util.pretty_port(self.port))
7124 q.breakable()
7125 q.text('}')
7126
Rich Lane7dcdf022013-12-11 14:45:27 -08007127message.subtypes[22] = queue_get_config_request
7128
7129class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007130 version = 2
7131 type = 1
7132 err_type = 9
7133
7134 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007135 if xid != None:
7136 self.xid = xid
7137 else:
7138 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007139 if code != None:
7140 self.code = code
7141 else:
7142 self.code = 0
7143 if data != None:
7144 self.data = data
7145 else:
7146 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007147 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007148
7149 def pack(self):
7150 packed = []
7151 packed.append(struct.pack("!B", self.version))
7152 packed.append(struct.pack("!B", self.type))
7153 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7154 packed.append(struct.pack("!L", self.xid))
7155 packed.append(struct.pack("!H", self.err_type))
7156 packed.append(struct.pack("!H", self.code))
7157 packed.append(self.data)
7158 length = sum([len(x) for x in packed])
7159 packed[2] = struct.pack("!H", length)
7160 return ''.join(packed)
7161
7162 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007163 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007164 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007165 _version = reader.read("!B")[0]
7166 assert(_version == 2)
7167 _type = reader.read("!B")[0]
7168 assert(_type == 1)
7169 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007170 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007171 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07007172 obj.xid = reader.read("!L")[0]
7173 _err_type = reader.read("!H")[0]
7174 assert(_err_type == 9)
7175 obj.code = reader.read("!H")[0]
7176 obj.data = str(reader.read_all())
7177 return obj
7178
7179 def __eq__(self, other):
7180 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007181 if self.xid != other.xid: return False
7182 if self.code != other.code: return False
7183 if self.data != other.data: return False
7184 return True
7185
Rich Lane6f4978c2013-10-20 21:33:52 -07007186 def pretty_print(self, q):
7187 q.text("queue_op_failed_error_msg {")
7188 with q.group():
7189 with q.indent(2):
7190 q.breakable()
7191 q.text("xid = ");
7192 if self.xid != None:
7193 q.text("%#x" % self.xid)
7194 else:
7195 q.text('None')
7196 q.text(","); q.breakable()
7197 q.text("code = ");
7198 q.text("%#x" % self.code)
7199 q.text(","); q.breakable()
7200 q.text("data = ");
7201 q.pp(self.data)
7202 q.breakable()
7203 q.text('}')
7204
Rich Lane7dcdf022013-12-11 14:45:27 -08007205error_msg.subtypes[9] = queue_op_failed_error_msg
7206
7207class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007208 version = 2
7209 type = 19
7210 stats_type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007211
7212 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007213 if xid != None:
7214 self.xid = xid
7215 else:
7216 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007217 if flags != None:
7218 self.flags = flags
7219 else:
7220 self.flags = 0
7221 if entries != None:
7222 self.entries = entries
7223 else:
7224 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007225 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007226
7227 def pack(self):
7228 packed = []
7229 packed.append(struct.pack("!B", self.version))
7230 packed.append(struct.pack("!B", self.type))
7231 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7232 packed.append(struct.pack("!L", self.xid))
7233 packed.append(struct.pack("!H", self.stats_type))
7234 packed.append(struct.pack("!H", self.flags))
7235 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007236 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007237 length = sum([len(x) for x in packed])
7238 packed[2] = struct.pack("!H", length)
7239 return ''.join(packed)
7240
7241 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007242 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007243 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007244 _version = reader.read("!B")[0]
7245 assert(_version == 2)
7246 _type = reader.read("!B")[0]
7247 assert(_type == 19)
7248 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007249 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007250 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007251 obj.xid = reader.read("!L")[0]
7252 _stats_type = reader.read("!H")[0]
7253 assert(_stats_type == 5)
7254 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007255 reader.skip(4)
7256 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
7257 return obj
7258
7259 def __eq__(self, other):
7260 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007261 if self.xid != other.xid: return False
7262 if self.flags != other.flags: return False
7263 if self.entries != other.entries: return False
7264 return True
7265
Rich Lanec2ee4b82013-04-24 17:12:38 -07007266 def pretty_print(self, q):
7267 q.text("queue_stats_reply {")
7268 with q.group():
7269 with q.indent(2):
7270 q.breakable()
7271 q.text("xid = ");
7272 if self.xid != None:
7273 q.text("%#x" % self.xid)
7274 else:
7275 q.text('None')
7276 q.text(","); q.breakable()
7277 q.text("flags = ");
7278 q.text("%#x" % self.flags)
7279 q.text(","); q.breakable()
7280 q.text("entries = ");
7281 q.pp(self.entries)
7282 q.breakable()
7283 q.text('}')
7284
Rich Lane7dcdf022013-12-11 14:45:27 -08007285stats_reply.subtypes[5] = queue_stats_reply
7286
7287class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007288 version = 2
7289 type = 18
7290 stats_type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007291
7292 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007293 if xid != None:
7294 self.xid = xid
7295 else:
7296 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007297 if flags != None:
7298 self.flags = flags
7299 else:
7300 self.flags = 0
7301 if port_no != None:
7302 self.port_no = port_no
7303 else:
7304 self.port_no = 0
7305 if queue_id != None:
7306 self.queue_id = queue_id
7307 else:
7308 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007309 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007310
7311 def pack(self):
7312 packed = []
7313 packed.append(struct.pack("!B", self.version))
7314 packed.append(struct.pack("!B", self.type))
7315 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7316 packed.append(struct.pack("!L", self.xid))
7317 packed.append(struct.pack("!H", self.stats_type))
7318 packed.append(struct.pack("!H", self.flags))
7319 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007320 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007321 packed.append(struct.pack("!L", self.queue_id))
7322 length = sum([len(x) for x in packed])
7323 packed[2] = struct.pack("!H", length)
7324 return ''.join(packed)
7325
7326 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007327 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007328 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007329 _version = reader.read("!B")[0]
7330 assert(_version == 2)
7331 _type = reader.read("!B")[0]
7332 assert(_type == 18)
7333 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007334 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007335 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007336 obj.xid = reader.read("!L")[0]
7337 _stats_type = reader.read("!H")[0]
7338 assert(_stats_type == 5)
7339 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007340 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07007341 obj.port_no = util.unpack_port_no(reader)
7342 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007343 return obj
7344
7345 def __eq__(self, other):
7346 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007347 if self.xid != other.xid: return False
7348 if self.flags != other.flags: return False
7349 if self.port_no != other.port_no: return False
7350 if self.queue_id != other.queue_id: return False
7351 return True
7352
Rich Lanec2ee4b82013-04-24 17:12:38 -07007353 def pretty_print(self, q):
7354 q.text("queue_stats_request {")
7355 with q.group():
7356 with q.indent(2):
7357 q.breakable()
7358 q.text("xid = ");
7359 if self.xid != None:
7360 q.text("%#x" % self.xid)
7361 else:
7362 q.text('None')
7363 q.text(","); q.breakable()
7364 q.text("flags = ");
7365 q.text("%#x" % self.flags)
7366 q.text(","); q.breakable()
7367 q.text("port_no = ");
7368 q.text(util.pretty_port(self.port_no))
7369 q.text(","); q.breakable()
7370 q.text("queue_id = ");
7371 q.text("%#x" % self.queue_id)
7372 q.breakable()
7373 q.text('}')
7374
Rich Lane7dcdf022013-12-11 14:45:27 -08007375stats_request.subtypes[5] = queue_stats_request
7376
7377class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007378 version = 2
7379 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -07007380
7381 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007382 if xid != None:
7383 self.xid = xid
7384 else:
7385 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007386 if flags != None:
7387 self.flags = flags
7388 else:
7389 self.flags = 0
7390 if miss_send_len != None:
7391 self.miss_send_len = miss_send_len
7392 else:
7393 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007394 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007395
7396 def pack(self):
7397 packed = []
7398 packed.append(struct.pack("!B", self.version))
7399 packed.append(struct.pack("!B", self.type))
7400 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7401 packed.append(struct.pack("!L", self.xid))
7402 packed.append(struct.pack("!H", self.flags))
7403 packed.append(struct.pack("!H", self.miss_send_len))
7404 length = sum([len(x) for x in packed])
7405 packed[2] = struct.pack("!H", length)
7406 return ''.join(packed)
7407
7408 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007409 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007410 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007411 _version = reader.read("!B")[0]
7412 assert(_version == 2)
7413 _type = reader.read("!B")[0]
7414 assert(_type == 9)
7415 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007416 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007417 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007418 obj.xid = reader.read("!L")[0]
7419 obj.flags = reader.read("!H")[0]
7420 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007421 return obj
7422
7423 def __eq__(self, other):
7424 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007425 if self.xid != other.xid: return False
7426 if self.flags != other.flags: return False
7427 if self.miss_send_len != other.miss_send_len: return False
7428 return True
7429
Rich Lanec2ee4b82013-04-24 17:12:38 -07007430 def pretty_print(self, q):
7431 q.text("set_config {")
7432 with q.group():
7433 with q.indent(2):
7434 q.breakable()
7435 q.text("xid = ");
7436 if self.xid != None:
7437 q.text("%#x" % self.xid)
7438 else:
7439 q.text('None')
7440 q.text(","); q.breakable()
7441 q.text("flags = ");
7442 q.text("%#x" % self.flags)
7443 q.text(","); q.breakable()
7444 q.text("miss_send_len = ");
7445 q.text("%#x" % self.miss_send_len)
7446 q.breakable()
7447 q.text('}')
7448
Rich Lane7dcdf022013-12-11 14:45:27 -08007449message.subtypes[9] = set_config
7450
7451class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007452 version = 2
7453 type = 1
7454 err_type = 10
7455
7456 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007457 if xid != None:
7458 self.xid = xid
7459 else:
7460 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007461 if code != None:
7462 self.code = code
7463 else:
7464 self.code = 0
7465 if data != None:
7466 self.data = data
7467 else:
7468 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007469 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007470
7471 def pack(self):
7472 packed = []
7473 packed.append(struct.pack("!B", self.version))
7474 packed.append(struct.pack("!B", self.type))
7475 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7476 packed.append(struct.pack("!L", self.xid))
7477 packed.append(struct.pack("!H", self.err_type))
7478 packed.append(struct.pack("!H", self.code))
7479 packed.append(self.data)
7480 length = sum([len(x) for x in packed])
7481 packed[2] = struct.pack("!H", length)
7482 return ''.join(packed)
7483
7484 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007485 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007486 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007487 _version = reader.read("!B")[0]
7488 assert(_version == 2)
7489 _type = reader.read("!B")[0]
7490 assert(_type == 1)
7491 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007492 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007493 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07007494 obj.xid = reader.read("!L")[0]
7495 _err_type = reader.read("!H")[0]
7496 assert(_err_type == 10)
7497 obj.code = reader.read("!H")[0]
7498 obj.data = str(reader.read_all())
7499 return obj
7500
7501 def __eq__(self, other):
7502 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007503 if self.xid != other.xid: return False
7504 if self.code != other.code: return False
7505 if self.data != other.data: return False
7506 return True
7507
Rich Lane6f4978c2013-10-20 21:33:52 -07007508 def pretty_print(self, q):
7509 q.text("switch_config_failed_error_msg {")
7510 with q.group():
7511 with q.indent(2):
7512 q.breakable()
7513 q.text("xid = ");
7514 if self.xid != None:
7515 q.text("%#x" % self.xid)
7516 else:
7517 q.text('None')
7518 q.text(","); q.breakable()
7519 q.text("code = ");
7520 q.text("%#x" % self.code)
7521 q.text(","); q.breakable()
7522 q.text("data = ");
7523 q.pp(self.data)
7524 q.breakable()
7525 q.text('}')
7526
Rich Lane7dcdf022013-12-11 14:45:27 -08007527error_msg.subtypes[10] = switch_config_failed_error_msg
7528
7529class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007530 version = 2
7531 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -07007532
7533 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007534 if xid != None:
7535 self.xid = xid
7536 else:
7537 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007538 if table_id != None:
7539 self.table_id = table_id
7540 else:
7541 self.table_id = 0
7542 if config != None:
7543 self.config = config
7544 else:
7545 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007546 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007547
7548 def pack(self):
7549 packed = []
7550 packed.append(struct.pack("!B", self.version))
7551 packed.append(struct.pack("!B", self.type))
7552 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7553 packed.append(struct.pack("!L", self.xid))
7554 packed.append(struct.pack("!B", self.table_id))
7555 packed.append('\x00' * 3)
7556 packed.append(struct.pack("!L", self.config))
7557 length = sum([len(x) for x in packed])
7558 packed[2] = struct.pack("!H", length)
7559 return ''.join(packed)
7560
7561 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007562 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007563 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007564 _version = reader.read("!B")[0]
7565 assert(_version == 2)
7566 _type = reader.read("!B")[0]
7567 assert(_type == 17)
7568 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007569 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007570 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007571 obj.xid = reader.read("!L")[0]
7572 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007573 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007574 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007575 return obj
7576
7577 def __eq__(self, other):
7578 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007579 if self.xid != other.xid: return False
7580 if self.table_id != other.table_id: return False
7581 if self.config != other.config: return False
7582 return True
7583
Rich Lanec2ee4b82013-04-24 17:12:38 -07007584 def pretty_print(self, q):
7585 q.text("table_mod {")
7586 with q.group():
7587 with q.indent(2):
7588 q.breakable()
7589 q.text("xid = ");
7590 if self.xid != None:
7591 q.text("%#x" % self.xid)
7592 else:
7593 q.text('None')
7594 q.text(","); q.breakable()
7595 q.text("table_id = ");
7596 q.text("%#x" % self.table_id)
7597 q.text(","); q.breakable()
7598 q.text("config = ");
7599 q.text("%#x" % self.config)
7600 q.breakable()
7601 q.text('}')
7602
Rich Lane7dcdf022013-12-11 14:45:27 -08007603message.subtypes[17] = table_mod
7604
7605class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007606 version = 2
7607 type = 1
7608 err_type = 8
7609
7610 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007611 if xid != None:
7612 self.xid = xid
7613 else:
7614 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007615 if code != None:
7616 self.code = code
7617 else:
7618 self.code = 0
7619 if data != None:
7620 self.data = data
7621 else:
7622 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007623 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007624
7625 def pack(self):
7626 packed = []
7627 packed.append(struct.pack("!B", self.version))
7628 packed.append(struct.pack("!B", self.type))
7629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7630 packed.append(struct.pack("!L", self.xid))
7631 packed.append(struct.pack("!H", self.err_type))
7632 packed.append(struct.pack("!H", self.code))
7633 packed.append(self.data)
7634 length = sum([len(x) for x in packed])
7635 packed[2] = struct.pack("!H", length)
7636 return ''.join(packed)
7637
7638 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007639 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007640 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007641 _version = reader.read("!B")[0]
7642 assert(_version == 2)
7643 _type = reader.read("!B")[0]
7644 assert(_type == 1)
7645 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007646 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007647 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07007648 obj.xid = reader.read("!L")[0]
7649 _err_type = reader.read("!H")[0]
7650 assert(_err_type == 8)
7651 obj.code = reader.read("!H")[0]
7652 obj.data = str(reader.read_all())
7653 return obj
7654
7655 def __eq__(self, other):
7656 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007657 if self.xid != other.xid: return False
7658 if self.code != other.code: return False
7659 if self.data != other.data: return False
7660 return True
7661
Rich Lane6f4978c2013-10-20 21:33:52 -07007662 def pretty_print(self, q):
7663 q.text("table_mod_failed_error_msg {")
7664 with q.group():
7665 with q.indent(2):
7666 q.breakable()
7667 q.text("xid = ");
7668 if self.xid != None:
7669 q.text("%#x" % self.xid)
7670 else:
7671 q.text('None')
7672 q.text(","); q.breakable()
7673 q.text("code = ");
7674 q.text("%#x" % self.code)
7675 q.text(","); q.breakable()
7676 q.text("data = ");
7677 q.pp(self.data)
7678 q.breakable()
7679 q.text('}')
7680
Rich Lane7dcdf022013-12-11 14:45:27 -08007681error_msg.subtypes[8] = table_mod_failed_error_msg
7682
7683class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007684 version = 2
7685 type = 19
7686 stats_type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007687
7688 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007689 if xid != None:
7690 self.xid = xid
7691 else:
7692 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007693 if flags != None:
7694 self.flags = flags
7695 else:
7696 self.flags = 0
7697 if entries != None:
7698 self.entries = entries
7699 else:
7700 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007701 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007702
7703 def pack(self):
7704 packed = []
7705 packed.append(struct.pack("!B", self.version))
7706 packed.append(struct.pack("!B", self.type))
7707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7708 packed.append(struct.pack("!L", self.xid))
7709 packed.append(struct.pack("!H", self.stats_type))
7710 packed.append(struct.pack("!H", self.flags))
7711 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007712 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007713 length = sum([len(x) for x in packed])
7714 packed[2] = struct.pack("!H", length)
7715 return ''.join(packed)
7716
7717 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007718 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007719 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007720 _version = reader.read("!B")[0]
7721 assert(_version == 2)
7722 _type = reader.read("!B")[0]
7723 assert(_type == 19)
7724 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007725 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007726 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007727 obj.xid = reader.read("!L")[0]
7728 _stats_type = reader.read("!H")[0]
7729 assert(_stats_type == 3)
7730 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007731 reader.skip(4)
7732 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
7733 return obj
7734
7735 def __eq__(self, other):
7736 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007737 if self.xid != other.xid: return False
7738 if self.flags != other.flags: return False
7739 if self.entries != other.entries: return False
7740 return True
7741
Rich Lanec2ee4b82013-04-24 17:12:38 -07007742 def pretty_print(self, q):
7743 q.text("table_stats_reply {")
7744 with q.group():
7745 with q.indent(2):
7746 q.breakable()
7747 q.text("xid = ");
7748 if self.xid != None:
7749 q.text("%#x" % self.xid)
7750 else:
7751 q.text('None')
7752 q.text(","); q.breakable()
7753 q.text("flags = ");
7754 q.text("%#x" % self.flags)
7755 q.text(","); q.breakable()
7756 q.text("entries = ");
7757 q.pp(self.entries)
7758 q.breakable()
7759 q.text('}')
7760
Rich Lane7dcdf022013-12-11 14:45:27 -08007761stats_reply.subtypes[3] = table_stats_reply
7762
7763class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007764 version = 2
7765 type = 18
7766 stats_type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007767
7768 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007769 if xid != None:
7770 self.xid = xid
7771 else:
7772 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007773 if flags != None:
7774 self.flags = flags
7775 else:
7776 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007777 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007778
7779 def pack(self):
7780 packed = []
7781 packed.append(struct.pack("!B", self.version))
7782 packed.append(struct.pack("!B", self.type))
7783 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7784 packed.append(struct.pack("!L", self.xid))
7785 packed.append(struct.pack("!H", self.stats_type))
7786 packed.append(struct.pack("!H", self.flags))
7787 packed.append('\x00' * 4)
7788 length = sum([len(x) for x in packed])
7789 packed[2] = struct.pack("!H", length)
7790 return ''.join(packed)
7791
7792 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007793 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007794 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007795 _version = reader.read("!B")[0]
7796 assert(_version == 2)
7797 _type = reader.read("!B")[0]
7798 assert(_type == 18)
7799 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007800 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007801 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007802 obj.xid = reader.read("!L")[0]
7803 _stats_type = reader.read("!H")[0]
7804 assert(_stats_type == 3)
7805 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007806 reader.skip(4)
7807 return obj
7808
7809 def __eq__(self, other):
7810 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007811 if self.xid != other.xid: return False
7812 if self.flags != other.flags: return False
7813 return True
7814
Rich Lanec2ee4b82013-04-24 17:12:38 -07007815 def pretty_print(self, q):
7816 q.text("table_stats_request {")
7817 with q.group():
7818 with q.indent(2):
7819 q.breakable()
7820 q.text("xid = ");
7821 if self.xid != None:
7822 q.text("%#x" % self.xid)
7823 else:
7824 q.text('None')
7825 q.text(","); q.breakable()
7826 q.text("flags = ");
7827 q.text("%#x" % self.flags)
7828 q.breakable()
7829 q.text('}')
7830
Rich Lane7dcdf022013-12-11 14:45:27 -08007831stats_request.subtypes[3] = table_stats_request
7832
Rich Lanec2ee4b82013-04-24 17:12:38 -07007833
7834def parse_header(buf):
7835 if len(buf) < 8:
7836 raise loxi.ProtocolError("too short to be an OpenFlow message")
7837 return struct.unpack_from("!BBHL", buf)
7838
7839def parse_message(buf):
7840 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -07007841 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
7842 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007843 if len(buf) != msg_len:
7844 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007845 return message.unpack(loxi.generic_util.OFReader(buf))