blob: 8e1610a9752672a4b21879c3ee95690b00a5948a [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
10import loxi
11import const
12import common
Rich Lane7dcdf022013-12-11 14:45:27 -080013import action
14import instruction
15import oxm
16import action_id
17import instruction_id
18import meter_band
Rich Lane5454b682014-01-14 17:07:36 -080019import bsn_tlv
Rich Lanec2ee4b82013-04-24 17:12:38 -070020import util
21import loxi.generic_util
22
Rich Lane7dcdf022013-12-11 14:45:27 -080023class message(loxi.OFObject):
24 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070025
Rich Lane95f7fc92014-01-27 17:08:16 -080026 version = 4
27
28 def __init__(self, type=None, xid=None):
29 if type != None:
30 self.type = type
31 else:
32 self.type = 0
33 if xid != None:
34 self.xid = xid
35 else:
36 self.xid = None
37 return
38
39 def pack(self):
40 packed = []
41 packed.append(struct.pack("!B", self.version))
42 packed.append(struct.pack("!B", self.type))
43 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
44 packed.append(struct.pack("!L", self.xid))
45 length = sum([len(x) for x in packed])
46 packed[2] = struct.pack("!H", length)
47 return ''.join(packed)
48
Rich Lane7dcdf022013-12-11 14:45:27 -080049 @staticmethod
50 def unpack(reader):
51 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080052 subclass = message.subtypes.get(subtype)
53 if subclass:
54 return subclass.unpack(reader)
55
56 obj = message()
57 _version = reader.read("!B")[0]
58 assert(_version == 4)
59 obj.type = reader.read("!B")[0]
60 _length = reader.read("!H")[0]
61 orig_reader = reader
62 reader = orig_reader.slice(_length - (2 + 2))
63 obj.xid = reader.read("!L")[0]
64 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 if self.xid != other.xid: return False
70 return True
71
72 def pretty_print(self, q):
73 q.text("message {")
74 with q.group():
75 with q.indent(2):
76 q.breakable()
77 q.text("xid = ");
78 if self.xid != None:
79 q.text("%#x" % self.xid)
80 else:
81 q.text('None')
82 q.breakable()
83 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080084
85
86class stats_reply(message):
87 subtypes = {}
88
Rich Lane95f7fc92014-01-27 17:08:16 -080089 version = 4
90 type = 19
91
92 def __init__(self, xid=None, stats_type=None, flags=None):
93 if xid != None:
94 self.xid = xid
95 else:
96 self.xid = None
97 if stats_type != None:
98 self.stats_type = stats_type
99 else:
100 self.stats_type = 0
101 if flags != None:
102 self.flags = flags
103 else:
104 self.flags = 0
105 return
106
107 def pack(self):
108 packed = []
109 packed.append(struct.pack("!B", self.version))
110 packed.append(struct.pack("!B", self.type))
111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
112 packed.append(struct.pack("!L", self.xid))
113 packed.append(struct.pack("!H", self.stats_type))
114 packed.append(struct.pack("!H", self.flags))
115 packed.append('\x00' * 4)
116 length = sum([len(x) for x in packed])
117 packed[2] = struct.pack("!H", length)
118 return ''.join(packed)
119
Rich Lane7dcdf022013-12-11 14:45:27 -0800120 @staticmethod
121 def unpack(reader):
122 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800123 subclass = stats_reply.subtypes.get(subtype)
124 if subclass:
125 return subclass.unpack(reader)
126
127 obj = stats_reply()
128 _version = reader.read("!B")[0]
129 assert(_version == 4)
130 _type = reader.read("!B")[0]
131 assert(_type == 19)
132 _length = reader.read("!H")[0]
133 orig_reader = reader
134 reader = orig_reader.slice(_length - (2 + 2))
135 obj.xid = reader.read("!L")[0]
136 obj.stats_type = reader.read("!H")[0]
137 obj.flags = reader.read("!H")[0]
138 reader.skip(4)
139 return obj
140
141 def __eq__(self, other):
142 if type(self) != type(other): return False
143 if self.xid != other.xid: return False
144 if self.stats_type != other.stats_type: return False
145 if self.flags != other.flags: return False
146 return True
147
148 def pretty_print(self, q):
149 q.text("stats_reply {")
150 with q.group():
151 with q.indent(2):
152 q.breakable()
153 q.text("xid = ");
154 if self.xid != None:
155 q.text("%#x" % self.xid)
156 else:
157 q.text('None')
158 q.text(","); q.breakable()
159 q.text("flags = ");
160 q.text("%#x" % self.flags)
161 q.breakable()
162 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800163
164message.subtypes[19] = stats_reply
165
166class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700167 version = 4
168 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700169 stats_type = 2
170
171 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800172 if xid != None:
173 self.xid = xid
174 else:
175 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700176 if flags != None:
177 self.flags = flags
178 else:
179 self.flags = 0
180 if packet_count != None:
181 self.packet_count = packet_count
182 else:
183 self.packet_count = 0
184 if byte_count != None:
185 self.byte_count = byte_count
186 else:
187 self.byte_count = 0
188 if flow_count != None:
189 self.flow_count = flow_count
190 else:
191 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800192 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700193
194 def pack(self):
195 packed = []
196 packed.append(struct.pack("!B", self.version))
197 packed.append(struct.pack("!B", self.type))
198 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
199 packed.append(struct.pack("!L", self.xid))
200 packed.append(struct.pack("!H", self.stats_type))
201 packed.append(struct.pack("!H", self.flags))
202 packed.append('\x00' * 4)
203 packed.append(struct.pack("!Q", self.packet_count))
204 packed.append(struct.pack("!Q", self.byte_count))
205 packed.append(struct.pack("!L", self.flow_count))
206 packed.append('\x00' * 4)
207 length = sum([len(x) for x in packed])
208 packed[2] = struct.pack("!H", length)
209 return ''.join(packed)
210
211 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800212 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700213 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700214 _version = reader.read("!B")[0]
215 assert(_version == 4)
216 _type = reader.read("!B")[0]
217 assert(_type == 19)
218 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800219 orig_reader = reader
220 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700221 obj.xid = reader.read("!L")[0]
222 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700223 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700224 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700225 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700226 obj.packet_count = reader.read("!Q")[0]
227 obj.byte_count = reader.read("!Q")[0]
228 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700229 reader.skip(4)
230 return obj
231
232 def __eq__(self, other):
233 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700234 if self.xid != other.xid: return False
235 if self.flags != other.flags: return False
236 if self.packet_count != other.packet_count: return False
237 if self.byte_count != other.byte_count: return False
238 if self.flow_count != other.flow_count: return False
239 return True
240
Rich Lanec2ee4b82013-04-24 17:12:38 -0700241 def pretty_print(self, q):
242 q.text("aggregate_stats_reply {")
243 with q.group():
244 with q.indent(2):
245 q.breakable()
246 q.text("xid = ");
247 if self.xid != None:
248 q.text("%#x" % self.xid)
249 else:
250 q.text('None')
251 q.text(","); q.breakable()
252 q.text("flags = ");
253 q.text("%#x" % self.flags)
254 q.text(","); q.breakable()
255 q.text("packet_count = ");
256 q.text("%#x" % self.packet_count)
257 q.text(","); q.breakable()
258 q.text("byte_count = ");
259 q.text("%#x" % self.byte_count)
260 q.text(","); q.breakable()
261 q.text("flow_count = ");
262 q.text("%#x" % self.flow_count)
263 q.breakable()
264 q.text('}')
265
Rich Lane7dcdf022013-12-11 14:45:27 -0800266stats_reply.subtypes[2] = aggregate_stats_reply
267
268class stats_request(message):
269 subtypes = {}
270
Rich Lane95f7fc92014-01-27 17:08:16 -0800271 version = 4
272 type = 18
273
274 def __init__(self, xid=None, stats_type=None, flags=None):
275 if xid != None:
276 self.xid = xid
277 else:
278 self.xid = None
279 if stats_type != None:
280 self.stats_type = stats_type
281 else:
282 self.stats_type = 0
283 if flags != None:
284 self.flags = flags
285 else:
286 self.flags = 0
287 return
288
289 def pack(self):
290 packed = []
291 packed.append(struct.pack("!B", self.version))
292 packed.append(struct.pack("!B", self.type))
293 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
294 packed.append(struct.pack("!L", self.xid))
295 packed.append(struct.pack("!H", self.stats_type))
296 packed.append(struct.pack("!H", self.flags))
297 packed.append('\x00' * 4)
298 length = sum([len(x) for x in packed])
299 packed[2] = struct.pack("!H", length)
300 return ''.join(packed)
301
Rich Lane7dcdf022013-12-11 14:45:27 -0800302 @staticmethod
303 def unpack(reader):
304 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800305 subclass = stats_request.subtypes.get(subtype)
306 if subclass:
307 return subclass.unpack(reader)
308
309 obj = stats_request()
310 _version = reader.read("!B")[0]
311 assert(_version == 4)
312 _type = reader.read("!B")[0]
313 assert(_type == 18)
314 _length = reader.read("!H")[0]
315 orig_reader = reader
316 reader = orig_reader.slice(_length - (2 + 2))
317 obj.xid = reader.read("!L")[0]
318 obj.stats_type = reader.read("!H")[0]
319 obj.flags = reader.read("!H")[0]
320 reader.skip(4)
321 return obj
322
323 def __eq__(self, other):
324 if type(self) != type(other): return False
325 if self.xid != other.xid: return False
326 if self.stats_type != other.stats_type: return False
327 if self.flags != other.flags: return False
328 return True
329
330 def pretty_print(self, q):
331 q.text("stats_request {")
332 with q.group():
333 with q.indent(2):
334 q.breakable()
335 q.text("xid = ");
336 if self.xid != None:
337 q.text("%#x" % self.xid)
338 else:
339 q.text('None')
340 q.text(","); q.breakable()
341 q.text("flags = ");
342 q.text("%#x" % self.flags)
343 q.breakable()
344 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800345
346message.subtypes[18] = stats_request
347
348class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700349 version = 4
350 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700351 stats_type = 2
352
353 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 -0800354 if xid != None:
355 self.xid = xid
356 else:
357 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700358 if flags != None:
359 self.flags = flags
360 else:
361 self.flags = 0
362 if table_id != None:
363 self.table_id = table_id
364 else:
365 self.table_id = 0
366 if out_port != None:
367 self.out_port = out_port
368 else:
369 self.out_port = 0
370 if out_group != None:
371 self.out_group = out_group
372 else:
373 self.out_group = 0
374 if cookie != None:
375 self.cookie = cookie
376 else:
377 self.cookie = 0
378 if cookie_mask != None:
379 self.cookie_mask = cookie_mask
380 else:
381 self.cookie_mask = 0
382 if match != None:
383 self.match = match
384 else:
385 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800386 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700387
388 def pack(self):
389 packed = []
390 packed.append(struct.pack("!B", self.version))
391 packed.append(struct.pack("!B", self.type))
392 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
393 packed.append(struct.pack("!L", self.xid))
394 packed.append(struct.pack("!H", self.stats_type))
395 packed.append(struct.pack("!H", self.flags))
396 packed.append('\x00' * 4)
397 packed.append(struct.pack("!B", self.table_id))
398 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700399 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700400 packed.append(struct.pack("!L", self.out_group))
401 packed.append('\x00' * 4)
402 packed.append(struct.pack("!Q", self.cookie))
403 packed.append(struct.pack("!Q", self.cookie_mask))
404 packed.append(self.match.pack())
405 length = sum([len(x) for x in packed])
406 packed[2] = struct.pack("!H", length)
407 return ''.join(packed)
408
409 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800410 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700411 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700412 _version = reader.read("!B")[0]
413 assert(_version == 4)
414 _type = reader.read("!B")[0]
415 assert(_type == 18)
416 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800417 orig_reader = reader
418 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700419 obj.xid = reader.read("!L")[0]
420 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700421 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700422 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700423 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700424 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700425 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700426 obj.out_port = util.unpack_port_no(reader)
427 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700428 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700429 obj.cookie = reader.read("!Q")[0]
430 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700431 obj.match = common.match.unpack(reader)
432 return obj
433
434 def __eq__(self, other):
435 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700436 if self.xid != other.xid: return False
437 if self.flags != other.flags: return False
438 if self.table_id != other.table_id: return False
439 if self.out_port != other.out_port: return False
440 if self.out_group != other.out_group: return False
441 if self.cookie != other.cookie: return False
442 if self.cookie_mask != other.cookie_mask: return False
443 if self.match != other.match: return False
444 return True
445
Rich Lanec2ee4b82013-04-24 17:12:38 -0700446 def pretty_print(self, q):
447 q.text("aggregate_stats_request {")
448 with q.group():
449 with q.indent(2):
450 q.breakable()
451 q.text("xid = ");
452 if self.xid != None:
453 q.text("%#x" % self.xid)
454 else:
455 q.text('None')
456 q.text(","); q.breakable()
457 q.text("flags = ");
458 q.text("%#x" % self.flags)
459 q.text(","); q.breakable()
460 q.text("table_id = ");
461 q.text("%#x" % self.table_id)
462 q.text(","); q.breakable()
463 q.text("out_port = ");
464 q.text(util.pretty_port(self.out_port))
465 q.text(","); q.breakable()
466 q.text("out_group = ");
467 q.text("%#x" % self.out_group)
468 q.text(","); q.breakable()
469 q.text("cookie = ");
470 q.text("%#x" % self.cookie)
471 q.text(","); q.breakable()
472 q.text("cookie_mask = ");
473 q.text("%#x" % self.cookie_mask)
474 q.text(","); q.breakable()
475 q.text("match = ");
476 q.pp(self.match)
477 q.breakable()
478 q.text('}')
479
Rich Lane7dcdf022013-12-11 14:45:27 -0800480stats_request.subtypes[2] = aggregate_stats_request
481
482class async_get_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700483 version = 4
484 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700485
486 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800487 if xid != None:
488 self.xid = xid
489 else:
490 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700491 if packet_in_mask_equal_master != None:
492 self.packet_in_mask_equal_master = packet_in_mask_equal_master
493 else:
494 self.packet_in_mask_equal_master = 0
495 if packet_in_mask_slave != None:
496 self.packet_in_mask_slave = packet_in_mask_slave
497 else:
498 self.packet_in_mask_slave = 0
499 if port_status_mask_equal_master != None:
500 self.port_status_mask_equal_master = port_status_mask_equal_master
501 else:
502 self.port_status_mask_equal_master = 0
503 if port_status_mask_slave != None:
504 self.port_status_mask_slave = port_status_mask_slave
505 else:
506 self.port_status_mask_slave = 0
507 if flow_removed_mask_equal_master != None:
508 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
509 else:
510 self.flow_removed_mask_equal_master = 0
511 if flow_removed_mask_slave != None:
512 self.flow_removed_mask_slave = flow_removed_mask_slave
513 else:
514 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800515 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700516
517 def pack(self):
518 packed = []
519 packed.append(struct.pack("!B", self.version))
520 packed.append(struct.pack("!B", self.type))
521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
522 packed.append(struct.pack("!L", self.xid))
523 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
524 packed.append(struct.pack("!L", self.packet_in_mask_slave))
525 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
526 packed.append(struct.pack("!L", self.port_status_mask_slave))
527 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
528 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
529 length = sum([len(x) for x in packed])
530 packed[2] = struct.pack("!H", length)
531 return ''.join(packed)
532
533 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800534 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700535 obj = async_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700536 _version = reader.read("!B")[0]
537 assert(_version == 4)
538 _type = reader.read("!B")[0]
539 assert(_type == 27)
540 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800541 orig_reader = reader
542 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700543 obj.xid = reader.read("!L")[0]
544 obj.packet_in_mask_equal_master = reader.read("!L")[0]
545 obj.packet_in_mask_slave = reader.read("!L")[0]
546 obj.port_status_mask_equal_master = reader.read("!L")[0]
547 obj.port_status_mask_slave = reader.read("!L")[0]
548 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
549 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700550 return obj
551
552 def __eq__(self, other):
553 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700554 if self.xid != other.xid: return False
555 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
556 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
557 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
558 if self.port_status_mask_slave != other.port_status_mask_slave: return False
559 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
560 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
561 return True
562
Rich Lanec2ee4b82013-04-24 17:12:38 -0700563 def pretty_print(self, q):
564 q.text("async_get_reply {")
565 with q.group():
566 with q.indent(2):
567 q.breakable()
568 q.text("xid = ");
569 if self.xid != None:
570 q.text("%#x" % self.xid)
571 else:
572 q.text('None')
573 q.text(","); q.breakable()
574 q.text("packet_in_mask_equal_master = ");
575 q.text("%#x" % self.packet_in_mask_equal_master)
576 q.text(","); q.breakable()
577 q.text("packet_in_mask_slave = ");
578 q.text("%#x" % self.packet_in_mask_slave)
579 q.text(","); q.breakable()
580 q.text("port_status_mask_equal_master = ");
581 q.text("%#x" % self.port_status_mask_equal_master)
582 q.text(","); q.breakable()
583 q.text("port_status_mask_slave = ");
584 q.text("%#x" % self.port_status_mask_slave)
585 q.text(","); q.breakable()
586 q.text("flow_removed_mask_equal_master = ");
587 q.text("%#x" % self.flow_removed_mask_equal_master)
588 q.text(","); q.breakable()
589 q.text("flow_removed_mask_slave = ");
590 q.text("%#x" % self.flow_removed_mask_slave)
591 q.breakable()
592 q.text('}')
593
Rich Lane7dcdf022013-12-11 14:45:27 -0800594message.subtypes[27] = async_get_reply
595
596class async_get_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700597 version = 4
598 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700599
600 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800601 if xid != None:
602 self.xid = xid
603 else:
604 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700605 if packet_in_mask_equal_master != None:
606 self.packet_in_mask_equal_master = packet_in_mask_equal_master
607 else:
608 self.packet_in_mask_equal_master = 0
609 if packet_in_mask_slave != None:
610 self.packet_in_mask_slave = packet_in_mask_slave
611 else:
612 self.packet_in_mask_slave = 0
613 if port_status_mask_equal_master != None:
614 self.port_status_mask_equal_master = port_status_mask_equal_master
615 else:
616 self.port_status_mask_equal_master = 0
617 if port_status_mask_slave != None:
618 self.port_status_mask_slave = port_status_mask_slave
619 else:
620 self.port_status_mask_slave = 0
621 if flow_removed_mask_equal_master != None:
622 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
623 else:
624 self.flow_removed_mask_equal_master = 0
625 if flow_removed_mask_slave != None:
626 self.flow_removed_mask_slave = flow_removed_mask_slave
627 else:
628 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800629 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700630
631 def pack(self):
632 packed = []
633 packed.append(struct.pack("!B", self.version))
634 packed.append(struct.pack("!B", self.type))
635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
636 packed.append(struct.pack("!L", self.xid))
637 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
638 packed.append(struct.pack("!L", self.packet_in_mask_slave))
639 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
640 packed.append(struct.pack("!L", self.port_status_mask_slave))
641 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
642 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
643 length = sum([len(x) for x in packed])
644 packed[2] = struct.pack("!H", length)
645 return ''.join(packed)
646
647 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800648 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700649 obj = async_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700650 _version = reader.read("!B")[0]
651 assert(_version == 4)
652 _type = reader.read("!B")[0]
653 assert(_type == 26)
654 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800655 orig_reader = reader
656 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700657 obj.xid = reader.read("!L")[0]
658 obj.packet_in_mask_equal_master = reader.read("!L")[0]
659 obj.packet_in_mask_slave = reader.read("!L")[0]
660 obj.port_status_mask_equal_master = reader.read("!L")[0]
661 obj.port_status_mask_slave = reader.read("!L")[0]
662 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
663 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700664 return obj
665
666 def __eq__(self, other):
667 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700668 if self.xid != other.xid: return False
669 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
670 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
671 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
672 if self.port_status_mask_slave != other.port_status_mask_slave: return False
673 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
674 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
675 return True
676
Rich Lanec2ee4b82013-04-24 17:12:38 -0700677 def pretty_print(self, q):
678 q.text("async_get_request {")
679 with q.group():
680 with q.indent(2):
681 q.breakable()
682 q.text("xid = ");
683 if self.xid != None:
684 q.text("%#x" % self.xid)
685 else:
686 q.text('None')
687 q.text(","); q.breakable()
688 q.text("packet_in_mask_equal_master = ");
689 q.text("%#x" % self.packet_in_mask_equal_master)
690 q.text(","); q.breakable()
691 q.text("packet_in_mask_slave = ");
692 q.text("%#x" % self.packet_in_mask_slave)
693 q.text(","); q.breakable()
694 q.text("port_status_mask_equal_master = ");
695 q.text("%#x" % self.port_status_mask_equal_master)
696 q.text(","); q.breakable()
697 q.text("port_status_mask_slave = ");
698 q.text("%#x" % self.port_status_mask_slave)
699 q.text(","); q.breakable()
700 q.text("flow_removed_mask_equal_master = ");
701 q.text("%#x" % self.flow_removed_mask_equal_master)
702 q.text(","); q.breakable()
703 q.text("flow_removed_mask_slave = ");
704 q.text("%#x" % self.flow_removed_mask_slave)
705 q.breakable()
706 q.text('}')
707
Rich Lane7dcdf022013-12-11 14:45:27 -0800708message.subtypes[26] = async_get_request
709
710class async_set(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700711 version = 4
712 type = 28
Rich Lanec2ee4b82013-04-24 17:12:38 -0700713
714 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800715 if xid != None:
716 self.xid = xid
717 else:
718 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700719 if packet_in_mask_equal_master != None:
720 self.packet_in_mask_equal_master = packet_in_mask_equal_master
721 else:
722 self.packet_in_mask_equal_master = 0
723 if packet_in_mask_slave != None:
724 self.packet_in_mask_slave = packet_in_mask_slave
725 else:
726 self.packet_in_mask_slave = 0
727 if port_status_mask_equal_master != None:
728 self.port_status_mask_equal_master = port_status_mask_equal_master
729 else:
730 self.port_status_mask_equal_master = 0
731 if port_status_mask_slave != None:
732 self.port_status_mask_slave = port_status_mask_slave
733 else:
734 self.port_status_mask_slave = 0
735 if flow_removed_mask_equal_master != None:
736 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
737 else:
738 self.flow_removed_mask_equal_master = 0
739 if flow_removed_mask_slave != None:
740 self.flow_removed_mask_slave = flow_removed_mask_slave
741 else:
742 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800743 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700744
745 def pack(self):
746 packed = []
747 packed.append(struct.pack("!B", self.version))
748 packed.append(struct.pack("!B", self.type))
749 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
750 packed.append(struct.pack("!L", self.xid))
751 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
752 packed.append(struct.pack("!L", self.packet_in_mask_slave))
753 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
754 packed.append(struct.pack("!L", self.port_status_mask_slave))
755 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
756 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
757 length = sum([len(x) for x in packed])
758 packed[2] = struct.pack("!H", length)
759 return ''.join(packed)
760
761 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800762 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700763 obj = async_set()
Dan Talaycof6202252013-07-02 01:00:29 -0700764 _version = reader.read("!B")[0]
765 assert(_version == 4)
766 _type = reader.read("!B")[0]
767 assert(_type == 28)
768 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800769 orig_reader = reader
770 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700771 obj.xid = reader.read("!L")[0]
772 obj.packet_in_mask_equal_master = reader.read("!L")[0]
773 obj.packet_in_mask_slave = reader.read("!L")[0]
774 obj.port_status_mask_equal_master = reader.read("!L")[0]
775 obj.port_status_mask_slave = reader.read("!L")[0]
776 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
777 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700778 return obj
779
780 def __eq__(self, other):
781 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700782 if self.xid != other.xid: return False
783 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
784 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
785 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
786 if self.port_status_mask_slave != other.port_status_mask_slave: return False
787 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
788 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
789 return True
790
Rich Lanec2ee4b82013-04-24 17:12:38 -0700791 def pretty_print(self, q):
792 q.text("async_set {")
793 with q.group():
794 with q.indent(2):
795 q.breakable()
796 q.text("xid = ");
797 if self.xid != None:
798 q.text("%#x" % self.xid)
799 else:
800 q.text('None')
801 q.text(","); q.breakable()
802 q.text("packet_in_mask_equal_master = ");
803 q.text("%#x" % self.packet_in_mask_equal_master)
804 q.text(","); q.breakable()
805 q.text("packet_in_mask_slave = ");
806 q.text("%#x" % self.packet_in_mask_slave)
807 q.text(","); q.breakable()
808 q.text("port_status_mask_equal_master = ");
809 q.text("%#x" % self.port_status_mask_equal_master)
810 q.text(","); q.breakable()
811 q.text("port_status_mask_slave = ");
812 q.text("%#x" % self.port_status_mask_slave)
813 q.text(","); q.breakable()
814 q.text("flow_removed_mask_equal_master = ");
815 q.text("%#x" % self.flow_removed_mask_equal_master)
816 q.text(","); q.breakable()
817 q.text("flow_removed_mask_slave = ");
818 q.text("%#x" % self.flow_removed_mask_slave)
819 q.breakable()
820 q.text('}')
821
Rich Lane7dcdf022013-12-11 14:45:27 -0800822message.subtypes[28] = async_set
823
824class error_msg(message):
825 subtypes = {}
826
Rich Lane95f7fc92014-01-27 17:08:16 -0800827 version = 4
828 type = 1
829
830 def __init__(self, xid=None, err_type=None):
831 if xid != None:
832 self.xid = xid
833 else:
834 self.xid = None
835 if err_type != None:
836 self.err_type = err_type
837 else:
838 self.err_type = 0
839 return
840
841 def pack(self):
842 packed = []
843 packed.append(struct.pack("!B", self.version))
844 packed.append(struct.pack("!B", self.type))
845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
846 packed.append(struct.pack("!L", self.xid))
847 packed.append(struct.pack("!H", self.err_type))
848 length = sum([len(x) for x in packed])
849 packed[2] = struct.pack("!H", length)
850 return ''.join(packed)
851
Rich Lane7dcdf022013-12-11 14:45:27 -0800852 @staticmethod
853 def unpack(reader):
854 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800855 subclass = error_msg.subtypes.get(subtype)
856 if subclass:
857 return subclass.unpack(reader)
858
859 obj = error_msg()
860 _version = reader.read("!B")[0]
861 assert(_version == 4)
862 _type = reader.read("!B")[0]
863 assert(_type == 1)
864 _length = reader.read("!H")[0]
865 orig_reader = reader
866 reader = orig_reader.slice(_length - (2 + 2))
867 obj.xid = reader.read("!L")[0]
868 obj.err_type = reader.read("!H")[0]
869 return obj
870
871 def __eq__(self, other):
872 if type(self) != type(other): return False
873 if self.xid != other.xid: return False
874 if self.err_type != other.err_type: return False
875 return True
876
877 def pretty_print(self, q):
878 q.text("error_msg {")
879 with q.group():
880 with q.indent(2):
881 q.breakable()
882 q.text("xid = ");
883 if self.xid != None:
884 q.text("%#x" % self.xid)
885 else:
886 q.text('None')
887 q.breakable()
888 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800889
890message.subtypes[1] = error_msg
891
892class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700893 version = 4
894 type = 1
895 err_type = 2
896
897 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800898 if xid != None:
899 self.xid = xid
900 else:
901 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700902 if code != None:
903 self.code = code
904 else:
905 self.code = 0
906 if data != None:
907 self.data = data
908 else:
909 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800910 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700911
912 def pack(self):
913 packed = []
914 packed.append(struct.pack("!B", self.version))
915 packed.append(struct.pack("!B", self.type))
916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
917 packed.append(struct.pack("!L", self.xid))
918 packed.append(struct.pack("!H", self.err_type))
919 packed.append(struct.pack("!H", self.code))
920 packed.append(self.data)
921 length = sum([len(x) for x in packed])
922 packed[2] = struct.pack("!H", length)
923 return ''.join(packed)
924
925 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800926 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700927 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700928 _version = reader.read("!B")[0]
929 assert(_version == 4)
930 _type = reader.read("!B")[0]
931 assert(_type == 1)
932 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800933 orig_reader = reader
934 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700935 obj.xid = reader.read("!L")[0]
936 _err_type = reader.read("!H")[0]
937 assert(_err_type == 2)
938 obj.code = reader.read("!H")[0]
939 obj.data = str(reader.read_all())
940 return obj
941
942 def __eq__(self, other):
943 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700944 if self.xid != other.xid: return False
945 if self.code != other.code: return False
946 if self.data != other.data: return False
947 return True
948
Rich Lane6f4978c2013-10-20 21:33:52 -0700949 def pretty_print(self, q):
950 q.text("bad_action_error_msg {")
951 with q.group():
952 with q.indent(2):
953 q.breakable()
954 q.text("xid = ");
955 if self.xid != None:
956 q.text("%#x" % self.xid)
957 else:
958 q.text('None')
959 q.text(","); q.breakable()
960 q.text("code = ");
961 q.text("%#x" % self.code)
962 q.text(","); q.breakable()
963 q.text("data = ");
964 q.pp(self.data)
965 q.breakable()
966 q.text('}')
967
Rich Lane7dcdf022013-12-11 14:45:27 -0800968error_msg.subtypes[2] = bad_action_error_msg
969
970class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700971 version = 4
972 type = 1
973 err_type = 3
974
975 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800976 if xid != None:
977 self.xid = xid
978 else:
979 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700980 if code != None:
981 self.code = code
982 else:
983 self.code = 0
984 if data != None:
985 self.data = data
986 else:
987 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800988 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700989
990 def pack(self):
991 packed = []
992 packed.append(struct.pack("!B", self.version))
993 packed.append(struct.pack("!B", self.type))
994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
995 packed.append(struct.pack("!L", self.xid))
996 packed.append(struct.pack("!H", self.err_type))
997 packed.append(struct.pack("!H", self.code))
998 packed.append(self.data)
999 length = sum([len(x) for x in packed])
1000 packed[2] = struct.pack("!H", length)
1001 return ''.join(packed)
1002
1003 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001004 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001005 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001006 _version = reader.read("!B")[0]
1007 assert(_version == 4)
1008 _type = reader.read("!B")[0]
1009 assert(_type == 1)
1010 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001011 orig_reader = reader
1012 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001013 obj.xid = reader.read("!L")[0]
1014 _err_type = reader.read("!H")[0]
1015 assert(_err_type == 3)
1016 obj.code = reader.read("!H")[0]
1017 obj.data = str(reader.read_all())
1018 return obj
1019
1020 def __eq__(self, other):
1021 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001022 if self.xid != other.xid: return False
1023 if self.code != other.code: return False
1024 if self.data != other.data: return False
1025 return True
1026
Rich Lane6f4978c2013-10-20 21:33:52 -07001027 def pretty_print(self, q):
1028 q.text("bad_instruction_error_msg {")
1029 with q.group():
1030 with q.indent(2):
1031 q.breakable()
1032 q.text("xid = ");
1033 if self.xid != None:
1034 q.text("%#x" % self.xid)
1035 else:
1036 q.text('None')
1037 q.text(","); q.breakable()
1038 q.text("code = ");
1039 q.text("%#x" % self.code)
1040 q.text(","); q.breakable()
1041 q.text("data = ");
1042 q.pp(self.data)
1043 q.breakable()
1044 q.text('}')
1045
Rich Lane7dcdf022013-12-11 14:45:27 -08001046error_msg.subtypes[3] = bad_instruction_error_msg
1047
1048class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001049 version = 4
1050 type = 1
1051 err_type = 4
1052
1053 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001054 if xid != None:
1055 self.xid = xid
1056 else:
1057 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001058 if code != None:
1059 self.code = code
1060 else:
1061 self.code = 0
1062 if data != None:
1063 self.data = data
1064 else:
1065 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001066 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001067
1068 def pack(self):
1069 packed = []
1070 packed.append(struct.pack("!B", self.version))
1071 packed.append(struct.pack("!B", self.type))
1072 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1073 packed.append(struct.pack("!L", self.xid))
1074 packed.append(struct.pack("!H", self.err_type))
1075 packed.append(struct.pack("!H", self.code))
1076 packed.append(self.data)
1077 length = sum([len(x) for x in packed])
1078 packed[2] = struct.pack("!H", length)
1079 return ''.join(packed)
1080
1081 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001082 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001083 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001084 _version = reader.read("!B")[0]
1085 assert(_version == 4)
1086 _type = reader.read("!B")[0]
1087 assert(_type == 1)
1088 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001089 orig_reader = reader
1090 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001091 obj.xid = reader.read("!L")[0]
1092 _err_type = reader.read("!H")[0]
1093 assert(_err_type == 4)
1094 obj.code = reader.read("!H")[0]
1095 obj.data = str(reader.read_all())
1096 return obj
1097
1098 def __eq__(self, other):
1099 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001100 if self.xid != other.xid: return False
1101 if self.code != other.code: return False
1102 if self.data != other.data: return False
1103 return True
1104
Rich Lane6f4978c2013-10-20 21:33:52 -07001105 def pretty_print(self, q):
1106 q.text("bad_match_error_msg {")
1107 with q.group():
1108 with q.indent(2):
1109 q.breakable()
1110 q.text("xid = ");
1111 if self.xid != None:
1112 q.text("%#x" % self.xid)
1113 else:
1114 q.text('None')
1115 q.text(","); q.breakable()
1116 q.text("code = ");
1117 q.text("%#x" % self.code)
1118 q.text(","); q.breakable()
1119 q.text("data = ");
1120 q.pp(self.data)
1121 q.breakable()
1122 q.text('}')
1123
Rich Lane7dcdf022013-12-11 14:45:27 -08001124error_msg.subtypes[4] = bad_match_error_msg
1125
1126class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001127 version = 4
1128 type = 1
1129 err_type = 1
1130
1131 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001132 if xid != None:
1133 self.xid = xid
1134 else:
1135 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001136 if code != None:
1137 self.code = code
1138 else:
1139 self.code = 0
1140 if data != None:
1141 self.data = data
1142 else:
1143 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001144 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001145
1146 def pack(self):
1147 packed = []
1148 packed.append(struct.pack("!B", self.version))
1149 packed.append(struct.pack("!B", self.type))
1150 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1151 packed.append(struct.pack("!L", self.xid))
1152 packed.append(struct.pack("!H", self.err_type))
1153 packed.append(struct.pack("!H", self.code))
1154 packed.append(self.data)
1155 length = sum([len(x) for x in packed])
1156 packed[2] = struct.pack("!H", length)
1157 return ''.join(packed)
1158
1159 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001160 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001161 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001162 _version = reader.read("!B")[0]
1163 assert(_version == 4)
1164 _type = reader.read("!B")[0]
1165 assert(_type == 1)
1166 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001167 orig_reader = reader
1168 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001169 obj.xid = reader.read("!L")[0]
1170 _err_type = reader.read("!H")[0]
1171 assert(_err_type == 1)
1172 obj.code = reader.read("!H")[0]
1173 obj.data = str(reader.read_all())
1174 return obj
1175
1176 def __eq__(self, other):
1177 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001178 if self.xid != other.xid: return False
1179 if self.code != other.code: return False
1180 if self.data != other.data: return False
1181 return True
1182
Rich Lane6f4978c2013-10-20 21:33:52 -07001183 def pretty_print(self, q):
1184 q.text("bad_request_error_msg {")
1185 with q.group():
1186 with q.indent(2):
1187 q.breakable()
1188 q.text("xid = ");
1189 if self.xid != None:
1190 q.text("%#x" % self.xid)
1191 else:
1192 q.text('None')
1193 q.text(","); q.breakable()
1194 q.text("code = ");
1195 q.text("%#x" % self.code)
1196 q.text(","); q.breakable()
1197 q.text("data = ");
1198 q.pp(self.data)
1199 q.breakable()
1200 q.text('}')
1201
Rich Lane7dcdf022013-12-11 14:45:27 -08001202error_msg.subtypes[1] = bad_request_error_msg
1203
1204class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001205 version = 4
1206 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001207
1208 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001209 if xid != None:
1210 self.xid = xid
1211 else:
1212 self.xid = None
1213 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001214
1215 def pack(self):
1216 packed = []
1217 packed.append(struct.pack("!B", self.version))
1218 packed.append(struct.pack("!B", self.type))
1219 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1220 packed.append(struct.pack("!L", self.xid))
1221 length = sum([len(x) for x in packed])
1222 packed[2] = struct.pack("!H", length)
1223 return ''.join(packed)
1224
1225 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001226 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001227 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001228 _version = reader.read("!B")[0]
1229 assert(_version == 4)
1230 _type = reader.read("!B")[0]
1231 assert(_type == 21)
1232 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001233 orig_reader = reader
1234 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001235 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001236 return obj
1237
1238 def __eq__(self, other):
1239 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001240 if self.xid != other.xid: return False
1241 return True
1242
Rich Lanec2ee4b82013-04-24 17:12:38 -07001243 def pretty_print(self, q):
1244 q.text("barrier_reply {")
1245 with q.group():
1246 with q.indent(2):
1247 q.breakable()
1248 q.text("xid = ");
1249 if self.xid != None:
1250 q.text("%#x" % self.xid)
1251 else:
1252 q.text('None')
1253 q.breakable()
1254 q.text('}')
1255
Rich Lane7dcdf022013-12-11 14:45:27 -08001256message.subtypes[21] = barrier_reply
1257
1258class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001259 version = 4
1260 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -07001261
1262 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001263 if xid != None:
1264 self.xid = xid
1265 else:
1266 self.xid = None
1267 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001268
1269 def pack(self):
1270 packed = []
1271 packed.append(struct.pack("!B", self.version))
1272 packed.append(struct.pack("!B", self.type))
1273 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1274 packed.append(struct.pack("!L", self.xid))
1275 length = sum([len(x) for x in packed])
1276 packed[2] = struct.pack("!H", length)
1277 return ''.join(packed)
1278
1279 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001280 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001281 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001282 _version = reader.read("!B")[0]
1283 assert(_version == 4)
1284 _type = reader.read("!B")[0]
1285 assert(_type == 20)
1286 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001287 orig_reader = reader
1288 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001289 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001290 return obj
1291
1292 def __eq__(self, other):
1293 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001294 if self.xid != other.xid: return False
1295 return True
1296
Rich Lanec2ee4b82013-04-24 17:12:38 -07001297 def pretty_print(self, q):
1298 q.text("barrier_request {")
1299 with q.group():
1300 with q.indent(2):
1301 q.breakable()
1302 q.text("xid = ");
1303 if self.xid != None:
1304 q.text("%#x" % self.xid)
1305 else:
1306 q.text('None')
1307 q.breakable()
1308 q.text('}')
1309
Rich Lane7dcdf022013-12-11 14:45:27 -08001310message.subtypes[20] = barrier_request
1311
1312class experimenter(message):
1313 subtypes = {}
1314
Rich Lane95f7fc92014-01-27 17:08:16 -08001315 version = 4
1316 type = 4
1317
1318 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1319 if xid != None:
1320 self.xid = xid
1321 else:
1322 self.xid = None
1323 if experimenter != None:
1324 self.experimenter = experimenter
1325 else:
1326 self.experimenter = 0
1327 if subtype != None:
1328 self.subtype = subtype
1329 else:
1330 self.subtype = 0
1331 if data != None:
1332 self.data = data
1333 else:
1334 self.data = ''
1335 return
1336
1337 def pack(self):
1338 packed = []
1339 packed.append(struct.pack("!B", self.version))
1340 packed.append(struct.pack("!B", self.type))
1341 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1342 packed.append(struct.pack("!L", self.xid))
1343 packed.append(struct.pack("!L", self.experimenter))
1344 packed.append(struct.pack("!L", self.subtype))
1345 packed.append(self.data)
1346 length = sum([len(x) for x in packed])
1347 packed[2] = struct.pack("!H", length)
1348 return ''.join(packed)
1349
Rich Lane7dcdf022013-12-11 14:45:27 -08001350 @staticmethod
1351 def unpack(reader):
1352 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001353 subclass = experimenter.subtypes.get(subtype)
1354 if subclass:
1355 return subclass.unpack(reader)
1356
1357 obj = experimenter()
1358 _version = reader.read("!B")[0]
1359 assert(_version == 4)
1360 _type = reader.read("!B")[0]
1361 assert(_type == 4)
1362 _length = reader.read("!H")[0]
1363 orig_reader = reader
1364 reader = orig_reader.slice(_length - (2 + 2))
1365 obj.xid = reader.read("!L")[0]
1366 obj.experimenter = reader.read("!L")[0]
1367 obj.subtype = reader.read("!L")[0]
1368 obj.data = str(reader.read_all())
1369 return obj
1370
1371 def __eq__(self, other):
1372 if type(self) != type(other): return False
1373 if self.xid != other.xid: return False
1374 if self.experimenter != other.experimenter: return False
1375 if self.subtype != other.subtype: return False
1376 if self.data != other.data: return False
1377 return True
1378
1379 def pretty_print(self, q):
1380 q.text("experimenter {")
1381 with q.group():
1382 with q.indent(2):
1383 q.breakable()
1384 q.text("xid = ");
1385 if self.xid != None:
1386 q.text("%#x" % self.xid)
1387 else:
1388 q.text('None')
1389 q.text(","); q.breakable()
1390 q.text("subtype = ");
1391 q.text("%#x" % self.subtype)
1392 q.text(","); q.breakable()
1393 q.text("data = ");
1394 q.pp(self.data)
1395 q.breakable()
1396 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001397
1398message.subtypes[4] = experimenter
1399
1400class bsn_header(experimenter):
1401 subtypes = {}
1402
Rich Lane95f7fc92014-01-27 17:08:16 -08001403 version = 4
1404 type = 4
1405 experimenter = 6035143
1406
1407 def __init__(self, xid=None, subtype=None):
1408 if xid != None:
1409 self.xid = xid
1410 else:
1411 self.xid = None
1412 if subtype != None:
1413 self.subtype = subtype
1414 else:
1415 self.subtype = 0
1416 return
1417
1418 def pack(self):
1419 packed = []
1420 packed.append(struct.pack("!B", self.version))
1421 packed.append(struct.pack("!B", self.type))
1422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1423 packed.append(struct.pack("!L", self.xid))
1424 packed.append(struct.pack("!L", self.experimenter))
1425 packed.append(struct.pack("!L", self.subtype))
1426 length = sum([len(x) for x in packed])
1427 packed[2] = struct.pack("!H", length)
1428 return ''.join(packed)
1429
Rich Lane7dcdf022013-12-11 14:45:27 -08001430 @staticmethod
1431 def unpack(reader):
1432 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001433 subclass = bsn_header.subtypes.get(subtype)
1434 if subclass:
1435 return subclass.unpack(reader)
1436
1437 obj = bsn_header()
1438 _version = reader.read("!B")[0]
1439 assert(_version == 4)
1440 _type = reader.read("!B")[0]
1441 assert(_type == 4)
1442 _length = reader.read("!H")[0]
1443 orig_reader = reader
1444 reader = orig_reader.slice(_length - (2 + 2))
1445 obj.xid = reader.read("!L")[0]
1446 _experimenter = reader.read("!L")[0]
1447 assert(_experimenter == 6035143)
1448 obj.subtype = reader.read("!L")[0]
1449 return obj
1450
1451 def __eq__(self, other):
1452 if type(self) != type(other): return False
1453 if self.xid != other.xid: return False
1454 if self.subtype != other.subtype: return False
1455 return True
1456
1457 def pretty_print(self, q):
1458 q.text("bsn_header {")
1459 with q.group():
1460 with q.indent(2):
1461 q.breakable()
1462 q.text("xid = ");
1463 if self.xid != None:
1464 q.text("%#x" % self.xid)
1465 else:
1466 q.text('None')
1467 q.breakable()
1468 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001469
1470experimenter.subtypes[6035143] = bsn_header
1471
1472class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001473 version = 4
1474 type = 4
1475 experimenter = 6035143
1476 subtype = 22
1477
1478 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001479 if xid != None:
1480 self.xid = xid
1481 else:
1482 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001483 if status != None:
1484 self.status = status
1485 else:
1486 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001487 return
Dan Talaycof6202252013-07-02 01:00:29 -07001488
1489 def pack(self):
1490 packed = []
1491 packed.append(struct.pack("!B", self.version))
1492 packed.append(struct.pack("!B", self.type))
1493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1494 packed.append(struct.pack("!L", self.xid))
1495 packed.append(struct.pack("!L", self.experimenter))
1496 packed.append(struct.pack("!L", self.subtype))
1497 packed.append(struct.pack("!L", self.status))
1498 length = sum([len(x) for x in packed])
1499 packed[2] = struct.pack("!H", length)
1500 return ''.join(packed)
1501
1502 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001503 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001504 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001505 _version = reader.read("!B")[0]
1506 assert(_version == 4)
1507 _type = reader.read("!B")[0]
1508 assert(_type == 4)
1509 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001510 orig_reader = reader
1511 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001512 obj.xid = reader.read("!L")[0]
1513 _experimenter = reader.read("!L")[0]
1514 assert(_experimenter == 6035143)
1515 _subtype = reader.read("!L")[0]
1516 assert(_subtype == 22)
1517 obj.status = reader.read("!L")[0]
1518 return obj
1519
1520 def __eq__(self, other):
1521 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001522 if self.xid != other.xid: return False
1523 if self.status != other.status: return False
1524 return True
1525
Dan Talaycof6202252013-07-02 01:00:29 -07001526 def pretty_print(self, q):
1527 q.text("bsn_bw_clear_data_reply {")
1528 with q.group():
1529 with q.indent(2):
1530 q.breakable()
1531 q.text("xid = ");
1532 if self.xid != None:
1533 q.text("%#x" % self.xid)
1534 else:
1535 q.text('None')
1536 q.text(","); q.breakable()
1537 q.text("status = ");
1538 q.text("%#x" % self.status)
1539 q.breakable()
1540 q.text('}')
1541
Rich Lane7dcdf022013-12-11 14:45:27 -08001542bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1543
1544class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001545 version = 4
1546 type = 4
1547 experimenter = 6035143
1548 subtype = 21
1549
1550 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001551 if xid != None:
1552 self.xid = xid
1553 else:
1554 self.xid = None
1555 return
Dan Talaycof6202252013-07-02 01:00:29 -07001556
1557 def pack(self):
1558 packed = []
1559 packed.append(struct.pack("!B", self.version))
1560 packed.append(struct.pack("!B", self.type))
1561 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1562 packed.append(struct.pack("!L", self.xid))
1563 packed.append(struct.pack("!L", self.experimenter))
1564 packed.append(struct.pack("!L", self.subtype))
1565 length = sum([len(x) for x in packed])
1566 packed[2] = struct.pack("!H", length)
1567 return ''.join(packed)
1568
1569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001570 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001571 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001572 _version = reader.read("!B")[0]
1573 assert(_version == 4)
1574 _type = reader.read("!B")[0]
1575 assert(_type == 4)
1576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001577 orig_reader = reader
1578 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001579 obj.xid = reader.read("!L")[0]
1580 _experimenter = reader.read("!L")[0]
1581 assert(_experimenter == 6035143)
1582 _subtype = reader.read("!L")[0]
1583 assert(_subtype == 21)
1584 return obj
1585
1586 def __eq__(self, other):
1587 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001588 if self.xid != other.xid: return False
1589 return True
1590
Dan Talaycof6202252013-07-02 01:00:29 -07001591 def pretty_print(self, q):
1592 q.text("bsn_bw_clear_data_request {")
1593 with q.group():
1594 with q.indent(2):
1595 q.breakable()
1596 q.text("xid = ");
1597 if self.xid != None:
1598 q.text("%#x" % self.xid)
1599 else:
1600 q.text('None')
1601 q.breakable()
1602 q.text('}')
1603
Rich Lane7dcdf022013-12-11 14:45:27 -08001604bsn_header.subtypes[21] = bsn_bw_clear_data_request
1605
1606class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001607 version = 4
1608 type = 4
1609 experimenter = 6035143
1610 subtype = 20
1611
1612 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001613 if xid != None:
1614 self.xid = xid
1615 else:
1616 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001617 if enabled != None:
1618 self.enabled = enabled
1619 else:
1620 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001621 return
Dan Talaycof6202252013-07-02 01:00:29 -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 packed.append(struct.pack("!L", self.enabled))
1632 length = sum([len(x) for x in packed])
1633 packed[2] = struct.pack("!H", length)
1634 return ''.join(packed)
1635
1636 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001637 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001638 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001639 _version = reader.read("!B")[0]
1640 assert(_version == 4)
1641 _type = reader.read("!B")[0]
1642 assert(_type == 4)
1643 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001644 orig_reader = reader
1645 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001646 obj.xid = reader.read("!L")[0]
1647 _experimenter = reader.read("!L")[0]
1648 assert(_experimenter == 6035143)
1649 _subtype = reader.read("!L")[0]
1650 assert(_subtype == 20)
1651 obj.enabled = reader.read("!L")[0]
1652 return obj
1653
1654 def __eq__(self, other):
1655 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001656 if self.xid != other.xid: return False
1657 if self.enabled != other.enabled: return False
1658 return True
1659
Dan Talaycof6202252013-07-02 01:00:29 -07001660 def pretty_print(self, q):
1661 q.text("bsn_bw_enable_get_reply {")
1662 with q.group():
1663 with q.indent(2):
1664 q.breakable()
1665 q.text("xid = ");
1666 if self.xid != None:
1667 q.text("%#x" % self.xid)
1668 else:
1669 q.text('None')
1670 q.text(","); q.breakable()
1671 q.text("enabled = ");
1672 q.text("%#x" % self.enabled)
1673 q.breakable()
1674 q.text('}')
1675
Rich Lane7dcdf022013-12-11 14:45:27 -08001676bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1677
1678class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001679 version = 4
1680 type = 4
1681 experimenter = 6035143
1682 subtype = 19
1683
1684 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001685 if xid != None:
1686 self.xid = xid
1687 else:
1688 self.xid = None
1689 return
Dan Talaycof6202252013-07-02 01:00:29 -07001690
1691 def pack(self):
1692 packed = []
1693 packed.append(struct.pack("!B", self.version))
1694 packed.append(struct.pack("!B", self.type))
1695 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1696 packed.append(struct.pack("!L", self.xid))
1697 packed.append(struct.pack("!L", self.experimenter))
1698 packed.append(struct.pack("!L", self.subtype))
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):
Dan Talaycof6202252013-07-02 01:00:29 -07001705 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001706 _version = reader.read("!B")[0]
1707 assert(_version == 4)
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
1712 reader = orig_reader.slice(_length - (2 + 2))
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]
1717 assert(_subtype == 19)
1718 return obj
1719
1720 def __eq__(self, other):
1721 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001722 if self.xid != other.xid: return False
1723 return True
1724
Dan Talaycof6202252013-07-02 01:00:29 -07001725 def pretty_print(self, q):
1726 q.text("bsn_bw_enable_get_request {")
1727 with q.group():
1728 with q.indent(2):
1729 q.breakable()
1730 q.text("xid = ");
1731 if self.xid != None:
1732 q.text("%#x" % self.xid)
1733 else:
1734 q.text('None')
1735 q.breakable()
1736 q.text('}')
1737
Rich Lane7dcdf022013-12-11 14:45:27 -08001738bsn_header.subtypes[19] = bsn_bw_enable_get_request
1739
1740class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001741 version = 4
1742 type = 4
1743 experimenter = 6035143
1744 subtype = 23
1745
1746 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001747 if xid != None:
1748 self.xid = xid
1749 else:
1750 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001751 if enable != None:
1752 self.enable = enable
1753 else:
1754 self.enable = 0
1755 if status != None:
1756 self.status = status
1757 else:
1758 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001759 return
Dan Talaycof6202252013-07-02 01:00:29 -07001760
1761 def pack(self):
1762 packed = []
1763 packed.append(struct.pack("!B", self.version))
1764 packed.append(struct.pack("!B", self.type))
1765 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1766 packed.append(struct.pack("!L", self.xid))
1767 packed.append(struct.pack("!L", self.experimenter))
1768 packed.append(struct.pack("!L", self.subtype))
1769 packed.append(struct.pack("!L", self.enable))
1770 packed.append(struct.pack("!L", self.status))
1771 length = sum([len(x) for x in packed])
1772 packed[2] = struct.pack("!H", length)
1773 return ''.join(packed)
1774
1775 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001776 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001777 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001778 _version = reader.read("!B")[0]
1779 assert(_version == 4)
1780 _type = reader.read("!B")[0]
1781 assert(_type == 4)
1782 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001783 orig_reader = reader
1784 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001785 obj.xid = reader.read("!L")[0]
1786 _experimenter = reader.read("!L")[0]
1787 assert(_experimenter == 6035143)
1788 _subtype = reader.read("!L")[0]
1789 assert(_subtype == 23)
1790 obj.enable = reader.read("!L")[0]
1791 obj.status = reader.read("!L")[0]
1792 return obj
1793
1794 def __eq__(self, other):
1795 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001796 if self.xid != other.xid: return False
1797 if self.enable != other.enable: return False
1798 if self.status != other.status: return False
1799 return True
1800
Dan Talaycof6202252013-07-02 01:00:29 -07001801 def pretty_print(self, q):
1802 q.text("bsn_bw_enable_set_reply {")
1803 with q.group():
1804 with q.indent(2):
1805 q.breakable()
1806 q.text("xid = ");
1807 if self.xid != None:
1808 q.text("%#x" % self.xid)
1809 else:
1810 q.text('None')
1811 q.text(","); q.breakable()
1812 q.text("enable = ");
1813 q.text("%#x" % self.enable)
1814 q.text(","); q.breakable()
1815 q.text("status = ");
1816 q.text("%#x" % self.status)
1817 q.breakable()
1818 q.text('}')
1819
Rich Lane7dcdf022013-12-11 14:45:27 -08001820bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1821
1822class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001823 version = 4
1824 type = 4
1825 experimenter = 6035143
1826 subtype = 18
1827
1828 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001829 if xid != None:
1830 self.xid = xid
1831 else:
1832 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001833 if enable != None:
1834 self.enable = enable
1835 else:
1836 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001837 return
Dan Talaycof6202252013-07-02 01:00:29 -07001838
1839 def pack(self):
1840 packed = []
1841 packed.append(struct.pack("!B", self.version))
1842 packed.append(struct.pack("!B", self.type))
1843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1844 packed.append(struct.pack("!L", self.xid))
1845 packed.append(struct.pack("!L", self.experimenter))
1846 packed.append(struct.pack("!L", self.subtype))
1847 packed.append(struct.pack("!L", self.enable))
1848 length = sum([len(x) for x in packed])
1849 packed[2] = struct.pack("!H", length)
1850 return ''.join(packed)
1851
1852 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001853 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001854 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001855 _version = reader.read("!B")[0]
1856 assert(_version == 4)
1857 _type = reader.read("!B")[0]
1858 assert(_type == 4)
1859 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001860 orig_reader = reader
1861 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001862 obj.xid = reader.read("!L")[0]
1863 _experimenter = reader.read("!L")[0]
1864 assert(_experimenter == 6035143)
1865 _subtype = reader.read("!L")[0]
1866 assert(_subtype == 18)
1867 obj.enable = reader.read("!L")[0]
1868 return obj
1869
1870 def __eq__(self, other):
1871 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001872 if self.xid != other.xid: return False
1873 if self.enable != other.enable: return False
1874 return True
1875
Dan Talaycof6202252013-07-02 01:00:29 -07001876 def pretty_print(self, q):
1877 q.text("bsn_bw_enable_set_request {")
1878 with q.group():
1879 with q.indent(2):
1880 q.breakable()
1881 q.text("xid = ");
1882 if self.xid != None:
1883 q.text("%#x" % self.xid)
1884 else:
1885 q.text('None')
1886 q.text(","); q.breakable()
1887 q.text("enable = ");
1888 q.text("%#x" % self.enable)
1889 q.breakable()
1890 q.text('}')
1891
Rich Lane7dcdf022013-12-11 14:45:27 -08001892bsn_header.subtypes[18] = bsn_bw_enable_set_request
1893
Rich Lane5454b682014-01-14 17:07:36 -08001894class bsn_controller_connections_reply(bsn_header):
1895 version = 4
1896 type = 4
1897 experimenter = 6035143
1898 subtype = 57
1899
1900 def __init__(self, xid=None, connections=None):
1901 if xid != None:
1902 self.xid = xid
1903 else:
1904 self.xid = None
1905 if connections != None:
1906 self.connections = connections
1907 else:
1908 self.connections = []
1909 return
1910
1911 def pack(self):
1912 packed = []
1913 packed.append(struct.pack("!B", self.version))
1914 packed.append(struct.pack("!B", self.type))
1915 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1916 packed.append(struct.pack("!L", self.xid))
1917 packed.append(struct.pack("!L", self.experimenter))
1918 packed.append(struct.pack("!L", self.subtype))
1919 packed.append(loxi.generic_util.pack_list(self.connections))
1920 length = sum([len(x) for x in packed])
1921 packed[2] = struct.pack("!H", length)
1922 return ''.join(packed)
1923
1924 @staticmethod
1925 def unpack(reader):
1926 obj = bsn_controller_connections_reply()
1927 _version = reader.read("!B")[0]
1928 assert(_version == 4)
1929 _type = reader.read("!B")[0]
1930 assert(_type == 4)
1931 _length = reader.read("!H")[0]
1932 orig_reader = reader
1933 reader = orig_reader.slice(_length - (2 + 2))
1934 obj.xid = reader.read("!L")[0]
1935 _experimenter = reader.read("!L")[0]
1936 assert(_experimenter == 6035143)
1937 _subtype = reader.read("!L")[0]
1938 assert(_subtype == 57)
1939 obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack)
1940 return obj
1941
1942 def __eq__(self, other):
1943 if type(self) != type(other): return False
1944 if self.xid != other.xid: return False
1945 if self.connections != other.connections: return False
1946 return True
1947
1948 def pretty_print(self, q):
1949 q.text("bsn_controller_connections_reply {")
1950 with q.group():
1951 with q.indent(2):
1952 q.breakable()
1953 q.text("xid = ");
1954 if self.xid != None:
1955 q.text("%#x" % self.xid)
1956 else:
1957 q.text('None')
1958 q.text(","); q.breakable()
1959 q.text("connections = ");
1960 q.pp(self.connections)
1961 q.breakable()
1962 q.text('}')
1963
1964bsn_header.subtypes[57] = bsn_controller_connections_reply
1965
1966class bsn_controller_connections_request(bsn_header):
1967 version = 4
1968 type = 4
1969 experimenter = 6035143
1970 subtype = 56
1971
1972 def __init__(self, xid=None):
1973 if xid != None:
1974 self.xid = xid
1975 else:
1976 self.xid = None
1977 return
1978
1979 def pack(self):
1980 packed = []
1981 packed.append(struct.pack("!B", self.version))
1982 packed.append(struct.pack("!B", self.type))
1983 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1984 packed.append(struct.pack("!L", self.xid))
1985 packed.append(struct.pack("!L", self.experimenter))
1986 packed.append(struct.pack("!L", self.subtype))
1987 length = sum([len(x) for x in packed])
1988 packed[2] = struct.pack("!H", length)
1989 return ''.join(packed)
1990
1991 @staticmethod
1992 def unpack(reader):
1993 obj = bsn_controller_connections_request()
1994 _version = reader.read("!B")[0]
1995 assert(_version == 4)
1996 _type = reader.read("!B")[0]
1997 assert(_type == 4)
1998 _length = reader.read("!H")[0]
1999 orig_reader = reader
2000 reader = orig_reader.slice(_length - (2 + 2))
2001 obj.xid = reader.read("!L")[0]
2002 _experimenter = reader.read("!L")[0]
2003 assert(_experimenter == 6035143)
2004 _subtype = reader.read("!L")[0]
2005 assert(_subtype == 56)
2006 return obj
2007
2008 def __eq__(self, other):
2009 if type(self) != type(other): return False
2010 if self.xid != other.xid: return False
2011 return True
2012
2013 def pretty_print(self, q):
2014 q.text("bsn_controller_connections_request {")
2015 with q.group():
2016 with q.indent(2):
2017 q.breakable()
2018 q.text("xid = ");
2019 if self.xid != None:
2020 q.text("%#x" % self.xid)
2021 else:
2022 q.text('None')
2023 q.breakable()
2024 q.text('}')
2025
2026bsn_header.subtypes[56] = bsn_controller_connections_request
2027
Rich Lane7dcdf022013-12-11 14:45:27 -08002028class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002029 version = 4
2030 type = 4
2031 experimenter = 6035143
2032 subtype = 40
2033
2034 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002035 if xid != None:
2036 self.xid = xid
2037 else:
2038 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002039 if cookie != None:
2040 self.cookie = cookie
2041 else:
2042 self.cookie = 0
2043 if priority != None:
2044 self.priority = priority
2045 else:
2046 self.priority = 0
2047 if table_id != None:
2048 self.table_id = table_id
2049 else:
2050 self.table_id = 0
2051 if match != None:
2052 self.match = match
2053 else:
2054 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08002055 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002056
2057 def pack(self):
2058 packed = []
2059 packed.append(struct.pack("!B", self.version))
2060 packed.append(struct.pack("!B", self.type))
2061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2062 packed.append(struct.pack("!L", self.xid))
2063 packed.append(struct.pack("!L", self.experimenter))
2064 packed.append(struct.pack("!L", self.subtype))
2065 packed.append(struct.pack("!Q", self.cookie))
2066 packed.append(struct.pack("!H", self.priority))
2067 packed.append(struct.pack("!B", self.table_id))
2068 packed.append('\x00' * 5)
2069 packed.append(self.match.pack())
2070 length = sum([len(x) for x in packed])
2071 packed[2] = struct.pack("!H", length)
2072 return ''.join(packed)
2073
2074 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002075 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002076 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07002077 _version = reader.read("!B")[0]
2078 assert(_version == 4)
2079 _type = reader.read("!B")[0]
2080 assert(_type == 4)
2081 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002082 orig_reader = reader
2083 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002084 obj.xid = reader.read("!L")[0]
2085 _experimenter = reader.read("!L")[0]
2086 assert(_experimenter == 6035143)
2087 _subtype = reader.read("!L")[0]
2088 assert(_subtype == 40)
2089 obj.cookie = reader.read("!Q")[0]
2090 obj.priority = reader.read("!H")[0]
2091 obj.table_id = reader.read("!B")[0]
2092 reader.skip(5)
2093 obj.match = common.match.unpack(reader)
2094 return obj
2095
2096 def __eq__(self, other):
2097 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002098 if self.xid != other.xid: return False
2099 if self.cookie != other.cookie: return False
2100 if self.priority != other.priority: return False
2101 if self.table_id != other.table_id: return False
2102 if self.match != other.match: return False
2103 return True
2104
Rich Lane6f4978c2013-10-20 21:33:52 -07002105 def pretty_print(self, q):
2106 q.text("bsn_flow_idle {")
2107 with q.group():
2108 with q.indent(2):
2109 q.breakable()
2110 q.text("xid = ");
2111 if self.xid != None:
2112 q.text("%#x" % self.xid)
2113 else:
2114 q.text('None')
2115 q.text(","); q.breakable()
2116 q.text("cookie = ");
2117 q.text("%#x" % self.cookie)
2118 q.text(","); q.breakable()
2119 q.text("priority = ");
2120 q.text("%#x" % self.priority)
2121 q.text(","); q.breakable()
2122 q.text("table_id = ");
2123 q.text("%#x" % self.table_id)
2124 q.text(","); q.breakable()
2125 q.text("match = ");
2126 q.pp(self.match)
2127 q.breakable()
2128 q.text('}')
2129
Rich Lane7dcdf022013-12-11 14:45:27 -08002130bsn_header.subtypes[40] = bsn_flow_idle
2131
2132class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002133 version = 4
2134 type = 4
2135 experimenter = 6035143
2136 subtype = 39
2137
2138 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002139 if xid != None:
2140 self.xid = xid
2141 else:
2142 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002143 if enabled != None:
2144 self.enabled = enabled
2145 else:
2146 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002147 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002148
2149 def pack(self):
2150 packed = []
2151 packed.append(struct.pack("!B", self.version))
2152 packed.append(struct.pack("!B", self.type))
2153 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2154 packed.append(struct.pack("!L", self.xid))
2155 packed.append(struct.pack("!L", self.experimenter))
2156 packed.append(struct.pack("!L", self.subtype))
2157 packed.append(struct.pack("!L", self.enabled))
2158 length = sum([len(x) for x in packed])
2159 packed[2] = struct.pack("!H", length)
2160 return ''.join(packed)
2161
2162 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002163 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002164 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002165 _version = reader.read("!B")[0]
2166 assert(_version == 4)
2167 _type = reader.read("!B")[0]
2168 assert(_type == 4)
2169 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002170 orig_reader = reader
2171 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002172 obj.xid = reader.read("!L")[0]
2173 _experimenter = reader.read("!L")[0]
2174 assert(_experimenter == 6035143)
2175 _subtype = reader.read("!L")[0]
2176 assert(_subtype == 39)
2177 obj.enabled = reader.read("!L")[0]
2178 return obj
2179
2180 def __eq__(self, other):
2181 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002182 if self.xid != other.xid: return False
2183 if self.enabled != other.enabled: return False
2184 return True
2185
Rich Lane6f4978c2013-10-20 21:33:52 -07002186 def pretty_print(self, q):
2187 q.text("bsn_flow_idle_enable_get_reply {")
2188 with q.group():
2189 with q.indent(2):
2190 q.breakable()
2191 q.text("xid = ");
2192 if self.xid != None:
2193 q.text("%#x" % self.xid)
2194 else:
2195 q.text('None')
2196 q.text(","); q.breakable()
2197 q.text("enabled = ");
2198 q.text("%#x" % self.enabled)
2199 q.breakable()
2200 q.text('}')
2201
Rich Lane7dcdf022013-12-11 14:45:27 -08002202bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
2203
2204class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002205 version = 4
2206 type = 4
2207 experimenter = 6035143
2208 subtype = 38
2209
2210 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002211 if xid != None:
2212 self.xid = xid
2213 else:
2214 self.xid = None
2215 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002216
2217 def pack(self):
2218 packed = []
2219 packed.append(struct.pack("!B", self.version))
2220 packed.append(struct.pack("!B", self.type))
2221 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2222 packed.append(struct.pack("!L", self.xid))
2223 packed.append(struct.pack("!L", self.experimenter))
2224 packed.append(struct.pack("!L", self.subtype))
2225 length = sum([len(x) for x in packed])
2226 packed[2] = struct.pack("!H", length)
2227 return ''.join(packed)
2228
2229 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002230 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002231 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002232 _version = reader.read("!B")[0]
2233 assert(_version == 4)
2234 _type = reader.read("!B")[0]
2235 assert(_type == 4)
2236 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002237 orig_reader = reader
2238 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002239 obj.xid = reader.read("!L")[0]
2240 _experimenter = reader.read("!L")[0]
2241 assert(_experimenter == 6035143)
2242 _subtype = reader.read("!L")[0]
2243 assert(_subtype == 38)
2244 return obj
2245
2246 def __eq__(self, other):
2247 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002248 if self.xid != other.xid: return False
2249 return True
2250
Rich Lane6f4978c2013-10-20 21:33:52 -07002251 def pretty_print(self, q):
2252 q.text("bsn_flow_idle_enable_get_request {")
2253 with q.group():
2254 with q.indent(2):
2255 q.breakable()
2256 q.text("xid = ");
2257 if self.xid != None:
2258 q.text("%#x" % self.xid)
2259 else:
2260 q.text('None')
2261 q.breakable()
2262 q.text('}')
2263
Rich Lane7dcdf022013-12-11 14:45:27 -08002264bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
2265
2266class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002267 version = 4
2268 type = 4
2269 experimenter = 6035143
2270 subtype = 37
2271
2272 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002273 if xid != None:
2274 self.xid = xid
2275 else:
2276 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002277 if enable != None:
2278 self.enable = enable
2279 else:
2280 self.enable = 0
2281 if status != None:
2282 self.status = status
2283 else:
2284 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002285 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002286
2287 def pack(self):
2288 packed = []
2289 packed.append(struct.pack("!B", self.version))
2290 packed.append(struct.pack("!B", self.type))
2291 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2292 packed.append(struct.pack("!L", self.xid))
2293 packed.append(struct.pack("!L", self.experimenter))
2294 packed.append(struct.pack("!L", self.subtype))
2295 packed.append(struct.pack("!L", self.enable))
2296 packed.append(struct.pack("!L", self.status))
2297 length = sum([len(x) for x in packed])
2298 packed[2] = struct.pack("!H", length)
2299 return ''.join(packed)
2300
2301 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002302 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002303 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002304 _version = reader.read("!B")[0]
2305 assert(_version == 4)
2306 _type = reader.read("!B")[0]
2307 assert(_type == 4)
2308 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002309 orig_reader = reader
2310 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002311 obj.xid = reader.read("!L")[0]
2312 _experimenter = reader.read("!L")[0]
2313 assert(_experimenter == 6035143)
2314 _subtype = reader.read("!L")[0]
2315 assert(_subtype == 37)
2316 obj.enable = reader.read("!L")[0]
2317 obj.status = reader.read("!L")[0]
2318 return obj
2319
2320 def __eq__(self, other):
2321 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002322 if self.xid != other.xid: return False
2323 if self.enable != other.enable: return False
2324 if self.status != other.status: return False
2325 return True
2326
Rich Lane6f4978c2013-10-20 21:33:52 -07002327 def pretty_print(self, q):
2328 q.text("bsn_flow_idle_enable_set_reply {")
2329 with q.group():
2330 with q.indent(2):
2331 q.breakable()
2332 q.text("xid = ");
2333 if self.xid != None:
2334 q.text("%#x" % self.xid)
2335 else:
2336 q.text('None')
2337 q.text(","); q.breakable()
2338 q.text("enable = ");
2339 q.text("%#x" % self.enable)
2340 q.text(","); q.breakable()
2341 q.text("status = ");
2342 q.text("%#x" % self.status)
2343 q.breakable()
2344 q.text('}')
2345
Rich Lane7dcdf022013-12-11 14:45:27 -08002346bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
2347
2348class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002349 version = 4
2350 type = 4
2351 experimenter = 6035143
2352 subtype = 36
2353
2354 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002355 if xid != None:
2356 self.xid = xid
2357 else:
2358 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002359 if enable != None:
2360 self.enable = enable
2361 else:
2362 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002363 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002364
2365 def pack(self):
2366 packed = []
2367 packed.append(struct.pack("!B", self.version))
2368 packed.append(struct.pack("!B", self.type))
2369 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2370 packed.append(struct.pack("!L", self.xid))
2371 packed.append(struct.pack("!L", self.experimenter))
2372 packed.append(struct.pack("!L", self.subtype))
2373 packed.append(struct.pack("!L", self.enable))
2374 length = sum([len(x) for x in packed])
2375 packed[2] = struct.pack("!H", length)
2376 return ''.join(packed)
2377
2378 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002379 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002380 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002381 _version = reader.read("!B")[0]
2382 assert(_version == 4)
2383 _type = reader.read("!B")[0]
2384 assert(_type == 4)
2385 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002386 orig_reader = reader
2387 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002388 obj.xid = reader.read("!L")[0]
2389 _experimenter = reader.read("!L")[0]
2390 assert(_experimenter == 6035143)
2391 _subtype = reader.read("!L")[0]
2392 assert(_subtype == 36)
2393 obj.enable = reader.read("!L")[0]
2394 return obj
2395
2396 def __eq__(self, other):
2397 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002398 if self.xid != other.xid: return False
2399 if self.enable != other.enable: return False
2400 return True
2401
Rich Lane6f4978c2013-10-20 21:33:52 -07002402 def pretty_print(self, q):
2403 q.text("bsn_flow_idle_enable_set_request {")
2404 with q.group():
2405 with q.indent(2):
2406 q.breakable()
2407 q.text("xid = ");
2408 if self.xid != None:
2409 q.text("%#x" % self.xid)
2410 else:
2411 q.text('None')
2412 q.text(","); q.breakable()
2413 q.text("enable = ");
2414 q.text("%#x" % self.enable)
2415 q.breakable()
2416 q.text('}')
2417
Rich Lane7dcdf022013-12-11 14:45:27 -08002418bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
2419
Rich Lane5454b682014-01-14 17:07:36 -08002420class experimenter_stats_reply(stats_reply):
2421 subtypes = {}
2422
Rich Lane95f7fc92014-01-27 17:08:16 -08002423 version = 4
2424 type = 19
2425 stats_type = 65535
2426
2427 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2428 if xid != None:
2429 self.xid = xid
2430 else:
2431 self.xid = None
2432 if flags != None:
2433 self.flags = flags
2434 else:
2435 self.flags = 0
2436 if experimenter != None:
2437 self.experimenter = experimenter
2438 else:
2439 self.experimenter = 0
2440 if subtype != None:
2441 self.subtype = subtype
2442 else:
2443 self.subtype = 0
2444 return
2445
2446 def pack(self):
2447 packed = []
2448 packed.append(struct.pack("!B", self.version))
2449 packed.append(struct.pack("!B", self.type))
2450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2451 packed.append(struct.pack("!L", self.xid))
2452 packed.append(struct.pack("!H", self.stats_type))
2453 packed.append(struct.pack("!H", self.flags))
2454 packed.append('\x00' * 4)
2455 packed.append(struct.pack("!L", self.experimenter))
2456 packed.append(struct.pack("!L", self.subtype))
2457 length = sum([len(x) for x in packed])
2458 packed[2] = struct.pack("!H", length)
2459 return ''.join(packed)
2460
Rich Lane5454b682014-01-14 17:07:36 -08002461 @staticmethod
2462 def unpack(reader):
2463 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002464 subclass = experimenter_stats_reply.subtypes.get(subtype)
2465 if subclass:
2466 return subclass.unpack(reader)
2467
2468 obj = experimenter_stats_reply()
2469 _version = reader.read("!B")[0]
2470 assert(_version == 4)
2471 _type = reader.read("!B")[0]
2472 assert(_type == 19)
2473 _length = reader.read("!H")[0]
2474 orig_reader = reader
2475 reader = orig_reader.slice(_length - (2 + 2))
2476 obj.xid = reader.read("!L")[0]
2477 _stats_type = reader.read("!H")[0]
2478 assert(_stats_type == 65535)
2479 obj.flags = reader.read("!H")[0]
2480 reader.skip(4)
2481 obj.experimenter = reader.read("!L")[0]
2482 obj.subtype = reader.read("!L")[0]
2483 return obj
2484
2485 def __eq__(self, other):
2486 if type(self) != type(other): return False
2487 if self.xid != other.xid: return False
2488 if self.flags != other.flags: return False
2489 if self.experimenter != other.experimenter: return False
2490 if self.subtype != other.subtype: return False
2491 return True
2492
2493 def pretty_print(self, q):
2494 q.text("experimenter_stats_reply {")
2495 with q.group():
2496 with q.indent(2):
2497 q.breakable()
2498 q.text("xid = ");
2499 if self.xid != None:
2500 q.text("%#x" % self.xid)
2501 else:
2502 q.text('None')
2503 q.text(","); q.breakable()
2504 q.text("flags = ");
2505 q.text("%#x" % self.flags)
2506 q.text(","); q.breakable()
2507 q.text("subtype = ");
2508 q.text("%#x" % self.subtype)
2509 q.breakable()
2510 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002511
2512stats_reply.subtypes[65535] = experimenter_stats_reply
2513
2514class bsn_stats_reply(experimenter_stats_reply):
2515 subtypes = {}
2516
Rich Lane95f7fc92014-01-27 17:08:16 -08002517 version = 4
2518 type = 19
2519 stats_type = 65535
2520 experimenter = 6035143
2521
2522 def __init__(self, xid=None, flags=None, subtype=None):
2523 if xid != None:
2524 self.xid = xid
2525 else:
2526 self.xid = None
2527 if flags != None:
2528 self.flags = flags
2529 else:
2530 self.flags = 0
2531 if subtype != None:
2532 self.subtype = subtype
2533 else:
2534 self.subtype = 0
2535 return
2536
2537 def pack(self):
2538 packed = []
2539 packed.append(struct.pack("!B", self.version))
2540 packed.append(struct.pack("!B", self.type))
2541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2542 packed.append(struct.pack("!L", self.xid))
2543 packed.append(struct.pack("!H", self.stats_type))
2544 packed.append(struct.pack("!H", self.flags))
2545 packed.append('\x00' * 4)
2546 packed.append(struct.pack("!L", self.experimenter))
2547 packed.append(struct.pack("!L", self.subtype))
2548 length = sum([len(x) for x in packed])
2549 packed[2] = struct.pack("!H", length)
2550 return ''.join(packed)
2551
Rich Lane5454b682014-01-14 17:07:36 -08002552 @staticmethod
2553 def unpack(reader):
2554 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002555 subclass = bsn_stats_reply.subtypes.get(subtype)
2556 if subclass:
2557 return subclass.unpack(reader)
2558
2559 obj = bsn_stats_reply()
2560 _version = reader.read("!B")[0]
2561 assert(_version == 4)
2562 _type = reader.read("!B")[0]
2563 assert(_type == 19)
2564 _length = reader.read("!H")[0]
2565 orig_reader = reader
2566 reader = orig_reader.slice(_length - (2 + 2))
2567 obj.xid = reader.read("!L")[0]
2568 _stats_type = reader.read("!H")[0]
2569 assert(_stats_type == 65535)
2570 obj.flags = reader.read("!H")[0]
2571 reader.skip(4)
2572 _experimenter = reader.read("!L")[0]
2573 assert(_experimenter == 6035143)
2574 obj.subtype = reader.read("!L")[0]
2575 return obj
2576
2577 def __eq__(self, other):
2578 if type(self) != type(other): return False
2579 if self.xid != other.xid: return False
2580 if self.flags != other.flags: return False
2581 if self.subtype != other.subtype: return False
2582 return True
2583
2584 def pretty_print(self, q):
2585 q.text("bsn_stats_reply {")
2586 with q.group():
2587 with q.indent(2):
2588 q.breakable()
2589 q.text("xid = ");
2590 if self.xid != None:
2591 q.text("%#x" % self.xid)
2592 else:
2593 q.text('None')
2594 q.text(","); q.breakable()
2595 q.text("flags = ");
2596 q.text("%#x" % self.flags)
2597 q.breakable()
2598 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002599
2600experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2601
2602class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
2603 version = 4
2604 type = 19
2605 stats_type = 65535
2606 experimenter = 6035143
2607 subtype = 5
2608
2609 def __init__(self, xid=None, flags=None, entries=None):
2610 if xid != None:
2611 self.xid = xid
2612 else:
2613 self.xid = None
2614 if flags != None:
2615 self.flags = flags
2616 else:
2617 self.flags = 0
2618 if entries != None:
2619 self.entries = entries
2620 else:
2621 self.entries = []
2622 return
2623
2624 def pack(self):
2625 packed = []
2626 packed.append(struct.pack("!B", self.version))
2627 packed.append(struct.pack("!B", self.type))
2628 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2629 packed.append(struct.pack("!L", self.xid))
2630 packed.append(struct.pack("!H", self.stats_type))
2631 packed.append(struct.pack("!H", self.flags))
2632 packed.append('\x00' * 4)
2633 packed.append(struct.pack("!L", self.experimenter))
2634 packed.append(struct.pack("!L", self.subtype))
2635 packed.append(loxi.generic_util.pack_list(self.entries))
2636 length = sum([len(x) for x in packed])
2637 packed[2] = struct.pack("!H", length)
2638 return ''.join(packed)
2639
2640 @staticmethod
2641 def unpack(reader):
2642 obj = bsn_gentable_bucket_stats_reply()
2643 _version = reader.read("!B")[0]
2644 assert(_version == 4)
2645 _type = reader.read("!B")[0]
2646 assert(_type == 19)
2647 _length = reader.read("!H")[0]
2648 orig_reader = reader
2649 reader = orig_reader.slice(_length - (2 + 2))
2650 obj.xid = reader.read("!L")[0]
2651 _stats_type = reader.read("!H")[0]
2652 assert(_stats_type == 65535)
2653 obj.flags = reader.read("!H")[0]
2654 reader.skip(4)
2655 _experimenter = reader.read("!L")[0]
2656 assert(_experimenter == 6035143)
2657 _subtype = reader.read("!L")[0]
2658 assert(_subtype == 5)
2659 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
2660 return obj
2661
2662 def __eq__(self, other):
2663 if type(self) != type(other): return False
2664 if self.xid != other.xid: return False
2665 if self.flags != other.flags: return False
2666 if self.entries != other.entries: return False
2667 return True
2668
2669 def pretty_print(self, q):
2670 q.text("bsn_gentable_bucket_stats_reply {")
2671 with q.group():
2672 with q.indent(2):
2673 q.breakable()
2674 q.text("xid = ");
2675 if self.xid != None:
2676 q.text("%#x" % self.xid)
2677 else:
2678 q.text('None')
2679 q.text(","); q.breakable()
2680 q.text("flags = ");
2681 q.text("%#x" % self.flags)
2682 q.text(","); q.breakable()
2683 q.text("entries = ");
2684 q.pp(self.entries)
2685 q.breakable()
2686 q.text('}')
2687
2688bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
2689
2690class experimenter_stats_request(stats_request):
2691 subtypes = {}
2692
Rich Lane95f7fc92014-01-27 17:08:16 -08002693 version = 4
2694 type = 18
2695 stats_type = 65535
2696
2697 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2698 if xid != None:
2699 self.xid = xid
2700 else:
2701 self.xid = None
2702 if flags != None:
2703 self.flags = flags
2704 else:
2705 self.flags = 0
2706 if experimenter != None:
2707 self.experimenter = experimenter
2708 else:
2709 self.experimenter = 0
2710 if subtype != None:
2711 self.subtype = subtype
2712 else:
2713 self.subtype = 0
2714 return
2715
2716 def pack(self):
2717 packed = []
2718 packed.append(struct.pack("!B", self.version))
2719 packed.append(struct.pack("!B", self.type))
2720 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2721 packed.append(struct.pack("!L", self.xid))
2722 packed.append(struct.pack("!H", self.stats_type))
2723 packed.append(struct.pack("!H", self.flags))
2724 packed.append('\x00' * 4)
2725 packed.append(struct.pack("!L", self.experimenter))
2726 packed.append(struct.pack("!L", self.subtype))
2727 length = sum([len(x) for x in packed])
2728 packed[2] = struct.pack("!H", length)
2729 return ''.join(packed)
2730
Rich Lane5454b682014-01-14 17:07:36 -08002731 @staticmethod
2732 def unpack(reader):
2733 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002734 subclass = experimenter_stats_request.subtypes.get(subtype)
2735 if subclass:
2736 return subclass.unpack(reader)
2737
2738 obj = experimenter_stats_request()
2739 _version = reader.read("!B")[0]
2740 assert(_version == 4)
2741 _type = reader.read("!B")[0]
2742 assert(_type == 18)
2743 _length = reader.read("!H")[0]
2744 orig_reader = reader
2745 reader = orig_reader.slice(_length - (2 + 2))
2746 obj.xid = reader.read("!L")[0]
2747 _stats_type = reader.read("!H")[0]
2748 assert(_stats_type == 65535)
2749 obj.flags = reader.read("!H")[0]
2750 reader.skip(4)
2751 obj.experimenter = reader.read("!L")[0]
2752 obj.subtype = reader.read("!L")[0]
2753 return obj
2754
2755 def __eq__(self, other):
2756 if type(self) != type(other): return False
2757 if self.xid != other.xid: return False
2758 if self.flags != other.flags: return False
2759 if self.experimenter != other.experimenter: return False
2760 if self.subtype != other.subtype: return False
2761 return True
2762
2763 def pretty_print(self, q):
2764 q.text("experimenter_stats_request {")
2765 with q.group():
2766 with q.indent(2):
2767 q.breakable()
2768 q.text("xid = ");
2769 if self.xid != None:
2770 q.text("%#x" % self.xid)
2771 else:
2772 q.text('None')
2773 q.text(","); q.breakable()
2774 q.text("flags = ");
2775 q.text("%#x" % self.flags)
2776 q.text(","); q.breakable()
2777 q.text("subtype = ");
2778 q.text("%#x" % self.subtype)
2779 q.breakable()
2780 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002781
2782stats_request.subtypes[65535] = experimenter_stats_request
2783
2784class bsn_stats_request(experimenter_stats_request):
2785 subtypes = {}
2786
Rich Lane95f7fc92014-01-27 17:08:16 -08002787 version = 4
2788 type = 18
2789 stats_type = 65535
2790 experimenter = 6035143
2791
2792 def __init__(self, xid=None, flags=None, subtype=None):
2793 if xid != None:
2794 self.xid = xid
2795 else:
2796 self.xid = None
2797 if flags != None:
2798 self.flags = flags
2799 else:
2800 self.flags = 0
2801 if subtype != None:
2802 self.subtype = subtype
2803 else:
2804 self.subtype = 0
2805 return
2806
2807 def pack(self):
2808 packed = []
2809 packed.append(struct.pack("!B", self.version))
2810 packed.append(struct.pack("!B", self.type))
2811 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2812 packed.append(struct.pack("!L", self.xid))
2813 packed.append(struct.pack("!H", self.stats_type))
2814 packed.append(struct.pack("!H", self.flags))
2815 packed.append('\x00' * 4)
2816 packed.append(struct.pack("!L", self.experimenter))
2817 packed.append(struct.pack("!L", self.subtype))
2818 length = sum([len(x) for x in packed])
2819 packed[2] = struct.pack("!H", length)
2820 return ''.join(packed)
2821
Rich Lane5454b682014-01-14 17:07:36 -08002822 @staticmethod
2823 def unpack(reader):
2824 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002825 subclass = bsn_stats_request.subtypes.get(subtype)
2826 if subclass:
2827 return subclass.unpack(reader)
2828
2829 obj = bsn_stats_request()
2830 _version = reader.read("!B")[0]
2831 assert(_version == 4)
2832 _type = reader.read("!B")[0]
2833 assert(_type == 18)
2834 _length = reader.read("!H")[0]
2835 orig_reader = reader
2836 reader = orig_reader.slice(_length - (2 + 2))
2837 obj.xid = reader.read("!L")[0]
2838 _stats_type = reader.read("!H")[0]
2839 assert(_stats_type == 65535)
2840 obj.flags = reader.read("!H")[0]
2841 reader.skip(4)
2842 _experimenter = reader.read("!L")[0]
2843 assert(_experimenter == 6035143)
2844 obj.subtype = reader.read("!L")[0]
2845 return obj
2846
2847 def __eq__(self, other):
2848 if type(self) != type(other): return False
2849 if self.xid != other.xid: return False
2850 if self.flags != other.flags: return False
2851 if self.subtype != other.subtype: return False
2852 return True
2853
2854 def pretty_print(self, q):
2855 q.text("bsn_stats_request {")
2856 with q.group():
2857 with q.indent(2):
2858 q.breakable()
2859 q.text("xid = ");
2860 if self.xid != None:
2861 q.text("%#x" % self.xid)
2862 else:
2863 q.text('None')
2864 q.text(","); q.breakable()
2865 q.text("flags = ");
2866 q.text("%#x" % self.flags)
2867 q.breakable()
2868 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002869
2870experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2871
2872class bsn_gentable_bucket_stats_request(bsn_stats_request):
2873 version = 4
2874 type = 18
2875 stats_type = 65535
2876 experimenter = 6035143
2877 subtype = 5
2878
2879 def __init__(self, xid=None, flags=None, table_id=None):
2880 if xid != None:
2881 self.xid = xid
2882 else:
2883 self.xid = None
2884 if flags != None:
2885 self.flags = flags
2886 else:
2887 self.flags = 0
2888 if table_id != None:
2889 self.table_id = table_id
2890 else:
2891 self.table_id = 0
2892 return
2893
2894 def pack(self):
2895 packed = []
2896 packed.append(struct.pack("!B", self.version))
2897 packed.append(struct.pack("!B", self.type))
2898 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2899 packed.append(struct.pack("!L", self.xid))
2900 packed.append(struct.pack("!H", self.stats_type))
2901 packed.append(struct.pack("!H", self.flags))
2902 packed.append('\x00' * 4)
2903 packed.append(struct.pack("!L", self.experimenter))
2904 packed.append(struct.pack("!L", self.subtype))
2905 packed.append(struct.pack("!H", self.table_id))
2906 length = sum([len(x) for x in packed])
2907 packed[2] = struct.pack("!H", length)
2908 return ''.join(packed)
2909
2910 @staticmethod
2911 def unpack(reader):
2912 obj = bsn_gentable_bucket_stats_request()
2913 _version = reader.read("!B")[0]
2914 assert(_version == 4)
2915 _type = reader.read("!B")[0]
2916 assert(_type == 18)
2917 _length = reader.read("!H")[0]
2918 orig_reader = reader
2919 reader = orig_reader.slice(_length - (2 + 2))
2920 obj.xid = reader.read("!L")[0]
2921 _stats_type = reader.read("!H")[0]
2922 assert(_stats_type == 65535)
2923 obj.flags = reader.read("!H")[0]
2924 reader.skip(4)
2925 _experimenter = reader.read("!L")[0]
2926 assert(_experimenter == 6035143)
2927 _subtype = reader.read("!L")[0]
2928 assert(_subtype == 5)
2929 obj.table_id = reader.read("!H")[0]
2930 return obj
2931
2932 def __eq__(self, other):
2933 if type(self) != type(other): return False
2934 if self.xid != other.xid: return False
2935 if self.flags != other.flags: return False
2936 if self.table_id != other.table_id: return False
2937 return True
2938
2939 def pretty_print(self, q):
2940 q.text("bsn_gentable_bucket_stats_request {")
2941 with q.group():
2942 with q.indent(2):
2943 q.breakable()
2944 q.text("xid = ");
2945 if self.xid != None:
2946 q.text("%#x" % self.xid)
2947 else:
2948 q.text('None')
2949 q.text(","); q.breakable()
2950 q.text("flags = ");
2951 q.text("%#x" % self.flags)
2952 q.text(","); q.breakable()
2953 q.text("table_id = ");
2954 q.text("%#x" % self.table_id)
2955 q.breakable()
2956 q.text('}')
2957
2958bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
2959
2960class bsn_gentable_clear_reply(bsn_header):
2961 version = 4
2962 type = 4
2963 experimenter = 6035143
2964 subtype = 49
2965
2966 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
2967 if xid != None:
2968 self.xid = xid
2969 else:
2970 self.xid = None
2971 if table_id != None:
2972 self.table_id = table_id
2973 else:
2974 self.table_id = 0
2975 if deleted_count != None:
2976 self.deleted_count = deleted_count
2977 else:
2978 self.deleted_count = 0
2979 if error_count != None:
2980 self.error_count = error_count
2981 else:
2982 self.error_count = 0
2983 return
2984
2985 def pack(self):
2986 packed = []
2987 packed.append(struct.pack("!B", self.version))
2988 packed.append(struct.pack("!B", self.type))
2989 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2990 packed.append(struct.pack("!L", self.xid))
2991 packed.append(struct.pack("!L", self.experimenter))
2992 packed.append(struct.pack("!L", self.subtype))
2993 packed.append(struct.pack("!H", self.table_id))
2994 packed.append('\x00' * 2)
2995 packed.append(struct.pack("!L", self.deleted_count))
2996 packed.append(struct.pack("!L", self.error_count))
2997 length = sum([len(x) for x in packed])
2998 packed[2] = struct.pack("!H", length)
2999 return ''.join(packed)
3000
3001 @staticmethod
3002 def unpack(reader):
3003 obj = bsn_gentable_clear_reply()
3004 _version = reader.read("!B")[0]
3005 assert(_version == 4)
3006 _type = reader.read("!B")[0]
3007 assert(_type == 4)
3008 _length = reader.read("!H")[0]
3009 orig_reader = reader
3010 reader = orig_reader.slice(_length - (2 + 2))
3011 obj.xid = reader.read("!L")[0]
3012 _experimenter = reader.read("!L")[0]
3013 assert(_experimenter == 6035143)
3014 _subtype = reader.read("!L")[0]
3015 assert(_subtype == 49)
3016 obj.table_id = reader.read("!H")[0]
3017 reader.skip(2)
3018 obj.deleted_count = reader.read("!L")[0]
3019 obj.error_count = reader.read("!L")[0]
3020 return obj
3021
3022 def __eq__(self, other):
3023 if type(self) != type(other): return False
3024 if self.xid != other.xid: return False
3025 if self.table_id != other.table_id: return False
3026 if self.deleted_count != other.deleted_count: return False
3027 if self.error_count != other.error_count: return False
3028 return True
3029
3030 def pretty_print(self, q):
3031 q.text("bsn_gentable_clear_reply {")
3032 with q.group():
3033 with q.indent(2):
3034 q.breakable()
3035 q.text("xid = ");
3036 if self.xid != None:
3037 q.text("%#x" % self.xid)
3038 else:
3039 q.text('None')
3040 q.text(","); q.breakable()
3041 q.text("table_id = ");
3042 q.text("%#x" % self.table_id)
3043 q.text(","); q.breakable()
3044 q.text("deleted_count = ");
3045 q.text("%#x" % self.deleted_count)
3046 q.text(","); q.breakable()
3047 q.text("error_count = ");
3048 q.text("%#x" % self.error_count)
3049 q.breakable()
3050 q.text('}')
3051
3052bsn_header.subtypes[49] = bsn_gentable_clear_reply
3053
3054class bsn_gentable_clear_request(bsn_header):
3055 version = 4
3056 type = 4
3057 experimenter = 6035143
3058 subtype = 48
3059
3060 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3061 if xid != None:
3062 self.xid = xid
3063 else:
3064 self.xid = None
3065 if table_id != None:
3066 self.table_id = table_id
3067 else:
3068 self.table_id = 0
3069 if checksum != None:
3070 self.checksum = checksum
3071 else:
3072 self.checksum = 0
3073 if checksum_mask != None:
3074 self.checksum_mask = checksum_mask
3075 else:
3076 self.checksum_mask = 0
3077 return
3078
3079 def pack(self):
3080 packed = []
3081 packed.append(struct.pack("!B", self.version))
3082 packed.append(struct.pack("!B", self.type))
3083 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3084 packed.append(struct.pack("!L", self.xid))
3085 packed.append(struct.pack("!L", self.experimenter))
3086 packed.append(struct.pack("!L", self.subtype))
3087 packed.append(struct.pack("!H", self.table_id))
3088 packed.append('\x00' * 2)
3089 packed.append(util.pack_checksum_128(self.checksum))
3090 packed.append(util.pack_checksum_128(self.checksum_mask))
3091 length = sum([len(x) for x in packed])
3092 packed[2] = struct.pack("!H", length)
3093 return ''.join(packed)
3094
3095 @staticmethod
3096 def unpack(reader):
3097 obj = bsn_gentable_clear_request()
3098 _version = reader.read("!B")[0]
3099 assert(_version == 4)
3100 _type = reader.read("!B")[0]
3101 assert(_type == 4)
3102 _length = reader.read("!H")[0]
3103 orig_reader = reader
3104 reader = orig_reader.slice(_length - (2 + 2))
3105 obj.xid = reader.read("!L")[0]
3106 _experimenter = reader.read("!L")[0]
3107 assert(_experimenter == 6035143)
3108 _subtype = reader.read("!L")[0]
3109 assert(_subtype == 48)
3110 obj.table_id = reader.read("!H")[0]
3111 reader.skip(2)
3112 obj.checksum = util.unpack_checksum_128(reader)
3113 obj.checksum_mask = util.unpack_checksum_128(reader)
3114 return obj
3115
3116 def __eq__(self, other):
3117 if type(self) != type(other): return False
3118 if self.xid != other.xid: return False
3119 if self.table_id != other.table_id: return False
3120 if self.checksum != other.checksum: return False
3121 if self.checksum_mask != other.checksum_mask: return False
3122 return True
3123
3124 def pretty_print(self, q):
3125 q.text("bsn_gentable_clear_request {")
3126 with q.group():
3127 with q.indent(2):
3128 q.breakable()
3129 q.text("xid = ");
3130 if self.xid != None:
3131 q.text("%#x" % self.xid)
3132 else:
3133 q.text('None')
3134 q.text(","); q.breakable()
3135 q.text("table_id = ");
3136 q.text("%#x" % self.table_id)
3137 q.text(","); q.breakable()
3138 q.text("checksum = ");
3139 q.pp(self.checksum)
3140 q.text(","); q.breakable()
3141 q.text("checksum_mask = ");
3142 q.pp(self.checksum_mask)
3143 q.breakable()
3144 q.text('}')
3145
3146bsn_header.subtypes[48] = bsn_gentable_clear_request
3147
3148class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3149 version = 4
3150 type = 19
3151 stats_type = 65535
3152 experimenter = 6035143
3153 subtype = 4
3154
3155 def __init__(self, xid=None, flags=None, entries=None):
3156 if xid != None:
3157 self.xid = xid
3158 else:
3159 self.xid = None
3160 if flags != None:
3161 self.flags = flags
3162 else:
3163 self.flags = 0
3164 if entries != None:
3165 self.entries = entries
3166 else:
3167 self.entries = []
3168 return
3169
3170 def pack(self):
3171 packed = []
3172 packed.append(struct.pack("!B", self.version))
3173 packed.append(struct.pack("!B", self.type))
3174 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3175 packed.append(struct.pack("!L", self.xid))
3176 packed.append(struct.pack("!H", self.stats_type))
3177 packed.append(struct.pack("!H", self.flags))
3178 packed.append('\x00' * 4)
3179 packed.append(struct.pack("!L", self.experimenter))
3180 packed.append(struct.pack("!L", self.subtype))
3181 packed.append(loxi.generic_util.pack_list(self.entries))
3182 length = sum([len(x) for x in packed])
3183 packed[2] = struct.pack("!H", length)
3184 return ''.join(packed)
3185
3186 @staticmethod
3187 def unpack(reader):
3188 obj = bsn_gentable_desc_stats_reply()
3189 _version = reader.read("!B")[0]
3190 assert(_version == 4)
3191 _type = reader.read("!B")[0]
3192 assert(_type == 19)
3193 _length = reader.read("!H")[0]
3194 orig_reader = reader
3195 reader = orig_reader.slice(_length - (2 + 2))
3196 obj.xid = reader.read("!L")[0]
3197 _stats_type = reader.read("!H")[0]
3198 assert(_stats_type == 65535)
3199 obj.flags = reader.read("!H")[0]
3200 reader.skip(4)
3201 _experimenter = reader.read("!L")[0]
3202 assert(_experimenter == 6035143)
3203 _subtype = reader.read("!L")[0]
3204 assert(_subtype == 4)
3205 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3206 return obj
3207
3208 def __eq__(self, other):
3209 if type(self) != type(other): return False
3210 if self.xid != other.xid: return False
3211 if self.flags != other.flags: return False
3212 if self.entries != other.entries: return False
3213 return True
3214
3215 def pretty_print(self, q):
3216 q.text("bsn_gentable_desc_stats_reply {")
3217 with q.group():
3218 with q.indent(2):
3219 q.breakable()
3220 q.text("xid = ");
3221 if self.xid != None:
3222 q.text("%#x" % self.xid)
3223 else:
3224 q.text('None')
3225 q.text(","); q.breakable()
3226 q.text("flags = ");
3227 q.text("%#x" % self.flags)
3228 q.text(","); q.breakable()
3229 q.text("entries = ");
3230 q.pp(self.entries)
3231 q.breakable()
3232 q.text('}')
3233
3234bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
3235
3236class bsn_gentable_desc_stats_request(bsn_stats_request):
3237 version = 4
3238 type = 18
3239 stats_type = 65535
3240 experimenter = 6035143
3241 subtype = 4
3242
3243 def __init__(self, xid=None, flags=None):
3244 if xid != None:
3245 self.xid = xid
3246 else:
3247 self.xid = None
3248 if flags != None:
3249 self.flags = flags
3250 else:
3251 self.flags = 0
3252 return
3253
3254 def pack(self):
3255 packed = []
3256 packed.append(struct.pack("!B", self.version))
3257 packed.append(struct.pack("!B", self.type))
3258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3259 packed.append(struct.pack("!L", self.xid))
3260 packed.append(struct.pack("!H", self.stats_type))
3261 packed.append(struct.pack("!H", self.flags))
3262 packed.append('\x00' * 4)
3263 packed.append(struct.pack("!L", self.experimenter))
3264 packed.append(struct.pack("!L", self.subtype))
3265 length = sum([len(x) for x in packed])
3266 packed[2] = struct.pack("!H", length)
3267 return ''.join(packed)
3268
3269 @staticmethod
3270 def unpack(reader):
3271 obj = bsn_gentable_desc_stats_request()
3272 _version = reader.read("!B")[0]
3273 assert(_version == 4)
3274 _type = reader.read("!B")[0]
3275 assert(_type == 18)
3276 _length = reader.read("!H")[0]
3277 orig_reader = reader
3278 reader = orig_reader.slice(_length - (2 + 2))
3279 obj.xid = reader.read("!L")[0]
3280 _stats_type = reader.read("!H")[0]
3281 assert(_stats_type == 65535)
3282 obj.flags = reader.read("!H")[0]
3283 reader.skip(4)
3284 _experimenter = reader.read("!L")[0]
3285 assert(_experimenter == 6035143)
3286 _subtype = reader.read("!L")[0]
3287 assert(_subtype == 4)
3288 return obj
3289
3290 def __eq__(self, other):
3291 if type(self) != type(other): return False
3292 if self.xid != other.xid: return False
3293 if self.flags != other.flags: return False
3294 return True
3295
3296 def pretty_print(self, q):
3297 q.text("bsn_gentable_desc_stats_request {")
3298 with q.group():
3299 with q.indent(2):
3300 q.breakable()
3301 q.text("xid = ");
3302 if self.xid != None:
3303 q.text("%#x" % self.xid)
3304 else:
3305 q.text('None')
3306 q.text(","); q.breakable()
3307 q.text("flags = ");
3308 q.text("%#x" % self.flags)
3309 q.breakable()
3310 q.text('}')
3311
3312bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
3313
3314class bsn_gentable_entry_add(bsn_header):
3315 version = 4
3316 type = 4
3317 experimenter = 6035143
3318 subtype = 46
3319
3320 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
3321 if xid != None:
3322 self.xid = xid
3323 else:
3324 self.xid = None
3325 if table_id != None:
3326 self.table_id = table_id
3327 else:
3328 self.table_id = 0
3329 if checksum != None:
3330 self.checksum = checksum
3331 else:
3332 self.checksum = 0
3333 if key != None:
3334 self.key = key
3335 else:
3336 self.key = []
3337 if value != None:
3338 self.value = value
3339 else:
3340 self.value = []
3341 return
3342
3343 def pack(self):
3344 packed = []
3345 packed.append(struct.pack("!B", self.version))
3346 packed.append(struct.pack("!B", self.type))
3347 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3348 packed.append(struct.pack("!L", self.xid))
3349 packed.append(struct.pack("!L", self.experimenter))
3350 packed.append(struct.pack("!L", self.subtype))
3351 packed.append(struct.pack("!H", self.table_id))
3352 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
3353 packed.append(util.pack_checksum_128(self.checksum))
3354 packed.append(loxi.generic_util.pack_list(self.key))
3355 packed[7] = struct.pack("!H", len(packed[-1]))
3356 packed.append(loxi.generic_util.pack_list(self.value))
3357 length = sum([len(x) for x in packed])
3358 packed[2] = struct.pack("!H", length)
3359 return ''.join(packed)
3360
3361 @staticmethod
3362 def unpack(reader):
3363 obj = bsn_gentable_entry_add()
3364 _version = reader.read("!B")[0]
3365 assert(_version == 4)
3366 _type = reader.read("!B")[0]
3367 assert(_type == 4)
3368 _length = reader.read("!H")[0]
3369 orig_reader = reader
3370 reader = orig_reader.slice(_length - (2 + 2))
3371 obj.xid = reader.read("!L")[0]
3372 _experimenter = reader.read("!L")[0]
3373 assert(_experimenter == 6035143)
3374 _subtype = reader.read("!L")[0]
3375 assert(_subtype == 46)
3376 obj.table_id = reader.read("!H")[0]
3377 _key_length = reader.read("!H")[0]
3378 obj.checksum = util.unpack_checksum_128(reader)
3379 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
3380 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3381 return obj
3382
3383 def __eq__(self, other):
3384 if type(self) != type(other): return False
3385 if self.xid != other.xid: return False
3386 if self.table_id != other.table_id: return False
3387 if self.checksum != other.checksum: return False
3388 if self.key != other.key: return False
3389 if self.value != other.value: return False
3390 return True
3391
3392 def pretty_print(self, q):
3393 q.text("bsn_gentable_entry_add {")
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("table_id = ");
3404 q.text("%#x" % self.table_id)
3405 q.text(","); q.breakable()
3406 q.text("checksum = ");
3407 q.pp(self.checksum)
3408 q.text(","); q.breakable()
3409 q.text("key = ");
3410 q.pp(self.key)
3411 q.text(","); q.breakable()
3412 q.text("value = ");
3413 q.pp(self.value)
3414 q.breakable()
3415 q.text('}')
3416
3417bsn_header.subtypes[46] = bsn_gentable_entry_add
3418
3419class bsn_gentable_entry_delete(bsn_header):
3420 version = 4
3421 type = 4
3422 experimenter = 6035143
3423 subtype = 47
3424
3425 def __init__(self, xid=None, table_id=None, key=None):
3426 if xid != None:
3427 self.xid = xid
3428 else:
3429 self.xid = None
3430 if table_id != None:
3431 self.table_id = table_id
3432 else:
3433 self.table_id = 0
3434 if key != None:
3435 self.key = key
3436 else:
3437 self.key = []
3438 return
3439
3440 def pack(self):
3441 packed = []
3442 packed.append(struct.pack("!B", self.version))
3443 packed.append(struct.pack("!B", self.type))
3444 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3445 packed.append(struct.pack("!L", self.xid))
3446 packed.append(struct.pack("!L", self.experimenter))
3447 packed.append(struct.pack("!L", self.subtype))
3448 packed.append(struct.pack("!H", self.table_id))
3449 packed.append(loxi.generic_util.pack_list(self.key))
3450 length = sum([len(x) for x in packed])
3451 packed[2] = struct.pack("!H", length)
3452 return ''.join(packed)
3453
3454 @staticmethod
3455 def unpack(reader):
3456 obj = bsn_gentable_entry_delete()
3457 _version = reader.read("!B")[0]
3458 assert(_version == 4)
3459 _type = reader.read("!B")[0]
3460 assert(_type == 4)
3461 _length = reader.read("!H")[0]
3462 orig_reader = reader
3463 reader = orig_reader.slice(_length - (2 + 2))
3464 obj.xid = reader.read("!L")[0]
3465 _experimenter = reader.read("!L")[0]
3466 assert(_experimenter == 6035143)
3467 _subtype = reader.read("!L")[0]
3468 assert(_subtype == 47)
3469 obj.table_id = reader.read("!H")[0]
3470 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3471 return obj
3472
3473 def __eq__(self, other):
3474 if type(self) != type(other): return False
3475 if self.xid != other.xid: return False
3476 if self.table_id != other.table_id: return False
3477 if self.key != other.key: return False
3478 return True
3479
3480 def pretty_print(self, q):
3481 q.text("bsn_gentable_entry_delete {")
3482 with q.group():
3483 with q.indent(2):
3484 q.breakable()
3485 q.text("xid = ");
3486 if self.xid != None:
3487 q.text("%#x" % self.xid)
3488 else:
3489 q.text('None')
3490 q.text(","); q.breakable()
3491 q.text("table_id = ");
3492 q.text("%#x" % self.table_id)
3493 q.text(","); q.breakable()
3494 q.text("key = ");
3495 q.pp(self.key)
3496 q.breakable()
3497 q.text('}')
3498
3499bsn_header.subtypes[47] = bsn_gentable_entry_delete
3500
3501class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
3502 version = 4
3503 type = 19
3504 stats_type = 65535
3505 experimenter = 6035143
3506 subtype = 2
3507
3508 def __init__(self, xid=None, flags=None, entries=None):
3509 if xid != None:
3510 self.xid = xid
3511 else:
3512 self.xid = None
3513 if flags != None:
3514 self.flags = flags
3515 else:
3516 self.flags = 0
3517 if entries != None:
3518 self.entries = entries
3519 else:
3520 self.entries = []
3521 return
3522
3523 def pack(self):
3524 packed = []
3525 packed.append(struct.pack("!B", self.version))
3526 packed.append(struct.pack("!B", self.type))
3527 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3528 packed.append(struct.pack("!L", self.xid))
3529 packed.append(struct.pack("!H", self.stats_type))
3530 packed.append(struct.pack("!H", self.flags))
3531 packed.append('\x00' * 4)
3532 packed.append(struct.pack("!L", self.experimenter))
3533 packed.append(struct.pack("!L", self.subtype))
3534 packed.append(loxi.generic_util.pack_list(self.entries))
3535 length = sum([len(x) for x in packed])
3536 packed[2] = struct.pack("!H", length)
3537 return ''.join(packed)
3538
3539 @staticmethod
3540 def unpack(reader):
3541 obj = bsn_gentable_entry_desc_stats_reply()
3542 _version = reader.read("!B")[0]
3543 assert(_version == 4)
3544 _type = reader.read("!B")[0]
3545 assert(_type == 19)
3546 _length = reader.read("!H")[0]
3547 orig_reader = reader
3548 reader = orig_reader.slice(_length - (2 + 2))
3549 obj.xid = reader.read("!L")[0]
3550 _stats_type = reader.read("!H")[0]
3551 assert(_stats_type == 65535)
3552 obj.flags = reader.read("!H")[0]
3553 reader.skip(4)
3554 _experimenter = reader.read("!L")[0]
3555 assert(_experimenter == 6035143)
3556 _subtype = reader.read("!L")[0]
3557 assert(_subtype == 2)
3558 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
3559 return obj
3560
3561 def __eq__(self, other):
3562 if type(self) != type(other): return False
3563 if self.xid != other.xid: return False
3564 if self.flags != other.flags: return False
3565 if self.entries != other.entries: return False
3566 return True
3567
3568 def pretty_print(self, q):
3569 q.text("bsn_gentable_entry_desc_stats_reply {")
3570 with q.group():
3571 with q.indent(2):
3572 q.breakable()
3573 q.text("xid = ");
3574 if self.xid != None:
3575 q.text("%#x" % self.xid)
3576 else:
3577 q.text('None')
3578 q.text(","); q.breakable()
3579 q.text("flags = ");
3580 q.text("%#x" % self.flags)
3581 q.text(","); q.breakable()
3582 q.text("entries = ");
3583 q.pp(self.entries)
3584 q.breakable()
3585 q.text('}')
3586
3587bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
3588
3589class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
3590 version = 4
3591 type = 18
3592 stats_type = 65535
3593 experimenter = 6035143
3594 subtype = 2
3595
3596 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
3597 if xid != None:
3598 self.xid = xid
3599 else:
3600 self.xid = None
3601 if flags != None:
3602 self.flags = flags
3603 else:
3604 self.flags = 0
3605 if table_id != None:
3606 self.table_id = table_id
3607 else:
3608 self.table_id = 0
3609 if checksum != None:
3610 self.checksum = checksum
3611 else:
3612 self.checksum = 0
3613 if checksum_mask != None:
3614 self.checksum_mask = checksum_mask
3615 else:
3616 self.checksum_mask = 0
3617 return
3618
3619 def pack(self):
3620 packed = []
3621 packed.append(struct.pack("!B", self.version))
3622 packed.append(struct.pack("!B", self.type))
3623 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3624 packed.append(struct.pack("!L", self.xid))
3625 packed.append(struct.pack("!H", self.stats_type))
3626 packed.append(struct.pack("!H", self.flags))
3627 packed.append('\x00' * 4)
3628 packed.append(struct.pack("!L", self.experimenter))
3629 packed.append(struct.pack("!L", self.subtype))
3630 packed.append(struct.pack("!H", self.table_id))
3631 packed.append('\x00' * 2)
3632 packed.append(util.pack_checksum_128(self.checksum))
3633 packed.append(util.pack_checksum_128(self.checksum_mask))
3634 length = sum([len(x) for x in packed])
3635 packed[2] = struct.pack("!H", length)
3636 return ''.join(packed)
3637
3638 @staticmethod
3639 def unpack(reader):
3640 obj = bsn_gentable_entry_desc_stats_request()
3641 _version = reader.read("!B")[0]
3642 assert(_version == 4)
3643 _type = reader.read("!B")[0]
3644 assert(_type == 18)
3645 _length = reader.read("!H")[0]
3646 orig_reader = reader
3647 reader = orig_reader.slice(_length - (2 + 2))
3648 obj.xid = reader.read("!L")[0]
3649 _stats_type = reader.read("!H")[0]
3650 assert(_stats_type == 65535)
3651 obj.flags = reader.read("!H")[0]
3652 reader.skip(4)
3653 _experimenter = reader.read("!L")[0]
3654 assert(_experimenter == 6035143)
3655 _subtype = reader.read("!L")[0]
3656 assert(_subtype == 2)
3657 obj.table_id = reader.read("!H")[0]
3658 reader.skip(2)
3659 obj.checksum = util.unpack_checksum_128(reader)
3660 obj.checksum_mask = util.unpack_checksum_128(reader)
3661 return obj
3662
3663 def __eq__(self, other):
3664 if type(self) != type(other): return False
3665 if self.xid != other.xid: return False
3666 if self.flags != other.flags: return False
3667 if self.table_id != other.table_id: return False
3668 if self.checksum != other.checksum: return False
3669 if self.checksum_mask != other.checksum_mask: return False
3670 return True
3671
3672 def pretty_print(self, q):
3673 q.text("bsn_gentable_entry_desc_stats_request {")
3674 with q.group():
3675 with q.indent(2):
3676 q.breakable()
3677 q.text("xid = ");
3678 if self.xid != None:
3679 q.text("%#x" % self.xid)
3680 else:
3681 q.text('None')
3682 q.text(","); q.breakable()
3683 q.text("flags = ");
3684 q.text("%#x" % self.flags)
3685 q.text(","); q.breakable()
3686 q.text("table_id = ");
3687 q.text("%#x" % self.table_id)
3688 q.text(","); q.breakable()
3689 q.text("checksum = ");
3690 q.pp(self.checksum)
3691 q.text(","); q.breakable()
3692 q.text("checksum_mask = ");
3693 q.pp(self.checksum_mask)
3694 q.breakable()
3695 q.text('}')
3696
3697bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
3698
3699class bsn_gentable_entry_stats_reply(bsn_stats_reply):
3700 version = 4
3701 type = 19
3702 stats_type = 65535
3703 experimenter = 6035143
3704 subtype = 3
3705
3706 def __init__(self, xid=None, flags=None, entries=None):
3707 if xid != None:
3708 self.xid = xid
3709 else:
3710 self.xid = None
3711 if flags != None:
3712 self.flags = flags
3713 else:
3714 self.flags = 0
3715 if entries != None:
3716 self.entries = entries
3717 else:
3718 self.entries = []
3719 return
3720
3721 def pack(self):
3722 packed = []
3723 packed.append(struct.pack("!B", self.version))
3724 packed.append(struct.pack("!B", self.type))
3725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3726 packed.append(struct.pack("!L", self.xid))
3727 packed.append(struct.pack("!H", self.stats_type))
3728 packed.append(struct.pack("!H", self.flags))
3729 packed.append('\x00' * 4)
3730 packed.append(struct.pack("!L", self.experimenter))
3731 packed.append(struct.pack("!L", self.subtype))
3732 packed.append(loxi.generic_util.pack_list(self.entries))
3733 length = sum([len(x) for x in packed])
3734 packed[2] = struct.pack("!H", length)
3735 return ''.join(packed)
3736
3737 @staticmethod
3738 def unpack(reader):
3739 obj = bsn_gentable_entry_stats_reply()
3740 _version = reader.read("!B")[0]
3741 assert(_version == 4)
3742 _type = reader.read("!B")[0]
3743 assert(_type == 19)
3744 _length = reader.read("!H")[0]
3745 orig_reader = reader
3746 reader = orig_reader.slice(_length - (2 + 2))
3747 obj.xid = reader.read("!L")[0]
3748 _stats_type = reader.read("!H")[0]
3749 assert(_stats_type == 65535)
3750 obj.flags = reader.read("!H")[0]
3751 reader.skip(4)
3752 _experimenter = reader.read("!L")[0]
3753 assert(_experimenter == 6035143)
3754 _subtype = reader.read("!L")[0]
3755 assert(_subtype == 3)
3756 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
3757 return obj
3758
3759 def __eq__(self, other):
3760 if type(self) != type(other): return False
3761 if self.xid != other.xid: return False
3762 if self.flags != other.flags: return False
3763 if self.entries != other.entries: return False
3764 return True
3765
3766 def pretty_print(self, q):
3767 q.text("bsn_gentable_entry_stats_reply {")
3768 with q.group():
3769 with q.indent(2):
3770 q.breakable()
3771 q.text("xid = ");
3772 if self.xid != None:
3773 q.text("%#x" % self.xid)
3774 else:
3775 q.text('None')
3776 q.text(","); q.breakable()
3777 q.text("flags = ");
3778 q.text("%#x" % self.flags)
3779 q.text(","); q.breakable()
3780 q.text("entries = ");
3781 q.pp(self.entries)
3782 q.breakable()
3783 q.text('}')
3784
3785bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
3786
3787class bsn_gentable_entry_stats_request(bsn_stats_request):
3788 version = 4
3789 type = 18
3790 stats_type = 65535
3791 experimenter = 6035143
3792 subtype = 3
3793
3794 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
3795 if xid != None:
3796 self.xid = xid
3797 else:
3798 self.xid = None
3799 if flags != None:
3800 self.flags = flags
3801 else:
3802 self.flags = 0
3803 if table_id != None:
3804 self.table_id = table_id
3805 else:
3806 self.table_id = 0
3807 if checksum != None:
3808 self.checksum = checksum
3809 else:
3810 self.checksum = 0
3811 if checksum_mask != None:
3812 self.checksum_mask = checksum_mask
3813 else:
3814 self.checksum_mask = 0
3815 return
3816
3817 def pack(self):
3818 packed = []
3819 packed.append(struct.pack("!B", self.version))
3820 packed.append(struct.pack("!B", self.type))
3821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3822 packed.append(struct.pack("!L", self.xid))
3823 packed.append(struct.pack("!H", self.stats_type))
3824 packed.append(struct.pack("!H", self.flags))
3825 packed.append('\x00' * 4)
3826 packed.append(struct.pack("!L", self.experimenter))
3827 packed.append(struct.pack("!L", self.subtype))
3828 packed.append(struct.pack("!H", self.table_id))
3829 packed.append('\x00' * 2)
3830 packed.append(util.pack_checksum_128(self.checksum))
3831 packed.append(util.pack_checksum_128(self.checksum_mask))
3832 length = sum([len(x) for x in packed])
3833 packed[2] = struct.pack("!H", length)
3834 return ''.join(packed)
3835
3836 @staticmethod
3837 def unpack(reader):
3838 obj = bsn_gentable_entry_stats_request()
3839 _version = reader.read("!B")[0]
3840 assert(_version == 4)
3841 _type = reader.read("!B")[0]
3842 assert(_type == 18)
3843 _length = reader.read("!H")[0]
3844 orig_reader = reader
3845 reader = orig_reader.slice(_length - (2 + 2))
3846 obj.xid = reader.read("!L")[0]
3847 _stats_type = reader.read("!H")[0]
3848 assert(_stats_type == 65535)
3849 obj.flags = reader.read("!H")[0]
3850 reader.skip(4)
3851 _experimenter = reader.read("!L")[0]
3852 assert(_experimenter == 6035143)
3853 _subtype = reader.read("!L")[0]
3854 assert(_subtype == 3)
3855 obj.table_id = reader.read("!H")[0]
3856 reader.skip(2)
3857 obj.checksum = util.unpack_checksum_128(reader)
3858 obj.checksum_mask = util.unpack_checksum_128(reader)
3859 return obj
3860
3861 def __eq__(self, other):
3862 if type(self) != type(other): return False
3863 if self.xid != other.xid: return False
3864 if self.flags != other.flags: return False
3865 if self.table_id != other.table_id: return False
3866 if self.checksum != other.checksum: return False
3867 if self.checksum_mask != other.checksum_mask: return False
3868 return True
3869
3870 def pretty_print(self, q):
3871 q.text("bsn_gentable_entry_stats_request {")
3872 with q.group():
3873 with q.indent(2):
3874 q.breakable()
3875 q.text("xid = ");
3876 if self.xid != None:
3877 q.text("%#x" % self.xid)
3878 else:
3879 q.text('None')
3880 q.text(","); q.breakable()
3881 q.text("flags = ");
3882 q.text("%#x" % self.flags)
3883 q.text(","); q.breakable()
3884 q.text("table_id = ");
3885 q.text("%#x" % self.table_id)
3886 q.text(","); q.breakable()
3887 q.text("checksum = ");
3888 q.pp(self.checksum)
3889 q.text(","); q.breakable()
3890 q.text("checksum_mask = ");
3891 q.pp(self.checksum_mask)
3892 q.breakable()
3893 q.text('}')
3894
3895bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
3896
3897class bsn_gentable_set_buckets_size(bsn_header):
3898 version = 4
3899 type = 4
3900 experimenter = 6035143
3901 subtype = 50
3902
3903 def __init__(self, xid=None, table_id=None, buckets_size=None):
3904 if xid != None:
3905 self.xid = xid
3906 else:
3907 self.xid = None
3908 if table_id != None:
3909 self.table_id = table_id
3910 else:
3911 self.table_id = 0
3912 if buckets_size != None:
3913 self.buckets_size = buckets_size
3914 else:
3915 self.buckets_size = 0
3916 return
3917
3918 def pack(self):
3919 packed = []
3920 packed.append(struct.pack("!B", self.version))
3921 packed.append(struct.pack("!B", self.type))
3922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3923 packed.append(struct.pack("!L", self.xid))
3924 packed.append(struct.pack("!L", self.experimenter))
3925 packed.append(struct.pack("!L", self.subtype))
3926 packed.append(struct.pack("!H", self.table_id))
3927 packed.append('\x00' * 2)
3928 packed.append(struct.pack("!L", self.buckets_size))
3929 length = sum([len(x) for x in packed])
3930 packed[2] = struct.pack("!H", length)
3931 return ''.join(packed)
3932
3933 @staticmethod
3934 def unpack(reader):
3935 obj = bsn_gentable_set_buckets_size()
3936 _version = reader.read("!B")[0]
3937 assert(_version == 4)
3938 _type = reader.read("!B")[0]
3939 assert(_type == 4)
3940 _length = reader.read("!H")[0]
3941 orig_reader = reader
3942 reader = orig_reader.slice(_length - (2 + 2))
3943 obj.xid = reader.read("!L")[0]
3944 _experimenter = reader.read("!L")[0]
3945 assert(_experimenter == 6035143)
3946 _subtype = reader.read("!L")[0]
3947 assert(_subtype == 50)
3948 obj.table_id = reader.read("!H")[0]
3949 reader.skip(2)
3950 obj.buckets_size = reader.read("!L")[0]
3951 return obj
3952
3953 def __eq__(self, other):
3954 if type(self) != type(other): return False
3955 if self.xid != other.xid: return False
3956 if self.table_id != other.table_id: return False
3957 if self.buckets_size != other.buckets_size: return False
3958 return True
3959
3960 def pretty_print(self, q):
3961 q.text("bsn_gentable_set_buckets_size {")
3962 with q.group():
3963 with q.indent(2):
3964 q.breakable()
3965 q.text("xid = ");
3966 if self.xid != None:
3967 q.text("%#x" % self.xid)
3968 else:
3969 q.text('None')
3970 q.text(","); q.breakable()
3971 q.text("table_id = ");
3972 q.text("%#x" % self.table_id)
3973 q.text(","); q.breakable()
3974 q.text("buckets_size = ");
3975 q.text("%#x" % self.buckets_size)
3976 q.breakable()
3977 q.text('}')
3978
3979bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
3980
3981class bsn_gentable_stats_reply(bsn_stats_reply):
3982 version = 4
3983 type = 19
3984 stats_type = 65535
3985 experimenter = 6035143
3986 subtype = 7
3987
3988 def __init__(self, xid=None, flags=None, entries=None):
3989 if xid != None:
3990 self.xid = xid
3991 else:
3992 self.xid = None
3993 if flags != None:
3994 self.flags = flags
3995 else:
3996 self.flags = 0
3997 if entries != None:
3998 self.entries = entries
3999 else:
4000 self.entries = []
4001 return
4002
4003 def pack(self):
4004 packed = []
4005 packed.append(struct.pack("!B", self.version))
4006 packed.append(struct.pack("!B", self.type))
4007 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4008 packed.append(struct.pack("!L", self.xid))
4009 packed.append(struct.pack("!H", self.stats_type))
4010 packed.append(struct.pack("!H", self.flags))
4011 packed.append('\x00' * 4)
4012 packed.append(struct.pack("!L", self.experimenter))
4013 packed.append(struct.pack("!L", self.subtype))
4014 packed.append(loxi.generic_util.pack_list(self.entries))
4015 length = sum([len(x) for x in packed])
4016 packed[2] = struct.pack("!H", length)
4017 return ''.join(packed)
4018
4019 @staticmethod
4020 def unpack(reader):
4021 obj = bsn_gentable_stats_reply()
4022 _version = reader.read("!B")[0]
4023 assert(_version == 4)
4024 _type = reader.read("!B")[0]
4025 assert(_type == 19)
4026 _length = reader.read("!H")[0]
4027 orig_reader = reader
4028 reader = orig_reader.slice(_length - (2 + 2))
4029 obj.xid = reader.read("!L")[0]
4030 _stats_type = reader.read("!H")[0]
4031 assert(_stats_type == 65535)
4032 obj.flags = reader.read("!H")[0]
4033 reader.skip(4)
4034 _experimenter = reader.read("!L")[0]
4035 assert(_experimenter == 6035143)
4036 _subtype = reader.read("!L")[0]
4037 assert(_subtype == 7)
4038 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4039 return obj
4040
4041 def __eq__(self, other):
4042 if type(self) != type(other): return False
4043 if self.xid != other.xid: return False
4044 if self.flags != other.flags: return False
4045 if self.entries != other.entries: return False
4046 return True
4047
4048 def pretty_print(self, q):
4049 q.text("bsn_gentable_stats_reply {")
4050 with q.group():
4051 with q.indent(2):
4052 q.breakable()
4053 q.text("xid = ");
4054 if self.xid != None:
4055 q.text("%#x" % self.xid)
4056 else:
4057 q.text('None')
4058 q.text(","); q.breakable()
4059 q.text("flags = ");
4060 q.text("%#x" % self.flags)
4061 q.text(","); q.breakable()
4062 q.text("entries = ");
4063 q.pp(self.entries)
4064 q.breakable()
4065 q.text('}')
4066
4067bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4068
4069class bsn_gentable_stats_request(bsn_stats_request):
4070 version = 4
4071 type = 18
4072 stats_type = 65535
4073 experimenter = 6035143
4074 subtype = 7
4075
4076 def __init__(self, xid=None, flags=None):
4077 if xid != None:
4078 self.xid = xid
4079 else:
4080 self.xid = None
4081 if flags != None:
4082 self.flags = flags
4083 else:
4084 self.flags = 0
4085 return
4086
4087 def pack(self):
4088 packed = []
4089 packed.append(struct.pack("!B", self.version))
4090 packed.append(struct.pack("!B", self.type))
4091 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4092 packed.append(struct.pack("!L", self.xid))
4093 packed.append(struct.pack("!H", self.stats_type))
4094 packed.append(struct.pack("!H", self.flags))
4095 packed.append('\x00' * 4)
4096 packed.append(struct.pack("!L", self.experimenter))
4097 packed.append(struct.pack("!L", self.subtype))
4098 length = sum([len(x) for x in packed])
4099 packed[2] = struct.pack("!H", length)
4100 return ''.join(packed)
4101
4102 @staticmethod
4103 def unpack(reader):
4104 obj = bsn_gentable_stats_request()
4105 _version = reader.read("!B")[0]
4106 assert(_version == 4)
4107 _type = reader.read("!B")[0]
4108 assert(_type == 18)
4109 _length = reader.read("!H")[0]
4110 orig_reader = reader
4111 reader = orig_reader.slice(_length - (2 + 2))
4112 obj.xid = reader.read("!L")[0]
4113 _stats_type = reader.read("!H")[0]
4114 assert(_stats_type == 65535)
4115 obj.flags = reader.read("!H")[0]
4116 reader.skip(4)
4117 _experimenter = reader.read("!L")[0]
4118 assert(_experimenter == 6035143)
4119 _subtype = reader.read("!L")[0]
4120 assert(_subtype == 7)
4121 return obj
4122
4123 def __eq__(self, other):
4124 if type(self) != type(other): return False
4125 if self.xid != other.xid: return False
4126 if self.flags != other.flags: return False
4127 return True
4128
4129 def pretty_print(self, q):
4130 q.text("bsn_gentable_stats_request {")
4131 with q.group():
4132 with q.indent(2):
4133 q.breakable()
4134 q.text("xid = ");
4135 if self.xid != None:
4136 q.text("%#x" % self.xid)
4137 else:
4138 q.text('None')
4139 q.text(","); q.breakable()
4140 q.text("flags = ");
4141 q.text("%#x" % self.flags)
4142 q.breakable()
4143 q.text('}')
4144
4145bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4146
Rich Lane7dcdf022013-12-11 14:45:27 -08004147class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004148 version = 4
4149 type = 4
4150 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004151 subtype = 10
4152
4153 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004154 if xid != None:
4155 self.xid = xid
4156 else:
4157 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004158 if interfaces != None:
4159 self.interfaces = interfaces
4160 else:
4161 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004162 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004163
4164 def pack(self):
4165 packed = []
4166 packed.append(struct.pack("!B", self.version))
4167 packed.append(struct.pack("!B", self.type))
4168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4169 packed.append(struct.pack("!L", self.xid))
4170 packed.append(struct.pack("!L", self.experimenter))
4171 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004172 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004173 length = sum([len(x) for x in packed])
4174 packed[2] = struct.pack("!H", length)
4175 return ''.join(packed)
4176
4177 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004178 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004179 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004180 _version = reader.read("!B")[0]
4181 assert(_version == 4)
4182 _type = reader.read("!B")[0]
4183 assert(_type == 4)
4184 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004185 orig_reader = reader
4186 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004187 obj.xid = reader.read("!L")[0]
4188 _experimenter = reader.read("!L")[0]
4189 assert(_experimenter == 6035143)
4190 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004191 assert(_subtype == 10)
4192 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4193 return obj
4194
4195 def __eq__(self, other):
4196 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004197 if self.xid != other.xid: return False
4198 if self.interfaces != other.interfaces: return False
4199 return True
4200
Rich Lanec2ee4b82013-04-24 17:12:38 -07004201 def pretty_print(self, q):
4202 q.text("bsn_get_interfaces_reply {")
4203 with q.group():
4204 with q.indent(2):
4205 q.breakable()
4206 q.text("xid = ");
4207 if self.xid != None:
4208 q.text("%#x" % self.xid)
4209 else:
4210 q.text('None')
4211 q.text(","); q.breakable()
4212 q.text("interfaces = ");
4213 q.pp(self.interfaces)
4214 q.breakable()
4215 q.text('}')
4216
Rich Lane7dcdf022013-12-11 14:45:27 -08004217bsn_header.subtypes[10] = bsn_get_interfaces_reply
4218
4219class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004220 version = 4
4221 type = 4
4222 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004223 subtype = 9
4224
4225 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004226 if xid != None:
4227 self.xid = xid
4228 else:
4229 self.xid = None
4230 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004231
4232 def pack(self):
4233 packed = []
4234 packed.append(struct.pack("!B", self.version))
4235 packed.append(struct.pack("!B", self.type))
4236 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4237 packed.append(struct.pack("!L", self.xid))
4238 packed.append(struct.pack("!L", self.experimenter))
4239 packed.append(struct.pack("!L", self.subtype))
4240 length = sum([len(x) for x in packed])
4241 packed[2] = struct.pack("!H", length)
4242 return ''.join(packed)
4243
4244 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004245 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004246 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004247 _version = reader.read("!B")[0]
4248 assert(_version == 4)
4249 _type = reader.read("!B")[0]
4250 assert(_type == 4)
4251 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004252 orig_reader = reader
4253 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004254 obj.xid = reader.read("!L")[0]
4255 _experimenter = reader.read("!L")[0]
4256 assert(_experimenter == 6035143)
4257 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004258 assert(_subtype == 9)
4259 return obj
4260
4261 def __eq__(self, other):
4262 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004263 if self.xid != other.xid: return False
4264 return True
4265
Rich Lanec2ee4b82013-04-24 17:12:38 -07004266 def pretty_print(self, q):
4267 q.text("bsn_get_interfaces_request {")
4268 with q.group():
4269 with q.indent(2):
4270 q.breakable()
4271 q.text("xid = ");
4272 if self.xid != None:
4273 q.text("%#x" % self.xid)
4274 else:
4275 q.text('None')
4276 q.breakable()
4277 q.text('}')
4278
Rich Lane7dcdf022013-12-11 14:45:27 -08004279bsn_header.subtypes[9] = bsn_get_interfaces_request
4280
4281class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004282 version = 4
4283 type = 4
4284 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004285 subtype = 5
4286
4287 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004288 if xid != None:
4289 self.xid = xid
4290 else:
4291 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004292 if report_mirror_ports != None:
4293 self.report_mirror_ports = report_mirror_ports
4294 else:
4295 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004296 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004297
4298 def pack(self):
4299 packed = []
4300 packed.append(struct.pack("!B", self.version))
4301 packed.append(struct.pack("!B", self.type))
4302 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4303 packed.append(struct.pack("!L", self.xid))
4304 packed.append(struct.pack("!L", self.experimenter))
4305 packed.append(struct.pack("!L", self.subtype))
4306 packed.append(struct.pack("!B", self.report_mirror_ports))
4307 packed.append('\x00' * 3)
4308 length = sum([len(x) for x in packed])
4309 packed[2] = struct.pack("!H", length)
4310 return ''.join(packed)
4311
4312 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004313 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004314 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004315 _version = reader.read("!B")[0]
4316 assert(_version == 4)
4317 _type = reader.read("!B")[0]
4318 assert(_type == 4)
4319 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004320 orig_reader = reader
4321 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004322 obj.xid = reader.read("!L")[0]
4323 _experimenter = reader.read("!L")[0]
4324 assert(_experimenter == 6035143)
4325 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004326 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07004327 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004328 reader.skip(3)
4329 return obj
4330
4331 def __eq__(self, other):
4332 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004333 if self.xid != other.xid: return False
4334 if self.report_mirror_ports != other.report_mirror_ports: return False
4335 return True
4336
Rich Lanec2ee4b82013-04-24 17:12:38 -07004337 def pretty_print(self, q):
4338 q.text("bsn_get_mirroring_reply {")
4339 with q.group():
4340 with q.indent(2):
4341 q.breakable()
4342 q.text("xid = ");
4343 if self.xid != None:
4344 q.text("%#x" % self.xid)
4345 else:
4346 q.text('None')
4347 q.text(","); q.breakable()
4348 q.text("report_mirror_ports = ");
4349 q.text("%#x" % self.report_mirror_ports)
4350 q.breakable()
4351 q.text('}')
4352
Rich Lane7dcdf022013-12-11 14:45:27 -08004353bsn_header.subtypes[5] = bsn_get_mirroring_reply
4354
4355class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004356 version = 4
4357 type = 4
4358 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004359 subtype = 4
4360
4361 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004362 if xid != None:
4363 self.xid = xid
4364 else:
4365 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004366 if report_mirror_ports != None:
4367 self.report_mirror_ports = report_mirror_ports
4368 else:
4369 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004370 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004371
4372 def pack(self):
4373 packed = []
4374 packed.append(struct.pack("!B", self.version))
4375 packed.append(struct.pack("!B", self.type))
4376 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4377 packed.append(struct.pack("!L", self.xid))
4378 packed.append(struct.pack("!L", self.experimenter))
4379 packed.append(struct.pack("!L", self.subtype))
4380 packed.append(struct.pack("!B", self.report_mirror_ports))
4381 packed.append('\x00' * 3)
4382 length = sum([len(x) for x in packed])
4383 packed[2] = struct.pack("!H", length)
4384 return ''.join(packed)
4385
4386 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004387 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004388 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004389 _version = reader.read("!B")[0]
4390 assert(_version == 4)
4391 _type = reader.read("!B")[0]
4392 assert(_type == 4)
4393 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004394 orig_reader = reader
4395 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004396 obj.xid = reader.read("!L")[0]
4397 _experimenter = reader.read("!L")[0]
4398 assert(_experimenter == 6035143)
4399 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004400 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004401 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004402 reader.skip(3)
4403 return obj
4404
4405 def __eq__(self, other):
4406 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004407 if self.xid != other.xid: return False
4408 if self.report_mirror_ports != other.report_mirror_ports: return False
4409 return True
4410
Rich Lanec2ee4b82013-04-24 17:12:38 -07004411 def pretty_print(self, q):
4412 q.text("bsn_get_mirroring_request {")
4413 with q.group():
4414 with q.indent(2):
4415 q.breakable()
4416 q.text("xid = ");
4417 if self.xid != None:
4418 q.text("%#x" % self.xid)
4419 else:
4420 q.text('None')
4421 q.text(","); q.breakable()
4422 q.text("report_mirror_ports = ");
4423 q.text("%#x" % self.report_mirror_ports)
4424 q.breakable()
4425 q.text('}')
4426
Rich Lane7dcdf022013-12-11 14:45:27 -08004427bsn_header.subtypes[4] = bsn_get_mirroring_request
4428
4429class bsn_get_switch_pipeline_reply(bsn_header):
4430 version = 4
4431 type = 4
4432 experimenter = 6035143
4433 subtype = 52
4434
4435 def __init__(self, xid=None, pipeline=None):
4436 if xid != None:
4437 self.xid = xid
4438 else:
4439 self.xid = None
4440 if pipeline != None:
4441 self.pipeline = pipeline
4442 else:
4443 self.pipeline = ""
4444 return
4445
4446 def pack(self):
4447 packed = []
4448 packed.append(struct.pack("!B", self.version))
4449 packed.append(struct.pack("!B", self.type))
4450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4451 packed.append(struct.pack("!L", self.xid))
4452 packed.append(struct.pack("!L", self.experimenter))
4453 packed.append(struct.pack("!L", self.subtype))
4454 packed.append(struct.pack("!256s", self.pipeline))
4455 length = sum([len(x) for x in packed])
4456 packed[2] = struct.pack("!H", length)
4457 return ''.join(packed)
4458
4459 @staticmethod
4460 def unpack(reader):
4461 obj = bsn_get_switch_pipeline_reply()
4462 _version = reader.read("!B")[0]
4463 assert(_version == 4)
4464 _type = reader.read("!B")[0]
4465 assert(_type == 4)
4466 _length = reader.read("!H")[0]
4467 orig_reader = reader
4468 reader = orig_reader.slice(_length - (2 + 2))
4469 obj.xid = reader.read("!L")[0]
4470 _experimenter = reader.read("!L")[0]
4471 assert(_experimenter == 6035143)
4472 _subtype = reader.read("!L")[0]
4473 assert(_subtype == 52)
4474 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
4475 return obj
4476
4477 def __eq__(self, other):
4478 if type(self) != type(other): return False
4479 if self.xid != other.xid: return False
4480 if self.pipeline != other.pipeline: return False
4481 return True
4482
4483 def pretty_print(self, q):
4484 q.text("bsn_get_switch_pipeline_reply {")
4485 with q.group():
4486 with q.indent(2):
4487 q.breakable()
4488 q.text("xid = ");
4489 if self.xid != None:
4490 q.text("%#x" % self.xid)
4491 else:
4492 q.text('None')
4493 q.text(","); q.breakable()
4494 q.text("pipeline = ");
4495 q.pp(self.pipeline)
4496 q.breakable()
4497 q.text('}')
4498
4499bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
4500
4501class bsn_get_switch_pipeline_request(bsn_header):
4502 version = 4
4503 type = 4
4504 experimenter = 6035143
4505 subtype = 51
4506
4507 def __init__(self, xid=None):
4508 if xid != None:
4509 self.xid = xid
4510 else:
4511 self.xid = None
4512 return
4513
4514 def pack(self):
4515 packed = []
4516 packed.append(struct.pack("!B", self.version))
4517 packed.append(struct.pack("!B", self.type))
4518 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4519 packed.append(struct.pack("!L", self.xid))
4520 packed.append(struct.pack("!L", self.experimenter))
4521 packed.append(struct.pack("!L", self.subtype))
4522 length = sum([len(x) for x in packed])
4523 packed[2] = struct.pack("!H", length)
4524 return ''.join(packed)
4525
4526 @staticmethod
4527 def unpack(reader):
4528 obj = bsn_get_switch_pipeline_request()
4529 _version = reader.read("!B")[0]
4530 assert(_version == 4)
4531 _type = reader.read("!B")[0]
4532 assert(_type == 4)
4533 _length = reader.read("!H")[0]
4534 orig_reader = reader
4535 reader = orig_reader.slice(_length - (2 + 2))
4536 obj.xid = reader.read("!L")[0]
4537 _experimenter = reader.read("!L")[0]
4538 assert(_experimenter == 6035143)
4539 _subtype = reader.read("!L")[0]
4540 assert(_subtype == 51)
4541 return obj
4542
4543 def __eq__(self, other):
4544 if type(self) != type(other): return False
4545 if self.xid != other.xid: return False
4546 return True
4547
4548 def pretty_print(self, q):
4549 q.text("bsn_get_switch_pipeline_request {")
4550 with q.group():
4551 with q.indent(2):
4552 q.breakable()
4553 q.text("xid = ");
4554 if self.xid != None:
4555 q.text("%#x" % self.xid)
4556 else:
4557 q.text('None')
4558 q.breakable()
4559 q.text('}')
4560
4561bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
4562
4563class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08004564 version = 4
4565 type = 4
4566 experimenter = 6035143
4567 subtype = 43
4568
4569 def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004570 if xid != None:
4571 self.xid = xid
4572 else:
4573 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004574 if convergence_status != None:
4575 self.convergence_status = convergence_status
4576 else:
4577 self.convergence_status = 0
4578 if port_no != None:
4579 self.port_no = port_no
4580 else:
4581 self.port_no = 0
4582 if actor_sys_priority != None:
4583 self.actor_sys_priority = actor_sys_priority
4584 else:
4585 self.actor_sys_priority = 0
4586 if actor_sys_mac != None:
4587 self.actor_sys_mac = actor_sys_mac
4588 else:
4589 self.actor_sys_mac = [0,0,0,0,0,0]
4590 if actor_port_priority != None:
4591 self.actor_port_priority = actor_port_priority
4592 else:
4593 self.actor_port_priority = 0
4594 if actor_port_num != None:
4595 self.actor_port_num = actor_port_num
4596 else:
4597 self.actor_port_num = 0
4598 if actor_key != None:
4599 self.actor_key = actor_key
4600 else:
4601 self.actor_key = 0
4602 if partner_sys_priority != None:
4603 self.partner_sys_priority = partner_sys_priority
4604 else:
4605 self.partner_sys_priority = 0
4606 if partner_sys_mac != None:
4607 self.partner_sys_mac = partner_sys_mac
4608 else:
4609 self.partner_sys_mac = [0,0,0,0,0,0]
4610 if partner_port_priority != None:
4611 self.partner_port_priority = partner_port_priority
4612 else:
4613 self.partner_port_priority = 0
4614 if partner_port_num != None:
4615 self.partner_port_num = partner_port_num
4616 else:
4617 self.partner_port_num = 0
4618 if partner_key != None:
4619 self.partner_key = partner_key
4620 else:
4621 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004622 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004623
4624 def pack(self):
4625 packed = []
4626 packed.append(struct.pack("!B", self.version))
4627 packed.append(struct.pack("!B", self.type))
4628 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4629 packed.append(struct.pack("!L", self.xid))
4630 packed.append(struct.pack("!L", self.experimenter))
4631 packed.append(struct.pack("!L", self.subtype))
4632 packed.append(struct.pack("!B", self.convergence_status))
4633 packed.append('\x00' * 3)
4634 packed.append(util.pack_port_no(self.port_no))
4635 packed.append(struct.pack("!H", self.actor_sys_priority))
4636 packed.append(struct.pack("!6B", *self.actor_sys_mac))
4637 packed.append(struct.pack("!H", self.actor_port_priority))
4638 packed.append(struct.pack("!H", self.actor_port_num))
4639 packed.append(struct.pack("!H", self.actor_key))
4640 packed.append(struct.pack("!H", self.partner_sys_priority))
4641 packed.append(struct.pack("!6B", *self.partner_sys_mac))
4642 packed.append(struct.pack("!H", self.partner_port_priority))
4643 packed.append(struct.pack("!H", self.partner_port_num))
4644 packed.append(struct.pack("!H", self.partner_key))
4645 length = sum([len(x) for x in packed])
4646 packed[2] = struct.pack("!H", length)
4647 return ''.join(packed)
4648
4649 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004650 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004651 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08004652 _version = reader.read("!B")[0]
4653 assert(_version == 4)
4654 _type = reader.read("!B")[0]
4655 assert(_type == 4)
4656 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004657 orig_reader = reader
4658 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004659 obj.xid = reader.read("!L")[0]
4660 _experimenter = reader.read("!L")[0]
4661 assert(_experimenter == 6035143)
4662 _subtype = reader.read("!L")[0]
4663 assert(_subtype == 43)
4664 obj.convergence_status = reader.read("!B")[0]
4665 reader.skip(3)
4666 obj.port_no = util.unpack_port_no(reader)
4667 obj.actor_sys_priority = reader.read("!H")[0]
4668 obj.actor_sys_mac = list(reader.read('!6B'))
4669 obj.actor_port_priority = reader.read("!H")[0]
4670 obj.actor_port_num = reader.read("!H")[0]
4671 obj.actor_key = reader.read("!H")[0]
4672 obj.partner_sys_priority = reader.read("!H")[0]
4673 obj.partner_sys_mac = list(reader.read('!6B'))
4674 obj.partner_port_priority = reader.read("!H")[0]
4675 obj.partner_port_num = reader.read("!H")[0]
4676 obj.partner_key = reader.read("!H")[0]
4677 return obj
4678
4679 def __eq__(self, other):
4680 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004681 if self.xid != other.xid: return False
4682 if self.convergence_status != other.convergence_status: return False
4683 if self.port_no != other.port_no: return False
4684 if self.actor_sys_priority != other.actor_sys_priority: return False
4685 if self.actor_sys_mac != other.actor_sys_mac: return False
4686 if self.actor_port_priority != other.actor_port_priority: return False
4687 if self.actor_port_num != other.actor_port_num: return False
4688 if self.actor_key != other.actor_key: return False
4689 if self.partner_sys_priority != other.partner_sys_priority: return False
4690 if self.partner_sys_mac != other.partner_sys_mac: return False
4691 if self.partner_port_priority != other.partner_port_priority: return False
4692 if self.partner_port_num != other.partner_port_num: return False
4693 if self.partner_key != other.partner_key: return False
4694 return True
4695
Rich Lane7b0f2012013-11-22 14:15:26 -08004696 def pretty_print(self, q):
4697 q.text("bsn_lacp_convergence_notif {")
4698 with q.group():
4699 with q.indent(2):
4700 q.breakable()
4701 q.text("xid = ");
4702 if self.xid != None:
4703 q.text("%#x" % self.xid)
4704 else:
4705 q.text('None')
4706 q.text(","); q.breakable()
4707 q.text("convergence_status = ");
4708 q.text("%#x" % self.convergence_status)
4709 q.text(","); q.breakable()
4710 q.text("port_no = ");
4711 q.text(util.pretty_port(self.port_no))
4712 q.text(","); q.breakable()
4713 q.text("actor_sys_priority = ");
4714 q.text("%#x" % self.actor_sys_priority)
4715 q.text(","); q.breakable()
4716 q.text("actor_sys_mac = ");
4717 q.text(util.pretty_mac(self.actor_sys_mac))
4718 q.text(","); q.breakable()
4719 q.text("actor_port_priority = ");
4720 q.text("%#x" % self.actor_port_priority)
4721 q.text(","); q.breakable()
4722 q.text("actor_port_num = ");
4723 q.text("%#x" % self.actor_port_num)
4724 q.text(","); q.breakable()
4725 q.text("actor_key = ");
4726 q.text("%#x" % self.actor_key)
4727 q.text(","); q.breakable()
4728 q.text("partner_sys_priority = ");
4729 q.text("%#x" % self.partner_sys_priority)
4730 q.text(","); q.breakable()
4731 q.text("partner_sys_mac = ");
4732 q.text(util.pretty_mac(self.partner_sys_mac))
4733 q.text(","); q.breakable()
4734 q.text("partner_port_priority = ");
4735 q.text("%#x" % self.partner_port_priority)
4736 q.text(","); q.breakable()
4737 q.text("partner_port_num = ");
4738 q.text("%#x" % self.partner_port_num)
4739 q.text(","); q.breakable()
4740 q.text("partner_key = ");
4741 q.text("%#x" % self.partner_key)
4742 q.breakable()
4743 q.text('}')
4744
Rich Lane7dcdf022013-12-11 14:45:27 -08004745bsn_header.subtypes[43] = bsn_lacp_convergence_notif
4746
Rich Lane7dcdf022013-12-11 14:45:27 -08004747class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08004748 version = 4
4749 type = 19
4750 stats_type = 65535
4751 experimenter = 6035143
4752 subtype = 1
4753
4754 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004755 if xid != None:
4756 self.xid = xid
4757 else:
4758 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004759 if flags != None:
4760 self.flags = flags
4761 else:
4762 self.flags = 0
4763 if entries != None:
4764 self.entries = entries
4765 else:
4766 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004767 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004768
4769 def pack(self):
4770 packed = []
4771 packed.append(struct.pack("!B", self.version))
4772 packed.append(struct.pack("!B", self.type))
4773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4774 packed.append(struct.pack("!L", self.xid))
4775 packed.append(struct.pack("!H", self.stats_type))
4776 packed.append(struct.pack("!H", self.flags))
4777 packed.append('\x00' * 4)
4778 packed.append(struct.pack("!L", self.experimenter))
4779 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004780 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08004781 length = sum([len(x) for x in packed])
4782 packed[2] = struct.pack("!H", length)
4783 return ''.join(packed)
4784
4785 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004786 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004787 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08004788 _version = reader.read("!B")[0]
4789 assert(_version == 4)
4790 _type = reader.read("!B")[0]
4791 assert(_type == 19)
4792 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004793 orig_reader = reader
4794 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004795 obj.xid = reader.read("!L")[0]
4796 _stats_type = reader.read("!H")[0]
4797 assert(_stats_type == 65535)
4798 obj.flags = reader.read("!H")[0]
4799 reader.skip(4)
4800 _experimenter = reader.read("!L")[0]
4801 assert(_experimenter == 6035143)
4802 _subtype = reader.read("!L")[0]
4803 assert(_subtype == 1)
4804 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
4805 return obj
4806
4807 def __eq__(self, other):
4808 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004809 if self.xid != other.xid: return False
4810 if self.flags != other.flags: return False
4811 if self.entries != other.entries: return False
4812 return True
4813
Rich Lane7b0f2012013-11-22 14:15:26 -08004814 def pretty_print(self, q):
4815 q.text("bsn_lacp_stats_reply {")
4816 with q.group():
4817 with q.indent(2):
4818 q.breakable()
4819 q.text("xid = ");
4820 if self.xid != None:
4821 q.text("%#x" % self.xid)
4822 else:
4823 q.text('None')
4824 q.text(","); q.breakable()
4825 q.text("flags = ");
4826 q.text("%#x" % self.flags)
4827 q.text(","); q.breakable()
4828 q.text("entries = ");
4829 q.pp(self.entries)
4830 q.breakable()
4831 q.text('}')
4832
Rich Lane7dcdf022013-12-11 14:45:27 -08004833bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
4834
Rich Lane7dcdf022013-12-11 14:45:27 -08004835class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08004836 version = 4
4837 type = 18
4838 stats_type = 65535
4839 experimenter = 6035143
4840 subtype = 1
4841
4842 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004843 if xid != None:
4844 self.xid = xid
4845 else:
4846 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004847 if flags != None:
4848 self.flags = flags
4849 else:
4850 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004851 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004852
4853 def pack(self):
4854 packed = []
4855 packed.append(struct.pack("!B", self.version))
4856 packed.append(struct.pack("!B", self.type))
4857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4858 packed.append(struct.pack("!L", self.xid))
4859 packed.append(struct.pack("!H", self.stats_type))
4860 packed.append(struct.pack("!H", self.flags))
4861 packed.append('\x00' * 4)
4862 packed.append(struct.pack("!L", self.experimenter))
4863 packed.append(struct.pack("!L", self.subtype))
4864 length = sum([len(x) for x in packed])
4865 packed[2] = struct.pack("!H", length)
4866 return ''.join(packed)
4867
4868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004869 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004870 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08004871 _version = reader.read("!B")[0]
4872 assert(_version == 4)
4873 _type = reader.read("!B")[0]
4874 assert(_type == 18)
4875 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004876 orig_reader = reader
4877 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004878 obj.xid = reader.read("!L")[0]
4879 _stats_type = reader.read("!H")[0]
4880 assert(_stats_type == 65535)
4881 obj.flags = reader.read("!H")[0]
4882 reader.skip(4)
4883 _experimenter = reader.read("!L")[0]
4884 assert(_experimenter == 6035143)
4885 _subtype = reader.read("!L")[0]
4886 assert(_subtype == 1)
4887 return obj
4888
4889 def __eq__(self, other):
4890 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004891 if self.xid != other.xid: return False
4892 if self.flags != other.flags: return False
4893 return True
4894
Rich Lane7b0f2012013-11-22 14:15:26 -08004895 def pretty_print(self, q):
4896 q.text("bsn_lacp_stats_request {")
4897 with q.group():
4898 with q.indent(2):
4899 q.breakable()
4900 q.text("xid = ");
4901 if self.xid != None:
4902 q.text("%#x" % self.xid)
4903 else:
4904 q.text('None')
4905 q.text(","); q.breakable()
4906 q.text("flags = ");
4907 q.text("%#x" % self.flags)
4908 q.breakable()
4909 q.text('}')
4910
Rich Lane7dcdf022013-12-11 14:45:27 -08004911bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
4912
4913class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07004914 version = 4
4915 type = 4
4916 experimenter = 6035143
4917 subtype = 34
4918
Rich Lane7b0f2012013-11-22 14:15:26 -08004919 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004920 if xid != None:
4921 self.xid = xid
4922 else:
4923 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07004924 if status != None:
4925 self.status = status
4926 else:
4927 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08004928 if port_no != None:
4929 self.port_no = port_no
4930 else:
4931 self.port_no = 0
4932 if slot_num != None:
4933 self.slot_num = slot_num
4934 else:
4935 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004936 return
Rich Lane6f4978c2013-10-20 21:33:52 -07004937
4938 def pack(self):
4939 packed = []
4940 packed.append(struct.pack("!B", self.version))
4941 packed.append(struct.pack("!B", self.type))
4942 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4943 packed.append(struct.pack("!L", self.xid))
4944 packed.append(struct.pack("!L", self.experimenter))
4945 packed.append(struct.pack("!L", self.subtype))
4946 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08004947 packed.append(util.pack_port_no(self.port_no))
4948 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07004949 length = sum([len(x) for x in packed])
4950 packed[2] = struct.pack("!H", length)
4951 return ''.join(packed)
4952
4953 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004954 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07004955 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07004956 _version = reader.read("!B")[0]
4957 assert(_version == 4)
4958 _type = reader.read("!B")[0]
4959 assert(_type == 4)
4960 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004961 orig_reader = reader
4962 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07004963 obj.xid = reader.read("!L")[0]
4964 _experimenter = reader.read("!L")[0]
4965 assert(_experimenter == 6035143)
4966 _subtype = reader.read("!L")[0]
4967 assert(_subtype == 34)
4968 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08004969 obj.port_no = util.unpack_port_no(reader)
4970 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07004971 return obj
4972
4973 def __eq__(self, other):
4974 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07004975 if self.xid != other.xid: return False
4976 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004977 if self.port_no != other.port_no: return False
4978 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07004979 return True
4980
Rich Lane6f4978c2013-10-20 21:33:52 -07004981 def pretty_print(self, q):
4982 q.text("bsn_pdu_rx_reply {")
4983 with q.group():
4984 with q.indent(2):
4985 q.breakable()
4986 q.text("xid = ");
4987 if self.xid != None:
4988 q.text("%#x" % self.xid)
4989 else:
4990 q.text('None')
4991 q.text(","); q.breakable()
4992 q.text("status = ");
4993 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08004994 q.text(","); q.breakable()
4995 q.text("port_no = ");
4996 q.text(util.pretty_port(self.port_no))
4997 q.text(","); q.breakable()
4998 q.text("slot_num = ");
4999 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005000 q.breakable()
5001 q.text('}')
5002
Rich Lane7dcdf022013-12-11 14:45:27 -08005003bsn_header.subtypes[34] = bsn_pdu_rx_reply
5004
5005class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005006 version = 4
5007 type = 4
5008 experimenter = 6035143
5009 subtype = 33
5010
5011 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005012 if xid != None:
5013 self.xid = xid
5014 else:
5015 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005016 if timeout_ms != None:
5017 self.timeout_ms = timeout_ms
5018 else:
5019 self.timeout_ms = 0
5020 if port_no != None:
5021 self.port_no = port_no
5022 else:
5023 self.port_no = 0
5024 if slot_num != None:
5025 self.slot_num = slot_num
5026 else:
5027 self.slot_num = 0
5028 if data != None:
5029 self.data = data
5030 else:
5031 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005032 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005033
5034 def pack(self):
5035 packed = []
5036 packed.append(struct.pack("!B", self.version))
5037 packed.append(struct.pack("!B", self.type))
5038 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5039 packed.append(struct.pack("!L", self.xid))
5040 packed.append(struct.pack("!L", self.experimenter))
5041 packed.append(struct.pack("!L", self.subtype))
5042 packed.append(struct.pack("!L", self.timeout_ms))
5043 packed.append(util.pack_port_no(self.port_no))
5044 packed.append(struct.pack("!B", self.slot_num))
5045 packed.append('\x00' * 3)
5046 packed.append(self.data)
5047 length = sum([len(x) for x in packed])
5048 packed[2] = struct.pack("!H", length)
5049 return ''.join(packed)
5050
5051 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005052 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005053 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005054 _version = reader.read("!B")[0]
5055 assert(_version == 4)
5056 _type = reader.read("!B")[0]
5057 assert(_type == 4)
5058 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005059 orig_reader = reader
5060 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005061 obj.xid = reader.read("!L")[0]
5062 _experimenter = reader.read("!L")[0]
5063 assert(_experimenter == 6035143)
5064 _subtype = reader.read("!L")[0]
5065 assert(_subtype == 33)
5066 obj.timeout_ms = reader.read("!L")[0]
5067 obj.port_no = util.unpack_port_no(reader)
5068 obj.slot_num = reader.read("!B")[0]
5069 reader.skip(3)
5070 obj.data = str(reader.read_all())
5071 return obj
5072
5073 def __eq__(self, other):
5074 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005075 if self.xid != other.xid: return False
5076 if self.timeout_ms != other.timeout_ms: return False
5077 if self.port_no != other.port_no: return False
5078 if self.slot_num != other.slot_num: return False
5079 if self.data != other.data: return False
5080 return True
5081
Rich Lane6f4978c2013-10-20 21:33:52 -07005082 def pretty_print(self, q):
5083 q.text("bsn_pdu_rx_request {")
5084 with q.group():
5085 with q.indent(2):
5086 q.breakable()
5087 q.text("xid = ");
5088 if self.xid != None:
5089 q.text("%#x" % self.xid)
5090 else:
5091 q.text('None')
5092 q.text(","); q.breakable()
5093 q.text("timeout_ms = ");
5094 q.text("%#x" % self.timeout_ms)
5095 q.text(","); q.breakable()
5096 q.text("port_no = ");
5097 q.text(util.pretty_port(self.port_no))
5098 q.text(","); q.breakable()
5099 q.text("slot_num = ");
5100 q.text("%#x" % self.slot_num)
5101 q.text(","); q.breakable()
5102 q.text("data = ");
5103 q.pp(self.data)
5104 q.breakable()
5105 q.text('}')
5106
Rich Lane7dcdf022013-12-11 14:45:27 -08005107bsn_header.subtypes[33] = bsn_pdu_rx_request
5108
5109class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005110 version = 4
5111 type = 4
5112 experimenter = 6035143
5113 subtype = 35
5114
5115 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005116 if xid != None:
5117 self.xid = xid
5118 else:
5119 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005120 if port_no != None:
5121 self.port_no = port_no
5122 else:
5123 self.port_no = 0
5124 if slot_num != None:
5125 self.slot_num = slot_num
5126 else:
5127 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005128 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005129
5130 def pack(self):
5131 packed = []
5132 packed.append(struct.pack("!B", self.version))
5133 packed.append(struct.pack("!B", self.type))
5134 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5135 packed.append(struct.pack("!L", self.xid))
5136 packed.append(struct.pack("!L", self.experimenter))
5137 packed.append(struct.pack("!L", self.subtype))
5138 packed.append(util.pack_port_no(self.port_no))
5139 packed.append(struct.pack("!B", self.slot_num))
5140 length = sum([len(x) for x in packed])
5141 packed[2] = struct.pack("!H", length)
5142 return ''.join(packed)
5143
5144 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005145 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005146 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07005147 _version = reader.read("!B")[0]
5148 assert(_version == 4)
5149 _type = reader.read("!B")[0]
5150 assert(_type == 4)
5151 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005152 orig_reader = reader
5153 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005154 obj.xid = reader.read("!L")[0]
5155 _experimenter = reader.read("!L")[0]
5156 assert(_experimenter == 6035143)
5157 _subtype = reader.read("!L")[0]
5158 assert(_subtype == 35)
5159 obj.port_no = util.unpack_port_no(reader)
5160 obj.slot_num = reader.read("!B")[0]
5161 return obj
5162
5163 def __eq__(self, other):
5164 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005165 if self.xid != other.xid: return False
5166 if self.port_no != other.port_no: return False
5167 if self.slot_num != other.slot_num: return False
5168 return True
5169
Rich Lane6f4978c2013-10-20 21:33:52 -07005170 def pretty_print(self, q):
5171 q.text("bsn_pdu_rx_timeout {")
5172 with q.group():
5173 with q.indent(2):
5174 q.breakable()
5175 q.text("xid = ");
5176 if self.xid != None:
5177 q.text("%#x" % self.xid)
5178 else:
5179 q.text('None')
5180 q.text(","); q.breakable()
5181 q.text("port_no = ");
5182 q.text(util.pretty_port(self.port_no))
5183 q.text(","); q.breakable()
5184 q.text("slot_num = ");
5185 q.text("%#x" % self.slot_num)
5186 q.breakable()
5187 q.text('}')
5188
Rich Lane7dcdf022013-12-11 14:45:27 -08005189bsn_header.subtypes[35] = bsn_pdu_rx_timeout
5190
5191class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005192 version = 4
5193 type = 4
5194 experimenter = 6035143
5195 subtype = 32
5196
Rich Lane7b0f2012013-11-22 14:15:26 -08005197 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005198 if xid != None:
5199 self.xid = xid
5200 else:
5201 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005202 if status != None:
5203 self.status = status
5204 else:
5205 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005206 if port_no != None:
5207 self.port_no = port_no
5208 else:
5209 self.port_no = 0
5210 if slot_num != None:
5211 self.slot_num = slot_num
5212 else:
5213 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005214 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005215
5216 def pack(self):
5217 packed = []
5218 packed.append(struct.pack("!B", self.version))
5219 packed.append(struct.pack("!B", self.type))
5220 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5221 packed.append(struct.pack("!L", self.xid))
5222 packed.append(struct.pack("!L", self.experimenter))
5223 packed.append(struct.pack("!L", self.subtype))
5224 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005225 packed.append(util.pack_port_no(self.port_no))
5226 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005227 length = sum([len(x) for x in packed])
5228 packed[2] = struct.pack("!H", length)
5229 return ''.join(packed)
5230
5231 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005232 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005233 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005234 _version = reader.read("!B")[0]
5235 assert(_version == 4)
5236 _type = reader.read("!B")[0]
5237 assert(_type == 4)
5238 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005239 orig_reader = reader
5240 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005241 obj.xid = reader.read("!L")[0]
5242 _experimenter = reader.read("!L")[0]
5243 assert(_experimenter == 6035143)
5244 _subtype = reader.read("!L")[0]
5245 assert(_subtype == 32)
5246 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005247 obj.port_no = util.unpack_port_no(reader)
5248 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005249 return obj
5250
5251 def __eq__(self, other):
5252 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005253 if self.xid != other.xid: return False
5254 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005255 if self.port_no != other.port_no: return False
5256 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005257 return True
5258
Rich Lane6f4978c2013-10-20 21:33:52 -07005259 def pretty_print(self, q):
5260 q.text("bsn_pdu_tx_reply {")
5261 with q.group():
5262 with q.indent(2):
5263 q.breakable()
5264 q.text("xid = ");
5265 if self.xid != None:
5266 q.text("%#x" % self.xid)
5267 else:
5268 q.text('None')
5269 q.text(","); q.breakable()
5270 q.text("status = ");
5271 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005272 q.text(","); q.breakable()
5273 q.text("port_no = ");
5274 q.text(util.pretty_port(self.port_no))
5275 q.text(","); q.breakable()
5276 q.text("slot_num = ");
5277 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005278 q.breakable()
5279 q.text('}')
5280
Rich Lane7dcdf022013-12-11 14:45:27 -08005281bsn_header.subtypes[32] = bsn_pdu_tx_reply
5282
5283class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005284 version = 4
5285 type = 4
5286 experimenter = 6035143
5287 subtype = 31
5288
5289 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005290 if xid != None:
5291 self.xid = xid
5292 else:
5293 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005294 if tx_interval_ms != None:
5295 self.tx_interval_ms = tx_interval_ms
5296 else:
5297 self.tx_interval_ms = 0
5298 if port_no != None:
5299 self.port_no = port_no
5300 else:
5301 self.port_no = 0
5302 if slot_num != None:
5303 self.slot_num = slot_num
5304 else:
5305 self.slot_num = 0
5306 if data != None:
5307 self.data = data
5308 else:
5309 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005310 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005311
5312 def pack(self):
5313 packed = []
5314 packed.append(struct.pack("!B", self.version))
5315 packed.append(struct.pack("!B", self.type))
5316 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5317 packed.append(struct.pack("!L", self.xid))
5318 packed.append(struct.pack("!L", self.experimenter))
5319 packed.append(struct.pack("!L", self.subtype))
5320 packed.append(struct.pack("!L", self.tx_interval_ms))
5321 packed.append(util.pack_port_no(self.port_no))
5322 packed.append(struct.pack("!B", self.slot_num))
5323 packed.append('\x00' * 3)
5324 packed.append(self.data)
5325 length = sum([len(x) for x in packed])
5326 packed[2] = struct.pack("!H", length)
5327 return ''.join(packed)
5328
5329 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005330 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005331 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005332 _version = reader.read("!B")[0]
5333 assert(_version == 4)
5334 _type = reader.read("!B")[0]
5335 assert(_type == 4)
5336 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005337 orig_reader = reader
5338 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005339 obj.xid = reader.read("!L")[0]
5340 _experimenter = reader.read("!L")[0]
5341 assert(_experimenter == 6035143)
5342 _subtype = reader.read("!L")[0]
5343 assert(_subtype == 31)
5344 obj.tx_interval_ms = reader.read("!L")[0]
5345 obj.port_no = util.unpack_port_no(reader)
5346 obj.slot_num = reader.read("!B")[0]
5347 reader.skip(3)
5348 obj.data = str(reader.read_all())
5349 return obj
5350
5351 def __eq__(self, other):
5352 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005353 if self.xid != other.xid: return False
5354 if self.tx_interval_ms != other.tx_interval_ms: return False
5355 if self.port_no != other.port_no: return False
5356 if self.slot_num != other.slot_num: return False
5357 if self.data != other.data: return False
5358 return True
5359
Rich Lane6f4978c2013-10-20 21:33:52 -07005360 def pretty_print(self, q):
5361 q.text("bsn_pdu_tx_request {")
5362 with q.group():
5363 with q.indent(2):
5364 q.breakable()
5365 q.text("xid = ");
5366 if self.xid != None:
5367 q.text("%#x" % self.xid)
5368 else:
5369 q.text('None')
5370 q.text(","); q.breakable()
5371 q.text("tx_interval_ms = ");
5372 q.text("%#x" % self.tx_interval_ms)
5373 q.text(","); q.breakable()
5374 q.text("port_no = ");
5375 q.text(util.pretty_port(self.port_no))
5376 q.text(","); q.breakable()
5377 q.text("slot_num = ");
5378 q.text("%#x" % self.slot_num)
5379 q.text(","); q.breakable()
5380 q.text("data = ");
5381 q.pp(self.data)
5382 q.breakable()
5383 q.text('}')
5384
Rich Lane7dcdf022013-12-11 14:45:27 -08005385bsn_header.subtypes[31] = bsn_pdu_tx_request
5386
5387class bsn_port_counter_stats_reply(bsn_stats_reply):
5388 version = 4
5389 type = 19
5390 stats_type = 65535
5391 experimenter = 6035143
5392 subtype = 8
5393
5394 def __init__(self, xid=None, flags=None, entries=None):
5395 if xid != None:
5396 self.xid = xid
5397 else:
5398 self.xid = None
5399 if flags != None:
5400 self.flags = flags
5401 else:
5402 self.flags = 0
5403 if entries != None:
5404 self.entries = entries
5405 else:
5406 self.entries = []
5407 return
5408
5409 def pack(self):
5410 packed = []
5411 packed.append(struct.pack("!B", self.version))
5412 packed.append(struct.pack("!B", self.type))
5413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5414 packed.append(struct.pack("!L", self.xid))
5415 packed.append(struct.pack("!H", self.stats_type))
5416 packed.append(struct.pack("!H", self.flags))
5417 packed.append('\x00' * 4)
5418 packed.append(struct.pack("!L", self.experimenter))
5419 packed.append(struct.pack("!L", self.subtype))
5420 packed.append(loxi.generic_util.pack_list(self.entries))
5421 length = sum([len(x) for x in packed])
5422 packed[2] = struct.pack("!H", length)
5423 return ''.join(packed)
5424
5425 @staticmethod
5426 def unpack(reader):
5427 obj = bsn_port_counter_stats_reply()
5428 _version = reader.read("!B")[0]
5429 assert(_version == 4)
5430 _type = reader.read("!B")[0]
5431 assert(_type == 19)
5432 _length = reader.read("!H")[0]
5433 orig_reader = reader
5434 reader = orig_reader.slice(_length - (2 + 2))
5435 obj.xid = reader.read("!L")[0]
5436 _stats_type = reader.read("!H")[0]
5437 assert(_stats_type == 65535)
5438 obj.flags = reader.read("!H")[0]
5439 reader.skip(4)
5440 _experimenter = reader.read("!L")[0]
5441 assert(_experimenter == 6035143)
5442 _subtype = reader.read("!L")[0]
5443 assert(_subtype == 8)
5444 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
5445 return obj
5446
5447 def __eq__(self, other):
5448 if type(self) != type(other): return False
5449 if self.xid != other.xid: return False
5450 if self.flags != other.flags: return False
5451 if self.entries != other.entries: return False
5452 return True
5453
5454 def pretty_print(self, q):
5455 q.text("bsn_port_counter_stats_reply {")
5456 with q.group():
5457 with q.indent(2):
5458 q.breakable()
5459 q.text("xid = ");
5460 if self.xid != None:
5461 q.text("%#x" % self.xid)
5462 else:
5463 q.text('None')
5464 q.text(","); q.breakable()
5465 q.text("flags = ");
5466 q.text("%#x" % self.flags)
5467 q.text(","); q.breakable()
5468 q.text("entries = ");
5469 q.pp(self.entries)
5470 q.breakable()
5471 q.text('}')
5472
5473bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
5474
5475class bsn_port_counter_stats_request(bsn_stats_request):
5476 version = 4
5477 type = 18
5478 stats_type = 65535
5479 experimenter = 6035143
5480 subtype = 8
5481
5482 def __init__(self, xid=None, flags=None, port_no=None):
5483 if xid != None:
5484 self.xid = xid
5485 else:
5486 self.xid = None
5487 if flags != None:
5488 self.flags = flags
5489 else:
5490 self.flags = 0
5491 if port_no != None:
5492 self.port_no = port_no
5493 else:
5494 self.port_no = 0
5495 return
5496
5497 def pack(self):
5498 packed = []
5499 packed.append(struct.pack("!B", self.version))
5500 packed.append(struct.pack("!B", self.type))
5501 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5502 packed.append(struct.pack("!L", self.xid))
5503 packed.append(struct.pack("!H", self.stats_type))
5504 packed.append(struct.pack("!H", self.flags))
5505 packed.append('\x00' * 4)
5506 packed.append(struct.pack("!L", self.experimenter))
5507 packed.append(struct.pack("!L", self.subtype))
5508 packed.append(util.pack_port_no(self.port_no))
5509 length = sum([len(x) for x in packed])
5510 packed[2] = struct.pack("!H", length)
5511 return ''.join(packed)
5512
5513 @staticmethod
5514 def unpack(reader):
5515 obj = bsn_port_counter_stats_request()
5516 _version = reader.read("!B")[0]
5517 assert(_version == 4)
5518 _type = reader.read("!B")[0]
5519 assert(_type == 18)
5520 _length = reader.read("!H")[0]
5521 orig_reader = reader
5522 reader = orig_reader.slice(_length - (2 + 2))
5523 obj.xid = reader.read("!L")[0]
5524 _stats_type = reader.read("!H")[0]
5525 assert(_stats_type == 65535)
5526 obj.flags = reader.read("!H")[0]
5527 reader.skip(4)
5528 _experimenter = reader.read("!L")[0]
5529 assert(_experimenter == 6035143)
5530 _subtype = reader.read("!L")[0]
5531 assert(_subtype == 8)
5532 obj.port_no = util.unpack_port_no(reader)
5533 return obj
5534
5535 def __eq__(self, other):
5536 if type(self) != type(other): return False
5537 if self.xid != other.xid: return False
5538 if self.flags != other.flags: return False
5539 if self.port_no != other.port_no: return False
5540 return True
5541
5542 def pretty_print(self, q):
5543 q.text("bsn_port_counter_stats_request {")
5544 with q.group():
5545 with q.indent(2):
5546 q.breakable()
5547 q.text("xid = ");
5548 if self.xid != None:
5549 q.text("%#x" % self.xid)
5550 else:
5551 q.text('None')
5552 q.text(","); q.breakable()
5553 q.text("flags = ");
5554 q.text("%#x" % self.flags)
5555 q.text(","); q.breakable()
5556 q.text("port_no = ");
5557 q.text(util.pretty_port(self.port_no))
5558 q.breakable()
5559 q.text('}')
5560
5561bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
5562
Rich Lane5454b682014-01-14 17:07:36 -08005563class bsn_role_status(bsn_header):
5564 version = 4
5565 type = 4
5566 experimenter = 6035143
5567 subtype = 55
5568
5569 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
5570 if xid != None:
5571 self.xid = xid
5572 else:
5573 self.xid = None
5574 if role != None:
5575 self.role = role
5576 else:
5577 self.role = 0
5578 if reason != None:
5579 self.reason = reason
5580 else:
5581 self.reason = 0
5582 if generation_id != None:
5583 self.generation_id = generation_id
5584 else:
5585 self.generation_id = 0
5586 return
5587
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("!L", self.experimenter))
5595 packed.append(struct.pack("!L", self.subtype))
5596 packed.append(struct.pack("!L", self.role))
5597 packed.append(struct.pack("!B", self.reason))
5598 packed.append('\x00' * 3)
5599 packed.append(struct.pack("!Q", self.generation_id))
5600 length = sum([len(x) for x in packed])
5601 packed[2] = struct.pack("!H", length)
5602 return ''.join(packed)
5603
5604 @staticmethod
5605 def unpack(reader):
5606 obj = bsn_role_status()
5607 _version = reader.read("!B")[0]
5608 assert(_version == 4)
5609 _type = reader.read("!B")[0]
5610 assert(_type == 4)
5611 _length = reader.read("!H")[0]
5612 orig_reader = reader
5613 reader = orig_reader.slice(_length - (2 + 2))
5614 obj.xid = reader.read("!L")[0]
5615 _experimenter = reader.read("!L")[0]
5616 assert(_experimenter == 6035143)
5617 _subtype = reader.read("!L")[0]
5618 assert(_subtype == 55)
5619 obj.role = reader.read("!L")[0]
5620 obj.reason = reader.read("!B")[0]
5621 reader.skip(3)
5622 obj.generation_id = reader.read("!Q")[0]
5623 return obj
5624
5625 def __eq__(self, other):
5626 if type(self) != type(other): return False
5627 if self.xid != other.xid: return False
5628 if self.role != other.role: return False
5629 if self.reason != other.reason: return False
5630 if self.generation_id != other.generation_id: return False
5631 return True
5632
5633 def pretty_print(self, q):
5634 q.text("bsn_role_status {")
5635 with q.group():
5636 with q.indent(2):
5637 q.breakable()
5638 q.text("xid = ");
5639 if self.xid != None:
5640 q.text("%#x" % self.xid)
5641 else:
5642 q.text('None')
5643 q.text(","); q.breakable()
5644 q.text("role = ");
5645 q.text("%#x" % self.role)
5646 q.text(","); q.breakable()
5647 q.text("reason = ");
5648 q.text("%#x" % self.reason)
5649 q.text(","); q.breakable()
5650 q.text("generation_id = ");
5651 q.text("%#x" % self.generation_id)
5652 q.breakable()
5653 q.text('}')
5654
5655bsn_header.subtypes[55] = bsn_role_status
5656
Rich Lane95f7fc92014-01-27 17:08:16 -08005657class bsn_set_aux_cxns_reply(bsn_header):
5658 version = 4
5659 type = 4
5660 experimenter = 6035143
5661 subtype = 59
5662
5663 def __init__(self, xid=None, num_aux=None, status=None):
5664 if xid != None:
5665 self.xid = xid
5666 else:
5667 self.xid = None
5668 if num_aux != None:
5669 self.num_aux = num_aux
5670 else:
5671 self.num_aux = 0
5672 if status != None:
5673 self.status = status
5674 else:
5675 self.status = 0
5676 return
5677
5678 def pack(self):
5679 packed = []
5680 packed.append(struct.pack("!B", self.version))
5681 packed.append(struct.pack("!B", self.type))
5682 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5683 packed.append(struct.pack("!L", self.xid))
5684 packed.append(struct.pack("!L", self.experimenter))
5685 packed.append(struct.pack("!L", self.subtype))
5686 packed.append(struct.pack("!L", self.num_aux))
5687 packed.append(struct.pack("!L", self.status))
5688 length = sum([len(x) for x in packed])
5689 packed[2] = struct.pack("!H", length)
5690 return ''.join(packed)
5691
5692 @staticmethod
5693 def unpack(reader):
5694 obj = bsn_set_aux_cxns_reply()
5695 _version = reader.read("!B")[0]
5696 assert(_version == 4)
5697 _type = reader.read("!B")[0]
5698 assert(_type == 4)
5699 _length = reader.read("!H")[0]
5700 orig_reader = reader
5701 reader = orig_reader.slice(_length - (2 + 2))
5702 obj.xid = reader.read("!L")[0]
5703 _experimenter = reader.read("!L")[0]
5704 assert(_experimenter == 6035143)
5705 _subtype = reader.read("!L")[0]
5706 assert(_subtype == 59)
5707 obj.num_aux = reader.read("!L")[0]
5708 obj.status = reader.read("!L")[0]
5709 return obj
5710
5711 def __eq__(self, other):
5712 if type(self) != type(other): return False
5713 if self.xid != other.xid: return False
5714 if self.num_aux != other.num_aux: return False
5715 if self.status != other.status: return False
5716 return True
5717
5718 def pretty_print(self, q):
5719 q.text("bsn_set_aux_cxns_reply {")
5720 with q.group():
5721 with q.indent(2):
5722 q.breakable()
5723 q.text("xid = ");
5724 if self.xid != None:
5725 q.text("%#x" % self.xid)
5726 else:
5727 q.text('None')
5728 q.text(","); q.breakable()
5729 q.text("num_aux = ");
5730 q.text("%#x" % self.num_aux)
5731 q.text(","); q.breakable()
5732 q.text("status = ");
5733 q.text("%#x" % self.status)
5734 q.breakable()
5735 q.text('}')
5736
5737bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
5738
5739class bsn_set_aux_cxns_request(bsn_header):
5740 version = 4
5741 type = 4
5742 experimenter = 6035143
5743 subtype = 58
5744
5745 def __init__(self, xid=None, num_aux=None):
5746 if xid != None:
5747 self.xid = xid
5748 else:
5749 self.xid = None
5750 if num_aux != None:
5751 self.num_aux = num_aux
5752 else:
5753 self.num_aux = 0
5754 return
5755
5756 def pack(self):
5757 packed = []
5758 packed.append(struct.pack("!B", self.version))
5759 packed.append(struct.pack("!B", self.type))
5760 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5761 packed.append(struct.pack("!L", self.xid))
5762 packed.append(struct.pack("!L", self.experimenter))
5763 packed.append(struct.pack("!L", self.subtype))
5764 packed.append(struct.pack("!L", self.num_aux))
5765 length = sum([len(x) for x in packed])
5766 packed[2] = struct.pack("!H", length)
5767 return ''.join(packed)
5768
5769 @staticmethod
5770 def unpack(reader):
5771 obj = bsn_set_aux_cxns_request()
5772 _version = reader.read("!B")[0]
5773 assert(_version == 4)
5774 _type = reader.read("!B")[0]
5775 assert(_type == 4)
5776 _length = reader.read("!H")[0]
5777 orig_reader = reader
5778 reader = orig_reader.slice(_length - (2 + 2))
5779 obj.xid = reader.read("!L")[0]
5780 _experimenter = reader.read("!L")[0]
5781 assert(_experimenter == 6035143)
5782 _subtype = reader.read("!L")[0]
5783 assert(_subtype == 58)
5784 obj.num_aux = reader.read("!L")[0]
5785 return obj
5786
5787 def __eq__(self, other):
5788 if type(self) != type(other): return False
5789 if self.xid != other.xid: return False
5790 if self.num_aux != other.num_aux: return False
5791 return True
5792
5793 def pretty_print(self, q):
5794 q.text("bsn_set_aux_cxns_request {")
5795 with q.group():
5796 with q.indent(2):
5797 q.breakable()
5798 q.text("xid = ");
5799 if self.xid != None:
5800 q.text("%#x" % self.xid)
5801 else:
5802 q.text('None')
5803 q.text(","); q.breakable()
5804 q.text("num_aux = ");
5805 q.text("%#x" % self.num_aux)
5806 q.breakable()
5807 q.text('}')
5808
5809bsn_header.subtypes[58] = bsn_set_aux_cxns_request
5810
Rich Lane7dcdf022013-12-11 14:45:27 -08005811class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005812 version = 4
5813 type = 4
5814 experimenter = 6035143
5815 subtype = 42
5816
5817 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005818 if xid != None:
5819 self.xid = xid
5820 else:
5821 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005822 if status != None:
5823 self.status = status
5824 else:
5825 self.status = 0
5826 if port_no != None:
5827 self.port_no = port_no
5828 else:
5829 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005830 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005831
5832 def pack(self):
5833 packed = []
5834 packed.append(struct.pack("!B", self.version))
5835 packed.append(struct.pack("!B", self.type))
5836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5837 packed.append(struct.pack("!L", self.xid))
5838 packed.append(struct.pack("!L", self.experimenter))
5839 packed.append(struct.pack("!L", self.subtype))
5840 packed.append(struct.pack("!L", self.status))
5841 packed.append(util.pack_port_no(self.port_no))
5842 length = sum([len(x) for x in packed])
5843 packed[2] = struct.pack("!H", length)
5844 return ''.join(packed)
5845
5846 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005847 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005848 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005849 _version = reader.read("!B")[0]
5850 assert(_version == 4)
5851 _type = reader.read("!B")[0]
5852 assert(_type == 4)
5853 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005854 orig_reader = reader
5855 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005856 obj.xid = reader.read("!L")[0]
5857 _experimenter = reader.read("!L")[0]
5858 assert(_experimenter == 6035143)
5859 _subtype = reader.read("!L")[0]
5860 assert(_subtype == 42)
5861 obj.status = reader.read("!L")[0]
5862 obj.port_no = util.unpack_port_no(reader)
5863 return obj
5864
5865 def __eq__(self, other):
5866 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005867 if self.xid != other.xid: return False
5868 if self.status != other.status: return False
5869 if self.port_no != other.port_no: return False
5870 return True
5871
Rich Lane7b0f2012013-11-22 14:15:26 -08005872 def pretty_print(self, q):
5873 q.text("bsn_set_lacp_reply {")
5874 with q.group():
5875 with q.indent(2):
5876 q.breakable()
5877 q.text("xid = ");
5878 if self.xid != None:
5879 q.text("%#x" % self.xid)
5880 else:
5881 q.text('None')
5882 q.text(","); q.breakable()
5883 q.text("status = ");
5884 q.text("%#x" % self.status)
5885 q.text(","); q.breakable()
5886 q.text("port_no = ");
5887 q.text(util.pretty_port(self.port_no))
5888 q.breakable()
5889 q.text('}')
5890
Rich Lane7dcdf022013-12-11 14:45:27 -08005891bsn_header.subtypes[42] = bsn_set_lacp_reply
5892
5893class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005894 version = 4
5895 type = 4
5896 experimenter = 6035143
5897 subtype = 41
5898
5899 def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005900 if xid != None:
5901 self.xid = xid
5902 else:
5903 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005904 if enabled != None:
5905 self.enabled = enabled
5906 else:
5907 self.enabled = 0
5908 if port_no != None:
5909 self.port_no = port_no
5910 else:
5911 self.port_no = 0
5912 if actor_sys_priority != None:
5913 self.actor_sys_priority = actor_sys_priority
5914 else:
5915 self.actor_sys_priority = 0
5916 if actor_sys_mac != None:
5917 self.actor_sys_mac = actor_sys_mac
5918 else:
5919 self.actor_sys_mac = [0,0,0,0,0,0]
5920 if actor_port_priority != None:
5921 self.actor_port_priority = actor_port_priority
5922 else:
5923 self.actor_port_priority = 0
5924 if actor_port_num != None:
5925 self.actor_port_num = actor_port_num
5926 else:
5927 self.actor_port_num = 0
5928 if actor_key != None:
5929 self.actor_key = actor_key
5930 else:
5931 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005932 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005933
5934 def pack(self):
5935 packed = []
5936 packed.append(struct.pack("!B", self.version))
5937 packed.append(struct.pack("!B", self.type))
5938 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5939 packed.append(struct.pack("!L", self.xid))
5940 packed.append(struct.pack("!L", self.experimenter))
5941 packed.append(struct.pack("!L", self.subtype))
5942 packed.append(struct.pack("!B", self.enabled))
5943 packed.append('\x00' * 3)
5944 packed.append(util.pack_port_no(self.port_no))
5945 packed.append(struct.pack("!H", self.actor_sys_priority))
5946 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5947 packed.append(struct.pack("!H", self.actor_port_priority))
5948 packed.append(struct.pack("!H", self.actor_port_num))
5949 packed.append(struct.pack("!H", self.actor_key))
5950 length = sum([len(x) for x in packed])
5951 packed[2] = struct.pack("!H", length)
5952 return ''.join(packed)
5953
5954 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005955 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005956 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005957 _version = reader.read("!B")[0]
5958 assert(_version == 4)
5959 _type = reader.read("!B")[0]
5960 assert(_type == 4)
5961 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005962 orig_reader = reader
5963 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005964 obj.xid = reader.read("!L")[0]
5965 _experimenter = reader.read("!L")[0]
5966 assert(_experimenter == 6035143)
5967 _subtype = reader.read("!L")[0]
5968 assert(_subtype == 41)
5969 obj.enabled = reader.read("!B")[0]
5970 reader.skip(3)
5971 obj.port_no = util.unpack_port_no(reader)
5972 obj.actor_sys_priority = reader.read("!H")[0]
5973 obj.actor_sys_mac = list(reader.read('!6B'))
5974 obj.actor_port_priority = reader.read("!H")[0]
5975 obj.actor_port_num = reader.read("!H")[0]
5976 obj.actor_key = reader.read("!H")[0]
5977 return obj
5978
5979 def __eq__(self, other):
5980 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005981 if self.xid != other.xid: return False
5982 if self.enabled != other.enabled: return False
5983 if self.port_no != other.port_no: return False
5984 if self.actor_sys_priority != other.actor_sys_priority: return False
5985 if self.actor_sys_mac != other.actor_sys_mac: return False
5986 if self.actor_port_priority != other.actor_port_priority: return False
5987 if self.actor_port_num != other.actor_port_num: return False
5988 if self.actor_key != other.actor_key: return False
5989 return True
5990
Rich Lane7b0f2012013-11-22 14:15:26 -08005991 def pretty_print(self, q):
5992 q.text("bsn_set_lacp_request {")
5993 with q.group():
5994 with q.indent(2):
5995 q.breakable()
5996 q.text("xid = ");
5997 if self.xid != None:
5998 q.text("%#x" % self.xid)
5999 else:
6000 q.text('None')
6001 q.text(","); q.breakable()
6002 q.text("enabled = ");
6003 q.text("%#x" % self.enabled)
6004 q.text(","); q.breakable()
6005 q.text("port_no = ");
6006 q.text(util.pretty_port(self.port_no))
6007 q.text(","); q.breakable()
6008 q.text("actor_sys_priority = ");
6009 q.text("%#x" % self.actor_sys_priority)
6010 q.text(","); q.breakable()
6011 q.text("actor_sys_mac = ");
6012 q.text(util.pretty_mac(self.actor_sys_mac))
6013 q.text(","); q.breakable()
6014 q.text("actor_port_priority = ");
6015 q.text("%#x" % self.actor_port_priority)
6016 q.text(","); q.breakable()
6017 q.text("actor_port_num = ");
6018 q.text("%#x" % self.actor_port_num)
6019 q.text(","); q.breakable()
6020 q.text("actor_key = ");
6021 q.text("%#x" % self.actor_key)
6022 q.breakable()
6023 q.text('}')
6024
Rich Lane7dcdf022013-12-11 14:45:27 -08006025bsn_header.subtypes[41] = bsn_set_lacp_request
6026
6027class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006028 version = 4
6029 type = 4
6030 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006031 subtype = 3
6032
6033 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006034 if xid != None:
6035 self.xid = xid
6036 else:
6037 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006038 if report_mirror_ports != None:
6039 self.report_mirror_ports = report_mirror_ports
6040 else:
6041 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006042 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006043
6044 def pack(self):
6045 packed = []
6046 packed.append(struct.pack("!B", self.version))
6047 packed.append(struct.pack("!B", self.type))
6048 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6049 packed.append(struct.pack("!L", self.xid))
6050 packed.append(struct.pack("!L", self.experimenter))
6051 packed.append(struct.pack("!L", self.subtype))
6052 packed.append(struct.pack("!B", self.report_mirror_ports))
6053 packed.append('\x00' * 3)
6054 length = sum([len(x) for x in packed])
6055 packed[2] = struct.pack("!H", length)
6056 return ''.join(packed)
6057
6058 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006059 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006060 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07006061 _version = reader.read("!B")[0]
6062 assert(_version == 4)
6063 _type = reader.read("!B")[0]
6064 assert(_type == 4)
6065 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006066 orig_reader = reader
6067 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006068 obj.xid = reader.read("!L")[0]
6069 _experimenter = reader.read("!L")[0]
6070 assert(_experimenter == 6035143)
6071 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006072 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07006073 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006074 reader.skip(3)
6075 return obj
6076
6077 def __eq__(self, other):
6078 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006079 if self.xid != other.xid: return False
6080 if self.report_mirror_ports != other.report_mirror_ports: return False
6081 return True
6082
Rich Lanec2ee4b82013-04-24 17:12:38 -07006083 def pretty_print(self, q):
6084 q.text("bsn_set_mirroring {")
6085 with q.group():
6086 with q.indent(2):
6087 q.breakable()
6088 q.text("xid = ");
6089 if self.xid != None:
6090 q.text("%#x" % self.xid)
6091 else:
6092 q.text('None')
6093 q.text(","); q.breakable()
6094 q.text("report_mirror_ports = ");
6095 q.text("%#x" % self.report_mirror_ports)
6096 q.breakable()
6097 q.text('}')
6098
Rich Lane7dcdf022013-12-11 14:45:27 -08006099bsn_header.subtypes[3] = bsn_set_mirroring
6100
6101class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006102 version = 4
6103 type = 4
6104 experimenter = 6035143
6105 subtype = 25
6106
6107 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006108 if xid != None:
6109 self.xid = xid
6110 else:
6111 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006112 if status != None:
6113 self.status = status
6114 else:
6115 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006116 return
Dan Talaycof6202252013-07-02 01:00:29 -07006117
6118 def pack(self):
6119 packed = []
6120 packed.append(struct.pack("!B", self.version))
6121 packed.append(struct.pack("!B", self.type))
6122 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6123 packed.append(struct.pack("!L", self.xid))
6124 packed.append(struct.pack("!L", self.experimenter))
6125 packed.append(struct.pack("!L", self.subtype))
6126 packed.append(struct.pack("!L", self.status))
6127 length = sum([len(x) for x in packed])
6128 packed[2] = struct.pack("!H", length)
6129 return ''.join(packed)
6130
6131 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006132 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006133 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006134 _version = reader.read("!B")[0]
6135 assert(_version == 4)
6136 _type = reader.read("!B")[0]
6137 assert(_type == 4)
6138 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006139 orig_reader = reader
6140 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006141 obj.xid = reader.read("!L")[0]
6142 _experimenter = reader.read("!L")[0]
6143 assert(_experimenter == 6035143)
6144 _subtype = reader.read("!L")[0]
6145 assert(_subtype == 25)
6146 obj.status = reader.read("!L")[0]
6147 return obj
6148
6149 def __eq__(self, other):
6150 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006151 if self.xid != other.xid: return False
6152 if self.status != other.status: return False
6153 return True
6154
Dan Talaycof6202252013-07-02 01:00:29 -07006155 def pretty_print(self, q):
6156 q.text("bsn_set_pktin_suppression_reply {")
6157 with q.group():
6158 with q.indent(2):
6159 q.breakable()
6160 q.text("xid = ");
6161 if self.xid != None:
6162 q.text("%#x" % self.xid)
6163 else:
6164 q.text('None')
6165 q.text(","); q.breakable()
6166 q.text("status = ");
6167 q.text("%#x" % self.status)
6168 q.breakable()
6169 q.text('}')
6170
Rich Lane7dcdf022013-12-11 14:45:27 -08006171bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
6172
6173class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006174 version = 4
6175 type = 4
6176 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006177 subtype = 11
6178
6179 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006180 if xid != None:
6181 self.xid = xid
6182 else:
6183 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006184 if enabled != None:
6185 self.enabled = enabled
6186 else:
6187 self.enabled = 0
6188 if idle_timeout != None:
6189 self.idle_timeout = idle_timeout
6190 else:
6191 self.idle_timeout = 0
6192 if hard_timeout != None:
6193 self.hard_timeout = hard_timeout
6194 else:
6195 self.hard_timeout = 0
6196 if priority != None:
6197 self.priority = priority
6198 else:
6199 self.priority = 0
6200 if cookie != None:
6201 self.cookie = cookie
6202 else:
6203 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006204 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006205
6206 def pack(self):
6207 packed = []
6208 packed.append(struct.pack("!B", self.version))
6209 packed.append(struct.pack("!B", self.type))
6210 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6211 packed.append(struct.pack("!L", self.xid))
6212 packed.append(struct.pack("!L", self.experimenter))
6213 packed.append(struct.pack("!L", self.subtype))
6214 packed.append(struct.pack("!B", self.enabled))
6215 packed.append('\x00' * 1)
6216 packed.append(struct.pack("!H", self.idle_timeout))
6217 packed.append(struct.pack("!H", self.hard_timeout))
6218 packed.append(struct.pack("!H", self.priority))
6219 packed.append(struct.pack("!Q", self.cookie))
6220 length = sum([len(x) for x in packed])
6221 packed[2] = struct.pack("!H", length)
6222 return ''.join(packed)
6223
6224 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006225 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006226 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006227 _version = reader.read("!B")[0]
6228 assert(_version == 4)
6229 _type = reader.read("!B")[0]
6230 assert(_type == 4)
6231 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006232 orig_reader = reader
6233 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006234 obj.xid = reader.read("!L")[0]
6235 _experimenter = reader.read("!L")[0]
6236 assert(_experimenter == 6035143)
6237 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006238 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006239 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006240 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07006241 obj.idle_timeout = reader.read("!H")[0]
6242 obj.hard_timeout = reader.read("!H")[0]
6243 obj.priority = reader.read("!H")[0]
6244 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006245 return obj
6246
6247 def __eq__(self, other):
6248 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006249 if self.xid != other.xid: return False
6250 if self.enabled != other.enabled: return False
6251 if self.idle_timeout != other.idle_timeout: return False
6252 if self.hard_timeout != other.hard_timeout: return False
6253 if self.priority != other.priority: return False
6254 if self.cookie != other.cookie: return False
6255 return True
6256
Rich Lanec2ee4b82013-04-24 17:12:38 -07006257 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07006258 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07006259 with q.group():
6260 with q.indent(2):
6261 q.breakable()
6262 q.text("xid = ");
6263 if self.xid != None:
6264 q.text("%#x" % self.xid)
6265 else:
6266 q.text('None')
6267 q.text(","); q.breakable()
6268 q.text("enabled = ");
6269 q.text("%#x" % self.enabled)
6270 q.text(","); q.breakable()
6271 q.text("idle_timeout = ");
6272 q.text("%#x" % self.idle_timeout)
6273 q.text(","); q.breakable()
6274 q.text("hard_timeout = ");
6275 q.text("%#x" % self.hard_timeout)
6276 q.text(","); q.breakable()
6277 q.text("priority = ");
6278 q.text("%#x" % self.priority)
6279 q.text(","); q.breakable()
6280 q.text("cookie = ");
6281 q.text("%#x" % self.cookie)
6282 q.breakable()
6283 q.text('}')
6284
Rich Lane7dcdf022013-12-11 14:45:27 -08006285bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
6286
6287class bsn_set_switch_pipeline_reply(bsn_header):
6288 version = 4
6289 type = 4
6290 experimenter = 6035143
6291 subtype = 54
6292
6293 def __init__(self, xid=None, status=None):
6294 if xid != None:
6295 self.xid = xid
6296 else:
6297 self.xid = None
6298 if status != None:
6299 self.status = status
6300 else:
6301 self.status = 0
6302 return
6303
6304 def pack(self):
6305 packed = []
6306 packed.append(struct.pack("!B", self.version))
6307 packed.append(struct.pack("!B", self.type))
6308 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6309 packed.append(struct.pack("!L", self.xid))
6310 packed.append(struct.pack("!L", self.experimenter))
6311 packed.append(struct.pack("!L", self.subtype))
6312 packed.append(struct.pack("!L", self.status))
6313 length = sum([len(x) for x in packed])
6314 packed[2] = struct.pack("!H", length)
6315 return ''.join(packed)
6316
6317 @staticmethod
6318 def unpack(reader):
6319 obj = bsn_set_switch_pipeline_reply()
6320 _version = reader.read("!B")[0]
6321 assert(_version == 4)
6322 _type = reader.read("!B")[0]
6323 assert(_type == 4)
6324 _length = reader.read("!H")[0]
6325 orig_reader = reader
6326 reader = orig_reader.slice(_length - (2 + 2))
6327 obj.xid = reader.read("!L")[0]
6328 _experimenter = reader.read("!L")[0]
6329 assert(_experimenter == 6035143)
6330 _subtype = reader.read("!L")[0]
6331 assert(_subtype == 54)
6332 obj.status = reader.read("!L")[0]
6333 return obj
6334
6335 def __eq__(self, other):
6336 if type(self) != type(other): return False
6337 if self.xid != other.xid: return False
6338 if self.status != other.status: return False
6339 return True
6340
6341 def pretty_print(self, q):
6342 q.text("bsn_set_switch_pipeline_reply {")
6343 with q.group():
6344 with q.indent(2):
6345 q.breakable()
6346 q.text("xid = ");
6347 if self.xid != None:
6348 q.text("%#x" % self.xid)
6349 else:
6350 q.text('None')
6351 q.text(","); q.breakable()
6352 q.text("status = ");
6353 q.text("%#x" % self.status)
6354 q.breakable()
6355 q.text('}')
6356
6357bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
6358
6359class bsn_set_switch_pipeline_request(bsn_header):
6360 version = 4
6361 type = 4
6362 experimenter = 6035143
6363 subtype = 53
6364
6365 def __init__(self, xid=None, pipeline=None):
6366 if xid != None:
6367 self.xid = xid
6368 else:
6369 self.xid = None
6370 if pipeline != None:
6371 self.pipeline = pipeline
6372 else:
6373 self.pipeline = ""
6374 return
6375
6376 def pack(self):
6377 packed = []
6378 packed.append(struct.pack("!B", self.version))
6379 packed.append(struct.pack("!B", self.type))
6380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6381 packed.append(struct.pack("!L", self.xid))
6382 packed.append(struct.pack("!L", self.experimenter))
6383 packed.append(struct.pack("!L", self.subtype))
6384 packed.append(struct.pack("!256s", self.pipeline))
6385 length = sum([len(x) for x in packed])
6386 packed[2] = struct.pack("!H", length)
6387 return ''.join(packed)
6388
6389 @staticmethod
6390 def unpack(reader):
6391 obj = bsn_set_switch_pipeline_request()
6392 _version = reader.read("!B")[0]
6393 assert(_version == 4)
6394 _type = reader.read("!B")[0]
6395 assert(_type == 4)
6396 _length = reader.read("!H")[0]
6397 orig_reader = reader
6398 reader = orig_reader.slice(_length - (2 + 2))
6399 obj.xid = reader.read("!L")[0]
6400 _experimenter = reader.read("!L")[0]
6401 assert(_experimenter == 6035143)
6402 _subtype = reader.read("!L")[0]
6403 assert(_subtype == 53)
6404 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
6405 return obj
6406
6407 def __eq__(self, other):
6408 if type(self) != type(other): return False
6409 if self.xid != other.xid: return False
6410 if self.pipeline != other.pipeline: return False
6411 return True
6412
6413 def pretty_print(self, q):
6414 q.text("bsn_set_switch_pipeline_request {")
6415 with q.group():
6416 with q.indent(2):
6417 q.breakable()
6418 q.text("xid = ");
6419 if self.xid != None:
6420 q.text("%#x" % self.xid)
6421 else:
6422 q.text('None')
6423 q.text(","); q.breakable()
6424 q.text("pipeline = ");
6425 q.pp(self.pipeline)
6426 q.breakable()
6427 q.text('}')
6428
6429bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
6430
6431class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
6432 version = 4
6433 type = 19
6434 stats_type = 65535
6435 experimenter = 6035143
6436 subtype = 6
6437
6438 def __init__(self, xid=None, flags=None, entries=None):
6439 if xid != None:
6440 self.xid = xid
6441 else:
6442 self.xid = None
6443 if flags != None:
6444 self.flags = flags
6445 else:
6446 self.flags = 0
6447 if entries != None:
6448 self.entries = entries
6449 else:
6450 self.entries = []
6451 return
6452
6453 def pack(self):
6454 packed = []
6455 packed.append(struct.pack("!B", self.version))
6456 packed.append(struct.pack("!B", self.type))
6457 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6458 packed.append(struct.pack("!L", self.xid))
6459 packed.append(struct.pack("!H", self.stats_type))
6460 packed.append(struct.pack("!H", self.flags))
6461 packed.append('\x00' * 4)
6462 packed.append(struct.pack("!L", self.experimenter))
6463 packed.append(struct.pack("!L", self.subtype))
6464 packed.append(loxi.generic_util.pack_list(self.entries))
6465 length = sum([len(x) for x in packed])
6466 packed[2] = struct.pack("!H", length)
6467 return ''.join(packed)
6468
6469 @staticmethod
6470 def unpack(reader):
6471 obj = bsn_switch_pipeline_stats_reply()
6472 _version = reader.read("!B")[0]
6473 assert(_version == 4)
6474 _type = reader.read("!B")[0]
6475 assert(_type == 19)
6476 _length = reader.read("!H")[0]
6477 orig_reader = reader
6478 reader = orig_reader.slice(_length - (2 + 2))
6479 obj.xid = reader.read("!L")[0]
6480 _stats_type = reader.read("!H")[0]
6481 assert(_stats_type == 65535)
6482 obj.flags = reader.read("!H")[0]
6483 reader.skip(4)
6484 _experimenter = reader.read("!L")[0]
6485 assert(_experimenter == 6035143)
6486 _subtype = reader.read("!L")[0]
6487 assert(_subtype == 6)
6488 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
6489 return obj
6490
6491 def __eq__(self, other):
6492 if type(self) != type(other): return False
6493 if self.xid != other.xid: return False
6494 if self.flags != other.flags: return False
6495 if self.entries != other.entries: return False
6496 return True
6497
6498 def pretty_print(self, q):
6499 q.text("bsn_switch_pipeline_stats_reply {")
6500 with q.group():
6501 with q.indent(2):
6502 q.breakable()
6503 q.text("xid = ");
6504 if self.xid != None:
6505 q.text("%#x" % self.xid)
6506 else:
6507 q.text('None')
6508 q.text(","); q.breakable()
6509 q.text("flags = ");
6510 q.text("%#x" % self.flags)
6511 q.text(","); q.breakable()
6512 q.text("entries = ");
6513 q.pp(self.entries)
6514 q.breakable()
6515 q.text('}')
6516
6517bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
6518
6519class bsn_switch_pipeline_stats_request(bsn_stats_request):
6520 version = 4
6521 type = 18
6522 stats_type = 65535
6523 experimenter = 6035143
6524 subtype = 6
6525
6526 def __init__(self, xid=None, flags=None):
6527 if xid != None:
6528 self.xid = xid
6529 else:
6530 self.xid = None
6531 if flags != None:
6532 self.flags = flags
6533 else:
6534 self.flags = 0
6535 return
6536
6537 def pack(self):
6538 packed = []
6539 packed.append(struct.pack("!B", self.version))
6540 packed.append(struct.pack("!B", self.type))
6541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6542 packed.append(struct.pack("!L", self.xid))
6543 packed.append(struct.pack("!H", self.stats_type))
6544 packed.append(struct.pack("!H", self.flags))
6545 packed.append('\x00' * 4)
6546 packed.append(struct.pack("!L", self.experimenter))
6547 packed.append(struct.pack("!L", self.subtype))
6548 length = sum([len(x) for x in packed])
6549 packed[2] = struct.pack("!H", length)
6550 return ''.join(packed)
6551
6552 @staticmethod
6553 def unpack(reader):
6554 obj = bsn_switch_pipeline_stats_request()
6555 _version = reader.read("!B")[0]
6556 assert(_version == 4)
6557 _type = reader.read("!B")[0]
6558 assert(_type == 18)
6559 _length = reader.read("!H")[0]
6560 orig_reader = reader
6561 reader = orig_reader.slice(_length - (2 + 2))
6562 obj.xid = reader.read("!L")[0]
6563 _stats_type = reader.read("!H")[0]
6564 assert(_stats_type == 65535)
6565 obj.flags = reader.read("!H")[0]
6566 reader.skip(4)
6567 _experimenter = reader.read("!L")[0]
6568 assert(_experimenter == 6035143)
6569 _subtype = reader.read("!L")[0]
6570 assert(_subtype == 6)
6571 return obj
6572
6573 def __eq__(self, other):
6574 if type(self) != type(other): return False
6575 if self.xid != other.xid: return False
6576 if self.flags != other.flags: return False
6577 return True
6578
6579 def pretty_print(self, q):
6580 q.text("bsn_switch_pipeline_stats_request {")
6581 with q.group():
6582 with q.indent(2):
6583 q.breakable()
6584 q.text("xid = ");
6585 if self.xid != None:
6586 q.text("%#x" % self.xid)
6587 else:
6588 q.text('None')
6589 q.text(","); q.breakable()
6590 q.text("flags = ");
6591 q.text("%#x" % self.flags)
6592 q.breakable()
6593 q.text('}')
6594
6595bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
6596
6597class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006598 version = 4
6599 type = 4
6600 experimenter = 6035143
6601 subtype = 45
6602
6603 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006604 if xid != None:
6605 self.xid = xid
6606 else:
6607 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006608 if time_ms != None:
6609 self.time_ms = time_ms
6610 else:
6611 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006612 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006613
6614 def pack(self):
6615 packed = []
6616 packed.append(struct.pack("!B", self.version))
6617 packed.append(struct.pack("!B", self.type))
6618 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6619 packed.append(struct.pack("!L", self.xid))
6620 packed.append(struct.pack("!L", self.experimenter))
6621 packed.append(struct.pack("!L", self.subtype))
6622 packed.append(struct.pack("!Q", self.time_ms))
6623 length = sum([len(x) for x in packed])
6624 packed[2] = struct.pack("!H", length)
6625 return ''.join(packed)
6626
6627 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006628 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006629 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08006630 _version = reader.read("!B")[0]
6631 assert(_version == 4)
6632 _type = reader.read("!B")[0]
6633 assert(_type == 4)
6634 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006635 orig_reader = reader
6636 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006637 obj.xid = reader.read("!L")[0]
6638 _experimenter = reader.read("!L")[0]
6639 assert(_experimenter == 6035143)
6640 _subtype = reader.read("!L")[0]
6641 assert(_subtype == 45)
6642 obj.time_ms = reader.read("!Q")[0]
6643 return obj
6644
6645 def __eq__(self, other):
6646 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006647 if self.xid != other.xid: return False
6648 if self.time_ms != other.time_ms: return False
6649 return True
6650
Rich Lane7b0f2012013-11-22 14:15:26 -08006651 def pretty_print(self, q):
6652 q.text("bsn_time_reply {")
6653 with q.group():
6654 with q.indent(2):
6655 q.breakable()
6656 q.text("xid = ");
6657 if self.xid != None:
6658 q.text("%#x" % self.xid)
6659 else:
6660 q.text('None')
6661 q.text(","); q.breakable()
6662 q.text("time_ms = ");
6663 q.text("%#x" % self.time_ms)
6664 q.breakable()
6665 q.text('}')
6666
Rich Lane7dcdf022013-12-11 14:45:27 -08006667bsn_header.subtypes[45] = bsn_time_reply
6668
6669class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006670 version = 4
6671 type = 4
6672 experimenter = 6035143
6673 subtype = 44
6674
6675 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006676 if xid != None:
6677 self.xid = xid
6678 else:
6679 self.xid = None
6680 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006681
6682 def pack(self):
6683 packed = []
6684 packed.append(struct.pack("!B", self.version))
6685 packed.append(struct.pack("!B", self.type))
6686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6687 packed.append(struct.pack("!L", self.xid))
6688 packed.append(struct.pack("!L", self.experimenter))
6689 packed.append(struct.pack("!L", self.subtype))
6690 length = sum([len(x) for x in packed])
6691 packed[2] = struct.pack("!H", length)
6692 return ''.join(packed)
6693
6694 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006695 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006696 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006697 _version = reader.read("!B")[0]
6698 assert(_version == 4)
6699 _type = reader.read("!B")[0]
6700 assert(_type == 4)
6701 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006702 orig_reader = reader
6703 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006704 obj.xid = reader.read("!L")[0]
6705 _experimenter = reader.read("!L")[0]
6706 assert(_experimenter == 6035143)
6707 _subtype = reader.read("!L")[0]
6708 assert(_subtype == 44)
6709 return obj
6710
6711 def __eq__(self, other):
6712 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006713 if self.xid != other.xid: return False
6714 return True
6715
Rich Lane7b0f2012013-11-22 14:15:26 -08006716 def pretty_print(self, q):
6717 q.text("bsn_time_request {")
6718 with q.group():
6719 with q.indent(2):
6720 q.breakable()
6721 q.text("xid = ");
6722 if self.xid != None:
6723 q.text("%#x" % self.xid)
6724 else:
6725 q.text('None')
6726 q.breakable()
6727 q.text('}')
6728
Rich Lane7dcdf022013-12-11 14:45:27 -08006729bsn_header.subtypes[44] = bsn_time_request
6730
6731class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006732 version = 4
6733 type = 4
6734 experimenter = 6035143
6735 subtype = 16
6736
6737 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006738 if xid != None:
6739 self.xid = xid
6740 else:
6741 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006742 if status != None:
6743 self.status = status
6744 else:
6745 self.status = 0
6746 if vport_no != None:
6747 self.vport_no = vport_no
6748 else:
6749 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006750 return
Dan Talaycof6202252013-07-02 01:00:29 -07006751
6752 def pack(self):
6753 packed = []
6754 packed.append(struct.pack("!B", self.version))
6755 packed.append(struct.pack("!B", self.type))
6756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6757 packed.append(struct.pack("!L", self.xid))
6758 packed.append(struct.pack("!L", self.experimenter))
6759 packed.append(struct.pack("!L", self.subtype))
6760 packed.append(struct.pack("!L", self.status))
6761 packed.append(struct.pack("!L", self.vport_no))
6762 length = sum([len(x) for x in packed])
6763 packed[2] = struct.pack("!H", length)
6764 return ''.join(packed)
6765
6766 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006767 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006768 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006769 _version = reader.read("!B")[0]
6770 assert(_version == 4)
6771 _type = reader.read("!B")[0]
6772 assert(_type == 4)
6773 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006774 orig_reader = reader
6775 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006776 obj.xid = reader.read("!L")[0]
6777 _experimenter = reader.read("!L")[0]
6778 assert(_experimenter == 6035143)
6779 _subtype = reader.read("!L")[0]
6780 assert(_subtype == 16)
6781 obj.status = reader.read("!L")[0]
6782 obj.vport_no = reader.read("!L")[0]
6783 return obj
6784
6785 def __eq__(self, other):
6786 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006787 if self.xid != other.xid: return False
6788 if self.status != other.status: return False
6789 if self.vport_no != other.vport_no: return False
6790 return True
6791
Dan Talaycof6202252013-07-02 01:00:29 -07006792 def pretty_print(self, q):
6793 q.text("bsn_virtual_port_create_reply {")
6794 with q.group():
6795 with q.indent(2):
6796 q.breakable()
6797 q.text("xid = ");
6798 if self.xid != None:
6799 q.text("%#x" % self.xid)
6800 else:
6801 q.text('None')
6802 q.text(","); q.breakable()
6803 q.text("status = ");
6804 q.text("%#x" % self.status)
6805 q.text(","); q.breakable()
6806 q.text("vport_no = ");
6807 q.text("%#x" % self.vport_no)
6808 q.breakable()
6809 q.text('}')
6810
Rich Lane7dcdf022013-12-11 14:45:27 -08006811bsn_header.subtypes[16] = bsn_virtual_port_create_reply
6812
6813class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006814 version = 4
6815 type = 4
6816 experimenter = 6035143
6817 subtype = 15
6818
6819 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006820 if xid != None:
6821 self.xid = xid
6822 else:
6823 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006824 if vport != None:
6825 self.vport = vport
6826 else:
6827 self.vport = common.bsn_vport_q_in_q()
Rich Lane7dcdf022013-12-11 14:45:27 -08006828 return
Dan Talaycof6202252013-07-02 01:00:29 -07006829
6830 def pack(self):
6831 packed = []
6832 packed.append(struct.pack("!B", self.version))
6833 packed.append(struct.pack("!B", self.type))
6834 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6835 packed.append(struct.pack("!L", self.xid))
6836 packed.append(struct.pack("!L", self.experimenter))
6837 packed.append(struct.pack("!L", self.subtype))
6838 packed.append(self.vport.pack())
6839 length = sum([len(x) for x in packed])
6840 packed[2] = struct.pack("!H", length)
6841 return ''.join(packed)
6842
6843 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006844 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006845 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006846 _version = reader.read("!B")[0]
6847 assert(_version == 4)
6848 _type = reader.read("!B")[0]
6849 assert(_type == 4)
6850 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006851 orig_reader = reader
6852 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006853 obj.xid = reader.read("!L")[0]
6854 _experimenter = reader.read("!L")[0]
6855 assert(_experimenter == 6035143)
6856 _subtype = reader.read("!L")[0]
6857 assert(_subtype == 15)
6858 obj.vport = common.bsn_vport_q_in_q.unpack(reader)
6859 return obj
6860
6861 def __eq__(self, other):
6862 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006863 if self.xid != other.xid: return False
6864 if self.vport != other.vport: return False
6865 return True
6866
Dan Talaycof6202252013-07-02 01:00:29 -07006867 def pretty_print(self, q):
6868 q.text("bsn_virtual_port_create_request {")
6869 with q.group():
6870 with q.indent(2):
6871 q.breakable()
6872 q.text("xid = ");
6873 if self.xid != None:
6874 q.text("%#x" % self.xid)
6875 else:
6876 q.text('None')
6877 q.text(","); q.breakable()
6878 q.text("vport = ");
6879 q.pp(self.vport)
6880 q.breakable()
6881 q.text('}')
6882
Rich Lane7dcdf022013-12-11 14:45:27 -08006883bsn_header.subtypes[15] = bsn_virtual_port_create_request
6884
6885class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006886 version = 4
6887 type = 4
6888 experimenter = 6035143
6889 subtype = 26
6890
6891 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006892 if xid != None:
6893 self.xid = xid
6894 else:
6895 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006896 if status != None:
6897 self.status = status
6898 else:
6899 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006900 return
Dan Talaycof6202252013-07-02 01:00:29 -07006901
6902 def pack(self):
6903 packed = []
6904 packed.append(struct.pack("!B", self.version))
6905 packed.append(struct.pack("!B", self.type))
6906 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6907 packed.append(struct.pack("!L", self.xid))
6908 packed.append(struct.pack("!L", self.experimenter))
6909 packed.append(struct.pack("!L", self.subtype))
6910 packed.append(struct.pack("!L", self.status))
6911 length = sum([len(x) for x in packed])
6912 packed[2] = struct.pack("!H", length)
6913 return ''.join(packed)
6914
6915 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006916 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006917 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006918 _version = reader.read("!B")[0]
6919 assert(_version == 4)
6920 _type = reader.read("!B")[0]
6921 assert(_type == 4)
6922 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006923 orig_reader = reader
6924 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006925 obj.xid = reader.read("!L")[0]
6926 _experimenter = reader.read("!L")[0]
6927 assert(_experimenter == 6035143)
6928 _subtype = reader.read("!L")[0]
6929 assert(_subtype == 26)
6930 obj.status = reader.read("!L")[0]
6931 return obj
6932
6933 def __eq__(self, other):
6934 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006935 if self.xid != other.xid: return False
6936 if self.status != other.status: return False
6937 return True
6938
Dan Talaycof6202252013-07-02 01:00:29 -07006939 def pretty_print(self, q):
6940 q.text("bsn_virtual_port_remove_reply {")
6941 with q.group():
6942 with q.indent(2):
6943 q.breakable()
6944 q.text("xid = ");
6945 if self.xid != None:
6946 q.text("%#x" % self.xid)
6947 else:
6948 q.text('None')
6949 q.text(","); q.breakable()
6950 q.text("status = ");
6951 q.text("%#x" % self.status)
6952 q.breakable()
6953 q.text('}')
6954
Rich Lane7dcdf022013-12-11 14:45:27 -08006955bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
6956
6957class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006958 version = 4
6959 type = 4
6960 experimenter = 6035143
6961 subtype = 17
6962
6963 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006964 if xid != None:
6965 self.xid = xid
6966 else:
6967 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006968 if vport_no != None:
6969 self.vport_no = vport_no
6970 else:
6971 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006972 return
Dan Talaycof6202252013-07-02 01:00:29 -07006973
6974 def pack(self):
6975 packed = []
6976 packed.append(struct.pack("!B", self.version))
6977 packed.append(struct.pack("!B", self.type))
6978 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6979 packed.append(struct.pack("!L", self.xid))
6980 packed.append(struct.pack("!L", self.experimenter))
6981 packed.append(struct.pack("!L", self.subtype))
6982 packed.append(struct.pack("!L", self.vport_no))
6983 length = sum([len(x) for x in packed])
6984 packed[2] = struct.pack("!H", length)
6985 return ''.join(packed)
6986
6987 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006988 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006989 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006990 _version = reader.read("!B")[0]
6991 assert(_version == 4)
6992 _type = reader.read("!B")[0]
6993 assert(_type == 4)
6994 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006995 orig_reader = reader
6996 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006997 obj.xid = reader.read("!L")[0]
6998 _experimenter = reader.read("!L")[0]
6999 assert(_experimenter == 6035143)
7000 _subtype = reader.read("!L")[0]
7001 assert(_subtype == 17)
7002 obj.vport_no = reader.read("!L")[0]
7003 return obj
7004
7005 def __eq__(self, other):
7006 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007007 if self.xid != other.xid: return False
7008 if self.vport_no != other.vport_no: return False
7009 return True
7010
Dan Talaycof6202252013-07-02 01:00:29 -07007011 def pretty_print(self, q):
7012 q.text("bsn_virtual_port_remove_request {")
7013 with q.group():
7014 with q.indent(2):
7015 q.breakable()
7016 q.text("xid = ");
7017 if self.xid != None:
7018 q.text("%#x" % self.xid)
7019 else:
7020 q.text('None')
7021 q.text(","); q.breakable()
7022 q.text("vport_no = ");
7023 q.text("%#x" % self.vport_no)
7024 q.breakable()
7025 q.text('}')
7026
Rich Lane7dcdf022013-12-11 14:45:27 -08007027bsn_header.subtypes[17] = bsn_virtual_port_remove_request
7028
7029class bsn_vlan_counter_stats_reply(bsn_stats_reply):
7030 version = 4
7031 type = 19
7032 stats_type = 65535
7033 experimenter = 6035143
7034 subtype = 9
7035
7036 def __init__(self, xid=None, flags=None, entries=None):
7037 if xid != None:
7038 self.xid = xid
7039 else:
7040 self.xid = None
7041 if flags != None:
7042 self.flags = flags
7043 else:
7044 self.flags = 0
7045 if entries != None:
7046 self.entries = entries
7047 else:
7048 self.entries = []
7049 return
7050
7051 def pack(self):
7052 packed = []
7053 packed.append(struct.pack("!B", self.version))
7054 packed.append(struct.pack("!B", self.type))
7055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7056 packed.append(struct.pack("!L", self.xid))
7057 packed.append(struct.pack("!H", self.stats_type))
7058 packed.append(struct.pack("!H", self.flags))
7059 packed.append('\x00' * 4)
7060 packed.append(struct.pack("!L", self.experimenter))
7061 packed.append(struct.pack("!L", self.subtype))
7062 packed.append(loxi.generic_util.pack_list(self.entries))
7063 length = sum([len(x) for x in packed])
7064 packed[2] = struct.pack("!H", length)
7065 return ''.join(packed)
7066
7067 @staticmethod
7068 def unpack(reader):
7069 obj = bsn_vlan_counter_stats_reply()
7070 _version = reader.read("!B")[0]
7071 assert(_version == 4)
7072 _type = reader.read("!B")[0]
7073 assert(_type == 19)
7074 _length = reader.read("!H")[0]
7075 orig_reader = reader
7076 reader = orig_reader.slice(_length - (2 + 2))
7077 obj.xid = reader.read("!L")[0]
7078 _stats_type = reader.read("!H")[0]
7079 assert(_stats_type == 65535)
7080 obj.flags = reader.read("!H")[0]
7081 reader.skip(4)
7082 _experimenter = reader.read("!L")[0]
7083 assert(_experimenter == 6035143)
7084 _subtype = reader.read("!L")[0]
7085 assert(_subtype == 9)
7086 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
7087 return obj
7088
7089 def __eq__(self, other):
7090 if type(self) != type(other): return False
7091 if self.xid != other.xid: return False
7092 if self.flags != other.flags: return False
7093 if self.entries != other.entries: return False
7094 return True
7095
7096 def pretty_print(self, q):
7097 q.text("bsn_vlan_counter_stats_reply {")
7098 with q.group():
7099 with q.indent(2):
7100 q.breakable()
7101 q.text("xid = ");
7102 if self.xid != None:
7103 q.text("%#x" % self.xid)
7104 else:
7105 q.text('None')
7106 q.text(","); q.breakable()
7107 q.text("flags = ");
7108 q.text("%#x" % self.flags)
7109 q.text(","); q.breakable()
7110 q.text("entries = ");
7111 q.pp(self.entries)
7112 q.breakable()
7113 q.text('}')
7114
7115bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
7116
7117class bsn_vlan_counter_stats_request(bsn_stats_request):
7118 version = 4
7119 type = 18
7120 stats_type = 65535
7121 experimenter = 6035143
7122 subtype = 9
7123
7124 def __init__(self, xid=None, flags=None, vlan_vid=None):
7125 if xid != None:
7126 self.xid = xid
7127 else:
7128 self.xid = None
7129 if flags != None:
7130 self.flags = flags
7131 else:
7132 self.flags = 0
7133 if vlan_vid != None:
7134 self.vlan_vid = vlan_vid
7135 else:
7136 self.vlan_vid = 0
7137 return
7138
7139 def pack(self):
7140 packed = []
7141 packed.append(struct.pack("!B", self.version))
7142 packed.append(struct.pack("!B", self.type))
7143 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7144 packed.append(struct.pack("!L", self.xid))
7145 packed.append(struct.pack("!H", self.stats_type))
7146 packed.append(struct.pack("!H", self.flags))
7147 packed.append('\x00' * 4)
7148 packed.append(struct.pack("!L", self.experimenter))
7149 packed.append(struct.pack("!L", self.subtype))
7150 packed.append(struct.pack("!H", self.vlan_vid))
7151 length = sum([len(x) for x in packed])
7152 packed[2] = struct.pack("!H", length)
7153 return ''.join(packed)
7154
7155 @staticmethod
7156 def unpack(reader):
7157 obj = bsn_vlan_counter_stats_request()
7158 _version = reader.read("!B")[0]
7159 assert(_version == 4)
7160 _type = reader.read("!B")[0]
7161 assert(_type == 18)
7162 _length = reader.read("!H")[0]
7163 orig_reader = reader
7164 reader = orig_reader.slice(_length - (2 + 2))
7165 obj.xid = reader.read("!L")[0]
7166 _stats_type = reader.read("!H")[0]
7167 assert(_stats_type == 65535)
7168 obj.flags = reader.read("!H")[0]
7169 reader.skip(4)
7170 _experimenter = reader.read("!L")[0]
7171 assert(_experimenter == 6035143)
7172 _subtype = reader.read("!L")[0]
7173 assert(_subtype == 9)
7174 obj.vlan_vid = reader.read("!H")[0]
7175 return obj
7176
7177 def __eq__(self, other):
7178 if type(self) != type(other): return False
7179 if self.xid != other.xid: return False
7180 if self.flags != other.flags: return False
7181 if self.vlan_vid != other.vlan_vid: return False
7182 return True
7183
7184 def pretty_print(self, q):
7185 q.text("bsn_vlan_counter_stats_request {")
7186 with q.group():
7187 with q.indent(2):
7188 q.breakable()
7189 q.text("xid = ");
7190 if self.xid != None:
7191 q.text("%#x" % self.xid)
7192 else:
7193 q.text('None')
7194 q.text(","); q.breakable()
7195 q.text("flags = ");
7196 q.text("%#x" % self.flags)
7197 q.text(","); q.breakable()
7198 q.text("vlan_vid = ");
7199 q.text("%#x" % self.vlan_vid)
7200 q.breakable()
7201 q.text('}')
7202
7203bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
7204
7205class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007206 version = 4
7207 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007208 stats_type = 0
7209
7210 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 -08007211 if xid != None:
7212 self.xid = xid
7213 else:
7214 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007215 if flags != None:
7216 self.flags = flags
7217 else:
7218 self.flags = 0
7219 if mfr_desc != None:
7220 self.mfr_desc = mfr_desc
7221 else:
7222 self.mfr_desc = ""
7223 if hw_desc != None:
7224 self.hw_desc = hw_desc
7225 else:
7226 self.hw_desc = ""
7227 if sw_desc != None:
7228 self.sw_desc = sw_desc
7229 else:
7230 self.sw_desc = ""
7231 if serial_num != None:
7232 self.serial_num = serial_num
7233 else:
7234 self.serial_num = ""
7235 if dp_desc != None:
7236 self.dp_desc = dp_desc
7237 else:
7238 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08007239 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007240
7241 def pack(self):
7242 packed = []
7243 packed.append(struct.pack("!B", self.version))
7244 packed.append(struct.pack("!B", self.type))
7245 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7246 packed.append(struct.pack("!L", self.xid))
7247 packed.append(struct.pack("!H", self.stats_type))
7248 packed.append(struct.pack("!H", self.flags))
7249 packed.append('\x00' * 4)
7250 packed.append(struct.pack("!256s", self.mfr_desc))
7251 packed.append(struct.pack("!256s", self.hw_desc))
7252 packed.append(struct.pack("!256s", self.sw_desc))
7253 packed.append(struct.pack("!32s", self.serial_num))
7254 packed.append(struct.pack("!256s", self.dp_desc))
7255 length = sum([len(x) for x in packed])
7256 packed[2] = struct.pack("!H", length)
7257 return ''.join(packed)
7258
7259 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007260 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007261 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007262 _version = reader.read("!B")[0]
7263 assert(_version == 4)
7264 _type = reader.read("!B")[0]
7265 assert(_type == 19)
7266 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007267 orig_reader = reader
7268 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007269 obj.xid = reader.read("!L")[0]
7270 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007271 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007272 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007273 reader.skip(4)
7274 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
7275 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
7276 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
7277 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
7278 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
7279 return obj
7280
7281 def __eq__(self, other):
7282 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007283 if self.xid != other.xid: return False
7284 if self.flags != other.flags: return False
7285 if self.mfr_desc != other.mfr_desc: return False
7286 if self.hw_desc != other.hw_desc: return False
7287 if self.sw_desc != other.sw_desc: return False
7288 if self.serial_num != other.serial_num: return False
7289 if self.dp_desc != other.dp_desc: return False
7290 return True
7291
Rich Lanec2ee4b82013-04-24 17:12:38 -07007292 def pretty_print(self, q):
7293 q.text("desc_stats_reply {")
7294 with q.group():
7295 with q.indent(2):
7296 q.breakable()
7297 q.text("xid = ");
7298 if self.xid != None:
7299 q.text("%#x" % self.xid)
7300 else:
7301 q.text('None')
7302 q.text(","); q.breakable()
7303 q.text("flags = ");
7304 q.text("%#x" % self.flags)
7305 q.text(","); q.breakable()
7306 q.text("mfr_desc = ");
7307 q.pp(self.mfr_desc)
7308 q.text(","); q.breakable()
7309 q.text("hw_desc = ");
7310 q.pp(self.hw_desc)
7311 q.text(","); q.breakable()
7312 q.text("sw_desc = ");
7313 q.pp(self.sw_desc)
7314 q.text(","); q.breakable()
7315 q.text("serial_num = ");
7316 q.pp(self.serial_num)
7317 q.text(","); q.breakable()
7318 q.text("dp_desc = ");
7319 q.pp(self.dp_desc)
7320 q.breakable()
7321 q.text('}')
7322
Rich Lane7dcdf022013-12-11 14:45:27 -08007323stats_reply.subtypes[0] = desc_stats_reply
7324
7325class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007326 version = 4
7327 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007328 stats_type = 0
7329
7330 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007331 if xid != None:
7332 self.xid = xid
7333 else:
7334 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007335 if flags != None:
7336 self.flags = flags
7337 else:
7338 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007339 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007340
7341 def pack(self):
7342 packed = []
7343 packed.append(struct.pack("!B", self.version))
7344 packed.append(struct.pack("!B", self.type))
7345 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7346 packed.append(struct.pack("!L", self.xid))
7347 packed.append(struct.pack("!H", self.stats_type))
7348 packed.append(struct.pack("!H", self.flags))
7349 packed.append('\x00' * 4)
7350 length = sum([len(x) for x in packed])
7351 packed[2] = struct.pack("!H", length)
7352 return ''.join(packed)
7353
7354 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007355 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007356 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007357 _version = reader.read("!B")[0]
7358 assert(_version == 4)
7359 _type = reader.read("!B")[0]
7360 assert(_type == 18)
7361 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007362 orig_reader = reader
7363 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007364 obj.xid = reader.read("!L")[0]
7365 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007366 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007367 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007368 reader.skip(4)
7369 return obj
7370
7371 def __eq__(self, other):
7372 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007373 if self.xid != other.xid: return False
7374 if self.flags != other.flags: return False
7375 return True
7376
Rich Lanec2ee4b82013-04-24 17:12:38 -07007377 def pretty_print(self, q):
7378 q.text("desc_stats_request {")
7379 with q.group():
7380 with q.indent(2):
7381 q.breakable()
7382 q.text("xid = ");
7383 if self.xid != None:
7384 q.text("%#x" % self.xid)
7385 else:
7386 q.text('None')
7387 q.text(","); q.breakable()
7388 q.text("flags = ");
7389 q.text("%#x" % self.flags)
7390 q.breakable()
7391 q.text('}')
7392
Rich Lane7dcdf022013-12-11 14:45:27 -08007393stats_request.subtypes[0] = desc_stats_request
7394
7395class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007396 version = 4
7397 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007398
7399 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007400 if xid != None:
7401 self.xid = xid
7402 else:
7403 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007404 if data != None:
7405 self.data = data
7406 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007407 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007408 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007409
7410 def pack(self):
7411 packed = []
7412 packed.append(struct.pack("!B", self.version))
7413 packed.append(struct.pack("!B", self.type))
7414 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7415 packed.append(struct.pack("!L", self.xid))
7416 packed.append(self.data)
7417 length = sum([len(x) for x in packed])
7418 packed[2] = struct.pack("!H", length)
7419 return ''.join(packed)
7420
7421 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007422 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007423 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007424 _version = reader.read("!B")[0]
7425 assert(_version == 4)
7426 _type = reader.read("!B")[0]
7427 assert(_type == 3)
7428 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007429 orig_reader = reader
7430 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007431 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007432 obj.data = str(reader.read_all())
7433 return obj
7434
7435 def __eq__(self, other):
7436 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007437 if self.xid != other.xid: return False
7438 if self.data != other.data: return False
7439 return True
7440
Rich Lanec2ee4b82013-04-24 17:12:38 -07007441 def pretty_print(self, q):
7442 q.text("echo_reply {")
7443 with q.group():
7444 with q.indent(2):
7445 q.breakable()
7446 q.text("xid = ");
7447 if self.xid != None:
7448 q.text("%#x" % self.xid)
7449 else:
7450 q.text('None')
7451 q.text(","); q.breakable()
7452 q.text("data = ");
7453 q.pp(self.data)
7454 q.breakable()
7455 q.text('}')
7456
Rich Lane7dcdf022013-12-11 14:45:27 -08007457message.subtypes[3] = echo_reply
7458
7459class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007460 version = 4
7461 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07007462
7463 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007464 if xid != None:
7465 self.xid = xid
7466 else:
7467 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007468 if data != None:
7469 self.data = data
7470 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007471 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007472 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007473
7474 def pack(self):
7475 packed = []
7476 packed.append(struct.pack("!B", self.version))
7477 packed.append(struct.pack("!B", self.type))
7478 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7479 packed.append(struct.pack("!L", self.xid))
7480 packed.append(self.data)
7481 length = sum([len(x) for x in packed])
7482 packed[2] = struct.pack("!H", length)
7483 return ''.join(packed)
7484
7485 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007486 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007487 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007488 _version = reader.read("!B")[0]
7489 assert(_version == 4)
7490 _type = reader.read("!B")[0]
7491 assert(_type == 2)
7492 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007493 orig_reader = reader
7494 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007495 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007496 obj.data = str(reader.read_all())
7497 return obj
7498
7499 def __eq__(self, other):
7500 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007501 if self.xid != other.xid: return False
7502 if self.data != other.data: return False
7503 return True
7504
Rich Lanec2ee4b82013-04-24 17:12:38 -07007505 def pretty_print(self, q):
7506 q.text("echo_request {")
7507 with q.group():
7508 with q.indent(2):
7509 q.breakable()
7510 q.text("xid = ");
7511 if self.xid != None:
7512 q.text("%#x" % self.xid)
7513 else:
7514 q.text('None')
7515 q.text(","); q.breakable()
7516 q.text("data = ");
7517 q.pp(self.data)
7518 q.breakable()
7519 q.text('}')
7520
Rich Lane7dcdf022013-12-11 14:45:27 -08007521message.subtypes[2] = echo_request
7522
7523class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07007524 version = 4
7525 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07007526 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07007527
Rich Lane6f4978c2013-10-20 21:33:52 -07007528 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007529 if xid != None:
7530 self.xid = xid
7531 else:
7532 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007533 if subtype != None:
7534 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07007535 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07007536 self.subtype = 0
7537 if experimenter != None:
7538 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07007539 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07007540 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07007541 if data != None:
7542 self.data = data
7543 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007544 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007545 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007546
7547 def pack(self):
7548 packed = []
7549 packed.append(struct.pack("!B", self.version))
7550 packed.append(struct.pack("!B", self.type))
7551 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7552 packed.append(struct.pack("!L", self.xid))
7553 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07007554 packed.append(struct.pack("!H", self.subtype))
7555 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007556 packed.append(self.data)
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 Lane6f4978c2013-10-20 21:33:52 -07007563 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07007564 _version = reader.read("!B")[0]
7565 assert(_version == 4)
7566 _type = reader.read("!B")[0]
7567 assert(_type == 1)
7568 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007569 orig_reader = reader
7570 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007571 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07007572 _err_type = reader.read("!H")[0]
7573 assert(_err_type == 65535)
7574 obj.subtype = reader.read("!H")[0]
7575 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007576 obj.data = str(reader.read_all())
7577 return obj
7578
7579 def __eq__(self, other):
7580 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007581 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007582 if self.subtype != other.subtype: return False
7583 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007584 if self.data != other.data: return False
7585 return True
7586
Rich Lanec2ee4b82013-04-24 17:12:38 -07007587 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07007588 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007589 with q.group():
7590 with q.indent(2):
7591 q.breakable()
7592 q.text("xid = ");
7593 if self.xid != None:
7594 q.text("%#x" % self.xid)
7595 else:
7596 q.text('None')
7597 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07007598 q.text("subtype = ");
7599 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007600 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07007601 q.text("experimenter = ");
7602 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007603 q.text(","); q.breakable()
7604 q.text("data = ");
7605 q.pp(self.data)
7606 q.breakable()
7607 q.text('}')
7608
Rich Lane7dcdf022013-12-11 14:45:27 -08007609error_msg.subtypes[65535] = experimenter_error_msg
7610
7611class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007612 version = 4
7613 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07007614
7615 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007616 if xid != None:
7617 self.xid = xid
7618 else:
7619 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007620 if datapath_id != None:
7621 self.datapath_id = datapath_id
7622 else:
7623 self.datapath_id = 0
7624 if n_buffers != None:
7625 self.n_buffers = n_buffers
7626 else:
7627 self.n_buffers = 0
7628 if n_tables != None:
7629 self.n_tables = n_tables
7630 else:
7631 self.n_tables = 0
7632 if auxiliary_id != None:
7633 self.auxiliary_id = auxiliary_id
7634 else:
7635 self.auxiliary_id = 0
7636 if capabilities != None:
7637 self.capabilities = capabilities
7638 else:
7639 self.capabilities = 0
7640 if reserved != None:
7641 self.reserved = reserved
7642 else:
7643 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007644 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007645
7646 def pack(self):
7647 packed = []
7648 packed.append(struct.pack("!B", self.version))
7649 packed.append(struct.pack("!B", self.type))
7650 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7651 packed.append(struct.pack("!L", self.xid))
7652 packed.append(struct.pack("!Q", self.datapath_id))
7653 packed.append(struct.pack("!L", self.n_buffers))
7654 packed.append(struct.pack("!B", self.n_tables))
7655 packed.append(struct.pack("!B", self.auxiliary_id))
7656 packed.append('\x00' * 2)
7657 packed.append(struct.pack("!L", self.capabilities))
7658 packed.append(struct.pack("!L", self.reserved))
7659 length = sum([len(x) for x in packed])
7660 packed[2] = struct.pack("!H", length)
7661 return ''.join(packed)
7662
7663 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007664 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007665 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007666 _version = reader.read("!B")[0]
7667 assert(_version == 4)
7668 _type = reader.read("!B")[0]
7669 assert(_type == 6)
7670 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007671 orig_reader = reader
7672 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007673 obj.xid = reader.read("!L")[0]
7674 obj.datapath_id = reader.read("!Q")[0]
7675 obj.n_buffers = reader.read("!L")[0]
7676 obj.n_tables = reader.read("!B")[0]
7677 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007678 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007679 obj.capabilities = reader.read("!L")[0]
7680 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007681 return obj
7682
7683 def __eq__(self, other):
7684 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007685 if self.xid != other.xid: return False
7686 if self.datapath_id != other.datapath_id: return False
7687 if self.n_buffers != other.n_buffers: return False
7688 if self.n_tables != other.n_tables: return False
7689 if self.auxiliary_id != other.auxiliary_id: return False
7690 if self.capabilities != other.capabilities: return False
7691 if self.reserved != other.reserved: return False
7692 return True
7693
Rich Lanec2ee4b82013-04-24 17:12:38 -07007694 def pretty_print(self, q):
7695 q.text("features_reply {")
7696 with q.group():
7697 with q.indent(2):
7698 q.breakable()
7699 q.text("xid = ");
7700 if self.xid != None:
7701 q.text("%#x" % self.xid)
7702 else:
7703 q.text('None')
7704 q.text(","); q.breakable()
7705 q.text("datapath_id = ");
7706 q.text("%#x" % self.datapath_id)
7707 q.text(","); q.breakable()
7708 q.text("n_buffers = ");
7709 q.text("%#x" % self.n_buffers)
7710 q.text(","); q.breakable()
7711 q.text("n_tables = ");
7712 q.text("%#x" % self.n_tables)
7713 q.text(","); q.breakable()
7714 q.text("auxiliary_id = ");
7715 q.text("%#x" % self.auxiliary_id)
7716 q.text(","); q.breakable()
7717 q.text("capabilities = ");
7718 q.text("%#x" % self.capabilities)
7719 q.text(","); q.breakable()
7720 q.text("reserved = ");
7721 q.text("%#x" % self.reserved)
7722 q.breakable()
7723 q.text('}')
7724
Rich Lane7dcdf022013-12-11 14:45:27 -08007725message.subtypes[6] = features_reply
7726
7727class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007728 version = 4
7729 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007730
7731 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007732 if xid != None:
7733 self.xid = xid
7734 else:
7735 self.xid = None
7736 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007737
7738 def pack(self):
7739 packed = []
7740 packed.append(struct.pack("!B", self.version))
7741 packed.append(struct.pack("!B", self.type))
7742 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7743 packed.append(struct.pack("!L", self.xid))
7744 length = sum([len(x) for x in packed])
7745 packed[2] = struct.pack("!H", length)
7746 return ''.join(packed)
7747
7748 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007749 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007750 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007751 _version = reader.read("!B")[0]
7752 assert(_version == 4)
7753 _type = reader.read("!B")[0]
7754 assert(_type == 5)
7755 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007756 orig_reader = reader
7757 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007758 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007759 return obj
7760
7761 def __eq__(self, other):
7762 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007763 if self.xid != other.xid: return False
7764 return True
7765
Rich Lanec2ee4b82013-04-24 17:12:38 -07007766 def pretty_print(self, q):
7767 q.text("features_request {")
7768 with q.group():
7769 with q.indent(2):
7770 q.breakable()
7771 q.text("xid = ");
7772 if self.xid != None:
7773 q.text("%#x" % self.xid)
7774 else:
7775 q.text('None')
7776 q.breakable()
7777 q.text('}')
7778
Rich Lane7dcdf022013-12-11 14:45:27 -08007779message.subtypes[5] = features_request
7780
7781class flow_mod(message):
7782 subtypes = {}
7783
Rich Lane95f7fc92014-01-27 17:08:16 -08007784 version = 4
7785 type = 14
7786
7787 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):
7788 if xid != None:
7789 self.xid = xid
7790 else:
7791 self.xid = None
7792 if cookie != None:
7793 self.cookie = cookie
7794 else:
7795 self.cookie = 0
7796 if cookie_mask != None:
7797 self.cookie_mask = cookie_mask
7798 else:
7799 self.cookie_mask = 0
7800 if table_id != None:
7801 self.table_id = table_id
7802 else:
7803 self.table_id = 0
7804 if _command != None:
7805 self._command = _command
7806 else:
7807 self._command = 0
7808 if idle_timeout != None:
7809 self.idle_timeout = idle_timeout
7810 else:
7811 self.idle_timeout = 0
7812 if hard_timeout != None:
7813 self.hard_timeout = hard_timeout
7814 else:
7815 self.hard_timeout = 0
7816 if priority != None:
7817 self.priority = priority
7818 else:
7819 self.priority = 0
7820 if buffer_id != None:
7821 self.buffer_id = buffer_id
7822 else:
7823 self.buffer_id = 0
7824 if out_port != None:
7825 self.out_port = out_port
7826 else:
7827 self.out_port = 0
7828 if out_group != None:
7829 self.out_group = out_group
7830 else:
7831 self.out_group = 0
7832 if flags != None:
7833 self.flags = flags
7834 else:
7835 self.flags = 0
7836 if match != None:
7837 self.match = match
7838 else:
7839 self.match = common.match()
7840 if instructions != None:
7841 self.instructions = instructions
7842 else:
7843 self.instructions = []
7844 return
7845
7846 def pack(self):
7847 packed = []
7848 packed.append(struct.pack("!B", self.version))
7849 packed.append(struct.pack("!B", self.type))
7850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7851 packed.append(struct.pack("!L", self.xid))
7852 packed.append(struct.pack("!Q", self.cookie))
7853 packed.append(struct.pack("!Q", self.cookie_mask))
7854 packed.append(struct.pack("!B", self.table_id))
7855 packed.append(util.pack_fm_cmd(self._command))
7856 packed.append(struct.pack("!H", self.idle_timeout))
7857 packed.append(struct.pack("!H", self.hard_timeout))
7858 packed.append(struct.pack("!H", self.priority))
7859 packed.append(struct.pack("!L", self.buffer_id))
7860 packed.append(util.pack_port_no(self.out_port))
7861 packed.append(struct.pack("!L", self.out_group))
7862 packed.append(struct.pack("!H", self.flags))
7863 packed.append('\x00' * 2)
7864 packed.append(self.match.pack())
7865 packed.append(loxi.generic_util.pack_list(self.instructions))
7866 length = sum([len(x) for x in packed])
7867 packed[2] = struct.pack("!H", length)
7868 return ''.join(packed)
7869
Rich Lane7dcdf022013-12-11 14:45:27 -08007870 @staticmethod
7871 def unpack(reader):
7872 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08007873 subclass = flow_mod.subtypes.get(subtype)
7874 if subclass:
7875 return subclass.unpack(reader)
7876
7877 obj = flow_mod()
7878 _version = reader.read("!B")[0]
7879 assert(_version == 4)
7880 _type = reader.read("!B")[0]
7881 assert(_type == 14)
7882 _length = reader.read("!H")[0]
7883 orig_reader = reader
7884 reader = orig_reader.slice(_length - (2 + 2))
7885 obj.xid = reader.read("!L")[0]
7886 obj.cookie = reader.read("!Q")[0]
7887 obj.cookie_mask = reader.read("!Q")[0]
7888 obj.table_id = reader.read("!B")[0]
7889 obj._command = util.unpack_fm_cmd(reader)
7890 obj.idle_timeout = reader.read("!H")[0]
7891 obj.hard_timeout = reader.read("!H")[0]
7892 obj.priority = reader.read("!H")[0]
7893 obj.buffer_id = reader.read("!L")[0]
7894 obj.out_port = util.unpack_port_no(reader)
7895 obj.out_group = reader.read("!L")[0]
7896 obj.flags = reader.read("!H")[0]
7897 reader.skip(2)
7898 obj.match = common.match.unpack(reader)
7899 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
7900 return obj
7901
7902 def __eq__(self, other):
7903 if type(self) != type(other): return False
7904 if self.xid != other.xid: return False
7905 if self.cookie != other.cookie: return False
7906 if self.cookie_mask != other.cookie_mask: return False
7907 if self.table_id != other.table_id: return False
7908 if self._command != other._command: return False
7909 if self.idle_timeout != other.idle_timeout: return False
7910 if self.hard_timeout != other.hard_timeout: return False
7911 if self.priority != other.priority: return False
7912 if self.buffer_id != other.buffer_id: return False
7913 if self.out_port != other.out_port: return False
7914 if self.out_group != other.out_group: return False
7915 if self.flags != other.flags: return False
7916 if self.match != other.match: return False
7917 if self.instructions != other.instructions: return False
7918 return True
7919
7920 def pretty_print(self, q):
7921 q.text("flow_mod {")
7922 with q.group():
7923 with q.indent(2):
7924 q.breakable()
7925 q.text("xid = ");
7926 if self.xid != None:
7927 q.text("%#x" % self.xid)
7928 else:
7929 q.text('None')
7930 q.text(","); q.breakable()
7931 q.text("cookie = ");
7932 q.text("%#x" % self.cookie)
7933 q.text(","); q.breakable()
7934 q.text("cookie_mask = ");
7935 q.text("%#x" % self.cookie_mask)
7936 q.text(","); q.breakable()
7937 q.text("table_id = ");
7938 q.text("%#x" % self.table_id)
7939 q.text(","); q.breakable()
7940 q.text("idle_timeout = ");
7941 q.text("%#x" % self.idle_timeout)
7942 q.text(","); q.breakable()
7943 q.text("hard_timeout = ");
7944 q.text("%#x" % self.hard_timeout)
7945 q.text(","); q.breakable()
7946 q.text("priority = ");
7947 q.text("%#x" % self.priority)
7948 q.text(","); q.breakable()
7949 q.text("buffer_id = ");
7950 q.text("%#x" % self.buffer_id)
7951 q.text(","); q.breakable()
7952 q.text("out_port = ");
7953 q.text(util.pretty_port(self.out_port))
7954 q.text(","); q.breakable()
7955 q.text("out_group = ");
7956 q.text("%#x" % self.out_group)
7957 q.text(","); q.breakable()
7958 q.text("flags = ");
7959 q.text("%#x" % self.flags)
7960 q.text(","); q.breakable()
7961 q.text("match = ");
7962 q.pp(self.match)
7963 q.text(","); q.breakable()
7964 q.text("instructions = ");
7965 q.pp(self.instructions)
7966 q.breakable()
7967 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08007968
7969message.subtypes[14] = flow_mod
7970
7971class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07007972 version = 4
7973 type = 14
7974 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07007975
7976 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 -08007977 if xid != None:
7978 self.xid = xid
7979 else:
7980 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007981 if cookie != None:
7982 self.cookie = cookie
7983 else:
7984 self.cookie = 0
7985 if cookie_mask != None:
7986 self.cookie_mask = cookie_mask
7987 else:
7988 self.cookie_mask = 0
7989 if table_id != None:
7990 self.table_id = table_id
7991 else:
7992 self.table_id = 0
7993 if idle_timeout != None:
7994 self.idle_timeout = idle_timeout
7995 else:
7996 self.idle_timeout = 0
7997 if hard_timeout != None:
7998 self.hard_timeout = hard_timeout
7999 else:
8000 self.hard_timeout = 0
8001 if priority != None:
8002 self.priority = priority
8003 else:
8004 self.priority = 0
8005 if buffer_id != None:
8006 self.buffer_id = buffer_id
8007 else:
8008 self.buffer_id = 0
8009 if out_port != None:
8010 self.out_port = out_port
8011 else:
8012 self.out_port = 0
8013 if out_group != None:
8014 self.out_group = out_group
8015 else:
8016 self.out_group = 0
8017 if flags != None:
8018 self.flags = flags
8019 else:
8020 self.flags = 0
8021 if match != None:
8022 self.match = match
8023 else:
8024 self.match = common.match()
8025 if instructions != None:
8026 self.instructions = instructions
8027 else:
8028 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008029 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008030
8031 def pack(self):
8032 packed = []
8033 packed.append(struct.pack("!B", self.version))
8034 packed.append(struct.pack("!B", self.type))
8035 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8036 packed.append(struct.pack("!L", self.xid))
8037 packed.append(struct.pack("!Q", self.cookie))
8038 packed.append(struct.pack("!Q", self.cookie_mask))
8039 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008040 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008041 packed.append(struct.pack("!H", self.idle_timeout))
8042 packed.append(struct.pack("!H", self.hard_timeout))
8043 packed.append(struct.pack("!H", self.priority))
8044 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008045 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008046 packed.append(struct.pack("!L", self.out_group))
8047 packed.append(struct.pack("!H", self.flags))
8048 packed.append('\x00' * 2)
8049 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008050 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008051 length = sum([len(x) for x in packed])
8052 packed[2] = struct.pack("!H", length)
8053 return ''.join(packed)
8054
8055 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008056 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008057 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07008058 _version = reader.read("!B")[0]
8059 assert(_version == 4)
8060 _type = reader.read("!B")[0]
8061 assert(_type == 14)
8062 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008063 orig_reader = reader
8064 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008065 obj.xid = reader.read("!L")[0]
8066 obj.cookie = reader.read("!Q")[0]
8067 obj.cookie_mask = reader.read("!Q")[0]
8068 obj.table_id = reader.read("!B")[0]
8069 __command = util.unpack_fm_cmd(reader)
8070 assert(__command == 0)
8071 obj.idle_timeout = reader.read("!H")[0]
8072 obj.hard_timeout = reader.read("!H")[0]
8073 obj.priority = reader.read("!H")[0]
8074 obj.buffer_id = reader.read("!L")[0]
8075 obj.out_port = util.unpack_port_no(reader)
8076 obj.out_group = reader.read("!L")[0]
8077 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008078 reader.skip(2)
8079 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008080 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008081 return obj
8082
8083 def __eq__(self, other):
8084 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008085 if self.xid != other.xid: return False
8086 if self.cookie != other.cookie: return False
8087 if self.cookie_mask != other.cookie_mask: return False
8088 if self.table_id != other.table_id: return False
8089 if self.idle_timeout != other.idle_timeout: return False
8090 if self.hard_timeout != other.hard_timeout: return False
8091 if self.priority != other.priority: return False
8092 if self.buffer_id != other.buffer_id: return False
8093 if self.out_port != other.out_port: return False
8094 if self.out_group != other.out_group: return False
8095 if self.flags != other.flags: return False
8096 if self.match != other.match: return False
8097 if self.instructions != other.instructions: return False
8098 return True
8099
Rich Lanec2ee4b82013-04-24 17:12:38 -07008100 def pretty_print(self, q):
8101 q.text("flow_add {")
8102 with q.group():
8103 with q.indent(2):
8104 q.breakable()
8105 q.text("xid = ");
8106 if self.xid != None:
8107 q.text("%#x" % self.xid)
8108 else:
8109 q.text('None')
8110 q.text(","); q.breakable()
8111 q.text("cookie = ");
8112 q.text("%#x" % self.cookie)
8113 q.text(","); q.breakable()
8114 q.text("cookie_mask = ");
8115 q.text("%#x" % self.cookie_mask)
8116 q.text(","); q.breakable()
8117 q.text("table_id = ");
8118 q.text("%#x" % self.table_id)
8119 q.text(","); q.breakable()
8120 q.text("idle_timeout = ");
8121 q.text("%#x" % self.idle_timeout)
8122 q.text(","); q.breakable()
8123 q.text("hard_timeout = ");
8124 q.text("%#x" % self.hard_timeout)
8125 q.text(","); q.breakable()
8126 q.text("priority = ");
8127 q.text("%#x" % self.priority)
8128 q.text(","); q.breakable()
8129 q.text("buffer_id = ");
8130 q.text("%#x" % self.buffer_id)
8131 q.text(","); q.breakable()
8132 q.text("out_port = ");
8133 q.text(util.pretty_port(self.out_port))
8134 q.text(","); q.breakable()
8135 q.text("out_group = ");
8136 q.text("%#x" % self.out_group)
8137 q.text(","); q.breakable()
8138 q.text("flags = ");
8139 q.text("%#x" % self.flags)
8140 q.text(","); q.breakable()
8141 q.text("match = ");
8142 q.pp(self.match)
8143 q.text(","); q.breakable()
8144 q.text("instructions = ");
8145 q.pp(self.instructions)
8146 q.breakable()
8147 q.text('}')
8148
Rich Lane7dcdf022013-12-11 14:45:27 -08008149flow_mod.subtypes[0] = flow_add
8150
8151class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008152 version = 4
8153 type = 14
8154 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07008155
8156 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 -08008157 if xid != None:
8158 self.xid = xid
8159 else:
8160 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008161 if cookie != None:
8162 self.cookie = cookie
8163 else:
8164 self.cookie = 0
8165 if cookie_mask != None:
8166 self.cookie_mask = cookie_mask
8167 else:
8168 self.cookie_mask = 0
8169 if table_id != None:
8170 self.table_id = table_id
8171 else:
8172 self.table_id = 0
8173 if idle_timeout != None:
8174 self.idle_timeout = idle_timeout
8175 else:
8176 self.idle_timeout = 0
8177 if hard_timeout != None:
8178 self.hard_timeout = hard_timeout
8179 else:
8180 self.hard_timeout = 0
8181 if priority != None:
8182 self.priority = priority
8183 else:
8184 self.priority = 0
8185 if buffer_id != None:
8186 self.buffer_id = buffer_id
8187 else:
8188 self.buffer_id = 0
8189 if out_port != None:
8190 self.out_port = out_port
8191 else:
8192 self.out_port = 0
8193 if out_group != None:
8194 self.out_group = out_group
8195 else:
8196 self.out_group = 0
8197 if flags != None:
8198 self.flags = flags
8199 else:
8200 self.flags = 0
8201 if match != None:
8202 self.match = match
8203 else:
8204 self.match = common.match()
8205 if instructions != None:
8206 self.instructions = instructions
8207 else:
8208 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008209 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008210
8211 def pack(self):
8212 packed = []
8213 packed.append(struct.pack("!B", self.version))
8214 packed.append(struct.pack("!B", self.type))
8215 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8216 packed.append(struct.pack("!L", self.xid))
8217 packed.append(struct.pack("!Q", self.cookie))
8218 packed.append(struct.pack("!Q", self.cookie_mask))
8219 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008220 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008221 packed.append(struct.pack("!H", self.idle_timeout))
8222 packed.append(struct.pack("!H", self.hard_timeout))
8223 packed.append(struct.pack("!H", self.priority))
8224 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008225 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008226 packed.append(struct.pack("!L", self.out_group))
8227 packed.append(struct.pack("!H", self.flags))
8228 packed.append('\x00' * 2)
8229 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008230 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008231 length = sum([len(x) for x in packed])
8232 packed[2] = struct.pack("!H", length)
8233 return ''.join(packed)
8234
8235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008236 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008237 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07008238 _version = reader.read("!B")[0]
8239 assert(_version == 4)
8240 _type = reader.read("!B")[0]
8241 assert(_type == 14)
8242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008243 orig_reader = reader
8244 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008245 obj.xid = reader.read("!L")[0]
8246 obj.cookie = reader.read("!Q")[0]
8247 obj.cookie_mask = reader.read("!Q")[0]
8248 obj.table_id = reader.read("!B")[0]
8249 __command = util.unpack_fm_cmd(reader)
8250 assert(__command == 3)
8251 obj.idle_timeout = reader.read("!H")[0]
8252 obj.hard_timeout = reader.read("!H")[0]
8253 obj.priority = reader.read("!H")[0]
8254 obj.buffer_id = reader.read("!L")[0]
8255 obj.out_port = util.unpack_port_no(reader)
8256 obj.out_group = reader.read("!L")[0]
8257 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008258 reader.skip(2)
8259 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008260 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008261 return obj
8262
8263 def __eq__(self, other):
8264 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008265 if self.xid != other.xid: return False
8266 if self.cookie != other.cookie: return False
8267 if self.cookie_mask != other.cookie_mask: return False
8268 if self.table_id != other.table_id: return False
8269 if self.idle_timeout != other.idle_timeout: return False
8270 if self.hard_timeout != other.hard_timeout: return False
8271 if self.priority != other.priority: return False
8272 if self.buffer_id != other.buffer_id: return False
8273 if self.out_port != other.out_port: return False
8274 if self.out_group != other.out_group: return False
8275 if self.flags != other.flags: return False
8276 if self.match != other.match: return False
8277 if self.instructions != other.instructions: return False
8278 return True
8279
Rich Lanec2ee4b82013-04-24 17:12:38 -07008280 def pretty_print(self, q):
8281 q.text("flow_delete {")
8282 with q.group():
8283 with q.indent(2):
8284 q.breakable()
8285 q.text("xid = ");
8286 if self.xid != None:
8287 q.text("%#x" % self.xid)
8288 else:
8289 q.text('None')
8290 q.text(","); q.breakable()
8291 q.text("cookie = ");
8292 q.text("%#x" % self.cookie)
8293 q.text(","); q.breakable()
8294 q.text("cookie_mask = ");
8295 q.text("%#x" % self.cookie_mask)
8296 q.text(","); q.breakable()
8297 q.text("table_id = ");
8298 q.text("%#x" % self.table_id)
8299 q.text(","); q.breakable()
8300 q.text("idle_timeout = ");
8301 q.text("%#x" % self.idle_timeout)
8302 q.text(","); q.breakable()
8303 q.text("hard_timeout = ");
8304 q.text("%#x" % self.hard_timeout)
8305 q.text(","); q.breakable()
8306 q.text("priority = ");
8307 q.text("%#x" % self.priority)
8308 q.text(","); q.breakable()
8309 q.text("buffer_id = ");
8310 q.text("%#x" % self.buffer_id)
8311 q.text(","); q.breakable()
8312 q.text("out_port = ");
8313 q.text(util.pretty_port(self.out_port))
8314 q.text(","); q.breakable()
8315 q.text("out_group = ");
8316 q.text("%#x" % self.out_group)
8317 q.text(","); q.breakable()
8318 q.text("flags = ");
8319 q.text("%#x" % self.flags)
8320 q.text(","); q.breakable()
8321 q.text("match = ");
8322 q.pp(self.match)
8323 q.text(","); q.breakable()
8324 q.text("instructions = ");
8325 q.pp(self.instructions)
8326 q.breakable()
8327 q.text('}')
8328
Rich Lane7dcdf022013-12-11 14:45:27 -08008329flow_mod.subtypes[3] = flow_delete
8330
8331class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008332 version = 4
8333 type = 14
8334 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07008335
8336 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 -08008337 if xid != None:
8338 self.xid = xid
8339 else:
8340 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008341 if cookie != None:
8342 self.cookie = cookie
8343 else:
8344 self.cookie = 0
8345 if cookie_mask != None:
8346 self.cookie_mask = cookie_mask
8347 else:
8348 self.cookie_mask = 0
8349 if table_id != None:
8350 self.table_id = table_id
8351 else:
8352 self.table_id = 0
8353 if idle_timeout != None:
8354 self.idle_timeout = idle_timeout
8355 else:
8356 self.idle_timeout = 0
8357 if hard_timeout != None:
8358 self.hard_timeout = hard_timeout
8359 else:
8360 self.hard_timeout = 0
8361 if priority != None:
8362 self.priority = priority
8363 else:
8364 self.priority = 0
8365 if buffer_id != None:
8366 self.buffer_id = buffer_id
8367 else:
8368 self.buffer_id = 0
8369 if out_port != None:
8370 self.out_port = out_port
8371 else:
8372 self.out_port = 0
8373 if out_group != None:
8374 self.out_group = out_group
8375 else:
8376 self.out_group = 0
8377 if flags != None:
8378 self.flags = flags
8379 else:
8380 self.flags = 0
8381 if match != None:
8382 self.match = match
8383 else:
8384 self.match = common.match()
8385 if instructions != None:
8386 self.instructions = instructions
8387 else:
8388 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008389 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008390
8391 def pack(self):
8392 packed = []
8393 packed.append(struct.pack("!B", self.version))
8394 packed.append(struct.pack("!B", self.type))
8395 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8396 packed.append(struct.pack("!L", self.xid))
8397 packed.append(struct.pack("!Q", self.cookie))
8398 packed.append(struct.pack("!Q", self.cookie_mask))
8399 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008400 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008401 packed.append(struct.pack("!H", self.idle_timeout))
8402 packed.append(struct.pack("!H", self.hard_timeout))
8403 packed.append(struct.pack("!H", self.priority))
8404 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008405 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008406 packed.append(struct.pack("!L", self.out_group))
8407 packed.append(struct.pack("!H", self.flags))
8408 packed.append('\x00' * 2)
8409 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008410 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008411 length = sum([len(x) for x in packed])
8412 packed[2] = struct.pack("!H", length)
8413 return ''.join(packed)
8414
8415 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008416 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008417 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07008418 _version = reader.read("!B")[0]
8419 assert(_version == 4)
8420 _type = reader.read("!B")[0]
8421 assert(_type == 14)
8422 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008423 orig_reader = reader
8424 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008425 obj.xid = reader.read("!L")[0]
8426 obj.cookie = reader.read("!Q")[0]
8427 obj.cookie_mask = reader.read("!Q")[0]
8428 obj.table_id = reader.read("!B")[0]
8429 __command = util.unpack_fm_cmd(reader)
8430 assert(__command == 4)
8431 obj.idle_timeout = reader.read("!H")[0]
8432 obj.hard_timeout = reader.read("!H")[0]
8433 obj.priority = reader.read("!H")[0]
8434 obj.buffer_id = reader.read("!L")[0]
8435 obj.out_port = util.unpack_port_no(reader)
8436 obj.out_group = reader.read("!L")[0]
8437 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008438 reader.skip(2)
8439 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008440 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008441 return obj
8442
8443 def __eq__(self, other):
8444 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008445 if self.xid != other.xid: return False
8446 if self.cookie != other.cookie: return False
8447 if self.cookie_mask != other.cookie_mask: return False
8448 if self.table_id != other.table_id: return False
8449 if self.idle_timeout != other.idle_timeout: return False
8450 if self.hard_timeout != other.hard_timeout: return False
8451 if self.priority != other.priority: return False
8452 if self.buffer_id != other.buffer_id: return False
8453 if self.out_port != other.out_port: return False
8454 if self.out_group != other.out_group: return False
8455 if self.flags != other.flags: return False
8456 if self.match != other.match: return False
8457 if self.instructions != other.instructions: return False
8458 return True
8459
Rich Lanec2ee4b82013-04-24 17:12:38 -07008460 def pretty_print(self, q):
8461 q.text("flow_delete_strict {")
8462 with q.group():
8463 with q.indent(2):
8464 q.breakable()
8465 q.text("xid = ");
8466 if self.xid != None:
8467 q.text("%#x" % self.xid)
8468 else:
8469 q.text('None')
8470 q.text(","); q.breakable()
8471 q.text("cookie = ");
8472 q.text("%#x" % self.cookie)
8473 q.text(","); q.breakable()
8474 q.text("cookie_mask = ");
8475 q.text("%#x" % self.cookie_mask)
8476 q.text(","); q.breakable()
8477 q.text("table_id = ");
8478 q.text("%#x" % self.table_id)
8479 q.text(","); q.breakable()
8480 q.text("idle_timeout = ");
8481 q.text("%#x" % self.idle_timeout)
8482 q.text(","); q.breakable()
8483 q.text("hard_timeout = ");
8484 q.text("%#x" % self.hard_timeout)
8485 q.text(","); q.breakable()
8486 q.text("priority = ");
8487 q.text("%#x" % self.priority)
8488 q.text(","); q.breakable()
8489 q.text("buffer_id = ");
8490 q.text("%#x" % self.buffer_id)
8491 q.text(","); q.breakable()
8492 q.text("out_port = ");
8493 q.text(util.pretty_port(self.out_port))
8494 q.text(","); q.breakable()
8495 q.text("out_group = ");
8496 q.text("%#x" % self.out_group)
8497 q.text(","); q.breakable()
8498 q.text("flags = ");
8499 q.text("%#x" % self.flags)
8500 q.text(","); q.breakable()
8501 q.text("match = ");
8502 q.pp(self.match)
8503 q.text(","); q.breakable()
8504 q.text("instructions = ");
8505 q.pp(self.instructions)
8506 q.breakable()
8507 q.text('}')
8508
Rich Lane7dcdf022013-12-11 14:45:27 -08008509flow_mod.subtypes[4] = flow_delete_strict
8510
8511class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07008512 version = 4
8513 type = 1
8514 err_type = 5
8515
8516 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008517 if xid != None:
8518 self.xid = xid
8519 else:
8520 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008521 if code != None:
8522 self.code = code
8523 else:
8524 self.code = 0
8525 if data != None:
8526 self.data = data
8527 else:
8528 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008529 return
Rich Lane6f4978c2013-10-20 21:33:52 -07008530
8531 def pack(self):
8532 packed = []
8533 packed.append(struct.pack("!B", self.version))
8534 packed.append(struct.pack("!B", self.type))
8535 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8536 packed.append(struct.pack("!L", self.xid))
8537 packed.append(struct.pack("!H", self.err_type))
8538 packed.append(struct.pack("!H", self.code))
8539 packed.append(self.data)
8540 length = sum([len(x) for x in packed])
8541 packed[2] = struct.pack("!H", length)
8542 return ''.join(packed)
8543
8544 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008545 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07008546 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07008547 _version = reader.read("!B")[0]
8548 assert(_version == 4)
8549 _type = reader.read("!B")[0]
8550 assert(_type == 1)
8551 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008552 orig_reader = reader
8553 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07008554 obj.xid = reader.read("!L")[0]
8555 _err_type = reader.read("!H")[0]
8556 assert(_err_type == 5)
8557 obj.code = reader.read("!H")[0]
8558 obj.data = str(reader.read_all())
8559 return obj
8560
8561 def __eq__(self, other):
8562 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07008563 if self.xid != other.xid: return False
8564 if self.code != other.code: return False
8565 if self.data != other.data: return False
8566 return True
8567
Rich Lane6f4978c2013-10-20 21:33:52 -07008568 def pretty_print(self, q):
8569 q.text("flow_mod_failed_error_msg {")
8570 with q.group():
8571 with q.indent(2):
8572 q.breakable()
8573 q.text("xid = ");
8574 if self.xid != None:
8575 q.text("%#x" % self.xid)
8576 else:
8577 q.text('None')
8578 q.text(","); q.breakable()
8579 q.text("code = ");
8580 q.text("%#x" % self.code)
8581 q.text(","); q.breakable()
8582 q.text("data = ");
8583 q.pp(self.data)
8584 q.breakable()
8585 q.text('}')
8586
Rich Lane7dcdf022013-12-11 14:45:27 -08008587error_msg.subtypes[5] = flow_mod_failed_error_msg
8588
8589class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008590 version = 4
8591 type = 14
8592 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07008593
8594 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 -08008595 if xid != None:
8596 self.xid = xid
8597 else:
8598 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008599 if cookie != None:
8600 self.cookie = cookie
8601 else:
8602 self.cookie = 0
8603 if cookie_mask != None:
8604 self.cookie_mask = cookie_mask
8605 else:
8606 self.cookie_mask = 0
8607 if table_id != None:
8608 self.table_id = table_id
8609 else:
8610 self.table_id = 0
8611 if idle_timeout != None:
8612 self.idle_timeout = idle_timeout
8613 else:
8614 self.idle_timeout = 0
8615 if hard_timeout != None:
8616 self.hard_timeout = hard_timeout
8617 else:
8618 self.hard_timeout = 0
8619 if priority != None:
8620 self.priority = priority
8621 else:
8622 self.priority = 0
8623 if buffer_id != None:
8624 self.buffer_id = buffer_id
8625 else:
8626 self.buffer_id = 0
8627 if out_port != None:
8628 self.out_port = out_port
8629 else:
8630 self.out_port = 0
8631 if out_group != None:
8632 self.out_group = out_group
8633 else:
8634 self.out_group = 0
8635 if flags != None:
8636 self.flags = flags
8637 else:
8638 self.flags = 0
8639 if match != None:
8640 self.match = match
8641 else:
8642 self.match = common.match()
8643 if instructions != None:
8644 self.instructions = instructions
8645 else:
8646 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008647 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008648
8649 def pack(self):
8650 packed = []
8651 packed.append(struct.pack("!B", self.version))
8652 packed.append(struct.pack("!B", self.type))
8653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8654 packed.append(struct.pack("!L", self.xid))
8655 packed.append(struct.pack("!Q", self.cookie))
8656 packed.append(struct.pack("!Q", self.cookie_mask))
8657 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008658 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008659 packed.append(struct.pack("!H", self.idle_timeout))
8660 packed.append(struct.pack("!H", self.hard_timeout))
8661 packed.append(struct.pack("!H", self.priority))
8662 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008663 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008664 packed.append(struct.pack("!L", self.out_group))
8665 packed.append(struct.pack("!H", self.flags))
8666 packed.append('\x00' * 2)
8667 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008668 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008669 length = sum([len(x) for x in packed])
8670 packed[2] = struct.pack("!H", length)
8671 return ''.join(packed)
8672
8673 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008674 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008675 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07008676 _version = reader.read("!B")[0]
8677 assert(_version == 4)
8678 _type = reader.read("!B")[0]
8679 assert(_type == 14)
8680 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008681 orig_reader = reader
8682 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008683 obj.xid = reader.read("!L")[0]
8684 obj.cookie = reader.read("!Q")[0]
8685 obj.cookie_mask = reader.read("!Q")[0]
8686 obj.table_id = reader.read("!B")[0]
8687 __command = util.unpack_fm_cmd(reader)
8688 assert(__command == 1)
8689 obj.idle_timeout = reader.read("!H")[0]
8690 obj.hard_timeout = reader.read("!H")[0]
8691 obj.priority = reader.read("!H")[0]
8692 obj.buffer_id = reader.read("!L")[0]
8693 obj.out_port = util.unpack_port_no(reader)
8694 obj.out_group = reader.read("!L")[0]
8695 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008696 reader.skip(2)
8697 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008698 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008699 return obj
8700
8701 def __eq__(self, other):
8702 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008703 if self.xid != other.xid: return False
8704 if self.cookie != other.cookie: return False
8705 if self.cookie_mask != other.cookie_mask: return False
8706 if self.table_id != other.table_id: return False
8707 if self.idle_timeout != other.idle_timeout: return False
8708 if self.hard_timeout != other.hard_timeout: return False
8709 if self.priority != other.priority: return False
8710 if self.buffer_id != other.buffer_id: return False
8711 if self.out_port != other.out_port: return False
8712 if self.out_group != other.out_group: return False
8713 if self.flags != other.flags: return False
8714 if self.match != other.match: return False
8715 if self.instructions != other.instructions: return False
8716 return True
8717
Rich Lanec2ee4b82013-04-24 17:12:38 -07008718 def pretty_print(self, q):
8719 q.text("flow_modify {")
8720 with q.group():
8721 with q.indent(2):
8722 q.breakable()
8723 q.text("xid = ");
8724 if self.xid != None:
8725 q.text("%#x" % self.xid)
8726 else:
8727 q.text('None')
8728 q.text(","); q.breakable()
8729 q.text("cookie = ");
8730 q.text("%#x" % self.cookie)
8731 q.text(","); q.breakable()
8732 q.text("cookie_mask = ");
8733 q.text("%#x" % self.cookie_mask)
8734 q.text(","); q.breakable()
8735 q.text("table_id = ");
8736 q.text("%#x" % self.table_id)
8737 q.text(","); q.breakable()
8738 q.text("idle_timeout = ");
8739 q.text("%#x" % self.idle_timeout)
8740 q.text(","); q.breakable()
8741 q.text("hard_timeout = ");
8742 q.text("%#x" % self.hard_timeout)
8743 q.text(","); q.breakable()
8744 q.text("priority = ");
8745 q.text("%#x" % self.priority)
8746 q.text(","); q.breakable()
8747 q.text("buffer_id = ");
8748 q.text("%#x" % self.buffer_id)
8749 q.text(","); q.breakable()
8750 q.text("out_port = ");
8751 q.text(util.pretty_port(self.out_port))
8752 q.text(","); q.breakable()
8753 q.text("out_group = ");
8754 q.text("%#x" % self.out_group)
8755 q.text(","); q.breakable()
8756 q.text("flags = ");
8757 q.text("%#x" % self.flags)
8758 q.text(","); q.breakable()
8759 q.text("match = ");
8760 q.pp(self.match)
8761 q.text(","); q.breakable()
8762 q.text("instructions = ");
8763 q.pp(self.instructions)
8764 q.breakable()
8765 q.text('}')
8766
Rich Lane7dcdf022013-12-11 14:45:27 -08008767flow_mod.subtypes[1] = flow_modify
8768
8769class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008770 version = 4
8771 type = 14
8772 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07008773
8774 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 -08008775 if xid != None:
8776 self.xid = xid
8777 else:
8778 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008779 if cookie != None:
8780 self.cookie = cookie
8781 else:
8782 self.cookie = 0
8783 if cookie_mask != None:
8784 self.cookie_mask = cookie_mask
8785 else:
8786 self.cookie_mask = 0
8787 if table_id != None:
8788 self.table_id = table_id
8789 else:
8790 self.table_id = 0
8791 if idle_timeout != None:
8792 self.idle_timeout = idle_timeout
8793 else:
8794 self.idle_timeout = 0
8795 if hard_timeout != None:
8796 self.hard_timeout = hard_timeout
8797 else:
8798 self.hard_timeout = 0
8799 if priority != None:
8800 self.priority = priority
8801 else:
8802 self.priority = 0
8803 if buffer_id != None:
8804 self.buffer_id = buffer_id
8805 else:
8806 self.buffer_id = 0
8807 if out_port != None:
8808 self.out_port = out_port
8809 else:
8810 self.out_port = 0
8811 if out_group != None:
8812 self.out_group = out_group
8813 else:
8814 self.out_group = 0
8815 if flags != None:
8816 self.flags = flags
8817 else:
8818 self.flags = 0
8819 if match != None:
8820 self.match = match
8821 else:
8822 self.match = common.match()
8823 if instructions != None:
8824 self.instructions = instructions
8825 else:
8826 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008827 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008828
8829 def pack(self):
8830 packed = []
8831 packed.append(struct.pack("!B", self.version))
8832 packed.append(struct.pack("!B", self.type))
8833 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8834 packed.append(struct.pack("!L", self.xid))
8835 packed.append(struct.pack("!Q", self.cookie))
8836 packed.append(struct.pack("!Q", self.cookie_mask))
8837 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008838 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008839 packed.append(struct.pack("!H", self.idle_timeout))
8840 packed.append(struct.pack("!H", self.hard_timeout))
8841 packed.append(struct.pack("!H", self.priority))
8842 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008843 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008844 packed.append(struct.pack("!L", self.out_group))
8845 packed.append(struct.pack("!H", self.flags))
8846 packed.append('\x00' * 2)
8847 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008848 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008849 length = sum([len(x) for x in packed])
8850 packed[2] = struct.pack("!H", length)
8851 return ''.join(packed)
8852
8853 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008854 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008855 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07008856 _version = reader.read("!B")[0]
8857 assert(_version == 4)
8858 _type = reader.read("!B")[0]
8859 assert(_type == 14)
8860 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008861 orig_reader = reader
8862 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008863 obj.xid = reader.read("!L")[0]
8864 obj.cookie = reader.read("!Q")[0]
8865 obj.cookie_mask = reader.read("!Q")[0]
8866 obj.table_id = reader.read("!B")[0]
8867 __command = util.unpack_fm_cmd(reader)
8868 assert(__command == 2)
8869 obj.idle_timeout = reader.read("!H")[0]
8870 obj.hard_timeout = reader.read("!H")[0]
8871 obj.priority = reader.read("!H")[0]
8872 obj.buffer_id = reader.read("!L")[0]
8873 obj.out_port = util.unpack_port_no(reader)
8874 obj.out_group = reader.read("!L")[0]
8875 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008876 reader.skip(2)
8877 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008878 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008879 return obj
8880
8881 def __eq__(self, other):
8882 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008883 if self.xid != other.xid: return False
8884 if self.cookie != other.cookie: return False
8885 if self.cookie_mask != other.cookie_mask: return False
8886 if self.table_id != other.table_id: return False
8887 if self.idle_timeout != other.idle_timeout: return False
8888 if self.hard_timeout != other.hard_timeout: return False
8889 if self.priority != other.priority: return False
8890 if self.buffer_id != other.buffer_id: return False
8891 if self.out_port != other.out_port: return False
8892 if self.out_group != other.out_group: return False
8893 if self.flags != other.flags: return False
8894 if self.match != other.match: return False
8895 if self.instructions != other.instructions: return False
8896 return True
8897
Rich Lanec2ee4b82013-04-24 17:12:38 -07008898 def pretty_print(self, q):
8899 q.text("flow_modify_strict {")
8900 with q.group():
8901 with q.indent(2):
8902 q.breakable()
8903 q.text("xid = ");
8904 if self.xid != None:
8905 q.text("%#x" % self.xid)
8906 else:
8907 q.text('None')
8908 q.text(","); q.breakable()
8909 q.text("cookie = ");
8910 q.text("%#x" % self.cookie)
8911 q.text(","); q.breakable()
8912 q.text("cookie_mask = ");
8913 q.text("%#x" % self.cookie_mask)
8914 q.text(","); q.breakable()
8915 q.text("table_id = ");
8916 q.text("%#x" % self.table_id)
8917 q.text(","); q.breakable()
8918 q.text("idle_timeout = ");
8919 q.text("%#x" % self.idle_timeout)
8920 q.text(","); q.breakable()
8921 q.text("hard_timeout = ");
8922 q.text("%#x" % self.hard_timeout)
8923 q.text(","); q.breakable()
8924 q.text("priority = ");
8925 q.text("%#x" % self.priority)
8926 q.text(","); q.breakable()
8927 q.text("buffer_id = ");
8928 q.text("%#x" % self.buffer_id)
8929 q.text(","); q.breakable()
8930 q.text("out_port = ");
8931 q.text(util.pretty_port(self.out_port))
8932 q.text(","); q.breakable()
8933 q.text("out_group = ");
8934 q.text("%#x" % self.out_group)
8935 q.text(","); q.breakable()
8936 q.text("flags = ");
8937 q.text("%#x" % self.flags)
8938 q.text(","); q.breakable()
8939 q.text("match = ");
8940 q.pp(self.match)
8941 q.text(","); q.breakable()
8942 q.text("instructions = ");
8943 q.pp(self.instructions)
8944 q.breakable()
8945 q.text('}')
8946
Rich Lane7dcdf022013-12-11 14:45:27 -08008947flow_mod.subtypes[2] = flow_modify_strict
8948
8949class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008950 version = 4
8951 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07008952
8953 def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008954 if xid != None:
8955 self.xid = xid
8956 else:
8957 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008958 if cookie != None:
8959 self.cookie = cookie
8960 else:
8961 self.cookie = 0
8962 if priority != None:
8963 self.priority = priority
8964 else:
8965 self.priority = 0
8966 if reason != None:
8967 self.reason = reason
8968 else:
8969 self.reason = 0
8970 if table_id != None:
8971 self.table_id = table_id
8972 else:
8973 self.table_id = 0
8974 if duration_sec != None:
8975 self.duration_sec = duration_sec
8976 else:
8977 self.duration_sec = 0
8978 if duration_nsec != None:
8979 self.duration_nsec = duration_nsec
8980 else:
8981 self.duration_nsec = 0
8982 if idle_timeout != None:
8983 self.idle_timeout = idle_timeout
8984 else:
8985 self.idle_timeout = 0
8986 if hard_timeout != None:
8987 self.hard_timeout = hard_timeout
8988 else:
8989 self.hard_timeout = 0
8990 if packet_count != None:
8991 self.packet_count = packet_count
8992 else:
8993 self.packet_count = 0
8994 if byte_count != None:
8995 self.byte_count = byte_count
8996 else:
8997 self.byte_count = 0
8998 if match != None:
8999 self.match = match
9000 else:
9001 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009002 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009003
9004 def pack(self):
9005 packed = []
9006 packed.append(struct.pack("!B", self.version))
9007 packed.append(struct.pack("!B", self.type))
9008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9009 packed.append(struct.pack("!L", self.xid))
9010 packed.append(struct.pack("!Q", self.cookie))
9011 packed.append(struct.pack("!H", self.priority))
9012 packed.append(struct.pack("!B", self.reason))
9013 packed.append(struct.pack("!B", self.table_id))
9014 packed.append(struct.pack("!L", self.duration_sec))
9015 packed.append(struct.pack("!L", self.duration_nsec))
9016 packed.append(struct.pack("!H", self.idle_timeout))
9017 packed.append(struct.pack("!H", self.hard_timeout))
9018 packed.append(struct.pack("!Q", self.packet_count))
9019 packed.append(struct.pack("!Q", self.byte_count))
9020 packed.append(self.match.pack())
9021 length = sum([len(x) for x in packed])
9022 packed[2] = struct.pack("!H", length)
9023 return ''.join(packed)
9024
9025 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009026 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009027 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07009028 _version = reader.read("!B")[0]
9029 assert(_version == 4)
9030 _type = reader.read("!B")[0]
9031 assert(_type == 11)
9032 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009033 orig_reader = reader
9034 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009035 obj.xid = reader.read("!L")[0]
9036 obj.cookie = reader.read("!Q")[0]
9037 obj.priority = reader.read("!H")[0]
9038 obj.reason = reader.read("!B")[0]
9039 obj.table_id = reader.read("!B")[0]
9040 obj.duration_sec = reader.read("!L")[0]
9041 obj.duration_nsec = reader.read("!L")[0]
9042 obj.idle_timeout = reader.read("!H")[0]
9043 obj.hard_timeout = reader.read("!H")[0]
9044 obj.packet_count = reader.read("!Q")[0]
9045 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009046 obj.match = common.match.unpack(reader)
9047 return obj
9048
9049 def __eq__(self, other):
9050 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009051 if self.xid != other.xid: return False
9052 if self.cookie != other.cookie: return False
9053 if self.priority != other.priority: return False
9054 if self.reason != other.reason: return False
9055 if self.table_id != other.table_id: return False
9056 if self.duration_sec != other.duration_sec: return False
9057 if self.duration_nsec != other.duration_nsec: return False
9058 if self.idle_timeout != other.idle_timeout: return False
9059 if self.hard_timeout != other.hard_timeout: return False
9060 if self.packet_count != other.packet_count: return False
9061 if self.byte_count != other.byte_count: return False
9062 if self.match != other.match: return False
9063 return True
9064
Rich Lanec2ee4b82013-04-24 17:12:38 -07009065 def pretty_print(self, q):
9066 q.text("flow_removed {")
9067 with q.group():
9068 with q.indent(2):
9069 q.breakable()
9070 q.text("xid = ");
9071 if self.xid != None:
9072 q.text("%#x" % self.xid)
9073 else:
9074 q.text('None')
9075 q.text(","); q.breakable()
9076 q.text("cookie = ");
9077 q.text("%#x" % self.cookie)
9078 q.text(","); q.breakable()
9079 q.text("priority = ");
9080 q.text("%#x" % self.priority)
9081 q.text(","); q.breakable()
9082 q.text("reason = ");
9083 q.text("%#x" % self.reason)
9084 q.text(","); q.breakable()
9085 q.text("table_id = ");
9086 q.text("%#x" % self.table_id)
9087 q.text(","); q.breakable()
9088 q.text("duration_sec = ");
9089 q.text("%#x" % self.duration_sec)
9090 q.text(","); q.breakable()
9091 q.text("duration_nsec = ");
9092 q.text("%#x" % self.duration_nsec)
9093 q.text(","); q.breakable()
9094 q.text("idle_timeout = ");
9095 q.text("%#x" % self.idle_timeout)
9096 q.text(","); q.breakable()
9097 q.text("hard_timeout = ");
9098 q.text("%#x" % self.hard_timeout)
9099 q.text(","); q.breakable()
9100 q.text("packet_count = ");
9101 q.text("%#x" % self.packet_count)
9102 q.text(","); q.breakable()
9103 q.text("byte_count = ");
9104 q.text("%#x" % self.byte_count)
9105 q.text(","); q.breakable()
9106 q.text("match = ");
9107 q.pp(self.match)
9108 q.breakable()
9109 q.text('}')
9110
Rich Lane7dcdf022013-12-11 14:45:27 -08009111message.subtypes[11] = flow_removed
9112
9113class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009114 version = 4
9115 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009116 stats_type = 1
9117
9118 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009119 if xid != None:
9120 self.xid = xid
9121 else:
9122 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009123 if flags != None:
9124 self.flags = flags
9125 else:
9126 self.flags = 0
9127 if entries != None:
9128 self.entries = entries
9129 else:
9130 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009131 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009132
9133 def pack(self):
9134 packed = []
9135 packed.append(struct.pack("!B", self.version))
9136 packed.append(struct.pack("!B", self.type))
9137 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9138 packed.append(struct.pack("!L", self.xid))
9139 packed.append(struct.pack("!H", self.stats_type))
9140 packed.append(struct.pack("!H", self.flags))
9141 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009142 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009143 length = sum([len(x) for x in packed])
9144 packed[2] = struct.pack("!H", length)
9145 return ''.join(packed)
9146
9147 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009148 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009149 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009150 _version = reader.read("!B")[0]
9151 assert(_version == 4)
9152 _type = reader.read("!B")[0]
9153 assert(_type == 19)
9154 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009155 orig_reader = reader
9156 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009157 obj.xid = reader.read("!L")[0]
9158 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009159 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009160 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009161 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009162 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009163 return obj
9164
9165 def __eq__(self, other):
9166 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009167 if self.xid != other.xid: return False
9168 if self.flags != other.flags: return False
9169 if self.entries != other.entries: return False
9170 return True
9171
Rich Lanec2ee4b82013-04-24 17:12:38 -07009172 def pretty_print(self, q):
9173 q.text("flow_stats_reply {")
9174 with q.group():
9175 with q.indent(2):
9176 q.breakable()
9177 q.text("xid = ");
9178 if self.xid != None:
9179 q.text("%#x" % self.xid)
9180 else:
9181 q.text('None')
9182 q.text(","); q.breakable()
9183 q.text("flags = ");
9184 q.text("%#x" % self.flags)
9185 q.text(","); q.breakable()
9186 q.text("entries = ");
9187 q.pp(self.entries)
9188 q.breakable()
9189 q.text('}')
9190
Rich Lane7dcdf022013-12-11 14:45:27 -08009191stats_reply.subtypes[1] = flow_stats_reply
9192
9193class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009194 version = 4
9195 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009196 stats_type = 1
9197
9198 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 -08009199 if xid != None:
9200 self.xid = xid
9201 else:
9202 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009203 if flags != None:
9204 self.flags = flags
9205 else:
9206 self.flags = 0
9207 if table_id != None:
9208 self.table_id = table_id
9209 else:
9210 self.table_id = 0
9211 if out_port != None:
9212 self.out_port = out_port
9213 else:
9214 self.out_port = 0
9215 if out_group != None:
9216 self.out_group = out_group
9217 else:
9218 self.out_group = 0
9219 if cookie != None:
9220 self.cookie = cookie
9221 else:
9222 self.cookie = 0
9223 if cookie_mask != None:
9224 self.cookie_mask = cookie_mask
9225 else:
9226 self.cookie_mask = 0
9227 if match != None:
9228 self.match = match
9229 else:
9230 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009231 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009232
9233 def pack(self):
9234 packed = []
9235 packed.append(struct.pack("!B", self.version))
9236 packed.append(struct.pack("!B", self.type))
9237 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9238 packed.append(struct.pack("!L", self.xid))
9239 packed.append(struct.pack("!H", self.stats_type))
9240 packed.append(struct.pack("!H", self.flags))
9241 packed.append('\x00' * 4)
9242 packed.append(struct.pack("!B", self.table_id))
9243 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07009244 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009245 packed.append(struct.pack("!L", self.out_group))
9246 packed.append('\x00' * 4)
9247 packed.append(struct.pack("!Q", self.cookie))
9248 packed.append(struct.pack("!Q", self.cookie_mask))
9249 packed.append(self.match.pack())
9250 length = sum([len(x) for x in packed])
9251 packed[2] = struct.pack("!H", length)
9252 return ''.join(packed)
9253
9254 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009255 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009256 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009257 _version = reader.read("!B")[0]
9258 assert(_version == 4)
9259 _type = reader.read("!B")[0]
9260 assert(_type == 18)
9261 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009262 orig_reader = reader
9263 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009264 obj.xid = reader.read("!L")[0]
9265 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009266 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009267 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009268 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009269 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009270 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07009271 obj.out_port = util.unpack_port_no(reader)
9272 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009273 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009274 obj.cookie = reader.read("!Q")[0]
9275 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009276 obj.match = common.match.unpack(reader)
9277 return obj
9278
9279 def __eq__(self, other):
9280 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009281 if self.xid != other.xid: return False
9282 if self.flags != other.flags: return False
9283 if self.table_id != other.table_id: return False
9284 if self.out_port != other.out_port: return False
9285 if self.out_group != other.out_group: return False
9286 if self.cookie != other.cookie: return False
9287 if self.cookie_mask != other.cookie_mask: return False
9288 if self.match != other.match: return False
9289 return True
9290
Rich Lanec2ee4b82013-04-24 17:12:38 -07009291 def pretty_print(self, q):
9292 q.text("flow_stats_request {")
9293 with q.group():
9294 with q.indent(2):
9295 q.breakable()
9296 q.text("xid = ");
9297 if self.xid != None:
9298 q.text("%#x" % self.xid)
9299 else:
9300 q.text('None')
9301 q.text(","); q.breakable()
9302 q.text("flags = ");
9303 q.text("%#x" % self.flags)
9304 q.text(","); q.breakable()
9305 q.text("table_id = ");
9306 q.text("%#x" % self.table_id)
9307 q.text(","); q.breakable()
9308 q.text("out_port = ");
9309 q.text(util.pretty_port(self.out_port))
9310 q.text(","); q.breakable()
9311 q.text("out_group = ");
9312 q.text("%#x" % self.out_group)
9313 q.text(","); q.breakable()
9314 q.text("cookie = ");
9315 q.text("%#x" % self.cookie)
9316 q.text(","); q.breakable()
9317 q.text("cookie_mask = ");
9318 q.text("%#x" % self.cookie_mask)
9319 q.text(","); q.breakable()
9320 q.text("match = ");
9321 q.pp(self.match)
9322 q.breakable()
9323 q.text('}')
9324
Rich Lane7dcdf022013-12-11 14:45:27 -08009325stats_request.subtypes[1] = flow_stats_request
9326
9327class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009328 version = 4
9329 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07009330
9331 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009332 if xid != None:
9333 self.xid = xid
9334 else:
9335 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009336 if flags != None:
9337 self.flags = flags
9338 else:
9339 self.flags = 0
9340 if miss_send_len != None:
9341 self.miss_send_len = miss_send_len
9342 else:
9343 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009344 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009345
9346 def pack(self):
9347 packed = []
9348 packed.append(struct.pack("!B", self.version))
9349 packed.append(struct.pack("!B", self.type))
9350 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9351 packed.append(struct.pack("!L", self.xid))
9352 packed.append(struct.pack("!H", self.flags))
9353 packed.append(struct.pack("!H", self.miss_send_len))
9354 length = sum([len(x) for x in packed])
9355 packed[2] = struct.pack("!H", length)
9356 return ''.join(packed)
9357
9358 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009359 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009360 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009361 _version = reader.read("!B")[0]
9362 assert(_version == 4)
9363 _type = reader.read("!B")[0]
9364 assert(_type == 8)
9365 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009366 orig_reader = reader
9367 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009368 obj.xid = reader.read("!L")[0]
9369 obj.flags = reader.read("!H")[0]
9370 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009371 return obj
9372
9373 def __eq__(self, other):
9374 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009375 if self.xid != other.xid: return False
9376 if self.flags != other.flags: return False
9377 if self.miss_send_len != other.miss_send_len: return False
9378 return True
9379
Rich Lanec2ee4b82013-04-24 17:12:38 -07009380 def pretty_print(self, q):
9381 q.text("get_config_reply {")
9382 with q.group():
9383 with q.indent(2):
9384 q.breakable()
9385 q.text("xid = ");
9386 if self.xid != None:
9387 q.text("%#x" % self.xid)
9388 else:
9389 q.text('None')
9390 q.text(","); q.breakable()
9391 q.text("flags = ");
9392 q.text("%#x" % self.flags)
9393 q.text(","); q.breakable()
9394 q.text("miss_send_len = ");
9395 q.text("%#x" % self.miss_send_len)
9396 q.breakable()
9397 q.text('}')
9398
Rich Lane7dcdf022013-12-11 14:45:27 -08009399message.subtypes[8] = get_config_reply
9400
9401class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009402 version = 4
9403 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07009404
9405 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009406 if xid != None:
9407 self.xid = xid
9408 else:
9409 self.xid = None
9410 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009411
9412 def pack(self):
9413 packed = []
9414 packed.append(struct.pack("!B", self.version))
9415 packed.append(struct.pack("!B", self.type))
9416 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9417 packed.append(struct.pack("!L", self.xid))
9418 length = sum([len(x) for x in packed])
9419 packed[2] = struct.pack("!H", length)
9420 return ''.join(packed)
9421
9422 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009423 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009424 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009425 _version = reader.read("!B")[0]
9426 assert(_version == 4)
9427 _type = reader.read("!B")[0]
9428 assert(_type == 7)
9429 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009430 orig_reader = reader
9431 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009432 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009433 return obj
9434
9435 def __eq__(self, other):
9436 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009437 if self.xid != other.xid: return False
9438 return True
9439
Rich Lanec2ee4b82013-04-24 17:12:38 -07009440 def pretty_print(self, q):
9441 q.text("get_config_request {")
9442 with q.group():
9443 with q.indent(2):
9444 q.breakable()
9445 q.text("xid = ");
9446 if self.xid != None:
9447 q.text("%#x" % self.xid)
9448 else:
9449 q.text('None')
9450 q.breakable()
9451 q.text('}')
9452
Rich Lane7dcdf022013-12-11 14:45:27 -08009453message.subtypes[7] = get_config_request
9454
9455class group_mod(message):
9456 subtypes = {}
9457
Rich Lane95f7fc92014-01-27 17:08:16 -08009458 version = 4
9459 type = 15
9460
9461 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
9462 if xid != None:
9463 self.xid = xid
9464 else:
9465 self.xid = None
9466 if command != None:
9467 self.command = command
9468 else:
9469 self.command = 0
9470 if group_type != None:
9471 self.group_type = group_type
9472 else:
9473 self.group_type = 0
9474 if group_id != None:
9475 self.group_id = group_id
9476 else:
9477 self.group_id = 0
9478 if buckets != None:
9479 self.buckets = buckets
9480 else:
9481 self.buckets = []
9482 return
9483
9484 def pack(self):
9485 packed = []
9486 packed.append(struct.pack("!B", self.version))
9487 packed.append(struct.pack("!B", self.type))
9488 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9489 packed.append(struct.pack("!L", self.xid))
9490 packed.append(struct.pack("!H", self.command))
9491 packed.append(struct.pack("!B", self.group_type))
9492 packed.append('\x00' * 1)
9493 packed.append(struct.pack("!L", self.group_id))
9494 packed.append(loxi.generic_util.pack_list(self.buckets))
9495 length = sum([len(x) for x in packed])
9496 packed[2] = struct.pack("!H", length)
9497 return ''.join(packed)
9498
Rich Lane7dcdf022013-12-11 14:45:27 -08009499 @staticmethod
9500 def unpack(reader):
9501 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08009502 subclass = group_mod.subtypes.get(subtype)
9503 if subclass:
9504 return subclass.unpack(reader)
9505
9506 obj = group_mod()
9507 _version = reader.read("!B")[0]
9508 assert(_version == 4)
9509 _type = reader.read("!B")[0]
9510 assert(_type == 15)
9511 _length = reader.read("!H")[0]
9512 orig_reader = reader
9513 reader = orig_reader.slice(_length - (2 + 2))
9514 obj.xid = reader.read("!L")[0]
9515 obj.command = reader.read("!H")[0]
9516 obj.group_type = reader.read("!B")[0]
9517 reader.skip(1)
9518 obj.group_id = reader.read("!L")[0]
9519 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
9520 return obj
9521
9522 def __eq__(self, other):
9523 if type(self) != type(other): return False
9524 if self.xid != other.xid: return False
9525 if self.command != other.command: return False
9526 if self.group_type != other.group_type: return False
9527 if self.group_id != other.group_id: return False
9528 if self.buckets != other.buckets: return False
9529 return True
9530
9531 def pretty_print(self, q):
9532 q.text("group_mod {")
9533 with q.group():
9534 with q.indent(2):
9535 q.breakable()
9536 q.text("xid = ");
9537 if self.xid != None:
9538 q.text("%#x" % self.xid)
9539 else:
9540 q.text('None')
9541 q.text(","); q.breakable()
9542 q.text("group_type = ");
9543 q.text("%#x" % self.group_type)
9544 q.text(","); q.breakable()
9545 q.text("group_id = ");
9546 q.text("%#x" % self.group_id)
9547 q.text(","); q.breakable()
9548 q.text("buckets = ");
9549 q.pp(self.buckets)
9550 q.breakable()
9551 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009552
9553message.subtypes[15] = group_mod
9554
9555class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08009556 version = 4
9557 type = 15
9558 command = 0
9559
9560 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009561 if xid != None:
9562 self.xid = xid
9563 else:
9564 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08009565 if group_type != None:
9566 self.group_type = group_type
9567 else:
9568 self.group_type = 0
9569 if group_id != None:
9570 self.group_id = group_id
9571 else:
9572 self.group_id = 0
9573 if buckets != None:
9574 self.buckets = buckets
9575 else:
9576 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009577 return
Rich Lane7b0f2012013-11-22 14:15:26 -08009578
9579 def pack(self):
9580 packed = []
9581 packed.append(struct.pack("!B", self.version))
9582 packed.append(struct.pack("!B", self.type))
9583 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9584 packed.append(struct.pack("!L", self.xid))
9585 packed.append(struct.pack("!H", self.command))
9586 packed.append(struct.pack("!B", self.group_type))
9587 packed.append('\x00' * 1)
9588 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08009589 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08009590 length = sum([len(x) for x in packed])
9591 packed[2] = struct.pack("!H", length)
9592 return ''.join(packed)
9593
9594 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009595 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08009596 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -08009597 _version = reader.read("!B")[0]
9598 assert(_version == 4)
9599 _type = reader.read("!B")[0]
9600 assert(_type == 15)
9601 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009602 orig_reader = reader
9603 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08009604 obj.xid = reader.read("!L")[0]
9605 _command = reader.read("!H")[0]
9606 assert(_command == 0)
9607 obj.group_type = reader.read("!B")[0]
9608 reader.skip(1)
9609 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009610 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08009611 return obj
9612
9613 def __eq__(self, other):
9614 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08009615 if self.xid != other.xid: return False
9616 if self.group_type != other.group_type: return False
9617 if self.group_id != other.group_id: return False
9618 if self.buckets != other.buckets: return False
9619 return True
9620
Rich Lane7b0f2012013-11-22 14:15:26 -08009621 def pretty_print(self, q):
9622 q.text("group_add {")
9623 with q.group():
9624 with q.indent(2):
9625 q.breakable()
9626 q.text("xid = ");
9627 if self.xid != None:
9628 q.text("%#x" % self.xid)
9629 else:
9630 q.text('None')
9631 q.text(","); q.breakable()
9632 q.text("group_type = ");
9633 q.text("%#x" % self.group_type)
9634 q.text(","); q.breakable()
9635 q.text("group_id = ");
9636 q.text("%#x" % self.group_id)
9637 q.text(","); q.breakable()
9638 q.text("buckets = ");
9639 q.pp(self.buckets)
9640 q.breakable()
9641 q.text('}')
9642
Rich Lane7dcdf022013-12-11 14:45:27 -08009643group_mod.subtypes[0] = group_add
9644
9645class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08009646 version = 4
9647 type = 15
9648 command = 2
9649
9650 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009651 if xid != None:
9652 self.xid = xid
9653 else:
9654 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08009655 if group_type != None:
9656 self.group_type = group_type
9657 else:
9658 self.group_type = 0
9659 if group_id != None:
9660 self.group_id = group_id
9661 else:
9662 self.group_id = 0
9663 if buckets != None:
9664 self.buckets = buckets
9665 else:
9666 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009667 return
Rich Lane7b0f2012013-11-22 14:15:26 -08009668
9669 def pack(self):
9670 packed = []
9671 packed.append(struct.pack("!B", self.version))
9672 packed.append(struct.pack("!B", self.type))
9673 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9674 packed.append(struct.pack("!L", self.xid))
9675 packed.append(struct.pack("!H", self.command))
9676 packed.append(struct.pack("!B", self.group_type))
9677 packed.append('\x00' * 1)
9678 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08009679 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08009680 length = sum([len(x) for x in packed])
9681 packed[2] = struct.pack("!H", length)
9682 return ''.join(packed)
9683
9684 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009685 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08009686 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -08009687 _version = reader.read("!B")[0]
9688 assert(_version == 4)
9689 _type = reader.read("!B")[0]
9690 assert(_type == 15)
9691 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009692 orig_reader = reader
9693 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08009694 obj.xid = reader.read("!L")[0]
9695 _command = reader.read("!H")[0]
9696 assert(_command == 2)
9697 obj.group_type = reader.read("!B")[0]
9698 reader.skip(1)
9699 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009700 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08009701 return obj
9702
9703 def __eq__(self, other):
9704 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08009705 if self.xid != other.xid: return False
9706 if self.group_type != other.group_type: return False
9707 if self.group_id != other.group_id: return False
9708 if self.buckets != other.buckets: return False
9709 return True
9710
Rich Lane7b0f2012013-11-22 14:15:26 -08009711 def pretty_print(self, q):
9712 q.text("group_delete {")
9713 with q.group():
9714 with q.indent(2):
9715 q.breakable()
9716 q.text("xid = ");
9717 if self.xid != None:
9718 q.text("%#x" % self.xid)
9719 else:
9720 q.text('None')
9721 q.text(","); q.breakable()
9722 q.text("group_type = ");
9723 q.text("%#x" % self.group_type)
9724 q.text(","); q.breakable()
9725 q.text("group_id = ");
9726 q.text("%#x" % self.group_id)
9727 q.text(","); q.breakable()
9728 q.text("buckets = ");
9729 q.pp(self.buckets)
9730 q.breakable()
9731 q.text('}')
9732
Rich Lane7dcdf022013-12-11 14:45:27 -08009733group_mod.subtypes[2] = group_delete
9734
9735class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009736 version = 4
9737 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009738 stats_type = 7
9739
9740 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009741 if xid != None:
9742 self.xid = xid
9743 else:
9744 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009745 if flags != None:
9746 self.flags = flags
9747 else:
9748 self.flags = 0
9749 if entries != None:
9750 self.entries = entries
9751 else:
9752 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009753 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009754
9755 def pack(self):
9756 packed = []
9757 packed.append(struct.pack("!B", self.version))
9758 packed.append(struct.pack("!B", self.type))
9759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9760 packed.append(struct.pack("!L", self.xid))
9761 packed.append(struct.pack("!H", self.stats_type))
9762 packed.append(struct.pack("!H", self.flags))
9763 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009764 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009765 length = sum([len(x) for x in packed])
9766 packed[2] = struct.pack("!H", length)
9767 return ''.join(packed)
9768
9769 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009770 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009771 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009772 _version = reader.read("!B")[0]
9773 assert(_version == 4)
9774 _type = reader.read("!B")[0]
9775 assert(_type == 19)
9776 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009777 orig_reader = reader
9778 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009779 obj.xid = reader.read("!L")[0]
9780 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009781 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07009782 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009783 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009784 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009785 return obj
9786
9787 def __eq__(self, other):
9788 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009789 if self.xid != other.xid: return False
9790 if self.flags != other.flags: return False
9791 if self.entries != other.entries: return False
9792 return True
9793
Rich Lanec2ee4b82013-04-24 17:12:38 -07009794 def pretty_print(self, q):
9795 q.text("group_desc_stats_reply {")
9796 with q.group():
9797 with q.indent(2):
9798 q.breakable()
9799 q.text("xid = ");
9800 if self.xid != None:
9801 q.text("%#x" % self.xid)
9802 else:
9803 q.text('None')
9804 q.text(","); q.breakable()
9805 q.text("flags = ");
9806 q.text("%#x" % self.flags)
9807 q.text(","); q.breakable()
9808 q.text("entries = ");
9809 q.pp(self.entries)
9810 q.breakable()
9811 q.text('}')
9812
Rich Lane7dcdf022013-12-11 14:45:27 -08009813stats_reply.subtypes[7] = group_desc_stats_reply
9814
9815class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009816 version = 4
9817 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009818 stats_type = 7
9819
9820 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009821 if xid != None:
9822 self.xid = xid
9823 else:
9824 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009825 if flags != None:
9826 self.flags = flags
9827 else:
9828 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009829 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009830
9831 def pack(self):
9832 packed = []
9833 packed.append(struct.pack("!B", self.version))
9834 packed.append(struct.pack("!B", self.type))
9835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9836 packed.append(struct.pack("!L", self.xid))
9837 packed.append(struct.pack("!H", self.stats_type))
9838 packed.append(struct.pack("!H", self.flags))
9839 packed.append('\x00' * 4)
9840 length = sum([len(x) for x in packed])
9841 packed[2] = struct.pack("!H", length)
9842 return ''.join(packed)
9843
9844 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009845 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009846 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009847 _version = reader.read("!B")[0]
9848 assert(_version == 4)
9849 _type = reader.read("!B")[0]
9850 assert(_type == 18)
9851 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009852 orig_reader = reader
9853 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009854 obj.xid = reader.read("!L")[0]
9855 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009856 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07009857 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009858 reader.skip(4)
9859 return obj
9860
9861 def __eq__(self, other):
9862 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009863 if self.xid != other.xid: return False
9864 if self.flags != other.flags: return False
9865 return True
9866
Rich Lanec2ee4b82013-04-24 17:12:38 -07009867 def pretty_print(self, q):
9868 q.text("group_desc_stats_request {")
9869 with q.group():
9870 with q.indent(2):
9871 q.breakable()
9872 q.text("xid = ");
9873 if self.xid != None:
9874 q.text("%#x" % self.xid)
9875 else:
9876 q.text('None')
9877 q.text(","); q.breakable()
9878 q.text("flags = ");
9879 q.text("%#x" % self.flags)
9880 q.breakable()
9881 q.text('}')
9882
Rich Lane7dcdf022013-12-11 14:45:27 -08009883stats_request.subtypes[7] = group_desc_stats_request
9884
9885class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009886 version = 4
9887 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009888 stats_type = 8
9889
9890 def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009891 if xid != None:
9892 self.xid = xid
9893 else:
9894 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009895 if flags != None:
9896 self.flags = flags
9897 else:
9898 self.flags = 0
9899 if types != None:
9900 self.types = types
9901 else:
9902 self.types = 0
9903 if capabilities != None:
9904 self.capabilities = capabilities
9905 else:
9906 self.capabilities = 0
9907 if max_groups_all != None:
9908 self.max_groups_all = max_groups_all
9909 else:
9910 self.max_groups_all = 0
9911 if max_groups_select != None:
9912 self.max_groups_select = max_groups_select
9913 else:
9914 self.max_groups_select = 0
9915 if max_groups_indirect != None:
9916 self.max_groups_indirect = max_groups_indirect
9917 else:
9918 self.max_groups_indirect = 0
9919 if max_groups_ff != None:
9920 self.max_groups_ff = max_groups_ff
9921 else:
9922 self.max_groups_ff = 0
9923 if actions_all != None:
9924 self.actions_all = actions_all
9925 else:
9926 self.actions_all = 0
9927 if actions_select != None:
9928 self.actions_select = actions_select
9929 else:
9930 self.actions_select = 0
9931 if actions_indirect != None:
9932 self.actions_indirect = actions_indirect
9933 else:
9934 self.actions_indirect = 0
9935 if actions_ff != None:
9936 self.actions_ff = actions_ff
9937 else:
9938 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009939 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009940
9941 def pack(self):
9942 packed = []
9943 packed.append(struct.pack("!B", self.version))
9944 packed.append(struct.pack("!B", self.type))
9945 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9946 packed.append(struct.pack("!L", self.xid))
9947 packed.append(struct.pack("!H", self.stats_type))
9948 packed.append(struct.pack("!H", self.flags))
9949 packed.append('\x00' * 4)
9950 packed.append(struct.pack("!L", self.types))
9951 packed.append(struct.pack("!L", self.capabilities))
9952 packed.append(struct.pack("!L", self.max_groups_all))
9953 packed.append(struct.pack("!L", self.max_groups_select))
9954 packed.append(struct.pack("!L", self.max_groups_indirect))
9955 packed.append(struct.pack("!L", self.max_groups_ff))
9956 packed.append(struct.pack("!L", self.actions_all))
9957 packed.append(struct.pack("!L", self.actions_select))
9958 packed.append(struct.pack("!L", self.actions_indirect))
9959 packed.append(struct.pack("!L", self.actions_ff))
9960 length = sum([len(x) for x in packed])
9961 packed[2] = struct.pack("!H", length)
9962 return ''.join(packed)
9963
9964 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009965 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009966 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009967 _version = reader.read("!B")[0]
9968 assert(_version == 4)
9969 _type = reader.read("!B")[0]
9970 assert(_type == 19)
9971 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009972 orig_reader = reader
9973 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009974 obj.xid = reader.read("!L")[0]
9975 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009976 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07009977 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009978 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009979 obj.types = reader.read("!L")[0]
9980 obj.capabilities = reader.read("!L")[0]
9981 obj.max_groups_all = reader.read("!L")[0]
9982 obj.max_groups_select = reader.read("!L")[0]
9983 obj.max_groups_indirect = reader.read("!L")[0]
9984 obj.max_groups_ff = reader.read("!L")[0]
9985 obj.actions_all = reader.read("!L")[0]
9986 obj.actions_select = reader.read("!L")[0]
9987 obj.actions_indirect = reader.read("!L")[0]
9988 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009989 return obj
9990
9991 def __eq__(self, other):
9992 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009993 if self.xid != other.xid: return False
9994 if self.flags != other.flags: return False
9995 if self.types != other.types: return False
9996 if self.capabilities != other.capabilities: return False
9997 if self.max_groups_all != other.max_groups_all: return False
9998 if self.max_groups_select != other.max_groups_select: return False
9999 if self.max_groups_indirect != other.max_groups_indirect: return False
10000 if self.max_groups_ff != other.max_groups_ff: return False
10001 if self.actions_all != other.actions_all: return False
10002 if self.actions_select != other.actions_select: return False
10003 if self.actions_indirect != other.actions_indirect: return False
10004 if self.actions_ff != other.actions_ff: return False
10005 return True
10006
Rich Lanec2ee4b82013-04-24 17:12:38 -070010007 def pretty_print(self, q):
10008 q.text("group_features_stats_reply {")
10009 with q.group():
10010 with q.indent(2):
10011 q.breakable()
10012 q.text("xid = ");
10013 if self.xid != None:
10014 q.text("%#x" % self.xid)
10015 else:
10016 q.text('None')
10017 q.text(","); q.breakable()
10018 q.text("flags = ");
10019 q.text("%#x" % self.flags)
10020 q.text(","); q.breakable()
10021 q.text("types = ");
10022 q.text("%#x" % self.types)
10023 q.text(","); q.breakable()
10024 q.text("capabilities = ");
10025 q.text("%#x" % self.capabilities)
10026 q.text(","); q.breakable()
10027 q.text("max_groups_all = ");
10028 q.text("%#x" % self.max_groups_all)
10029 q.text(","); q.breakable()
10030 q.text("max_groups_select = ");
10031 q.text("%#x" % self.max_groups_select)
10032 q.text(","); q.breakable()
10033 q.text("max_groups_indirect = ");
10034 q.text("%#x" % self.max_groups_indirect)
10035 q.text(","); q.breakable()
10036 q.text("max_groups_ff = ");
10037 q.text("%#x" % self.max_groups_ff)
10038 q.text(","); q.breakable()
10039 q.text("actions_all = ");
10040 q.text("%#x" % self.actions_all)
10041 q.text(","); q.breakable()
10042 q.text("actions_select = ");
10043 q.text("%#x" % self.actions_select)
10044 q.text(","); q.breakable()
10045 q.text("actions_indirect = ");
10046 q.text("%#x" % self.actions_indirect)
10047 q.text(","); q.breakable()
10048 q.text("actions_ff = ");
10049 q.text("%#x" % self.actions_ff)
10050 q.breakable()
10051 q.text('}')
10052
Rich Lane7dcdf022013-12-11 14:45:27 -080010053stats_reply.subtypes[8] = group_features_stats_reply
10054
10055class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010056 version = 4
10057 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010058 stats_type = 8
10059
10060 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010061 if xid != None:
10062 self.xid = xid
10063 else:
10064 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010065 if flags != None:
10066 self.flags = flags
10067 else:
10068 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010069 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010070
10071 def pack(self):
10072 packed = []
10073 packed.append(struct.pack("!B", self.version))
10074 packed.append(struct.pack("!B", self.type))
10075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10076 packed.append(struct.pack("!L", self.xid))
10077 packed.append(struct.pack("!H", self.stats_type))
10078 packed.append(struct.pack("!H", self.flags))
10079 packed.append('\x00' * 4)
10080 length = sum([len(x) for x in packed])
10081 packed[2] = struct.pack("!H", length)
10082 return ''.join(packed)
10083
10084 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010085 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010086 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010087 _version = reader.read("!B")[0]
10088 assert(_version == 4)
10089 _type = reader.read("!B")[0]
10090 assert(_type == 18)
10091 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010092 orig_reader = reader
10093 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010094 obj.xid = reader.read("!L")[0]
10095 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010096 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070010097 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010098 reader.skip(4)
10099 return obj
10100
10101 def __eq__(self, other):
10102 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010103 if self.xid != other.xid: return False
10104 if self.flags != other.flags: return False
10105 return True
10106
Rich Lanec2ee4b82013-04-24 17:12:38 -070010107 def pretty_print(self, q):
10108 q.text("group_features_stats_request {")
10109 with q.group():
10110 with q.indent(2):
10111 q.breakable()
10112 q.text("xid = ");
10113 if self.xid != None:
10114 q.text("%#x" % self.xid)
10115 else:
10116 q.text('None')
10117 q.text(","); q.breakable()
10118 q.text("flags = ");
10119 q.text("%#x" % self.flags)
10120 q.breakable()
10121 q.text('}')
10122
Rich Lane7dcdf022013-12-11 14:45:27 -080010123stats_request.subtypes[8] = group_features_stats_request
10124
10125class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010126 version = 4
10127 type = 1
10128 err_type = 6
10129
10130 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010131 if xid != None:
10132 self.xid = xid
10133 else:
10134 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010135 if code != None:
10136 self.code = code
10137 else:
10138 self.code = 0
10139 if data != None:
10140 self.data = data
10141 else:
10142 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010143 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010144
10145 def pack(self):
10146 packed = []
10147 packed.append(struct.pack("!B", self.version))
10148 packed.append(struct.pack("!B", self.type))
10149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10150 packed.append(struct.pack("!L", self.xid))
10151 packed.append(struct.pack("!H", self.err_type))
10152 packed.append(struct.pack("!H", self.code))
10153 packed.append(self.data)
10154 length = sum([len(x) for x in packed])
10155 packed[2] = struct.pack("!H", length)
10156 return ''.join(packed)
10157
10158 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010159 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010160 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010161 _version = reader.read("!B")[0]
10162 assert(_version == 4)
10163 _type = reader.read("!B")[0]
10164 assert(_type == 1)
10165 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010166 orig_reader = reader
10167 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010168 obj.xid = reader.read("!L")[0]
10169 _err_type = reader.read("!H")[0]
10170 assert(_err_type == 6)
10171 obj.code = reader.read("!H")[0]
10172 obj.data = str(reader.read_all())
10173 return obj
10174
10175 def __eq__(self, other):
10176 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010177 if self.xid != other.xid: return False
10178 if self.code != other.code: return False
10179 if self.data != other.data: return False
10180 return True
10181
Rich Lane6f4978c2013-10-20 21:33:52 -070010182 def pretty_print(self, q):
10183 q.text("group_mod_failed_error_msg {")
10184 with q.group():
10185 with q.indent(2):
10186 q.breakable()
10187 q.text("xid = ");
10188 if self.xid != None:
10189 q.text("%#x" % self.xid)
10190 else:
10191 q.text('None')
10192 q.text(","); q.breakable()
10193 q.text("code = ");
10194 q.text("%#x" % self.code)
10195 q.text(","); q.breakable()
10196 q.text("data = ");
10197 q.pp(self.data)
10198 q.breakable()
10199 q.text('}')
10200
Rich Lane7dcdf022013-12-11 14:45:27 -080010201error_msg.subtypes[6] = group_mod_failed_error_msg
10202
10203class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010204 version = 4
10205 type = 15
10206 command = 1
10207
10208 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010209 if xid != None:
10210 self.xid = xid
10211 else:
10212 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010213 if group_type != None:
10214 self.group_type = group_type
10215 else:
10216 self.group_type = 0
10217 if group_id != None:
10218 self.group_id = group_id
10219 else:
10220 self.group_id = 0
10221 if buckets != None:
10222 self.buckets = buckets
10223 else:
10224 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010225 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010226
10227 def pack(self):
10228 packed = []
10229 packed.append(struct.pack("!B", self.version))
10230 packed.append(struct.pack("!B", self.type))
10231 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10232 packed.append(struct.pack("!L", self.xid))
10233 packed.append(struct.pack("!H", self.command))
10234 packed.append(struct.pack("!B", self.group_type))
10235 packed.append('\x00' * 1)
10236 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010237 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010238 length = sum([len(x) for x in packed])
10239 packed[2] = struct.pack("!H", length)
10240 return ''.join(packed)
10241
10242 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010243 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010244 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080010245 _version = reader.read("!B")[0]
10246 assert(_version == 4)
10247 _type = reader.read("!B")[0]
10248 assert(_type == 15)
10249 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010250 orig_reader = reader
10251 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010252 obj.xid = reader.read("!L")[0]
10253 _command = reader.read("!H")[0]
10254 assert(_command == 1)
10255 obj.group_type = reader.read("!B")[0]
10256 reader.skip(1)
10257 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010258 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010259 return obj
10260
10261 def __eq__(self, other):
10262 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010263 if self.xid != other.xid: return False
10264 if self.group_type != other.group_type: return False
10265 if self.group_id != other.group_id: return False
10266 if self.buckets != other.buckets: return False
10267 return True
10268
Rich Lane7b0f2012013-11-22 14:15:26 -080010269 def pretty_print(self, q):
10270 q.text("group_modify {")
10271 with q.group():
10272 with q.indent(2):
10273 q.breakable()
10274 q.text("xid = ");
10275 if self.xid != None:
10276 q.text("%#x" % self.xid)
10277 else:
10278 q.text('None')
10279 q.text(","); q.breakable()
10280 q.text("group_type = ");
10281 q.text("%#x" % self.group_type)
10282 q.text(","); q.breakable()
10283 q.text("group_id = ");
10284 q.text("%#x" % self.group_id)
10285 q.text(","); q.breakable()
10286 q.text("buckets = ");
10287 q.pp(self.buckets)
10288 q.breakable()
10289 q.text('}')
10290
Rich Lane7dcdf022013-12-11 14:45:27 -080010291group_mod.subtypes[1] = group_modify
10292
10293class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010294 version = 4
10295 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010296 stats_type = 6
10297
10298 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010299 if xid != None:
10300 self.xid = xid
10301 else:
10302 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010303 if flags != None:
10304 self.flags = flags
10305 else:
10306 self.flags = 0
10307 if entries != None:
10308 self.entries = entries
10309 else:
10310 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010311 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010312
10313 def pack(self):
10314 packed = []
10315 packed.append(struct.pack("!B", self.version))
10316 packed.append(struct.pack("!B", self.type))
10317 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10318 packed.append(struct.pack("!L", self.xid))
10319 packed.append(struct.pack("!H", self.stats_type))
10320 packed.append(struct.pack("!H", self.flags))
10321 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010322 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010323 length = sum([len(x) for x in packed])
10324 packed[2] = struct.pack("!H", length)
10325 return ''.join(packed)
10326
10327 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010328 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010329 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010330 _version = reader.read("!B")[0]
10331 assert(_version == 4)
10332 _type = reader.read("!B")[0]
10333 assert(_type == 19)
10334 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010335 orig_reader = reader
10336 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010337 obj.xid = reader.read("!L")[0]
10338 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010339 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010340 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010341 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010342 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010343 return obj
10344
10345 def __eq__(self, other):
10346 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010347 if self.xid != other.xid: return False
10348 if self.flags != other.flags: return False
10349 if self.entries != other.entries: return False
10350 return True
10351
Rich Lanec2ee4b82013-04-24 17:12:38 -070010352 def pretty_print(self, q):
10353 q.text("group_stats_reply {")
10354 with q.group():
10355 with q.indent(2):
10356 q.breakable()
10357 q.text("xid = ");
10358 if self.xid != None:
10359 q.text("%#x" % self.xid)
10360 else:
10361 q.text('None')
10362 q.text(","); q.breakable()
10363 q.text("flags = ");
10364 q.text("%#x" % self.flags)
10365 q.text(","); q.breakable()
10366 q.text("entries = ");
10367 q.pp(self.entries)
10368 q.breakable()
10369 q.text('}')
10370
Rich Lane7dcdf022013-12-11 14:45:27 -080010371stats_reply.subtypes[6] = group_stats_reply
10372
10373class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010374 version = 4
10375 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010376 stats_type = 6
10377
10378 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010379 if xid != None:
10380 self.xid = xid
10381 else:
10382 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010383 if flags != None:
10384 self.flags = flags
10385 else:
10386 self.flags = 0
10387 if group_id != None:
10388 self.group_id = group_id
10389 else:
10390 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010391 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010392
10393 def pack(self):
10394 packed = []
10395 packed.append(struct.pack("!B", self.version))
10396 packed.append(struct.pack("!B", self.type))
10397 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10398 packed.append(struct.pack("!L", self.xid))
10399 packed.append(struct.pack("!H", self.stats_type))
10400 packed.append(struct.pack("!H", self.flags))
10401 packed.append('\x00' * 4)
10402 packed.append(struct.pack("!L", self.group_id))
10403 packed.append('\x00' * 4)
10404 length = sum([len(x) for x in packed])
10405 packed[2] = struct.pack("!H", length)
10406 return ''.join(packed)
10407
10408 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010409 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010410 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010411 _version = reader.read("!B")[0]
10412 assert(_version == 4)
10413 _type = reader.read("!B")[0]
10414 assert(_type == 18)
10415 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010416 orig_reader = reader
10417 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010418 obj.xid = reader.read("!L")[0]
10419 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010420 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010421 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010422 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010423 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010424 reader.skip(4)
10425 return obj
10426
10427 def __eq__(self, other):
10428 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010429 if self.xid != other.xid: return False
10430 if self.flags != other.flags: return False
10431 if self.group_id != other.group_id: return False
10432 return True
10433
Rich Lanec2ee4b82013-04-24 17:12:38 -070010434 def pretty_print(self, q):
10435 q.text("group_stats_request {")
10436 with q.group():
10437 with q.indent(2):
10438 q.breakable()
10439 q.text("xid = ");
10440 if self.xid != None:
10441 q.text("%#x" % self.xid)
10442 else:
10443 q.text('None')
10444 q.text(","); q.breakable()
10445 q.text("flags = ");
10446 q.text("%#x" % self.flags)
10447 q.text(","); q.breakable()
10448 q.text("group_id = ");
10449 q.text("%#x" % self.group_id)
10450 q.breakable()
10451 q.text('}')
10452
Rich Lane7dcdf022013-12-11 14:45:27 -080010453stats_request.subtypes[6] = group_stats_request
10454
10455class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010456 version = 4
10457 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070010458
10459 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010460 if xid != None:
10461 self.xid = xid
10462 else:
10463 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010464 if elements != None:
10465 self.elements = elements
10466 else:
10467 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010468 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010469
10470 def pack(self):
10471 packed = []
10472 packed.append(struct.pack("!B", self.version))
10473 packed.append(struct.pack("!B", self.type))
10474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10475 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080010476 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010477 length = sum([len(x) for x in packed])
10478 packed[2] = struct.pack("!H", length)
10479 return ''.join(packed)
10480
10481 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010482 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010483 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070010484 _version = reader.read("!B")[0]
10485 assert(_version == 4)
10486 _type = reader.read("!B")[0]
10487 assert(_type == 0)
10488 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010489 orig_reader = reader
10490 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010491 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080010492 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010493 return obj
10494
10495 def __eq__(self, other):
10496 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010497 if self.xid != other.xid: return False
10498 if self.elements != other.elements: return False
10499 return True
10500
Rich Lanec2ee4b82013-04-24 17:12:38 -070010501 def pretty_print(self, q):
10502 q.text("hello {")
10503 with q.group():
10504 with q.indent(2):
10505 q.breakable()
10506 q.text("xid = ");
10507 if self.xid != None:
10508 q.text("%#x" % self.xid)
10509 else:
10510 q.text('None')
10511 q.text(","); q.breakable()
10512 q.text("elements = ");
10513 q.pp(self.elements)
10514 q.breakable()
10515 q.text('}')
10516
Rich Lane7dcdf022013-12-11 14:45:27 -080010517message.subtypes[0] = hello
10518
10519class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010520 version = 4
10521 type = 1
10522 err_type = 0
10523
10524 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010525 if xid != None:
10526 self.xid = xid
10527 else:
10528 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010529 if code != None:
10530 self.code = code
10531 else:
10532 self.code = 0
10533 if data != None:
10534 self.data = data
10535 else:
10536 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010537 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010538
10539 def pack(self):
10540 packed = []
10541 packed.append(struct.pack("!B", self.version))
10542 packed.append(struct.pack("!B", self.type))
10543 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10544 packed.append(struct.pack("!L", self.xid))
10545 packed.append(struct.pack("!H", self.err_type))
10546 packed.append(struct.pack("!H", self.code))
10547 packed.append(self.data)
10548 length = sum([len(x) for x in packed])
10549 packed[2] = struct.pack("!H", length)
10550 return ''.join(packed)
10551
10552 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010553 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010554 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010555 _version = reader.read("!B")[0]
10556 assert(_version == 4)
10557 _type = reader.read("!B")[0]
10558 assert(_type == 1)
10559 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010560 orig_reader = reader
10561 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010562 obj.xid = reader.read("!L")[0]
10563 _err_type = reader.read("!H")[0]
10564 assert(_err_type == 0)
10565 obj.code = reader.read("!H")[0]
10566 obj.data = str(reader.read_all())
10567 return obj
10568
10569 def __eq__(self, other):
10570 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010571 if self.xid != other.xid: return False
10572 if self.code != other.code: return False
10573 if self.data != other.data: return False
10574 return True
10575
Rich Lane6f4978c2013-10-20 21:33:52 -070010576 def pretty_print(self, q):
10577 q.text("hello_failed_error_msg {")
10578 with q.group():
10579 with q.indent(2):
10580 q.breakable()
10581 q.text("xid = ");
10582 if self.xid != None:
10583 q.text("%#x" % self.xid)
10584 else:
10585 q.text('None')
10586 q.text(","); q.breakable()
10587 q.text("code = ");
10588 q.text("%#x" % self.code)
10589 q.text(","); q.breakable()
10590 q.text("data = ");
10591 q.pp(self.data)
10592 q.breakable()
10593 q.text('}')
10594
Rich Lane7dcdf022013-12-11 14:45:27 -080010595error_msg.subtypes[0] = hello_failed_error_msg
10596
10597class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010598 version = 4
10599 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010600 stats_type = 10
10601
10602 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010603 if xid != None:
10604 self.xid = xid
10605 else:
10606 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010607 if flags != None:
10608 self.flags = flags
10609 else:
10610 self.flags = 0
10611 if entries != None:
10612 self.entries = entries
10613 else:
10614 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010615 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010616
10617 def pack(self):
10618 packed = []
10619 packed.append(struct.pack("!B", self.version))
10620 packed.append(struct.pack("!B", self.type))
10621 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10622 packed.append(struct.pack("!L", self.xid))
10623 packed.append(struct.pack("!H", self.stats_type))
10624 packed.append(struct.pack("!H", self.flags))
10625 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010626 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010627 length = sum([len(x) for x in packed])
10628 packed[2] = struct.pack("!H", length)
10629 return ''.join(packed)
10630
10631 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010632 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010633 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010634 _version = reader.read("!B")[0]
10635 assert(_version == 4)
10636 _type = reader.read("!B")[0]
10637 assert(_type == 19)
10638 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010639 orig_reader = reader
10640 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010641 obj.xid = reader.read("!L")[0]
10642 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010643 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070010644 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010645 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010646 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010647 return obj
10648
10649 def __eq__(self, other):
10650 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010651 if self.xid != other.xid: return False
10652 if self.flags != other.flags: return False
10653 if self.entries != other.entries: return False
10654 return True
10655
Rich Lanec2ee4b82013-04-24 17:12:38 -070010656 def pretty_print(self, q):
10657 q.text("meter_config_stats_reply {")
10658 with q.group():
10659 with q.indent(2):
10660 q.breakable()
10661 q.text("xid = ");
10662 if self.xid != None:
10663 q.text("%#x" % self.xid)
10664 else:
10665 q.text('None')
10666 q.text(","); q.breakable()
10667 q.text("flags = ");
10668 q.text("%#x" % self.flags)
10669 q.text(","); q.breakable()
10670 q.text("entries = ");
10671 q.pp(self.entries)
10672 q.breakable()
10673 q.text('}')
10674
Rich Lane7dcdf022013-12-11 14:45:27 -080010675stats_reply.subtypes[10] = meter_config_stats_reply
10676
10677class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010678 version = 4
10679 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010680 stats_type = 10
10681
10682 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010683 if xid != None:
10684 self.xid = xid
10685 else:
10686 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010687 if flags != None:
10688 self.flags = flags
10689 else:
10690 self.flags = 0
10691 if meter_id != None:
10692 self.meter_id = meter_id
10693 else:
10694 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010695 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010696
10697 def pack(self):
10698 packed = []
10699 packed.append(struct.pack("!B", self.version))
10700 packed.append(struct.pack("!B", self.type))
10701 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10702 packed.append(struct.pack("!L", self.xid))
10703 packed.append(struct.pack("!H", self.stats_type))
10704 packed.append(struct.pack("!H", self.flags))
10705 packed.append('\x00' * 4)
10706 packed.append(struct.pack("!L", self.meter_id))
10707 packed.append('\x00' * 4)
10708 length = sum([len(x) for x in packed])
10709 packed[2] = struct.pack("!H", length)
10710 return ''.join(packed)
10711
10712 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010713 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010714 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010715 _version = reader.read("!B")[0]
10716 assert(_version == 4)
10717 _type = reader.read("!B")[0]
10718 assert(_type == 18)
10719 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010720 orig_reader = reader
10721 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010722 obj.xid = reader.read("!L")[0]
10723 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010724 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070010725 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010726 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010727 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010728 reader.skip(4)
10729 return obj
10730
10731 def __eq__(self, other):
10732 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010733 if self.xid != other.xid: return False
10734 if self.flags != other.flags: return False
10735 if self.meter_id != other.meter_id: return False
10736 return True
10737
Rich Lanec2ee4b82013-04-24 17:12:38 -070010738 def pretty_print(self, q):
10739 q.text("meter_config_stats_request {")
10740 with q.group():
10741 with q.indent(2):
10742 q.breakable()
10743 q.text("xid = ");
10744 if self.xid != None:
10745 q.text("%#x" % self.xid)
10746 else:
10747 q.text('None')
10748 q.text(","); q.breakable()
10749 q.text("flags = ");
10750 q.text("%#x" % self.flags)
10751 q.text(","); q.breakable()
10752 q.text("meter_id = ");
10753 q.text("%#x" % self.meter_id)
10754 q.breakable()
10755 q.text('}')
10756
Rich Lane7dcdf022013-12-11 14:45:27 -080010757stats_request.subtypes[10] = meter_config_stats_request
10758
10759class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010760 version = 4
10761 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010762 stats_type = 11
10763
10764 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010765 if xid != None:
10766 self.xid = xid
10767 else:
10768 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010769 if flags != None:
10770 self.flags = flags
10771 else:
10772 self.flags = 0
10773 if features != None:
10774 self.features = features
10775 else:
10776 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080010777 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010778
10779 def pack(self):
10780 packed = []
10781 packed.append(struct.pack("!B", self.version))
10782 packed.append(struct.pack("!B", self.type))
10783 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10784 packed.append(struct.pack("!L", self.xid))
10785 packed.append(struct.pack("!H", self.stats_type))
10786 packed.append(struct.pack("!H", self.flags))
10787 packed.append('\x00' * 4)
10788 packed.append(self.features.pack())
10789 length = sum([len(x) for x in packed])
10790 packed[2] = struct.pack("!H", length)
10791 return ''.join(packed)
10792
10793 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010794 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010795 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010796 _version = reader.read("!B")[0]
10797 assert(_version == 4)
10798 _type = reader.read("!B")[0]
10799 assert(_type == 19)
10800 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010801 orig_reader = reader
10802 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010803 obj.xid = reader.read("!L")[0]
10804 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010805 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070010806 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010807 reader.skip(4)
10808 obj.features = common.meter_features.unpack(reader)
10809 return obj
10810
10811 def __eq__(self, other):
10812 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010813 if self.xid != other.xid: return False
10814 if self.flags != other.flags: return False
10815 if self.features != other.features: return False
10816 return True
10817
Rich Lanec2ee4b82013-04-24 17:12:38 -070010818 def pretty_print(self, q):
10819 q.text("meter_features_stats_reply {")
10820 with q.group():
10821 with q.indent(2):
10822 q.breakable()
10823 q.text("xid = ");
10824 if self.xid != None:
10825 q.text("%#x" % self.xid)
10826 else:
10827 q.text('None')
10828 q.text(","); q.breakable()
10829 q.text("flags = ");
10830 q.text("%#x" % self.flags)
10831 q.text(","); q.breakable()
10832 q.text("features = ");
10833 q.pp(self.features)
10834 q.breakable()
10835 q.text('}')
10836
Rich Lane7dcdf022013-12-11 14:45:27 -080010837stats_reply.subtypes[11] = meter_features_stats_reply
10838
10839class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010840 version = 4
10841 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010842 stats_type = 11
10843
10844 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010845 if xid != None:
10846 self.xid = xid
10847 else:
10848 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010849 if flags != None:
10850 self.flags = flags
10851 else:
10852 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010853 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010854
10855 def pack(self):
10856 packed = []
10857 packed.append(struct.pack("!B", self.version))
10858 packed.append(struct.pack("!B", self.type))
10859 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10860 packed.append(struct.pack("!L", self.xid))
10861 packed.append(struct.pack("!H", self.stats_type))
10862 packed.append(struct.pack("!H", self.flags))
10863 packed.append('\x00' * 4)
10864 length = sum([len(x) for x in packed])
10865 packed[2] = struct.pack("!H", length)
10866 return ''.join(packed)
10867
10868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010869 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010870 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010871 _version = reader.read("!B")[0]
10872 assert(_version == 4)
10873 _type = reader.read("!B")[0]
10874 assert(_type == 18)
10875 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010876 orig_reader = reader
10877 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010878 obj.xid = reader.read("!L")[0]
10879 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010880 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070010881 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010882 reader.skip(4)
10883 return obj
10884
10885 def __eq__(self, other):
10886 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010887 if self.xid != other.xid: return False
10888 if self.flags != other.flags: return False
10889 return True
10890
Rich Lanec2ee4b82013-04-24 17:12:38 -070010891 def pretty_print(self, q):
10892 q.text("meter_features_stats_request {")
10893 with q.group():
10894 with q.indent(2):
10895 q.breakable()
10896 q.text("xid = ");
10897 if self.xid != None:
10898 q.text("%#x" % self.xid)
10899 else:
10900 q.text('None')
10901 q.text(","); q.breakable()
10902 q.text("flags = ");
10903 q.text("%#x" % self.flags)
10904 q.breakable()
10905 q.text('}')
10906
Rich Lane7dcdf022013-12-11 14:45:27 -080010907stats_request.subtypes[11] = meter_features_stats_request
10908
10909class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010910 version = 4
10911 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070010912
10913 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010914 if xid != None:
10915 self.xid = xid
10916 else:
10917 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010918 if command != None:
10919 self.command = command
10920 else:
10921 self.command = 0
10922 if flags != None:
10923 self.flags = flags
10924 else:
10925 self.flags = 0
10926 if meter_id != None:
10927 self.meter_id = meter_id
10928 else:
10929 self.meter_id = 0
10930 if meters != None:
10931 self.meters = meters
10932 else:
10933 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010934 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010935
10936 def pack(self):
10937 packed = []
10938 packed.append(struct.pack("!B", self.version))
10939 packed.append(struct.pack("!B", self.type))
10940 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10941 packed.append(struct.pack("!L", self.xid))
10942 packed.append(struct.pack("!H", self.command))
10943 packed.append(struct.pack("!H", self.flags))
10944 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010945 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010946 length = sum([len(x) for x in packed])
10947 packed[2] = struct.pack("!H", length)
10948 return ''.join(packed)
10949
10950 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010951 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010952 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070010953 _version = reader.read("!B")[0]
10954 assert(_version == 4)
10955 _type = reader.read("!B")[0]
10956 assert(_type == 29)
10957 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010958 orig_reader = reader
10959 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010960 obj.xid = reader.read("!L")[0]
10961 obj.command = reader.read("!H")[0]
10962 obj.flags = reader.read("!H")[0]
10963 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010964 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010965 return obj
10966
10967 def __eq__(self, other):
10968 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010969 if self.xid != other.xid: return False
10970 if self.command != other.command: return False
10971 if self.flags != other.flags: return False
10972 if self.meter_id != other.meter_id: return False
10973 if self.meters != other.meters: return False
10974 return True
10975
Rich Lanec2ee4b82013-04-24 17:12:38 -070010976 def pretty_print(self, q):
10977 q.text("meter_mod {")
10978 with q.group():
10979 with q.indent(2):
10980 q.breakable()
10981 q.text("xid = ");
10982 if self.xid != None:
10983 q.text("%#x" % self.xid)
10984 else:
10985 q.text('None')
10986 q.text(","); q.breakable()
10987 q.text("command = ");
10988 q.text("%#x" % self.command)
10989 q.text(","); q.breakable()
10990 q.text("flags = ");
10991 q.text("%#x" % self.flags)
10992 q.text(","); q.breakable()
10993 q.text("meter_id = ");
10994 q.text("%#x" % self.meter_id)
10995 q.text(","); q.breakable()
10996 q.text("meters = ");
10997 q.pp(self.meters)
10998 q.breakable()
10999 q.text('}')
11000
Rich Lane7dcdf022013-12-11 14:45:27 -080011001message.subtypes[29] = meter_mod
11002
11003class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011004 version = 4
11005 type = 1
11006 err_type = 12
11007
11008 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011009 if xid != None:
11010 self.xid = xid
11011 else:
11012 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011013 if code != None:
11014 self.code = code
11015 else:
11016 self.code = 0
11017 if data != None:
11018 self.data = data
11019 else:
11020 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011021 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011022
11023 def pack(self):
11024 packed = []
11025 packed.append(struct.pack("!B", self.version))
11026 packed.append(struct.pack("!B", self.type))
11027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11028 packed.append(struct.pack("!L", self.xid))
11029 packed.append(struct.pack("!H", self.err_type))
11030 packed.append(struct.pack("!H", self.code))
11031 packed.append(self.data)
11032 length = sum([len(x) for x in packed])
11033 packed[2] = struct.pack("!H", length)
11034 return ''.join(packed)
11035
11036 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011037 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011038 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011039 _version = reader.read("!B")[0]
11040 assert(_version == 4)
11041 _type = reader.read("!B")[0]
11042 assert(_type == 1)
11043 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011044 orig_reader = reader
11045 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011046 obj.xid = reader.read("!L")[0]
11047 _err_type = reader.read("!H")[0]
11048 assert(_err_type == 12)
11049 obj.code = reader.read("!H")[0]
11050 obj.data = str(reader.read_all())
11051 return obj
11052
11053 def __eq__(self, other):
11054 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011055 if self.xid != other.xid: return False
11056 if self.code != other.code: return False
11057 if self.data != other.data: return False
11058 return True
11059
Rich Lane6f4978c2013-10-20 21:33:52 -070011060 def pretty_print(self, q):
11061 q.text("meter_mod_failed_error_msg {")
11062 with q.group():
11063 with q.indent(2):
11064 q.breakable()
11065 q.text("xid = ");
11066 if self.xid != None:
11067 q.text("%#x" % self.xid)
11068 else:
11069 q.text('None')
11070 q.text(","); q.breakable()
11071 q.text("code = ");
11072 q.text("%#x" % self.code)
11073 q.text(","); q.breakable()
11074 q.text("data = ");
11075 q.pp(self.data)
11076 q.breakable()
11077 q.text('}')
11078
Rich Lane7dcdf022013-12-11 14:45:27 -080011079error_msg.subtypes[12] = meter_mod_failed_error_msg
11080
11081class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011082 version = 4
11083 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011084 stats_type = 9
11085
11086 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011087 if xid != None:
11088 self.xid = xid
11089 else:
11090 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011091 if flags != None:
11092 self.flags = flags
11093 else:
11094 self.flags = 0
11095 if entries != None:
11096 self.entries = entries
11097 else:
11098 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011099 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011100
11101 def pack(self):
11102 packed = []
11103 packed.append(struct.pack("!B", self.version))
11104 packed.append(struct.pack("!B", self.type))
11105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11106 packed.append(struct.pack("!L", self.xid))
11107 packed.append(struct.pack("!H", self.stats_type))
11108 packed.append(struct.pack("!H", self.flags))
11109 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011110 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011111 length = sum([len(x) for x in packed])
11112 packed[2] = struct.pack("!H", length)
11113 return ''.join(packed)
11114
11115 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011116 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011117 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011118 _version = reader.read("!B")[0]
11119 assert(_version == 4)
11120 _type = reader.read("!B")[0]
11121 assert(_type == 19)
11122 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011123 orig_reader = reader
11124 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011125 obj.xid = reader.read("!L")[0]
11126 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011127 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011128 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011129 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011130 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011131 return obj
11132
11133 def __eq__(self, other):
11134 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011135 if self.xid != other.xid: return False
11136 if self.flags != other.flags: return False
11137 if self.entries != other.entries: return False
11138 return True
11139
Rich Lanec2ee4b82013-04-24 17:12:38 -070011140 def pretty_print(self, q):
11141 q.text("meter_stats_reply {")
11142 with q.group():
11143 with q.indent(2):
11144 q.breakable()
11145 q.text("xid = ");
11146 if self.xid != None:
11147 q.text("%#x" % self.xid)
11148 else:
11149 q.text('None')
11150 q.text(","); q.breakable()
11151 q.text("flags = ");
11152 q.text("%#x" % self.flags)
11153 q.text(","); q.breakable()
11154 q.text("entries = ");
11155 q.pp(self.entries)
11156 q.breakable()
11157 q.text('}')
11158
Rich Lane7dcdf022013-12-11 14:45:27 -080011159stats_reply.subtypes[9] = meter_stats_reply
11160
11161class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011162 version = 4
11163 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011164 stats_type = 9
11165
11166 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011167 if xid != None:
11168 self.xid = xid
11169 else:
11170 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011171 if flags != None:
11172 self.flags = flags
11173 else:
11174 self.flags = 0
11175 if meter_id != None:
11176 self.meter_id = meter_id
11177 else:
11178 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011179 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011180
11181 def pack(self):
11182 packed = []
11183 packed.append(struct.pack("!B", self.version))
11184 packed.append(struct.pack("!B", self.type))
11185 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11186 packed.append(struct.pack("!L", self.xid))
11187 packed.append(struct.pack("!H", self.stats_type))
11188 packed.append(struct.pack("!H", self.flags))
11189 packed.append('\x00' * 4)
11190 packed.append(struct.pack("!L", self.meter_id))
11191 packed.append('\x00' * 4)
11192 length = sum([len(x) for x in packed])
11193 packed[2] = struct.pack("!H", length)
11194 return ''.join(packed)
11195
11196 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011197 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011198 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011199 _version = reader.read("!B")[0]
11200 assert(_version == 4)
11201 _type = reader.read("!B")[0]
11202 assert(_type == 18)
11203 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011204 orig_reader = reader
11205 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011206 obj.xid = reader.read("!L")[0]
11207 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011208 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011209 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011210 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011211 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011212 reader.skip(4)
11213 return obj
11214
11215 def __eq__(self, other):
11216 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011217 if self.xid != other.xid: return False
11218 if self.flags != other.flags: return False
11219 if self.meter_id != other.meter_id: return False
11220 return True
11221
Rich Lanec2ee4b82013-04-24 17:12:38 -070011222 def pretty_print(self, q):
11223 q.text("meter_stats_request {")
11224 with q.group():
11225 with q.indent(2):
11226 q.breakable()
11227 q.text("xid = ");
11228 if self.xid != None:
11229 q.text("%#x" % self.xid)
11230 else:
11231 q.text('None')
11232 q.text(","); q.breakable()
11233 q.text("flags = ");
11234 q.text("%#x" % self.flags)
11235 q.text(","); q.breakable()
11236 q.text("meter_id = ");
11237 q.text("%#x" % self.meter_id)
11238 q.breakable()
11239 q.text('}')
11240
Rich Lane7dcdf022013-12-11 14:45:27 -080011241stats_request.subtypes[9] = meter_stats_request
11242
11243class nicira_header(experimenter):
11244 subtypes = {}
11245
Rich Lane95f7fc92014-01-27 17:08:16 -080011246 version = 4
11247 type = 4
11248 experimenter = 8992
11249
11250 def __init__(self, xid=None, subtype=None):
11251 if xid != None:
11252 self.xid = xid
11253 else:
11254 self.xid = None
11255 if subtype != None:
11256 self.subtype = subtype
11257 else:
11258 self.subtype = 0
11259 return
11260
11261 def pack(self):
11262 packed = []
11263 packed.append(struct.pack("!B", self.version))
11264 packed.append(struct.pack("!B", self.type))
11265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11266 packed.append(struct.pack("!L", self.xid))
11267 packed.append(struct.pack("!L", self.experimenter))
11268 packed.append(struct.pack("!L", self.subtype))
11269 length = sum([len(x) for x in packed])
11270 packed[2] = struct.pack("!H", length)
11271 return ''.join(packed)
11272
Rich Lane7dcdf022013-12-11 14:45:27 -080011273 @staticmethod
11274 def unpack(reader):
11275 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080011276 subclass = nicira_header.subtypes.get(subtype)
11277 if subclass:
11278 return subclass.unpack(reader)
11279
11280 obj = nicira_header()
11281 _version = reader.read("!B")[0]
11282 assert(_version == 4)
11283 _type = reader.read("!B")[0]
11284 assert(_type == 4)
11285 _length = reader.read("!H")[0]
11286 orig_reader = reader
11287 reader = orig_reader.slice(_length - (2 + 2))
11288 obj.xid = reader.read("!L")[0]
11289 _experimenter = reader.read("!L")[0]
11290 assert(_experimenter == 8992)
11291 obj.subtype = reader.read("!L")[0]
11292 return obj
11293
11294 def __eq__(self, other):
11295 if type(self) != type(other): return False
11296 if self.xid != other.xid: return False
11297 if self.subtype != other.subtype: return False
11298 return True
11299
11300 def pretty_print(self, q):
11301 q.text("nicira_header {")
11302 with q.group():
11303 with q.indent(2):
11304 q.breakable()
11305 q.text("xid = ");
11306 if self.xid != None:
11307 q.text("%#x" % self.xid)
11308 else:
11309 q.text('None')
11310 q.breakable()
11311 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011312
11313experimenter.subtypes[8992] = nicira_header
11314
11315class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011316 version = 4
11317 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070011318
11319 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011320 if xid != None:
11321 self.xid = xid
11322 else:
11323 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011324 if buffer_id != None:
11325 self.buffer_id = buffer_id
11326 else:
11327 self.buffer_id = 0
11328 if total_len != None:
11329 self.total_len = total_len
11330 else:
11331 self.total_len = 0
11332 if reason != None:
11333 self.reason = reason
11334 else:
11335 self.reason = 0
11336 if table_id != None:
11337 self.table_id = table_id
11338 else:
11339 self.table_id = 0
11340 if cookie != None:
11341 self.cookie = cookie
11342 else:
11343 self.cookie = 0
11344 if match != None:
11345 self.match = match
11346 else:
11347 self.match = common.match()
11348 if data != None:
11349 self.data = data
11350 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011351 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011352 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011353
11354 def pack(self):
11355 packed = []
11356 packed.append(struct.pack("!B", self.version))
11357 packed.append(struct.pack("!B", self.type))
11358 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11359 packed.append(struct.pack("!L", self.xid))
11360 packed.append(struct.pack("!L", self.buffer_id))
11361 packed.append(struct.pack("!H", self.total_len))
11362 packed.append(struct.pack("!B", self.reason))
11363 packed.append(struct.pack("!B", self.table_id))
11364 packed.append(struct.pack("!Q", self.cookie))
11365 packed.append(self.match.pack())
11366 packed.append('\x00' * 2)
11367 packed.append(self.data)
11368 length = sum([len(x) for x in packed])
11369 packed[2] = struct.pack("!H", length)
11370 return ''.join(packed)
11371
11372 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011373 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011374 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070011375 _version = reader.read("!B")[0]
11376 assert(_version == 4)
11377 _type = reader.read("!B")[0]
11378 assert(_type == 10)
11379 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011380 orig_reader = reader
11381 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011382 obj.xid = reader.read("!L")[0]
11383 obj.buffer_id = reader.read("!L")[0]
11384 obj.total_len = reader.read("!H")[0]
11385 obj.reason = reader.read("!B")[0]
11386 obj.table_id = reader.read("!B")[0]
11387 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011388 obj.match = common.match.unpack(reader)
11389 reader.skip(2)
11390 obj.data = str(reader.read_all())
11391 return obj
11392
11393 def __eq__(self, other):
11394 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011395 if self.xid != other.xid: return False
11396 if self.buffer_id != other.buffer_id: return False
11397 if self.total_len != other.total_len: return False
11398 if self.reason != other.reason: return False
11399 if self.table_id != other.table_id: return False
11400 if self.cookie != other.cookie: return False
11401 if self.match != other.match: return False
11402 if self.data != other.data: return False
11403 return True
11404
Rich Lanec2ee4b82013-04-24 17:12:38 -070011405 def pretty_print(self, q):
11406 q.text("packet_in {")
11407 with q.group():
11408 with q.indent(2):
11409 q.breakable()
11410 q.text("xid = ");
11411 if self.xid != None:
11412 q.text("%#x" % self.xid)
11413 else:
11414 q.text('None')
11415 q.text(","); q.breakable()
11416 q.text("buffer_id = ");
11417 q.text("%#x" % self.buffer_id)
11418 q.text(","); q.breakable()
11419 q.text("total_len = ");
11420 q.text("%#x" % self.total_len)
11421 q.text(","); q.breakable()
11422 q.text("reason = ");
11423 q.text("%#x" % self.reason)
11424 q.text(","); q.breakable()
11425 q.text("table_id = ");
11426 q.text("%#x" % self.table_id)
11427 q.text(","); q.breakable()
11428 q.text("cookie = ");
11429 q.text("%#x" % self.cookie)
11430 q.text(","); q.breakable()
11431 q.text("match = ");
11432 q.pp(self.match)
11433 q.text(","); q.breakable()
11434 q.text("data = ");
11435 q.pp(self.data)
11436 q.breakable()
11437 q.text('}')
11438
Rich Lane7dcdf022013-12-11 14:45:27 -080011439message.subtypes[10] = packet_in
11440
11441class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011442 version = 4
11443 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070011444
11445 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011446 if xid != None:
11447 self.xid = xid
11448 else:
11449 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011450 if buffer_id != None:
11451 self.buffer_id = buffer_id
11452 else:
11453 self.buffer_id = 0
11454 if in_port != None:
11455 self.in_port = in_port
11456 else:
11457 self.in_port = 0
11458 if actions != None:
11459 self.actions = actions
11460 else:
11461 self.actions = []
11462 if data != None:
11463 self.data = data
11464 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011465 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011466 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011467
11468 def pack(self):
11469 packed = []
11470 packed.append(struct.pack("!B", self.version))
11471 packed.append(struct.pack("!B", self.type))
11472 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11473 packed.append(struct.pack("!L", self.xid))
11474 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070011475 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011476 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
11477 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080011478 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011479 packed[6] = struct.pack("!H", len(packed[-1]))
11480 packed.append(self.data)
11481 length = sum([len(x) for x in packed])
11482 packed[2] = struct.pack("!H", length)
11483 return ''.join(packed)
11484
11485 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011486 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011487 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070011488 _version = reader.read("!B")[0]
11489 assert(_version == 4)
11490 _type = reader.read("!B")[0]
11491 assert(_type == 13)
11492 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011493 orig_reader = reader
11494 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011495 obj.xid = reader.read("!L")[0]
11496 obj.buffer_id = reader.read("!L")[0]
11497 obj.in_port = util.unpack_port_no(reader)
11498 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011499 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080011500 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011501 obj.data = str(reader.read_all())
11502 return obj
11503
11504 def __eq__(self, other):
11505 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011506 if self.xid != other.xid: return False
11507 if self.buffer_id != other.buffer_id: return False
11508 if self.in_port != other.in_port: return False
11509 if self.actions != other.actions: return False
11510 if self.data != other.data: return False
11511 return True
11512
Rich Lanec2ee4b82013-04-24 17:12:38 -070011513 def pretty_print(self, q):
11514 q.text("packet_out {")
11515 with q.group():
11516 with q.indent(2):
11517 q.breakable()
11518 q.text("xid = ");
11519 if self.xid != None:
11520 q.text("%#x" % self.xid)
11521 else:
11522 q.text('None')
11523 q.text(","); q.breakable()
11524 q.text("buffer_id = ");
11525 q.text("%#x" % self.buffer_id)
11526 q.text(","); q.breakable()
11527 q.text("in_port = ");
11528 q.text(util.pretty_port(self.in_port))
11529 q.text(","); q.breakable()
11530 q.text("actions = ");
11531 q.pp(self.actions)
11532 q.text(","); q.breakable()
11533 q.text("data = ");
11534 q.pp(self.data)
11535 q.breakable()
11536 q.text('}')
11537
Rich Lane7dcdf022013-12-11 14:45:27 -080011538message.subtypes[13] = packet_out
11539
11540class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011541 version = 4
11542 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011543 stats_type = 13
11544
11545 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011546 if xid != None:
11547 self.xid = xid
11548 else:
11549 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011550 if flags != None:
11551 self.flags = flags
11552 else:
11553 self.flags = 0
11554 if entries != None:
11555 self.entries = entries
11556 else:
11557 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011558 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011559
11560 def pack(self):
11561 packed = []
11562 packed.append(struct.pack("!B", self.version))
11563 packed.append(struct.pack("!B", self.type))
11564 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11565 packed.append(struct.pack("!L", self.xid))
11566 packed.append(struct.pack("!H", self.stats_type))
11567 packed.append(struct.pack("!H", self.flags))
11568 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011569 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011570 length = sum([len(x) for x in packed])
11571 packed[2] = struct.pack("!H", length)
11572 return ''.join(packed)
11573
11574 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011575 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011576 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011577 _version = reader.read("!B")[0]
11578 assert(_version == 4)
11579 _type = reader.read("!B")[0]
11580 assert(_type == 19)
11581 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011582 orig_reader = reader
11583 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011584 obj.xid = reader.read("!L")[0]
11585 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011586 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070011587 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011588 reader.skip(4)
11589 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
11590 return obj
11591
11592 def __eq__(self, other):
11593 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011594 if self.xid != other.xid: return False
11595 if self.flags != other.flags: return False
11596 if self.entries != other.entries: return False
11597 return True
11598
Rich Lanec2ee4b82013-04-24 17:12:38 -070011599 def pretty_print(self, q):
11600 q.text("port_desc_stats_reply {")
11601 with q.group():
11602 with q.indent(2):
11603 q.breakable()
11604 q.text("xid = ");
11605 if self.xid != None:
11606 q.text("%#x" % self.xid)
11607 else:
11608 q.text('None')
11609 q.text(","); q.breakable()
11610 q.text("flags = ");
11611 q.text("%#x" % self.flags)
11612 q.text(","); q.breakable()
11613 q.text("entries = ");
11614 q.pp(self.entries)
11615 q.breakable()
11616 q.text('}')
11617
Rich Lane7dcdf022013-12-11 14:45:27 -080011618stats_reply.subtypes[13] = port_desc_stats_reply
11619
11620class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011621 version = 4
11622 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011623 stats_type = 13
11624
11625 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011626 if xid != None:
11627 self.xid = xid
11628 else:
11629 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011630 if flags != None:
11631 self.flags = flags
11632 else:
11633 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011634 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011635
11636 def pack(self):
11637 packed = []
11638 packed.append(struct.pack("!B", self.version))
11639 packed.append(struct.pack("!B", self.type))
11640 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11641 packed.append(struct.pack("!L", self.xid))
11642 packed.append(struct.pack("!H", self.stats_type))
11643 packed.append(struct.pack("!H", self.flags))
11644 packed.append('\x00' * 4)
11645 length = sum([len(x) for x in packed])
11646 packed[2] = struct.pack("!H", length)
11647 return ''.join(packed)
11648
11649 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011650 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011651 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011652 _version = reader.read("!B")[0]
11653 assert(_version == 4)
11654 _type = reader.read("!B")[0]
11655 assert(_type == 18)
11656 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011657 orig_reader = reader
11658 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011659 obj.xid = reader.read("!L")[0]
11660 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011661 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070011662 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011663 reader.skip(4)
11664 return obj
11665
11666 def __eq__(self, other):
11667 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011668 if self.xid != other.xid: return False
11669 if self.flags != other.flags: return False
11670 return True
11671
Rich Lanec2ee4b82013-04-24 17:12:38 -070011672 def pretty_print(self, q):
11673 q.text("port_desc_stats_request {")
11674 with q.group():
11675 with q.indent(2):
11676 q.breakable()
11677 q.text("xid = ");
11678 if self.xid != None:
11679 q.text("%#x" % self.xid)
11680 else:
11681 q.text('None')
11682 q.text(","); q.breakable()
11683 q.text("flags = ");
11684 q.text("%#x" % self.flags)
11685 q.breakable()
11686 q.text('}')
11687
Rich Lane7dcdf022013-12-11 14:45:27 -080011688stats_request.subtypes[13] = port_desc_stats_request
11689
11690class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011691 version = 4
11692 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070011693
11694 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011695 if xid != None:
11696 self.xid = xid
11697 else:
11698 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011699 if port_no != None:
11700 self.port_no = port_no
11701 else:
11702 self.port_no = 0
11703 if hw_addr != None:
11704 self.hw_addr = hw_addr
11705 else:
11706 self.hw_addr = [0,0,0,0,0,0]
11707 if config != None:
11708 self.config = config
11709 else:
11710 self.config = 0
11711 if mask != None:
11712 self.mask = mask
11713 else:
11714 self.mask = 0
11715 if advertise != None:
11716 self.advertise = advertise
11717 else:
11718 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011719 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011720
11721 def pack(self):
11722 packed = []
11723 packed.append(struct.pack("!B", self.version))
11724 packed.append(struct.pack("!B", self.type))
11725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11726 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070011727 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011728 packed.append('\x00' * 4)
11729 packed.append(struct.pack("!6B", *self.hw_addr))
11730 packed.append('\x00' * 2)
11731 packed.append(struct.pack("!L", self.config))
11732 packed.append(struct.pack("!L", self.mask))
11733 packed.append(struct.pack("!L", self.advertise))
11734 packed.append('\x00' * 4)
11735 length = sum([len(x) for x in packed])
11736 packed[2] = struct.pack("!H", length)
11737 return ''.join(packed)
11738
11739 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011740 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011741 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070011742 _version = reader.read("!B")[0]
11743 assert(_version == 4)
11744 _type = reader.read("!B")[0]
11745 assert(_type == 16)
11746 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011747 orig_reader = reader
11748 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011749 obj.xid = reader.read("!L")[0]
11750 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011751 reader.skip(4)
11752 obj.hw_addr = list(reader.read('!6B'))
11753 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070011754 obj.config = reader.read("!L")[0]
11755 obj.mask = reader.read("!L")[0]
11756 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011757 reader.skip(4)
11758 return obj
11759
11760 def __eq__(self, other):
11761 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011762 if self.xid != other.xid: return False
11763 if self.port_no != other.port_no: return False
11764 if self.hw_addr != other.hw_addr: return False
11765 if self.config != other.config: return False
11766 if self.mask != other.mask: return False
11767 if self.advertise != other.advertise: return False
11768 return True
11769
Rich Lanec2ee4b82013-04-24 17:12:38 -070011770 def pretty_print(self, q):
11771 q.text("port_mod {")
11772 with q.group():
11773 with q.indent(2):
11774 q.breakable()
11775 q.text("xid = ");
11776 if self.xid != None:
11777 q.text("%#x" % self.xid)
11778 else:
11779 q.text('None')
11780 q.text(","); q.breakable()
11781 q.text("port_no = ");
11782 q.text(util.pretty_port(self.port_no))
11783 q.text(","); q.breakable()
11784 q.text("hw_addr = ");
11785 q.text(util.pretty_mac(self.hw_addr))
11786 q.text(","); q.breakable()
11787 q.text("config = ");
11788 q.text("%#x" % self.config)
11789 q.text(","); q.breakable()
11790 q.text("mask = ");
11791 q.text("%#x" % self.mask)
11792 q.text(","); q.breakable()
11793 q.text("advertise = ");
11794 q.text("%#x" % self.advertise)
11795 q.breakable()
11796 q.text('}')
11797
Rich Lane7dcdf022013-12-11 14:45:27 -080011798message.subtypes[16] = port_mod
11799
11800class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011801 version = 4
11802 type = 1
11803 err_type = 7
11804
11805 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011806 if xid != None:
11807 self.xid = xid
11808 else:
11809 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011810 if code != None:
11811 self.code = code
11812 else:
11813 self.code = 0
11814 if data != None:
11815 self.data = data
11816 else:
11817 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011818 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011819
11820 def pack(self):
11821 packed = []
11822 packed.append(struct.pack("!B", self.version))
11823 packed.append(struct.pack("!B", self.type))
11824 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11825 packed.append(struct.pack("!L", self.xid))
11826 packed.append(struct.pack("!H", self.err_type))
11827 packed.append(struct.pack("!H", self.code))
11828 packed.append(self.data)
11829 length = sum([len(x) for x in packed])
11830 packed[2] = struct.pack("!H", length)
11831 return ''.join(packed)
11832
11833 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011834 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011835 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011836 _version = reader.read("!B")[0]
11837 assert(_version == 4)
11838 _type = reader.read("!B")[0]
11839 assert(_type == 1)
11840 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011841 orig_reader = reader
11842 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011843 obj.xid = reader.read("!L")[0]
11844 _err_type = reader.read("!H")[0]
11845 assert(_err_type == 7)
11846 obj.code = reader.read("!H")[0]
11847 obj.data = str(reader.read_all())
11848 return obj
11849
11850 def __eq__(self, other):
11851 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011852 if self.xid != other.xid: return False
11853 if self.code != other.code: return False
11854 if self.data != other.data: return False
11855 return True
11856
Rich Lane6f4978c2013-10-20 21:33:52 -070011857 def pretty_print(self, q):
11858 q.text("port_mod_failed_error_msg {")
11859 with q.group():
11860 with q.indent(2):
11861 q.breakable()
11862 q.text("xid = ");
11863 if self.xid != None:
11864 q.text("%#x" % self.xid)
11865 else:
11866 q.text('None')
11867 q.text(","); q.breakable()
11868 q.text("code = ");
11869 q.text("%#x" % self.code)
11870 q.text(","); q.breakable()
11871 q.text("data = ");
11872 q.pp(self.data)
11873 q.breakable()
11874 q.text('}')
11875
Rich Lane7dcdf022013-12-11 14:45:27 -080011876error_msg.subtypes[7] = port_mod_failed_error_msg
11877
11878class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011879 version = 4
11880 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011881 stats_type = 4
11882
11883 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011884 if xid != None:
11885 self.xid = xid
11886 else:
11887 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011888 if flags != None:
11889 self.flags = flags
11890 else:
11891 self.flags = 0
11892 if entries != None:
11893 self.entries = entries
11894 else:
11895 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011896 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011897
11898 def pack(self):
11899 packed = []
11900 packed.append(struct.pack("!B", self.version))
11901 packed.append(struct.pack("!B", self.type))
11902 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11903 packed.append(struct.pack("!L", self.xid))
11904 packed.append(struct.pack("!H", self.stats_type))
11905 packed.append(struct.pack("!H", self.flags))
11906 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011907 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011908 length = sum([len(x) for x in packed])
11909 packed[2] = struct.pack("!H", length)
11910 return ''.join(packed)
11911
11912 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011913 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011914 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011915 _version = reader.read("!B")[0]
11916 assert(_version == 4)
11917 _type = reader.read("!B")[0]
11918 assert(_type == 19)
11919 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011920 orig_reader = reader
11921 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011922 obj.xid = reader.read("!L")[0]
11923 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011924 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011925 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011926 reader.skip(4)
11927 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
11928 return obj
11929
11930 def __eq__(self, other):
11931 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011932 if self.xid != other.xid: return False
11933 if self.flags != other.flags: return False
11934 if self.entries != other.entries: return False
11935 return True
11936
Rich Lanec2ee4b82013-04-24 17:12:38 -070011937 def pretty_print(self, q):
11938 q.text("port_stats_reply {")
11939 with q.group():
11940 with q.indent(2):
11941 q.breakable()
11942 q.text("xid = ");
11943 if self.xid != None:
11944 q.text("%#x" % self.xid)
11945 else:
11946 q.text('None')
11947 q.text(","); q.breakable()
11948 q.text("flags = ");
11949 q.text("%#x" % self.flags)
11950 q.text(","); q.breakable()
11951 q.text("entries = ");
11952 q.pp(self.entries)
11953 q.breakable()
11954 q.text('}')
11955
Rich Lane7dcdf022013-12-11 14:45:27 -080011956stats_reply.subtypes[4] = port_stats_reply
11957
11958class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011959 version = 4
11960 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011961 stats_type = 4
11962
11963 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011964 if xid != None:
11965 self.xid = xid
11966 else:
11967 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011968 if flags != None:
11969 self.flags = flags
11970 else:
11971 self.flags = 0
11972 if port_no != None:
11973 self.port_no = port_no
11974 else:
11975 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011976 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011977
11978 def pack(self):
11979 packed = []
11980 packed.append(struct.pack("!B", self.version))
11981 packed.append(struct.pack("!B", self.type))
11982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11983 packed.append(struct.pack("!L", self.xid))
11984 packed.append(struct.pack("!H", self.stats_type))
11985 packed.append(struct.pack("!H", self.flags))
11986 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011987 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011988 packed.append('\x00' * 4)
11989 length = sum([len(x) for x in packed])
11990 packed[2] = struct.pack("!H", length)
11991 return ''.join(packed)
11992
11993 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011994 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011995 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011996 _version = reader.read("!B")[0]
11997 assert(_version == 4)
11998 _type = reader.read("!B")[0]
11999 assert(_type == 18)
12000 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012001 orig_reader = reader
12002 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012003 obj.xid = reader.read("!L")[0]
12004 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012005 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012006 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012007 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012008 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012009 reader.skip(4)
12010 return obj
12011
12012 def __eq__(self, other):
12013 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012014 if self.xid != other.xid: return False
12015 if self.flags != other.flags: return False
12016 if self.port_no != other.port_no: return False
12017 return True
12018
Rich Lanec2ee4b82013-04-24 17:12:38 -070012019 def pretty_print(self, q):
12020 q.text("port_stats_request {")
12021 with q.group():
12022 with q.indent(2):
12023 q.breakable()
12024 q.text("xid = ");
12025 if self.xid != None:
12026 q.text("%#x" % self.xid)
12027 else:
12028 q.text('None')
12029 q.text(","); q.breakable()
12030 q.text("flags = ");
12031 q.text("%#x" % self.flags)
12032 q.text(","); q.breakable()
12033 q.text("port_no = ");
12034 q.text(util.pretty_port(self.port_no))
12035 q.breakable()
12036 q.text('}')
12037
Rich Lane7dcdf022013-12-11 14:45:27 -080012038stats_request.subtypes[4] = port_stats_request
12039
12040class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012041 version = 4
12042 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070012043
12044 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012045 if xid != None:
12046 self.xid = xid
12047 else:
12048 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012049 if reason != None:
12050 self.reason = reason
12051 else:
12052 self.reason = 0
12053 if desc != None:
12054 self.desc = desc
12055 else:
12056 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080012057 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012058
12059 def pack(self):
12060 packed = []
12061 packed.append(struct.pack("!B", self.version))
12062 packed.append(struct.pack("!B", self.type))
12063 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12064 packed.append(struct.pack("!L", self.xid))
12065 packed.append(struct.pack("!B", self.reason))
12066 packed.append('\x00' * 7)
12067 packed.append(self.desc.pack())
12068 length = sum([len(x) for x in packed])
12069 packed[2] = struct.pack("!H", length)
12070 return ''.join(packed)
12071
12072 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012073 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012074 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070012075 _version = reader.read("!B")[0]
12076 assert(_version == 4)
12077 _type = reader.read("!B")[0]
12078 assert(_type == 12)
12079 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012080 orig_reader = reader
12081 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012082 obj.xid = reader.read("!L")[0]
12083 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012084 reader.skip(7)
12085 obj.desc = common.port_desc.unpack(reader)
12086 return obj
12087
12088 def __eq__(self, other):
12089 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012090 if self.xid != other.xid: return False
12091 if self.reason != other.reason: return False
12092 if self.desc != other.desc: return False
12093 return True
12094
Rich Lanec2ee4b82013-04-24 17:12:38 -070012095 def pretty_print(self, q):
12096 q.text("port_status {")
12097 with q.group():
12098 with q.indent(2):
12099 q.breakable()
12100 q.text("xid = ");
12101 if self.xid != None:
12102 q.text("%#x" % self.xid)
12103 else:
12104 q.text('None')
12105 q.text(","); q.breakable()
12106 q.text("reason = ");
12107 q.text("%#x" % self.reason)
12108 q.text(","); q.breakable()
12109 q.text("desc = ");
12110 q.pp(self.desc)
12111 q.breakable()
12112 q.text('}')
12113
Rich Lane7dcdf022013-12-11 14:45:27 -080012114message.subtypes[12] = port_status
12115
12116class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012117 version = 4
12118 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070012119
12120 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012121 if xid != None:
12122 self.xid = xid
12123 else:
12124 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012125 if port != None:
12126 self.port = port
12127 else:
12128 self.port = 0
12129 if queues != None:
12130 self.queues = queues
12131 else:
12132 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012133 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012134
12135 def pack(self):
12136 packed = []
12137 packed.append(struct.pack("!B", self.version))
12138 packed.append(struct.pack("!B", self.type))
12139 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12140 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012141 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012142 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012143 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012144 length = sum([len(x) for x in packed])
12145 packed[2] = struct.pack("!H", length)
12146 return ''.join(packed)
12147
12148 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012149 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012150 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012151 _version = reader.read("!B")[0]
12152 assert(_version == 4)
12153 _type = reader.read("!B")[0]
12154 assert(_type == 23)
12155 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012156 orig_reader = reader
12157 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012158 obj.xid = reader.read("!L")[0]
12159 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012160 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012161 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012162 return obj
12163
12164 def __eq__(self, other):
12165 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012166 if self.xid != other.xid: return False
12167 if self.port != other.port: return False
12168 if self.queues != other.queues: return False
12169 return True
12170
Rich Lanec2ee4b82013-04-24 17:12:38 -070012171 def pretty_print(self, q):
12172 q.text("queue_get_config_reply {")
12173 with q.group():
12174 with q.indent(2):
12175 q.breakable()
12176 q.text("xid = ");
12177 if self.xid != None:
12178 q.text("%#x" % self.xid)
12179 else:
12180 q.text('None')
12181 q.text(","); q.breakable()
12182 q.text("port = ");
12183 q.text(util.pretty_port(self.port))
12184 q.text(","); q.breakable()
12185 q.text("queues = ");
12186 q.pp(self.queues)
12187 q.breakable()
12188 q.text('}')
12189
Rich Lane7dcdf022013-12-11 14:45:27 -080012190message.subtypes[23] = queue_get_config_reply
12191
12192class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012193 version = 4
12194 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070012195
12196 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012197 if xid != None:
12198 self.xid = xid
12199 else:
12200 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012201 if port != None:
12202 self.port = port
12203 else:
12204 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012205 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012206
12207 def pack(self):
12208 packed = []
12209 packed.append(struct.pack("!B", self.version))
12210 packed.append(struct.pack("!B", self.type))
12211 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12212 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012213 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012214 packed.append('\x00' * 4)
12215 length = sum([len(x) for x in packed])
12216 packed[2] = struct.pack("!H", length)
12217 return ''.join(packed)
12218
12219 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012220 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012221 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012222 _version = reader.read("!B")[0]
12223 assert(_version == 4)
12224 _type = reader.read("!B")[0]
12225 assert(_type == 22)
12226 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012227 orig_reader = reader
12228 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012229 obj.xid = reader.read("!L")[0]
12230 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012231 reader.skip(4)
12232 return obj
12233
12234 def __eq__(self, other):
12235 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012236 if self.xid != other.xid: return False
12237 if self.port != other.port: return False
12238 return True
12239
Rich Lanec2ee4b82013-04-24 17:12:38 -070012240 def pretty_print(self, q):
12241 q.text("queue_get_config_request {")
12242 with q.group():
12243 with q.indent(2):
12244 q.breakable()
12245 q.text("xid = ");
12246 if self.xid != None:
12247 q.text("%#x" % self.xid)
12248 else:
12249 q.text('None')
12250 q.text(","); q.breakable()
12251 q.text("port = ");
12252 q.text(util.pretty_port(self.port))
12253 q.breakable()
12254 q.text('}')
12255
Rich Lane7dcdf022013-12-11 14:45:27 -080012256message.subtypes[22] = queue_get_config_request
12257
12258class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012259 version = 4
12260 type = 1
12261 err_type = 9
12262
12263 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012264 if xid != None:
12265 self.xid = xid
12266 else:
12267 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012268 if code != None:
12269 self.code = code
12270 else:
12271 self.code = 0
12272 if data != None:
12273 self.data = data
12274 else:
12275 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012276 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012277
12278 def pack(self):
12279 packed = []
12280 packed.append(struct.pack("!B", self.version))
12281 packed.append(struct.pack("!B", self.type))
12282 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12283 packed.append(struct.pack("!L", self.xid))
12284 packed.append(struct.pack("!H", self.err_type))
12285 packed.append(struct.pack("!H", self.code))
12286 packed.append(self.data)
12287 length = sum([len(x) for x in packed])
12288 packed[2] = struct.pack("!H", length)
12289 return ''.join(packed)
12290
12291 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012292 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012293 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012294 _version = reader.read("!B")[0]
12295 assert(_version == 4)
12296 _type = reader.read("!B")[0]
12297 assert(_type == 1)
12298 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012299 orig_reader = reader
12300 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012301 obj.xid = reader.read("!L")[0]
12302 _err_type = reader.read("!H")[0]
12303 assert(_err_type == 9)
12304 obj.code = reader.read("!H")[0]
12305 obj.data = str(reader.read_all())
12306 return obj
12307
12308 def __eq__(self, other):
12309 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012310 if self.xid != other.xid: return False
12311 if self.code != other.code: return False
12312 if self.data != other.data: return False
12313 return True
12314
Rich Lane6f4978c2013-10-20 21:33:52 -070012315 def pretty_print(self, q):
12316 q.text("queue_op_failed_error_msg {")
12317 with q.group():
12318 with q.indent(2):
12319 q.breakable()
12320 q.text("xid = ");
12321 if self.xid != None:
12322 q.text("%#x" % self.xid)
12323 else:
12324 q.text('None')
12325 q.text(","); q.breakable()
12326 q.text("code = ");
12327 q.text("%#x" % self.code)
12328 q.text(","); q.breakable()
12329 q.text("data = ");
12330 q.pp(self.data)
12331 q.breakable()
12332 q.text('}')
12333
Rich Lane7dcdf022013-12-11 14:45:27 -080012334error_msg.subtypes[9] = queue_op_failed_error_msg
12335
12336class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012337 version = 4
12338 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012339 stats_type = 5
12340
12341 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012342 if xid != None:
12343 self.xid = xid
12344 else:
12345 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012346 if flags != None:
12347 self.flags = flags
12348 else:
12349 self.flags = 0
12350 if entries != None:
12351 self.entries = entries
12352 else:
12353 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012354 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012355
12356 def pack(self):
12357 packed = []
12358 packed.append(struct.pack("!B", self.version))
12359 packed.append(struct.pack("!B", self.type))
12360 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12361 packed.append(struct.pack("!L", self.xid))
12362 packed.append(struct.pack("!H", self.stats_type))
12363 packed.append(struct.pack("!H", self.flags))
12364 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012365 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012366 length = sum([len(x) for x in packed])
12367 packed[2] = struct.pack("!H", length)
12368 return ''.join(packed)
12369
12370 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012371 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012372 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012373 _version = reader.read("!B")[0]
12374 assert(_version == 4)
12375 _type = reader.read("!B")[0]
12376 assert(_type == 19)
12377 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012378 orig_reader = reader
12379 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012380 obj.xid = reader.read("!L")[0]
12381 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012382 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012383 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012384 reader.skip(4)
12385 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
12386 return obj
12387
12388 def __eq__(self, other):
12389 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012390 if self.xid != other.xid: return False
12391 if self.flags != other.flags: return False
12392 if self.entries != other.entries: return False
12393 return True
12394
Rich Lanec2ee4b82013-04-24 17:12:38 -070012395 def pretty_print(self, q):
12396 q.text("queue_stats_reply {")
12397 with q.group():
12398 with q.indent(2):
12399 q.breakable()
12400 q.text("xid = ");
12401 if self.xid != None:
12402 q.text("%#x" % self.xid)
12403 else:
12404 q.text('None')
12405 q.text(","); q.breakable()
12406 q.text("flags = ");
12407 q.text("%#x" % self.flags)
12408 q.text(","); q.breakable()
12409 q.text("entries = ");
12410 q.pp(self.entries)
12411 q.breakable()
12412 q.text('}')
12413
Rich Lane7dcdf022013-12-11 14:45:27 -080012414stats_reply.subtypes[5] = queue_stats_reply
12415
12416class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012417 version = 4
12418 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012419 stats_type = 5
12420
12421 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012422 if xid != None:
12423 self.xid = xid
12424 else:
12425 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012426 if flags != None:
12427 self.flags = flags
12428 else:
12429 self.flags = 0
12430 if port_no != None:
12431 self.port_no = port_no
12432 else:
12433 self.port_no = 0
12434 if queue_id != None:
12435 self.queue_id = queue_id
12436 else:
12437 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012438 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012439
12440 def pack(self):
12441 packed = []
12442 packed.append(struct.pack("!B", self.version))
12443 packed.append(struct.pack("!B", self.type))
12444 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12445 packed.append(struct.pack("!L", self.xid))
12446 packed.append(struct.pack("!H", self.stats_type))
12447 packed.append(struct.pack("!H", self.flags))
12448 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012449 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012450 packed.append(struct.pack("!L", self.queue_id))
12451 length = sum([len(x) for x in packed])
12452 packed[2] = struct.pack("!H", length)
12453 return ''.join(packed)
12454
12455 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012456 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012457 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012458 _version = reader.read("!B")[0]
12459 assert(_version == 4)
12460 _type = reader.read("!B")[0]
12461 assert(_type == 18)
12462 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012463 orig_reader = reader
12464 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012465 obj.xid = reader.read("!L")[0]
12466 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012467 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012468 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012469 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012470 obj.port_no = util.unpack_port_no(reader)
12471 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012472 return obj
12473
12474 def __eq__(self, other):
12475 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012476 if self.xid != other.xid: return False
12477 if self.flags != other.flags: return False
12478 if self.port_no != other.port_no: return False
12479 if self.queue_id != other.queue_id: return False
12480 return True
12481
Rich Lanec2ee4b82013-04-24 17:12:38 -070012482 def pretty_print(self, q):
12483 q.text("queue_stats_request {")
12484 with q.group():
12485 with q.indent(2):
12486 q.breakable()
12487 q.text("xid = ");
12488 if self.xid != None:
12489 q.text("%#x" % self.xid)
12490 else:
12491 q.text('None')
12492 q.text(","); q.breakable()
12493 q.text("flags = ");
12494 q.text("%#x" % self.flags)
12495 q.text(","); q.breakable()
12496 q.text("port_no = ");
12497 q.text(util.pretty_port(self.port_no))
12498 q.text(","); q.breakable()
12499 q.text("queue_id = ");
12500 q.text("%#x" % self.queue_id)
12501 q.breakable()
12502 q.text('}')
12503
Rich Lane7dcdf022013-12-11 14:45:27 -080012504stats_request.subtypes[5] = queue_stats_request
12505
12506class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012507 version = 4
12508 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070012509
Rich Laned9e3f7b2013-11-04 11:40:43 -080012510 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012511 if xid != None:
12512 self.xid = xid
12513 else:
12514 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080012515 if role != None:
12516 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070012517 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080012518 self.role = 0
12519 if generation_id != None:
12520 self.generation_id = generation_id
12521 else:
12522 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012523 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012524
12525 def pack(self):
12526 packed = []
12527 packed.append(struct.pack("!B", self.version))
12528 packed.append(struct.pack("!B", self.type))
12529 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12530 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080012531 packed.append(struct.pack("!L", self.role))
12532 packed.append('\x00' * 4)
12533 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012534 length = sum([len(x) for x in packed])
12535 packed[2] = struct.pack("!H", length)
12536 return ''.join(packed)
12537
12538 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012539 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012540 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012541 _version = reader.read("!B")[0]
12542 assert(_version == 4)
12543 _type = reader.read("!B")[0]
12544 assert(_type == 25)
12545 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012546 orig_reader = reader
12547 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012548 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080012549 obj.role = reader.read("!L")[0]
12550 reader.skip(4)
12551 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012552 return obj
12553
12554 def __eq__(self, other):
12555 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012556 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080012557 if self.role != other.role: return False
12558 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012559 return True
12560
Rich Lanec2ee4b82013-04-24 17:12:38 -070012561 def pretty_print(self, q):
12562 q.text("role_reply {")
12563 with q.group():
12564 with q.indent(2):
12565 q.breakable()
12566 q.text("xid = ");
12567 if self.xid != None:
12568 q.text("%#x" % self.xid)
12569 else:
12570 q.text('None')
12571 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080012572 q.text("role = ");
12573 q.text("%#x" % self.role)
12574 q.text(","); q.breakable()
12575 q.text("generation_id = ");
12576 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012577 q.breakable()
12578 q.text('}')
12579
Rich Lane7dcdf022013-12-11 14:45:27 -080012580message.subtypes[25] = role_reply
12581
12582class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012583 version = 4
12584 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070012585
12586 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012587 if xid != None:
12588 self.xid = xid
12589 else:
12590 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012591 if role != None:
12592 self.role = role
12593 else:
12594 self.role = 0
12595 if generation_id != None:
12596 self.generation_id = generation_id
12597 else:
12598 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012599 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012600
12601 def pack(self):
12602 packed = []
12603 packed.append(struct.pack("!B", self.version))
12604 packed.append(struct.pack("!B", self.type))
12605 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12606 packed.append(struct.pack("!L", self.xid))
12607 packed.append(struct.pack("!L", self.role))
12608 packed.append('\x00' * 4)
12609 packed.append(struct.pack("!Q", self.generation_id))
12610 length = sum([len(x) for x in packed])
12611 packed[2] = struct.pack("!H", length)
12612 return ''.join(packed)
12613
12614 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012615 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012616 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012617 _version = reader.read("!B")[0]
12618 assert(_version == 4)
12619 _type = reader.read("!B")[0]
12620 assert(_type == 24)
12621 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012622 orig_reader = reader
12623 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012624 obj.xid = reader.read("!L")[0]
12625 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012626 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012627 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012628 return obj
12629
12630 def __eq__(self, other):
12631 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012632 if self.xid != other.xid: return False
12633 if self.role != other.role: return False
12634 if self.generation_id != other.generation_id: return False
12635 return True
12636
Rich Lanec2ee4b82013-04-24 17:12:38 -070012637 def pretty_print(self, q):
12638 q.text("role_request {")
12639 with q.group():
12640 with q.indent(2):
12641 q.breakable()
12642 q.text("xid = ");
12643 if self.xid != None:
12644 q.text("%#x" % self.xid)
12645 else:
12646 q.text('None')
12647 q.text(","); q.breakable()
12648 q.text("role = ");
12649 q.text("%#x" % self.role)
12650 q.text(","); q.breakable()
12651 q.text("generation_id = ");
12652 q.text("%#x" % self.generation_id)
12653 q.breakable()
12654 q.text('}')
12655
Rich Lane7dcdf022013-12-11 14:45:27 -080012656message.subtypes[24] = role_request
12657
12658class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012659 version = 4
12660 type = 1
12661 err_type = 11
12662
12663 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012664 if xid != None:
12665 self.xid = xid
12666 else:
12667 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012668 if code != None:
12669 self.code = code
12670 else:
12671 self.code = 0
12672 if data != None:
12673 self.data = data
12674 else:
12675 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012676 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012677
12678 def pack(self):
12679 packed = []
12680 packed.append(struct.pack("!B", self.version))
12681 packed.append(struct.pack("!B", self.type))
12682 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12683 packed.append(struct.pack("!L", self.xid))
12684 packed.append(struct.pack("!H", self.err_type))
12685 packed.append(struct.pack("!H", self.code))
12686 packed.append(self.data)
12687 length = sum([len(x) for x in packed])
12688 packed[2] = struct.pack("!H", length)
12689 return ''.join(packed)
12690
12691 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012692 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012693 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012694 _version = reader.read("!B")[0]
12695 assert(_version == 4)
12696 _type = reader.read("!B")[0]
12697 assert(_type == 1)
12698 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012699 orig_reader = reader
12700 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012701 obj.xid = reader.read("!L")[0]
12702 _err_type = reader.read("!H")[0]
12703 assert(_err_type == 11)
12704 obj.code = reader.read("!H")[0]
12705 obj.data = str(reader.read_all())
12706 return obj
12707
12708 def __eq__(self, other):
12709 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012710 if self.xid != other.xid: return False
12711 if self.code != other.code: return False
12712 if self.data != other.data: return False
12713 return True
12714
Rich Lane6f4978c2013-10-20 21:33:52 -070012715 def pretty_print(self, q):
12716 q.text("role_request_failed_error_msg {")
12717 with q.group():
12718 with q.indent(2):
12719 q.breakable()
12720 q.text("xid = ");
12721 if self.xid != None:
12722 q.text("%#x" % self.xid)
12723 else:
12724 q.text('None')
12725 q.text(","); q.breakable()
12726 q.text("code = ");
12727 q.text("%#x" % self.code)
12728 q.text(","); q.breakable()
12729 q.text("data = ");
12730 q.pp(self.data)
12731 q.breakable()
12732 q.text('}')
12733
Rich Lane7dcdf022013-12-11 14:45:27 -080012734error_msg.subtypes[11] = role_request_failed_error_msg
12735
12736class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012737 version = 4
12738 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070012739
12740 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012741 if xid != None:
12742 self.xid = xid
12743 else:
12744 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012745 if flags != None:
12746 self.flags = flags
12747 else:
12748 self.flags = 0
12749 if miss_send_len != None:
12750 self.miss_send_len = miss_send_len
12751 else:
12752 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012753 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012754
12755 def pack(self):
12756 packed = []
12757 packed.append(struct.pack("!B", self.version))
12758 packed.append(struct.pack("!B", self.type))
12759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12760 packed.append(struct.pack("!L", self.xid))
12761 packed.append(struct.pack("!H", self.flags))
12762 packed.append(struct.pack("!H", self.miss_send_len))
12763 length = sum([len(x) for x in packed])
12764 packed[2] = struct.pack("!H", length)
12765 return ''.join(packed)
12766
12767 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012768 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012769 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070012770 _version = reader.read("!B")[0]
12771 assert(_version == 4)
12772 _type = reader.read("!B")[0]
12773 assert(_type == 9)
12774 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012775 orig_reader = reader
12776 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012777 obj.xid = reader.read("!L")[0]
12778 obj.flags = reader.read("!H")[0]
12779 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012780 return obj
12781
12782 def __eq__(self, other):
12783 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012784 if self.xid != other.xid: return False
12785 if self.flags != other.flags: return False
12786 if self.miss_send_len != other.miss_send_len: return False
12787 return True
12788
Rich Lanec2ee4b82013-04-24 17:12:38 -070012789 def pretty_print(self, q):
12790 q.text("set_config {")
12791 with q.group():
12792 with q.indent(2):
12793 q.breakable()
12794 q.text("xid = ");
12795 if self.xid != None:
12796 q.text("%#x" % self.xid)
12797 else:
12798 q.text('None')
12799 q.text(","); q.breakable()
12800 q.text("flags = ");
12801 q.text("%#x" % self.flags)
12802 q.text(","); q.breakable()
12803 q.text("miss_send_len = ");
12804 q.text("%#x" % self.miss_send_len)
12805 q.breakable()
12806 q.text('}')
12807
Rich Lane7dcdf022013-12-11 14:45:27 -080012808message.subtypes[9] = set_config
12809
12810class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012811 version = 4
12812 type = 1
12813 err_type = 10
12814
12815 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012816 if xid != None:
12817 self.xid = xid
12818 else:
12819 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012820 if code != None:
12821 self.code = code
12822 else:
12823 self.code = 0
12824 if data != None:
12825 self.data = data
12826 else:
12827 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012828 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012829
12830 def pack(self):
12831 packed = []
12832 packed.append(struct.pack("!B", self.version))
12833 packed.append(struct.pack("!B", self.type))
12834 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12835 packed.append(struct.pack("!L", self.xid))
12836 packed.append(struct.pack("!H", self.err_type))
12837 packed.append(struct.pack("!H", self.code))
12838 packed.append(self.data)
12839 length = sum([len(x) for x in packed])
12840 packed[2] = struct.pack("!H", length)
12841 return ''.join(packed)
12842
12843 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012844 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012845 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012846 _version = reader.read("!B")[0]
12847 assert(_version == 4)
12848 _type = reader.read("!B")[0]
12849 assert(_type == 1)
12850 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012851 orig_reader = reader
12852 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012853 obj.xid = reader.read("!L")[0]
12854 _err_type = reader.read("!H")[0]
12855 assert(_err_type == 10)
12856 obj.code = reader.read("!H")[0]
12857 obj.data = str(reader.read_all())
12858 return obj
12859
12860 def __eq__(self, other):
12861 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012862 if self.xid != other.xid: return False
12863 if self.code != other.code: return False
12864 if self.data != other.data: return False
12865 return True
12866
Rich Lane6f4978c2013-10-20 21:33:52 -070012867 def pretty_print(self, q):
12868 q.text("switch_config_failed_error_msg {")
12869 with q.group():
12870 with q.indent(2):
12871 q.breakable()
12872 q.text("xid = ");
12873 if self.xid != None:
12874 q.text("%#x" % self.xid)
12875 else:
12876 q.text('None')
12877 q.text(","); q.breakable()
12878 q.text("code = ");
12879 q.text("%#x" % self.code)
12880 q.text(","); q.breakable()
12881 q.text("data = ");
12882 q.pp(self.data)
12883 q.breakable()
12884 q.text('}')
12885
Rich Lane7dcdf022013-12-11 14:45:27 -080012886error_msg.subtypes[10] = switch_config_failed_error_msg
12887
12888class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012889 version = 4
12890 type = 1
12891 err_type = 13
12892
12893 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012894 if xid != None:
12895 self.xid = xid
12896 else:
12897 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012898 if code != None:
12899 self.code = code
12900 else:
12901 self.code = 0
12902 if data != None:
12903 self.data = data
12904 else:
12905 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012906 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012907
12908 def pack(self):
12909 packed = []
12910 packed.append(struct.pack("!B", self.version))
12911 packed.append(struct.pack("!B", self.type))
12912 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12913 packed.append(struct.pack("!L", self.xid))
12914 packed.append(struct.pack("!H", self.err_type))
12915 packed.append(struct.pack("!H", self.code))
12916 packed.append(self.data)
12917 length = sum([len(x) for x in packed])
12918 packed[2] = struct.pack("!H", length)
12919 return ''.join(packed)
12920
12921 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012922 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012923 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012924 _version = reader.read("!B")[0]
12925 assert(_version == 4)
12926 _type = reader.read("!B")[0]
12927 assert(_type == 1)
12928 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012929 orig_reader = reader
12930 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012931 obj.xid = reader.read("!L")[0]
12932 _err_type = reader.read("!H")[0]
12933 assert(_err_type == 13)
12934 obj.code = reader.read("!H")[0]
12935 obj.data = str(reader.read_all())
12936 return obj
12937
12938 def __eq__(self, other):
12939 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012940 if self.xid != other.xid: return False
12941 if self.code != other.code: return False
12942 if self.data != other.data: return False
12943 return True
12944
Rich Lane6f4978c2013-10-20 21:33:52 -070012945 def pretty_print(self, q):
12946 q.text("table_features_failed_error_msg {")
12947 with q.group():
12948 with q.indent(2):
12949 q.breakable()
12950 q.text("xid = ");
12951 if self.xid != None:
12952 q.text("%#x" % self.xid)
12953 else:
12954 q.text('None')
12955 q.text(","); q.breakable()
12956 q.text("code = ");
12957 q.text("%#x" % self.code)
12958 q.text(","); q.breakable()
12959 q.text("data = ");
12960 q.pp(self.data)
12961 q.breakable()
12962 q.text('}')
12963
Rich Lane7dcdf022013-12-11 14:45:27 -080012964error_msg.subtypes[13] = table_features_failed_error_msg
12965
12966class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012967 version = 4
12968 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012969 stats_type = 12
12970
12971 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012972 if xid != None:
12973 self.xid = xid
12974 else:
12975 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012976 if flags != None:
12977 self.flags = flags
12978 else:
12979 self.flags = 0
12980 if entries != None:
12981 self.entries = entries
12982 else:
12983 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012984 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012985
12986 def pack(self):
12987 packed = []
12988 packed.append(struct.pack("!B", self.version))
12989 packed.append(struct.pack("!B", self.type))
12990 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12991 packed.append(struct.pack("!L", self.xid))
12992 packed.append(struct.pack("!H", self.stats_type))
12993 packed.append(struct.pack("!H", self.flags))
12994 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012995 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012996 length = sum([len(x) for x in packed])
12997 packed[2] = struct.pack("!H", length)
12998 return ''.join(packed)
12999
13000 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013001 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013002 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013003 _version = reader.read("!B")[0]
13004 assert(_version == 4)
13005 _type = reader.read("!B")[0]
13006 assert(_type == 19)
13007 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013008 orig_reader = reader
13009 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013010 obj.xid = reader.read("!L")[0]
13011 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013012 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013013 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013014 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013015 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013016 return obj
13017
13018 def __eq__(self, other):
13019 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013020 if self.xid != other.xid: return False
13021 if self.flags != other.flags: return False
13022 if self.entries != other.entries: return False
13023 return True
13024
Rich Lanec2ee4b82013-04-24 17:12:38 -070013025 def pretty_print(self, q):
13026 q.text("table_features_stats_reply {")
13027 with q.group():
13028 with q.indent(2):
13029 q.breakable()
13030 q.text("xid = ");
13031 if self.xid != None:
13032 q.text("%#x" % self.xid)
13033 else:
13034 q.text('None')
13035 q.text(","); q.breakable()
13036 q.text("flags = ");
13037 q.text("%#x" % self.flags)
13038 q.text(","); q.breakable()
13039 q.text("entries = ");
13040 q.pp(self.entries)
13041 q.breakable()
13042 q.text('}')
13043
Rich Lane7dcdf022013-12-11 14:45:27 -080013044stats_reply.subtypes[12] = table_features_stats_reply
13045
13046class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013047 version = 4
13048 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013049 stats_type = 12
13050
13051 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013052 if xid != None:
13053 self.xid = xid
13054 else:
13055 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013056 if flags != None:
13057 self.flags = flags
13058 else:
13059 self.flags = 0
13060 if entries != None:
13061 self.entries = entries
13062 else:
13063 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013064 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013065
13066 def pack(self):
13067 packed = []
13068 packed.append(struct.pack("!B", self.version))
13069 packed.append(struct.pack("!B", self.type))
13070 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13071 packed.append(struct.pack("!L", self.xid))
13072 packed.append(struct.pack("!H", self.stats_type))
13073 packed.append(struct.pack("!H", self.flags))
13074 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013075 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013076 length = sum([len(x) for x in packed])
13077 packed[2] = struct.pack("!H", length)
13078 return ''.join(packed)
13079
13080 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013081 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013082 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013083 _version = reader.read("!B")[0]
13084 assert(_version == 4)
13085 _type = reader.read("!B")[0]
13086 assert(_type == 18)
13087 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013088 orig_reader = reader
13089 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013090 obj.xid = reader.read("!L")[0]
13091 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013092 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013093 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013094 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013095 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013096 return obj
13097
13098 def __eq__(self, other):
13099 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013100 if self.xid != other.xid: return False
13101 if self.flags != other.flags: return False
13102 if self.entries != other.entries: return False
13103 return True
13104
Rich Lanec2ee4b82013-04-24 17:12:38 -070013105 def pretty_print(self, q):
13106 q.text("table_features_stats_request {")
13107 with q.group():
13108 with q.indent(2):
13109 q.breakable()
13110 q.text("xid = ");
13111 if self.xid != None:
13112 q.text("%#x" % self.xid)
13113 else:
13114 q.text('None')
13115 q.text(","); q.breakable()
13116 q.text("flags = ");
13117 q.text("%#x" % self.flags)
13118 q.text(","); q.breakable()
13119 q.text("entries = ");
13120 q.pp(self.entries)
13121 q.breakable()
13122 q.text('}')
13123
Rich Lane7dcdf022013-12-11 14:45:27 -080013124stats_request.subtypes[12] = table_features_stats_request
13125
13126class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013127 version = 4
13128 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070013129
13130 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013131 if xid != None:
13132 self.xid = xid
13133 else:
13134 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013135 if table_id != None:
13136 self.table_id = table_id
13137 else:
13138 self.table_id = 0
13139 if config != None:
13140 self.config = config
13141 else:
13142 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013143 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013144
13145 def pack(self):
13146 packed = []
13147 packed.append(struct.pack("!B", self.version))
13148 packed.append(struct.pack("!B", self.type))
13149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13150 packed.append(struct.pack("!L", self.xid))
13151 packed.append(struct.pack("!B", self.table_id))
13152 packed.append('\x00' * 3)
13153 packed.append(struct.pack("!L", self.config))
13154 length = sum([len(x) for x in packed])
13155 packed[2] = struct.pack("!H", length)
13156 return ''.join(packed)
13157
13158 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013159 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013160 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013161 _version = reader.read("!B")[0]
13162 assert(_version == 4)
13163 _type = reader.read("!B")[0]
13164 assert(_type == 17)
13165 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013166 orig_reader = reader
13167 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013168 obj.xid = reader.read("!L")[0]
13169 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013170 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070013171 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013172 return obj
13173
13174 def __eq__(self, other):
13175 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013176 if self.xid != other.xid: return False
13177 if self.table_id != other.table_id: return False
13178 if self.config != other.config: return False
13179 return True
13180
Rich Lanec2ee4b82013-04-24 17:12:38 -070013181 def pretty_print(self, q):
13182 q.text("table_mod {")
13183 with q.group():
13184 with q.indent(2):
13185 q.breakable()
13186 q.text("xid = ");
13187 if self.xid != None:
13188 q.text("%#x" % self.xid)
13189 else:
13190 q.text('None')
13191 q.text(","); q.breakable()
13192 q.text("table_id = ");
13193 q.text("%#x" % self.table_id)
13194 q.text(","); q.breakable()
13195 q.text("config = ");
13196 q.text("%#x" % self.config)
13197 q.breakable()
13198 q.text('}')
13199
Rich Lane7dcdf022013-12-11 14:45:27 -080013200message.subtypes[17] = table_mod
13201
13202class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013203 version = 4
13204 type = 1
13205 err_type = 8
13206
13207 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013208 if xid != None:
13209 self.xid = xid
13210 else:
13211 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013212 if code != None:
13213 self.code = code
13214 else:
13215 self.code = 0
13216 if data != None:
13217 self.data = data
13218 else:
13219 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013220 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013221
13222 def pack(self):
13223 packed = []
13224 packed.append(struct.pack("!B", self.version))
13225 packed.append(struct.pack("!B", self.type))
13226 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13227 packed.append(struct.pack("!L", self.xid))
13228 packed.append(struct.pack("!H", self.err_type))
13229 packed.append(struct.pack("!H", self.code))
13230 packed.append(self.data)
13231 length = sum([len(x) for x in packed])
13232 packed[2] = struct.pack("!H", length)
13233 return ''.join(packed)
13234
13235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013236 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013237 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013238 _version = reader.read("!B")[0]
13239 assert(_version == 4)
13240 _type = reader.read("!B")[0]
13241 assert(_type == 1)
13242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013243 orig_reader = reader
13244 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013245 obj.xid = reader.read("!L")[0]
13246 _err_type = reader.read("!H")[0]
13247 assert(_err_type == 8)
13248 obj.code = reader.read("!H")[0]
13249 obj.data = str(reader.read_all())
13250 return obj
13251
13252 def __eq__(self, other):
13253 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013254 if self.xid != other.xid: return False
13255 if self.code != other.code: return False
13256 if self.data != other.data: return False
13257 return True
13258
Rich Lane6f4978c2013-10-20 21:33:52 -070013259 def pretty_print(self, q):
13260 q.text("table_mod_failed_error_msg {")
13261 with q.group():
13262 with q.indent(2):
13263 q.breakable()
13264 q.text("xid = ");
13265 if self.xid != None:
13266 q.text("%#x" % self.xid)
13267 else:
13268 q.text('None')
13269 q.text(","); q.breakable()
13270 q.text("code = ");
13271 q.text("%#x" % self.code)
13272 q.text(","); q.breakable()
13273 q.text("data = ");
13274 q.pp(self.data)
13275 q.breakable()
13276 q.text('}')
13277
Rich Lane7dcdf022013-12-11 14:45:27 -080013278error_msg.subtypes[8] = table_mod_failed_error_msg
13279
13280class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013281 version = 4
13282 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013283 stats_type = 3
13284
13285 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013286 if xid != None:
13287 self.xid = xid
13288 else:
13289 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013290 if flags != None:
13291 self.flags = flags
13292 else:
13293 self.flags = 0
13294 if entries != None:
13295 self.entries = entries
13296 else:
13297 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013298 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013299
13300 def pack(self):
13301 packed = []
13302 packed.append(struct.pack("!B", self.version))
13303 packed.append(struct.pack("!B", self.type))
13304 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13305 packed.append(struct.pack("!L", self.xid))
13306 packed.append(struct.pack("!H", self.stats_type))
13307 packed.append(struct.pack("!H", self.flags))
13308 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013309 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013310 length = sum([len(x) for x in packed])
13311 packed[2] = struct.pack("!H", length)
13312 return ''.join(packed)
13313
13314 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013315 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013316 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013317 _version = reader.read("!B")[0]
13318 assert(_version == 4)
13319 _type = reader.read("!B")[0]
13320 assert(_type == 19)
13321 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013322 orig_reader = reader
13323 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013324 obj.xid = reader.read("!L")[0]
13325 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013326 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013327 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013328 reader.skip(4)
13329 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
13330 return obj
13331
13332 def __eq__(self, other):
13333 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013334 if self.xid != other.xid: return False
13335 if self.flags != other.flags: return False
13336 if self.entries != other.entries: return False
13337 return True
13338
Rich Lanec2ee4b82013-04-24 17:12:38 -070013339 def pretty_print(self, q):
13340 q.text("table_stats_reply {")
13341 with q.group():
13342 with q.indent(2):
13343 q.breakable()
13344 q.text("xid = ");
13345 if self.xid != None:
13346 q.text("%#x" % self.xid)
13347 else:
13348 q.text('None')
13349 q.text(","); q.breakable()
13350 q.text("flags = ");
13351 q.text("%#x" % self.flags)
13352 q.text(","); q.breakable()
13353 q.text("entries = ");
13354 q.pp(self.entries)
13355 q.breakable()
13356 q.text('}')
13357
Rich Lane7dcdf022013-12-11 14:45:27 -080013358stats_reply.subtypes[3] = table_stats_reply
13359
13360class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013361 version = 4
13362 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013363 stats_type = 3
13364
13365 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013366 if xid != None:
13367 self.xid = xid
13368 else:
13369 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013370 if flags != None:
13371 self.flags = flags
13372 else:
13373 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013374 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013375
13376 def pack(self):
13377 packed = []
13378 packed.append(struct.pack("!B", self.version))
13379 packed.append(struct.pack("!B", self.type))
13380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13381 packed.append(struct.pack("!L", self.xid))
13382 packed.append(struct.pack("!H", self.stats_type))
13383 packed.append(struct.pack("!H", self.flags))
13384 packed.append('\x00' * 4)
13385 length = sum([len(x) for x in packed])
13386 packed[2] = struct.pack("!H", length)
13387 return ''.join(packed)
13388
13389 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013390 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013391 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013392 _version = reader.read("!B")[0]
13393 assert(_version == 4)
13394 _type = reader.read("!B")[0]
13395 assert(_type == 18)
13396 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013397 orig_reader = reader
13398 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013399 obj.xid = reader.read("!L")[0]
13400 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013401 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013402 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013403 reader.skip(4)
13404 return obj
13405
13406 def __eq__(self, other):
13407 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013408 if self.xid != other.xid: return False
13409 if self.flags != other.flags: return False
13410 return True
13411
Rich Lanec2ee4b82013-04-24 17:12:38 -070013412 def pretty_print(self, q):
13413 q.text("table_stats_request {")
13414 with q.group():
13415 with q.indent(2):
13416 q.breakable()
13417 q.text("xid = ");
13418 if self.xid != None:
13419 q.text("%#x" % self.xid)
13420 else:
13421 q.text('None')
13422 q.text(","); q.breakable()
13423 q.text("flags = ");
13424 q.text("%#x" % self.flags)
13425 q.breakable()
13426 q.text('}')
13427
Rich Lane7dcdf022013-12-11 14:45:27 -080013428stats_request.subtypes[3] = table_stats_request
13429
Rich Lanec2ee4b82013-04-24 17:12:38 -070013430
13431def parse_header(buf):
13432 if len(buf) < 8:
13433 raise loxi.ProtocolError("too short to be an OpenFlow message")
13434 return struct.unpack_from("!BBHL", buf)
13435
13436def parse_message(buf):
13437 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070013438 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
13439 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013440 if len(buf) != msg_len:
13441 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080013442 return message.unpack(loxi.generic_util.OFReader(buf))