blob: 0aaeec6476f8dee5f8e98ba3d7defabd378a4acc [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
Rich Lanea61048f2014-01-30 16:14:00 -08001472class bsn_arp_idle(bsn_header):
1473 version = 4
1474 type = 4
1475 experimenter = 6035143
1476 subtype = 60
1477
1478 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1479 if xid != None:
1480 self.xid = xid
1481 else:
1482 self.xid = None
1483 if vlan_vid != None:
1484 self.vlan_vid = vlan_vid
1485 else:
1486 self.vlan_vid = 0
1487 if ipv4_addr != None:
1488 self.ipv4_addr = ipv4_addr
1489 else:
1490 self.ipv4_addr = 0
1491 return
1492
1493 def pack(self):
1494 packed = []
1495 packed.append(struct.pack("!B", self.version))
1496 packed.append(struct.pack("!B", self.type))
1497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1498 packed.append(struct.pack("!L", self.xid))
1499 packed.append(struct.pack("!L", self.experimenter))
1500 packed.append(struct.pack("!L", self.subtype))
1501 packed.append(struct.pack("!H", self.vlan_vid))
1502 packed.append('\x00' * 2)
1503 packed.append(struct.pack("!L", self.ipv4_addr))
1504 length = sum([len(x) for x in packed])
1505 packed[2] = struct.pack("!H", length)
1506 return ''.join(packed)
1507
1508 @staticmethod
1509 def unpack(reader):
1510 obj = bsn_arp_idle()
1511 _version = reader.read("!B")[0]
1512 assert(_version == 4)
1513 _type = reader.read("!B")[0]
1514 assert(_type == 4)
1515 _length = reader.read("!H")[0]
1516 orig_reader = reader
1517 reader = orig_reader.slice(_length - (2 + 2))
1518 obj.xid = reader.read("!L")[0]
1519 _experimenter = reader.read("!L")[0]
1520 assert(_experimenter == 6035143)
1521 _subtype = reader.read("!L")[0]
1522 assert(_subtype == 60)
1523 obj.vlan_vid = reader.read("!H")[0]
1524 reader.skip(2)
1525 obj.ipv4_addr = reader.read("!L")[0]
1526 return obj
1527
1528 def __eq__(self, other):
1529 if type(self) != type(other): return False
1530 if self.xid != other.xid: return False
1531 if self.vlan_vid != other.vlan_vid: return False
1532 if self.ipv4_addr != other.ipv4_addr: return False
1533 return True
1534
1535 def pretty_print(self, q):
1536 q.text("bsn_arp_idle {")
1537 with q.group():
1538 with q.indent(2):
1539 q.breakable()
1540 q.text("xid = ");
1541 if self.xid != None:
1542 q.text("%#x" % self.xid)
1543 else:
1544 q.text('None')
1545 q.text(","); q.breakable()
1546 q.text("vlan_vid = ");
1547 q.text("%#x" % self.vlan_vid)
1548 q.text(","); q.breakable()
1549 q.text("ipv4_addr = ");
1550 q.text(util.pretty_ipv4(self.ipv4_addr))
1551 q.breakable()
1552 q.text('}')
1553
1554bsn_header.subtypes[60] = bsn_arp_idle
1555
Rich Lane7dcdf022013-12-11 14:45:27 -08001556class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001557 version = 4
1558 type = 4
1559 experimenter = 6035143
1560 subtype = 22
1561
1562 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001563 if xid != None:
1564 self.xid = xid
1565 else:
1566 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001567 if status != None:
1568 self.status = status
1569 else:
1570 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001571 return
Dan Talaycof6202252013-07-02 01:00:29 -07001572
1573 def pack(self):
1574 packed = []
1575 packed.append(struct.pack("!B", self.version))
1576 packed.append(struct.pack("!B", self.type))
1577 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1578 packed.append(struct.pack("!L", self.xid))
1579 packed.append(struct.pack("!L", self.experimenter))
1580 packed.append(struct.pack("!L", self.subtype))
1581 packed.append(struct.pack("!L", self.status))
1582 length = sum([len(x) for x in packed])
1583 packed[2] = struct.pack("!H", length)
1584 return ''.join(packed)
1585
1586 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001587 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001588 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001589 _version = reader.read("!B")[0]
1590 assert(_version == 4)
1591 _type = reader.read("!B")[0]
1592 assert(_type == 4)
1593 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001594 orig_reader = reader
1595 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001596 obj.xid = reader.read("!L")[0]
1597 _experimenter = reader.read("!L")[0]
1598 assert(_experimenter == 6035143)
1599 _subtype = reader.read("!L")[0]
1600 assert(_subtype == 22)
1601 obj.status = reader.read("!L")[0]
1602 return obj
1603
1604 def __eq__(self, other):
1605 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001606 if self.xid != other.xid: return False
1607 if self.status != other.status: return False
1608 return True
1609
Dan Talaycof6202252013-07-02 01:00:29 -07001610 def pretty_print(self, q):
1611 q.text("bsn_bw_clear_data_reply {")
1612 with q.group():
1613 with q.indent(2):
1614 q.breakable()
1615 q.text("xid = ");
1616 if self.xid != None:
1617 q.text("%#x" % self.xid)
1618 else:
1619 q.text('None')
1620 q.text(","); q.breakable()
1621 q.text("status = ");
1622 q.text("%#x" % self.status)
1623 q.breakable()
1624 q.text('}')
1625
Rich Lane7dcdf022013-12-11 14:45:27 -08001626bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1627
1628class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001629 version = 4
1630 type = 4
1631 experimenter = 6035143
1632 subtype = 21
1633
1634 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001635 if xid != None:
1636 self.xid = xid
1637 else:
1638 self.xid = None
1639 return
Dan Talaycof6202252013-07-02 01:00:29 -07001640
1641 def pack(self):
1642 packed = []
1643 packed.append(struct.pack("!B", self.version))
1644 packed.append(struct.pack("!B", self.type))
1645 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1646 packed.append(struct.pack("!L", self.xid))
1647 packed.append(struct.pack("!L", self.experimenter))
1648 packed.append(struct.pack("!L", self.subtype))
1649 length = sum([len(x) for x in packed])
1650 packed[2] = struct.pack("!H", length)
1651 return ''.join(packed)
1652
1653 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001654 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001655 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001656 _version = reader.read("!B")[0]
1657 assert(_version == 4)
1658 _type = reader.read("!B")[0]
1659 assert(_type == 4)
1660 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001661 orig_reader = reader
1662 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001663 obj.xid = reader.read("!L")[0]
1664 _experimenter = reader.read("!L")[0]
1665 assert(_experimenter == 6035143)
1666 _subtype = reader.read("!L")[0]
1667 assert(_subtype == 21)
1668 return obj
1669
1670 def __eq__(self, other):
1671 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001672 if self.xid != other.xid: return False
1673 return True
1674
Dan Talaycof6202252013-07-02 01:00:29 -07001675 def pretty_print(self, q):
1676 q.text("bsn_bw_clear_data_request {")
1677 with q.group():
1678 with q.indent(2):
1679 q.breakable()
1680 q.text("xid = ");
1681 if self.xid != None:
1682 q.text("%#x" % self.xid)
1683 else:
1684 q.text('None')
1685 q.breakable()
1686 q.text('}')
1687
Rich Lane7dcdf022013-12-11 14:45:27 -08001688bsn_header.subtypes[21] = bsn_bw_clear_data_request
1689
1690class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001691 version = 4
1692 type = 4
1693 experimenter = 6035143
1694 subtype = 20
1695
1696 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001697 if xid != None:
1698 self.xid = xid
1699 else:
1700 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001701 if enabled != None:
1702 self.enabled = enabled
1703 else:
1704 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001705 return
Dan Talaycof6202252013-07-02 01:00:29 -07001706
1707 def pack(self):
1708 packed = []
1709 packed.append(struct.pack("!B", self.version))
1710 packed.append(struct.pack("!B", self.type))
1711 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1712 packed.append(struct.pack("!L", self.xid))
1713 packed.append(struct.pack("!L", self.experimenter))
1714 packed.append(struct.pack("!L", self.subtype))
1715 packed.append(struct.pack("!L", self.enabled))
1716 length = sum([len(x) for x in packed])
1717 packed[2] = struct.pack("!H", length)
1718 return ''.join(packed)
1719
1720 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001721 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001722 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001723 _version = reader.read("!B")[0]
1724 assert(_version == 4)
1725 _type = reader.read("!B")[0]
1726 assert(_type == 4)
1727 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001728 orig_reader = reader
1729 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001730 obj.xid = reader.read("!L")[0]
1731 _experimenter = reader.read("!L")[0]
1732 assert(_experimenter == 6035143)
1733 _subtype = reader.read("!L")[0]
1734 assert(_subtype == 20)
1735 obj.enabled = reader.read("!L")[0]
1736 return obj
1737
1738 def __eq__(self, other):
1739 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001740 if self.xid != other.xid: return False
1741 if self.enabled != other.enabled: return False
1742 return True
1743
Dan Talaycof6202252013-07-02 01:00:29 -07001744 def pretty_print(self, q):
1745 q.text("bsn_bw_enable_get_reply {")
1746 with q.group():
1747 with q.indent(2):
1748 q.breakable()
1749 q.text("xid = ");
1750 if self.xid != None:
1751 q.text("%#x" % self.xid)
1752 else:
1753 q.text('None')
1754 q.text(","); q.breakable()
1755 q.text("enabled = ");
1756 q.text("%#x" % self.enabled)
1757 q.breakable()
1758 q.text('}')
1759
Rich Lane7dcdf022013-12-11 14:45:27 -08001760bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1761
1762class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001763 version = 4
1764 type = 4
1765 experimenter = 6035143
1766 subtype = 19
1767
1768 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001769 if xid != None:
1770 self.xid = xid
1771 else:
1772 self.xid = None
1773 return
Dan Talaycof6202252013-07-02 01:00:29 -07001774
1775 def pack(self):
1776 packed = []
1777 packed.append(struct.pack("!B", self.version))
1778 packed.append(struct.pack("!B", self.type))
1779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1780 packed.append(struct.pack("!L", self.xid))
1781 packed.append(struct.pack("!L", self.experimenter))
1782 packed.append(struct.pack("!L", self.subtype))
1783 length = sum([len(x) for x in packed])
1784 packed[2] = struct.pack("!H", length)
1785 return ''.join(packed)
1786
1787 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001788 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001789 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001790 _version = reader.read("!B")[0]
1791 assert(_version == 4)
1792 _type = reader.read("!B")[0]
1793 assert(_type == 4)
1794 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001795 orig_reader = reader
1796 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001797 obj.xid = reader.read("!L")[0]
1798 _experimenter = reader.read("!L")[0]
1799 assert(_experimenter == 6035143)
1800 _subtype = reader.read("!L")[0]
1801 assert(_subtype == 19)
1802 return obj
1803
1804 def __eq__(self, other):
1805 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001806 if self.xid != other.xid: return False
1807 return True
1808
Dan Talaycof6202252013-07-02 01:00:29 -07001809 def pretty_print(self, q):
1810 q.text("bsn_bw_enable_get_request {")
1811 with q.group():
1812 with q.indent(2):
1813 q.breakable()
1814 q.text("xid = ");
1815 if self.xid != None:
1816 q.text("%#x" % self.xid)
1817 else:
1818 q.text('None')
1819 q.breakable()
1820 q.text('}')
1821
Rich Lane7dcdf022013-12-11 14:45:27 -08001822bsn_header.subtypes[19] = bsn_bw_enable_get_request
1823
1824class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001825 version = 4
1826 type = 4
1827 experimenter = 6035143
1828 subtype = 23
1829
1830 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001831 if xid != None:
1832 self.xid = xid
1833 else:
1834 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001835 if enable != None:
1836 self.enable = enable
1837 else:
1838 self.enable = 0
1839 if status != None:
1840 self.status = status
1841 else:
1842 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001843 return
Dan Talaycof6202252013-07-02 01:00:29 -07001844
1845 def pack(self):
1846 packed = []
1847 packed.append(struct.pack("!B", self.version))
1848 packed.append(struct.pack("!B", self.type))
1849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1850 packed.append(struct.pack("!L", self.xid))
1851 packed.append(struct.pack("!L", self.experimenter))
1852 packed.append(struct.pack("!L", self.subtype))
1853 packed.append(struct.pack("!L", self.enable))
1854 packed.append(struct.pack("!L", self.status))
1855 length = sum([len(x) for x in packed])
1856 packed[2] = struct.pack("!H", length)
1857 return ''.join(packed)
1858
1859 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001860 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001861 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001862 _version = reader.read("!B")[0]
1863 assert(_version == 4)
1864 _type = reader.read("!B")[0]
1865 assert(_type == 4)
1866 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001867 orig_reader = reader
1868 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001869 obj.xid = reader.read("!L")[0]
1870 _experimenter = reader.read("!L")[0]
1871 assert(_experimenter == 6035143)
1872 _subtype = reader.read("!L")[0]
1873 assert(_subtype == 23)
1874 obj.enable = reader.read("!L")[0]
1875 obj.status = reader.read("!L")[0]
1876 return obj
1877
1878 def __eq__(self, other):
1879 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001880 if self.xid != other.xid: return False
1881 if self.enable != other.enable: return False
1882 if self.status != other.status: return False
1883 return True
1884
Dan Talaycof6202252013-07-02 01:00:29 -07001885 def pretty_print(self, q):
1886 q.text("bsn_bw_enable_set_reply {")
1887 with q.group():
1888 with q.indent(2):
1889 q.breakable()
1890 q.text("xid = ");
1891 if self.xid != None:
1892 q.text("%#x" % self.xid)
1893 else:
1894 q.text('None')
1895 q.text(","); q.breakable()
1896 q.text("enable = ");
1897 q.text("%#x" % self.enable)
1898 q.text(","); q.breakable()
1899 q.text("status = ");
1900 q.text("%#x" % self.status)
1901 q.breakable()
1902 q.text('}')
1903
Rich Lane7dcdf022013-12-11 14:45:27 -08001904bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1905
1906class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001907 version = 4
1908 type = 4
1909 experimenter = 6035143
1910 subtype = 18
1911
1912 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001913 if xid != None:
1914 self.xid = xid
1915 else:
1916 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001917 if enable != None:
1918 self.enable = enable
1919 else:
1920 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001921 return
Dan Talaycof6202252013-07-02 01:00:29 -07001922
1923 def pack(self):
1924 packed = []
1925 packed.append(struct.pack("!B", self.version))
1926 packed.append(struct.pack("!B", self.type))
1927 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1928 packed.append(struct.pack("!L", self.xid))
1929 packed.append(struct.pack("!L", self.experimenter))
1930 packed.append(struct.pack("!L", self.subtype))
1931 packed.append(struct.pack("!L", self.enable))
1932 length = sum([len(x) for x in packed])
1933 packed[2] = struct.pack("!H", length)
1934 return ''.join(packed)
1935
1936 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001937 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001938 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001939 _version = reader.read("!B")[0]
1940 assert(_version == 4)
1941 _type = reader.read("!B")[0]
1942 assert(_type == 4)
1943 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001944 orig_reader = reader
1945 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001946 obj.xid = reader.read("!L")[0]
1947 _experimenter = reader.read("!L")[0]
1948 assert(_experimenter == 6035143)
1949 _subtype = reader.read("!L")[0]
1950 assert(_subtype == 18)
1951 obj.enable = reader.read("!L")[0]
1952 return obj
1953
1954 def __eq__(self, other):
1955 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001956 if self.xid != other.xid: return False
1957 if self.enable != other.enable: return False
1958 return True
1959
Dan Talaycof6202252013-07-02 01:00:29 -07001960 def pretty_print(self, q):
1961 q.text("bsn_bw_enable_set_request {")
1962 with q.group():
1963 with q.indent(2):
1964 q.breakable()
1965 q.text("xid = ");
1966 if self.xid != None:
1967 q.text("%#x" % self.xid)
1968 else:
1969 q.text('None')
1970 q.text(","); q.breakable()
1971 q.text("enable = ");
1972 q.text("%#x" % self.enable)
1973 q.breakable()
1974 q.text('}')
1975
Rich Lane7dcdf022013-12-11 14:45:27 -08001976bsn_header.subtypes[18] = bsn_bw_enable_set_request
1977
Rich Lane5454b682014-01-14 17:07:36 -08001978class bsn_controller_connections_reply(bsn_header):
1979 version = 4
1980 type = 4
1981 experimenter = 6035143
1982 subtype = 57
1983
1984 def __init__(self, xid=None, connections=None):
1985 if xid != None:
1986 self.xid = xid
1987 else:
1988 self.xid = None
1989 if connections != None:
1990 self.connections = connections
1991 else:
1992 self.connections = []
1993 return
1994
1995 def pack(self):
1996 packed = []
1997 packed.append(struct.pack("!B", self.version))
1998 packed.append(struct.pack("!B", self.type))
1999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2000 packed.append(struct.pack("!L", self.xid))
2001 packed.append(struct.pack("!L", self.experimenter))
2002 packed.append(struct.pack("!L", self.subtype))
2003 packed.append(loxi.generic_util.pack_list(self.connections))
2004 length = sum([len(x) for x in packed])
2005 packed[2] = struct.pack("!H", length)
2006 return ''.join(packed)
2007
2008 @staticmethod
2009 def unpack(reader):
2010 obj = bsn_controller_connections_reply()
2011 _version = reader.read("!B")[0]
2012 assert(_version == 4)
2013 _type = reader.read("!B")[0]
2014 assert(_type == 4)
2015 _length = reader.read("!H")[0]
2016 orig_reader = reader
2017 reader = orig_reader.slice(_length - (2 + 2))
2018 obj.xid = reader.read("!L")[0]
2019 _experimenter = reader.read("!L")[0]
2020 assert(_experimenter == 6035143)
2021 _subtype = reader.read("!L")[0]
2022 assert(_subtype == 57)
2023 obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack)
2024 return obj
2025
2026 def __eq__(self, other):
2027 if type(self) != type(other): return False
2028 if self.xid != other.xid: return False
2029 if self.connections != other.connections: return False
2030 return True
2031
2032 def pretty_print(self, q):
2033 q.text("bsn_controller_connections_reply {")
2034 with q.group():
2035 with q.indent(2):
2036 q.breakable()
2037 q.text("xid = ");
2038 if self.xid != None:
2039 q.text("%#x" % self.xid)
2040 else:
2041 q.text('None')
2042 q.text(","); q.breakable()
2043 q.text("connections = ");
2044 q.pp(self.connections)
2045 q.breakable()
2046 q.text('}')
2047
2048bsn_header.subtypes[57] = bsn_controller_connections_reply
2049
2050class bsn_controller_connections_request(bsn_header):
2051 version = 4
2052 type = 4
2053 experimenter = 6035143
2054 subtype = 56
2055
2056 def __init__(self, xid=None):
2057 if xid != None:
2058 self.xid = xid
2059 else:
2060 self.xid = None
2061 return
2062
2063 def pack(self):
2064 packed = []
2065 packed.append(struct.pack("!B", self.version))
2066 packed.append(struct.pack("!B", self.type))
2067 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2068 packed.append(struct.pack("!L", self.xid))
2069 packed.append(struct.pack("!L", self.experimenter))
2070 packed.append(struct.pack("!L", self.subtype))
2071 length = sum([len(x) for x in packed])
2072 packed[2] = struct.pack("!H", length)
2073 return ''.join(packed)
2074
2075 @staticmethod
2076 def unpack(reader):
2077 obj = bsn_controller_connections_request()
2078 _version = reader.read("!B")[0]
2079 assert(_version == 4)
2080 _type = reader.read("!B")[0]
2081 assert(_type == 4)
2082 _length = reader.read("!H")[0]
2083 orig_reader = reader
2084 reader = orig_reader.slice(_length - (2 + 2))
2085 obj.xid = reader.read("!L")[0]
2086 _experimenter = reader.read("!L")[0]
2087 assert(_experimenter == 6035143)
2088 _subtype = reader.read("!L")[0]
2089 assert(_subtype == 56)
2090 return obj
2091
2092 def __eq__(self, other):
2093 if type(self) != type(other): return False
2094 if self.xid != other.xid: return False
2095 return True
2096
2097 def pretty_print(self, q):
2098 q.text("bsn_controller_connections_request {")
2099 with q.group():
2100 with q.indent(2):
2101 q.breakable()
2102 q.text("xid = ");
2103 if self.xid != None:
2104 q.text("%#x" % self.xid)
2105 else:
2106 q.text('None')
2107 q.breakable()
2108 q.text('}')
2109
2110bsn_header.subtypes[56] = bsn_controller_connections_request
2111
Rich Lane9ec3fca2014-02-26 16:22:56 -08002112class experimenter_stats_reply(stats_reply):
2113 subtypes = {}
2114
2115 version = 4
2116 type = 19
2117 stats_type = 65535
2118
2119 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2120 if xid != None:
2121 self.xid = xid
2122 else:
2123 self.xid = None
2124 if flags != None:
2125 self.flags = flags
2126 else:
2127 self.flags = 0
2128 if experimenter != None:
2129 self.experimenter = experimenter
2130 else:
2131 self.experimenter = 0
2132 if subtype != None:
2133 self.subtype = subtype
2134 else:
2135 self.subtype = 0
2136 return
2137
2138 def pack(self):
2139 packed = []
2140 packed.append(struct.pack("!B", self.version))
2141 packed.append(struct.pack("!B", self.type))
2142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2143 packed.append(struct.pack("!L", self.xid))
2144 packed.append(struct.pack("!H", self.stats_type))
2145 packed.append(struct.pack("!H", self.flags))
2146 packed.append('\x00' * 4)
2147 packed.append(struct.pack("!L", self.experimenter))
2148 packed.append(struct.pack("!L", self.subtype))
2149 length = sum([len(x) for x in packed])
2150 packed[2] = struct.pack("!H", length)
2151 return ''.join(packed)
2152
2153 @staticmethod
2154 def unpack(reader):
2155 subtype, = reader.peek('!L', 16)
2156 subclass = experimenter_stats_reply.subtypes.get(subtype)
2157 if subclass:
2158 return subclass.unpack(reader)
2159
2160 obj = experimenter_stats_reply()
2161 _version = reader.read("!B")[0]
2162 assert(_version == 4)
2163 _type = reader.read("!B")[0]
2164 assert(_type == 19)
2165 _length = reader.read("!H")[0]
2166 orig_reader = reader
2167 reader = orig_reader.slice(_length - (2 + 2))
2168 obj.xid = reader.read("!L")[0]
2169 _stats_type = reader.read("!H")[0]
2170 assert(_stats_type == 65535)
2171 obj.flags = reader.read("!H")[0]
2172 reader.skip(4)
2173 obj.experimenter = reader.read("!L")[0]
2174 obj.subtype = reader.read("!L")[0]
2175 return obj
2176
2177 def __eq__(self, other):
2178 if type(self) != type(other): return False
2179 if self.xid != other.xid: return False
2180 if self.flags != other.flags: return False
2181 if self.experimenter != other.experimenter: return False
2182 if self.subtype != other.subtype: return False
2183 return True
2184
2185 def pretty_print(self, q):
2186 q.text("experimenter_stats_reply {")
2187 with q.group():
2188 with q.indent(2):
2189 q.breakable()
2190 q.text("xid = ");
2191 if self.xid != None:
2192 q.text("%#x" % self.xid)
2193 else:
2194 q.text('None')
2195 q.text(","); q.breakable()
2196 q.text("flags = ");
2197 q.text("%#x" % self.flags)
2198 q.text(","); q.breakable()
2199 q.text("subtype = ");
2200 q.text("%#x" % self.subtype)
2201 q.breakable()
2202 q.text('}')
2203
2204stats_reply.subtypes[65535] = experimenter_stats_reply
2205
2206class bsn_stats_reply(experimenter_stats_reply):
2207 subtypes = {}
2208
2209 version = 4
2210 type = 19
2211 stats_type = 65535
2212 experimenter = 6035143
2213
2214 def __init__(self, xid=None, flags=None, subtype=None):
2215 if xid != None:
2216 self.xid = xid
2217 else:
2218 self.xid = None
2219 if flags != None:
2220 self.flags = flags
2221 else:
2222 self.flags = 0
2223 if subtype != None:
2224 self.subtype = subtype
2225 else:
2226 self.subtype = 0
2227 return
2228
2229 def pack(self):
2230 packed = []
2231 packed.append(struct.pack("!B", self.version))
2232 packed.append(struct.pack("!B", self.type))
2233 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2234 packed.append(struct.pack("!L", self.xid))
2235 packed.append(struct.pack("!H", self.stats_type))
2236 packed.append(struct.pack("!H", self.flags))
2237 packed.append('\x00' * 4)
2238 packed.append(struct.pack("!L", self.experimenter))
2239 packed.append(struct.pack("!L", self.subtype))
2240 length = sum([len(x) for x in packed])
2241 packed[2] = struct.pack("!H", length)
2242 return ''.join(packed)
2243
2244 @staticmethod
2245 def unpack(reader):
2246 subtype, = reader.peek('!L', 20)
2247 subclass = bsn_stats_reply.subtypes.get(subtype)
2248 if subclass:
2249 return subclass.unpack(reader)
2250
2251 obj = bsn_stats_reply()
2252 _version = reader.read("!B")[0]
2253 assert(_version == 4)
2254 _type = reader.read("!B")[0]
2255 assert(_type == 19)
2256 _length = reader.read("!H")[0]
2257 orig_reader = reader
2258 reader = orig_reader.slice(_length - (2 + 2))
2259 obj.xid = reader.read("!L")[0]
2260 _stats_type = reader.read("!H")[0]
2261 assert(_stats_type == 65535)
2262 obj.flags = reader.read("!H")[0]
2263 reader.skip(4)
2264 _experimenter = reader.read("!L")[0]
2265 assert(_experimenter == 6035143)
2266 obj.subtype = reader.read("!L")[0]
2267 return obj
2268
2269 def __eq__(self, other):
2270 if type(self) != type(other): return False
2271 if self.xid != other.xid: return False
2272 if self.flags != other.flags: return False
2273 if self.subtype != other.subtype: return False
2274 return True
2275
2276 def pretty_print(self, q):
2277 q.text("bsn_stats_reply {")
2278 with q.group():
2279 with q.indent(2):
2280 q.breakable()
2281 q.text("xid = ");
2282 if self.xid != None:
2283 q.text("%#x" % self.xid)
2284 else:
2285 q.text('None')
2286 q.text(","); q.breakable()
2287 q.text("flags = ");
2288 q.text("%#x" % self.flags)
2289 q.breakable()
2290 q.text('}')
2291
2292experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2293
2294class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2295 version = 4
2296 type = 19
2297 stats_type = 65535
2298 experimenter = 6035143
2299 subtype = 10
2300
2301 def __init__(self, xid=None, flags=None, entries=None):
2302 if xid != None:
2303 self.xid = xid
2304 else:
2305 self.xid = None
2306 if flags != None:
2307 self.flags = flags
2308 else:
2309 self.flags = 0
2310 if entries != None:
2311 self.entries = entries
2312 else:
2313 self.entries = []
2314 return
2315
2316 def pack(self):
2317 packed = []
2318 packed.append(struct.pack("!B", self.version))
2319 packed.append(struct.pack("!B", self.type))
2320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2321 packed.append(struct.pack("!L", self.xid))
2322 packed.append(struct.pack("!H", self.stats_type))
2323 packed.append(struct.pack("!H", self.flags))
2324 packed.append('\x00' * 4)
2325 packed.append(struct.pack("!L", self.experimenter))
2326 packed.append(struct.pack("!L", self.subtype))
2327 packed.append(loxi.generic_util.pack_list(self.entries))
2328 length = sum([len(x) for x in packed])
2329 packed[2] = struct.pack("!H", length)
2330 return ''.join(packed)
2331
2332 @staticmethod
2333 def unpack(reader):
2334 obj = bsn_flow_checksum_bucket_stats_reply()
2335 _version = reader.read("!B")[0]
2336 assert(_version == 4)
2337 _type = reader.read("!B")[0]
2338 assert(_type == 19)
2339 _length = reader.read("!H")[0]
2340 orig_reader = reader
2341 reader = orig_reader.slice(_length - (2 + 2))
2342 obj.xid = reader.read("!L")[0]
2343 _stats_type = reader.read("!H")[0]
2344 assert(_stats_type == 65535)
2345 obj.flags = reader.read("!H")[0]
2346 reader.skip(4)
2347 _experimenter = reader.read("!L")[0]
2348 assert(_experimenter == 6035143)
2349 _subtype = reader.read("!L")[0]
2350 assert(_subtype == 10)
2351 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack)
2352 return obj
2353
2354 def __eq__(self, other):
2355 if type(self) != type(other): return False
2356 if self.xid != other.xid: return False
2357 if self.flags != other.flags: return False
2358 if self.entries != other.entries: return False
2359 return True
2360
2361 def pretty_print(self, q):
2362 q.text("bsn_flow_checksum_bucket_stats_reply {")
2363 with q.group():
2364 with q.indent(2):
2365 q.breakable()
2366 q.text("xid = ");
2367 if self.xid != None:
2368 q.text("%#x" % self.xid)
2369 else:
2370 q.text('None')
2371 q.text(","); q.breakable()
2372 q.text("flags = ");
2373 q.text("%#x" % self.flags)
2374 q.text(","); q.breakable()
2375 q.text("entries = ");
2376 q.pp(self.entries)
2377 q.breakable()
2378 q.text('}')
2379
2380bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2381
2382class experimenter_stats_request(stats_request):
2383 subtypes = {}
2384
2385 version = 4
2386 type = 18
2387 stats_type = 65535
2388
2389 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2390 if xid != None:
2391 self.xid = xid
2392 else:
2393 self.xid = None
2394 if flags != None:
2395 self.flags = flags
2396 else:
2397 self.flags = 0
2398 if experimenter != None:
2399 self.experimenter = experimenter
2400 else:
2401 self.experimenter = 0
2402 if subtype != None:
2403 self.subtype = subtype
2404 else:
2405 self.subtype = 0
2406 return
2407
2408 def pack(self):
2409 packed = []
2410 packed.append(struct.pack("!B", self.version))
2411 packed.append(struct.pack("!B", self.type))
2412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2413 packed.append(struct.pack("!L", self.xid))
2414 packed.append(struct.pack("!H", self.stats_type))
2415 packed.append(struct.pack("!H", self.flags))
2416 packed.append('\x00' * 4)
2417 packed.append(struct.pack("!L", self.experimenter))
2418 packed.append(struct.pack("!L", self.subtype))
2419 length = sum([len(x) for x in packed])
2420 packed[2] = struct.pack("!H", length)
2421 return ''.join(packed)
2422
2423 @staticmethod
2424 def unpack(reader):
2425 subtype, = reader.peek('!L', 16)
2426 subclass = experimenter_stats_request.subtypes.get(subtype)
2427 if subclass:
2428 return subclass.unpack(reader)
2429
2430 obj = experimenter_stats_request()
2431 _version = reader.read("!B")[0]
2432 assert(_version == 4)
2433 _type = reader.read("!B")[0]
2434 assert(_type == 18)
2435 _length = reader.read("!H")[0]
2436 orig_reader = reader
2437 reader = orig_reader.slice(_length - (2 + 2))
2438 obj.xid = reader.read("!L")[0]
2439 _stats_type = reader.read("!H")[0]
2440 assert(_stats_type == 65535)
2441 obj.flags = reader.read("!H")[0]
2442 reader.skip(4)
2443 obj.experimenter = reader.read("!L")[0]
2444 obj.subtype = reader.read("!L")[0]
2445 return obj
2446
2447 def __eq__(self, other):
2448 if type(self) != type(other): return False
2449 if self.xid != other.xid: return False
2450 if self.flags != other.flags: return False
2451 if self.experimenter != other.experimenter: return False
2452 if self.subtype != other.subtype: return False
2453 return True
2454
2455 def pretty_print(self, q):
2456 q.text("experimenter_stats_request {")
2457 with q.group():
2458 with q.indent(2):
2459 q.breakable()
2460 q.text("xid = ");
2461 if self.xid != None:
2462 q.text("%#x" % self.xid)
2463 else:
2464 q.text('None')
2465 q.text(","); q.breakable()
2466 q.text("flags = ");
2467 q.text("%#x" % self.flags)
2468 q.text(","); q.breakable()
2469 q.text("subtype = ");
2470 q.text("%#x" % self.subtype)
2471 q.breakable()
2472 q.text('}')
2473
2474stats_request.subtypes[65535] = experimenter_stats_request
2475
2476class bsn_stats_request(experimenter_stats_request):
2477 subtypes = {}
2478
2479 version = 4
2480 type = 18
2481 stats_type = 65535
2482 experimenter = 6035143
2483
2484 def __init__(self, xid=None, flags=None, subtype=None):
2485 if xid != None:
2486 self.xid = xid
2487 else:
2488 self.xid = None
2489 if flags != None:
2490 self.flags = flags
2491 else:
2492 self.flags = 0
2493 if subtype != None:
2494 self.subtype = subtype
2495 else:
2496 self.subtype = 0
2497 return
2498
2499 def pack(self):
2500 packed = []
2501 packed.append(struct.pack("!B", self.version))
2502 packed.append(struct.pack("!B", self.type))
2503 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2504 packed.append(struct.pack("!L", self.xid))
2505 packed.append(struct.pack("!H", self.stats_type))
2506 packed.append(struct.pack("!H", self.flags))
2507 packed.append('\x00' * 4)
2508 packed.append(struct.pack("!L", self.experimenter))
2509 packed.append(struct.pack("!L", self.subtype))
2510 length = sum([len(x) for x in packed])
2511 packed[2] = struct.pack("!H", length)
2512 return ''.join(packed)
2513
2514 @staticmethod
2515 def unpack(reader):
2516 subtype, = reader.peek('!L', 20)
2517 subclass = bsn_stats_request.subtypes.get(subtype)
2518 if subclass:
2519 return subclass.unpack(reader)
2520
2521 obj = bsn_stats_request()
2522 _version = reader.read("!B")[0]
2523 assert(_version == 4)
2524 _type = reader.read("!B")[0]
2525 assert(_type == 18)
2526 _length = reader.read("!H")[0]
2527 orig_reader = reader
2528 reader = orig_reader.slice(_length - (2 + 2))
2529 obj.xid = reader.read("!L")[0]
2530 _stats_type = reader.read("!H")[0]
2531 assert(_stats_type == 65535)
2532 obj.flags = reader.read("!H")[0]
2533 reader.skip(4)
2534 _experimenter = reader.read("!L")[0]
2535 assert(_experimenter == 6035143)
2536 obj.subtype = reader.read("!L")[0]
2537 return obj
2538
2539 def __eq__(self, other):
2540 if type(self) != type(other): return False
2541 if self.xid != other.xid: return False
2542 if self.flags != other.flags: return False
2543 if self.subtype != other.subtype: return False
2544 return True
2545
2546 def pretty_print(self, q):
2547 q.text("bsn_stats_request {")
2548 with q.group():
2549 with q.indent(2):
2550 q.breakable()
2551 q.text("xid = ");
2552 if self.xid != None:
2553 q.text("%#x" % self.xid)
2554 else:
2555 q.text('None')
2556 q.text(","); q.breakable()
2557 q.text("flags = ");
2558 q.text("%#x" % self.flags)
2559 q.breakable()
2560 q.text('}')
2561
2562experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2563
2564class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2565 version = 4
2566 type = 18
2567 stats_type = 65535
2568 experimenter = 6035143
2569 subtype = 10
2570
2571 def __init__(self, xid=None, flags=None, table_id=None):
2572 if xid != None:
2573 self.xid = xid
2574 else:
2575 self.xid = None
2576 if flags != None:
2577 self.flags = flags
2578 else:
2579 self.flags = 0
2580 if table_id != None:
2581 self.table_id = table_id
2582 else:
2583 self.table_id = 0
2584 return
2585
2586 def pack(self):
2587 packed = []
2588 packed.append(struct.pack("!B", self.version))
2589 packed.append(struct.pack("!B", self.type))
2590 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2591 packed.append(struct.pack("!L", self.xid))
2592 packed.append(struct.pack("!H", self.stats_type))
2593 packed.append(struct.pack("!H", self.flags))
2594 packed.append('\x00' * 4)
2595 packed.append(struct.pack("!L", self.experimenter))
2596 packed.append(struct.pack("!L", self.subtype))
2597 packed.append(struct.pack("!B", self.table_id))
2598 length = sum([len(x) for x in packed])
2599 packed[2] = struct.pack("!H", length)
2600 return ''.join(packed)
2601
2602 @staticmethod
2603 def unpack(reader):
2604 obj = bsn_flow_checksum_bucket_stats_request()
2605 _version = reader.read("!B")[0]
2606 assert(_version == 4)
2607 _type = reader.read("!B")[0]
2608 assert(_type == 18)
2609 _length = reader.read("!H")[0]
2610 orig_reader = reader
2611 reader = orig_reader.slice(_length - (2 + 2))
2612 obj.xid = reader.read("!L")[0]
2613 _stats_type = reader.read("!H")[0]
2614 assert(_stats_type == 65535)
2615 obj.flags = reader.read("!H")[0]
2616 reader.skip(4)
2617 _experimenter = reader.read("!L")[0]
2618 assert(_experimenter == 6035143)
2619 _subtype = reader.read("!L")[0]
2620 assert(_subtype == 10)
2621 obj.table_id = reader.read("!B")[0]
2622 return obj
2623
2624 def __eq__(self, other):
2625 if type(self) != type(other): return False
2626 if self.xid != other.xid: return False
2627 if self.flags != other.flags: return False
2628 if self.table_id != other.table_id: return False
2629 return True
2630
2631 def pretty_print(self, q):
2632 q.text("bsn_flow_checksum_bucket_stats_request {")
2633 with q.group():
2634 with q.indent(2):
2635 q.breakable()
2636 q.text("xid = ");
2637 if self.xid != None:
2638 q.text("%#x" % self.xid)
2639 else:
2640 q.text('None')
2641 q.text(","); q.breakable()
2642 q.text("flags = ");
2643 q.text("%#x" % self.flags)
2644 q.text(","); q.breakable()
2645 q.text("table_id = ");
2646 q.text("%#x" % self.table_id)
2647 q.breakable()
2648 q.text('}')
2649
2650bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2651
Rich Lane7dcdf022013-12-11 14:45:27 -08002652class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002653 version = 4
2654 type = 4
2655 experimenter = 6035143
2656 subtype = 40
2657
2658 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002659 if xid != None:
2660 self.xid = xid
2661 else:
2662 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002663 if cookie != None:
2664 self.cookie = cookie
2665 else:
2666 self.cookie = 0
2667 if priority != None:
2668 self.priority = priority
2669 else:
2670 self.priority = 0
2671 if table_id != None:
2672 self.table_id = table_id
2673 else:
2674 self.table_id = 0
2675 if match != None:
2676 self.match = match
2677 else:
2678 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08002679 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002680
2681 def pack(self):
2682 packed = []
2683 packed.append(struct.pack("!B", self.version))
2684 packed.append(struct.pack("!B", self.type))
2685 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2686 packed.append(struct.pack("!L", self.xid))
2687 packed.append(struct.pack("!L", self.experimenter))
2688 packed.append(struct.pack("!L", self.subtype))
2689 packed.append(struct.pack("!Q", self.cookie))
2690 packed.append(struct.pack("!H", self.priority))
2691 packed.append(struct.pack("!B", self.table_id))
2692 packed.append('\x00' * 5)
2693 packed.append(self.match.pack())
2694 length = sum([len(x) for x in packed])
2695 packed[2] = struct.pack("!H", length)
2696 return ''.join(packed)
2697
2698 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002699 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002700 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07002701 _version = reader.read("!B")[0]
2702 assert(_version == 4)
2703 _type = reader.read("!B")[0]
2704 assert(_type == 4)
2705 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002706 orig_reader = reader
2707 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002708 obj.xid = reader.read("!L")[0]
2709 _experimenter = reader.read("!L")[0]
2710 assert(_experimenter == 6035143)
2711 _subtype = reader.read("!L")[0]
2712 assert(_subtype == 40)
2713 obj.cookie = reader.read("!Q")[0]
2714 obj.priority = reader.read("!H")[0]
2715 obj.table_id = reader.read("!B")[0]
2716 reader.skip(5)
2717 obj.match = common.match.unpack(reader)
2718 return obj
2719
2720 def __eq__(self, other):
2721 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002722 if self.xid != other.xid: return False
2723 if self.cookie != other.cookie: return False
2724 if self.priority != other.priority: return False
2725 if self.table_id != other.table_id: return False
2726 if self.match != other.match: return False
2727 return True
2728
Rich Lane6f4978c2013-10-20 21:33:52 -07002729 def pretty_print(self, q):
2730 q.text("bsn_flow_idle {")
2731 with q.group():
2732 with q.indent(2):
2733 q.breakable()
2734 q.text("xid = ");
2735 if self.xid != None:
2736 q.text("%#x" % self.xid)
2737 else:
2738 q.text('None')
2739 q.text(","); q.breakable()
2740 q.text("cookie = ");
2741 q.text("%#x" % self.cookie)
2742 q.text(","); q.breakable()
2743 q.text("priority = ");
2744 q.text("%#x" % self.priority)
2745 q.text(","); q.breakable()
2746 q.text("table_id = ");
2747 q.text("%#x" % self.table_id)
2748 q.text(","); q.breakable()
2749 q.text("match = ");
2750 q.pp(self.match)
2751 q.breakable()
2752 q.text('}')
2753
Rich Lane7dcdf022013-12-11 14:45:27 -08002754bsn_header.subtypes[40] = bsn_flow_idle
2755
2756class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002757 version = 4
2758 type = 4
2759 experimenter = 6035143
2760 subtype = 39
2761
2762 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002763 if xid != None:
2764 self.xid = xid
2765 else:
2766 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002767 if enabled != None:
2768 self.enabled = enabled
2769 else:
2770 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002771 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002772
2773 def pack(self):
2774 packed = []
2775 packed.append(struct.pack("!B", self.version))
2776 packed.append(struct.pack("!B", self.type))
2777 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2778 packed.append(struct.pack("!L", self.xid))
2779 packed.append(struct.pack("!L", self.experimenter))
2780 packed.append(struct.pack("!L", self.subtype))
2781 packed.append(struct.pack("!L", self.enabled))
2782 length = sum([len(x) for x in packed])
2783 packed[2] = struct.pack("!H", length)
2784 return ''.join(packed)
2785
2786 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002787 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002788 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002789 _version = reader.read("!B")[0]
2790 assert(_version == 4)
2791 _type = reader.read("!B")[0]
2792 assert(_type == 4)
2793 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002794 orig_reader = reader
2795 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002796 obj.xid = reader.read("!L")[0]
2797 _experimenter = reader.read("!L")[0]
2798 assert(_experimenter == 6035143)
2799 _subtype = reader.read("!L")[0]
2800 assert(_subtype == 39)
2801 obj.enabled = reader.read("!L")[0]
2802 return obj
2803
2804 def __eq__(self, other):
2805 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002806 if self.xid != other.xid: return False
2807 if self.enabled != other.enabled: return False
2808 return True
2809
Rich Lane6f4978c2013-10-20 21:33:52 -07002810 def pretty_print(self, q):
2811 q.text("bsn_flow_idle_enable_get_reply {")
2812 with q.group():
2813 with q.indent(2):
2814 q.breakable()
2815 q.text("xid = ");
2816 if self.xid != None:
2817 q.text("%#x" % self.xid)
2818 else:
2819 q.text('None')
2820 q.text(","); q.breakable()
2821 q.text("enabled = ");
2822 q.text("%#x" % self.enabled)
2823 q.breakable()
2824 q.text('}')
2825
Rich Lane7dcdf022013-12-11 14:45:27 -08002826bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
2827
2828class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002829 version = 4
2830 type = 4
2831 experimenter = 6035143
2832 subtype = 38
2833
2834 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002835 if xid != None:
2836 self.xid = xid
2837 else:
2838 self.xid = None
2839 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002840
2841 def pack(self):
2842 packed = []
2843 packed.append(struct.pack("!B", self.version))
2844 packed.append(struct.pack("!B", self.type))
2845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2846 packed.append(struct.pack("!L", self.xid))
2847 packed.append(struct.pack("!L", self.experimenter))
2848 packed.append(struct.pack("!L", self.subtype))
2849 length = sum([len(x) for x in packed])
2850 packed[2] = struct.pack("!H", length)
2851 return ''.join(packed)
2852
2853 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002854 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002855 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002856 _version = reader.read("!B")[0]
2857 assert(_version == 4)
2858 _type = reader.read("!B")[0]
2859 assert(_type == 4)
2860 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002861 orig_reader = reader
2862 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002863 obj.xid = reader.read("!L")[0]
2864 _experimenter = reader.read("!L")[0]
2865 assert(_experimenter == 6035143)
2866 _subtype = reader.read("!L")[0]
2867 assert(_subtype == 38)
2868 return obj
2869
2870 def __eq__(self, other):
2871 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002872 if self.xid != other.xid: return False
2873 return True
2874
Rich Lane6f4978c2013-10-20 21:33:52 -07002875 def pretty_print(self, q):
2876 q.text("bsn_flow_idle_enable_get_request {")
2877 with q.group():
2878 with q.indent(2):
2879 q.breakable()
2880 q.text("xid = ");
2881 if self.xid != None:
2882 q.text("%#x" % self.xid)
2883 else:
2884 q.text('None')
2885 q.breakable()
2886 q.text('}')
2887
Rich Lane7dcdf022013-12-11 14:45:27 -08002888bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
2889
2890class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002891 version = 4
2892 type = 4
2893 experimenter = 6035143
2894 subtype = 37
2895
2896 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002897 if xid != None:
2898 self.xid = xid
2899 else:
2900 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002901 if enable != None:
2902 self.enable = enable
2903 else:
2904 self.enable = 0
2905 if status != None:
2906 self.status = status
2907 else:
2908 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002909 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002910
2911 def pack(self):
2912 packed = []
2913 packed.append(struct.pack("!B", self.version))
2914 packed.append(struct.pack("!B", self.type))
2915 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2916 packed.append(struct.pack("!L", self.xid))
2917 packed.append(struct.pack("!L", self.experimenter))
2918 packed.append(struct.pack("!L", self.subtype))
2919 packed.append(struct.pack("!L", self.enable))
2920 packed.append(struct.pack("!L", self.status))
2921 length = sum([len(x) for x in packed])
2922 packed[2] = struct.pack("!H", length)
2923 return ''.join(packed)
2924
2925 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002926 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002927 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002928 _version = reader.read("!B")[0]
2929 assert(_version == 4)
2930 _type = reader.read("!B")[0]
2931 assert(_type == 4)
2932 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002933 orig_reader = reader
2934 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002935 obj.xid = reader.read("!L")[0]
2936 _experimenter = reader.read("!L")[0]
2937 assert(_experimenter == 6035143)
2938 _subtype = reader.read("!L")[0]
2939 assert(_subtype == 37)
2940 obj.enable = reader.read("!L")[0]
2941 obj.status = reader.read("!L")[0]
2942 return obj
2943
2944 def __eq__(self, other):
2945 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002946 if self.xid != other.xid: return False
2947 if self.enable != other.enable: return False
2948 if self.status != other.status: return False
2949 return True
2950
Rich Lane6f4978c2013-10-20 21:33:52 -07002951 def pretty_print(self, q):
2952 q.text("bsn_flow_idle_enable_set_reply {")
2953 with q.group():
2954 with q.indent(2):
2955 q.breakable()
2956 q.text("xid = ");
2957 if self.xid != None:
2958 q.text("%#x" % self.xid)
2959 else:
2960 q.text('None')
2961 q.text(","); q.breakable()
2962 q.text("enable = ");
2963 q.text("%#x" % self.enable)
2964 q.text(","); q.breakable()
2965 q.text("status = ");
2966 q.text("%#x" % self.status)
2967 q.breakable()
2968 q.text('}')
2969
Rich Lane7dcdf022013-12-11 14:45:27 -08002970bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
2971
2972class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002973 version = 4
2974 type = 4
2975 experimenter = 6035143
2976 subtype = 36
2977
2978 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002979 if xid != None:
2980 self.xid = xid
2981 else:
2982 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002983 if enable != None:
2984 self.enable = enable
2985 else:
2986 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002987 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002988
2989 def pack(self):
2990 packed = []
2991 packed.append(struct.pack("!B", self.version))
2992 packed.append(struct.pack("!B", self.type))
2993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2994 packed.append(struct.pack("!L", self.xid))
2995 packed.append(struct.pack("!L", self.experimenter))
2996 packed.append(struct.pack("!L", self.subtype))
2997 packed.append(struct.pack("!L", self.enable))
2998 length = sum([len(x) for x in packed])
2999 packed[2] = struct.pack("!H", length)
3000 return ''.join(packed)
3001
3002 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003003 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003004 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003005 _version = reader.read("!B")[0]
3006 assert(_version == 4)
3007 _type = reader.read("!B")[0]
3008 assert(_type == 4)
3009 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003010 orig_reader = reader
3011 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003012 obj.xid = reader.read("!L")[0]
3013 _experimenter = reader.read("!L")[0]
3014 assert(_experimenter == 6035143)
3015 _subtype = reader.read("!L")[0]
3016 assert(_subtype == 36)
3017 obj.enable = reader.read("!L")[0]
3018 return obj
3019
3020 def __eq__(self, other):
3021 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003022 if self.xid != other.xid: return False
3023 if self.enable != other.enable: return False
3024 return True
3025
Rich Lane6f4978c2013-10-20 21:33:52 -07003026 def pretty_print(self, q):
3027 q.text("bsn_flow_idle_enable_set_request {")
3028 with q.group():
3029 with q.indent(2):
3030 q.breakable()
3031 q.text("xid = ");
3032 if self.xid != None:
3033 q.text("%#x" % self.xid)
3034 else:
3035 q.text('None')
3036 q.text(","); q.breakable()
3037 q.text("enable = ");
3038 q.text("%#x" % self.enable)
3039 q.breakable()
3040 q.text('}')
3041
Rich Lane7dcdf022013-12-11 14:45:27 -08003042bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3043
Rich Lane5454b682014-01-14 17:07:36 -08003044class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3045 version = 4
3046 type = 19
3047 stats_type = 65535
3048 experimenter = 6035143
3049 subtype = 5
3050
3051 def __init__(self, xid=None, flags=None, entries=None):
3052 if xid != None:
3053 self.xid = xid
3054 else:
3055 self.xid = None
3056 if flags != None:
3057 self.flags = flags
3058 else:
3059 self.flags = 0
3060 if entries != None:
3061 self.entries = entries
3062 else:
3063 self.entries = []
3064 return
3065
3066 def pack(self):
3067 packed = []
3068 packed.append(struct.pack("!B", self.version))
3069 packed.append(struct.pack("!B", self.type))
3070 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3071 packed.append(struct.pack("!L", self.xid))
3072 packed.append(struct.pack("!H", self.stats_type))
3073 packed.append(struct.pack("!H", self.flags))
3074 packed.append('\x00' * 4)
3075 packed.append(struct.pack("!L", self.experimenter))
3076 packed.append(struct.pack("!L", self.subtype))
3077 packed.append(loxi.generic_util.pack_list(self.entries))
3078 length = sum([len(x) for x in packed])
3079 packed[2] = struct.pack("!H", length)
3080 return ''.join(packed)
3081
3082 @staticmethod
3083 def unpack(reader):
3084 obj = bsn_gentable_bucket_stats_reply()
3085 _version = reader.read("!B")[0]
3086 assert(_version == 4)
3087 _type = reader.read("!B")[0]
3088 assert(_type == 19)
3089 _length = reader.read("!H")[0]
3090 orig_reader = reader
3091 reader = orig_reader.slice(_length - (2 + 2))
3092 obj.xid = reader.read("!L")[0]
3093 _stats_type = reader.read("!H")[0]
3094 assert(_stats_type == 65535)
3095 obj.flags = reader.read("!H")[0]
3096 reader.skip(4)
3097 _experimenter = reader.read("!L")[0]
3098 assert(_experimenter == 6035143)
3099 _subtype = reader.read("!L")[0]
3100 assert(_subtype == 5)
3101 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
3102 return obj
3103
3104 def __eq__(self, other):
3105 if type(self) != type(other): return False
3106 if self.xid != other.xid: return False
3107 if self.flags != other.flags: return False
3108 if self.entries != other.entries: return False
3109 return True
3110
3111 def pretty_print(self, q):
3112 q.text("bsn_gentable_bucket_stats_reply {")
3113 with q.group():
3114 with q.indent(2):
3115 q.breakable()
3116 q.text("xid = ");
3117 if self.xid != None:
3118 q.text("%#x" % self.xid)
3119 else:
3120 q.text('None')
3121 q.text(","); q.breakable()
3122 q.text("flags = ");
3123 q.text("%#x" % self.flags)
3124 q.text(","); q.breakable()
3125 q.text("entries = ");
3126 q.pp(self.entries)
3127 q.breakable()
3128 q.text('}')
3129
3130bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3131
Rich Lane5454b682014-01-14 17:07:36 -08003132class bsn_gentable_bucket_stats_request(bsn_stats_request):
3133 version = 4
3134 type = 18
3135 stats_type = 65535
3136 experimenter = 6035143
3137 subtype = 5
3138
3139 def __init__(self, xid=None, flags=None, table_id=None):
3140 if xid != None:
3141 self.xid = xid
3142 else:
3143 self.xid = None
3144 if flags != None:
3145 self.flags = flags
3146 else:
3147 self.flags = 0
3148 if table_id != None:
3149 self.table_id = table_id
3150 else:
3151 self.table_id = 0
3152 return
3153
3154 def pack(self):
3155 packed = []
3156 packed.append(struct.pack("!B", self.version))
3157 packed.append(struct.pack("!B", self.type))
3158 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3159 packed.append(struct.pack("!L", self.xid))
3160 packed.append(struct.pack("!H", self.stats_type))
3161 packed.append(struct.pack("!H", self.flags))
3162 packed.append('\x00' * 4)
3163 packed.append(struct.pack("!L", self.experimenter))
3164 packed.append(struct.pack("!L", self.subtype))
3165 packed.append(struct.pack("!H", self.table_id))
3166 length = sum([len(x) for x in packed])
3167 packed[2] = struct.pack("!H", length)
3168 return ''.join(packed)
3169
3170 @staticmethod
3171 def unpack(reader):
3172 obj = bsn_gentable_bucket_stats_request()
3173 _version = reader.read("!B")[0]
3174 assert(_version == 4)
3175 _type = reader.read("!B")[0]
3176 assert(_type == 18)
3177 _length = reader.read("!H")[0]
3178 orig_reader = reader
3179 reader = orig_reader.slice(_length - (2 + 2))
3180 obj.xid = reader.read("!L")[0]
3181 _stats_type = reader.read("!H")[0]
3182 assert(_stats_type == 65535)
3183 obj.flags = reader.read("!H")[0]
3184 reader.skip(4)
3185 _experimenter = reader.read("!L")[0]
3186 assert(_experimenter == 6035143)
3187 _subtype = reader.read("!L")[0]
3188 assert(_subtype == 5)
3189 obj.table_id = reader.read("!H")[0]
3190 return obj
3191
3192 def __eq__(self, other):
3193 if type(self) != type(other): return False
3194 if self.xid != other.xid: return False
3195 if self.flags != other.flags: return False
3196 if self.table_id != other.table_id: return False
3197 return True
3198
3199 def pretty_print(self, q):
3200 q.text("bsn_gentable_bucket_stats_request {")
3201 with q.group():
3202 with q.indent(2):
3203 q.breakable()
3204 q.text("xid = ");
3205 if self.xid != None:
3206 q.text("%#x" % self.xid)
3207 else:
3208 q.text('None')
3209 q.text(","); q.breakable()
3210 q.text("flags = ");
3211 q.text("%#x" % self.flags)
3212 q.text(","); q.breakable()
3213 q.text("table_id = ");
3214 q.text("%#x" % self.table_id)
3215 q.breakable()
3216 q.text('}')
3217
3218bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3219
3220class bsn_gentable_clear_reply(bsn_header):
3221 version = 4
3222 type = 4
3223 experimenter = 6035143
3224 subtype = 49
3225
3226 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3227 if xid != None:
3228 self.xid = xid
3229 else:
3230 self.xid = None
3231 if table_id != None:
3232 self.table_id = table_id
3233 else:
3234 self.table_id = 0
3235 if deleted_count != None:
3236 self.deleted_count = deleted_count
3237 else:
3238 self.deleted_count = 0
3239 if error_count != None:
3240 self.error_count = error_count
3241 else:
3242 self.error_count = 0
3243 return
3244
3245 def pack(self):
3246 packed = []
3247 packed.append(struct.pack("!B", self.version))
3248 packed.append(struct.pack("!B", self.type))
3249 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3250 packed.append(struct.pack("!L", self.xid))
3251 packed.append(struct.pack("!L", self.experimenter))
3252 packed.append(struct.pack("!L", self.subtype))
3253 packed.append(struct.pack("!H", self.table_id))
3254 packed.append('\x00' * 2)
3255 packed.append(struct.pack("!L", self.deleted_count))
3256 packed.append(struct.pack("!L", self.error_count))
3257 length = sum([len(x) for x in packed])
3258 packed[2] = struct.pack("!H", length)
3259 return ''.join(packed)
3260
3261 @staticmethod
3262 def unpack(reader):
3263 obj = bsn_gentable_clear_reply()
3264 _version = reader.read("!B")[0]
3265 assert(_version == 4)
3266 _type = reader.read("!B")[0]
3267 assert(_type == 4)
3268 _length = reader.read("!H")[0]
3269 orig_reader = reader
3270 reader = orig_reader.slice(_length - (2 + 2))
3271 obj.xid = reader.read("!L")[0]
3272 _experimenter = reader.read("!L")[0]
3273 assert(_experimenter == 6035143)
3274 _subtype = reader.read("!L")[0]
3275 assert(_subtype == 49)
3276 obj.table_id = reader.read("!H")[0]
3277 reader.skip(2)
3278 obj.deleted_count = reader.read("!L")[0]
3279 obj.error_count = reader.read("!L")[0]
3280 return obj
3281
3282 def __eq__(self, other):
3283 if type(self) != type(other): return False
3284 if self.xid != other.xid: return False
3285 if self.table_id != other.table_id: return False
3286 if self.deleted_count != other.deleted_count: return False
3287 if self.error_count != other.error_count: return False
3288 return True
3289
3290 def pretty_print(self, q):
3291 q.text("bsn_gentable_clear_reply {")
3292 with q.group():
3293 with q.indent(2):
3294 q.breakable()
3295 q.text("xid = ");
3296 if self.xid != None:
3297 q.text("%#x" % self.xid)
3298 else:
3299 q.text('None')
3300 q.text(","); q.breakable()
3301 q.text("table_id = ");
3302 q.text("%#x" % self.table_id)
3303 q.text(","); q.breakable()
3304 q.text("deleted_count = ");
3305 q.text("%#x" % self.deleted_count)
3306 q.text(","); q.breakable()
3307 q.text("error_count = ");
3308 q.text("%#x" % self.error_count)
3309 q.breakable()
3310 q.text('}')
3311
3312bsn_header.subtypes[49] = bsn_gentable_clear_reply
3313
3314class bsn_gentable_clear_request(bsn_header):
3315 version = 4
3316 type = 4
3317 experimenter = 6035143
3318 subtype = 48
3319
3320 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=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 checksum_mask != None:
3334 self.checksum_mask = checksum_mask
3335 else:
3336 self.checksum_mask = 0
3337 return
3338
3339 def pack(self):
3340 packed = []
3341 packed.append(struct.pack("!B", self.version))
3342 packed.append(struct.pack("!B", self.type))
3343 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3344 packed.append(struct.pack("!L", self.xid))
3345 packed.append(struct.pack("!L", self.experimenter))
3346 packed.append(struct.pack("!L", self.subtype))
3347 packed.append(struct.pack("!H", self.table_id))
3348 packed.append('\x00' * 2)
3349 packed.append(util.pack_checksum_128(self.checksum))
3350 packed.append(util.pack_checksum_128(self.checksum_mask))
3351 length = sum([len(x) for x in packed])
3352 packed[2] = struct.pack("!H", length)
3353 return ''.join(packed)
3354
3355 @staticmethod
3356 def unpack(reader):
3357 obj = bsn_gentable_clear_request()
3358 _version = reader.read("!B")[0]
3359 assert(_version == 4)
3360 _type = reader.read("!B")[0]
3361 assert(_type == 4)
3362 _length = reader.read("!H")[0]
3363 orig_reader = reader
3364 reader = orig_reader.slice(_length - (2 + 2))
3365 obj.xid = reader.read("!L")[0]
3366 _experimenter = reader.read("!L")[0]
3367 assert(_experimenter == 6035143)
3368 _subtype = reader.read("!L")[0]
3369 assert(_subtype == 48)
3370 obj.table_id = reader.read("!H")[0]
3371 reader.skip(2)
3372 obj.checksum = util.unpack_checksum_128(reader)
3373 obj.checksum_mask = util.unpack_checksum_128(reader)
3374 return obj
3375
3376 def __eq__(self, other):
3377 if type(self) != type(other): return False
3378 if self.xid != other.xid: return False
3379 if self.table_id != other.table_id: return False
3380 if self.checksum != other.checksum: return False
3381 if self.checksum_mask != other.checksum_mask: return False
3382 return True
3383
3384 def pretty_print(self, q):
3385 q.text("bsn_gentable_clear_request {")
3386 with q.group():
3387 with q.indent(2):
3388 q.breakable()
3389 q.text("xid = ");
3390 if self.xid != None:
3391 q.text("%#x" % self.xid)
3392 else:
3393 q.text('None')
3394 q.text(","); q.breakable()
3395 q.text("table_id = ");
3396 q.text("%#x" % self.table_id)
3397 q.text(","); q.breakable()
3398 q.text("checksum = ");
3399 q.pp(self.checksum)
3400 q.text(","); q.breakable()
3401 q.text("checksum_mask = ");
3402 q.pp(self.checksum_mask)
3403 q.breakable()
3404 q.text('}')
3405
3406bsn_header.subtypes[48] = bsn_gentable_clear_request
3407
3408class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3409 version = 4
3410 type = 19
3411 stats_type = 65535
3412 experimenter = 6035143
3413 subtype = 4
3414
3415 def __init__(self, xid=None, flags=None, entries=None):
3416 if xid != None:
3417 self.xid = xid
3418 else:
3419 self.xid = None
3420 if flags != None:
3421 self.flags = flags
3422 else:
3423 self.flags = 0
3424 if entries != None:
3425 self.entries = entries
3426 else:
3427 self.entries = []
3428 return
3429
3430 def pack(self):
3431 packed = []
3432 packed.append(struct.pack("!B", self.version))
3433 packed.append(struct.pack("!B", self.type))
3434 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3435 packed.append(struct.pack("!L", self.xid))
3436 packed.append(struct.pack("!H", self.stats_type))
3437 packed.append(struct.pack("!H", self.flags))
3438 packed.append('\x00' * 4)
3439 packed.append(struct.pack("!L", self.experimenter))
3440 packed.append(struct.pack("!L", self.subtype))
3441 packed.append(loxi.generic_util.pack_list(self.entries))
3442 length = sum([len(x) for x in packed])
3443 packed[2] = struct.pack("!H", length)
3444 return ''.join(packed)
3445
3446 @staticmethod
3447 def unpack(reader):
3448 obj = bsn_gentable_desc_stats_reply()
3449 _version = reader.read("!B")[0]
3450 assert(_version == 4)
3451 _type = reader.read("!B")[0]
3452 assert(_type == 19)
3453 _length = reader.read("!H")[0]
3454 orig_reader = reader
3455 reader = orig_reader.slice(_length - (2 + 2))
3456 obj.xid = reader.read("!L")[0]
3457 _stats_type = reader.read("!H")[0]
3458 assert(_stats_type == 65535)
3459 obj.flags = reader.read("!H")[0]
3460 reader.skip(4)
3461 _experimenter = reader.read("!L")[0]
3462 assert(_experimenter == 6035143)
3463 _subtype = reader.read("!L")[0]
3464 assert(_subtype == 4)
3465 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3466 return obj
3467
3468 def __eq__(self, other):
3469 if type(self) != type(other): return False
3470 if self.xid != other.xid: return False
3471 if self.flags != other.flags: return False
3472 if self.entries != other.entries: return False
3473 return True
3474
3475 def pretty_print(self, q):
3476 q.text("bsn_gentable_desc_stats_reply {")
3477 with q.group():
3478 with q.indent(2):
3479 q.breakable()
3480 q.text("xid = ");
3481 if self.xid != None:
3482 q.text("%#x" % self.xid)
3483 else:
3484 q.text('None')
3485 q.text(","); q.breakable()
3486 q.text("flags = ");
3487 q.text("%#x" % self.flags)
3488 q.text(","); q.breakable()
3489 q.text("entries = ");
3490 q.pp(self.entries)
3491 q.breakable()
3492 q.text('}')
3493
3494bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
3495
3496class bsn_gentable_desc_stats_request(bsn_stats_request):
3497 version = 4
3498 type = 18
3499 stats_type = 65535
3500 experimenter = 6035143
3501 subtype = 4
3502
3503 def __init__(self, xid=None, flags=None):
3504 if xid != None:
3505 self.xid = xid
3506 else:
3507 self.xid = None
3508 if flags != None:
3509 self.flags = flags
3510 else:
3511 self.flags = 0
3512 return
3513
3514 def pack(self):
3515 packed = []
3516 packed.append(struct.pack("!B", self.version))
3517 packed.append(struct.pack("!B", self.type))
3518 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3519 packed.append(struct.pack("!L", self.xid))
3520 packed.append(struct.pack("!H", self.stats_type))
3521 packed.append(struct.pack("!H", self.flags))
3522 packed.append('\x00' * 4)
3523 packed.append(struct.pack("!L", self.experimenter))
3524 packed.append(struct.pack("!L", self.subtype))
3525 length = sum([len(x) for x in packed])
3526 packed[2] = struct.pack("!H", length)
3527 return ''.join(packed)
3528
3529 @staticmethod
3530 def unpack(reader):
3531 obj = bsn_gentable_desc_stats_request()
3532 _version = reader.read("!B")[0]
3533 assert(_version == 4)
3534 _type = reader.read("!B")[0]
3535 assert(_type == 18)
3536 _length = reader.read("!H")[0]
3537 orig_reader = reader
3538 reader = orig_reader.slice(_length - (2 + 2))
3539 obj.xid = reader.read("!L")[0]
3540 _stats_type = reader.read("!H")[0]
3541 assert(_stats_type == 65535)
3542 obj.flags = reader.read("!H")[0]
3543 reader.skip(4)
3544 _experimenter = reader.read("!L")[0]
3545 assert(_experimenter == 6035143)
3546 _subtype = reader.read("!L")[0]
3547 assert(_subtype == 4)
3548 return obj
3549
3550 def __eq__(self, other):
3551 if type(self) != type(other): return False
3552 if self.xid != other.xid: return False
3553 if self.flags != other.flags: return False
3554 return True
3555
3556 def pretty_print(self, q):
3557 q.text("bsn_gentable_desc_stats_request {")
3558 with q.group():
3559 with q.indent(2):
3560 q.breakable()
3561 q.text("xid = ");
3562 if self.xid != None:
3563 q.text("%#x" % self.xid)
3564 else:
3565 q.text('None')
3566 q.text(","); q.breakable()
3567 q.text("flags = ");
3568 q.text("%#x" % self.flags)
3569 q.breakable()
3570 q.text('}')
3571
3572bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
3573
3574class bsn_gentable_entry_add(bsn_header):
3575 version = 4
3576 type = 4
3577 experimenter = 6035143
3578 subtype = 46
3579
3580 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
3581 if xid != None:
3582 self.xid = xid
3583 else:
3584 self.xid = None
3585 if table_id != None:
3586 self.table_id = table_id
3587 else:
3588 self.table_id = 0
3589 if checksum != None:
3590 self.checksum = checksum
3591 else:
3592 self.checksum = 0
3593 if key != None:
3594 self.key = key
3595 else:
3596 self.key = []
3597 if value != None:
3598 self.value = value
3599 else:
3600 self.value = []
3601 return
3602
3603 def pack(self):
3604 packed = []
3605 packed.append(struct.pack("!B", self.version))
3606 packed.append(struct.pack("!B", self.type))
3607 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3608 packed.append(struct.pack("!L", self.xid))
3609 packed.append(struct.pack("!L", self.experimenter))
3610 packed.append(struct.pack("!L", self.subtype))
3611 packed.append(struct.pack("!H", self.table_id))
3612 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
3613 packed.append(util.pack_checksum_128(self.checksum))
3614 packed.append(loxi.generic_util.pack_list(self.key))
3615 packed[7] = struct.pack("!H", len(packed[-1]))
3616 packed.append(loxi.generic_util.pack_list(self.value))
3617 length = sum([len(x) for x in packed])
3618 packed[2] = struct.pack("!H", length)
3619 return ''.join(packed)
3620
3621 @staticmethod
3622 def unpack(reader):
3623 obj = bsn_gentable_entry_add()
3624 _version = reader.read("!B")[0]
3625 assert(_version == 4)
3626 _type = reader.read("!B")[0]
3627 assert(_type == 4)
3628 _length = reader.read("!H")[0]
3629 orig_reader = reader
3630 reader = orig_reader.slice(_length - (2 + 2))
3631 obj.xid = reader.read("!L")[0]
3632 _experimenter = reader.read("!L")[0]
3633 assert(_experimenter == 6035143)
3634 _subtype = reader.read("!L")[0]
3635 assert(_subtype == 46)
3636 obj.table_id = reader.read("!H")[0]
3637 _key_length = reader.read("!H")[0]
3638 obj.checksum = util.unpack_checksum_128(reader)
3639 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
3640 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3641 return obj
3642
3643 def __eq__(self, other):
3644 if type(self) != type(other): return False
3645 if self.xid != other.xid: return False
3646 if self.table_id != other.table_id: return False
3647 if self.checksum != other.checksum: return False
3648 if self.key != other.key: return False
3649 if self.value != other.value: return False
3650 return True
3651
3652 def pretty_print(self, q):
3653 q.text("bsn_gentable_entry_add {")
3654 with q.group():
3655 with q.indent(2):
3656 q.breakable()
3657 q.text("xid = ");
3658 if self.xid != None:
3659 q.text("%#x" % self.xid)
3660 else:
3661 q.text('None')
3662 q.text(","); q.breakable()
3663 q.text("table_id = ");
3664 q.text("%#x" % self.table_id)
3665 q.text(","); q.breakable()
3666 q.text("checksum = ");
3667 q.pp(self.checksum)
3668 q.text(","); q.breakable()
3669 q.text("key = ");
3670 q.pp(self.key)
3671 q.text(","); q.breakable()
3672 q.text("value = ");
3673 q.pp(self.value)
3674 q.breakable()
3675 q.text('}')
3676
3677bsn_header.subtypes[46] = bsn_gentable_entry_add
3678
3679class bsn_gentable_entry_delete(bsn_header):
3680 version = 4
3681 type = 4
3682 experimenter = 6035143
3683 subtype = 47
3684
3685 def __init__(self, xid=None, table_id=None, key=None):
3686 if xid != None:
3687 self.xid = xid
3688 else:
3689 self.xid = None
3690 if table_id != None:
3691 self.table_id = table_id
3692 else:
3693 self.table_id = 0
3694 if key != None:
3695 self.key = key
3696 else:
3697 self.key = []
3698 return
3699
3700 def pack(self):
3701 packed = []
3702 packed.append(struct.pack("!B", self.version))
3703 packed.append(struct.pack("!B", self.type))
3704 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3705 packed.append(struct.pack("!L", self.xid))
3706 packed.append(struct.pack("!L", self.experimenter))
3707 packed.append(struct.pack("!L", self.subtype))
3708 packed.append(struct.pack("!H", self.table_id))
3709 packed.append(loxi.generic_util.pack_list(self.key))
3710 length = sum([len(x) for x in packed])
3711 packed[2] = struct.pack("!H", length)
3712 return ''.join(packed)
3713
3714 @staticmethod
3715 def unpack(reader):
3716 obj = bsn_gentable_entry_delete()
3717 _version = reader.read("!B")[0]
3718 assert(_version == 4)
3719 _type = reader.read("!B")[0]
3720 assert(_type == 4)
3721 _length = reader.read("!H")[0]
3722 orig_reader = reader
3723 reader = orig_reader.slice(_length - (2 + 2))
3724 obj.xid = reader.read("!L")[0]
3725 _experimenter = reader.read("!L")[0]
3726 assert(_experimenter == 6035143)
3727 _subtype = reader.read("!L")[0]
3728 assert(_subtype == 47)
3729 obj.table_id = reader.read("!H")[0]
3730 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3731 return obj
3732
3733 def __eq__(self, other):
3734 if type(self) != type(other): return False
3735 if self.xid != other.xid: return False
3736 if self.table_id != other.table_id: return False
3737 if self.key != other.key: return False
3738 return True
3739
3740 def pretty_print(self, q):
3741 q.text("bsn_gentable_entry_delete {")
3742 with q.group():
3743 with q.indent(2):
3744 q.breakable()
3745 q.text("xid = ");
3746 if self.xid != None:
3747 q.text("%#x" % self.xid)
3748 else:
3749 q.text('None')
3750 q.text(","); q.breakable()
3751 q.text("table_id = ");
3752 q.text("%#x" % self.table_id)
3753 q.text(","); q.breakable()
3754 q.text("key = ");
3755 q.pp(self.key)
3756 q.breakable()
3757 q.text('}')
3758
3759bsn_header.subtypes[47] = bsn_gentable_entry_delete
3760
3761class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
3762 version = 4
3763 type = 19
3764 stats_type = 65535
3765 experimenter = 6035143
3766 subtype = 2
3767
3768 def __init__(self, xid=None, flags=None, entries=None):
3769 if xid != None:
3770 self.xid = xid
3771 else:
3772 self.xid = None
3773 if flags != None:
3774 self.flags = flags
3775 else:
3776 self.flags = 0
3777 if entries != None:
3778 self.entries = entries
3779 else:
3780 self.entries = []
3781 return
3782
3783 def pack(self):
3784 packed = []
3785 packed.append(struct.pack("!B", self.version))
3786 packed.append(struct.pack("!B", self.type))
3787 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3788 packed.append(struct.pack("!L", self.xid))
3789 packed.append(struct.pack("!H", self.stats_type))
3790 packed.append(struct.pack("!H", self.flags))
3791 packed.append('\x00' * 4)
3792 packed.append(struct.pack("!L", self.experimenter))
3793 packed.append(struct.pack("!L", self.subtype))
3794 packed.append(loxi.generic_util.pack_list(self.entries))
3795 length = sum([len(x) for x in packed])
3796 packed[2] = struct.pack("!H", length)
3797 return ''.join(packed)
3798
3799 @staticmethod
3800 def unpack(reader):
3801 obj = bsn_gentable_entry_desc_stats_reply()
3802 _version = reader.read("!B")[0]
3803 assert(_version == 4)
3804 _type = reader.read("!B")[0]
3805 assert(_type == 19)
3806 _length = reader.read("!H")[0]
3807 orig_reader = reader
3808 reader = orig_reader.slice(_length - (2 + 2))
3809 obj.xid = reader.read("!L")[0]
3810 _stats_type = reader.read("!H")[0]
3811 assert(_stats_type == 65535)
3812 obj.flags = reader.read("!H")[0]
3813 reader.skip(4)
3814 _experimenter = reader.read("!L")[0]
3815 assert(_experimenter == 6035143)
3816 _subtype = reader.read("!L")[0]
3817 assert(_subtype == 2)
3818 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
3819 return obj
3820
3821 def __eq__(self, other):
3822 if type(self) != type(other): return False
3823 if self.xid != other.xid: return False
3824 if self.flags != other.flags: return False
3825 if self.entries != other.entries: return False
3826 return True
3827
3828 def pretty_print(self, q):
3829 q.text("bsn_gentable_entry_desc_stats_reply {")
3830 with q.group():
3831 with q.indent(2):
3832 q.breakable()
3833 q.text("xid = ");
3834 if self.xid != None:
3835 q.text("%#x" % self.xid)
3836 else:
3837 q.text('None')
3838 q.text(","); q.breakable()
3839 q.text("flags = ");
3840 q.text("%#x" % self.flags)
3841 q.text(","); q.breakable()
3842 q.text("entries = ");
3843 q.pp(self.entries)
3844 q.breakable()
3845 q.text('}')
3846
3847bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
3848
3849class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
3850 version = 4
3851 type = 18
3852 stats_type = 65535
3853 experimenter = 6035143
3854 subtype = 2
3855
3856 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
3857 if xid != None:
3858 self.xid = xid
3859 else:
3860 self.xid = None
3861 if flags != None:
3862 self.flags = flags
3863 else:
3864 self.flags = 0
3865 if table_id != None:
3866 self.table_id = table_id
3867 else:
3868 self.table_id = 0
3869 if checksum != None:
3870 self.checksum = checksum
3871 else:
3872 self.checksum = 0
3873 if checksum_mask != None:
3874 self.checksum_mask = checksum_mask
3875 else:
3876 self.checksum_mask = 0
3877 return
3878
3879 def pack(self):
3880 packed = []
3881 packed.append(struct.pack("!B", self.version))
3882 packed.append(struct.pack("!B", self.type))
3883 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3884 packed.append(struct.pack("!L", self.xid))
3885 packed.append(struct.pack("!H", self.stats_type))
3886 packed.append(struct.pack("!H", self.flags))
3887 packed.append('\x00' * 4)
3888 packed.append(struct.pack("!L", self.experimenter))
3889 packed.append(struct.pack("!L", self.subtype))
3890 packed.append(struct.pack("!H", self.table_id))
3891 packed.append('\x00' * 2)
3892 packed.append(util.pack_checksum_128(self.checksum))
3893 packed.append(util.pack_checksum_128(self.checksum_mask))
3894 length = sum([len(x) for x in packed])
3895 packed[2] = struct.pack("!H", length)
3896 return ''.join(packed)
3897
3898 @staticmethod
3899 def unpack(reader):
3900 obj = bsn_gentable_entry_desc_stats_request()
3901 _version = reader.read("!B")[0]
3902 assert(_version == 4)
3903 _type = reader.read("!B")[0]
3904 assert(_type == 18)
3905 _length = reader.read("!H")[0]
3906 orig_reader = reader
3907 reader = orig_reader.slice(_length - (2 + 2))
3908 obj.xid = reader.read("!L")[0]
3909 _stats_type = reader.read("!H")[0]
3910 assert(_stats_type == 65535)
3911 obj.flags = reader.read("!H")[0]
3912 reader.skip(4)
3913 _experimenter = reader.read("!L")[0]
3914 assert(_experimenter == 6035143)
3915 _subtype = reader.read("!L")[0]
3916 assert(_subtype == 2)
3917 obj.table_id = reader.read("!H")[0]
3918 reader.skip(2)
3919 obj.checksum = util.unpack_checksum_128(reader)
3920 obj.checksum_mask = util.unpack_checksum_128(reader)
3921 return obj
3922
3923 def __eq__(self, other):
3924 if type(self) != type(other): return False
3925 if self.xid != other.xid: return False
3926 if self.flags != other.flags: return False
3927 if self.table_id != other.table_id: return False
3928 if self.checksum != other.checksum: return False
3929 if self.checksum_mask != other.checksum_mask: return False
3930 return True
3931
3932 def pretty_print(self, q):
3933 q.text("bsn_gentable_entry_desc_stats_request {")
3934 with q.group():
3935 with q.indent(2):
3936 q.breakable()
3937 q.text("xid = ");
3938 if self.xid != None:
3939 q.text("%#x" % self.xid)
3940 else:
3941 q.text('None')
3942 q.text(","); q.breakable()
3943 q.text("flags = ");
3944 q.text("%#x" % self.flags)
3945 q.text(","); q.breakable()
3946 q.text("table_id = ");
3947 q.text("%#x" % self.table_id)
3948 q.text(","); q.breakable()
3949 q.text("checksum = ");
3950 q.pp(self.checksum)
3951 q.text(","); q.breakable()
3952 q.text("checksum_mask = ");
3953 q.pp(self.checksum_mask)
3954 q.breakable()
3955 q.text('}')
3956
3957bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
3958
3959class bsn_gentable_entry_stats_reply(bsn_stats_reply):
3960 version = 4
3961 type = 19
3962 stats_type = 65535
3963 experimenter = 6035143
3964 subtype = 3
3965
3966 def __init__(self, xid=None, flags=None, entries=None):
3967 if xid != None:
3968 self.xid = xid
3969 else:
3970 self.xid = None
3971 if flags != None:
3972 self.flags = flags
3973 else:
3974 self.flags = 0
3975 if entries != None:
3976 self.entries = entries
3977 else:
3978 self.entries = []
3979 return
3980
3981 def pack(self):
3982 packed = []
3983 packed.append(struct.pack("!B", self.version))
3984 packed.append(struct.pack("!B", self.type))
3985 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3986 packed.append(struct.pack("!L", self.xid))
3987 packed.append(struct.pack("!H", self.stats_type))
3988 packed.append(struct.pack("!H", self.flags))
3989 packed.append('\x00' * 4)
3990 packed.append(struct.pack("!L", self.experimenter))
3991 packed.append(struct.pack("!L", self.subtype))
3992 packed.append(loxi.generic_util.pack_list(self.entries))
3993 length = sum([len(x) for x in packed])
3994 packed[2] = struct.pack("!H", length)
3995 return ''.join(packed)
3996
3997 @staticmethod
3998 def unpack(reader):
3999 obj = bsn_gentable_entry_stats_reply()
4000 _version = reader.read("!B")[0]
4001 assert(_version == 4)
4002 _type = reader.read("!B")[0]
4003 assert(_type == 19)
4004 _length = reader.read("!H")[0]
4005 orig_reader = reader
4006 reader = orig_reader.slice(_length - (2 + 2))
4007 obj.xid = reader.read("!L")[0]
4008 _stats_type = reader.read("!H")[0]
4009 assert(_stats_type == 65535)
4010 obj.flags = reader.read("!H")[0]
4011 reader.skip(4)
4012 _experimenter = reader.read("!L")[0]
4013 assert(_experimenter == 6035143)
4014 _subtype = reader.read("!L")[0]
4015 assert(_subtype == 3)
4016 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
4017 return obj
4018
4019 def __eq__(self, other):
4020 if type(self) != type(other): return False
4021 if self.xid != other.xid: return False
4022 if self.flags != other.flags: return False
4023 if self.entries != other.entries: return False
4024 return True
4025
4026 def pretty_print(self, q):
4027 q.text("bsn_gentable_entry_stats_reply {")
4028 with q.group():
4029 with q.indent(2):
4030 q.breakable()
4031 q.text("xid = ");
4032 if self.xid != None:
4033 q.text("%#x" % self.xid)
4034 else:
4035 q.text('None')
4036 q.text(","); q.breakable()
4037 q.text("flags = ");
4038 q.text("%#x" % self.flags)
4039 q.text(","); q.breakable()
4040 q.text("entries = ");
4041 q.pp(self.entries)
4042 q.breakable()
4043 q.text('}')
4044
4045bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4046
4047class bsn_gentable_entry_stats_request(bsn_stats_request):
4048 version = 4
4049 type = 18
4050 stats_type = 65535
4051 experimenter = 6035143
4052 subtype = 3
4053
4054 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4055 if xid != None:
4056 self.xid = xid
4057 else:
4058 self.xid = None
4059 if flags != None:
4060 self.flags = flags
4061 else:
4062 self.flags = 0
4063 if table_id != None:
4064 self.table_id = table_id
4065 else:
4066 self.table_id = 0
4067 if checksum != None:
4068 self.checksum = checksum
4069 else:
4070 self.checksum = 0
4071 if checksum_mask != None:
4072 self.checksum_mask = checksum_mask
4073 else:
4074 self.checksum_mask = 0
4075 return
4076
4077 def pack(self):
4078 packed = []
4079 packed.append(struct.pack("!B", self.version))
4080 packed.append(struct.pack("!B", self.type))
4081 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4082 packed.append(struct.pack("!L", self.xid))
4083 packed.append(struct.pack("!H", self.stats_type))
4084 packed.append(struct.pack("!H", self.flags))
4085 packed.append('\x00' * 4)
4086 packed.append(struct.pack("!L", self.experimenter))
4087 packed.append(struct.pack("!L", self.subtype))
4088 packed.append(struct.pack("!H", self.table_id))
4089 packed.append('\x00' * 2)
4090 packed.append(util.pack_checksum_128(self.checksum))
4091 packed.append(util.pack_checksum_128(self.checksum_mask))
4092 length = sum([len(x) for x in packed])
4093 packed[2] = struct.pack("!H", length)
4094 return ''.join(packed)
4095
4096 @staticmethod
4097 def unpack(reader):
4098 obj = bsn_gentable_entry_stats_request()
4099 _version = reader.read("!B")[0]
4100 assert(_version == 4)
4101 _type = reader.read("!B")[0]
4102 assert(_type == 18)
4103 _length = reader.read("!H")[0]
4104 orig_reader = reader
4105 reader = orig_reader.slice(_length - (2 + 2))
4106 obj.xid = reader.read("!L")[0]
4107 _stats_type = reader.read("!H")[0]
4108 assert(_stats_type == 65535)
4109 obj.flags = reader.read("!H")[0]
4110 reader.skip(4)
4111 _experimenter = reader.read("!L")[0]
4112 assert(_experimenter == 6035143)
4113 _subtype = reader.read("!L")[0]
4114 assert(_subtype == 3)
4115 obj.table_id = reader.read("!H")[0]
4116 reader.skip(2)
4117 obj.checksum = util.unpack_checksum_128(reader)
4118 obj.checksum_mask = util.unpack_checksum_128(reader)
4119 return obj
4120
4121 def __eq__(self, other):
4122 if type(self) != type(other): return False
4123 if self.xid != other.xid: return False
4124 if self.flags != other.flags: return False
4125 if self.table_id != other.table_id: return False
4126 if self.checksum != other.checksum: return False
4127 if self.checksum_mask != other.checksum_mask: return False
4128 return True
4129
4130 def pretty_print(self, q):
4131 q.text("bsn_gentable_entry_stats_request {")
4132 with q.group():
4133 with q.indent(2):
4134 q.breakable()
4135 q.text("xid = ");
4136 if self.xid != None:
4137 q.text("%#x" % self.xid)
4138 else:
4139 q.text('None')
4140 q.text(","); q.breakable()
4141 q.text("flags = ");
4142 q.text("%#x" % self.flags)
4143 q.text(","); q.breakable()
4144 q.text("table_id = ");
4145 q.text("%#x" % self.table_id)
4146 q.text(","); q.breakable()
4147 q.text("checksum = ");
4148 q.pp(self.checksum)
4149 q.text(","); q.breakable()
4150 q.text("checksum_mask = ");
4151 q.pp(self.checksum_mask)
4152 q.breakable()
4153 q.text('}')
4154
4155bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4156
4157class bsn_gentable_set_buckets_size(bsn_header):
4158 version = 4
4159 type = 4
4160 experimenter = 6035143
4161 subtype = 50
4162
4163 def __init__(self, xid=None, table_id=None, buckets_size=None):
4164 if xid != None:
4165 self.xid = xid
4166 else:
4167 self.xid = None
4168 if table_id != None:
4169 self.table_id = table_id
4170 else:
4171 self.table_id = 0
4172 if buckets_size != None:
4173 self.buckets_size = buckets_size
4174 else:
4175 self.buckets_size = 0
4176 return
4177
4178 def pack(self):
4179 packed = []
4180 packed.append(struct.pack("!B", self.version))
4181 packed.append(struct.pack("!B", self.type))
4182 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4183 packed.append(struct.pack("!L", self.xid))
4184 packed.append(struct.pack("!L", self.experimenter))
4185 packed.append(struct.pack("!L", self.subtype))
4186 packed.append(struct.pack("!H", self.table_id))
4187 packed.append('\x00' * 2)
4188 packed.append(struct.pack("!L", self.buckets_size))
4189 length = sum([len(x) for x in packed])
4190 packed[2] = struct.pack("!H", length)
4191 return ''.join(packed)
4192
4193 @staticmethod
4194 def unpack(reader):
4195 obj = bsn_gentable_set_buckets_size()
4196 _version = reader.read("!B")[0]
4197 assert(_version == 4)
4198 _type = reader.read("!B")[0]
4199 assert(_type == 4)
4200 _length = reader.read("!H")[0]
4201 orig_reader = reader
4202 reader = orig_reader.slice(_length - (2 + 2))
4203 obj.xid = reader.read("!L")[0]
4204 _experimenter = reader.read("!L")[0]
4205 assert(_experimenter == 6035143)
4206 _subtype = reader.read("!L")[0]
4207 assert(_subtype == 50)
4208 obj.table_id = reader.read("!H")[0]
4209 reader.skip(2)
4210 obj.buckets_size = reader.read("!L")[0]
4211 return obj
4212
4213 def __eq__(self, other):
4214 if type(self) != type(other): return False
4215 if self.xid != other.xid: return False
4216 if self.table_id != other.table_id: return False
4217 if self.buckets_size != other.buckets_size: return False
4218 return True
4219
4220 def pretty_print(self, q):
4221 q.text("bsn_gentable_set_buckets_size {")
4222 with q.group():
4223 with q.indent(2):
4224 q.breakable()
4225 q.text("xid = ");
4226 if self.xid != None:
4227 q.text("%#x" % self.xid)
4228 else:
4229 q.text('None')
4230 q.text(","); q.breakable()
4231 q.text("table_id = ");
4232 q.text("%#x" % self.table_id)
4233 q.text(","); q.breakable()
4234 q.text("buckets_size = ");
4235 q.text("%#x" % self.buckets_size)
4236 q.breakable()
4237 q.text('}')
4238
4239bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4240
4241class bsn_gentable_stats_reply(bsn_stats_reply):
4242 version = 4
4243 type = 19
4244 stats_type = 65535
4245 experimenter = 6035143
4246 subtype = 7
4247
4248 def __init__(self, xid=None, flags=None, entries=None):
4249 if xid != None:
4250 self.xid = xid
4251 else:
4252 self.xid = None
4253 if flags != None:
4254 self.flags = flags
4255 else:
4256 self.flags = 0
4257 if entries != None:
4258 self.entries = entries
4259 else:
4260 self.entries = []
4261 return
4262
4263 def pack(self):
4264 packed = []
4265 packed.append(struct.pack("!B", self.version))
4266 packed.append(struct.pack("!B", self.type))
4267 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4268 packed.append(struct.pack("!L", self.xid))
4269 packed.append(struct.pack("!H", self.stats_type))
4270 packed.append(struct.pack("!H", self.flags))
4271 packed.append('\x00' * 4)
4272 packed.append(struct.pack("!L", self.experimenter))
4273 packed.append(struct.pack("!L", self.subtype))
4274 packed.append(loxi.generic_util.pack_list(self.entries))
4275 length = sum([len(x) for x in packed])
4276 packed[2] = struct.pack("!H", length)
4277 return ''.join(packed)
4278
4279 @staticmethod
4280 def unpack(reader):
4281 obj = bsn_gentable_stats_reply()
4282 _version = reader.read("!B")[0]
4283 assert(_version == 4)
4284 _type = reader.read("!B")[0]
4285 assert(_type == 19)
4286 _length = reader.read("!H")[0]
4287 orig_reader = reader
4288 reader = orig_reader.slice(_length - (2 + 2))
4289 obj.xid = reader.read("!L")[0]
4290 _stats_type = reader.read("!H")[0]
4291 assert(_stats_type == 65535)
4292 obj.flags = reader.read("!H")[0]
4293 reader.skip(4)
4294 _experimenter = reader.read("!L")[0]
4295 assert(_experimenter == 6035143)
4296 _subtype = reader.read("!L")[0]
4297 assert(_subtype == 7)
4298 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4299 return obj
4300
4301 def __eq__(self, other):
4302 if type(self) != type(other): return False
4303 if self.xid != other.xid: return False
4304 if self.flags != other.flags: return False
4305 if self.entries != other.entries: return False
4306 return True
4307
4308 def pretty_print(self, q):
4309 q.text("bsn_gentable_stats_reply {")
4310 with q.group():
4311 with q.indent(2):
4312 q.breakable()
4313 q.text("xid = ");
4314 if self.xid != None:
4315 q.text("%#x" % self.xid)
4316 else:
4317 q.text('None')
4318 q.text(","); q.breakable()
4319 q.text("flags = ");
4320 q.text("%#x" % self.flags)
4321 q.text(","); q.breakable()
4322 q.text("entries = ");
4323 q.pp(self.entries)
4324 q.breakable()
4325 q.text('}')
4326
4327bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4328
4329class bsn_gentable_stats_request(bsn_stats_request):
4330 version = 4
4331 type = 18
4332 stats_type = 65535
4333 experimenter = 6035143
4334 subtype = 7
4335
4336 def __init__(self, xid=None, flags=None):
4337 if xid != None:
4338 self.xid = xid
4339 else:
4340 self.xid = None
4341 if flags != None:
4342 self.flags = flags
4343 else:
4344 self.flags = 0
4345 return
4346
4347 def pack(self):
4348 packed = []
4349 packed.append(struct.pack("!B", self.version))
4350 packed.append(struct.pack("!B", self.type))
4351 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4352 packed.append(struct.pack("!L", self.xid))
4353 packed.append(struct.pack("!H", self.stats_type))
4354 packed.append(struct.pack("!H", self.flags))
4355 packed.append('\x00' * 4)
4356 packed.append(struct.pack("!L", self.experimenter))
4357 packed.append(struct.pack("!L", self.subtype))
4358 length = sum([len(x) for x in packed])
4359 packed[2] = struct.pack("!H", length)
4360 return ''.join(packed)
4361
4362 @staticmethod
4363 def unpack(reader):
4364 obj = bsn_gentable_stats_request()
4365 _version = reader.read("!B")[0]
4366 assert(_version == 4)
4367 _type = reader.read("!B")[0]
4368 assert(_type == 18)
4369 _length = reader.read("!H")[0]
4370 orig_reader = reader
4371 reader = orig_reader.slice(_length - (2 + 2))
4372 obj.xid = reader.read("!L")[0]
4373 _stats_type = reader.read("!H")[0]
4374 assert(_stats_type == 65535)
4375 obj.flags = reader.read("!H")[0]
4376 reader.skip(4)
4377 _experimenter = reader.read("!L")[0]
4378 assert(_experimenter == 6035143)
4379 _subtype = reader.read("!L")[0]
4380 assert(_subtype == 7)
4381 return obj
4382
4383 def __eq__(self, other):
4384 if type(self) != type(other): return False
4385 if self.xid != other.xid: return False
4386 if self.flags != other.flags: return False
4387 return True
4388
4389 def pretty_print(self, q):
4390 q.text("bsn_gentable_stats_request {")
4391 with q.group():
4392 with q.indent(2):
4393 q.breakable()
4394 q.text("xid = ");
4395 if self.xid != None:
4396 q.text("%#x" % self.xid)
4397 else:
4398 q.text('None')
4399 q.text(","); q.breakable()
4400 q.text("flags = ");
4401 q.text("%#x" % self.flags)
4402 q.breakable()
4403 q.text('}')
4404
4405bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4406
Rich Lane7dcdf022013-12-11 14:45:27 -08004407class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004408 version = 4
4409 type = 4
4410 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004411 subtype = 10
4412
4413 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004414 if xid != None:
4415 self.xid = xid
4416 else:
4417 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004418 if interfaces != None:
4419 self.interfaces = interfaces
4420 else:
4421 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004422 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004423
4424 def pack(self):
4425 packed = []
4426 packed.append(struct.pack("!B", self.version))
4427 packed.append(struct.pack("!B", self.type))
4428 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4429 packed.append(struct.pack("!L", self.xid))
4430 packed.append(struct.pack("!L", self.experimenter))
4431 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004432 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004433 length = sum([len(x) for x in packed])
4434 packed[2] = struct.pack("!H", length)
4435 return ''.join(packed)
4436
4437 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004438 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004439 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004440 _version = reader.read("!B")[0]
4441 assert(_version == 4)
4442 _type = reader.read("!B")[0]
4443 assert(_type == 4)
4444 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004445 orig_reader = reader
4446 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004447 obj.xid = reader.read("!L")[0]
4448 _experimenter = reader.read("!L")[0]
4449 assert(_experimenter == 6035143)
4450 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004451 assert(_subtype == 10)
4452 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4453 return obj
4454
4455 def __eq__(self, other):
4456 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004457 if self.xid != other.xid: return False
4458 if self.interfaces != other.interfaces: return False
4459 return True
4460
Rich Lanec2ee4b82013-04-24 17:12:38 -07004461 def pretty_print(self, q):
4462 q.text("bsn_get_interfaces_reply {")
4463 with q.group():
4464 with q.indent(2):
4465 q.breakable()
4466 q.text("xid = ");
4467 if self.xid != None:
4468 q.text("%#x" % self.xid)
4469 else:
4470 q.text('None')
4471 q.text(","); q.breakable()
4472 q.text("interfaces = ");
4473 q.pp(self.interfaces)
4474 q.breakable()
4475 q.text('}')
4476
Rich Lane7dcdf022013-12-11 14:45:27 -08004477bsn_header.subtypes[10] = bsn_get_interfaces_reply
4478
4479class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004480 version = 4
4481 type = 4
4482 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004483 subtype = 9
4484
4485 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004486 if xid != None:
4487 self.xid = xid
4488 else:
4489 self.xid = None
4490 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004491
4492 def pack(self):
4493 packed = []
4494 packed.append(struct.pack("!B", self.version))
4495 packed.append(struct.pack("!B", self.type))
4496 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4497 packed.append(struct.pack("!L", self.xid))
4498 packed.append(struct.pack("!L", self.experimenter))
4499 packed.append(struct.pack("!L", self.subtype))
4500 length = sum([len(x) for x in packed])
4501 packed[2] = struct.pack("!H", length)
4502 return ''.join(packed)
4503
4504 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004505 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004506 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004507 _version = reader.read("!B")[0]
4508 assert(_version == 4)
4509 _type = reader.read("!B")[0]
4510 assert(_type == 4)
4511 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004512 orig_reader = reader
4513 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004514 obj.xid = reader.read("!L")[0]
4515 _experimenter = reader.read("!L")[0]
4516 assert(_experimenter == 6035143)
4517 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004518 assert(_subtype == 9)
4519 return obj
4520
4521 def __eq__(self, other):
4522 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004523 if self.xid != other.xid: return False
4524 return True
4525
Rich Lanec2ee4b82013-04-24 17:12:38 -07004526 def pretty_print(self, q):
4527 q.text("bsn_get_interfaces_request {")
4528 with q.group():
4529 with q.indent(2):
4530 q.breakable()
4531 q.text("xid = ");
4532 if self.xid != None:
4533 q.text("%#x" % self.xid)
4534 else:
4535 q.text('None')
4536 q.breakable()
4537 q.text('}')
4538
Rich Lane7dcdf022013-12-11 14:45:27 -08004539bsn_header.subtypes[9] = bsn_get_interfaces_request
4540
4541class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004542 version = 4
4543 type = 4
4544 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004545 subtype = 5
4546
4547 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004548 if xid != None:
4549 self.xid = xid
4550 else:
4551 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004552 if report_mirror_ports != None:
4553 self.report_mirror_ports = report_mirror_ports
4554 else:
4555 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004556 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004557
4558 def pack(self):
4559 packed = []
4560 packed.append(struct.pack("!B", self.version))
4561 packed.append(struct.pack("!B", self.type))
4562 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4563 packed.append(struct.pack("!L", self.xid))
4564 packed.append(struct.pack("!L", self.experimenter))
4565 packed.append(struct.pack("!L", self.subtype))
4566 packed.append(struct.pack("!B", self.report_mirror_ports))
4567 packed.append('\x00' * 3)
4568 length = sum([len(x) for x in packed])
4569 packed[2] = struct.pack("!H", length)
4570 return ''.join(packed)
4571
4572 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004573 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004574 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004575 _version = reader.read("!B")[0]
4576 assert(_version == 4)
4577 _type = reader.read("!B")[0]
4578 assert(_type == 4)
4579 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004580 orig_reader = reader
4581 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004582 obj.xid = reader.read("!L")[0]
4583 _experimenter = reader.read("!L")[0]
4584 assert(_experimenter == 6035143)
4585 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004586 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07004587 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004588 reader.skip(3)
4589 return obj
4590
4591 def __eq__(self, other):
4592 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004593 if self.xid != other.xid: return False
4594 if self.report_mirror_ports != other.report_mirror_ports: return False
4595 return True
4596
Rich Lanec2ee4b82013-04-24 17:12:38 -07004597 def pretty_print(self, q):
4598 q.text("bsn_get_mirroring_reply {")
4599 with q.group():
4600 with q.indent(2):
4601 q.breakable()
4602 q.text("xid = ");
4603 if self.xid != None:
4604 q.text("%#x" % self.xid)
4605 else:
4606 q.text('None')
4607 q.text(","); q.breakable()
4608 q.text("report_mirror_ports = ");
4609 q.text("%#x" % self.report_mirror_ports)
4610 q.breakable()
4611 q.text('}')
4612
Rich Lane7dcdf022013-12-11 14:45:27 -08004613bsn_header.subtypes[5] = bsn_get_mirroring_reply
4614
4615class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004616 version = 4
4617 type = 4
4618 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004619 subtype = 4
4620
4621 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004622 if xid != None:
4623 self.xid = xid
4624 else:
4625 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004626 if report_mirror_ports != None:
4627 self.report_mirror_ports = report_mirror_ports
4628 else:
4629 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004630 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004631
4632 def pack(self):
4633 packed = []
4634 packed.append(struct.pack("!B", self.version))
4635 packed.append(struct.pack("!B", self.type))
4636 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4637 packed.append(struct.pack("!L", self.xid))
4638 packed.append(struct.pack("!L", self.experimenter))
4639 packed.append(struct.pack("!L", self.subtype))
4640 packed.append(struct.pack("!B", self.report_mirror_ports))
4641 packed.append('\x00' * 3)
4642 length = sum([len(x) for x in packed])
4643 packed[2] = struct.pack("!H", length)
4644 return ''.join(packed)
4645
4646 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004647 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004648 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004649 _version = reader.read("!B")[0]
4650 assert(_version == 4)
4651 _type = reader.read("!B")[0]
4652 assert(_type == 4)
4653 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004654 orig_reader = reader
4655 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004656 obj.xid = reader.read("!L")[0]
4657 _experimenter = reader.read("!L")[0]
4658 assert(_experimenter == 6035143)
4659 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004660 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004661 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004662 reader.skip(3)
4663 return obj
4664
4665 def __eq__(self, other):
4666 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004667 if self.xid != other.xid: return False
4668 if self.report_mirror_ports != other.report_mirror_ports: return False
4669 return True
4670
Rich Lanec2ee4b82013-04-24 17:12:38 -07004671 def pretty_print(self, q):
4672 q.text("bsn_get_mirroring_request {")
4673 with q.group():
4674 with q.indent(2):
4675 q.breakable()
4676 q.text("xid = ");
4677 if self.xid != None:
4678 q.text("%#x" % self.xid)
4679 else:
4680 q.text('None')
4681 q.text(","); q.breakable()
4682 q.text("report_mirror_ports = ");
4683 q.text("%#x" % self.report_mirror_ports)
4684 q.breakable()
4685 q.text('}')
4686
Rich Lane7dcdf022013-12-11 14:45:27 -08004687bsn_header.subtypes[4] = bsn_get_mirroring_request
4688
4689class bsn_get_switch_pipeline_reply(bsn_header):
4690 version = 4
4691 type = 4
4692 experimenter = 6035143
4693 subtype = 52
4694
4695 def __init__(self, xid=None, pipeline=None):
4696 if xid != None:
4697 self.xid = xid
4698 else:
4699 self.xid = None
4700 if pipeline != None:
4701 self.pipeline = pipeline
4702 else:
4703 self.pipeline = ""
4704 return
4705
4706 def pack(self):
4707 packed = []
4708 packed.append(struct.pack("!B", self.version))
4709 packed.append(struct.pack("!B", self.type))
4710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4711 packed.append(struct.pack("!L", self.xid))
4712 packed.append(struct.pack("!L", self.experimenter))
4713 packed.append(struct.pack("!L", self.subtype))
4714 packed.append(struct.pack("!256s", self.pipeline))
4715 length = sum([len(x) for x in packed])
4716 packed[2] = struct.pack("!H", length)
4717 return ''.join(packed)
4718
4719 @staticmethod
4720 def unpack(reader):
4721 obj = bsn_get_switch_pipeline_reply()
4722 _version = reader.read("!B")[0]
4723 assert(_version == 4)
4724 _type = reader.read("!B")[0]
4725 assert(_type == 4)
4726 _length = reader.read("!H")[0]
4727 orig_reader = reader
4728 reader = orig_reader.slice(_length - (2 + 2))
4729 obj.xid = reader.read("!L")[0]
4730 _experimenter = reader.read("!L")[0]
4731 assert(_experimenter == 6035143)
4732 _subtype = reader.read("!L")[0]
4733 assert(_subtype == 52)
4734 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
4735 return obj
4736
4737 def __eq__(self, other):
4738 if type(self) != type(other): return False
4739 if self.xid != other.xid: return False
4740 if self.pipeline != other.pipeline: return False
4741 return True
4742
4743 def pretty_print(self, q):
4744 q.text("bsn_get_switch_pipeline_reply {")
4745 with q.group():
4746 with q.indent(2):
4747 q.breakable()
4748 q.text("xid = ");
4749 if self.xid != None:
4750 q.text("%#x" % self.xid)
4751 else:
4752 q.text('None')
4753 q.text(","); q.breakable()
4754 q.text("pipeline = ");
4755 q.pp(self.pipeline)
4756 q.breakable()
4757 q.text('}')
4758
4759bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
4760
4761class bsn_get_switch_pipeline_request(bsn_header):
4762 version = 4
4763 type = 4
4764 experimenter = 6035143
4765 subtype = 51
4766
4767 def __init__(self, xid=None):
4768 if xid != None:
4769 self.xid = xid
4770 else:
4771 self.xid = None
4772 return
4773
4774 def pack(self):
4775 packed = []
4776 packed.append(struct.pack("!B", self.version))
4777 packed.append(struct.pack("!B", self.type))
4778 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4779 packed.append(struct.pack("!L", self.xid))
4780 packed.append(struct.pack("!L", self.experimenter))
4781 packed.append(struct.pack("!L", self.subtype))
4782 length = sum([len(x) for x in packed])
4783 packed[2] = struct.pack("!H", length)
4784 return ''.join(packed)
4785
4786 @staticmethod
4787 def unpack(reader):
4788 obj = bsn_get_switch_pipeline_request()
4789 _version = reader.read("!B")[0]
4790 assert(_version == 4)
4791 _type = reader.read("!B")[0]
4792 assert(_type == 4)
4793 _length = reader.read("!H")[0]
4794 orig_reader = reader
4795 reader = orig_reader.slice(_length - (2 + 2))
4796 obj.xid = reader.read("!L")[0]
4797 _experimenter = reader.read("!L")[0]
4798 assert(_experimenter == 6035143)
4799 _subtype = reader.read("!L")[0]
4800 assert(_subtype == 51)
4801 return obj
4802
4803 def __eq__(self, other):
4804 if type(self) != type(other): return False
4805 if self.xid != other.xid: return False
4806 return True
4807
4808 def pretty_print(self, q):
4809 q.text("bsn_get_switch_pipeline_request {")
4810 with q.group():
4811 with q.indent(2):
4812 q.breakable()
4813 q.text("xid = ");
4814 if self.xid != None:
4815 q.text("%#x" % self.xid)
4816 else:
4817 q.text('None')
4818 q.breakable()
4819 q.text('}')
4820
4821bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
4822
4823class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08004824 version = 4
4825 type = 4
4826 experimenter = 6035143
4827 subtype = 43
4828
4829 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 -08004830 if xid != None:
4831 self.xid = xid
4832 else:
4833 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004834 if convergence_status != None:
4835 self.convergence_status = convergence_status
4836 else:
4837 self.convergence_status = 0
4838 if port_no != None:
4839 self.port_no = port_no
4840 else:
4841 self.port_no = 0
4842 if actor_sys_priority != None:
4843 self.actor_sys_priority = actor_sys_priority
4844 else:
4845 self.actor_sys_priority = 0
4846 if actor_sys_mac != None:
4847 self.actor_sys_mac = actor_sys_mac
4848 else:
4849 self.actor_sys_mac = [0,0,0,0,0,0]
4850 if actor_port_priority != None:
4851 self.actor_port_priority = actor_port_priority
4852 else:
4853 self.actor_port_priority = 0
4854 if actor_port_num != None:
4855 self.actor_port_num = actor_port_num
4856 else:
4857 self.actor_port_num = 0
4858 if actor_key != None:
4859 self.actor_key = actor_key
4860 else:
4861 self.actor_key = 0
4862 if partner_sys_priority != None:
4863 self.partner_sys_priority = partner_sys_priority
4864 else:
4865 self.partner_sys_priority = 0
4866 if partner_sys_mac != None:
4867 self.partner_sys_mac = partner_sys_mac
4868 else:
4869 self.partner_sys_mac = [0,0,0,0,0,0]
4870 if partner_port_priority != None:
4871 self.partner_port_priority = partner_port_priority
4872 else:
4873 self.partner_port_priority = 0
4874 if partner_port_num != None:
4875 self.partner_port_num = partner_port_num
4876 else:
4877 self.partner_port_num = 0
4878 if partner_key != None:
4879 self.partner_key = partner_key
4880 else:
4881 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004882 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004883
4884 def pack(self):
4885 packed = []
4886 packed.append(struct.pack("!B", self.version))
4887 packed.append(struct.pack("!B", self.type))
4888 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4889 packed.append(struct.pack("!L", self.xid))
4890 packed.append(struct.pack("!L", self.experimenter))
4891 packed.append(struct.pack("!L", self.subtype))
4892 packed.append(struct.pack("!B", self.convergence_status))
4893 packed.append('\x00' * 3)
4894 packed.append(util.pack_port_no(self.port_no))
4895 packed.append(struct.pack("!H", self.actor_sys_priority))
4896 packed.append(struct.pack("!6B", *self.actor_sys_mac))
4897 packed.append(struct.pack("!H", self.actor_port_priority))
4898 packed.append(struct.pack("!H", self.actor_port_num))
4899 packed.append(struct.pack("!H", self.actor_key))
4900 packed.append(struct.pack("!H", self.partner_sys_priority))
4901 packed.append(struct.pack("!6B", *self.partner_sys_mac))
4902 packed.append(struct.pack("!H", self.partner_port_priority))
4903 packed.append(struct.pack("!H", self.partner_port_num))
4904 packed.append(struct.pack("!H", self.partner_key))
4905 length = sum([len(x) for x in packed])
4906 packed[2] = struct.pack("!H", length)
4907 return ''.join(packed)
4908
4909 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004910 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004911 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08004912 _version = reader.read("!B")[0]
4913 assert(_version == 4)
4914 _type = reader.read("!B")[0]
4915 assert(_type == 4)
4916 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004917 orig_reader = reader
4918 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004919 obj.xid = reader.read("!L")[0]
4920 _experimenter = reader.read("!L")[0]
4921 assert(_experimenter == 6035143)
4922 _subtype = reader.read("!L")[0]
4923 assert(_subtype == 43)
4924 obj.convergence_status = reader.read("!B")[0]
4925 reader.skip(3)
4926 obj.port_no = util.unpack_port_no(reader)
4927 obj.actor_sys_priority = reader.read("!H")[0]
4928 obj.actor_sys_mac = list(reader.read('!6B'))
4929 obj.actor_port_priority = reader.read("!H")[0]
4930 obj.actor_port_num = reader.read("!H")[0]
4931 obj.actor_key = reader.read("!H")[0]
4932 obj.partner_sys_priority = reader.read("!H")[0]
4933 obj.partner_sys_mac = list(reader.read('!6B'))
4934 obj.partner_port_priority = reader.read("!H")[0]
4935 obj.partner_port_num = reader.read("!H")[0]
4936 obj.partner_key = reader.read("!H")[0]
4937 return obj
4938
4939 def __eq__(self, other):
4940 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004941 if self.xid != other.xid: return False
4942 if self.convergence_status != other.convergence_status: return False
4943 if self.port_no != other.port_no: return False
4944 if self.actor_sys_priority != other.actor_sys_priority: return False
4945 if self.actor_sys_mac != other.actor_sys_mac: return False
4946 if self.actor_port_priority != other.actor_port_priority: return False
4947 if self.actor_port_num != other.actor_port_num: return False
4948 if self.actor_key != other.actor_key: return False
4949 if self.partner_sys_priority != other.partner_sys_priority: return False
4950 if self.partner_sys_mac != other.partner_sys_mac: return False
4951 if self.partner_port_priority != other.partner_port_priority: return False
4952 if self.partner_port_num != other.partner_port_num: return False
4953 if self.partner_key != other.partner_key: return False
4954 return True
4955
Rich Lane7b0f2012013-11-22 14:15:26 -08004956 def pretty_print(self, q):
4957 q.text("bsn_lacp_convergence_notif {")
4958 with q.group():
4959 with q.indent(2):
4960 q.breakable()
4961 q.text("xid = ");
4962 if self.xid != None:
4963 q.text("%#x" % self.xid)
4964 else:
4965 q.text('None')
4966 q.text(","); q.breakable()
4967 q.text("convergence_status = ");
4968 q.text("%#x" % self.convergence_status)
4969 q.text(","); q.breakable()
4970 q.text("port_no = ");
4971 q.text(util.pretty_port(self.port_no))
4972 q.text(","); q.breakable()
4973 q.text("actor_sys_priority = ");
4974 q.text("%#x" % self.actor_sys_priority)
4975 q.text(","); q.breakable()
4976 q.text("actor_sys_mac = ");
4977 q.text(util.pretty_mac(self.actor_sys_mac))
4978 q.text(","); q.breakable()
4979 q.text("actor_port_priority = ");
4980 q.text("%#x" % self.actor_port_priority)
4981 q.text(","); q.breakable()
4982 q.text("actor_port_num = ");
4983 q.text("%#x" % self.actor_port_num)
4984 q.text(","); q.breakable()
4985 q.text("actor_key = ");
4986 q.text("%#x" % self.actor_key)
4987 q.text(","); q.breakable()
4988 q.text("partner_sys_priority = ");
4989 q.text("%#x" % self.partner_sys_priority)
4990 q.text(","); q.breakable()
4991 q.text("partner_sys_mac = ");
4992 q.text(util.pretty_mac(self.partner_sys_mac))
4993 q.text(","); q.breakable()
4994 q.text("partner_port_priority = ");
4995 q.text("%#x" % self.partner_port_priority)
4996 q.text(","); q.breakable()
4997 q.text("partner_port_num = ");
4998 q.text("%#x" % self.partner_port_num)
4999 q.text(","); q.breakable()
5000 q.text("partner_key = ");
5001 q.text("%#x" % self.partner_key)
5002 q.breakable()
5003 q.text('}')
5004
Rich Lane7dcdf022013-12-11 14:45:27 -08005005bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5006
Rich Lane7dcdf022013-12-11 14:45:27 -08005007class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08005008 version = 4
5009 type = 19
5010 stats_type = 65535
5011 experimenter = 6035143
5012 subtype = 1
5013
5014 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005015 if xid != None:
5016 self.xid = xid
5017 else:
5018 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005019 if flags != None:
5020 self.flags = flags
5021 else:
5022 self.flags = 0
5023 if entries != None:
5024 self.entries = entries
5025 else:
5026 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005027 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005028
5029 def pack(self):
5030 packed = []
5031 packed.append(struct.pack("!B", self.version))
5032 packed.append(struct.pack("!B", self.type))
5033 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5034 packed.append(struct.pack("!L", self.xid))
5035 packed.append(struct.pack("!H", self.stats_type))
5036 packed.append(struct.pack("!H", self.flags))
5037 packed.append('\x00' * 4)
5038 packed.append(struct.pack("!L", self.experimenter))
5039 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08005040 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08005041 length = sum([len(x) for x in packed])
5042 packed[2] = struct.pack("!H", length)
5043 return ''.join(packed)
5044
5045 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005046 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005047 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005048 _version = reader.read("!B")[0]
5049 assert(_version == 4)
5050 _type = reader.read("!B")[0]
5051 assert(_type == 19)
5052 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005053 orig_reader = reader
5054 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005055 obj.xid = reader.read("!L")[0]
5056 _stats_type = reader.read("!H")[0]
5057 assert(_stats_type == 65535)
5058 obj.flags = reader.read("!H")[0]
5059 reader.skip(4)
5060 _experimenter = reader.read("!L")[0]
5061 assert(_experimenter == 6035143)
5062 _subtype = reader.read("!L")[0]
5063 assert(_subtype == 1)
5064 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
5065 return obj
5066
5067 def __eq__(self, other):
5068 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005069 if self.xid != other.xid: return False
5070 if self.flags != other.flags: return False
5071 if self.entries != other.entries: return False
5072 return True
5073
Rich Lane7b0f2012013-11-22 14:15:26 -08005074 def pretty_print(self, q):
5075 q.text("bsn_lacp_stats_reply {")
5076 with q.group():
5077 with q.indent(2):
5078 q.breakable()
5079 q.text("xid = ");
5080 if self.xid != None:
5081 q.text("%#x" % self.xid)
5082 else:
5083 q.text('None')
5084 q.text(","); q.breakable()
5085 q.text("flags = ");
5086 q.text("%#x" % self.flags)
5087 q.text(","); q.breakable()
5088 q.text("entries = ");
5089 q.pp(self.entries)
5090 q.breakable()
5091 q.text('}')
5092
Rich Lane7dcdf022013-12-11 14:45:27 -08005093bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5094
Rich Lane7dcdf022013-12-11 14:45:27 -08005095class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08005096 version = 4
5097 type = 18
5098 stats_type = 65535
5099 experimenter = 6035143
5100 subtype = 1
5101
5102 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005103 if xid != None:
5104 self.xid = xid
5105 else:
5106 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005107 if flags != None:
5108 self.flags = flags
5109 else:
5110 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005111 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005112
5113 def pack(self):
5114 packed = []
5115 packed.append(struct.pack("!B", self.version))
5116 packed.append(struct.pack("!B", self.type))
5117 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5118 packed.append(struct.pack("!L", self.xid))
5119 packed.append(struct.pack("!H", self.stats_type))
5120 packed.append(struct.pack("!H", self.flags))
5121 packed.append('\x00' * 4)
5122 packed.append(struct.pack("!L", self.experimenter))
5123 packed.append(struct.pack("!L", self.subtype))
5124 length = sum([len(x) for x in packed])
5125 packed[2] = struct.pack("!H", length)
5126 return ''.join(packed)
5127
5128 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005129 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005130 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005131 _version = reader.read("!B")[0]
5132 assert(_version == 4)
5133 _type = reader.read("!B")[0]
5134 assert(_type == 18)
5135 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005136 orig_reader = reader
5137 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005138 obj.xid = reader.read("!L")[0]
5139 _stats_type = reader.read("!H")[0]
5140 assert(_stats_type == 65535)
5141 obj.flags = reader.read("!H")[0]
5142 reader.skip(4)
5143 _experimenter = reader.read("!L")[0]
5144 assert(_experimenter == 6035143)
5145 _subtype = reader.read("!L")[0]
5146 assert(_subtype == 1)
5147 return obj
5148
5149 def __eq__(self, other):
5150 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005151 if self.xid != other.xid: return False
5152 if self.flags != other.flags: return False
5153 return True
5154
Rich Lane7b0f2012013-11-22 14:15:26 -08005155 def pretty_print(self, q):
5156 q.text("bsn_lacp_stats_request {")
5157 with q.group():
5158 with q.indent(2):
5159 q.breakable()
5160 q.text("xid = ");
5161 if self.xid != None:
5162 q.text("%#x" % self.xid)
5163 else:
5164 q.text('None')
5165 q.text(","); q.breakable()
5166 q.text("flags = ");
5167 q.text("%#x" % self.flags)
5168 q.breakable()
5169 q.text('}')
5170
Rich Lane7dcdf022013-12-11 14:45:27 -08005171bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5172
5173class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005174 version = 4
5175 type = 4
5176 experimenter = 6035143
5177 subtype = 34
5178
Rich Lane7b0f2012013-11-22 14:15:26 -08005179 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005180 if xid != None:
5181 self.xid = xid
5182 else:
5183 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005184 if status != None:
5185 self.status = status
5186 else:
5187 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005188 if port_no != None:
5189 self.port_no = port_no
5190 else:
5191 self.port_no = 0
5192 if slot_num != None:
5193 self.slot_num = slot_num
5194 else:
5195 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005196 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005197
5198 def pack(self):
5199 packed = []
5200 packed.append(struct.pack("!B", self.version))
5201 packed.append(struct.pack("!B", self.type))
5202 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5203 packed.append(struct.pack("!L", self.xid))
5204 packed.append(struct.pack("!L", self.experimenter))
5205 packed.append(struct.pack("!L", self.subtype))
5206 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005207 packed.append(util.pack_port_no(self.port_no))
5208 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005209 length = sum([len(x) for x in packed])
5210 packed[2] = struct.pack("!H", length)
5211 return ''.join(packed)
5212
5213 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005214 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005215 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005216 _version = reader.read("!B")[0]
5217 assert(_version == 4)
5218 _type = reader.read("!B")[0]
5219 assert(_type == 4)
5220 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005221 orig_reader = reader
5222 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005223 obj.xid = reader.read("!L")[0]
5224 _experimenter = reader.read("!L")[0]
5225 assert(_experimenter == 6035143)
5226 _subtype = reader.read("!L")[0]
5227 assert(_subtype == 34)
5228 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005229 obj.port_no = util.unpack_port_no(reader)
5230 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005231 return obj
5232
5233 def __eq__(self, other):
5234 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005235 if self.xid != other.xid: return False
5236 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005237 if self.port_no != other.port_no: return False
5238 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005239 return True
5240
Rich Lane6f4978c2013-10-20 21:33:52 -07005241 def pretty_print(self, q):
5242 q.text("bsn_pdu_rx_reply {")
5243 with q.group():
5244 with q.indent(2):
5245 q.breakable()
5246 q.text("xid = ");
5247 if self.xid != None:
5248 q.text("%#x" % self.xid)
5249 else:
5250 q.text('None')
5251 q.text(","); q.breakable()
5252 q.text("status = ");
5253 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005254 q.text(","); q.breakable()
5255 q.text("port_no = ");
5256 q.text(util.pretty_port(self.port_no))
5257 q.text(","); q.breakable()
5258 q.text("slot_num = ");
5259 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005260 q.breakable()
5261 q.text('}')
5262
Rich Lane7dcdf022013-12-11 14:45:27 -08005263bsn_header.subtypes[34] = bsn_pdu_rx_reply
5264
5265class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005266 version = 4
5267 type = 4
5268 experimenter = 6035143
5269 subtype = 33
5270
5271 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005272 if xid != None:
5273 self.xid = xid
5274 else:
5275 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005276 if timeout_ms != None:
5277 self.timeout_ms = timeout_ms
5278 else:
5279 self.timeout_ms = 0
5280 if port_no != None:
5281 self.port_no = port_no
5282 else:
5283 self.port_no = 0
5284 if slot_num != None:
5285 self.slot_num = slot_num
5286 else:
5287 self.slot_num = 0
5288 if data != None:
5289 self.data = data
5290 else:
5291 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005292 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005293
5294 def pack(self):
5295 packed = []
5296 packed.append(struct.pack("!B", self.version))
5297 packed.append(struct.pack("!B", self.type))
5298 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5299 packed.append(struct.pack("!L", self.xid))
5300 packed.append(struct.pack("!L", self.experimenter))
5301 packed.append(struct.pack("!L", self.subtype))
5302 packed.append(struct.pack("!L", self.timeout_ms))
5303 packed.append(util.pack_port_no(self.port_no))
5304 packed.append(struct.pack("!B", self.slot_num))
5305 packed.append('\x00' * 3)
5306 packed.append(self.data)
5307 length = sum([len(x) for x in packed])
5308 packed[2] = struct.pack("!H", length)
5309 return ''.join(packed)
5310
5311 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005312 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005313 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005314 _version = reader.read("!B")[0]
5315 assert(_version == 4)
5316 _type = reader.read("!B")[0]
5317 assert(_type == 4)
5318 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005319 orig_reader = reader
5320 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005321 obj.xid = reader.read("!L")[0]
5322 _experimenter = reader.read("!L")[0]
5323 assert(_experimenter == 6035143)
5324 _subtype = reader.read("!L")[0]
5325 assert(_subtype == 33)
5326 obj.timeout_ms = reader.read("!L")[0]
5327 obj.port_no = util.unpack_port_no(reader)
5328 obj.slot_num = reader.read("!B")[0]
5329 reader.skip(3)
5330 obj.data = str(reader.read_all())
5331 return obj
5332
5333 def __eq__(self, other):
5334 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005335 if self.xid != other.xid: return False
5336 if self.timeout_ms != other.timeout_ms: return False
5337 if self.port_no != other.port_no: return False
5338 if self.slot_num != other.slot_num: return False
5339 if self.data != other.data: return False
5340 return True
5341
Rich Lane6f4978c2013-10-20 21:33:52 -07005342 def pretty_print(self, q):
5343 q.text("bsn_pdu_rx_request {")
5344 with q.group():
5345 with q.indent(2):
5346 q.breakable()
5347 q.text("xid = ");
5348 if self.xid != None:
5349 q.text("%#x" % self.xid)
5350 else:
5351 q.text('None')
5352 q.text(","); q.breakable()
5353 q.text("timeout_ms = ");
5354 q.text("%#x" % self.timeout_ms)
5355 q.text(","); q.breakable()
5356 q.text("port_no = ");
5357 q.text(util.pretty_port(self.port_no))
5358 q.text(","); q.breakable()
5359 q.text("slot_num = ");
5360 q.text("%#x" % self.slot_num)
5361 q.text(","); q.breakable()
5362 q.text("data = ");
5363 q.pp(self.data)
5364 q.breakable()
5365 q.text('}')
5366
Rich Lane7dcdf022013-12-11 14:45:27 -08005367bsn_header.subtypes[33] = bsn_pdu_rx_request
5368
5369class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005370 version = 4
5371 type = 4
5372 experimenter = 6035143
5373 subtype = 35
5374
5375 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005376 if xid != None:
5377 self.xid = xid
5378 else:
5379 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005380 if port_no != None:
5381 self.port_no = port_no
5382 else:
5383 self.port_no = 0
5384 if slot_num != None:
5385 self.slot_num = slot_num
5386 else:
5387 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005388 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005389
5390 def pack(self):
5391 packed = []
5392 packed.append(struct.pack("!B", self.version))
5393 packed.append(struct.pack("!B", self.type))
5394 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5395 packed.append(struct.pack("!L", self.xid))
5396 packed.append(struct.pack("!L", self.experimenter))
5397 packed.append(struct.pack("!L", self.subtype))
5398 packed.append(util.pack_port_no(self.port_no))
5399 packed.append(struct.pack("!B", self.slot_num))
5400 length = sum([len(x) for x in packed])
5401 packed[2] = struct.pack("!H", length)
5402 return ''.join(packed)
5403
5404 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005405 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005406 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07005407 _version = reader.read("!B")[0]
5408 assert(_version == 4)
5409 _type = reader.read("!B")[0]
5410 assert(_type == 4)
5411 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005412 orig_reader = reader
5413 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005414 obj.xid = reader.read("!L")[0]
5415 _experimenter = reader.read("!L")[0]
5416 assert(_experimenter == 6035143)
5417 _subtype = reader.read("!L")[0]
5418 assert(_subtype == 35)
5419 obj.port_no = util.unpack_port_no(reader)
5420 obj.slot_num = reader.read("!B")[0]
5421 return obj
5422
5423 def __eq__(self, other):
5424 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005425 if self.xid != other.xid: return False
5426 if self.port_no != other.port_no: return False
5427 if self.slot_num != other.slot_num: return False
5428 return True
5429
Rich Lane6f4978c2013-10-20 21:33:52 -07005430 def pretty_print(self, q):
5431 q.text("bsn_pdu_rx_timeout {")
5432 with q.group():
5433 with q.indent(2):
5434 q.breakable()
5435 q.text("xid = ");
5436 if self.xid != None:
5437 q.text("%#x" % self.xid)
5438 else:
5439 q.text('None')
5440 q.text(","); q.breakable()
5441 q.text("port_no = ");
5442 q.text(util.pretty_port(self.port_no))
5443 q.text(","); q.breakable()
5444 q.text("slot_num = ");
5445 q.text("%#x" % self.slot_num)
5446 q.breakable()
5447 q.text('}')
5448
Rich Lane7dcdf022013-12-11 14:45:27 -08005449bsn_header.subtypes[35] = bsn_pdu_rx_timeout
5450
5451class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005452 version = 4
5453 type = 4
5454 experimenter = 6035143
5455 subtype = 32
5456
Rich Lane7b0f2012013-11-22 14:15:26 -08005457 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005458 if xid != None:
5459 self.xid = xid
5460 else:
5461 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005462 if status != None:
5463 self.status = status
5464 else:
5465 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005466 if port_no != None:
5467 self.port_no = port_no
5468 else:
5469 self.port_no = 0
5470 if slot_num != None:
5471 self.slot_num = slot_num
5472 else:
5473 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005474 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005475
5476 def pack(self):
5477 packed = []
5478 packed.append(struct.pack("!B", self.version))
5479 packed.append(struct.pack("!B", self.type))
5480 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5481 packed.append(struct.pack("!L", self.xid))
5482 packed.append(struct.pack("!L", self.experimenter))
5483 packed.append(struct.pack("!L", self.subtype))
5484 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005485 packed.append(util.pack_port_no(self.port_no))
5486 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005487 length = sum([len(x) for x in packed])
5488 packed[2] = struct.pack("!H", length)
5489 return ''.join(packed)
5490
5491 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005492 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005493 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005494 _version = reader.read("!B")[0]
5495 assert(_version == 4)
5496 _type = reader.read("!B")[0]
5497 assert(_type == 4)
5498 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005499 orig_reader = reader
5500 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005501 obj.xid = reader.read("!L")[0]
5502 _experimenter = reader.read("!L")[0]
5503 assert(_experimenter == 6035143)
5504 _subtype = reader.read("!L")[0]
5505 assert(_subtype == 32)
5506 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005507 obj.port_no = util.unpack_port_no(reader)
5508 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005509 return obj
5510
5511 def __eq__(self, other):
5512 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005513 if self.xid != other.xid: return False
5514 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005515 if self.port_no != other.port_no: return False
5516 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005517 return True
5518
Rich Lane6f4978c2013-10-20 21:33:52 -07005519 def pretty_print(self, q):
5520 q.text("bsn_pdu_tx_reply {")
5521 with q.group():
5522 with q.indent(2):
5523 q.breakable()
5524 q.text("xid = ");
5525 if self.xid != None:
5526 q.text("%#x" % self.xid)
5527 else:
5528 q.text('None')
5529 q.text(","); q.breakable()
5530 q.text("status = ");
5531 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005532 q.text(","); q.breakable()
5533 q.text("port_no = ");
5534 q.text(util.pretty_port(self.port_no))
5535 q.text(","); q.breakable()
5536 q.text("slot_num = ");
5537 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005538 q.breakable()
5539 q.text('}')
5540
Rich Lane7dcdf022013-12-11 14:45:27 -08005541bsn_header.subtypes[32] = bsn_pdu_tx_reply
5542
5543class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005544 version = 4
5545 type = 4
5546 experimenter = 6035143
5547 subtype = 31
5548
5549 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005550 if xid != None:
5551 self.xid = xid
5552 else:
5553 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005554 if tx_interval_ms != None:
5555 self.tx_interval_ms = tx_interval_ms
5556 else:
5557 self.tx_interval_ms = 0
5558 if port_no != None:
5559 self.port_no = port_no
5560 else:
5561 self.port_no = 0
5562 if slot_num != None:
5563 self.slot_num = slot_num
5564 else:
5565 self.slot_num = 0
5566 if data != None:
5567 self.data = data
5568 else:
5569 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005570 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005571
5572 def pack(self):
5573 packed = []
5574 packed.append(struct.pack("!B", self.version))
5575 packed.append(struct.pack("!B", self.type))
5576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5577 packed.append(struct.pack("!L", self.xid))
5578 packed.append(struct.pack("!L", self.experimenter))
5579 packed.append(struct.pack("!L", self.subtype))
5580 packed.append(struct.pack("!L", self.tx_interval_ms))
5581 packed.append(util.pack_port_no(self.port_no))
5582 packed.append(struct.pack("!B", self.slot_num))
5583 packed.append('\x00' * 3)
5584 packed.append(self.data)
5585 length = sum([len(x) for x in packed])
5586 packed[2] = struct.pack("!H", length)
5587 return ''.join(packed)
5588
5589 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005590 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005591 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005592 _version = reader.read("!B")[0]
5593 assert(_version == 4)
5594 _type = reader.read("!B")[0]
5595 assert(_type == 4)
5596 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005597 orig_reader = reader
5598 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005599 obj.xid = reader.read("!L")[0]
5600 _experimenter = reader.read("!L")[0]
5601 assert(_experimenter == 6035143)
5602 _subtype = reader.read("!L")[0]
5603 assert(_subtype == 31)
5604 obj.tx_interval_ms = reader.read("!L")[0]
5605 obj.port_no = util.unpack_port_no(reader)
5606 obj.slot_num = reader.read("!B")[0]
5607 reader.skip(3)
5608 obj.data = str(reader.read_all())
5609 return obj
5610
5611 def __eq__(self, other):
5612 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005613 if self.xid != other.xid: return False
5614 if self.tx_interval_ms != other.tx_interval_ms: return False
5615 if self.port_no != other.port_no: return False
5616 if self.slot_num != other.slot_num: return False
5617 if self.data != other.data: return False
5618 return True
5619
Rich Lane6f4978c2013-10-20 21:33:52 -07005620 def pretty_print(self, q):
5621 q.text("bsn_pdu_tx_request {")
5622 with q.group():
5623 with q.indent(2):
5624 q.breakable()
5625 q.text("xid = ");
5626 if self.xid != None:
5627 q.text("%#x" % self.xid)
5628 else:
5629 q.text('None')
5630 q.text(","); q.breakable()
5631 q.text("tx_interval_ms = ");
5632 q.text("%#x" % self.tx_interval_ms)
5633 q.text(","); q.breakable()
5634 q.text("port_no = ");
5635 q.text(util.pretty_port(self.port_no))
5636 q.text(","); q.breakable()
5637 q.text("slot_num = ");
5638 q.text("%#x" % self.slot_num)
5639 q.text(","); q.breakable()
5640 q.text("data = ");
5641 q.pp(self.data)
5642 q.breakable()
5643 q.text('}')
5644
Rich Lane7dcdf022013-12-11 14:45:27 -08005645bsn_header.subtypes[31] = bsn_pdu_tx_request
5646
5647class bsn_port_counter_stats_reply(bsn_stats_reply):
5648 version = 4
5649 type = 19
5650 stats_type = 65535
5651 experimenter = 6035143
5652 subtype = 8
5653
5654 def __init__(self, xid=None, flags=None, entries=None):
5655 if xid != None:
5656 self.xid = xid
5657 else:
5658 self.xid = None
5659 if flags != None:
5660 self.flags = flags
5661 else:
5662 self.flags = 0
5663 if entries != None:
5664 self.entries = entries
5665 else:
5666 self.entries = []
5667 return
5668
5669 def pack(self):
5670 packed = []
5671 packed.append(struct.pack("!B", self.version))
5672 packed.append(struct.pack("!B", self.type))
5673 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5674 packed.append(struct.pack("!L", self.xid))
5675 packed.append(struct.pack("!H", self.stats_type))
5676 packed.append(struct.pack("!H", self.flags))
5677 packed.append('\x00' * 4)
5678 packed.append(struct.pack("!L", self.experimenter))
5679 packed.append(struct.pack("!L", self.subtype))
5680 packed.append(loxi.generic_util.pack_list(self.entries))
5681 length = sum([len(x) for x in packed])
5682 packed[2] = struct.pack("!H", length)
5683 return ''.join(packed)
5684
5685 @staticmethod
5686 def unpack(reader):
5687 obj = bsn_port_counter_stats_reply()
5688 _version = reader.read("!B")[0]
5689 assert(_version == 4)
5690 _type = reader.read("!B")[0]
5691 assert(_type == 19)
5692 _length = reader.read("!H")[0]
5693 orig_reader = reader
5694 reader = orig_reader.slice(_length - (2 + 2))
5695 obj.xid = reader.read("!L")[0]
5696 _stats_type = reader.read("!H")[0]
5697 assert(_stats_type == 65535)
5698 obj.flags = reader.read("!H")[0]
5699 reader.skip(4)
5700 _experimenter = reader.read("!L")[0]
5701 assert(_experimenter == 6035143)
5702 _subtype = reader.read("!L")[0]
5703 assert(_subtype == 8)
5704 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
5705 return obj
5706
5707 def __eq__(self, other):
5708 if type(self) != type(other): return False
5709 if self.xid != other.xid: return False
5710 if self.flags != other.flags: return False
5711 if self.entries != other.entries: return False
5712 return True
5713
5714 def pretty_print(self, q):
5715 q.text("bsn_port_counter_stats_reply {")
5716 with q.group():
5717 with q.indent(2):
5718 q.breakable()
5719 q.text("xid = ");
5720 if self.xid != None:
5721 q.text("%#x" % self.xid)
5722 else:
5723 q.text('None')
5724 q.text(","); q.breakable()
5725 q.text("flags = ");
5726 q.text("%#x" % self.flags)
5727 q.text(","); q.breakable()
5728 q.text("entries = ");
5729 q.pp(self.entries)
5730 q.breakable()
5731 q.text('}')
5732
5733bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
5734
5735class bsn_port_counter_stats_request(bsn_stats_request):
5736 version = 4
5737 type = 18
5738 stats_type = 65535
5739 experimenter = 6035143
5740 subtype = 8
5741
5742 def __init__(self, xid=None, flags=None, port_no=None):
5743 if xid != None:
5744 self.xid = xid
5745 else:
5746 self.xid = None
5747 if flags != None:
5748 self.flags = flags
5749 else:
5750 self.flags = 0
5751 if port_no != None:
5752 self.port_no = port_no
5753 else:
5754 self.port_no = 0
5755 return
5756
5757 def pack(self):
5758 packed = []
5759 packed.append(struct.pack("!B", self.version))
5760 packed.append(struct.pack("!B", self.type))
5761 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5762 packed.append(struct.pack("!L", self.xid))
5763 packed.append(struct.pack("!H", self.stats_type))
5764 packed.append(struct.pack("!H", self.flags))
5765 packed.append('\x00' * 4)
5766 packed.append(struct.pack("!L", self.experimenter))
5767 packed.append(struct.pack("!L", self.subtype))
5768 packed.append(util.pack_port_no(self.port_no))
5769 length = sum([len(x) for x in packed])
5770 packed[2] = struct.pack("!H", length)
5771 return ''.join(packed)
5772
5773 @staticmethod
5774 def unpack(reader):
5775 obj = bsn_port_counter_stats_request()
5776 _version = reader.read("!B")[0]
5777 assert(_version == 4)
5778 _type = reader.read("!B")[0]
5779 assert(_type == 18)
5780 _length = reader.read("!H")[0]
5781 orig_reader = reader
5782 reader = orig_reader.slice(_length - (2 + 2))
5783 obj.xid = reader.read("!L")[0]
5784 _stats_type = reader.read("!H")[0]
5785 assert(_stats_type == 65535)
5786 obj.flags = reader.read("!H")[0]
5787 reader.skip(4)
5788 _experimenter = reader.read("!L")[0]
5789 assert(_experimenter == 6035143)
5790 _subtype = reader.read("!L")[0]
5791 assert(_subtype == 8)
5792 obj.port_no = util.unpack_port_no(reader)
5793 return obj
5794
5795 def __eq__(self, other):
5796 if type(self) != type(other): return False
5797 if self.xid != other.xid: return False
5798 if self.flags != other.flags: return False
5799 if self.port_no != other.port_no: return False
5800 return True
5801
5802 def pretty_print(self, q):
5803 q.text("bsn_port_counter_stats_request {")
5804 with q.group():
5805 with q.indent(2):
5806 q.breakable()
5807 q.text("xid = ");
5808 if self.xid != None:
5809 q.text("%#x" % self.xid)
5810 else:
5811 q.text('None')
5812 q.text(","); q.breakable()
5813 q.text("flags = ");
5814 q.text("%#x" % self.flags)
5815 q.text(","); q.breakable()
5816 q.text("port_no = ");
5817 q.text(util.pretty_port(self.port_no))
5818 q.breakable()
5819 q.text('}')
5820
5821bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
5822
Rich Lane5454b682014-01-14 17:07:36 -08005823class bsn_role_status(bsn_header):
5824 version = 4
5825 type = 4
5826 experimenter = 6035143
5827 subtype = 55
5828
5829 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
5830 if xid != None:
5831 self.xid = xid
5832 else:
5833 self.xid = None
5834 if role != None:
5835 self.role = role
5836 else:
5837 self.role = 0
5838 if reason != None:
5839 self.reason = reason
5840 else:
5841 self.reason = 0
5842 if generation_id != None:
5843 self.generation_id = generation_id
5844 else:
5845 self.generation_id = 0
5846 return
5847
5848 def pack(self):
5849 packed = []
5850 packed.append(struct.pack("!B", self.version))
5851 packed.append(struct.pack("!B", self.type))
5852 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5853 packed.append(struct.pack("!L", self.xid))
5854 packed.append(struct.pack("!L", self.experimenter))
5855 packed.append(struct.pack("!L", self.subtype))
5856 packed.append(struct.pack("!L", self.role))
5857 packed.append(struct.pack("!B", self.reason))
5858 packed.append('\x00' * 3)
5859 packed.append(struct.pack("!Q", self.generation_id))
5860 length = sum([len(x) for x in packed])
5861 packed[2] = struct.pack("!H", length)
5862 return ''.join(packed)
5863
5864 @staticmethod
5865 def unpack(reader):
5866 obj = bsn_role_status()
5867 _version = reader.read("!B")[0]
5868 assert(_version == 4)
5869 _type = reader.read("!B")[0]
5870 assert(_type == 4)
5871 _length = reader.read("!H")[0]
5872 orig_reader = reader
5873 reader = orig_reader.slice(_length - (2 + 2))
5874 obj.xid = reader.read("!L")[0]
5875 _experimenter = reader.read("!L")[0]
5876 assert(_experimenter == 6035143)
5877 _subtype = reader.read("!L")[0]
5878 assert(_subtype == 55)
5879 obj.role = reader.read("!L")[0]
5880 obj.reason = reader.read("!B")[0]
5881 reader.skip(3)
5882 obj.generation_id = reader.read("!Q")[0]
5883 return obj
5884
5885 def __eq__(self, other):
5886 if type(self) != type(other): return False
5887 if self.xid != other.xid: return False
5888 if self.role != other.role: return False
5889 if self.reason != other.reason: return False
5890 if self.generation_id != other.generation_id: return False
5891 return True
5892
5893 def pretty_print(self, q):
5894 q.text("bsn_role_status {")
5895 with q.group():
5896 with q.indent(2):
5897 q.breakable()
5898 q.text("xid = ");
5899 if self.xid != None:
5900 q.text("%#x" % self.xid)
5901 else:
5902 q.text('None')
5903 q.text(","); q.breakable()
5904 q.text("role = ");
5905 q.text("%#x" % self.role)
5906 q.text(","); q.breakable()
5907 q.text("reason = ");
5908 q.text("%#x" % self.reason)
5909 q.text(","); q.breakable()
5910 q.text("generation_id = ");
5911 q.text("%#x" % self.generation_id)
5912 q.breakable()
5913 q.text('}')
5914
5915bsn_header.subtypes[55] = bsn_role_status
5916
Rich Lane95f7fc92014-01-27 17:08:16 -08005917class bsn_set_aux_cxns_reply(bsn_header):
5918 version = 4
5919 type = 4
5920 experimenter = 6035143
5921 subtype = 59
5922
5923 def __init__(self, xid=None, num_aux=None, status=None):
5924 if xid != None:
5925 self.xid = xid
5926 else:
5927 self.xid = None
5928 if num_aux != None:
5929 self.num_aux = num_aux
5930 else:
5931 self.num_aux = 0
5932 if status != None:
5933 self.status = status
5934 else:
5935 self.status = 0
5936 return
5937
5938 def pack(self):
5939 packed = []
5940 packed.append(struct.pack("!B", self.version))
5941 packed.append(struct.pack("!B", self.type))
5942 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5943 packed.append(struct.pack("!L", self.xid))
5944 packed.append(struct.pack("!L", self.experimenter))
5945 packed.append(struct.pack("!L", self.subtype))
5946 packed.append(struct.pack("!L", self.num_aux))
5947 packed.append(struct.pack("!L", self.status))
5948 length = sum([len(x) for x in packed])
5949 packed[2] = struct.pack("!H", length)
5950 return ''.join(packed)
5951
5952 @staticmethod
5953 def unpack(reader):
5954 obj = bsn_set_aux_cxns_reply()
5955 _version = reader.read("!B")[0]
5956 assert(_version == 4)
5957 _type = reader.read("!B")[0]
5958 assert(_type == 4)
5959 _length = reader.read("!H")[0]
5960 orig_reader = reader
5961 reader = orig_reader.slice(_length - (2 + 2))
5962 obj.xid = reader.read("!L")[0]
5963 _experimenter = reader.read("!L")[0]
5964 assert(_experimenter == 6035143)
5965 _subtype = reader.read("!L")[0]
5966 assert(_subtype == 59)
5967 obj.num_aux = reader.read("!L")[0]
5968 obj.status = reader.read("!L")[0]
5969 return obj
5970
5971 def __eq__(self, other):
5972 if type(self) != type(other): return False
5973 if self.xid != other.xid: return False
5974 if self.num_aux != other.num_aux: return False
5975 if self.status != other.status: return False
5976 return True
5977
5978 def pretty_print(self, q):
5979 q.text("bsn_set_aux_cxns_reply {")
5980 with q.group():
5981 with q.indent(2):
5982 q.breakable()
5983 q.text("xid = ");
5984 if self.xid != None:
5985 q.text("%#x" % self.xid)
5986 else:
5987 q.text('None')
5988 q.text(","); q.breakable()
5989 q.text("num_aux = ");
5990 q.text("%#x" % self.num_aux)
5991 q.text(","); q.breakable()
5992 q.text("status = ");
5993 q.text("%#x" % self.status)
5994 q.breakable()
5995 q.text('}')
5996
5997bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
5998
5999class bsn_set_aux_cxns_request(bsn_header):
6000 version = 4
6001 type = 4
6002 experimenter = 6035143
6003 subtype = 58
6004
6005 def __init__(self, xid=None, num_aux=None):
6006 if xid != None:
6007 self.xid = xid
6008 else:
6009 self.xid = None
6010 if num_aux != None:
6011 self.num_aux = num_aux
6012 else:
6013 self.num_aux = 0
6014 return
6015
6016 def pack(self):
6017 packed = []
6018 packed.append(struct.pack("!B", self.version))
6019 packed.append(struct.pack("!B", self.type))
6020 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6021 packed.append(struct.pack("!L", self.xid))
6022 packed.append(struct.pack("!L", self.experimenter))
6023 packed.append(struct.pack("!L", self.subtype))
6024 packed.append(struct.pack("!L", self.num_aux))
6025 length = sum([len(x) for x in packed])
6026 packed[2] = struct.pack("!H", length)
6027 return ''.join(packed)
6028
6029 @staticmethod
6030 def unpack(reader):
6031 obj = bsn_set_aux_cxns_request()
6032 _version = reader.read("!B")[0]
6033 assert(_version == 4)
6034 _type = reader.read("!B")[0]
6035 assert(_type == 4)
6036 _length = reader.read("!H")[0]
6037 orig_reader = reader
6038 reader = orig_reader.slice(_length - (2 + 2))
6039 obj.xid = reader.read("!L")[0]
6040 _experimenter = reader.read("!L")[0]
6041 assert(_experimenter == 6035143)
6042 _subtype = reader.read("!L")[0]
6043 assert(_subtype == 58)
6044 obj.num_aux = reader.read("!L")[0]
6045 return obj
6046
6047 def __eq__(self, other):
6048 if type(self) != type(other): return False
6049 if self.xid != other.xid: return False
6050 if self.num_aux != other.num_aux: return False
6051 return True
6052
6053 def pretty_print(self, q):
6054 q.text("bsn_set_aux_cxns_request {")
6055 with q.group():
6056 with q.indent(2):
6057 q.breakable()
6058 q.text("xid = ");
6059 if self.xid != None:
6060 q.text("%#x" % self.xid)
6061 else:
6062 q.text('None')
6063 q.text(","); q.breakable()
6064 q.text("num_aux = ");
6065 q.text("%#x" % self.num_aux)
6066 q.breakable()
6067 q.text('}')
6068
6069bsn_header.subtypes[58] = bsn_set_aux_cxns_request
6070
Rich Lane7dcdf022013-12-11 14:45:27 -08006071class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006072 version = 4
6073 type = 4
6074 experimenter = 6035143
6075 subtype = 42
6076
6077 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006078 if xid != None:
6079 self.xid = xid
6080 else:
6081 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006082 if status != None:
6083 self.status = status
6084 else:
6085 self.status = 0
6086 if port_no != None:
6087 self.port_no = port_no
6088 else:
6089 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006090 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006091
6092 def pack(self):
6093 packed = []
6094 packed.append(struct.pack("!B", self.version))
6095 packed.append(struct.pack("!B", self.type))
6096 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6097 packed.append(struct.pack("!L", self.xid))
6098 packed.append(struct.pack("!L", self.experimenter))
6099 packed.append(struct.pack("!L", self.subtype))
6100 packed.append(struct.pack("!L", self.status))
6101 packed.append(util.pack_port_no(self.port_no))
6102 length = sum([len(x) for x in packed])
6103 packed[2] = struct.pack("!H", length)
6104 return ''.join(packed)
6105
6106 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006107 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006108 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08006109 _version = reader.read("!B")[0]
6110 assert(_version == 4)
6111 _type = reader.read("!B")[0]
6112 assert(_type == 4)
6113 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006114 orig_reader = reader
6115 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006116 obj.xid = reader.read("!L")[0]
6117 _experimenter = reader.read("!L")[0]
6118 assert(_experimenter == 6035143)
6119 _subtype = reader.read("!L")[0]
6120 assert(_subtype == 42)
6121 obj.status = reader.read("!L")[0]
6122 obj.port_no = util.unpack_port_no(reader)
6123 return obj
6124
6125 def __eq__(self, other):
6126 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006127 if self.xid != other.xid: return False
6128 if self.status != other.status: return False
6129 if self.port_no != other.port_no: return False
6130 return True
6131
Rich Lane7b0f2012013-11-22 14:15:26 -08006132 def pretty_print(self, q):
6133 q.text("bsn_set_lacp_reply {")
6134 with q.group():
6135 with q.indent(2):
6136 q.breakable()
6137 q.text("xid = ");
6138 if self.xid != None:
6139 q.text("%#x" % self.xid)
6140 else:
6141 q.text('None')
6142 q.text(","); q.breakable()
6143 q.text("status = ");
6144 q.text("%#x" % self.status)
6145 q.text(","); q.breakable()
6146 q.text("port_no = ");
6147 q.text(util.pretty_port(self.port_no))
6148 q.breakable()
6149 q.text('}')
6150
Rich Lane7dcdf022013-12-11 14:45:27 -08006151bsn_header.subtypes[42] = bsn_set_lacp_reply
6152
6153class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006154 version = 4
6155 type = 4
6156 experimenter = 6035143
6157 subtype = 41
6158
6159 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 -08006160 if xid != None:
6161 self.xid = xid
6162 else:
6163 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006164 if enabled != None:
6165 self.enabled = enabled
6166 else:
6167 self.enabled = 0
6168 if port_no != None:
6169 self.port_no = port_no
6170 else:
6171 self.port_no = 0
6172 if actor_sys_priority != None:
6173 self.actor_sys_priority = actor_sys_priority
6174 else:
6175 self.actor_sys_priority = 0
6176 if actor_sys_mac != None:
6177 self.actor_sys_mac = actor_sys_mac
6178 else:
6179 self.actor_sys_mac = [0,0,0,0,0,0]
6180 if actor_port_priority != None:
6181 self.actor_port_priority = actor_port_priority
6182 else:
6183 self.actor_port_priority = 0
6184 if actor_port_num != None:
6185 self.actor_port_num = actor_port_num
6186 else:
6187 self.actor_port_num = 0
6188 if actor_key != None:
6189 self.actor_key = actor_key
6190 else:
6191 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006192 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006193
6194 def pack(self):
6195 packed = []
6196 packed.append(struct.pack("!B", self.version))
6197 packed.append(struct.pack("!B", self.type))
6198 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6199 packed.append(struct.pack("!L", self.xid))
6200 packed.append(struct.pack("!L", self.experimenter))
6201 packed.append(struct.pack("!L", self.subtype))
6202 packed.append(struct.pack("!B", self.enabled))
6203 packed.append('\x00' * 3)
6204 packed.append(util.pack_port_no(self.port_no))
6205 packed.append(struct.pack("!H", self.actor_sys_priority))
6206 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6207 packed.append(struct.pack("!H", self.actor_port_priority))
6208 packed.append(struct.pack("!H", self.actor_port_num))
6209 packed.append(struct.pack("!H", self.actor_key))
6210 length = sum([len(x) for x in packed])
6211 packed[2] = struct.pack("!H", length)
6212 return ''.join(packed)
6213
6214 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006215 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006216 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006217 _version = reader.read("!B")[0]
6218 assert(_version == 4)
6219 _type = reader.read("!B")[0]
6220 assert(_type == 4)
6221 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006222 orig_reader = reader
6223 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006224 obj.xid = reader.read("!L")[0]
6225 _experimenter = reader.read("!L")[0]
6226 assert(_experimenter == 6035143)
6227 _subtype = reader.read("!L")[0]
6228 assert(_subtype == 41)
6229 obj.enabled = reader.read("!B")[0]
6230 reader.skip(3)
6231 obj.port_no = util.unpack_port_no(reader)
6232 obj.actor_sys_priority = reader.read("!H")[0]
6233 obj.actor_sys_mac = list(reader.read('!6B'))
6234 obj.actor_port_priority = reader.read("!H")[0]
6235 obj.actor_port_num = reader.read("!H")[0]
6236 obj.actor_key = reader.read("!H")[0]
6237 return obj
6238
6239 def __eq__(self, other):
6240 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006241 if self.xid != other.xid: return False
6242 if self.enabled != other.enabled: return False
6243 if self.port_no != other.port_no: return False
6244 if self.actor_sys_priority != other.actor_sys_priority: return False
6245 if self.actor_sys_mac != other.actor_sys_mac: return False
6246 if self.actor_port_priority != other.actor_port_priority: return False
6247 if self.actor_port_num != other.actor_port_num: return False
6248 if self.actor_key != other.actor_key: return False
6249 return True
6250
Rich Lane7b0f2012013-11-22 14:15:26 -08006251 def pretty_print(self, q):
6252 q.text("bsn_set_lacp_request {")
6253 with q.group():
6254 with q.indent(2):
6255 q.breakable()
6256 q.text("xid = ");
6257 if self.xid != None:
6258 q.text("%#x" % self.xid)
6259 else:
6260 q.text('None')
6261 q.text(","); q.breakable()
6262 q.text("enabled = ");
6263 q.text("%#x" % self.enabled)
6264 q.text(","); q.breakable()
6265 q.text("port_no = ");
6266 q.text(util.pretty_port(self.port_no))
6267 q.text(","); q.breakable()
6268 q.text("actor_sys_priority = ");
6269 q.text("%#x" % self.actor_sys_priority)
6270 q.text(","); q.breakable()
6271 q.text("actor_sys_mac = ");
6272 q.text(util.pretty_mac(self.actor_sys_mac))
6273 q.text(","); q.breakable()
6274 q.text("actor_port_priority = ");
6275 q.text("%#x" % self.actor_port_priority)
6276 q.text(","); q.breakable()
6277 q.text("actor_port_num = ");
6278 q.text("%#x" % self.actor_port_num)
6279 q.text(","); q.breakable()
6280 q.text("actor_key = ");
6281 q.text("%#x" % self.actor_key)
6282 q.breakable()
6283 q.text('}')
6284
Rich Lane7dcdf022013-12-11 14:45:27 -08006285bsn_header.subtypes[41] = bsn_set_lacp_request
6286
6287class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006288 version = 4
6289 type = 4
6290 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006291 subtype = 3
6292
6293 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006294 if xid != None:
6295 self.xid = xid
6296 else:
6297 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006298 if report_mirror_ports != None:
6299 self.report_mirror_ports = report_mirror_ports
6300 else:
6301 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006302 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006303
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("!B", self.report_mirror_ports))
6313 packed.append('\x00' * 3)
6314 length = sum([len(x) for x in packed])
6315 packed[2] = struct.pack("!H", length)
6316 return ''.join(packed)
6317
6318 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006319 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006320 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07006321 _version = reader.read("!B")[0]
6322 assert(_version == 4)
6323 _type = reader.read("!B")[0]
6324 assert(_type == 4)
6325 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006326 orig_reader = reader
6327 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006328 obj.xid = reader.read("!L")[0]
6329 _experimenter = reader.read("!L")[0]
6330 assert(_experimenter == 6035143)
6331 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006332 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07006333 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006334 reader.skip(3)
6335 return obj
6336
6337 def __eq__(self, other):
6338 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006339 if self.xid != other.xid: return False
6340 if self.report_mirror_ports != other.report_mirror_ports: return False
6341 return True
6342
Rich Lanec2ee4b82013-04-24 17:12:38 -07006343 def pretty_print(self, q):
6344 q.text("bsn_set_mirroring {")
6345 with q.group():
6346 with q.indent(2):
6347 q.breakable()
6348 q.text("xid = ");
6349 if self.xid != None:
6350 q.text("%#x" % self.xid)
6351 else:
6352 q.text('None')
6353 q.text(","); q.breakable()
6354 q.text("report_mirror_ports = ");
6355 q.text("%#x" % self.report_mirror_ports)
6356 q.breakable()
6357 q.text('}')
6358
Rich Lane7dcdf022013-12-11 14:45:27 -08006359bsn_header.subtypes[3] = bsn_set_mirroring
6360
6361class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006362 version = 4
6363 type = 4
6364 experimenter = 6035143
6365 subtype = 25
6366
6367 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006368 if xid != None:
6369 self.xid = xid
6370 else:
6371 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006372 if status != None:
6373 self.status = status
6374 else:
6375 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006376 return
Dan Talaycof6202252013-07-02 01:00:29 -07006377
6378 def pack(self):
6379 packed = []
6380 packed.append(struct.pack("!B", self.version))
6381 packed.append(struct.pack("!B", self.type))
6382 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6383 packed.append(struct.pack("!L", self.xid))
6384 packed.append(struct.pack("!L", self.experimenter))
6385 packed.append(struct.pack("!L", self.subtype))
6386 packed.append(struct.pack("!L", self.status))
6387 length = sum([len(x) for x in packed])
6388 packed[2] = struct.pack("!H", length)
6389 return ''.join(packed)
6390
6391 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006392 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006393 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006394 _version = reader.read("!B")[0]
6395 assert(_version == 4)
6396 _type = reader.read("!B")[0]
6397 assert(_type == 4)
6398 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006399 orig_reader = reader
6400 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006401 obj.xid = reader.read("!L")[0]
6402 _experimenter = reader.read("!L")[0]
6403 assert(_experimenter == 6035143)
6404 _subtype = reader.read("!L")[0]
6405 assert(_subtype == 25)
6406 obj.status = reader.read("!L")[0]
6407 return obj
6408
6409 def __eq__(self, other):
6410 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006411 if self.xid != other.xid: return False
6412 if self.status != other.status: return False
6413 return True
6414
Dan Talaycof6202252013-07-02 01:00:29 -07006415 def pretty_print(self, q):
6416 q.text("bsn_set_pktin_suppression_reply {")
6417 with q.group():
6418 with q.indent(2):
6419 q.breakable()
6420 q.text("xid = ");
6421 if self.xid != None:
6422 q.text("%#x" % self.xid)
6423 else:
6424 q.text('None')
6425 q.text(","); q.breakable()
6426 q.text("status = ");
6427 q.text("%#x" % self.status)
6428 q.breakable()
6429 q.text('}')
6430
Rich Lane7dcdf022013-12-11 14:45:27 -08006431bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
6432
6433class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006434 version = 4
6435 type = 4
6436 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006437 subtype = 11
6438
6439 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006440 if xid != None:
6441 self.xid = xid
6442 else:
6443 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006444 if enabled != None:
6445 self.enabled = enabled
6446 else:
6447 self.enabled = 0
6448 if idle_timeout != None:
6449 self.idle_timeout = idle_timeout
6450 else:
6451 self.idle_timeout = 0
6452 if hard_timeout != None:
6453 self.hard_timeout = hard_timeout
6454 else:
6455 self.hard_timeout = 0
6456 if priority != None:
6457 self.priority = priority
6458 else:
6459 self.priority = 0
6460 if cookie != None:
6461 self.cookie = cookie
6462 else:
6463 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006464 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006465
6466 def pack(self):
6467 packed = []
6468 packed.append(struct.pack("!B", self.version))
6469 packed.append(struct.pack("!B", self.type))
6470 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6471 packed.append(struct.pack("!L", self.xid))
6472 packed.append(struct.pack("!L", self.experimenter))
6473 packed.append(struct.pack("!L", self.subtype))
6474 packed.append(struct.pack("!B", self.enabled))
6475 packed.append('\x00' * 1)
6476 packed.append(struct.pack("!H", self.idle_timeout))
6477 packed.append(struct.pack("!H", self.hard_timeout))
6478 packed.append(struct.pack("!H", self.priority))
6479 packed.append(struct.pack("!Q", self.cookie))
6480 length = sum([len(x) for x in packed])
6481 packed[2] = struct.pack("!H", length)
6482 return ''.join(packed)
6483
6484 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006485 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006486 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006487 _version = reader.read("!B")[0]
6488 assert(_version == 4)
6489 _type = reader.read("!B")[0]
6490 assert(_type == 4)
6491 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006492 orig_reader = reader
6493 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006494 obj.xid = reader.read("!L")[0]
6495 _experimenter = reader.read("!L")[0]
6496 assert(_experimenter == 6035143)
6497 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006498 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006499 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006500 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07006501 obj.idle_timeout = reader.read("!H")[0]
6502 obj.hard_timeout = reader.read("!H")[0]
6503 obj.priority = reader.read("!H")[0]
6504 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006505 return obj
6506
6507 def __eq__(self, other):
6508 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006509 if self.xid != other.xid: return False
6510 if self.enabled != other.enabled: return False
6511 if self.idle_timeout != other.idle_timeout: return False
6512 if self.hard_timeout != other.hard_timeout: return False
6513 if self.priority != other.priority: return False
6514 if self.cookie != other.cookie: return False
6515 return True
6516
Rich Lanec2ee4b82013-04-24 17:12:38 -07006517 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07006518 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07006519 with q.group():
6520 with q.indent(2):
6521 q.breakable()
6522 q.text("xid = ");
6523 if self.xid != None:
6524 q.text("%#x" % self.xid)
6525 else:
6526 q.text('None')
6527 q.text(","); q.breakable()
6528 q.text("enabled = ");
6529 q.text("%#x" % self.enabled)
6530 q.text(","); q.breakable()
6531 q.text("idle_timeout = ");
6532 q.text("%#x" % self.idle_timeout)
6533 q.text(","); q.breakable()
6534 q.text("hard_timeout = ");
6535 q.text("%#x" % self.hard_timeout)
6536 q.text(","); q.breakable()
6537 q.text("priority = ");
6538 q.text("%#x" % self.priority)
6539 q.text(","); q.breakable()
6540 q.text("cookie = ");
6541 q.text("%#x" % self.cookie)
6542 q.breakable()
6543 q.text('}')
6544
Rich Lane7dcdf022013-12-11 14:45:27 -08006545bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
6546
6547class bsn_set_switch_pipeline_reply(bsn_header):
6548 version = 4
6549 type = 4
6550 experimenter = 6035143
6551 subtype = 54
6552
6553 def __init__(self, xid=None, status=None):
6554 if xid != None:
6555 self.xid = xid
6556 else:
6557 self.xid = None
6558 if status != None:
6559 self.status = status
6560 else:
6561 self.status = 0
6562 return
6563
6564 def pack(self):
6565 packed = []
6566 packed.append(struct.pack("!B", self.version))
6567 packed.append(struct.pack("!B", self.type))
6568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6569 packed.append(struct.pack("!L", self.xid))
6570 packed.append(struct.pack("!L", self.experimenter))
6571 packed.append(struct.pack("!L", self.subtype))
6572 packed.append(struct.pack("!L", self.status))
6573 length = sum([len(x) for x in packed])
6574 packed[2] = struct.pack("!H", length)
6575 return ''.join(packed)
6576
6577 @staticmethod
6578 def unpack(reader):
6579 obj = bsn_set_switch_pipeline_reply()
6580 _version = reader.read("!B")[0]
6581 assert(_version == 4)
6582 _type = reader.read("!B")[0]
6583 assert(_type == 4)
6584 _length = reader.read("!H")[0]
6585 orig_reader = reader
6586 reader = orig_reader.slice(_length - (2 + 2))
6587 obj.xid = reader.read("!L")[0]
6588 _experimenter = reader.read("!L")[0]
6589 assert(_experimenter == 6035143)
6590 _subtype = reader.read("!L")[0]
6591 assert(_subtype == 54)
6592 obj.status = reader.read("!L")[0]
6593 return obj
6594
6595 def __eq__(self, other):
6596 if type(self) != type(other): return False
6597 if self.xid != other.xid: return False
6598 if self.status != other.status: return False
6599 return True
6600
6601 def pretty_print(self, q):
6602 q.text("bsn_set_switch_pipeline_reply {")
6603 with q.group():
6604 with q.indent(2):
6605 q.breakable()
6606 q.text("xid = ");
6607 if self.xid != None:
6608 q.text("%#x" % self.xid)
6609 else:
6610 q.text('None')
6611 q.text(","); q.breakable()
6612 q.text("status = ");
6613 q.text("%#x" % self.status)
6614 q.breakable()
6615 q.text('}')
6616
6617bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
6618
6619class bsn_set_switch_pipeline_request(bsn_header):
6620 version = 4
6621 type = 4
6622 experimenter = 6035143
6623 subtype = 53
6624
6625 def __init__(self, xid=None, pipeline=None):
6626 if xid != None:
6627 self.xid = xid
6628 else:
6629 self.xid = None
6630 if pipeline != None:
6631 self.pipeline = pipeline
6632 else:
6633 self.pipeline = ""
6634 return
6635
6636 def pack(self):
6637 packed = []
6638 packed.append(struct.pack("!B", self.version))
6639 packed.append(struct.pack("!B", self.type))
6640 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6641 packed.append(struct.pack("!L", self.xid))
6642 packed.append(struct.pack("!L", self.experimenter))
6643 packed.append(struct.pack("!L", self.subtype))
6644 packed.append(struct.pack("!256s", self.pipeline))
6645 length = sum([len(x) for x in packed])
6646 packed[2] = struct.pack("!H", length)
6647 return ''.join(packed)
6648
6649 @staticmethod
6650 def unpack(reader):
6651 obj = bsn_set_switch_pipeline_request()
6652 _version = reader.read("!B")[0]
6653 assert(_version == 4)
6654 _type = reader.read("!B")[0]
6655 assert(_type == 4)
6656 _length = reader.read("!H")[0]
6657 orig_reader = reader
6658 reader = orig_reader.slice(_length - (2 + 2))
6659 obj.xid = reader.read("!L")[0]
6660 _experimenter = reader.read("!L")[0]
6661 assert(_experimenter == 6035143)
6662 _subtype = reader.read("!L")[0]
6663 assert(_subtype == 53)
6664 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
6665 return obj
6666
6667 def __eq__(self, other):
6668 if type(self) != type(other): return False
6669 if self.xid != other.xid: return False
6670 if self.pipeline != other.pipeline: return False
6671 return True
6672
6673 def pretty_print(self, q):
6674 q.text("bsn_set_switch_pipeline_request {")
6675 with q.group():
6676 with q.indent(2):
6677 q.breakable()
6678 q.text("xid = ");
6679 if self.xid != None:
6680 q.text("%#x" % self.xid)
6681 else:
6682 q.text('None')
6683 q.text(","); q.breakable()
6684 q.text("pipeline = ");
6685 q.pp(self.pipeline)
6686 q.breakable()
6687 q.text('}')
6688
6689bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
6690
6691class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
6692 version = 4
6693 type = 19
6694 stats_type = 65535
6695 experimenter = 6035143
6696 subtype = 6
6697
6698 def __init__(self, xid=None, flags=None, entries=None):
6699 if xid != None:
6700 self.xid = xid
6701 else:
6702 self.xid = None
6703 if flags != None:
6704 self.flags = flags
6705 else:
6706 self.flags = 0
6707 if entries != None:
6708 self.entries = entries
6709 else:
6710 self.entries = []
6711 return
6712
6713 def pack(self):
6714 packed = []
6715 packed.append(struct.pack("!B", self.version))
6716 packed.append(struct.pack("!B", self.type))
6717 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6718 packed.append(struct.pack("!L", self.xid))
6719 packed.append(struct.pack("!H", self.stats_type))
6720 packed.append(struct.pack("!H", self.flags))
6721 packed.append('\x00' * 4)
6722 packed.append(struct.pack("!L", self.experimenter))
6723 packed.append(struct.pack("!L", self.subtype))
6724 packed.append(loxi.generic_util.pack_list(self.entries))
6725 length = sum([len(x) for x in packed])
6726 packed[2] = struct.pack("!H", length)
6727 return ''.join(packed)
6728
6729 @staticmethod
6730 def unpack(reader):
6731 obj = bsn_switch_pipeline_stats_reply()
6732 _version = reader.read("!B")[0]
6733 assert(_version == 4)
6734 _type = reader.read("!B")[0]
6735 assert(_type == 19)
6736 _length = reader.read("!H")[0]
6737 orig_reader = reader
6738 reader = orig_reader.slice(_length - (2 + 2))
6739 obj.xid = reader.read("!L")[0]
6740 _stats_type = reader.read("!H")[0]
6741 assert(_stats_type == 65535)
6742 obj.flags = reader.read("!H")[0]
6743 reader.skip(4)
6744 _experimenter = reader.read("!L")[0]
6745 assert(_experimenter == 6035143)
6746 _subtype = reader.read("!L")[0]
6747 assert(_subtype == 6)
6748 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
6749 return obj
6750
6751 def __eq__(self, other):
6752 if type(self) != type(other): return False
6753 if self.xid != other.xid: return False
6754 if self.flags != other.flags: return False
6755 if self.entries != other.entries: return False
6756 return True
6757
6758 def pretty_print(self, q):
6759 q.text("bsn_switch_pipeline_stats_reply {")
6760 with q.group():
6761 with q.indent(2):
6762 q.breakable()
6763 q.text("xid = ");
6764 if self.xid != None:
6765 q.text("%#x" % self.xid)
6766 else:
6767 q.text('None')
6768 q.text(","); q.breakable()
6769 q.text("flags = ");
6770 q.text("%#x" % self.flags)
6771 q.text(","); q.breakable()
6772 q.text("entries = ");
6773 q.pp(self.entries)
6774 q.breakable()
6775 q.text('}')
6776
6777bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
6778
6779class bsn_switch_pipeline_stats_request(bsn_stats_request):
6780 version = 4
6781 type = 18
6782 stats_type = 65535
6783 experimenter = 6035143
6784 subtype = 6
6785
6786 def __init__(self, xid=None, flags=None):
6787 if xid != None:
6788 self.xid = xid
6789 else:
6790 self.xid = None
6791 if flags != None:
6792 self.flags = flags
6793 else:
6794 self.flags = 0
6795 return
6796
6797 def pack(self):
6798 packed = []
6799 packed.append(struct.pack("!B", self.version))
6800 packed.append(struct.pack("!B", self.type))
6801 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6802 packed.append(struct.pack("!L", self.xid))
6803 packed.append(struct.pack("!H", self.stats_type))
6804 packed.append(struct.pack("!H", self.flags))
6805 packed.append('\x00' * 4)
6806 packed.append(struct.pack("!L", self.experimenter))
6807 packed.append(struct.pack("!L", self.subtype))
6808 length = sum([len(x) for x in packed])
6809 packed[2] = struct.pack("!H", length)
6810 return ''.join(packed)
6811
6812 @staticmethod
6813 def unpack(reader):
6814 obj = bsn_switch_pipeline_stats_request()
6815 _version = reader.read("!B")[0]
6816 assert(_version == 4)
6817 _type = reader.read("!B")[0]
6818 assert(_type == 18)
6819 _length = reader.read("!H")[0]
6820 orig_reader = reader
6821 reader = orig_reader.slice(_length - (2 + 2))
6822 obj.xid = reader.read("!L")[0]
6823 _stats_type = reader.read("!H")[0]
6824 assert(_stats_type == 65535)
6825 obj.flags = reader.read("!H")[0]
6826 reader.skip(4)
6827 _experimenter = reader.read("!L")[0]
6828 assert(_experimenter == 6035143)
6829 _subtype = reader.read("!L")[0]
6830 assert(_subtype == 6)
6831 return obj
6832
6833 def __eq__(self, other):
6834 if type(self) != type(other): return False
6835 if self.xid != other.xid: return False
6836 if self.flags != other.flags: return False
6837 return True
6838
6839 def pretty_print(self, q):
6840 q.text("bsn_switch_pipeline_stats_request {")
6841 with q.group():
6842 with q.indent(2):
6843 q.breakable()
6844 q.text("xid = ");
6845 if self.xid != None:
6846 q.text("%#x" % self.xid)
6847 else:
6848 q.text('None')
6849 q.text(","); q.breakable()
6850 q.text("flags = ");
6851 q.text("%#x" % self.flags)
6852 q.breakable()
6853 q.text('}')
6854
6855bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
6856
Rich Lane9ec3fca2014-02-26 16:22:56 -08006857class bsn_table_checksum_stats_reply(bsn_stats_reply):
6858 version = 4
6859 type = 19
6860 stats_type = 65535
6861 experimenter = 6035143
6862 subtype = 11
6863
6864 def __init__(self, xid=None, flags=None, entries=None):
6865 if xid != None:
6866 self.xid = xid
6867 else:
6868 self.xid = None
6869 if flags != None:
6870 self.flags = flags
6871 else:
6872 self.flags = 0
6873 if entries != None:
6874 self.entries = entries
6875 else:
6876 self.entries = []
6877 return
6878
6879 def pack(self):
6880 packed = []
6881 packed.append(struct.pack("!B", self.version))
6882 packed.append(struct.pack("!B", self.type))
6883 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6884 packed.append(struct.pack("!L", self.xid))
6885 packed.append(struct.pack("!H", self.stats_type))
6886 packed.append(struct.pack("!H", self.flags))
6887 packed.append('\x00' * 4)
6888 packed.append(struct.pack("!L", self.experimenter))
6889 packed.append(struct.pack("!L", self.subtype))
6890 packed.append(loxi.generic_util.pack_list(self.entries))
6891 length = sum([len(x) for x in packed])
6892 packed[2] = struct.pack("!H", length)
6893 return ''.join(packed)
6894
6895 @staticmethod
6896 def unpack(reader):
6897 obj = bsn_table_checksum_stats_reply()
6898 _version = reader.read("!B")[0]
6899 assert(_version == 4)
6900 _type = reader.read("!B")[0]
6901 assert(_type == 19)
6902 _length = reader.read("!H")[0]
6903 orig_reader = reader
6904 reader = orig_reader.slice(_length - (2 + 2))
6905 obj.xid = reader.read("!L")[0]
6906 _stats_type = reader.read("!H")[0]
6907 assert(_stats_type == 65535)
6908 obj.flags = reader.read("!H")[0]
6909 reader.skip(4)
6910 _experimenter = reader.read("!L")[0]
6911 assert(_experimenter == 6035143)
6912 _subtype = reader.read("!L")[0]
6913 assert(_subtype == 11)
6914 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
6915 return obj
6916
6917 def __eq__(self, other):
6918 if type(self) != type(other): return False
6919 if self.xid != other.xid: return False
6920 if self.flags != other.flags: return False
6921 if self.entries != other.entries: return False
6922 return True
6923
6924 def pretty_print(self, q):
6925 q.text("bsn_table_checksum_stats_reply {")
6926 with q.group():
6927 with q.indent(2):
6928 q.breakable()
6929 q.text("xid = ");
6930 if self.xid != None:
6931 q.text("%#x" % self.xid)
6932 else:
6933 q.text('None')
6934 q.text(","); q.breakable()
6935 q.text("flags = ");
6936 q.text("%#x" % self.flags)
6937 q.text(","); q.breakable()
6938 q.text("entries = ");
6939 q.pp(self.entries)
6940 q.breakable()
6941 q.text('}')
6942
6943bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
6944
6945class bsn_table_checksum_stats_request(bsn_stats_request):
6946 version = 4
6947 type = 18
6948 stats_type = 65535
6949 experimenter = 6035143
6950 subtype = 11
6951
6952 def __init__(self, xid=None, flags=None):
6953 if xid != None:
6954 self.xid = xid
6955 else:
6956 self.xid = None
6957 if flags != None:
6958 self.flags = flags
6959 else:
6960 self.flags = 0
6961 return
6962
6963 def pack(self):
6964 packed = []
6965 packed.append(struct.pack("!B", self.version))
6966 packed.append(struct.pack("!B", self.type))
6967 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6968 packed.append(struct.pack("!L", self.xid))
6969 packed.append(struct.pack("!H", self.stats_type))
6970 packed.append(struct.pack("!H", self.flags))
6971 packed.append('\x00' * 4)
6972 packed.append(struct.pack("!L", self.experimenter))
6973 packed.append(struct.pack("!L", self.subtype))
6974 length = sum([len(x) for x in packed])
6975 packed[2] = struct.pack("!H", length)
6976 return ''.join(packed)
6977
6978 @staticmethod
6979 def unpack(reader):
6980 obj = bsn_table_checksum_stats_request()
6981 _version = reader.read("!B")[0]
6982 assert(_version == 4)
6983 _type = reader.read("!B")[0]
6984 assert(_type == 18)
6985 _length = reader.read("!H")[0]
6986 orig_reader = reader
6987 reader = orig_reader.slice(_length - (2 + 2))
6988 obj.xid = reader.read("!L")[0]
6989 _stats_type = reader.read("!H")[0]
6990 assert(_stats_type == 65535)
6991 obj.flags = reader.read("!H")[0]
6992 reader.skip(4)
6993 _experimenter = reader.read("!L")[0]
6994 assert(_experimenter == 6035143)
6995 _subtype = reader.read("!L")[0]
6996 assert(_subtype == 11)
6997 return obj
6998
6999 def __eq__(self, other):
7000 if type(self) != type(other): return False
7001 if self.xid != other.xid: return False
7002 if self.flags != other.flags: return False
7003 return True
7004
7005 def pretty_print(self, q):
7006 q.text("bsn_table_checksum_stats_request {")
7007 with q.group():
7008 with q.indent(2):
7009 q.breakable()
7010 q.text("xid = ");
7011 if self.xid != None:
7012 q.text("%#x" % self.xid)
7013 else:
7014 q.text('None')
7015 q.text(","); q.breakable()
7016 q.text("flags = ");
7017 q.text("%#x" % self.flags)
7018 q.breakable()
7019 q.text('}')
7020
7021bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
7022
7023class bsn_table_set_buckets_size(bsn_header):
7024 version = 4
7025 type = 4
7026 experimenter = 6035143
7027 subtype = 61
7028
7029 def __init__(self, xid=None, table_id=None, buckets_size=None):
7030 if xid != None:
7031 self.xid = xid
7032 else:
7033 self.xid = None
7034 if table_id != None:
7035 self.table_id = table_id
7036 else:
7037 self.table_id = 0
7038 if buckets_size != None:
7039 self.buckets_size = buckets_size
7040 else:
7041 self.buckets_size = 0
7042 return
7043
7044 def pack(self):
7045 packed = []
7046 packed.append(struct.pack("!B", self.version))
7047 packed.append(struct.pack("!B", self.type))
7048 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7049 packed.append(struct.pack("!L", self.xid))
7050 packed.append(struct.pack("!L", self.experimenter))
7051 packed.append(struct.pack("!L", self.subtype))
7052 packed.append(struct.pack("!H", self.table_id))
7053 packed.append('\x00' * 2)
7054 packed.append(struct.pack("!L", self.buckets_size))
7055 length = sum([len(x) for x in packed])
7056 packed[2] = struct.pack("!H", length)
7057 return ''.join(packed)
7058
7059 @staticmethod
7060 def unpack(reader):
7061 obj = bsn_table_set_buckets_size()
7062 _version = reader.read("!B")[0]
7063 assert(_version == 4)
7064 _type = reader.read("!B")[0]
7065 assert(_type == 4)
7066 _length = reader.read("!H")[0]
7067 orig_reader = reader
7068 reader = orig_reader.slice(_length - (2 + 2))
7069 obj.xid = reader.read("!L")[0]
7070 _experimenter = reader.read("!L")[0]
7071 assert(_experimenter == 6035143)
7072 _subtype = reader.read("!L")[0]
7073 assert(_subtype == 61)
7074 obj.table_id = reader.read("!H")[0]
7075 reader.skip(2)
7076 obj.buckets_size = reader.read("!L")[0]
7077 return obj
7078
7079 def __eq__(self, other):
7080 if type(self) != type(other): return False
7081 if self.xid != other.xid: return False
7082 if self.table_id != other.table_id: return False
7083 if self.buckets_size != other.buckets_size: return False
7084 return True
7085
7086 def pretty_print(self, q):
7087 q.text("bsn_table_set_buckets_size {")
7088 with q.group():
7089 with q.indent(2):
7090 q.breakable()
7091 q.text("xid = ");
7092 if self.xid != None:
7093 q.text("%#x" % self.xid)
7094 else:
7095 q.text('None')
7096 q.text(","); q.breakable()
7097 q.text("table_id = ");
7098 q.text("%#x" % self.table_id)
7099 q.text(","); q.breakable()
7100 q.text("buckets_size = ");
7101 q.text("%#x" % self.buckets_size)
7102 q.breakable()
7103 q.text('}')
7104
7105bsn_header.subtypes[61] = bsn_table_set_buckets_size
7106
Rich Lane7dcdf022013-12-11 14:45:27 -08007107class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007108 version = 4
7109 type = 4
7110 experimenter = 6035143
7111 subtype = 45
7112
7113 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007114 if xid != None:
7115 self.xid = xid
7116 else:
7117 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007118 if time_ms != None:
7119 self.time_ms = time_ms
7120 else:
7121 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007122 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007123
7124 def pack(self):
7125 packed = []
7126 packed.append(struct.pack("!B", self.version))
7127 packed.append(struct.pack("!B", self.type))
7128 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7129 packed.append(struct.pack("!L", self.xid))
7130 packed.append(struct.pack("!L", self.experimenter))
7131 packed.append(struct.pack("!L", self.subtype))
7132 packed.append(struct.pack("!Q", self.time_ms))
7133 length = sum([len(x) for x in packed])
7134 packed[2] = struct.pack("!H", length)
7135 return ''.join(packed)
7136
7137 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007138 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007139 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007140 _version = reader.read("!B")[0]
7141 assert(_version == 4)
7142 _type = reader.read("!B")[0]
7143 assert(_type == 4)
7144 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007145 orig_reader = reader
7146 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007147 obj.xid = reader.read("!L")[0]
7148 _experimenter = reader.read("!L")[0]
7149 assert(_experimenter == 6035143)
7150 _subtype = reader.read("!L")[0]
7151 assert(_subtype == 45)
7152 obj.time_ms = reader.read("!Q")[0]
7153 return obj
7154
7155 def __eq__(self, other):
7156 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007157 if self.xid != other.xid: return False
7158 if self.time_ms != other.time_ms: return False
7159 return True
7160
Rich Lane7b0f2012013-11-22 14:15:26 -08007161 def pretty_print(self, q):
7162 q.text("bsn_time_reply {")
7163 with q.group():
7164 with q.indent(2):
7165 q.breakable()
7166 q.text("xid = ");
7167 if self.xid != None:
7168 q.text("%#x" % self.xid)
7169 else:
7170 q.text('None')
7171 q.text(","); q.breakable()
7172 q.text("time_ms = ");
7173 q.text("%#x" % self.time_ms)
7174 q.breakable()
7175 q.text('}')
7176
Rich Lane7dcdf022013-12-11 14:45:27 -08007177bsn_header.subtypes[45] = bsn_time_reply
7178
7179class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007180 version = 4
7181 type = 4
7182 experimenter = 6035143
7183 subtype = 44
7184
7185 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007186 if xid != None:
7187 self.xid = xid
7188 else:
7189 self.xid = None
7190 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007191
7192 def pack(self):
7193 packed = []
7194 packed.append(struct.pack("!B", self.version))
7195 packed.append(struct.pack("!B", self.type))
7196 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7197 packed.append(struct.pack("!L", self.xid))
7198 packed.append(struct.pack("!L", self.experimenter))
7199 packed.append(struct.pack("!L", self.subtype))
7200 length = sum([len(x) for x in packed])
7201 packed[2] = struct.pack("!H", length)
7202 return ''.join(packed)
7203
7204 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007205 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007206 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007207 _version = reader.read("!B")[0]
7208 assert(_version == 4)
7209 _type = reader.read("!B")[0]
7210 assert(_type == 4)
7211 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007212 orig_reader = reader
7213 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007214 obj.xid = reader.read("!L")[0]
7215 _experimenter = reader.read("!L")[0]
7216 assert(_experimenter == 6035143)
7217 _subtype = reader.read("!L")[0]
7218 assert(_subtype == 44)
7219 return obj
7220
7221 def __eq__(self, other):
7222 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007223 if self.xid != other.xid: return False
7224 return True
7225
Rich Lane7b0f2012013-11-22 14:15:26 -08007226 def pretty_print(self, q):
7227 q.text("bsn_time_request {")
7228 with q.group():
7229 with q.indent(2):
7230 q.breakable()
7231 q.text("xid = ");
7232 if self.xid != None:
7233 q.text("%#x" % self.xid)
7234 else:
7235 q.text('None')
7236 q.breakable()
7237 q.text('}')
7238
Rich Lane7dcdf022013-12-11 14:45:27 -08007239bsn_header.subtypes[44] = bsn_time_request
7240
7241class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007242 version = 4
7243 type = 4
7244 experimenter = 6035143
7245 subtype = 16
7246
7247 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007248 if xid != None:
7249 self.xid = xid
7250 else:
7251 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007252 if status != None:
7253 self.status = status
7254 else:
7255 self.status = 0
7256 if vport_no != None:
7257 self.vport_no = vport_no
7258 else:
7259 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007260 return
Dan Talaycof6202252013-07-02 01:00:29 -07007261
7262 def pack(self):
7263 packed = []
7264 packed.append(struct.pack("!B", self.version))
7265 packed.append(struct.pack("!B", self.type))
7266 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7267 packed.append(struct.pack("!L", self.xid))
7268 packed.append(struct.pack("!L", self.experimenter))
7269 packed.append(struct.pack("!L", self.subtype))
7270 packed.append(struct.pack("!L", self.status))
7271 packed.append(struct.pack("!L", self.vport_no))
7272 length = sum([len(x) for x in packed])
7273 packed[2] = struct.pack("!H", length)
7274 return ''.join(packed)
7275
7276 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007277 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007278 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007279 _version = reader.read("!B")[0]
7280 assert(_version == 4)
7281 _type = reader.read("!B")[0]
7282 assert(_type == 4)
7283 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007284 orig_reader = reader
7285 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007286 obj.xid = reader.read("!L")[0]
7287 _experimenter = reader.read("!L")[0]
7288 assert(_experimenter == 6035143)
7289 _subtype = reader.read("!L")[0]
7290 assert(_subtype == 16)
7291 obj.status = reader.read("!L")[0]
7292 obj.vport_no = reader.read("!L")[0]
7293 return obj
7294
7295 def __eq__(self, other):
7296 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007297 if self.xid != other.xid: return False
7298 if self.status != other.status: return False
7299 if self.vport_no != other.vport_no: return False
7300 return True
7301
Dan Talaycof6202252013-07-02 01:00:29 -07007302 def pretty_print(self, q):
7303 q.text("bsn_virtual_port_create_reply {")
7304 with q.group():
7305 with q.indent(2):
7306 q.breakable()
7307 q.text("xid = ");
7308 if self.xid != None:
7309 q.text("%#x" % self.xid)
7310 else:
7311 q.text('None')
7312 q.text(","); q.breakable()
7313 q.text("status = ");
7314 q.text("%#x" % self.status)
7315 q.text(","); q.breakable()
7316 q.text("vport_no = ");
7317 q.text("%#x" % self.vport_no)
7318 q.breakable()
7319 q.text('}')
7320
Rich Lane7dcdf022013-12-11 14:45:27 -08007321bsn_header.subtypes[16] = bsn_virtual_port_create_reply
7322
7323class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007324 version = 4
7325 type = 4
7326 experimenter = 6035143
7327 subtype = 15
7328
7329 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007330 if xid != None:
7331 self.xid = xid
7332 else:
7333 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007334 if vport != None:
7335 self.vport = vport
7336 else:
7337 self.vport = common.bsn_vport_q_in_q()
Rich Lane7dcdf022013-12-11 14:45:27 -08007338 return
Dan Talaycof6202252013-07-02 01:00:29 -07007339
7340 def pack(self):
7341 packed = []
7342 packed.append(struct.pack("!B", self.version))
7343 packed.append(struct.pack("!B", self.type))
7344 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7345 packed.append(struct.pack("!L", self.xid))
7346 packed.append(struct.pack("!L", self.experimenter))
7347 packed.append(struct.pack("!L", self.subtype))
7348 packed.append(self.vport.pack())
7349 length = sum([len(x) for x in packed])
7350 packed[2] = struct.pack("!H", length)
7351 return ''.join(packed)
7352
7353 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007354 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007355 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007356 _version = reader.read("!B")[0]
7357 assert(_version == 4)
7358 _type = reader.read("!B")[0]
7359 assert(_type == 4)
7360 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007361 orig_reader = reader
7362 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007363 obj.xid = reader.read("!L")[0]
7364 _experimenter = reader.read("!L")[0]
7365 assert(_experimenter == 6035143)
7366 _subtype = reader.read("!L")[0]
7367 assert(_subtype == 15)
7368 obj.vport = common.bsn_vport_q_in_q.unpack(reader)
7369 return obj
7370
7371 def __eq__(self, other):
7372 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007373 if self.xid != other.xid: return False
7374 if self.vport != other.vport: return False
7375 return True
7376
Dan Talaycof6202252013-07-02 01:00:29 -07007377 def pretty_print(self, q):
7378 q.text("bsn_virtual_port_create_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("vport = ");
7389 q.pp(self.vport)
7390 q.breakable()
7391 q.text('}')
7392
Rich Lane7dcdf022013-12-11 14:45:27 -08007393bsn_header.subtypes[15] = bsn_virtual_port_create_request
7394
7395class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007396 version = 4
7397 type = 4
7398 experimenter = 6035143
7399 subtype = 26
7400
7401 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007402 if xid != None:
7403 self.xid = xid
7404 else:
7405 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007406 if status != None:
7407 self.status = status
7408 else:
7409 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007410 return
Dan Talaycof6202252013-07-02 01:00:29 -07007411
7412 def pack(self):
7413 packed = []
7414 packed.append(struct.pack("!B", self.version))
7415 packed.append(struct.pack("!B", self.type))
7416 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7417 packed.append(struct.pack("!L", self.xid))
7418 packed.append(struct.pack("!L", self.experimenter))
7419 packed.append(struct.pack("!L", self.subtype))
7420 packed.append(struct.pack("!L", self.status))
7421 length = sum([len(x) for x in packed])
7422 packed[2] = struct.pack("!H", length)
7423 return ''.join(packed)
7424
7425 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007426 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007427 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007428 _version = reader.read("!B")[0]
7429 assert(_version == 4)
7430 _type = reader.read("!B")[0]
7431 assert(_type == 4)
7432 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007433 orig_reader = reader
7434 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007435 obj.xid = reader.read("!L")[0]
7436 _experimenter = reader.read("!L")[0]
7437 assert(_experimenter == 6035143)
7438 _subtype = reader.read("!L")[0]
7439 assert(_subtype == 26)
7440 obj.status = reader.read("!L")[0]
7441 return obj
7442
7443 def __eq__(self, other):
7444 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007445 if self.xid != other.xid: return False
7446 if self.status != other.status: return False
7447 return True
7448
Dan Talaycof6202252013-07-02 01:00:29 -07007449 def pretty_print(self, q):
7450 q.text("bsn_virtual_port_remove_reply {")
7451 with q.group():
7452 with q.indent(2):
7453 q.breakable()
7454 q.text("xid = ");
7455 if self.xid != None:
7456 q.text("%#x" % self.xid)
7457 else:
7458 q.text('None')
7459 q.text(","); q.breakable()
7460 q.text("status = ");
7461 q.text("%#x" % self.status)
7462 q.breakable()
7463 q.text('}')
7464
Rich Lane7dcdf022013-12-11 14:45:27 -08007465bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
7466
7467class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007468 version = 4
7469 type = 4
7470 experimenter = 6035143
7471 subtype = 17
7472
7473 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007474 if xid != None:
7475 self.xid = xid
7476 else:
7477 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007478 if vport_no != None:
7479 self.vport_no = vport_no
7480 else:
7481 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007482 return
Dan Talaycof6202252013-07-02 01:00:29 -07007483
7484 def pack(self):
7485 packed = []
7486 packed.append(struct.pack("!B", self.version))
7487 packed.append(struct.pack("!B", self.type))
7488 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7489 packed.append(struct.pack("!L", self.xid))
7490 packed.append(struct.pack("!L", self.experimenter))
7491 packed.append(struct.pack("!L", self.subtype))
7492 packed.append(struct.pack("!L", self.vport_no))
7493 length = sum([len(x) for x in packed])
7494 packed[2] = struct.pack("!H", length)
7495 return ''.join(packed)
7496
7497 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007498 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007499 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007500 _version = reader.read("!B")[0]
7501 assert(_version == 4)
7502 _type = reader.read("!B")[0]
7503 assert(_type == 4)
7504 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007505 orig_reader = reader
7506 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007507 obj.xid = reader.read("!L")[0]
7508 _experimenter = reader.read("!L")[0]
7509 assert(_experimenter == 6035143)
7510 _subtype = reader.read("!L")[0]
7511 assert(_subtype == 17)
7512 obj.vport_no = reader.read("!L")[0]
7513 return obj
7514
7515 def __eq__(self, other):
7516 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007517 if self.xid != other.xid: return False
7518 if self.vport_no != other.vport_no: return False
7519 return True
7520
Dan Talaycof6202252013-07-02 01:00:29 -07007521 def pretty_print(self, q):
7522 q.text("bsn_virtual_port_remove_request {")
7523 with q.group():
7524 with q.indent(2):
7525 q.breakable()
7526 q.text("xid = ");
7527 if self.xid != None:
7528 q.text("%#x" % self.xid)
7529 else:
7530 q.text('None')
7531 q.text(","); q.breakable()
7532 q.text("vport_no = ");
7533 q.text("%#x" % self.vport_no)
7534 q.breakable()
7535 q.text('}')
7536
Rich Lane7dcdf022013-12-11 14:45:27 -08007537bsn_header.subtypes[17] = bsn_virtual_port_remove_request
7538
7539class bsn_vlan_counter_stats_reply(bsn_stats_reply):
7540 version = 4
7541 type = 19
7542 stats_type = 65535
7543 experimenter = 6035143
7544 subtype = 9
7545
7546 def __init__(self, xid=None, flags=None, entries=None):
7547 if xid != None:
7548 self.xid = xid
7549 else:
7550 self.xid = None
7551 if flags != None:
7552 self.flags = flags
7553 else:
7554 self.flags = 0
7555 if entries != None:
7556 self.entries = entries
7557 else:
7558 self.entries = []
7559 return
7560
7561 def pack(self):
7562 packed = []
7563 packed.append(struct.pack("!B", self.version))
7564 packed.append(struct.pack("!B", self.type))
7565 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7566 packed.append(struct.pack("!L", self.xid))
7567 packed.append(struct.pack("!H", self.stats_type))
7568 packed.append(struct.pack("!H", self.flags))
7569 packed.append('\x00' * 4)
7570 packed.append(struct.pack("!L", self.experimenter))
7571 packed.append(struct.pack("!L", self.subtype))
7572 packed.append(loxi.generic_util.pack_list(self.entries))
7573 length = sum([len(x) for x in packed])
7574 packed[2] = struct.pack("!H", length)
7575 return ''.join(packed)
7576
7577 @staticmethod
7578 def unpack(reader):
7579 obj = bsn_vlan_counter_stats_reply()
7580 _version = reader.read("!B")[0]
7581 assert(_version == 4)
7582 _type = reader.read("!B")[0]
7583 assert(_type == 19)
7584 _length = reader.read("!H")[0]
7585 orig_reader = reader
7586 reader = orig_reader.slice(_length - (2 + 2))
7587 obj.xid = reader.read("!L")[0]
7588 _stats_type = reader.read("!H")[0]
7589 assert(_stats_type == 65535)
7590 obj.flags = reader.read("!H")[0]
7591 reader.skip(4)
7592 _experimenter = reader.read("!L")[0]
7593 assert(_experimenter == 6035143)
7594 _subtype = reader.read("!L")[0]
7595 assert(_subtype == 9)
7596 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
7597 return obj
7598
7599 def __eq__(self, other):
7600 if type(self) != type(other): return False
7601 if self.xid != other.xid: return False
7602 if self.flags != other.flags: return False
7603 if self.entries != other.entries: return False
7604 return True
7605
7606 def pretty_print(self, q):
7607 q.text("bsn_vlan_counter_stats_reply {")
7608 with q.group():
7609 with q.indent(2):
7610 q.breakable()
7611 q.text("xid = ");
7612 if self.xid != None:
7613 q.text("%#x" % self.xid)
7614 else:
7615 q.text('None')
7616 q.text(","); q.breakable()
7617 q.text("flags = ");
7618 q.text("%#x" % self.flags)
7619 q.text(","); q.breakable()
7620 q.text("entries = ");
7621 q.pp(self.entries)
7622 q.breakable()
7623 q.text('}')
7624
7625bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
7626
7627class bsn_vlan_counter_stats_request(bsn_stats_request):
7628 version = 4
7629 type = 18
7630 stats_type = 65535
7631 experimenter = 6035143
7632 subtype = 9
7633
7634 def __init__(self, xid=None, flags=None, vlan_vid=None):
7635 if xid != None:
7636 self.xid = xid
7637 else:
7638 self.xid = None
7639 if flags != None:
7640 self.flags = flags
7641 else:
7642 self.flags = 0
7643 if vlan_vid != None:
7644 self.vlan_vid = vlan_vid
7645 else:
7646 self.vlan_vid = 0
7647 return
7648
7649 def pack(self):
7650 packed = []
7651 packed.append(struct.pack("!B", self.version))
7652 packed.append(struct.pack("!B", self.type))
7653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7654 packed.append(struct.pack("!L", self.xid))
7655 packed.append(struct.pack("!H", self.stats_type))
7656 packed.append(struct.pack("!H", self.flags))
7657 packed.append('\x00' * 4)
7658 packed.append(struct.pack("!L", self.experimenter))
7659 packed.append(struct.pack("!L", self.subtype))
7660 packed.append(struct.pack("!H", self.vlan_vid))
7661 length = sum([len(x) for x in packed])
7662 packed[2] = struct.pack("!H", length)
7663 return ''.join(packed)
7664
7665 @staticmethod
7666 def unpack(reader):
7667 obj = bsn_vlan_counter_stats_request()
7668 _version = reader.read("!B")[0]
7669 assert(_version == 4)
7670 _type = reader.read("!B")[0]
7671 assert(_type == 18)
7672 _length = reader.read("!H")[0]
7673 orig_reader = reader
7674 reader = orig_reader.slice(_length - (2 + 2))
7675 obj.xid = reader.read("!L")[0]
7676 _stats_type = reader.read("!H")[0]
7677 assert(_stats_type == 65535)
7678 obj.flags = reader.read("!H")[0]
7679 reader.skip(4)
7680 _experimenter = reader.read("!L")[0]
7681 assert(_experimenter == 6035143)
7682 _subtype = reader.read("!L")[0]
7683 assert(_subtype == 9)
7684 obj.vlan_vid = reader.read("!H")[0]
7685 return obj
7686
7687 def __eq__(self, other):
7688 if type(self) != type(other): return False
7689 if self.xid != other.xid: return False
7690 if self.flags != other.flags: return False
7691 if self.vlan_vid != other.vlan_vid: return False
7692 return True
7693
7694 def pretty_print(self, q):
7695 q.text("bsn_vlan_counter_stats_request {")
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("flags = ");
7706 q.text("%#x" % self.flags)
7707 q.text(","); q.breakable()
7708 q.text("vlan_vid = ");
7709 q.text("%#x" % self.vlan_vid)
7710 q.breakable()
7711 q.text('}')
7712
7713bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
7714
7715class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007716 version = 4
7717 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007718 stats_type = 0
7719
7720 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 -08007721 if xid != None:
7722 self.xid = xid
7723 else:
7724 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007725 if flags != None:
7726 self.flags = flags
7727 else:
7728 self.flags = 0
7729 if mfr_desc != None:
7730 self.mfr_desc = mfr_desc
7731 else:
7732 self.mfr_desc = ""
7733 if hw_desc != None:
7734 self.hw_desc = hw_desc
7735 else:
7736 self.hw_desc = ""
7737 if sw_desc != None:
7738 self.sw_desc = sw_desc
7739 else:
7740 self.sw_desc = ""
7741 if serial_num != None:
7742 self.serial_num = serial_num
7743 else:
7744 self.serial_num = ""
7745 if dp_desc != None:
7746 self.dp_desc = dp_desc
7747 else:
7748 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08007749 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007750
7751 def pack(self):
7752 packed = []
7753 packed.append(struct.pack("!B", self.version))
7754 packed.append(struct.pack("!B", self.type))
7755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7756 packed.append(struct.pack("!L", self.xid))
7757 packed.append(struct.pack("!H", self.stats_type))
7758 packed.append(struct.pack("!H", self.flags))
7759 packed.append('\x00' * 4)
7760 packed.append(struct.pack("!256s", self.mfr_desc))
7761 packed.append(struct.pack("!256s", self.hw_desc))
7762 packed.append(struct.pack("!256s", self.sw_desc))
7763 packed.append(struct.pack("!32s", self.serial_num))
7764 packed.append(struct.pack("!256s", self.dp_desc))
7765 length = sum([len(x) for x in packed])
7766 packed[2] = struct.pack("!H", length)
7767 return ''.join(packed)
7768
7769 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007770 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007771 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007772 _version = reader.read("!B")[0]
7773 assert(_version == 4)
7774 _type = reader.read("!B")[0]
7775 assert(_type == 19)
7776 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007777 orig_reader = reader
7778 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007779 obj.xid = reader.read("!L")[0]
7780 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007781 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007782 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007783 reader.skip(4)
7784 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
7785 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
7786 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
7787 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
7788 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
7789 return obj
7790
7791 def __eq__(self, other):
7792 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007793 if self.xid != other.xid: return False
7794 if self.flags != other.flags: return False
7795 if self.mfr_desc != other.mfr_desc: return False
7796 if self.hw_desc != other.hw_desc: return False
7797 if self.sw_desc != other.sw_desc: return False
7798 if self.serial_num != other.serial_num: return False
7799 if self.dp_desc != other.dp_desc: return False
7800 return True
7801
Rich Lanec2ee4b82013-04-24 17:12:38 -07007802 def pretty_print(self, q):
7803 q.text("desc_stats_reply {")
7804 with q.group():
7805 with q.indent(2):
7806 q.breakable()
7807 q.text("xid = ");
7808 if self.xid != None:
7809 q.text("%#x" % self.xid)
7810 else:
7811 q.text('None')
7812 q.text(","); q.breakable()
7813 q.text("flags = ");
7814 q.text("%#x" % self.flags)
7815 q.text(","); q.breakable()
7816 q.text("mfr_desc = ");
7817 q.pp(self.mfr_desc)
7818 q.text(","); q.breakable()
7819 q.text("hw_desc = ");
7820 q.pp(self.hw_desc)
7821 q.text(","); q.breakable()
7822 q.text("sw_desc = ");
7823 q.pp(self.sw_desc)
7824 q.text(","); q.breakable()
7825 q.text("serial_num = ");
7826 q.pp(self.serial_num)
7827 q.text(","); q.breakable()
7828 q.text("dp_desc = ");
7829 q.pp(self.dp_desc)
7830 q.breakable()
7831 q.text('}')
7832
Rich Lane7dcdf022013-12-11 14:45:27 -08007833stats_reply.subtypes[0] = desc_stats_reply
7834
7835class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007836 version = 4
7837 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007838 stats_type = 0
7839
7840 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007841 if xid != None:
7842 self.xid = xid
7843 else:
7844 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007845 if flags != None:
7846 self.flags = flags
7847 else:
7848 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007849 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007850
7851 def pack(self):
7852 packed = []
7853 packed.append(struct.pack("!B", self.version))
7854 packed.append(struct.pack("!B", self.type))
7855 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7856 packed.append(struct.pack("!L", self.xid))
7857 packed.append(struct.pack("!H", self.stats_type))
7858 packed.append(struct.pack("!H", self.flags))
7859 packed.append('\x00' * 4)
7860 length = sum([len(x) for x in packed])
7861 packed[2] = struct.pack("!H", length)
7862 return ''.join(packed)
7863
7864 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007865 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007866 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007867 _version = reader.read("!B")[0]
7868 assert(_version == 4)
7869 _type = reader.read("!B")[0]
7870 assert(_type == 18)
7871 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007872 orig_reader = reader
7873 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007874 obj.xid = reader.read("!L")[0]
7875 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007876 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007877 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007878 reader.skip(4)
7879 return obj
7880
7881 def __eq__(self, other):
7882 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007883 if self.xid != other.xid: return False
7884 if self.flags != other.flags: return False
7885 return True
7886
Rich Lanec2ee4b82013-04-24 17:12:38 -07007887 def pretty_print(self, q):
7888 q.text("desc_stats_request {")
7889 with q.group():
7890 with q.indent(2):
7891 q.breakable()
7892 q.text("xid = ");
7893 if self.xid != None:
7894 q.text("%#x" % self.xid)
7895 else:
7896 q.text('None')
7897 q.text(","); q.breakable()
7898 q.text("flags = ");
7899 q.text("%#x" % self.flags)
7900 q.breakable()
7901 q.text('}')
7902
Rich Lane7dcdf022013-12-11 14:45:27 -08007903stats_request.subtypes[0] = desc_stats_request
7904
7905class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007906 version = 4
7907 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007908
7909 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007910 if xid != None:
7911 self.xid = xid
7912 else:
7913 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007914 if data != None:
7915 self.data = data
7916 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007917 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007918 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007919
7920 def pack(self):
7921 packed = []
7922 packed.append(struct.pack("!B", self.version))
7923 packed.append(struct.pack("!B", self.type))
7924 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7925 packed.append(struct.pack("!L", self.xid))
7926 packed.append(self.data)
7927 length = sum([len(x) for x in packed])
7928 packed[2] = struct.pack("!H", length)
7929 return ''.join(packed)
7930
7931 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007932 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007933 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007934 _version = reader.read("!B")[0]
7935 assert(_version == 4)
7936 _type = reader.read("!B")[0]
7937 assert(_type == 3)
7938 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007939 orig_reader = reader
7940 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007941 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007942 obj.data = str(reader.read_all())
7943 return obj
7944
7945 def __eq__(self, other):
7946 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007947 if self.xid != other.xid: return False
7948 if self.data != other.data: return False
7949 return True
7950
Rich Lanec2ee4b82013-04-24 17:12:38 -07007951 def pretty_print(self, q):
7952 q.text("echo_reply {")
7953 with q.group():
7954 with q.indent(2):
7955 q.breakable()
7956 q.text("xid = ");
7957 if self.xid != None:
7958 q.text("%#x" % self.xid)
7959 else:
7960 q.text('None')
7961 q.text(","); q.breakable()
7962 q.text("data = ");
7963 q.pp(self.data)
7964 q.breakable()
7965 q.text('}')
7966
Rich Lane7dcdf022013-12-11 14:45:27 -08007967message.subtypes[3] = echo_reply
7968
7969class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007970 version = 4
7971 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07007972
7973 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007974 if xid != None:
7975 self.xid = xid
7976 else:
7977 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007978 if data != None:
7979 self.data = data
7980 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007981 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007982 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007983
7984 def pack(self):
7985 packed = []
7986 packed.append(struct.pack("!B", self.version))
7987 packed.append(struct.pack("!B", self.type))
7988 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7989 packed.append(struct.pack("!L", self.xid))
7990 packed.append(self.data)
7991 length = sum([len(x) for x in packed])
7992 packed[2] = struct.pack("!H", length)
7993 return ''.join(packed)
7994
7995 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007996 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007997 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007998 _version = reader.read("!B")[0]
7999 assert(_version == 4)
8000 _type = reader.read("!B")[0]
8001 assert(_type == 2)
8002 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008003 orig_reader = reader
8004 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008005 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008006 obj.data = str(reader.read_all())
8007 return obj
8008
8009 def __eq__(self, other):
8010 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008011 if self.xid != other.xid: return False
8012 if self.data != other.data: return False
8013 return True
8014
Rich Lanec2ee4b82013-04-24 17:12:38 -07008015 def pretty_print(self, q):
8016 q.text("echo_request {")
8017 with q.group():
8018 with q.indent(2):
8019 q.breakable()
8020 q.text("xid = ");
8021 if self.xid != None:
8022 q.text("%#x" % self.xid)
8023 else:
8024 q.text('None')
8025 q.text(","); q.breakable()
8026 q.text("data = ");
8027 q.pp(self.data)
8028 q.breakable()
8029 q.text('}')
8030
Rich Lane7dcdf022013-12-11 14:45:27 -08008031message.subtypes[2] = echo_request
8032
8033class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07008034 version = 4
8035 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07008036 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07008037
Rich Lane6f4978c2013-10-20 21:33:52 -07008038 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008039 if xid != None:
8040 self.xid = xid
8041 else:
8042 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008043 if subtype != None:
8044 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07008045 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07008046 self.subtype = 0
8047 if experimenter != None:
8048 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07008049 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07008050 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07008051 if data != None:
8052 self.data = data
8053 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008054 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008055 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008056
8057 def pack(self):
8058 packed = []
8059 packed.append(struct.pack("!B", self.version))
8060 packed.append(struct.pack("!B", self.type))
8061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8062 packed.append(struct.pack("!L", self.xid))
8063 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07008064 packed.append(struct.pack("!H", self.subtype))
8065 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008066 packed.append(self.data)
8067 length = sum([len(x) for x in packed])
8068 packed[2] = struct.pack("!H", length)
8069 return ''.join(packed)
8070
8071 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008072 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07008073 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07008074 _version = reader.read("!B")[0]
8075 assert(_version == 4)
8076 _type = reader.read("!B")[0]
8077 assert(_type == 1)
8078 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008079 orig_reader = reader
8080 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008081 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07008082 _err_type = reader.read("!H")[0]
8083 assert(_err_type == 65535)
8084 obj.subtype = reader.read("!H")[0]
8085 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008086 obj.data = str(reader.read_all())
8087 return obj
8088
8089 def __eq__(self, other):
8090 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008091 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07008092 if self.subtype != other.subtype: return False
8093 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008094 if self.data != other.data: return False
8095 return True
8096
Rich Lanec2ee4b82013-04-24 17:12:38 -07008097 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07008098 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07008099 with q.group():
8100 with q.indent(2):
8101 q.breakable()
8102 q.text("xid = ");
8103 if self.xid != None:
8104 q.text("%#x" % self.xid)
8105 else:
8106 q.text('None')
8107 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07008108 q.text("subtype = ");
8109 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008110 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07008111 q.text("experimenter = ");
8112 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008113 q.text(","); q.breakable()
8114 q.text("data = ");
8115 q.pp(self.data)
8116 q.breakable()
8117 q.text('}')
8118
Rich Lane7dcdf022013-12-11 14:45:27 -08008119error_msg.subtypes[65535] = experimenter_error_msg
8120
8121class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008122 version = 4
8123 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07008124
8125 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 -08008126 if xid != None:
8127 self.xid = xid
8128 else:
8129 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008130 if datapath_id != None:
8131 self.datapath_id = datapath_id
8132 else:
8133 self.datapath_id = 0
8134 if n_buffers != None:
8135 self.n_buffers = n_buffers
8136 else:
8137 self.n_buffers = 0
8138 if n_tables != None:
8139 self.n_tables = n_tables
8140 else:
8141 self.n_tables = 0
8142 if auxiliary_id != None:
8143 self.auxiliary_id = auxiliary_id
8144 else:
8145 self.auxiliary_id = 0
8146 if capabilities != None:
8147 self.capabilities = capabilities
8148 else:
8149 self.capabilities = 0
8150 if reserved != None:
8151 self.reserved = reserved
8152 else:
8153 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008154 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008155
8156 def pack(self):
8157 packed = []
8158 packed.append(struct.pack("!B", self.version))
8159 packed.append(struct.pack("!B", self.type))
8160 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8161 packed.append(struct.pack("!L", self.xid))
8162 packed.append(struct.pack("!Q", self.datapath_id))
8163 packed.append(struct.pack("!L", self.n_buffers))
8164 packed.append(struct.pack("!B", self.n_tables))
8165 packed.append(struct.pack("!B", self.auxiliary_id))
8166 packed.append('\x00' * 2)
8167 packed.append(struct.pack("!L", self.capabilities))
8168 packed.append(struct.pack("!L", self.reserved))
8169 length = sum([len(x) for x in packed])
8170 packed[2] = struct.pack("!H", length)
8171 return ''.join(packed)
8172
8173 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008174 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008175 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008176 _version = reader.read("!B")[0]
8177 assert(_version == 4)
8178 _type = reader.read("!B")[0]
8179 assert(_type == 6)
8180 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008181 orig_reader = reader
8182 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008183 obj.xid = reader.read("!L")[0]
8184 obj.datapath_id = reader.read("!Q")[0]
8185 obj.n_buffers = reader.read("!L")[0]
8186 obj.n_tables = reader.read("!B")[0]
8187 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008188 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07008189 obj.capabilities = reader.read("!L")[0]
8190 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008191 return obj
8192
8193 def __eq__(self, other):
8194 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008195 if self.xid != other.xid: return False
8196 if self.datapath_id != other.datapath_id: return False
8197 if self.n_buffers != other.n_buffers: return False
8198 if self.n_tables != other.n_tables: return False
8199 if self.auxiliary_id != other.auxiliary_id: return False
8200 if self.capabilities != other.capabilities: return False
8201 if self.reserved != other.reserved: return False
8202 return True
8203
Rich Lanec2ee4b82013-04-24 17:12:38 -07008204 def pretty_print(self, q):
8205 q.text("features_reply {")
8206 with q.group():
8207 with q.indent(2):
8208 q.breakable()
8209 q.text("xid = ");
8210 if self.xid != None:
8211 q.text("%#x" % self.xid)
8212 else:
8213 q.text('None')
8214 q.text(","); q.breakable()
8215 q.text("datapath_id = ");
8216 q.text("%#x" % self.datapath_id)
8217 q.text(","); q.breakable()
8218 q.text("n_buffers = ");
8219 q.text("%#x" % self.n_buffers)
8220 q.text(","); q.breakable()
8221 q.text("n_tables = ");
8222 q.text("%#x" % self.n_tables)
8223 q.text(","); q.breakable()
8224 q.text("auxiliary_id = ");
8225 q.text("%#x" % self.auxiliary_id)
8226 q.text(","); q.breakable()
8227 q.text("capabilities = ");
8228 q.text("%#x" % self.capabilities)
8229 q.text(","); q.breakable()
8230 q.text("reserved = ");
8231 q.text("%#x" % self.reserved)
8232 q.breakable()
8233 q.text('}')
8234
Rich Lane7dcdf022013-12-11 14:45:27 -08008235message.subtypes[6] = features_reply
8236
8237class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008238 version = 4
8239 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07008240
8241 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008242 if xid != None:
8243 self.xid = xid
8244 else:
8245 self.xid = None
8246 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008247
8248 def pack(self):
8249 packed = []
8250 packed.append(struct.pack("!B", self.version))
8251 packed.append(struct.pack("!B", self.type))
8252 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8253 packed.append(struct.pack("!L", self.xid))
8254 length = sum([len(x) for x in packed])
8255 packed[2] = struct.pack("!H", length)
8256 return ''.join(packed)
8257
8258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008259 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008260 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008261 _version = reader.read("!B")[0]
8262 assert(_version == 4)
8263 _type = reader.read("!B")[0]
8264 assert(_type == 5)
8265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008266 orig_reader = reader
8267 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008268 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008269 return obj
8270
8271 def __eq__(self, other):
8272 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008273 if self.xid != other.xid: return False
8274 return True
8275
Rich Lanec2ee4b82013-04-24 17:12:38 -07008276 def pretty_print(self, q):
8277 q.text("features_request {")
8278 with q.group():
8279 with q.indent(2):
8280 q.breakable()
8281 q.text("xid = ");
8282 if self.xid != None:
8283 q.text("%#x" % self.xid)
8284 else:
8285 q.text('None')
8286 q.breakable()
8287 q.text('}')
8288
Rich Lane7dcdf022013-12-11 14:45:27 -08008289message.subtypes[5] = features_request
8290
8291class flow_mod(message):
8292 subtypes = {}
8293
Rich Lane95f7fc92014-01-27 17:08:16 -08008294 version = 4
8295 type = 14
8296
8297 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):
8298 if xid != None:
8299 self.xid = xid
8300 else:
8301 self.xid = None
8302 if cookie != None:
8303 self.cookie = cookie
8304 else:
8305 self.cookie = 0
8306 if cookie_mask != None:
8307 self.cookie_mask = cookie_mask
8308 else:
8309 self.cookie_mask = 0
8310 if table_id != None:
8311 self.table_id = table_id
8312 else:
8313 self.table_id = 0
8314 if _command != None:
8315 self._command = _command
8316 else:
8317 self._command = 0
8318 if idle_timeout != None:
8319 self.idle_timeout = idle_timeout
8320 else:
8321 self.idle_timeout = 0
8322 if hard_timeout != None:
8323 self.hard_timeout = hard_timeout
8324 else:
8325 self.hard_timeout = 0
8326 if priority != None:
8327 self.priority = priority
8328 else:
8329 self.priority = 0
8330 if buffer_id != None:
8331 self.buffer_id = buffer_id
8332 else:
8333 self.buffer_id = 0
8334 if out_port != None:
8335 self.out_port = out_port
8336 else:
8337 self.out_port = 0
8338 if out_group != None:
8339 self.out_group = out_group
8340 else:
8341 self.out_group = 0
8342 if flags != None:
8343 self.flags = flags
8344 else:
8345 self.flags = 0
8346 if match != None:
8347 self.match = match
8348 else:
8349 self.match = common.match()
8350 if instructions != None:
8351 self.instructions = instructions
8352 else:
8353 self.instructions = []
8354 return
8355
8356 def pack(self):
8357 packed = []
8358 packed.append(struct.pack("!B", self.version))
8359 packed.append(struct.pack("!B", self.type))
8360 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8361 packed.append(struct.pack("!L", self.xid))
8362 packed.append(struct.pack("!Q", self.cookie))
8363 packed.append(struct.pack("!Q", self.cookie_mask))
8364 packed.append(struct.pack("!B", self.table_id))
8365 packed.append(util.pack_fm_cmd(self._command))
8366 packed.append(struct.pack("!H", self.idle_timeout))
8367 packed.append(struct.pack("!H", self.hard_timeout))
8368 packed.append(struct.pack("!H", self.priority))
8369 packed.append(struct.pack("!L", self.buffer_id))
8370 packed.append(util.pack_port_no(self.out_port))
8371 packed.append(struct.pack("!L", self.out_group))
8372 packed.append(struct.pack("!H", self.flags))
8373 packed.append('\x00' * 2)
8374 packed.append(self.match.pack())
8375 packed.append(loxi.generic_util.pack_list(self.instructions))
8376 length = sum([len(x) for x in packed])
8377 packed[2] = struct.pack("!H", length)
8378 return ''.join(packed)
8379
Rich Lane7dcdf022013-12-11 14:45:27 -08008380 @staticmethod
8381 def unpack(reader):
8382 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08008383 subclass = flow_mod.subtypes.get(subtype)
8384 if subclass:
8385 return subclass.unpack(reader)
8386
8387 obj = flow_mod()
8388 _version = reader.read("!B")[0]
8389 assert(_version == 4)
8390 _type = reader.read("!B")[0]
8391 assert(_type == 14)
8392 _length = reader.read("!H")[0]
8393 orig_reader = reader
8394 reader = orig_reader.slice(_length - (2 + 2))
8395 obj.xid = reader.read("!L")[0]
8396 obj.cookie = reader.read("!Q")[0]
8397 obj.cookie_mask = reader.read("!Q")[0]
8398 obj.table_id = reader.read("!B")[0]
8399 obj._command = util.unpack_fm_cmd(reader)
8400 obj.idle_timeout = reader.read("!H")[0]
8401 obj.hard_timeout = reader.read("!H")[0]
8402 obj.priority = reader.read("!H")[0]
8403 obj.buffer_id = reader.read("!L")[0]
8404 obj.out_port = util.unpack_port_no(reader)
8405 obj.out_group = reader.read("!L")[0]
8406 obj.flags = reader.read("!H")[0]
8407 reader.skip(2)
8408 obj.match = common.match.unpack(reader)
8409 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
8410 return obj
8411
8412 def __eq__(self, other):
8413 if type(self) != type(other): return False
8414 if self.xid != other.xid: return False
8415 if self.cookie != other.cookie: return False
8416 if self.cookie_mask != other.cookie_mask: return False
8417 if self.table_id != other.table_id: return False
8418 if self._command != other._command: return False
8419 if self.idle_timeout != other.idle_timeout: return False
8420 if self.hard_timeout != other.hard_timeout: return False
8421 if self.priority != other.priority: return False
8422 if self.buffer_id != other.buffer_id: return False
8423 if self.out_port != other.out_port: return False
8424 if self.out_group != other.out_group: return False
8425 if self.flags != other.flags: return False
8426 if self.match != other.match: return False
8427 if self.instructions != other.instructions: return False
8428 return True
8429
8430 def pretty_print(self, q):
8431 q.text("flow_mod {")
8432 with q.group():
8433 with q.indent(2):
8434 q.breakable()
8435 q.text("xid = ");
8436 if self.xid != None:
8437 q.text("%#x" % self.xid)
8438 else:
8439 q.text('None')
8440 q.text(","); q.breakable()
8441 q.text("cookie = ");
8442 q.text("%#x" % self.cookie)
8443 q.text(","); q.breakable()
8444 q.text("cookie_mask = ");
8445 q.text("%#x" % self.cookie_mask)
8446 q.text(","); q.breakable()
8447 q.text("table_id = ");
8448 q.text("%#x" % self.table_id)
8449 q.text(","); q.breakable()
8450 q.text("idle_timeout = ");
8451 q.text("%#x" % self.idle_timeout)
8452 q.text(","); q.breakable()
8453 q.text("hard_timeout = ");
8454 q.text("%#x" % self.hard_timeout)
8455 q.text(","); q.breakable()
8456 q.text("priority = ");
8457 q.text("%#x" % self.priority)
8458 q.text(","); q.breakable()
8459 q.text("buffer_id = ");
8460 q.text("%#x" % self.buffer_id)
8461 q.text(","); q.breakable()
8462 q.text("out_port = ");
8463 q.text(util.pretty_port(self.out_port))
8464 q.text(","); q.breakable()
8465 q.text("out_group = ");
8466 q.text("%#x" % self.out_group)
8467 q.text(","); q.breakable()
8468 q.text("flags = ");
8469 q.text("%#x" % self.flags)
8470 q.text(","); q.breakable()
8471 q.text("match = ");
8472 q.pp(self.match)
8473 q.text(","); q.breakable()
8474 q.text("instructions = ");
8475 q.pp(self.instructions)
8476 q.breakable()
8477 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08008478
8479message.subtypes[14] = flow_mod
8480
8481class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008482 version = 4
8483 type = 14
8484 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07008485
8486 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 -08008487 if xid != None:
8488 self.xid = xid
8489 else:
8490 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008491 if cookie != None:
8492 self.cookie = cookie
8493 else:
8494 self.cookie = 0
8495 if cookie_mask != None:
8496 self.cookie_mask = cookie_mask
8497 else:
8498 self.cookie_mask = 0
8499 if table_id != None:
8500 self.table_id = table_id
8501 else:
8502 self.table_id = 0
8503 if idle_timeout != None:
8504 self.idle_timeout = idle_timeout
8505 else:
8506 self.idle_timeout = 0
8507 if hard_timeout != None:
8508 self.hard_timeout = hard_timeout
8509 else:
8510 self.hard_timeout = 0
8511 if priority != None:
8512 self.priority = priority
8513 else:
8514 self.priority = 0
8515 if buffer_id != None:
8516 self.buffer_id = buffer_id
8517 else:
8518 self.buffer_id = 0
8519 if out_port != None:
8520 self.out_port = out_port
8521 else:
8522 self.out_port = 0
8523 if out_group != None:
8524 self.out_group = out_group
8525 else:
8526 self.out_group = 0
8527 if flags != None:
8528 self.flags = flags
8529 else:
8530 self.flags = 0
8531 if match != None:
8532 self.match = match
8533 else:
8534 self.match = common.match()
8535 if instructions != None:
8536 self.instructions = instructions
8537 else:
8538 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008539 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008540
8541 def pack(self):
8542 packed = []
8543 packed.append(struct.pack("!B", self.version))
8544 packed.append(struct.pack("!B", self.type))
8545 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8546 packed.append(struct.pack("!L", self.xid))
8547 packed.append(struct.pack("!Q", self.cookie))
8548 packed.append(struct.pack("!Q", self.cookie_mask))
8549 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008550 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008551 packed.append(struct.pack("!H", self.idle_timeout))
8552 packed.append(struct.pack("!H", self.hard_timeout))
8553 packed.append(struct.pack("!H", self.priority))
8554 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008555 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008556 packed.append(struct.pack("!L", self.out_group))
8557 packed.append(struct.pack("!H", self.flags))
8558 packed.append('\x00' * 2)
8559 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008560 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008561 length = sum([len(x) for x in packed])
8562 packed[2] = struct.pack("!H", length)
8563 return ''.join(packed)
8564
8565 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008566 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008567 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07008568 _version = reader.read("!B")[0]
8569 assert(_version == 4)
8570 _type = reader.read("!B")[0]
8571 assert(_type == 14)
8572 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008573 orig_reader = reader
8574 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008575 obj.xid = reader.read("!L")[0]
8576 obj.cookie = reader.read("!Q")[0]
8577 obj.cookie_mask = reader.read("!Q")[0]
8578 obj.table_id = reader.read("!B")[0]
8579 __command = util.unpack_fm_cmd(reader)
8580 assert(__command == 0)
8581 obj.idle_timeout = reader.read("!H")[0]
8582 obj.hard_timeout = reader.read("!H")[0]
8583 obj.priority = reader.read("!H")[0]
8584 obj.buffer_id = reader.read("!L")[0]
8585 obj.out_port = util.unpack_port_no(reader)
8586 obj.out_group = reader.read("!L")[0]
8587 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008588 reader.skip(2)
8589 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008590 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008591 return obj
8592
8593 def __eq__(self, other):
8594 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008595 if self.xid != other.xid: return False
8596 if self.cookie != other.cookie: return False
8597 if self.cookie_mask != other.cookie_mask: return False
8598 if self.table_id != other.table_id: return False
8599 if self.idle_timeout != other.idle_timeout: return False
8600 if self.hard_timeout != other.hard_timeout: return False
8601 if self.priority != other.priority: return False
8602 if self.buffer_id != other.buffer_id: return False
8603 if self.out_port != other.out_port: return False
8604 if self.out_group != other.out_group: return False
8605 if self.flags != other.flags: return False
8606 if self.match != other.match: return False
8607 if self.instructions != other.instructions: return False
8608 return True
8609
Rich Lanec2ee4b82013-04-24 17:12:38 -07008610 def pretty_print(self, q):
8611 q.text("flow_add {")
8612 with q.group():
8613 with q.indent(2):
8614 q.breakable()
8615 q.text("xid = ");
8616 if self.xid != None:
8617 q.text("%#x" % self.xid)
8618 else:
8619 q.text('None')
8620 q.text(","); q.breakable()
8621 q.text("cookie = ");
8622 q.text("%#x" % self.cookie)
8623 q.text(","); q.breakable()
8624 q.text("cookie_mask = ");
8625 q.text("%#x" % self.cookie_mask)
8626 q.text(","); q.breakable()
8627 q.text("table_id = ");
8628 q.text("%#x" % self.table_id)
8629 q.text(","); q.breakable()
8630 q.text("idle_timeout = ");
8631 q.text("%#x" % self.idle_timeout)
8632 q.text(","); q.breakable()
8633 q.text("hard_timeout = ");
8634 q.text("%#x" % self.hard_timeout)
8635 q.text(","); q.breakable()
8636 q.text("priority = ");
8637 q.text("%#x" % self.priority)
8638 q.text(","); q.breakable()
8639 q.text("buffer_id = ");
8640 q.text("%#x" % self.buffer_id)
8641 q.text(","); q.breakable()
8642 q.text("out_port = ");
8643 q.text(util.pretty_port(self.out_port))
8644 q.text(","); q.breakable()
8645 q.text("out_group = ");
8646 q.text("%#x" % self.out_group)
8647 q.text(","); q.breakable()
8648 q.text("flags = ");
8649 q.text("%#x" % self.flags)
8650 q.text(","); q.breakable()
8651 q.text("match = ");
8652 q.pp(self.match)
8653 q.text(","); q.breakable()
8654 q.text("instructions = ");
8655 q.pp(self.instructions)
8656 q.breakable()
8657 q.text('}')
8658
Rich Lane7dcdf022013-12-11 14:45:27 -08008659flow_mod.subtypes[0] = flow_add
8660
8661class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008662 version = 4
8663 type = 14
8664 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07008665
8666 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 -08008667 if xid != None:
8668 self.xid = xid
8669 else:
8670 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008671 if cookie != None:
8672 self.cookie = cookie
8673 else:
8674 self.cookie = 0
8675 if cookie_mask != None:
8676 self.cookie_mask = cookie_mask
8677 else:
8678 self.cookie_mask = 0
8679 if table_id != None:
8680 self.table_id = table_id
8681 else:
8682 self.table_id = 0
8683 if idle_timeout != None:
8684 self.idle_timeout = idle_timeout
8685 else:
8686 self.idle_timeout = 0
8687 if hard_timeout != None:
8688 self.hard_timeout = hard_timeout
8689 else:
8690 self.hard_timeout = 0
8691 if priority != None:
8692 self.priority = priority
8693 else:
8694 self.priority = 0
8695 if buffer_id != None:
8696 self.buffer_id = buffer_id
8697 else:
8698 self.buffer_id = 0
8699 if out_port != None:
8700 self.out_port = out_port
8701 else:
8702 self.out_port = 0
8703 if out_group != None:
8704 self.out_group = out_group
8705 else:
8706 self.out_group = 0
8707 if flags != None:
8708 self.flags = flags
8709 else:
8710 self.flags = 0
8711 if match != None:
8712 self.match = match
8713 else:
8714 self.match = common.match()
8715 if instructions != None:
8716 self.instructions = instructions
8717 else:
8718 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008719 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008720
8721 def pack(self):
8722 packed = []
8723 packed.append(struct.pack("!B", self.version))
8724 packed.append(struct.pack("!B", self.type))
8725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8726 packed.append(struct.pack("!L", self.xid))
8727 packed.append(struct.pack("!Q", self.cookie))
8728 packed.append(struct.pack("!Q", self.cookie_mask))
8729 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008730 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008731 packed.append(struct.pack("!H", self.idle_timeout))
8732 packed.append(struct.pack("!H", self.hard_timeout))
8733 packed.append(struct.pack("!H", self.priority))
8734 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008735 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008736 packed.append(struct.pack("!L", self.out_group))
8737 packed.append(struct.pack("!H", self.flags))
8738 packed.append('\x00' * 2)
8739 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008740 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008741 length = sum([len(x) for x in packed])
8742 packed[2] = struct.pack("!H", length)
8743 return ''.join(packed)
8744
8745 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008746 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008747 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07008748 _version = reader.read("!B")[0]
8749 assert(_version == 4)
8750 _type = reader.read("!B")[0]
8751 assert(_type == 14)
8752 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008753 orig_reader = reader
8754 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008755 obj.xid = reader.read("!L")[0]
8756 obj.cookie = reader.read("!Q")[0]
8757 obj.cookie_mask = reader.read("!Q")[0]
8758 obj.table_id = reader.read("!B")[0]
8759 __command = util.unpack_fm_cmd(reader)
8760 assert(__command == 3)
8761 obj.idle_timeout = reader.read("!H")[0]
8762 obj.hard_timeout = reader.read("!H")[0]
8763 obj.priority = reader.read("!H")[0]
8764 obj.buffer_id = reader.read("!L")[0]
8765 obj.out_port = util.unpack_port_no(reader)
8766 obj.out_group = reader.read("!L")[0]
8767 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008768 reader.skip(2)
8769 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008770 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008771 return obj
8772
8773 def __eq__(self, other):
8774 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008775 if self.xid != other.xid: return False
8776 if self.cookie != other.cookie: return False
8777 if self.cookie_mask != other.cookie_mask: return False
8778 if self.table_id != other.table_id: return False
8779 if self.idle_timeout != other.idle_timeout: return False
8780 if self.hard_timeout != other.hard_timeout: return False
8781 if self.priority != other.priority: return False
8782 if self.buffer_id != other.buffer_id: return False
8783 if self.out_port != other.out_port: return False
8784 if self.out_group != other.out_group: return False
8785 if self.flags != other.flags: return False
8786 if self.match != other.match: return False
8787 if self.instructions != other.instructions: return False
8788 return True
8789
Rich Lanec2ee4b82013-04-24 17:12:38 -07008790 def pretty_print(self, q):
8791 q.text("flow_delete {")
8792 with q.group():
8793 with q.indent(2):
8794 q.breakable()
8795 q.text("xid = ");
8796 if self.xid != None:
8797 q.text("%#x" % self.xid)
8798 else:
8799 q.text('None')
8800 q.text(","); q.breakable()
8801 q.text("cookie = ");
8802 q.text("%#x" % self.cookie)
8803 q.text(","); q.breakable()
8804 q.text("cookie_mask = ");
8805 q.text("%#x" % self.cookie_mask)
8806 q.text(","); q.breakable()
8807 q.text("table_id = ");
8808 q.text("%#x" % self.table_id)
8809 q.text(","); q.breakable()
8810 q.text("idle_timeout = ");
8811 q.text("%#x" % self.idle_timeout)
8812 q.text(","); q.breakable()
8813 q.text("hard_timeout = ");
8814 q.text("%#x" % self.hard_timeout)
8815 q.text(","); q.breakable()
8816 q.text("priority = ");
8817 q.text("%#x" % self.priority)
8818 q.text(","); q.breakable()
8819 q.text("buffer_id = ");
8820 q.text("%#x" % self.buffer_id)
8821 q.text(","); q.breakable()
8822 q.text("out_port = ");
8823 q.text(util.pretty_port(self.out_port))
8824 q.text(","); q.breakable()
8825 q.text("out_group = ");
8826 q.text("%#x" % self.out_group)
8827 q.text(","); q.breakable()
8828 q.text("flags = ");
8829 q.text("%#x" % self.flags)
8830 q.text(","); q.breakable()
8831 q.text("match = ");
8832 q.pp(self.match)
8833 q.text(","); q.breakable()
8834 q.text("instructions = ");
8835 q.pp(self.instructions)
8836 q.breakable()
8837 q.text('}')
8838
Rich Lane7dcdf022013-12-11 14:45:27 -08008839flow_mod.subtypes[3] = flow_delete
8840
8841class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008842 version = 4
8843 type = 14
8844 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07008845
8846 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 -08008847 if xid != None:
8848 self.xid = xid
8849 else:
8850 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008851 if cookie != None:
8852 self.cookie = cookie
8853 else:
8854 self.cookie = 0
8855 if cookie_mask != None:
8856 self.cookie_mask = cookie_mask
8857 else:
8858 self.cookie_mask = 0
8859 if table_id != None:
8860 self.table_id = table_id
8861 else:
8862 self.table_id = 0
8863 if idle_timeout != None:
8864 self.idle_timeout = idle_timeout
8865 else:
8866 self.idle_timeout = 0
8867 if hard_timeout != None:
8868 self.hard_timeout = hard_timeout
8869 else:
8870 self.hard_timeout = 0
8871 if priority != None:
8872 self.priority = priority
8873 else:
8874 self.priority = 0
8875 if buffer_id != None:
8876 self.buffer_id = buffer_id
8877 else:
8878 self.buffer_id = 0
8879 if out_port != None:
8880 self.out_port = out_port
8881 else:
8882 self.out_port = 0
8883 if out_group != None:
8884 self.out_group = out_group
8885 else:
8886 self.out_group = 0
8887 if flags != None:
8888 self.flags = flags
8889 else:
8890 self.flags = 0
8891 if match != None:
8892 self.match = match
8893 else:
8894 self.match = common.match()
8895 if instructions != None:
8896 self.instructions = instructions
8897 else:
8898 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008899 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008900
8901 def pack(self):
8902 packed = []
8903 packed.append(struct.pack("!B", self.version))
8904 packed.append(struct.pack("!B", self.type))
8905 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8906 packed.append(struct.pack("!L", self.xid))
8907 packed.append(struct.pack("!Q", self.cookie))
8908 packed.append(struct.pack("!Q", self.cookie_mask))
8909 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008910 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008911 packed.append(struct.pack("!H", self.idle_timeout))
8912 packed.append(struct.pack("!H", self.hard_timeout))
8913 packed.append(struct.pack("!H", self.priority))
8914 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008915 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008916 packed.append(struct.pack("!L", self.out_group))
8917 packed.append(struct.pack("!H", self.flags))
8918 packed.append('\x00' * 2)
8919 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008920 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008921 length = sum([len(x) for x in packed])
8922 packed[2] = struct.pack("!H", length)
8923 return ''.join(packed)
8924
8925 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008926 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008927 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07008928 _version = reader.read("!B")[0]
8929 assert(_version == 4)
8930 _type = reader.read("!B")[0]
8931 assert(_type == 14)
8932 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008933 orig_reader = reader
8934 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008935 obj.xid = reader.read("!L")[0]
8936 obj.cookie = reader.read("!Q")[0]
8937 obj.cookie_mask = reader.read("!Q")[0]
8938 obj.table_id = reader.read("!B")[0]
8939 __command = util.unpack_fm_cmd(reader)
8940 assert(__command == 4)
8941 obj.idle_timeout = reader.read("!H")[0]
8942 obj.hard_timeout = reader.read("!H")[0]
8943 obj.priority = reader.read("!H")[0]
8944 obj.buffer_id = reader.read("!L")[0]
8945 obj.out_port = util.unpack_port_no(reader)
8946 obj.out_group = reader.read("!L")[0]
8947 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008948 reader.skip(2)
8949 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008950 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008951 return obj
8952
8953 def __eq__(self, other):
8954 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008955 if self.xid != other.xid: return False
8956 if self.cookie != other.cookie: return False
8957 if self.cookie_mask != other.cookie_mask: return False
8958 if self.table_id != other.table_id: return False
8959 if self.idle_timeout != other.idle_timeout: return False
8960 if self.hard_timeout != other.hard_timeout: return False
8961 if self.priority != other.priority: return False
8962 if self.buffer_id != other.buffer_id: return False
8963 if self.out_port != other.out_port: return False
8964 if self.out_group != other.out_group: return False
8965 if self.flags != other.flags: return False
8966 if self.match != other.match: return False
8967 if self.instructions != other.instructions: return False
8968 return True
8969
Rich Lanec2ee4b82013-04-24 17:12:38 -07008970 def pretty_print(self, q):
8971 q.text("flow_delete_strict {")
8972 with q.group():
8973 with q.indent(2):
8974 q.breakable()
8975 q.text("xid = ");
8976 if self.xid != None:
8977 q.text("%#x" % self.xid)
8978 else:
8979 q.text('None')
8980 q.text(","); q.breakable()
8981 q.text("cookie = ");
8982 q.text("%#x" % self.cookie)
8983 q.text(","); q.breakable()
8984 q.text("cookie_mask = ");
8985 q.text("%#x" % self.cookie_mask)
8986 q.text(","); q.breakable()
8987 q.text("table_id = ");
8988 q.text("%#x" % self.table_id)
8989 q.text(","); q.breakable()
8990 q.text("idle_timeout = ");
8991 q.text("%#x" % self.idle_timeout)
8992 q.text(","); q.breakable()
8993 q.text("hard_timeout = ");
8994 q.text("%#x" % self.hard_timeout)
8995 q.text(","); q.breakable()
8996 q.text("priority = ");
8997 q.text("%#x" % self.priority)
8998 q.text(","); q.breakable()
8999 q.text("buffer_id = ");
9000 q.text("%#x" % self.buffer_id)
9001 q.text(","); q.breakable()
9002 q.text("out_port = ");
9003 q.text(util.pretty_port(self.out_port))
9004 q.text(","); q.breakable()
9005 q.text("out_group = ");
9006 q.text("%#x" % self.out_group)
9007 q.text(","); q.breakable()
9008 q.text("flags = ");
9009 q.text("%#x" % self.flags)
9010 q.text(","); q.breakable()
9011 q.text("match = ");
9012 q.pp(self.match)
9013 q.text(","); q.breakable()
9014 q.text("instructions = ");
9015 q.pp(self.instructions)
9016 q.breakable()
9017 q.text('}')
9018
Rich Lane7dcdf022013-12-11 14:45:27 -08009019flow_mod.subtypes[4] = flow_delete_strict
9020
9021class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009022 version = 4
9023 type = 1
9024 err_type = 5
9025
9026 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009027 if xid != None:
9028 self.xid = xid
9029 else:
9030 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009031 if code != None:
9032 self.code = code
9033 else:
9034 self.code = 0
9035 if data != None:
9036 self.data = data
9037 else:
9038 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009039 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009040
9041 def pack(self):
9042 packed = []
9043 packed.append(struct.pack("!B", self.version))
9044 packed.append(struct.pack("!B", self.type))
9045 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9046 packed.append(struct.pack("!L", self.xid))
9047 packed.append(struct.pack("!H", self.err_type))
9048 packed.append(struct.pack("!H", self.code))
9049 packed.append(self.data)
9050 length = sum([len(x) for x in packed])
9051 packed[2] = struct.pack("!H", length)
9052 return ''.join(packed)
9053
9054 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009055 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009056 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07009057 _version = reader.read("!B")[0]
9058 assert(_version == 4)
9059 _type = reader.read("!B")[0]
9060 assert(_type == 1)
9061 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009062 orig_reader = reader
9063 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07009064 obj.xid = reader.read("!L")[0]
9065 _err_type = reader.read("!H")[0]
9066 assert(_err_type == 5)
9067 obj.code = reader.read("!H")[0]
9068 obj.data = str(reader.read_all())
9069 return obj
9070
9071 def __eq__(self, other):
9072 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009073 if self.xid != other.xid: return False
9074 if self.code != other.code: return False
9075 if self.data != other.data: return False
9076 return True
9077
Rich Lane6f4978c2013-10-20 21:33:52 -07009078 def pretty_print(self, q):
9079 q.text("flow_mod_failed_error_msg {")
9080 with q.group():
9081 with q.indent(2):
9082 q.breakable()
9083 q.text("xid = ");
9084 if self.xid != None:
9085 q.text("%#x" % self.xid)
9086 else:
9087 q.text('None')
9088 q.text(","); q.breakable()
9089 q.text("code = ");
9090 q.text("%#x" % self.code)
9091 q.text(","); q.breakable()
9092 q.text("data = ");
9093 q.pp(self.data)
9094 q.breakable()
9095 q.text('}')
9096
Rich Lane7dcdf022013-12-11 14:45:27 -08009097error_msg.subtypes[5] = flow_mod_failed_error_msg
9098
9099class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009100 version = 4
9101 type = 14
9102 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07009103
9104 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 -08009105 if xid != None:
9106 self.xid = xid
9107 else:
9108 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009109 if cookie != None:
9110 self.cookie = cookie
9111 else:
9112 self.cookie = 0
9113 if cookie_mask != None:
9114 self.cookie_mask = cookie_mask
9115 else:
9116 self.cookie_mask = 0
9117 if table_id != None:
9118 self.table_id = table_id
9119 else:
9120 self.table_id = 0
9121 if idle_timeout != None:
9122 self.idle_timeout = idle_timeout
9123 else:
9124 self.idle_timeout = 0
9125 if hard_timeout != None:
9126 self.hard_timeout = hard_timeout
9127 else:
9128 self.hard_timeout = 0
9129 if priority != None:
9130 self.priority = priority
9131 else:
9132 self.priority = 0
9133 if buffer_id != None:
9134 self.buffer_id = buffer_id
9135 else:
9136 self.buffer_id = 0
9137 if out_port != None:
9138 self.out_port = out_port
9139 else:
9140 self.out_port = 0
9141 if out_group != None:
9142 self.out_group = out_group
9143 else:
9144 self.out_group = 0
9145 if flags != None:
9146 self.flags = flags
9147 else:
9148 self.flags = 0
9149 if match != None:
9150 self.match = match
9151 else:
9152 self.match = common.match()
9153 if instructions != None:
9154 self.instructions = instructions
9155 else:
9156 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009157 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009158
9159 def pack(self):
9160 packed = []
9161 packed.append(struct.pack("!B", self.version))
9162 packed.append(struct.pack("!B", self.type))
9163 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9164 packed.append(struct.pack("!L", self.xid))
9165 packed.append(struct.pack("!Q", self.cookie))
9166 packed.append(struct.pack("!Q", self.cookie_mask))
9167 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009168 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009169 packed.append(struct.pack("!H", self.idle_timeout))
9170 packed.append(struct.pack("!H", self.hard_timeout))
9171 packed.append(struct.pack("!H", self.priority))
9172 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009173 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009174 packed.append(struct.pack("!L", self.out_group))
9175 packed.append(struct.pack("!H", self.flags))
9176 packed.append('\x00' * 2)
9177 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009178 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009179 length = sum([len(x) for x in packed])
9180 packed[2] = struct.pack("!H", length)
9181 return ''.join(packed)
9182
9183 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009184 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009185 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07009186 _version = reader.read("!B")[0]
9187 assert(_version == 4)
9188 _type = reader.read("!B")[0]
9189 assert(_type == 14)
9190 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009191 orig_reader = reader
9192 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009193 obj.xid = reader.read("!L")[0]
9194 obj.cookie = reader.read("!Q")[0]
9195 obj.cookie_mask = reader.read("!Q")[0]
9196 obj.table_id = reader.read("!B")[0]
9197 __command = util.unpack_fm_cmd(reader)
9198 assert(__command == 1)
9199 obj.idle_timeout = reader.read("!H")[0]
9200 obj.hard_timeout = reader.read("!H")[0]
9201 obj.priority = reader.read("!H")[0]
9202 obj.buffer_id = reader.read("!L")[0]
9203 obj.out_port = util.unpack_port_no(reader)
9204 obj.out_group = reader.read("!L")[0]
9205 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009206 reader.skip(2)
9207 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009208 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009209 return obj
9210
9211 def __eq__(self, other):
9212 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009213 if self.xid != other.xid: return False
9214 if self.cookie != other.cookie: return False
9215 if self.cookie_mask != other.cookie_mask: return False
9216 if self.table_id != other.table_id: return False
9217 if self.idle_timeout != other.idle_timeout: return False
9218 if self.hard_timeout != other.hard_timeout: return False
9219 if self.priority != other.priority: return False
9220 if self.buffer_id != other.buffer_id: return False
9221 if self.out_port != other.out_port: return False
9222 if self.out_group != other.out_group: return False
9223 if self.flags != other.flags: return False
9224 if self.match != other.match: return False
9225 if self.instructions != other.instructions: return False
9226 return True
9227
Rich Lanec2ee4b82013-04-24 17:12:38 -07009228 def pretty_print(self, q):
9229 q.text("flow_modify {")
9230 with q.group():
9231 with q.indent(2):
9232 q.breakable()
9233 q.text("xid = ");
9234 if self.xid != None:
9235 q.text("%#x" % self.xid)
9236 else:
9237 q.text('None')
9238 q.text(","); q.breakable()
9239 q.text("cookie = ");
9240 q.text("%#x" % self.cookie)
9241 q.text(","); q.breakable()
9242 q.text("cookie_mask = ");
9243 q.text("%#x" % self.cookie_mask)
9244 q.text(","); q.breakable()
9245 q.text("table_id = ");
9246 q.text("%#x" % self.table_id)
9247 q.text(","); q.breakable()
9248 q.text("idle_timeout = ");
9249 q.text("%#x" % self.idle_timeout)
9250 q.text(","); q.breakable()
9251 q.text("hard_timeout = ");
9252 q.text("%#x" % self.hard_timeout)
9253 q.text(","); q.breakable()
9254 q.text("priority = ");
9255 q.text("%#x" % self.priority)
9256 q.text(","); q.breakable()
9257 q.text("buffer_id = ");
9258 q.text("%#x" % self.buffer_id)
9259 q.text(","); q.breakable()
9260 q.text("out_port = ");
9261 q.text(util.pretty_port(self.out_port))
9262 q.text(","); q.breakable()
9263 q.text("out_group = ");
9264 q.text("%#x" % self.out_group)
9265 q.text(","); q.breakable()
9266 q.text("flags = ");
9267 q.text("%#x" % self.flags)
9268 q.text(","); q.breakable()
9269 q.text("match = ");
9270 q.pp(self.match)
9271 q.text(","); q.breakable()
9272 q.text("instructions = ");
9273 q.pp(self.instructions)
9274 q.breakable()
9275 q.text('}')
9276
Rich Lane7dcdf022013-12-11 14:45:27 -08009277flow_mod.subtypes[1] = flow_modify
9278
9279class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009280 version = 4
9281 type = 14
9282 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07009283
9284 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 -08009285 if xid != None:
9286 self.xid = xid
9287 else:
9288 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009289 if cookie != None:
9290 self.cookie = cookie
9291 else:
9292 self.cookie = 0
9293 if cookie_mask != None:
9294 self.cookie_mask = cookie_mask
9295 else:
9296 self.cookie_mask = 0
9297 if table_id != None:
9298 self.table_id = table_id
9299 else:
9300 self.table_id = 0
9301 if idle_timeout != None:
9302 self.idle_timeout = idle_timeout
9303 else:
9304 self.idle_timeout = 0
9305 if hard_timeout != None:
9306 self.hard_timeout = hard_timeout
9307 else:
9308 self.hard_timeout = 0
9309 if priority != None:
9310 self.priority = priority
9311 else:
9312 self.priority = 0
9313 if buffer_id != None:
9314 self.buffer_id = buffer_id
9315 else:
9316 self.buffer_id = 0
9317 if out_port != None:
9318 self.out_port = out_port
9319 else:
9320 self.out_port = 0
9321 if out_group != None:
9322 self.out_group = out_group
9323 else:
9324 self.out_group = 0
9325 if flags != None:
9326 self.flags = flags
9327 else:
9328 self.flags = 0
9329 if match != None:
9330 self.match = match
9331 else:
9332 self.match = common.match()
9333 if instructions != None:
9334 self.instructions = instructions
9335 else:
9336 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009337 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009338
9339 def pack(self):
9340 packed = []
9341 packed.append(struct.pack("!B", self.version))
9342 packed.append(struct.pack("!B", self.type))
9343 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9344 packed.append(struct.pack("!L", self.xid))
9345 packed.append(struct.pack("!Q", self.cookie))
9346 packed.append(struct.pack("!Q", self.cookie_mask))
9347 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009348 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009349 packed.append(struct.pack("!H", self.idle_timeout))
9350 packed.append(struct.pack("!H", self.hard_timeout))
9351 packed.append(struct.pack("!H", self.priority))
9352 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009353 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009354 packed.append(struct.pack("!L", self.out_group))
9355 packed.append(struct.pack("!H", self.flags))
9356 packed.append('\x00' * 2)
9357 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009358 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009359 length = sum([len(x) for x in packed])
9360 packed[2] = struct.pack("!H", length)
9361 return ''.join(packed)
9362
9363 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009364 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009365 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07009366 _version = reader.read("!B")[0]
9367 assert(_version == 4)
9368 _type = reader.read("!B")[0]
9369 assert(_type == 14)
9370 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009371 orig_reader = reader
9372 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009373 obj.xid = reader.read("!L")[0]
9374 obj.cookie = reader.read("!Q")[0]
9375 obj.cookie_mask = reader.read("!Q")[0]
9376 obj.table_id = reader.read("!B")[0]
9377 __command = util.unpack_fm_cmd(reader)
9378 assert(__command == 2)
9379 obj.idle_timeout = reader.read("!H")[0]
9380 obj.hard_timeout = reader.read("!H")[0]
9381 obj.priority = reader.read("!H")[0]
9382 obj.buffer_id = reader.read("!L")[0]
9383 obj.out_port = util.unpack_port_no(reader)
9384 obj.out_group = reader.read("!L")[0]
9385 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009386 reader.skip(2)
9387 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009388 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009389 return obj
9390
9391 def __eq__(self, other):
9392 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009393 if self.xid != other.xid: return False
9394 if self.cookie != other.cookie: return False
9395 if self.cookie_mask != other.cookie_mask: return False
9396 if self.table_id != other.table_id: return False
9397 if self.idle_timeout != other.idle_timeout: return False
9398 if self.hard_timeout != other.hard_timeout: return False
9399 if self.priority != other.priority: return False
9400 if self.buffer_id != other.buffer_id: return False
9401 if self.out_port != other.out_port: return False
9402 if self.out_group != other.out_group: return False
9403 if self.flags != other.flags: return False
9404 if self.match != other.match: return False
9405 if self.instructions != other.instructions: return False
9406 return True
9407
Rich Lanec2ee4b82013-04-24 17:12:38 -07009408 def pretty_print(self, q):
9409 q.text("flow_modify_strict {")
9410 with q.group():
9411 with q.indent(2):
9412 q.breakable()
9413 q.text("xid = ");
9414 if self.xid != None:
9415 q.text("%#x" % self.xid)
9416 else:
9417 q.text('None')
9418 q.text(","); q.breakable()
9419 q.text("cookie = ");
9420 q.text("%#x" % self.cookie)
9421 q.text(","); q.breakable()
9422 q.text("cookie_mask = ");
9423 q.text("%#x" % self.cookie_mask)
9424 q.text(","); q.breakable()
9425 q.text("table_id = ");
9426 q.text("%#x" % self.table_id)
9427 q.text(","); q.breakable()
9428 q.text("idle_timeout = ");
9429 q.text("%#x" % self.idle_timeout)
9430 q.text(","); q.breakable()
9431 q.text("hard_timeout = ");
9432 q.text("%#x" % self.hard_timeout)
9433 q.text(","); q.breakable()
9434 q.text("priority = ");
9435 q.text("%#x" % self.priority)
9436 q.text(","); q.breakable()
9437 q.text("buffer_id = ");
9438 q.text("%#x" % self.buffer_id)
9439 q.text(","); q.breakable()
9440 q.text("out_port = ");
9441 q.text(util.pretty_port(self.out_port))
9442 q.text(","); q.breakable()
9443 q.text("out_group = ");
9444 q.text("%#x" % self.out_group)
9445 q.text(","); q.breakable()
9446 q.text("flags = ");
9447 q.text("%#x" % self.flags)
9448 q.text(","); q.breakable()
9449 q.text("match = ");
9450 q.pp(self.match)
9451 q.text(","); q.breakable()
9452 q.text("instructions = ");
9453 q.pp(self.instructions)
9454 q.breakable()
9455 q.text('}')
9456
Rich Lane7dcdf022013-12-11 14:45:27 -08009457flow_mod.subtypes[2] = flow_modify_strict
9458
9459class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009460 version = 4
9461 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07009462
9463 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 -08009464 if xid != None:
9465 self.xid = xid
9466 else:
9467 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009468 if cookie != None:
9469 self.cookie = cookie
9470 else:
9471 self.cookie = 0
9472 if priority != None:
9473 self.priority = priority
9474 else:
9475 self.priority = 0
9476 if reason != None:
9477 self.reason = reason
9478 else:
9479 self.reason = 0
9480 if table_id != None:
9481 self.table_id = table_id
9482 else:
9483 self.table_id = 0
9484 if duration_sec != None:
9485 self.duration_sec = duration_sec
9486 else:
9487 self.duration_sec = 0
9488 if duration_nsec != None:
9489 self.duration_nsec = duration_nsec
9490 else:
9491 self.duration_nsec = 0
9492 if idle_timeout != None:
9493 self.idle_timeout = idle_timeout
9494 else:
9495 self.idle_timeout = 0
9496 if hard_timeout != None:
9497 self.hard_timeout = hard_timeout
9498 else:
9499 self.hard_timeout = 0
9500 if packet_count != None:
9501 self.packet_count = packet_count
9502 else:
9503 self.packet_count = 0
9504 if byte_count != None:
9505 self.byte_count = byte_count
9506 else:
9507 self.byte_count = 0
9508 if match != None:
9509 self.match = match
9510 else:
9511 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009512 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009513
9514 def pack(self):
9515 packed = []
9516 packed.append(struct.pack("!B", self.version))
9517 packed.append(struct.pack("!B", self.type))
9518 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9519 packed.append(struct.pack("!L", self.xid))
9520 packed.append(struct.pack("!Q", self.cookie))
9521 packed.append(struct.pack("!H", self.priority))
9522 packed.append(struct.pack("!B", self.reason))
9523 packed.append(struct.pack("!B", self.table_id))
9524 packed.append(struct.pack("!L", self.duration_sec))
9525 packed.append(struct.pack("!L", self.duration_nsec))
9526 packed.append(struct.pack("!H", self.idle_timeout))
9527 packed.append(struct.pack("!H", self.hard_timeout))
9528 packed.append(struct.pack("!Q", self.packet_count))
9529 packed.append(struct.pack("!Q", self.byte_count))
9530 packed.append(self.match.pack())
9531 length = sum([len(x) for x in packed])
9532 packed[2] = struct.pack("!H", length)
9533 return ''.join(packed)
9534
9535 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009536 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009537 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07009538 _version = reader.read("!B")[0]
9539 assert(_version == 4)
9540 _type = reader.read("!B")[0]
9541 assert(_type == 11)
9542 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009543 orig_reader = reader
9544 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009545 obj.xid = reader.read("!L")[0]
9546 obj.cookie = reader.read("!Q")[0]
9547 obj.priority = reader.read("!H")[0]
9548 obj.reason = reader.read("!B")[0]
9549 obj.table_id = reader.read("!B")[0]
9550 obj.duration_sec = reader.read("!L")[0]
9551 obj.duration_nsec = reader.read("!L")[0]
9552 obj.idle_timeout = reader.read("!H")[0]
9553 obj.hard_timeout = reader.read("!H")[0]
9554 obj.packet_count = reader.read("!Q")[0]
9555 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009556 obj.match = common.match.unpack(reader)
9557 return obj
9558
9559 def __eq__(self, other):
9560 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009561 if self.xid != other.xid: return False
9562 if self.cookie != other.cookie: return False
9563 if self.priority != other.priority: return False
9564 if self.reason != other.reason: return False
9565 if self.table_id != other.table_id: return False
9566 if self.duration_sec != other.duration_sec: return False
9567 if self.duration_nsec != other.duration_nsec: return False
9568 if self.idle_timeout != other.idle_timeout: return False
9569 if self.hard_timeout != other.hard_timeout: return False
9570 if self.packet_count != other.packet_count: return False
9571 if self.byte_count != other.byte_count: return False
9572 if self.match != other.match: return False
9573 return True
9574
Rich Lanec2ee4b82013-04-24 17:12:38 -07009575 def pretty_print(self, q):
9576 q.text("flow_removed {")
9577 with q.group():
9578 with q.indent(2):
9579 q.breakable()
9580 q.text("xid = ");
9581 if self.xid != None:
9582 q.text("%#x" % self.xid)
9583 else:
9584 q.text('None')
9585 q.text(","); q.breakable()
9586 q.text("cookie = ");
9587 q.text("%#x" % self.cookie)
9588 q.text(","); q.breakable()
9589 q.text("priority = ");
9590 q.text("%#x" % self.priority)
9591 q.text(","); q.breakable()
9592 q.text("reason = ");
9593 q.text("%#x" % self.reason)
9594 q.text(","); q.breakable()
9595 q.text("table_id = ");
9596 q.text("%#x" % self.table_id)
9597 q.text(","); q.breakable()
9598 q.text("duration_sec = ");
9599 q.text("%#x" % self.duration_sec)
9600 q.text(","); q.breakable()
9601 q.text("duration_nsec = ");
9602 q.text("%#x" % self.duration_nsec)
9603 q.text(","); q.breakable()
9604 q.text("idle_timeout = ");
9605 q.text("%#x" % self.idle_timeout)
9606 q.text(","); q.breakable()
9607 q.text("hard_timeout = ");
9608 q.text("%#x" % self.hard_timeout)
9609 q.text(","); q.breakable()
9610 q.text("packet_count = ");
9611 q.text("%#x" % self.packet_count)
9612 q.text(","); q.breakable()
9613 q.text("byte_count = ");
9614 q.text("%#x" % self.byte_count)
9615 q.text(","); q.breakable()
9616 q.text("match = ");
9617 q.pp(self.match)
9618 q.breakable()
9619 q.text('}')
9620
Rich Lane7dcdf022013-12-11 14:45:27 -08009621message.subtypes[11] = flow_removed
9622
9623class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009624 version = 4
9625 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009626 stats_type = 1
9627
9628 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009629 if xid != None:
9630 self.xid = xid
9631 else:
9632 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009633 if flags != None:
9634 self.flags = flags
9635 else:
9636 self.flags = 0
9637 if entries != None:
9638 self.entries = entries
9639 else:
9640 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009641 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009642
9643 def pack(self):
9644 packed = []
9645 packed.append(struct.pack("!B", self.version))
9646 packed.append(struct.pack("!B", self.type))
9647 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9648 packed.append(struct.pack("!L", self.xid))
9649 packed.append(struct.pack("!H", self.stats_type))
9650 packed.append(struct.pack("!H", self.flags))
9651 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009652 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009653 length = sum([len(x) for x in packed])
9654 packed[2] = struct.pack("!H", length)
9655 return ''.join(packed)
9656
9657 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009658 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009659 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009660 _version = reader.read("!B")[0]
9661 assert(_version == 4)
9662 _type = reader.read("!B")[0]
9663 assert(_type == 19)
9664 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009665 orig_reader = reader
9666 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009667 obj.xid = reader.read("!L")[0]
9668 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009669 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009670 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009671 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009672 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009673 return obj
9674
9675 def __eq__(self, other):
9676 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009677 if self.xid != other.xid: return False
9678 if self.flags != other.flags: return False
9679 if self.entries != other.entries: return False
9680 return True
9681
Rich Lanec2ee4b82013-04-24 17:12:38 -07009682 def pretty_print(self, q):
9683 q.text("flow_stats_reply {")
9684 with q.group():
9685 with q.indent(2):
9686 q.breakable()
9687 q.text("xid = ");
9688 if self.xid != None:
9689 q.text("%#x" % self.xid)
9690 else:
9691 q.text('None')
9692 q.text(","); q.breakable()
9693 q.text("flags = ");
9694 q.text("%#x" % self.flags)
9695 q.text(","); q.breakable()
9696 q.text("entries = ");
9697 q.pp(self.entries)
9698 q.breakable()
9699 q.text('}')
9700
Rich Lane7dcdf022013-12-11 14:45:27 -08009701stats_reply.subtypes[1] = flow_stats_reply
9702
9703class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009704 version = 4
9705 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009706 stats_type = 1
9707
9708 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 -08009709 if xid != None:
9710 self.xid = xid
9711 else:
9712 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009713 if flags != None:
9714 self.flags = flags
9715 else:
9716 self.flags = 0
9717 if table_id != None:
9718 self.table_id = table_id
9719 else:
9720 self.table_id = 0
9721 if out_port != None:
9722 self.out_port = out_port
9723 else:
9724 self.out_port = 0
9725 if out_group != None:
9726 self.out_group = out_group
9727 else:
9728 self.out_group = 0
9729 if cookie != None:
9730 self.cookie = cookie
9731 else:
9732 self.cookie = 0
9733 if cookie_mask != None:
9734 self.cookie_mask = cookie_mask
9735 else:
9736 self.cookie_mask = 0
9737 if match != None:
9738 self.match = match
9739 else:
9740 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009741 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009742
9743 def pack(self):
9744 packed = []
9745 packed.append(struct.pack("!B", self.version))
9746 packed.append(struct.pack("!B", self.type))
9747 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9748 packed.append(struct.pack("!L", self.xid))
9749 packed.append(struct.pack("!H", self.stats_type))
9750 packed.append(struct.pack("!H", self.flags))
9751 packed.append('\x00' * 4)
9752 packed.append(struct.pack("!B", self.table_id))
9753 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07009754 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009755 packed.append(struct.pack("!L", self.out_group))
9756 packed.append('\x00' * 4)
9757 packed.append(struct.pack("!Q", self.cookie))
9758 packed.append(struct.pack("!Q", self.cookie_mask))
9759 packed.append(self.match.pack())
9760 length = sum([len(x) for x in packed])
9761 packed[2] = struct.pack("!H", length)
9762 return ''.join(packed)
9763
9764 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009765 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009766 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009767 _version = reader.read("!B")[0]
9768 assert(_version == 4)
9769 _type = reader.read("!B")[0]
9770 assert(_type == 18)
9771 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009772 orig_reader = reader
9773 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009774 obj.xid = reader.read("!L")[0]
9775 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009776 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009777 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009778 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009779 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009780 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07009781 obj.out_port = util.unpack_port_no(reader)
9782 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009783 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009784 obj.cookie = reader.read("!Q")[0]
9785 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009786 obj.match = common.match.unpack(reader)
9787 return obj
9788
9789 def __eq__(self, other):
9790 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009791 if self.xid != other.xid: return False
9792 if self.flags != other.flags: return False
9793 if self.table_id != other.table_id: return False
9794 if self.out_port != other.out_port: return False
9795 if self.out_group != other.out_group: return False
9796 if self.cookie != other.cookie: return False
9797 if self.cookie_mask != other.cookie_mask: return False
9798 if self.match != other.match: return False
9799 return True
9800
Rich Lanec2ee4b82013-04-24 17:12:38 -07009801 def pretty_print(self, q):
9802 q.text("flow_stats_request {")
9803 with q.group():
9804 with q.indent(2):
9805 q.breakable()
9806 q.text("xid = ");
9807 if self.xid != None:
9808 q.text("%#x" % self.xid)
9809 else:
9810 q.text('None')
9811 q.text(","); q.breakable()
9812 q.text("flags = ");
9813 q.text("%#x" % self.flags)
9814 q.text(","); q.breakable()
9815 q.text("table_id = ");
9816 q.text("%#x" % self.table_id)
9817 q.text(","); q.breakable()
9818 q.text("out_port = ");
9819 q.text(util.pretty_port(self.out_port))
9820 q.text(","); q.breakable()
9821 q.text("out_group = ");
9822 q.text("%#x" % self.out_group)
9823 q.text(","); q.breakable()
9824 q.text("cookie = ");
9825 q.text("%#x" % self.cookie)
9826 q.text(","); q.breakable()
9827 q.text("cookie_mask = ");
9828 q.text("%#x" % self.cookie_mask)
9829 q.text(","); q.breakable()
9830 q.text("match = ");
9831 q.pp(self.match)
9832 q.breakable()
9833 q.text('}')
9834
Rich Lane7dcdf022013-12-11 14:45:27 -08009835stats_request.subtypes[1] = flow_stats_request
9836
9837class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009838 version = 4
9839 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07009840
9841 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009842 if xid != None:
9843 self.xid = xid
9844 else:
9845 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009846 if flags != None:
9847 self.flags = flags
9848 else:
9849 self.flags = 0
9850 if miss_send_len != None:
9851 self.miss_send_len = miss_send_len
9852 else:
9853 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009854 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009855
9856 def pack(self):
9857 packed = []
9858 packed.append(struct.pack("!B", self.version))
9859 packed.append(struct.pack("!B", self.type))
9860 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9861 packed.append(struct.pack("!L", self.xid))
9862 packed.append(struct.pack("!H", self.flags))
9863 packed.append(struct.pack("!H", self.miss_send_len))
9864 length = sum([len(x) for x in packed])
9865 packed[2] = struct.pack("!H", length)
9866 return ''.join(packed)
9867
9868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009869 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009870 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009871 _version = reader.read("!B")[0]
9872 assert(_version == 4)
9873 _type = reader.read("!B")[0]
9874 assert(_type == 8)
9875 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009876 orig_reader = reader
9877 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009878 obj.xid = reader.read("!L")[0]
9879 obj.flags = reader.read("!H")[0]
9880 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009881 return obj
9882
9883 def __eq__(self, other):
9884 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009885 if self.xid != other.xid: return False
9886 if self.flags != other.flags: return False
9887 if self.miss_send_len != other.miss_send_len: return False
9888 return True
9889
Rich Lanec2ee4b82013-04-24 17:12:38 -07009890 def pretty_print(self, q):
9891 q.text("get_config_reply {")
9892 with q.group():
9893 with q.indent(2):
9894 q.breakable()
9895 q.text("xid = ");
9896 if self.xid != None:
9897 q.text("%#x" % self.xid)
9898 else:
9899 q.text('None')
9900 q.text(","); q.breakable()
9901 q.text("flags = ");
9902 q.text("%#x" % self.flags)
9903 q.text(","); q.breakable()
9904 q.text("miss_send_len = ");
9905 q.text("%#x" % self.miss_send_len)
9906 q.breakable()
9907 q.text('}')
9908
Rich Lane7dcdf022013-12-11 14:45:27 -08009909message.subtypes[8] = get_config_reply
9910
9911class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009912 version = 4
9913 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07009914
9915 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009916 if xid != None:
9917 self.xid = xid
9918 else:
9919 self.xid = None
9920 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009921
9922 def pack(self):
9923 packed = []
9924 packed.append(struct.pack("!B", self.version))
9925 packed.append(struct.pack("!B", self.type))
9926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9927 packed.append(struct.pack("!L", self.xid))
9928 length = sum([len(x) for x in packed])
9929 packed[2] = struct.pack("!H", length)
9930 return ''.join(packed)
9931
9932 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009933 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009934 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009935 _version = reader.read("!B")[0]
9936 assert(_version == 4)
9937 _type = reader.read("!B")[0]
9938 assert(_type == 7)
9939 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009940 orig_reader = reader
9941 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009942 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009943 return obj
9944
9945 def __eq__(self, other):
9946 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009947 if self.xid != other.xid: return False
9948 return True
9949
Rich Lanec2ee4b82013-04-24 17:12:38 -07009950 def pretty_print(self, q):
9951 q.text("get_config_request {")
9952 with q.group():
9953 with q.indent(2):
9954 q.breakable()
9955 q.text("xid = ");
9956 if self.xid != None:
9957 q.text("%#x" % self.xid)
9958 else:
9959 q.text('None')
9960 q.breakable()
9961 q.text('}')
9962
Rich Lane7dcdf022013-12-11 14:45:27 -08009963message.subtypes[7] = get_config_request
9964
9965class group_mod(message):
9966 subtypes = {}
9967
Rich Lane95f7fc92014-01-27 17:08:16 -08009968 version = 4
9969 type = 15
9970
9971 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
9972 if xid != None:
9973 self.xid = xid
9974 else:
9975 self.xid = None
9976 if command != None:
9977 self.command = command
9978 else:
9979 self.command = 0
9980 if group_type != None:
9981 self.group_type = group_type
9982 else:
9983 self.group_type = 0
9984 if group_id != None:
9985 self.group_id = group_id
9986 else:
9987 self.group_id = 0
9988 if buckets != None:
9989 self.buckets = buckets
9990 else:
9991 self.buckets = []
9992 return
9993
9994 def pack(self):
9995 packed = []
9996 packed.append(struct.pack("!B", self.version))
9997 packed.append(struct.pack("!B", self.type))
9998 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9999 packed.append(struct.pack("!L", self.xid))
10000 packed.append(struct.pack("!H", self.command))
10001 packed.append(struct.pack("!B", self.group_type))
10002 packed.append('\x00' * 1)
10003 packed.append(struct.pack("!L", self.group_id))
10004 packed.append(loxi.generic_util.pack_list(self.buckets))
10005 length = sum([len(x) for x in packed])
10006 packed[2] = struct.pack("!H", length)
10007 return ''.join(packed)
10008
Rich Lane7dcdf022013-12-11 14:45:27 -080010009 @staticmethod
10010 def unpack(reader):
10011 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080010012 subclass = group_mod.subtypes.get(subtype)
10013 if subclass:
10014 return subclass.unpack(reader)
10015
10016 obj = group_mod()
10017 _version = reader.read("!B")[0]
10018 assert(_version == 4)
10019 _type = reader.read("!B")[0]
10020 assert(_type == 15)
10021 _length = reader.read("!H")[0]
10022 orig_reader = reader
10023 reader = orig_reader.slice(_length - (2 + 2))
10024 obj.xid = reader.read("!L")[0]
10025 obj.command = reader.read("!H")[0]
10026 obj.group_type = reader.read("!B")[0]
10027 reader.skip(1)
10028 obj.group_id = reader.read("!L")[0]
10029 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
10030 return obj
10031
10032 def __eq__(self, other):
10033 if type(self) != type(other): return False
10034 if self.xid != other.xid: return False
10035 if self.command != other.command: return False
10036 if self.group_type != other.group_type: return False
10037 if self.group_id != other.group_id: return False
10038 if self.buckets != other.buckets: return False
10039 return True
10040
10041 def pretty_print(self, q):
10042 q.text("group_mod {")
10043 with q.group():
10044 with q.indent(2):
10045 q.breakable()
10046 q.text("xid = ");
10047 if self.xid != None:
10048 q.text("%#x" % self.xid)
10049 else:
10050 q.text('None')
10051 q.text(","); q.breakable()
10052 q.text("group_type = ");
10053 q.text("%#x" % self.group_type)
10054 q.text(","); q.breakable()
10055 q.text("group_id = ");
10056 q.text("%#x" % self.group_id)
10057 q.text(","); q.breakable()
10058 q.text("buckets = ");
10059 q.pp(self.buckets)
10060 q.breakable()
10061 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080010062
10063message.subtypes[15] = group_mod
10064
10065class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010066 version = 4
10067 type = 15
10068 command = 0
10069
10070 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010071 if xid != None:
10072 self.xid = xid
10073 else:
10074 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010075 if group_type != None:
10076 self.group_type = group_type
10077 else:
10078 self.group_type = 0
10079 if group_id != None:
10080 self.group_id = group_id
10081 else:
10082 self.group_id = 0
10083 if buckets != None:
10084 self.buckets = buckets
10085 else:
10086 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010087 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010088
10089 def pack(self):
10090 packed = []
10091 packed.append(struct.pack("!B", self.version))
10092 packed.append(struct.pack("!B", self.type))
10093 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10094 packed.append(struct.pack("!L", self.xid))
10095 packed.append(struct.pack("!H", self.command))
10096 packed.append(struct.pack("!B", self.group_type))
10097 packed.append('\x00' * 1)
10098 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010099 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010100 length = sum([len(x) for x in packed])
10101 packed[2] = struct.pack("!H", length)
10102 return ''.join(packed)
10103
10104 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010105 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010106 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080010107 _version = reader.read("!B")[0]
10108 assert(_version == 4)
10109 _type = reader.read("!B")[0]
10110 assert(_type == 15)
10111 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010112 orig_reader = reader
10113 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010114 obj.xid = reader.read("!L")[0]
10115 _command = reader.read("!H")[0]
10116 assert(_command == 0)
10117 obj.group_type = reader.read("!B")[0]
10118 reader.skip(1)
10119 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010120 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010121 return obj
10122
10123 def __eq__(self, other):
10124 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010125 if self.xid != other.xid: return False
10126 if self.group_type != other.group_type: return False
10127 if self.group_id != other.group_id: return False
10128 if self.buckets != other.buckets: return False
10129 return True
10130
Rich Lane7b0f2012013-11-22 14:15:26 -080010131 def pretty_print(self, q):
10132 q.text("group_add {")
10133 with q.group():
10134 with q.indent(2):
10135 q.breakable()
10136 q.text("xid = ");
10137 if self.xid != None:
10138 q.text("%#x" % self.xid)
10139 else:
10140 q.text('None')
10141 q.text(","); q.breakable()
10142 q.text("group_type = ");
10143 q.text("%#x" % self.group_type)
10144 q.text(","); q.breakable()
10145 q.text("group_id = ");
10146 q.text("%#x" % self.group_id)
10147 q.text(","); q.breakable()
10148 q.text("buckets = ");
10149 q.pp(self.buckets)
10150 q.breakable()
10151 q.text('}')
10152
Rich Lane7dcdf022013-12-11 14:45:27 -080010153group_mod.subtypes[0] = group_add
10154
10155class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010156 version = 4
10157 type = 15
10158 command = 2
10159
10160 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010161 if xid != None:
10162 self.xid = xid
10163 else:
10164 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010165 if group_type != None:
10166 self.group_type = group_type
10167 else:
10168 self.group_type = 0
10169 if group_id != None:
10170 self.group_id = group_id
10171 else:
10172 self.group_id = 0
10173 if buckets != None:
10174 self.buckets = buckets
10175 else:
10176 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010177 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010178
10179 def pack(self):
10180 packed = []
10181 packed.append(struct.pack("!B", self.version))
10182 packed.append(struct.pack("!B", self.type))
10183 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10184 packed.append(struct.pack("!L", self.xid))
10185 packed.append(struct.pack("!H", self.command))
10186 packed.append(struct.pack("!B", self.group_type))
10187 packed.append('\x00' * 1)
10188 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010189 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010190 length = sum([len(x) for x in packed])
10191 packed[2] = struct.pack("!H", length)
10192 return ''.join(packed)
10193
10194 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010195 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010196 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080010197 _version = reader.read("!B")[0]
10198 assert(_version == 4)
10199 _type = reader.read("!B")[0]
10200 assert(_type == 15)
10201 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010202 orig_reader = reader
10203 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010204 obj.xid = reader.read("!L")[0]
10205 _command = reader.read("!H")[0]
10206 assert(_command == 2)
10207 obj.group_type = reader.read("!B")[0]
10208 reader.skip(1)
10209 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010210 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010211 return obj
10212
10213 def __eq__(self, other):
10214 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010215 if self.xid != other.xid: return False
10216 if self.group_type != other.group_type: return False
10217 if self.group_id != other.group_id: return False
10218 if self.buckets != other.buckets: return False
10219 return True
10220
Rich Lane7b0f2012013-11-22 14:15:26 -080010221 def pretty_print(self, q):
10222 q.text("group_delete {")
10223 with q.group():
10224 with q.indent(2):
10225 q.breakable()
10226 q.text("xid = ");
10227 if self.xid != None:
10228 q.text("%#x" % self.xid)
10229 else:
10230 q.text('None')
10231 q.text(","); q.breakable()
10232 q.text("group_type = ");
10233 q.text("%#x" % self.group_type)
10234 q.text(","); q.breakable()
10235 q.text("group_id = ");
10236 q.text("%#x" % self.group_id)
10237 q.text(","); q.breakable()
10238 q.text("buckets = ");
10239 q.pp(self.buckets)
10240 q.breakable()
10241 q.text('}')
10242
Rich Lane7dcdf022013-12-11 14:45:27 -080010243group_mod.subtypes[2] = group_delete
10244
10245class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010246 version = 4
10247 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010248 stats_type = 7
10249
10250 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010251 if xid != None:
10252 self.xid = xid
10253 else:
10254 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010255 if flags != None:
10256 self.flags = flags
10257 else:
10258 self.flags = 0
10259 if entries != None:
10260 self.entries = entries
10261 else:
10262 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010263 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010264
10265 def pack(self):
10266 packed = []
10267 packed.append(struct.pack("!B", self.version))
10268 packed.append(struct.pack("!B", self.type))
10269 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10270 packed.append(struct.pack("!L", self.xid))
10271 packed.append(struct.pack("!H", self.stats_type))
10272 packed.append(struct.pack("!H", self.flags))
10273 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010274 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010275 length = sum([len(x) for x in packed])
10276 packed[2] = struct.pack("!H", length)
10277 return ''.join(packed)
10278
10279 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010280 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010281 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010282 _version = reader.read("!B")[0]
10283 assert(_version == 4)
10284 _type = reader.read("!B")[0]
10285 assert(_type == 19)
10286 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010287 orig_reader = reader
10288 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010289 obj.xid = reader.read("!L")[0]
10290 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010291 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070010292 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010293 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010294 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010295 return obj
10296
10297 def __eq__(self, other):
10298 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010299 if self.xid != other.xid: return False
10300 if self.flags != other.flags: return False
10301 if self.entries != other.entries: return False
10302 return True
10303
Rich Lanec2ee4b82013-04-24 17:12:38 -070010304 def pretty_print(self, q):
10305 q.text("group_desc_stats_reply {")
10306 with q.group():
10307 with q.indent(2):
10308 q.breakable()
10309 q.text("xid = ");
10310 if self.xid != None:
10311 q.text("%#x" % self.xid)
10312 else:
10313 q.text('None')
10314 q.text(","); q.breakable()
10315 q.text("flags = ");
10316 q.text("%#x" % self.flags)
10317 q.text(","); q.breakable()
10318 q.text("entries = ");
10319 q.pp(self.entries)
10320 q.breakable()
10321 q.text('}')
10322
Rich Lane7dcdf022013-12-11 14:45:27 -080010323stats_reply.subtypes[7] = group_desc_stats_reply
10324
10325class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010326 version = 4
10327 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010328 stats_type = 7
10329
10330 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010331 if xid != None:
10332 self.xid = xid
10333 else:
10334 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010335 if flags != None:
10336 self.flags = flags
10337 else:
10338 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010339 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010340
10341 def pack(self):
10342 packed = []
10343 packed.append(struct.pack("!B", self.version))
10344 packed.append(struct.pack("!B", self.type))
10345 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10346 packed.append(struct.pack("!L", self.xid))
10347 packed.append(struct.pack("!H", self.stats_type))
10348 packed.append(struct.pack("!H", self.flags))
10349 packed.append('\x00' * 4)
10350 length = sum([len(x) for x in packed])
10351 packed[2] = struct.pack("!H", length)
10352 return ''.join(packed)
10353
10354 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010355 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010356 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010357 _version = reader.read("!B")[0]
10358 assert(_version == 4)
10359 _type = reader.read("!B")[0]
10360 assert(_type == 18)
10361 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010362 orig_reader = reader
10363 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010364 obj.xid = reader.read("!L")[0]
10365 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010366 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070010367 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010368 reader.skip(4)
10369 return obj
10370
10371 def __eq__(self, other):
10372 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010373 if self.xid != other.xid: return False
10374 if self.flags != other.flags: return False
10375 return True
10376
Rich Lanec2ee4b82013-04-24 17:12:38 -070010377 def pretty_print(self, q):
10378 q.text("group_desc_stats_request {")
10379 with q.group():
10380 with q.indent(2):
10381 q.breakable()
10382 q.text("xid = ");
10383 if self.xid != None:
10384 q.text("%#x" % self.xid)
10385 else:
10386 q.text('None')
10387 q.text(","); q.breakable()
10388 q.text("flags = ");
10389 q.text("%#x" % self.flags)
10390 q.breakable()
10391 q.text('}')
10392
Rich Lane7dcdf022013-12-11 14:45:27 -080010393stats_request.subtypes[7] = group_desc_stats_request
10394
10395class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010396 version = 4
10397 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010398 stats_type = 8
10399
10400 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 -080010401 if xid != None:
10402 self.xid = xid
10403 else:
10404 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010405 if flags != None:
10406 self.flags = flags
10407 else:
10408 self.flags = 0
10409 if types != None:
10410 self.types = types
10411 else:
10412 self.types = 0
10413 if capabilities != None:
10414 self.capabilities = capabilities
10415 else:
10416 self.capabilities = 0
10417 if max_groups_all != None:
10418 self.max_groups_all = max_groups_all
10419 else:
10420 self.max_groups_all = 0
10421 if max_groups_select != None:
10422 self.max_groups_select = max_groups_select
10423 else:
10424 self.max_groups_select = 0
10425 if max_groups_indirect != None:
10426 self.max_groups_indirect = max_groups_indirect
10427 else:
10428 self.max_groups_indirect = 0
10429 if max_groups_ff != None:
10430 self.max_groups_ff = max_groups_ff
10431 else:
10432 self.max_groups_ff = 0
10433 if actions_all != None:
10434 self.actions_all = actions_all
10435 else:
10436 self.actions_all = 0
10437 if actions_select != None:
10438 self.actions_select = actions_select
10439 else:
10440 self.actions_select = 0
10441 if actions_indirect != None:
10442 self.actions_indirect = actions_indirect
10443 else:
10444 self.actions_indirect = 0
10445 if actions_ff != None:
10446 self.actions_ff = actions_ff
10447 else:
10448 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010449 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010450
10451 def pack(self):
10452 packed = []
10453 packed.append(struct.pack("!B", self.version))
10454 packed.append(struct.pack("!B", self.type))
10455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10456 packed.append(struct.pack("!L", self.xid))
10457 packed.append(struct.pack("!H", self.stats_type))
10458 packed.append(struct.pack("!H", self.flags))
10459 packed.append('\x00' * 4)
10460 packed.append(struct.pack("!L", self.types))
10461 packed.append(struct.pack("!L", self.capabilities))
10462 packed.append(struct.pack("!L", self.max_groups_all))
10463 packed.append(struct.pack("!L", self.max_groups_select))
10464 packed.append(struct.pack("!L", self.max_groups_indirect))
10465 packed.append(struct.pack("!L", self.max_groups_ff))
10466 packed.append(struct.pack("!L", self.actions_all))
10467 packed.append(struct.pack("!L", self.actions_select))
10468 packed.append(struct.pack("!L", self.actions_indirect))
10469 packed.append(struct.pack("!L", self.actions_ff))
10470 length = sum([len(x) for x in packed])
10471 packed[2] = struct.pack("!H", length)
10472 return ''.join(packed)
10473
10474 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010475 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010476 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010477 _version = reader.read("!B")[0]
10478 assert(_version == 4)
10479 _type = reader.read("!B")[0]
10480 assert(_type == 19)
10481 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010482 orig_reader = reader
10483 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010484 obj.xid = reader.read("!L")[0]
10485 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010486 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070010487 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010488 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010489 obj.types = reader.read("!L")[0]
10490 obj.capabilities = reader.read("!L")[0]
10491 obj.max_groups_all = reader.read("!L")[0]
10492 obj.max_groups_select = reader.read("!L")[0]
10493 obj.max_groups_indirect = reader.read("!L")[0]
10494 obj.max_groups_ff = reader.read("!L")[0]
10495 obj.actions_all = reader.read("!L")[0]
10496 obj.actions_select = reader.read("!L")[0]
10497 obj.actions_indirect = reader.read("!L")[0]
10498 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010499 return obj
10500
10501 def __eq__(self, other):
10502 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010503 if self.xid != other.xid: return False
10504 if self.flags != other.flags: return False
10505 if self.types != other.types: return False
10506 if self.capabilities != other.capabilities: return False
10507 if self.max_groups_all != other.max_groups_all: return False
10508 if self.max_groups_select != other.max_groups_select: return False
10509 if self.max_groups_indirect != other.max_groups_indirect: return False
10510 if self.max_groups_ff != other.max_groups_ff: return False
10511 if self.actions_all != other.actions_all: return False
10512 if self.actions_select != other.actions_select: return False
10513 if self.actions_indirect != other.actions_indirect: return False
10514 if self.actions_ff != other.actions_ff: return False
10515 return True
10516
Rich Lanec2ee4b82013-04-24 17:12:38 -070010517 def pretty_print(self, q):
10518 q.text("group_features_stats_reply {")
10519 with q.group():
10520 with q.indent(2):
10521 q.breakable()
10522 q.text("xid = ");
10523 if self.xid != None:
10524 q.text("%#x" % self.xid)
10525 else:
10526 q.text('None')
10527 q.text(","); q.breakable()
10528 q.text("flags = ");
10529 q.text("%#x" % self.flags)
10530 q.text(","); q.breakable()
10531 q.text("types = ");
10532 q.text("%#x" % self.types)
10533 q.text(","); q.breakable()
10534 q.text("capabilities = ");
10535 q.text("%#x" % self.capabilities)
10536 q.text(","); q.breakable()
10537 q.text("max_groups_all = ");
10538 q.text("%#x" % self.max_groups_all)
10539 q.text(","); q.breakable()
10540 q.text("max_groups_select = ");
10541 q.text("%#x" % self.max_groups_select)
10542 q.text(","); q.breakable()
10543 q.text("max_groups_indirect = ");
10544 q.text("%#x" % self.max_groups_indirect)
10545 q.text(","); q.breakable()
10546 q.text("max_groups_ff = ");
10547 q.text("%#x" % self.max_groups_ff)
10548 q.text(","); q.breakable()
10549 q.text("actions_all = ");
10550 q.text("%#x" % self.actions_all)
10551 q.text(","); q.breakable()
10552 q.text("actions_select = ");
10553 q.text("%#x" % self.actions_select)
10554 q.text(","); q.breakable()
10555 q.text("actions_indirect = ");
10556 q.text("%#x" % self.actions_indirect)
10557 q.text(","); q.breakable()
10558 q.text("actions_ff = ");
10559 q.text("%#x" % self.actions_ff)
10560 q.breakable()
10561 q.text('}')
10562
Rich Lane7dcdf022013-12-11 14:45:27 -080010563stats_reply.subtypes[8] = group_features_stats_reply
10564
10565class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010566 version = 4
10567 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010568 stats_type = 8
10569
10570 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010571 if xid != None:
10572 self.xid = xid
10573 else:
10574 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010575 if flags != None:
10576 self.flags = flags
10577 else:
10578 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010579 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010580
10581 def pack(self):
10582 packed = []
10583 packed.append(struct.pack("!B", self.version))
10584 packed.append(struct.pack("!B", self.type))
10585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10586 packed.append(struct.pack("!L", self.xid))
10587 packed.append(struct.pack("!H", self.stats_type))
10588 packed.append(struct.pack("!H", self.flags))
10589 packed.append('\x00' * 4)
10590 length = sum([len(x) for x in packed])
10591 packed[2] = struct.pack("!H", length)
10592 return ''.join(packed)
10593
10594 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010595 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010596 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010597 _version = reader.read("!B")[0]
10598 assert(_version == 4)
10599 _type = reader.read("!B")[0]
10600 assert(_type == 18)
10601 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010602 orig_reader = reader
10603 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010604 obj.xid = reader.read("!L")[0]
10605 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010606 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070010607 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010608 reader.skip(4)
10609 return obj
10610
10611 def __eq__(self, other):
10612 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010613 if self.xid != other.xid: return False
10614 if self.flags != other.flags: return False
10615 return True
10616
Rich Lanec2ee4b82013-04-24 17:12:38 -070010617 def pretty_print(self, q):
10618 q.text("group_features_stats_request {")
10619 with q.group():
10620 with q.indent(2):
10621 q.breakable()
10622 q.text("xid = ");
10623 if self.xid != None:
10624 q.text("%#x" % self.xid)
10625 else:
10626 q.text('None')
10627 q.text(","); q.breakable()
10628 q.text("flags = ");
10629 q.text("%#x" % self.flags)
10630 q.breakable()
10631 q.text('}')
10632
Rich Lane7dcdf022013-12-11 14:45:27 -080010633stats_request.subtypes[8] = group_features_stats_request
10634
10635class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010636 version = 4
10637 type = 1
10638 err_type = 6
10639
10640 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010641 if xid != None:
10642 self.xid = xid
10643 else:
10644 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010645 if code != None:
10646 self.code = code
10647 else:
10648 self.code = 0
10649 if data != None:
10650 self.data = data
10651 else:
10652 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010653 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010654
10655 def pack(self):
10656 packed = []
10657 packed.append(struct.pack("!B", self.version))
10658 packed.append(struct.pack("!B", self.type))
10659 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10660 packed.append(struct.pack("!L", self.xid))
10661 packed.append(struct.pack("!H", self.err_type))
10662 packed.append(struct.pack("!H", self.code))
10663 packed.append(self.data)
10664 length = sum([len(x) for x in packed])
10665 packed[2] = struct.pack("!H", length)
10666 return ''.join(packed)
10667
10668 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010669 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010670 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010671 _version = reader.read("!B")[0]
10672 assert(_version == 4)
10673 _type = reader.read("!B")[0]
10674 assert(_type == 1)
10675 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010676 orig_reader = reader
10677 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010678 obj.xid = reader.read("!L")[0]
10679 _err_type = reader.read("!H")[0]
10680 assert(_err_type == 6)
10681 obj.code = reader.read("!H")[0]
10682 obj.data = str(reader.read_all())
10683 return obj
10684
10685 def __eq__(self, other):
10686 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010687 if self.xid != other.xid: return False
10688 if self.code != other.code: return False
10689 if self.data != other.data: return False
10690 return True
10691
Rich Lane6f4978c2013-10-20 21:33:52 -070010692 def pretty_print(self, q):
10693 q.text("group_mod_failed_error_msg {")
10694 with q.group():
10695 with q.indent(2):
10696 q.breakable()
10697 q.text("xid = ");
10698 if self.xid != None:
10699 q.text("%#x" % self.xid)
10700 else:
10701 q.text('None')
10702 q.text(","); q.breakable()
10703 q.text("code = ");
10704 q.text("%#x" % self.code)
10705 q.text(","); q.breakable()
10706 q.text("data = ");
10707 q.pp(self.data)
10708 q.breakable()
10709 q.text('}')
10710
Rich Lane7dcdf022013-12-11 14:45:27 -080010711error_msg.subtypes[6] = group_mod_failed_error_msg
10712
10713class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010714 version = 4
10715 type = 15
10716 command = 1
10717
10718 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010719 if xid != None:
10720 self.xid = xid
10721 else:
10722 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010723 if group_type != None:
10724 self.group_type = group_type
10725 else:
10726 self.group_type = 0
10727 if group_id != None:
10728 self.group_id = group_id
10729 else:
10730 self.group_id = 0
10731 if buckets != None:
10732 self.buckets = buckets
10733 else:
10734 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010735 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010736
10737 def pack(self):
10738 packed = []
10739 packed.append(struct.pack("!B", self.version))
10740 packed.append(struct.pack("!B", self.type))
10741 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10742 packed.append(struct.pack("!L", self.xid))
10743 packed.append(struct.pack("!H", self.command))
10744 packed.append(struct.pack("!B", self.group_type))
10745 packed.append('\x00' * 1)
10746 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010747 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010748 length = sum([len(x) for x in packed])
10749 packed[2] = struct.pack("!H", length)
10750 return ''.join(packed)
10751
10752 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010753 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010754 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080010755 _version = reader.read("!B")[0]
10756 assert(_version == 4)
10757 _type = reader.read("!B")[0]
10758 assert(_type == 15)
10759 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010760 orig_reader = reader
10761 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010762 obj.xid = reader.read("!L")[0]
10763 _command = reader.read("!H")[0]
10764 assert(_command == 1)
10765 obj.group_type = reader.read("!B")[0]
10766 reader.skip(1)
10767 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010768 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010769 return obj
10770
10771 def __eq__(self, other):
10772 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010773 if self.xid != other.xid: return False
10774 if self.group_type != other.group_type: return False
10775 if self.group_id != other.group_id: return False
10776 if self.buckets != other.buckets: return False
10777 return True
10778
Rich Lane7b0f2012013-11-22 14:15:26 -080010779 def pretty_print(self, q):
10780 q.text("group_modify {")
10781 with q.group():
10782 with q.indent(2):
10783 q.breakable()
10784 q.text("xid = ");
10785 if self.xid != None:
10786 q.text("%#x" % self.xid)
10787 else:
10788 q.text('None')
10789 q.text(","); q.breakable()
10790 q.text("group_type = ");
10791 q.text("%#x" % self.group_type)
10792 q.text(","); q.breakable()
10793 q.text("group_id = ");
10794 q.text("%#x" % self.group_id)
10795 q.text(","); q.breakable()
10796 q.text("buckets = ");
10797 q.pp(self.buckets)
10798 q.breakable()
10799 q.text('}')
10800
Rich Lane7dcdf022013-12-11 14:45:27 -080010801group_mod.subtypes[1] = group_modify
10802
10803class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010804 version = 4
10805 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010806 stats_type = 6
10807
10808 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010809 if xid != None:
10810 self.xid = xid
10811 else:
10812 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010813 if flags != None:
10814 self.flags = flags
10815 else:
10816 self.flags = 0
10817 if entries != None:
10818 self.entries = entries
10819 else:
10820 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010821 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010822
10823 def pack(self):
10824 packed = []
10825 packed.append(struct.pack("!B", self.version))
10826 packed.append(struct.pack("!B", self.type))
10827 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10828 packed.append(struct.pack("!L", self.xid))
10829 packed.append(struct.pack("!H", self.stats_type))
10830 packed.append(struct.pack("!H", self.flags))
10831 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010832 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010833 length = sum([len(x) for x in packed])
10834 packed[2] = struct.pack("!H", length)
10835 return ''.join(packed)
10836
10837 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010838 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010839 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010840 _version = reader.read("!B")[0]
10841 assert(_version == 4)
10842 _type = reader.read("!B")[0]
10843 assert(_type == 19)
10844 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010845 orig_reader = reader
10846 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010847 obj.xid = reader.read("!L")[0]
10848 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010849 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010850 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010851 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010852 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010853 return obj
10854
10855 def __eq__(self, other):
10856 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010857 if self.xid != other.xid: return False
10858 if self.flags != other.flags: return False
10859 if self.entries != other.entries: return False
10860 return True
10861
Rich Lanec2ee4b82013-04-24 17:12:38 -070010862 def pretty_print(self, q):
10863 q.text("group_stats_reply {")
10864 with q.group():
10865 with q.indent(2):
10866 q.breakable()
10867 q.text("xid = ");
10868 if self.xid != None:
10869 q.text("%#x" % self.xid)
10870 else:
10871 q.text('None')
10872 q.text(","); q.breakable()
10873 q.text("flags = ");
10874 q.text("%#x" % self.flags)
10875 q.text(","); q.breakable()
10876 q.text("entries = ");
10877 q.pp(self.entries)
10878 q.breakable()
10879 q.text('}')
10880
Rich Lane7dcdf022013-12-11 14:45:27 -080010881stats_reply.subtypes[6] = group_stats_reply
10882
10883class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010884 version = 4
10885 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010886 stats_type = 6
10887
10888 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010889 if xid != None:
10890 self.xid = xid
10891 else:
10892 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010893 if flags != None:
10894 self.flags = flags
10895 else:
10896 self.flags = 0
10897 if group_id != None:
10898 self.group_id = group_id
10899 else:
10900 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010901 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010902
10903 def pack(self):
10904 packed = []
10905 packed.append(struct.pack("!B", self.version))
10906 packed.append(struct.pack("!B", self.type))
10907 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10908 packed.append(struct.pack("!L", self.xid))
10909 packed.append(struct.pack("!H", self.stats_type))
10910 packed.append(struct.pack("!H", self.flags))
10911 packed.append('\x00' * 4)
10912 packed.append(struct.pack("!L", self.group_id))
10913 packed.append('\x00' * 4)
10914 length = sum([len(x) for x in packed])
10915 packed[2] = struct.pack("!H", length)
10916 return ''.join(packed)
10917
10918 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010919 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010920 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010921 _version = reader.read("!B")[0]
10922 assert(_version == 4)
10923 _type = reader.read("!B")[0]
10924 assert(_type == 18)
10925 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010926 orig_reader = reader
10927 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010928 obj.xid = reader.read("!L")[0]
10929 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010930 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010931 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010932 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010933 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010934 reader.skip(4)
10935 return obj
10936
10937 def __eq__(self, other):
10938 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010939 if self.xid != other.xid: return False
10940 if self.flags != other.flags: return False
10941 if self.group_id != other.group_id: return False
10942 return True
10943
Rich Lanec2ee4b82013-04-24 17:12:38 -070010944 def pretty_print(self, q):
10945 q.text("group_stats_request {")
10946 with q.group():
10947 with q.indent(2):
10948 q.breakable()
10949 q.text("xid = ");
10950 if self.xid != None:
10951 q.text("%#x" % self.xid)
10952 else:
10953 q.text('None')
10954 q.text(","); q.breakable()
10955 q.text("flags = ");
10956 q.text("%#x" % self.flags)
10957 q.text(","); q.breakable()
10958 q.text("group_id = ");
10959 q.text("%#x" % self.group_id)
10960 q.breakable()
10961 q.text('}')
10962
Rich Lane7dcdf022013-12-11 14:45:27 -080010963stats_request.subtypes[6] = group_stats_request
10964
10965class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010966 version = 4
10967 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070010968
10969 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010970 if xid != None:
10971 self.xid = xid
10972 else:
10973 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010974 if elements != None:
10975 self.elements = elements
10976 else:
10977 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010978 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010979
10980 def pack(self):
10981 packed = []
10982 packed.append(struct.pack("!B", self.version))
10983 packed.append(struct.pack("!B", self.type))
10984 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10985 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080010986 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010987 length = sum([len(x) for x in packed])
10988 packed[2] = struct.pack("!H", length)
10989 return ''.join(packed)
10990
10991 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010992 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010993 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070010994 _version = reader.read("!B")[0]
10995 assert(_version == 4)
10996 _type = reader.read("!B")[0]
10997 assert(_type == 0)
10998 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010999 orig_reader = reader
11000 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011001 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080011002 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011003 return obj
11004
11005 def __eq__(self, other):
11006 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011007 if self.xid != other.xid: return False
11008 if self.elements != other.elements: return False
11009 return True
11010
Rich Lanec2ee4b82013-04-24 17:12:38 -070011011 def pretty_print(self, q):
11012 q.text("hello {")
11013 with q.group():
11014 with q.indent(2):
11015 q.breakable()
11016 q.text("xid = ");
11017 if self.xid != None:
11018 q.text("%#x" % self.xid)
11019 else:
11020 q.text('None')
11021 q.text(","); q.breakable()
11022 q.text("elements = ");
11023 q.pp(self.elements)
11024 q.breakable()
11025 q.text('}')
11026
Rich Lane7dcdf022013-12-11 14:45:27 -080011027message.subtypes[0] = hello
11028
11029class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011030 version = 4
11031 type = 1
11032 err_type = 0
11033
11034 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011035 if xid != None:
11036 self.xid = xid
11037 else:
11038 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011039 if code != None:
11040 self.code = code
11041 else:
11042 self.code = 0
11043 if data != None:
11044 self.data = data
11045 else:
11046 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011047 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011048
11049 def pack(self):
11050 packed = []
11051 packed.append(struct.pack("!B", self.version))
11052 packed.append(struct.pack("!B", self.type))
11053 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11054 packed.append(struct.pack("!L", self.xid))
11055 packed.append(struct.pack("!H", self.err_type))
11056 packed.append(struct.pack("!H", self.code))
11057 packed.append(self.data)
11058 length = sum([len(x) for x in packed])
11059 packed[2] = struct.pack("!H", length)
11060 return ''.join(packed)
11061
11062 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011063 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011064 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011065 _version = reader.read("!B")[0]
11066 assert(_version == 4)
11067 _type = reader.read("!B")[0]
11068 assert(_type == 1)
11069 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011070 orig_reader = reader
11071 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011072 obj.xid = reader.read("!L")[0]
11073 _err_type = reader.read("!H")[0]
11074 assert(_err_type == 0)
11075 obj.code = reader.read("!H")[0]
11076 obj.data = str(reader.read_all())
11077 return obj
11078
11079 def __eq__(self, other):
11080 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011081 if self.xid != other.xid: return False
11082 if self.code != other.code: return False
11083 if self.data != other.data: return False
11084 return True
11085
Rich Lane6f4978c2013-10-20 21:33:52 -070011086 def pretty_print(self, q):
11087 q.text("hello_failed_error_msg {")
11088 with q.group():
11089 with q.indent(2):
11090 q.breakable()
11091 q.text("xid = ");
11092 if self.xid != None:
11093 q.text("%#x" % self.xid)
11094 else:
11095 q.text('None')
11096 q.text(","); q.breakable()
11097 q.text("code = ");
11098 q.text("%#x" % self.code)
11099 q.text(","); q.breakable()
11100 q.text("data = ");
11101 q.pp(self.data)
11102 q.breakable()
11103 q.text('}')
11104
Rich Lane7dcdf022013-12-11 14:45:27 -080011105error_msg.subtypes[0] = hello_failed_error_msg
11106
11107class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011108 version = 4
11109 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011110 stats_type = 10
11111
11112 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011113 if xid != None:
11114 self.xid = xid
11115 else:
11116 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011117 if flags != None:
11118 self.flags = flags
11119 else:
11120 self.flags = 0
11121 if entries != None:
11122 self.entries = entries
11123 else:
11124 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011125 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011126
11127 def pack(self):
11128 packed = []
11129 packed.append(struct.pack("!B", self.version))
11130 packed.append(struct.pack("!B", self.type))
11131 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11132 packed.append(struct.pack("!L", self.xid))
11133 packed.append(struct.pack("!H", self.stats_type))
11134 packed.append(struct.pack("!H", self.flags))
11135 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011136 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011137 length = sum([len(x) for x in packed])
11138 packed[2] = struct.pack("!H", length)
11139 return ''.join(packed)
11140
11141 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011142 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011143 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011144 _version = reader.read("!B")[0]
11145 assert(_version == 4)
11146 _type = reader.read("!B")[0]
11147 assert(_type == 19)
11148 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011149 orig_reader = reader
11150 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011151 obj.xid = reader.read("!L")[0]
11152 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011153 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070011154 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011155 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011156 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011157 return obj
11158
11159 def __eq__(self, other):
11160 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011161 if self.xid != other.xid: return False
11162 if self.flags != other.flags: return False
11163 if self.entries != other.entries: return False
11164 return True
11165
Rich Lanec2ee4b82013-04-24 17:12:38 -070011166 def pretty_print(self, q):
11167 q.text("meter_config_stats_reply {")
11168 with q.group():
11169 with q.indent(2):
11170 q.breakable()
11171 q.text("xid = ");
11172 if self.xid != None:
11173 q.text("%#x" % self.xid)
11174 else:
11175 q.text('None')
11176 q.text(","); q.breakable()
11177 q.text("flags = ");
11178 q.text("%#x" % self.flags)
11179 q.text(","); q.breakable()
11180 q.text("entries = ");
11181 q.pp(self.entries)
11182 q.breakable()
11183 q.text('}')
11184
Rich Lane7dcdf022013-12-11 14:45:27 -080011185stats_reply.subtypes[10] = meter_config_stats_reply
11186
11187class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011188 version = 4
11189 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011190 stats_type = 10
11191
11192 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011193 if xid != None:
11194 self.xid = xid
11195 else:
11196 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011197 if flags != None:
11198 self.flags = flags
11199 else:
11200 self.flags = 0
11201 if meter_id != None:
11202 self.meter_id = meter_id
11203 else:
11204 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011205 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011206
11207 def pack(self):
11208 packed = []
11209 packed.append(struct.pack("!B", self.version))
11210 packed.append(struct.pack("!B", self.type))
11211 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11212 packed.append(struct.pack("!L", self.xid))
11213 packed.append(struct.pack("!H", self.stats_type))
11214 packed.append(struct.pack("!H", self.flags))
11215 packed.append('\x00' * 4)
11216 packed.append(struct.pack("!L", self.meter_id))
11217 packed.append('\x00' * 4)
11218 length = sum([len(x) for x in packed])
11219 packed[2] = struct.pack("!H", length)
11220 return ''.join(packed)
11221
11222 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011223 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011224 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011225 _version = reader.read("!B")[0]
11226 assert(_version == 4)
11227 _type = reader.read("!B")[0]
11228 assert(_type == 18)
11229 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011230 orig_reader = reader
11231 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011232 obj.xid = reader.read("!L")[0]
11233 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011234 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070011235 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011236 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011237 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011238 reader.skip(4)
11239 return obj
11240
11241 def __eq__(self, other):
11242 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011243 if self.xid != other.xid: return False
11244 if self.flags != other.flags: return False
11245 if self.meter_id != other.meter_id: return False
11246 return True
11247
Rich Lanec2ee4b82013-04-24 17:12:38 -070011248 def pretty_print(self, q):
11249 q.text("meter_config_stats_request {")
11250 with q.group():
11251 with q.indent(2):
11252 q.breakable()
11253 q.text("xid = ");
11254 if self.xid != None:
11255 q.text("%#x" % self.xid)
11256 else:
11257 q.text('None')
11258 q.text(","); q.breakable()
11259 q.text("flags = ");
11260 q.text("%#x" % self.flags)
11261 q.text(","); q.breakable()
11262 q.text("meter_id = ");
11263 q.text("%#x" % self.meter_id)
11264 q.breakable()
11265 q.text('}')
11266
Rich Lane7dcdf022013-12-11 14:45:27 -080011267stats_request.subtypes[10] = meter_config_stats_request
11268
11269class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011270 version = 4
11271 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011272 stats_type = 11
11273
11274 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011275 if xid != None:
11276 self.xid = xid
11277 else:
11278 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011279 if flags != None:
11280 self.flags = flags
11281 else:
11282 self.flags = 0
11283 if features != None:
11284 self.features = features
11285 else:
11286 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080011287 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011288
11289 def pack(self):
11290 packed = []
11291 packed.append(struct.pack("!B", self.version))
11292 packed.append(struct.pack("!B", self.type))
11293 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11294 packed.append(struct.pack("!L", self.xid))
11295 packed.append(struct.pack("!H", self.stats_type))
11296 packed.append(struct.pack("!H", self.flags))
11297 packed.append('\x00' * 4)
11298 packed.append(self.features.pack())
11299 length = sum([len(x) for x in packed])
11300 packed[2] = struct.pack("!H", length)
11301 return ''.join(packed)
11302
11303 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011304 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011305 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011306 _version = reader.read("!B")[0]
11307 assert(_version == 4)
11308 _type = reader.read("!B")[0]
11309 assert(_type == 19)
11310 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011311 orig_reader = reader
11312 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011313 obj.xid = reader.read("!L")[0]
11314 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011315 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070011316 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011317 reader.skip(4)
11318 obj.features = common.meter_features.unpack(reader)
11319 return obj
11320
11321 def __eq__(self, other):
11322 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011323 if self.xid != other.xid: return False
11324 if self.flags != other.flags: return False
11325 if self.features != other.features: return False
11326 return True
11327
Rich Lanec2ee4b82013-04-24 17:12:38 -070011328 def pretty_print(self, q):
11329 q.text("meter_features_stats_reply {")
11330 with q.group():
11331 with q.indent(2):
11332 q.breakable()
11333 q.text("xid = ");
11334 if self.xid != None:
11335 q.text("%#x" % self.xid)
11336 else:
11337 q.text('None')
11338 q.text(","); q.breakable()
11339 q.text("flags = ");
11340 q.text("%#x" % self.flags)
11341 q.text(","); q.breakable()
11342 q.text("features = ");
11343 q.pp(self.features)
11344 q.breakable()
11345 q.text('}')
11346
Rich Lane7dcdf022013-12-11 14:45:27 -080011347stats_reply.subtypes[11] = meter_features_stats_reply
11348
11349class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011350 version = 4
11351 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011352 stats_type = 11
11353
11354 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011355 if xid != None:
11356 self.xid = xid
11357 else:
11358 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011359 if flags != None:
11360 self.flags = flags
11361 else:
11362 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011363 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011364
11365 def pack(self):
11366 packed = []
11367 packed.append(struct.pack("!B", self.version))
11368 packed.append(struct.pack("!B", self.type))
11369 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11370 packed.append(struct.pack("!L", self.xid))
11371 packed.append(struct.pack("!H", self.stats_type))
11372 packed.append(struct.pack("!H", self.flags))
11373 packed.append('\x00' * 4)
11374 length = sum([len(x) for x in packed])
11375 packed[2] = struct.pack("!H", length)
11376 return ''.join(packed)
11377
11378 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011379 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011380 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011381 _version = reader.read("!B")[0]
11382 assert(_version == 4)
11383 _type = reader.read("!B")[0]
11384 assert(_type == 18)
11385 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011386 orig_reader = reader
11387 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011388 obj.xid = reader.read("!L")[0]
11389 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011390 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070011391 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011392 reader.skip(4)
11393 return obj
11394
11395 def __eq__(self, other):
11396 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011397 if self.xid != other.xid: return False
11398 if self.flags != other.flags: return False
11399 return True
11400
Rich Lanec2ee4b82013-04-24 17:12:38 -070011401 def pretty_print(self, q):
11402 q.text("meter_features_stats_request {")
11403 with q.group():
11404 with q.indent(2):
11405 q.breakable()
11406 q.text("xid = ");
11407 if self.xid != None:
11408 q.text("%#x" % self.xid)
11409 else:
11410 q.text('None')
11411 q.text(","); q.breakable()
11412 q.text("flags = ");
11413 q.text("%#x" % self.flags)
11414 q.breakable()
11415 q.text('}')
11416
Rich Lane7dcdf022013-12-11 14:45:27 -080011417stats_request.subtypes[11] = meter_features_stats_request
11418
11419class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011420 version = 4
11421 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070011422
11423 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011424 if xid != None:
11425 self.xid = xid
11426 else:
11427 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011428 if command != None:
11429 self.command = command
11430 else:
11431 self.command = 0
11432 if flags != None:
11433 self.flags = flags
11434 else:
11435 self.flags = 0
11436 if meter_id != None:
11437 self.meter_id = meter_id
11438 else:
11439 self.meter_id = 0
11440 if meters != None:
11441 self.meters = meters
11442 else:
11443 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011444 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011445
11446 def pack(self):
11447 packed = []
11448 packed.append(struct.pack("!B", self.version))
11449 packed.append(struct.pack("!B", self.type))
11450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11451 packed.append(struct.pack("!L", self.xid))
11452 packed.append(struct.pack("!H", self.command))
11453 packed.append(struct.pack("!H", self.flags))
11454 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011455 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011456 length = sum([len(x) for x in packed])
11457 packed[2] = struct.pack("!H", length)
11458 return ''.join(packed)
11459
11460 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011461 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011462 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070011463 _version = reader.read("!B")[0]
11464 assert(_version == 4)
11465 _type = reader.read("!B")[0]
11466 assert(_type == 29)
11467 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011468 orig_reader = reader
11469 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011470 obj.xid = reader.read("!L")[0]
11471 obj.command = reader.read("!H")[0]
11472 obj.flags = reader.read("!H")[0]
11473 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011474 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011475 return obj
11476
11477 def __eq__(self, other):
11478 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011479 if self.xid != other.xid: return False
11480 if self.command != other.command: return False
11481 if self.flags != other.flags: return False
11482 if self.meter_id != other.meter_id: return False
11483 if self.meters != other.meters: return False
11484 return True
11485
Rich Lanec2ee4b82013-04-24 17:12:38 -070011486 def pretty_print(self, q):
11487 q.text("meter_mod {")
11488 with q.group():
11489 with q.indent(2):
11490 q.breakable()
11491 q.text("xid = ");
11492 if self.xid != None:
11493 q.text("%#x" % self.xid)
11494 else:
11495 q.text('None')
11496 q.text(","); q.breakable()
11497 q.text("command = ");
11498 q.text("%#x" % self.command)
11499 q.text(","); q.breakable()
11500 q.text("flags = ");
11501 q.text("%#x" % self.flags)
11502 q.text(","); q.breakable()
11503 q.text("meter_id = ");
11504 q.text("%#x" % self.meter_id)
11505 q.text(","); q.breakable()
11506 q.text("meters = ");
11507 q.pp(self.meters)
11508 q.breakable()
11509 q.text('}')
11510
Rich Lane7dcdf022013-12-11 14:45:27 -080011511message.subtypes[29] = meter_mod
11512
11513class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011514 version = 4
11515 type = 1
11516 err_type = 12
11517
11518 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011519 if xid != None:
11520 self.xid = xid
11521 else:
11522 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011523 if code != None:
11524 self.code = code
11525 else:
11526 self.code = 0
11527 if data != None:
11528 self.data = data
11529 else:
11530 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011531 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011532
11533 def pack(self):
11534 packed = []
11535 packed.append(struct.pack("!B", self.version))
11536 packed.append(struct.pack("!B", self.type))
11537 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11538 packed.append(struct.pack("!L", self.xid))
11539 packed.append(struct.pack("!H", self.err_type))
11540 packed.append(struct.pack("!H", self.code))
11541 packed.append(self.data)
11542 length = sum([len(x) for x in packed])
11543 packed[2] = struct.pack("!H", length)
11544 return ''.join(packed)
11545
11546 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011547 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011548 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011549 _version = reader.read("!B")[0]
11550 assert(_version == 4)
11551 _type = reader.read("!B")[0]
11552 assert(_type == 1)
11553 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011554 orig_reader = reader
11555 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011556 obj.xid = reader.read("!L")[0]
11557 _err_type = reader.read("!H")[0]
11558 assert(_err_type == 12)
11559 obj.code = reader.read("!H")[0]
11560 obj.data = str(reader.read_all())
11561 return obj
11562
11563 def __eq__(self, other):
11564 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011565 if self.xid != other.xid: return False
11566 if self.code != other.code: return False
11567 if self.data != other.data: return False
11568 return True
11569
Rich Lane6f4978c2013-10-20 21:33:52 -070011570 def pretty_print(self, q):
11571 q.text("meter_mod_failed_error_msg {")
11572 with q.group():
11573 with q.indent(2):
11574 q.breakable()
11575 q.text("xid = ");
11576 if self.xid != None:
11577 q.text("%#x" % self.xid)
11578 else:
11579 q.text('None')
11580 q.text(","); q.breakable()
11581 q.text("code = ");
11582 q.text("%#x" % self.code)
11583 q.text(","); q.breakable()
11584 q.text("data = ");
11585 q.pp(self.data)
11586 q.breakable()
11587 q.text('}')
11588
Rich Lane7dcdf022013-12-11 14:45:27 -080011589error_msg.subtypes[12] = meter_mod_failed_error_msg
11590
11591class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011592 version = 4
11593 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011594 stats_type = 9
11595
11596 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011597 if xid != None:
11598 self.xid = xid
11599 else:
11600 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011601 if flags != None:
11602 self.flags = flags
11603 else:
11604 self.flags = 0
11605 if entries != None:
11606 self.entries = entries
11607 else:
11608 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011609 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011610
11611 def pack(self):
11612 packed = []
11613 packed.append(struct.pack("!B", self.version))
11614 packed.append(struct.pack("!B", self.type))
11615 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11616 packed.append(struct.pack("!L", self.xid))
11617 packed.append(struct.pack("!H", self.stats_type))
11618 packed.append(struct.pack("!H", self.flags))
11619 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011620 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011621 length = sum([len(x) for x in packed])
11622 packed[2] = struct.pack("!H", length)
11623 return ''.join(packed)
11624
11625 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011626 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011627 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011628 _version = reader.read("!B")[0]
11629 assert(_version == 4)
11630 _type = reader.read("!B")[0]
11631 assert(_type == 19)
11632 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011633 orig_reader = reader
11634 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011635 obj.xid = reader.read("!L")[0]
11636 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011637 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011638 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011639 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011640 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011641 return obj
11642
11643 def __eq__(self, other):
11644 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011645 if self.xid != other.xid: return False
11646 if self.flags != other.flags: return False
11647 if self.entries != other.entries: return False
11648 return True
11649
Rich Lanec2ee4b82013-04-24 17:12:38 -070011650 def pretty_print(self, q):
11651 q.text("meter_stats_reply {")
11652 with q.group():
11653 with q.indent(2):
11654 q.breakable()
11655 q.text("xid = ");
11656 if self.xid != None:
11657 q.text("%#x" % self.xid)
11658 else:
11659 q.text('None')
11660 q.text(","); q.breakable()
11661 q.text("flags = ");
11662 q.text("%#x" % self.flags)
11663 q.text(","); q.breakable()
11664 q.text("entries = ");
11665 q.pp(self.entries)
11666 q.breakable()
11667 q.text('}')
11668
Rich Lane7dcdf022013-12-11 14:45:27 -080011669stats_reply.subtypes[9] = meter_stats_reply
11670
11671class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011672 version = 4
11673 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011674 stats_type = 9
11675
11676 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011677 if xid != None:
11678 self.xid = xid
11679 else:
11680 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011681 if flags != None:
11682 self.flags = flags
11683 else:
11684 self.flags = 0
11685 if meter_id != None:
11686 self.meter_id = meter_id
11687 else:
11688 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011689 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011690
11691 def pack(self):
11692 packed = []
11693 packed.append(struct.pack("!B", self.version))
11694 packed.append(struct.pack("!B", self.type))
11695 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11696 packed.append(struct.pack("!L", self.xid))
11697 packed.append(struct.pack("!H", self.stats_type))
11698 packed.append(struct.pack("!H", self.flags))
11699 packed.append('\x00' * 4)
11700 packed.append(struct.pack("!L", self.meter_id))
11701 packed.append('\x00' * 4)
11702 length = sum([len(x) for x in packed])
11703 packed[2] = struct.pack("!H", length)
11704 return ''.join(packed)
11705
11706 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011707 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011708 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011709 _version = reader.read("!B")[0]
11710 assert(_version == 4)
11711 _type = reader.read("!B")[0]
11712 assert(_type == 18)
11713 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011714 orig_reader = reader
11715 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011716 obj.xid = reader.read("!L")[0]
11717 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011718 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011719 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011720 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011721 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011722 reader.skip(4)
11723 return obj
11724
11725 def __eq__(self, other):
11726 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011727 if self.xid != other.xid: return False
11728 if self.flags != other.flags: return False
11729 if self.meter_id != other.meter_id: return False
11730 return True
11731
Rich Lanec2ee4b82013-04-24 17:12:38 -070011732 def pretty_print(self, q):
11733 q.text("meter_stats_request {")
11734 with q.group():
11735 with q.indent(2):
11736 q.breakable()
11737 q.text("xid = ");
11738 if self.xid != None:
11739 q.text("%#x" % self.xid)
11740 else:
11741 q.text('None')
11742 q.text(","); q.breakable()
11743 q.text("flags = ");
11744 q.text("%#x" % self.flags)
11745 q.text(","); q.breakable()
11746 q.text("meter_id = ");
11747 q.text("%#x" % self.meter_id)
11748 q.breakable()
11749 q.text('}')
11750
Rich Lane7dcdf022013-12-11 14:45:27 -080011751stats_request.subtypes[9] = meter_stats_request
11752
11753class nicira_header(experimenter):
11754 subtypes = {}
11755
Rich Lane95f7fc92014-01-27 17:08:16 -080011756 version = 4
11757 type = 4
11758 experimenter = 8992
11759
11760 def __init__(self, xid=None, subtype=None):
11761 if xid != None:
11762 self.xid = xid
11763 else:
11764 self.xid = None
11765 if subtype != None:
11766 self.subtype = subtype
11767 else:
11768 self.subtype = 0
11769 return
11770
11771 def pack(self):
11772 packed = []
11773 packed.append(struct.pack("!B", self.version))
11774 packed.append(struct.pack("!B", self.type))
11775 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11776 packed.append(struct.pack("!L", self.xid))
11777 packed.append(struct.pack("!L", self.experimenter))
11778 packed.append(struct.pack("!L", self.subtype))
11779 length = sum([len(x) for x in packed])
11780 packed[2] = struct.pack("!H", length)
11781 return ''.join(packed)
11782
Rich Lane7dcdf022013-12-11 14:45:27 -080011783 @staticmethod
11784 def unpack(reader):
11785 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080011786 subclass = nicira_header.subtypes.get(subtype)
11787 if subclass:
11788 return subclass.unpack(reader)
11789
11790 obj = nicira_header()
11791 _version = reader.read("!B")[0]
11792 assert(_version == 4)
11793 _type = reader.read("!B")[0]
11794 assert(_type == 4)
11795 _length = reader.read("!H")[0]
11796 orig_reader = reader
11797 reader = orig_reader.slice(_length - (2 + 2))
11798 obj.xid = reader.read("!L")[0]
11799 _experimenter = reader.read("!L")[0]
11800 assert(_experimenter == 8992)
11801 obj.subtype = reader.read("!L")[0]
11802 return obj
11803
11804 def __eq__(self, other):
11805 if type(self) != type(other): return False
11806 if self.xid != other.xid: return False
11807 if self.subtype != other.subtype: return False
11808 return True
11809
11810 def pretty_print(self, q):
11811 q.text("nicira_header {")
11812 with q.group():
11813 with q.indent(2):
11814 q.breakable()
11815 q.text("xid = ");
11816 if self.xid != None:
11817 q.text("%#x" % self.xid)
11818 else:
11819 q.text('None')
11820 q.breakable()
11821 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011822
11823experimenter.subtypes[8992] = nicira_header
11824
11825class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011826 version = 4
11827 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070011828
11829 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 -080011830 if xid != None:
11831 self.xid = xid
11832 else:
11833 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011834 if buffer_id != None:
11835 self.buffer_id = buffer_id
11836 else:
11837 self.buffer_id = 0
11838 if total_len != None:
11839 self.total_len = total_len
11840 else:
11841 self.total_len = 0
11842 if reason != None:
11843 self.reason = reason
11844 else:
11845 self.reason = 0
11846 if table_id != None:
11847 self.table_id = table_id
11848 else:
11849 self.table_id = 0
11850 if cookie != None:
11851 self.cookie = cookie
11852 else:
11853 self.cookie = 0
11854 if match != None:
11855 self.match = match
11856 else:
11857 self.match = common.match()
11858 if data != None:
11859 self.data = data
11860 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011861 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011862 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011863
11864 def pack(self):
11865 packed = []
11866 packed.append(struct.pack("!B", self.version))
11867 packed.append(struct.pack("!B", self.type))
11868 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11869 packed.append(struct.pack("!L", self.xid))
11870 packed.append(struct.pack("!L", self.buffer_id))
11871 packed.append(struct.pack("!H", self.total_len))
11872 packed.append(struct.pack("!B", self.reason))
11873 packed.append(struct.pack("!B", self.table_id))
11874 packed.append(struct.pack("!Q", self.cookie))
11875 packed.append(self.match.pack())
11876 packed.append('\x00' * 2)
11877 packed.append(self.data)
11878 length = sum([len(x) for x in packed])
11879 packed[2] = struct.pack("!H", length)
11880 return ''.join(packed)
11881
11882 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011883 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011884 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070011885 _version = reader.read("!B")[0]
11886 assert(_version == 4)
11887 _type = reader.read("!B")[0]
11888 assert(_type == 10)
11889 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011890 orig_reader = reader
11891 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011892 obj.xid = reader.read("!L")[0]
11893 obj.buffer_id = reader.read("!L")[0]
11894 obj.total_len = reader.read("!H")[0]
11895 obj.reason = reader.read("!B")[0]
11896 obj.table_id = reader.read("!B")[0]
11897 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011898 obj.match = common.match.unpack(reader)
11899 reader.skip(2)
11900 obj.data = str(reader.read_all())
11901 return obj
11902
11903 def __eq__(self, other):
11904 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011905 if self.xid != other.xid: return False
11906 if self.buffer_id != other.buffer_id: return False
11907 if self.total_len != other.total_len: return False
11908 if self.reason != other.reason: return False
11909 if self.table_id != other.table_id: return False
11910 if self.cookie != other.cookie: return False
11911 if self.match != other.match: return False
11912 if self.data != other.data: return False
11913 return True
11914
Rich Lanec2ee4b82013-04-24 17:12:38 -070011915 def pretty_print(self, q):
11916 q.text("packet_in {")
11917 with q.group():
11918 with q.indent(2):
11919 q.breakable()
11920 q.text("xid = ");
11921 if self.xid != None:
11922 q.text("%#x" % self.xid)
11923 else:
11924 q.text('None')
11925 q.text(","); q.breakable()
11926 q.text("buffer_id = ");
11927 q.text("%#x" % self.buffer_id)
11928 q.text(","); q.breakable()
11929 q.text("total_len = ");
11930 q.text("%#x" % self.total_len)
11931 q.text(","); q.breakable()
11932 q.text("reason = ");
11933 q.text("%#x" % self.reason)
11934 q.text(","); q.breakable()
11935 q.text("table_id = ");
11936 q.text("%#x" % self.table_id)
11937 q.text(","); q.breakable()
11938 q.text("cookie = ");
11939 q.text("%#x" % self.cookie)
11940 q.text(","); q.breakable()
11941 q.text("match = ");
11942 q.pp(self.match)
11943 q.text(","); q.breakable()
11944 q.text("data = ");
11945 q.pp(self.data)
11946 q.breakable()
11947 q.text('}')
11948
Rich Lane7dcdf022013-12-11 14:45:27 -080011949message.subtypes[10] = packet_in
11950
11951class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011952 version = 4
11953 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070011954
11955 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011956 if xid != None:
11957 self.xid = xid
11958 else:
11959 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011960 if buffer_id != None:
11961 self.buffer_id = buffer_id
11962 else:
11963 self.buffer_id = 0
11964 if in_port != None:
11965 self.in_port = in_port
11966 else:
11967 self.in_port = 0
11968 if actions != None:
11969 self.actions = actions
11970 else:
11971 self.actions = []
11972 if data != None:
11973 self.data = data
11974 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011975 self.data = ''
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("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070011985 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011986 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
11987 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080011988 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011989 packed[6] = struct.pack("!H", len(packed[-1]))
11990 packed.append(self.data)
11991 length = sum([len(x) for x in packed])
11992 packed[2] = struct.pack("!H", length)
11993 return ''.join(packed)
11994
11995 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011996 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011997 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070011998 _version = reader.read("!B")[0]
11999 assert(_version == 4)
12000 _type = reader.read("!B")[0]
12001 assert(_type == 13)
12002 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012003 orig_reader = reader
12004 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012005 obj.xid = reader.read("!L")[0]
12006 obj.buffer_id = reader.read("!L")[0]
12007 obj.in_port = util.unpack_port_no(reader)
12008 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012009 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080012010 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012011 obj.data = str(reader.read_all())
12012 return obj
12013
12014 def __eq__(self, other):
12015 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012016 if self.xid != other.xid: return False
12017 if self.buffer_id != other.buffer_id: return False
12018 if self.in_port != other.in_port: return False
12019 if self.actions != other.actions: return False
12020 if self.data != other.data: return False
12021 return True
12022
Rich Lanec2ee4b82013-04-24 17:12:38 -070012023 def pretty_print(self, q):
12024 q.text("packet_out {")
12025 with q.group():
12026 with q.indent(2):
12027 q.breakable()
12028 q.text("xid = ");
12029 if self.xid != None:
12030 q.text("%#x" % self.xid)
12031 else:
12032 q.text('None')
12033 q.text(","); q.breakable()
12034 q.text("buffer_id = ");
12035 q.text("%#x" % self.buffer_id)
12036 q.text(","); q.breakable()
12037 q.text("in_port = ");
12038 q.text(util.pretty_port(self.in_port))
12039 q.text(","); q.breakable()
12040 q.text("actions = ");
12041 q.pp(self.actions)
12042 q.text(","); q.breakable()
12043 q.text("data = ");
12044 q.pp(self.data)
12045 q.breakable()
12046 q.text('}')
12047
Rich Lane7dcdf022013-12-11 14:45:27 -080012048message.subtypes[13] = packet_out
12049
12050class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012051 version = 4
12052 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012053 stats_type = 13
12054
12055 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012056 if xid != None:
12057 self.xid = xid
12058 else:
12059 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012060 if flags != None:
12061 self.flags = flags
12062 else:
12063 self.flags = 0
12064 if entries != None:
12065 self.entries = entries
12066 else:
12067 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012068 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012069
12070 def pack(self):
12071 packed = []
12072 packed.append(struct.pack("!B", self.version))
12073 packed.append(struct.pack("!B", self.type))
12074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12075 packed.append(struct.pack("!L", self.xid))
12076 packed.append(struct.pack("!H", self.stats_type))
12077 packed.append(struct.pack("!H", self.flags))
12078 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012079 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012080 length = sum([len(x) for x in packed])
12081 packed[2] = struct.pack("!H", length)
12082 return ''.join(packed)
12083
12084 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012085 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012086 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012087 _version = reader.read("!B")[0]
12088 assert(_version == 4)
12089 _type = reader.read("!B")[0]
12090 assert(_type == 19)
12091 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012092 orig_reader = reader
12093 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012094 obj.xid = reader.read("!L")[0]
12095 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012096 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070012097 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012098 reader.skip(4)
12099 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
12100 return obj
12101
12102 def __eq__(self, other):
12103 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012104 if self.xid != other.xid: return False
12105 if self.flags != other.flags: return False
12106 if self.entries != other.entries: return False
12107 return True
12108
Rich Lanec2ee4b82013-04-24 17:12:38 -070012109 def pretty_print(self, q):
12110 q.text("port_desc_stats_reply {")
12111 with q.group():
12112 with q.indent(2):
12113 q.breakable()
12114 q.text("xid = ");
12115 if self.xid != None:
12116 q.text("%#x" % self.xid)
12117 else:
12118 q.text('None')
12119 q.text(","); q.breakable()
12120 q.text("flags = ");
12121 q.text("%#x" % self.flags)
12122 q.text(","); q.breakable()
12123 q.text("entries = ");
12124 q.pp(self.entries)
12125 q.breakable()
12126 q.text('}')
12127
Rich Lane7dcdf022013-12-11 14:45:27 -080012128stats_reply.subtypes[13] = port_desc_stats_reply
12129
12130class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012131 version = 4
12132 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012133 stats_type = 13
12134
12135 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012136 if xid != None:
12137 self.xid = xid
12138 else:
12139 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012140 if flags != None:
12141 self.flags = flags
12142 else:
12143 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012144 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012145
12146 def pack(self):
12147 packed = []
12148 packed.append(struct.pack("!B", self.version))
12149 packed.append(struct.pack("!B", self.type))
12150 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12151 packed.append(struct.pack("!L", self.xid))
12152 packed.append(struct.pack("!H", self.stats_type))
12153 packed.append(struct.pack("!H", self.flags))
12154 packed.append('\x00' * 4)
12155 length = sum([len(x) for x in packed])
12156 packed[2] = struct.pack("!H", length)
12157 return ''.join(packed)
12158
12159 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012160 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012161 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012162 _version = reader.read("!B")[0]
12163 assert(_version == 4)
12164 _type = reader.read("!B")[0]
12165 assert(_type == 18)
12166 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012167 orig_reader = reader
12168 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012169 obj.xid = reader.read("!L")[0]
12170 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012171 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070012172 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012173 reader.skip(4)
12174 return obj
12175
12176 def __eq__(self, other):
12177 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012178 if self.xid != other.xid: return False
12179 if self.flags != other.flags: return False
12180 return True
12181
Rich Lanec2ee4b82013-04-24 17:12:38 -070012182 def pretty_print(self, q):
12183 q.text("port_desc_stats_request {")
12184 with q.group():
12185 with q.indent(2):
12186 q.breakable()
12187 q.text("xid = ");
12188 if self.xid != None:
12189 q.text("%#x" % self.xid)
12190 else:
12191 q.text('None')
12192 q.text(","); q.breakable()
12193 q.text("flags = ");
12194 q.text("%#x" % self.flags)
12195 q.breakable()
12196 q.text('}')
12197
Rich Lane7dcdf022013-12-11 14:45:27 -080012198stats_request.subtypes[13] = port_desc_stats_request
12199
12200class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012201 version = 4
12202 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070012203
12204 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012205 if xid != None:
12206 self.xid = xid
12207 else:
12208 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012209 if port_no != None:
12210 self.port_no = port_no
12211 else:
12212 self.port_no = 0
12213 if hw_addr != None:
12214 self.hw_addr = hw_addr
12215 else:
12216 self.hw_addr = [0,0,0,0,0,0]
12217 if config != None:
12218 self.config = config
12219 else:
12220 self.config = 0
12221 if mask != None:
12222 self.mask = mask
12223 else:
12224 self.mask = 0
12225 if advertise != None:
12226 self.advertise = advertise
12227 else:
12228 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012229 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012230
12231 def pack(self):
12232 packed = []
12233 packed.append(struct.pack("!B", self.version))
12234 packed.append(struct.pack("!B", self.type))
12235 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12236 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012237 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012238 packed.append('\x00' * 4)
12239 packed.append(struct.pack("!6B", *self.hw_addr))
12240 packed.append('\x00' * 2)
12241 packed.append(struct.pack("!L", self.config))
12242 packed.append(struct.pack("!L", self.mask))
12243 packed.append(struct.pack("!L", self.advertise))
12244 packed.append('\x00' * 4)
12245 length = sum([len(x) for x in packed])
12246 packed[2] = struct.pack("!H", length)
12247 return ''.join(packed)
12248
12249 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012250 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012251 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012252 _version = reader.read("!B")[0]
12253 assert(_version == 4)
12254 _type = reader.read("!B")[0]
12255 assert(_type == 16)
12256 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012257 orig_reader = reader
12258 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012259 obj.xid = reader.read("!L")[0]
12260 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012261 reader.skip(4)
12262 obj.hw_addr = list(reader.read('!6B'))
12263 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070012264 obj.config = reader.read("!L")[0]
12265 obj.mask = reader.read("!L")[0]
12266 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012267 reader.skip(4)
12268 return obj
12269
12270 def __eq__(self, other):
12271 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012272 if self.xid != other.xid: return False
12273 if self.port_no != other.port_no: return False
12274 if self.hw_addr != other.hw_addr: return False
12275 if self.config != other.config: return False
12276 if self.mask != other.mask: return False
12277 if self.advertise != other.advertise: return False
12278 return True
12279
Rich Lanec2ee4b82013-04-24 17:12:38 -070012280 def pretty_print(self, q):
12281 q.text("port_mod {")
12282 with q.group():
12283 with q.indent(2):
12284 q.breakable()
12285 q.text("xid = ");
12286 if self.xid != None:
12287 q.text("%#x" % self.xid)
12288 else:
12289 q.text('None')
12290 q.text(","); q.breakable()
12291 q.text("port_no = ");
12292 q.text(util.pretty_port(self.port_no))
12293 q.text(","); q.breakable()
12294 q.text("hw_addr = ");
12295 q.text(util.pretty_mac(self.hw_addr))
12296 q.text(","); q.breakable()
12297 q.text("config = ");
12298 q.text("%#x" % self.config)
12299 q.text(","); q.breakable()
12300 q.text("mask = ");
12301 q.text("%#x" % self.mask)
12302 q.text(","); q.breakable()
12303 q.text("advertise = ");
12304 q.text("%#x" % self.advertise)
12305 q.breakable()
12306 q.text('}')
12307
Rich Lane7dcdf022013-12-11 14:45:27 -080012308message.subtypes[16] = port_mod
12309
12310class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012311 version = 4
12312 type = 1
12313 err_type = 7
12314
12315 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012316 if xid != None:
12317 self.xid = xid
12318 else:
12319 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012320 if code != None:
12321 self.code = code
12322 else:
12323 self.code = 0
12324 if data != None:
12325 self.data = data
12326 else:
12327 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012328 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012329
12330 def pack(self):
12331 packed = []
12332 packed.append(struct.pack("!B", self.version))
12333 packed.append(struct.pack("!B", self.type))
12334 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12335 packed.append(struct.pack("!L", self.xid))
12336 packed.append(struct.pack("!H", self.err_type))
12337 packed.append(struct.pack("!H", self.code))
12338 packed.append(self.data)
12339 length = sum([len(x) for x in packed])
12340 packed[2] = struct.pack("!H", length)
12341 return ''.join(packed)
12342
12343 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012344 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012345 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012346 _version = reader.read("!B")[0]
12347 assert(_version == 4)
12348 _type = reader.read("!B")[0]
12349 assert(_type == 1)
12350 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012351 orig_reader = reader
12352 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012353 obj.xid = reader.read("!L")[0]
12354 _err_type = reader.read("!H")[0]
12355 assert(_err_type == 7)
12356 obj.code = reader.read("!H")[0]
12357 obj.data = str(reader.read_all())
12358 return obj
12359
12360 def __eq__(self, other):
12361 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012362 if self.xid != other.xid: return False
12363 if self.code != other.code: return False
12364 if self.data != other.data: return False
12365 return True
12366
Rich Lane6f4978c2013-10-20 21:33:52 -070012367 def pretty_print(self, q):
12368 q.text("port_mod_failed_error_msg {")
12369 with q.group():
12370 with q.indent(2):
12371 q.breakable()
12372 q.text("xid = ");
12373 if self.xid != None:
12374 q.text("%#x" % self.xid)
12375 else:
12376 q.text('None')
12377 q.text(","); q.breakable()
12378 q.text("code = ");
12379 q.text("%#x" % self.code)
12380 q.text(","); q.breakable()
12381 q.text("data = ");
12382 q.pp(self.data)
12383 q.breakable()
12384 q.text('}')
12385
Rich Lane7dcdf022013-12-11 14:45:27 -080012386error_msg.subtypes[7] = port_mod_failed_error_msg
12387
12388class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012389 version = 4
12390 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012391 stats_type = 4
12392
12393 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012394 if xid != None:
12395 self.xid = xid
12396 else:
12397 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012398 if flags != None:
12399 self.flags = flags
12400 else:
12401 self.flags = 0
12402 if entries != None:
12403 self.entries = entries
12404 else:
12405 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012406 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012407
12408 def pack(self):
12409 packed = []
12410 packed.append(struct.pack("!B", self.version))
12411 packed.append(struct.pack("!B", self.type))
12412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12413 packed.append(struct.pack("!L", self.xid))
12414 packed.append(struct.pack("!H", self.stats_type))
12415 packed.append(struct.pack("!H", self.flags))
12416 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012417 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012418 length = sum([len(x) for x in packed])
12419 packed[2] = struct.pack("!H", length)
12420 return ''.join(packed)
12421
12422 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012423 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012424 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012425 _version = reader.read("!B")[0]
12426 assert(_version == 4)
12427 _type = reader.read("!B")[0]
12428 assert(_type == 19)
12429 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012430 orig_reader = reader
12431 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012432 obj.xid = reader.read("!L")[0]
12433 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012434 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012435 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012436 reader.skip(4)
12437 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
12438 return obj
12439
12440 def __eq__(self, other):
12441 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012442 if self.xid != other.xid: return False
12443 if self.flags != other.flags: return False
12444 if self.entries != other.entries: return False
12445 return True
12446
Rich Lanec2ee4b82013-04-24 17:12:38 -070012447 def pretty_print(self, q):
12448 q.text("port_stats_reply {")
12449 with q.group():
12450 with q.indent(2):
12451 q.breakable()
12452 q.text("xid = ");
12453 if self.xid != None:
12454 q.text("%#x" % self.xid)
12455 else:
12456 q.text('None')
12457 q.text(","); q.breakable()
12458 q.text("flags = ");
12459 q.text("%#x" % self.flags)
12460 q.text(","); q.breakable()
12461 q.text("entries = ");
12462 q.pp(self.entries)
12463 q.breakable()
12464 q.text('}')
12465
Rich Lane7dcdf022013-12-11 14:45:27 -080012466stats_reply.subtypes[4] = port_stats_reply
12467
12468class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012469 version = 4
12470 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012471 stats_type = 4
12472
12473 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012474 if xid != None:
12475 self.xid = xid
12476 else:
12477 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012478 if flags != None:
12479 self.flags = flags
12480 else:
12481 self.flags = 0
12482 if port_no != None:
12483 self.port_no = port_no
12484 else:
12485 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012486 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012487
12488 def pack(self):
12489 packed = []
12490 packed.append(struct.pack("!B", self.version))
12491 packed.append(struct.pack("!B", self.type))
12492 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12493 packed.append(struct.pack("!L", self.xid))
12494 packed.append(struct.pack("!H", self.stats_type))
12495 packed.append(struct.pack("!H", self.flags))
12496 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012497 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012498 packed.append('\x00' * 4)
12499 length = sum([len(x) for x in packed])
12500 packed[2] = struct.pack("!H", length)
12501 return ''.join(packed)
12502
12503 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012504 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012505 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012506 _version = reader.read("!B")[0]
12507 assert(_version == 4)
12508 _type = reader.read("!B")[0]
12509 assert(_type == 18)
12510 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012511 orig_reader = reader
12512 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012513 obj.xid = reader.read("!L")[0]
12514 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012515 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012516 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012517 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012518 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012519 reader.skip(4)
12520 return obj
12521
12522 def __eq__(self, other):
12523 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012524 if self.xid != other.xid: return False
12525 if self.flags != other.flags: return False
12526 if self.port_no != other.port_no: return False
12527 return True
12528
Rich Lanec2ee4b82013-04-24 17:12:38 -070012529 def pretty_print(self, q):
12530 q.text("port_stats_request {")
12531 with q.group():
12532 with q.indent(2):
12533 q.breakable()
12534 q.text("xid = ");
12535 if self.xid != None:
12536 q.text("%#x" % self.xid)
12537 else:
12538 q.text('None')
12539 q.text(","); q.breakable()
12540 q.text("flags = ");
12541 q.text("%#x" % self.flags)
12542 q.text(","); q.breakable()
12543 q.text("port_no = ");
12544 q.text(util.pretty_port(self.port_no))
12545 q.breakable()
12546 q.text('}')
12547
Rich Lane7dcdf022013-12-11 14:45:27 -080012548stats_request.subtypes[4] = port_stats_request
12549
12550class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012551 version = 4
12552 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070012553
12554 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012555 if xid != None:
12556 self.xid = xid
12557 else:
12558 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012559 if reason != None:
12560 self.reason = reason
12561 else:
12562 self.reason = 0
12563 if desc != None:
12564 self.desc = desc
12565 else:
12566 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080012567 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012568
12569 def pack(self):
12570 packed = []
12571 packed.append(struct.pack("!B", self.version))
12572 packed.append(struct.pack("!B", self.type))
12573 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12574 packed.append(struct.pack("!L", self.xid))
12575 packed.append(struct.pack("!B", self.reason))
12576 packed.append('\x00' * 7)
12577 packed.append(self.desc.pack())
12578 length = sum([len(x) for x in packed])
12579 packed[2] = struct.pack("!H", length)
12580 return ''.join(packed)
12581
12582 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012583 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012584 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070012585 _version = reader.read("!B")[0]
12586 assert(_version == 4)
12587 _type = reader.read("!B")[0]
12588 assert(_type == 12)
12589 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012590 orig_reader = reader
12591 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012592 obj.xid = reader.read("!L")[0]
12593 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012594 reader.skip(7)
12595 obj.desc = common.port_desc.unpack(reader)
12596 return obj
12597
12598 def __eq__(self, other):
12599 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012600 if self.xid != other.xid: return False
12601 if self.reason != other.reason: return False
12602 if self.desc != other.desc: return False
12603 return True
12604
Rich Lanec2ee4b82013-04-24 17:12:38 -070012605 def pretty_print(self, q):
12606 q.text("port_status {")
12607 with q.group():
12608 with q.indent(2):
12609 q.breakable()
12610 q.text("xid = ");
12611 if self.xid != None:
12612 q.text("%#x" % self.xid)
12613 else:
12614 q.text('None')
12615 q.text(","); q.breakable()
12616 q.text("reason = ");
12617 q.text("%#x" % self.reason)
12618 q.text(","); q.breakable()
12619 q.text("desc = ");
12620 q.pp(self.desc)
12621 q.breakable()
12622 q.text('}')
12623
Rich Lane7dcdf022013-12-11 14:45:27 -080012624message.subtypes[12] = port_status
12625
12626class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012627 version = 4
12628 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070012629
12630 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012631 if xid != None:
12632 self.xid = xid
12633 else:
12634 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012635 if port != None:
12636 self.port = port
12637 else:
12638 self.port = 0
12639 if queues != None:
12640 self.queues = queues
12641 else:
12642 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012643 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012644
12645 def pack(self):
12646 packed = []
12647 packed.append(struct.pack("!B", self.version))
12648 packed.append(struct.pack("!B", self.type))
12649 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12650 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012651 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012652 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012653 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012654 length = sum([len(x) for x in packed])
12655 packed[2] = struct.pack("!H", length)
12656 return ''.join(packed)
12657
12658 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012659 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012660 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012661 _version = reader.read("!B")[0]
12662 assert(_version == 4)
12663 _type = reader.read("!B")[0]
12664 assert(_type == 23)
12665 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012666 orig_reader = reader
12667 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012668 obj.xid = reader.read("!L")[0]
12669 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012670 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012671 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012672 return obj
12673
12674 def __eq__(self, other):
12675 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012676 if self.xid != other.xid: return False
12677 if self.port != other.port: return False
12678 if self.queues != other.queues: return False
12679 return True
12680
Rich Lanec2ee4b82013-04-24 17:12:38 -070012681 def pretty_print(self, q):
12682 q.text("queue_get_config_reply {")
12683 with q.group():
12684 with q.indent(2):
12685 q.breakable()
12686 q.text("xid = ");
12687 if self.xid != None:
12688 q.text("%#x" % self.xid)
12689 else:
12690 q.text('None')
12691 q.text(","); q.breakable()
12692 q.text("port = ");
12693 q.text(util.pretty_port(self.port))
12694 q.text(","); q.breakable()
12695 q.text("queues = ");
12696 q.pp(self.queues)
12697 q.breakable()
12698 q.text('}')
12699
Rich Lane7dcdf022013-12-11 14:45:27 -080012700message.subtypes[23] = queue_get_config_reply
12701
12702class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012703 version = 4
12704 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070012705
12706 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012707 if xid != None:
12708 self.xid = xid
12709 else:
12710 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012711 if port != None:
12712 self.port = port
12713 else:
12714 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012715 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012716
12717 def pack(self):
12718 packed = []
12719 packed.append(struct.pack("!B", self.version))
12720 packed.append(struct.pack("!B", self.type))
12721 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12722 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012723 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012724 packed.append('\x00' * 4)
12725 length = sum([len(x) for x in packed])
12726 packed[2] = struct.pack("!H", length)
12727 return ''.join(packed)
12728
12729 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012730 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012731 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012732 _version = reader.read("!B")[0]
12733 assert(_version == 4)
12734 _type = reader.read("!B")[0]
12735 assert(_type == 22)
12736 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012737 orig_reader = reader
12738 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012739 obj.xid = reader.read("!L")[0]
12740 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012741 reader.skip(4)
12742 return obj
12743
12744 def __eq__(self, other):
12745 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012746 if self.xid != other.xid: return False
12747 if self.port != other.port: return False
12748 return True
12749
Rich Lanec2ee4b82013-04-24 17:12:38 -070012750 def pretty_print(self, q):
12751 q.text("queue_get_config_request {")
12752 with q.group():
12753 with q.indent(2):
12754 q.breakable()
12755 q.text("xid = ");
12756 if self.xid != None:
12757 q.text("%#x" % self.xid)
12758 else:
12759 q.text('None')
12760 q.text(","); q.breakable()
12761 q.text("port = ");
12762 q.text(util.pretty_port(self.port))
12763 q.breakable()
12764 q.text('}')
12765
Rich Lane7dcdf022013-12-11 14:45:27 -080012766message.subtypes[22] = queue_get_config_request
12767
12768class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012769 version = 4
12770 type = 1
12771 err_type = 9
12772
12773 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012774 if xid != None:
12775 self.xid = xid
12776 else:
12777 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012778 if code != None:
12779 self.code = code
12780 else:
12781 self.code = 0
12782 if data != None:
12783 self.data = data
12784 else:
12785 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012786 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012787
12788 def pack(self):
12789 packed = []
12790 packed.append(struct.pack("!B", self.version))
12791 packed.append(struct.pack("!B", self.type))
12792 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12793 packed.append(struct.pack("!L", self.xid))
12794 packed.append(struct.pack("!H", self.err_type))
12795 packed.append(struct.pack("!H", self.code))
12796 packed.append(self.data)
12797 length = sum([len(x) for x in packed])
12798 packed[2] = struct.pack("!H", length)
12799 return ''.join(packed)
12800
12801 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012802 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012803 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012804 _version = reader.read("!B")[0]
12805 assert(_version == 4)
12806 _type = reader.read("!B")[0]
12807 assert(_type == 1)
12808 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012809 orig_reader = reader
12810 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012811 obj.xid = reader.read("!L")[0]
12812 _err_type = reader.read("!H")[0]
12813 assert(_err_type == 9)
12814 obj.code = reader.read("!H")[0]
12815 obj.data = str(reader.read_all())
12816 return obj
12817
12818 def __eq__(self, other):
12819 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012820 if self.xid != other.xid: return False
12821 if self.code != other.code: return False
12822 if self.data != other.data: return False
12823 return True
12824
Rich Lane6f4978c2013-10-20 21:33:52 -070012825 def pretty_print(self, q):
12826 q.text("queue_op_failed_error_msg {")
12827 with q.group():
12828 with q.indent(2):
12829 q.breakable()
12830 q.text("xid = ");
12831 if self.xid != None:
12832 q.text("%#x" % self.xid)
12833 else:
12834 q.text('None')
12835 q.text(","); q.breakable()
12836 q.text("code = ");
12837 q.text("%#x" % self.code)
12838 q.text(","); q.breakable()
12839 q.text("data = ");
12840 q.pp(self.data)
12841 q.breakable()
12842 q.text('}')
12843
Rich Lane7dcdf022013-12-11 14:45:27 -080012844error_msg.subtypes[9] = queue_op_failed_error_msg
12845
12846class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012847 version = 4
12848 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012849 stats_type = 5
12850
12851 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012852 if xid != None:
12853 self.xid = xid
12854 else:
12855 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012856 if flags != None:
12857 self.flags = flags
12858 else:
12859 self.flags = 0
12860 if entries != None:
12861 self.entries = entries
12862 else:
12863 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012864 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012865
12866 def pack(self):
12867 packed = []
12868 packed.append(struct.pack("!B", self.version))
12869 packed.append(struct.pack("!B", self.type))
12870 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12871 packed.append(struct.pack("!L", self.xid))
12872 packed.append(struct.pack("!H", self.stats_type))
12873 packed.append(struct.pack("!H", self.flags))
12874 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012875 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012876 length = sum([len(x) for x in packed])
12877 packed[2] = struct.pack("!H", length)
12878 return ''.join(packed)
12879
12880 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012881 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012882 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012883 _version = reader.read("!B")[0]
12884 assert(_version == 4)
12885 _type = reader.read("!B")[0]
12886 assert(_type == 19)
12887 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012888 orig_reader = reader
12889 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012890 obj.xid = reader.read("!L")[0]
12891 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012892 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012893 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012894 reader.skip(4)
12895 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
12896 return obj
12897
12898 def __eq__(self, other):
12899 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012900 if self.xid != other.xid: return False
12901 if self.flags != other.flags: return False
12902 if self.entries != other.entries: return False
12903 return True
12904
Rich Lanec2ee4b82013-04-24 17:12:38 -070012905 def pretty_print(self, q):
12906 q.text("queue_stats_reply {")
12907 with q.group():
12908 with q.indent(2):
12909 q.breakable()
12910 q.text("xid = ");
12911 if self.xid != None:
12912 q.text("%#x" % self.xid)
12913 else:
12914 q.text('None')
12915 q.text(","); q.breakable()
12916 q.text("flags = ");
12917 q.text("%#x" % self.flags)
12918 q.text(","); q.breakable()
12919 q.text("entries = ");
12920 q.pp(self.entries)
12921 q.breakable()
12922 q.text('}')
12923
Rich Lane7dcdf022013-12-11 14:45:27 -080012924stats_reply.subtypes[5] = queue_stats_reply
12925
12926class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012927 version = 4
12928 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012929 stats_type = 5
12930
12931 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012932 if xid != None:
12933 self.xid = xid
12934 else:
12935 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012936 if flags != None:
12937 self.flags = flags
12938 else:
12939 self.flags = 0
12940 if port_no != None:
12941 self.port_no = port_no
12942 else:
12943 self.port_no = 0
12944 if queue_id != None:
12945 self.queue_id = queue_id
12946 else:
12947 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012948 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012949
12950 def pack(self):
12951 packed = []
12952 packed.append(struct.pack("!B", self.version))
12953 packed.append(struct.pack("!B", self.type))
12954 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12955 packed.append(struct.pack("!L", self.xid))
12956 packed.append(struct.pack("!H", self.stats_type))
12957 packed.append(struct.pack("!H", self.flags))
12958 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012959 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012960 packed.append(struct.pack("!L", self.queue_id))
12961 length = sum([len(x) for x in packed])
12962 packed[2] = struct.pack("!H", length)
12963 return ''.join(packed)
12964
12965 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012966 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012967 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012968 _version = reader.read("!B")[0]
12969 assert(_version == 4)
12970 _type = reader.read("!B")[0]
12971 assert(_type == 18)
12972 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012973 orig_reader = reader
12974 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012975 obj.xid = reader.read("!L")[0]
12976 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012977 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012978 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012979 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012980 obj.port_no = util.unpack_port_no(reader)
12981 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012982 return obj
12983
12984 def __eq__(self, other):
12985 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012986 if self.xid != other.xid: return False
12987 if self.flags != other.flags: return False
12988 if self.port_no != other.port_no: return False
12989 if self.queue_id != other.queue_id: return False
12990 return True
12991
Rich Lanec2ee4b82013-04-24 17:12:38 -070012992 def pretty_print(self, q):
12993 q.text("queue_stats_request {")
12994 with q.group():
12995 with q.indent(2):
12996 q.breakable()
12997 q.text("xid = ");
12998 if self.xid != None:
12999 q.text("%#x" % self.xid)
13000 else:
13001 q.text('None')
13002 q.text(","); q.breakable()
13003 q.text("flags = ");
13004 q.text("%#x" % self.flags)
13005 q.text(","); q.breakable()
13006 q.text("port_no = ");
13007 q.text(util.pretty_port(self.port_no))
13008 q.text(","); q.breakable()
13009 q.text("queue_id = ");
13010 q.text("%#x" % self.queue_id)
13011 q.breakable()
13012 q.text('}')
13013
Rich Lane7dcdf022013-12-11 14:45:27 -080013014stats_request.subtypes[5] = queue_stats_request
13015
13016class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013017 version = 4
13018 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070013019
Rich Laned9e3f7b2013-11-04 11:40:43 -080013020 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013021 if xid != None:
13022 self.xid = xid
13023 else:
13024 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080013025 if role != None:
13026 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070013027 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080013028 self.role = 0
13029 if generation_id != None:
13030 self.generation_id = generation_id
13031 else:
13032 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013033 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013034
13035 def pack(self):
13036 packed = []
13037 packed.append(struct.pack("!B", self.version))
13038 packed.append(struct.pack("!B", self.type))
13039 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13040 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080013041 packed.append(struct.pack("!L", self.role))
13042 packed.append('\x00' * 4)
13043 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013044 length = sum([len(x) for x in packed])
13045 packed[2] = struct.pack("!H", length)
13046 return ''.join(packed)
13047
13048 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013049 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013050 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013051 _version = reader.read("!B")[0]
13052 assert(_version == 4)
13053 _type = reader.read("!B")[0]
13054 assert(_type == 25)
13055 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013056 orig_reader = reader
13057 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013058 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080013059 obj.role = reader.read("!L")[0]
13060 reader.skip(4)
13061 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013062 return obj
13063
13064 def __eq__(self, other):
13065 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013066 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080013067 if self.role != other.role: return False
13068 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013069 return True
13070
Rich Lanec2ee4b82013-04-24 17:12:38 -070013071 def pretty_print(self, q):
13072 q.text("role_reply {")
13073 with q.group():
13074 with q.indent(2):
13075 q.breakable()
13076 q.text("xid = ");
13077 if self.xid != None:
13078 q.text("%#x" % self.xid)
13079 else:
13080 q.text('None')
13081 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080013082 q.text("role = ");
13083 q.text("%#x" % self.role)
13084 q.text(","); q.breakable()
13085 q.text("generation_id = ");
13086 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013087 q.breakable()
13088 q.text('}')
13089
Rich Lane7dcdf022013-12-11 14:45:27 -080013090message.subtypes[25] = role_reply
13091
13092class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013093 version = 4
13094 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070013095
13096 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013097 if xid != None:
13098 self.xid = xid
13099 else:
13100 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013101 if role != None:
13102 self.role = role
13103 else:
13104 self.role = 0
13105 if generation_id != None:
13106 self.generation_id = generation_id
13107 else:
13108 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013109 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013110
13111 def pack(self):
13112 packed = []
13113 packed.append(struct.pack("!B", self.version))
13114 packed.append(struct.pack("!B", self.type))
13115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13116 packed.append(struct.pack("!L", self.xid))
13117 packed.append(struct.pack("!L", self.role))
13118 packed.append('\x00' * 4)
13119 packed.append(struct.pack("!Q", self.generation_id))
13120 length = sum([len(x) for x in packed])
13121 packed[2] = struct.pack("!H", length)
13122 return ''.join(packed)
13123
13124 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013125 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013126 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013127 _version = reader.read("!B")[0]
13128 assert(_version == 4)
13129 _type = reader.read("!B")[0]
13130 assert(_type == 24)
13131 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013132 orig_reader = reader
13133 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013134 obj.xid = reader.read("!L")[0]
13135 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013136 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013137 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013138 return obj
13139
13140 def __eq__(self, other):
13141 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013142 if self.xid != other.xid: return False
13143 if self.role != other.role: return False
13144 if self.generation_id != other.generation_id: return False
13145 return True
13146
Rich Lanec2ee4b82013-04-24 17:12:38 -070013147 def pretty_print(self, q):
13148 q.text("role_request {")
13149 with q.group():
13150 with q.indent(2):
13151 q.breakable()
13152 q.text("xid = ");
13153 if self.xid != None:
13154 q.text("%#x" % self.xid)
13155 else:
13156 q.text('None')
13157 q.text(","); q.breakable()
13158 q.text("role = ");
13159 q.text("%#x" % self.role)
13160 q.text(","); q.breakable()
13161 q.text("generation_id = ");
13162 q.text("%#x" % self.generation_id)
13163 q.breakable()
13164 q.text('}')
13165
Rich Lane7dcdf022013-12-11 14:45:27 -080013166message.subtypes[24] = role_request
13167
13168class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013169 version = 4
13170 type = 1
13171 err_type = 11
13172
13173 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013174 if xid != None:
13175 self.xid = xid
13176 else:
13177 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013178 if code != None:
13179 self.code = code
13180 else:
13181 self.code = 0
13182 if data != None:
13183 self.data = data
13184 else:
13185 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013186 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013187
13188 def pack(self):
13189 packed = []
13190 packed.append(struct.pack("!B", self.version))
13191 packed.append(struct.pack("!B", self.type))
13192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13193 packed.append(struct.pack("!L", self.xid))
13194 packed.append(struct.pack("!H", self.err_type))
13195 packed.append(struct.pack("!H", self.code))
13196 packed.append(self.data)
13197 length = sum([len(x) for x in packed])
13198 packed[2] = struct.pack("!H", length)
13199 return ''.join(packed)
13200
13201 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013202 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013203 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013204 _version = reader.read("!B")[0]
13205 assert(_version == 4)
13206 _type = reader.read("!B")[0]
13207 assert(_type == 1)
13208 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013209 orig_reader = reader
13210 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013211 obj.xid = reader.read("!L")[0]
13212 _err_type = reader.read("!H")[0]
13213 assert(_err_type == 11)
13214 obj.code = reader.read("!H")[0]
13215 obj.data = str(reader.read_all())
13216 return obj
13217
13218 def __eq__(self, other):
13219 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013220 if self.xid != other.xid: return False
13221 if self.code != other.code: return False
13222 if self.data != other.data: return False
13223 return True
13224
Rich Lane6f4978c2013-10-20 21:33:52 -070013225 def pretty_print(self, q):
13226 q.text("role_request_failed_error_msg {")
13227 with q.group():
13228 with q.indent(2):
13229 q.breakable()
13230 q.text("xid = ");
13231 if self.xid != None:
13232 q.text("%#x" % self.xid)
13233 else:
13234 q.text('None')
13235 q.text(","); q.breakable()
13236 q.text("code = ");
13237 q.text("%#x" % self.code)
13238 q.text(","); q.breakable()
13239 q.text("data = ");
13240 q.pp(self.data)
13241 q.breakable()
13242 q.text('}')
13243
Rich Lane7dcdf022013-12-11 14:45:27 -080013244error_msg.subtypes[11] = role_request_failed_error_msg
13245
13246class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013247 version = 4
13248 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070013249
13250 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013251 if xid != None:
13252 self.xid = xid
13253 else:
13254 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013255 if flags != None:
13256 self.flags = flags
13257 else:
13258 self.flags = 0
13259 if miss_send_len != None:
13260 self.miss_send_len = miss_send_len
13261 else:
13262 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013263 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013264
13265 def pack(self):
13266 packed = []
13267 packed.append(struct.pack("!B", self.version))
13268 packed.append(struct.pack("!B", self.type))
13269 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13270 packed.append(struct.pack("!L", self.xid))
13271 packed.append(struct.pack("!H", self.flags))
13272 packed.append(struct.pack("!H", self.miss_send_len))
13273 length = sum([len(x) for x in packed])
13274 packed[2] = struct.pack("!H", length)
13275 return ''.join(packed)
13276
13277 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013278 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013279 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070013280 _version = reader.read("!B")[0]
13281 assert(_version == 4)
13282 _type = reader.read("!B")[0]
13283 assert(_type == 9)
13284 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013285 orig_reader = reader
13286 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013287 obj.xid = reader.read("!L")[0]
13288 obj.flags = reader.read("!H")[0]
13289 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013290 return obj
13291
13292 def __eq__(self, other):
13293 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013294 if self.xid != other.xid: return False
13295 if self.flags != other.flags: return False
13296 if self.miss_send_len != other.miss_send_len: return False
13297 return True
13298
Rich Lanec2ee4b82013-04-24 17:12:38 -070013299 def pretty_print(self, q):
13300 q.text("set_config {")
13301 with q.group():
13302 with q.indent(2):
13303 q.breakable()
13304 q.text("xid = ");
13305 if self.xid != None:
13306 q.text("%#x" % self.xid)
13307 else:
13308 q.text('None')
13309 q.text(","); q.breakable()
13310 q.text("flags = ");
13311 q.text("%#x" % self.flags)
13312 q.text(","); q.breakable()
13313 q.text("miss_send_len = ");
13314 q.text("%#x" % self.miss_send_len)
13315 q.breakable()
13316 q.text('}')
13317
Rich Lane7dcdf022013-12-11 14:45:27 -080013318message.subtypes[9] = set_config
13319
13320class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013321 version = 4
13322 type = 1
13323 err_type = 10
13324
13325 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013326 if xid != None:
13327 self.xid = xid
13328 else:
13329 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013330 if code != None:
13331 self.code = code
13332 else:
13333 self.code = 0
13334 if data != None:
13335 self.data = data
13336 else:
13337 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013338 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013339
13340 def pack(self):
13341 packed = []
13342 packed.append(struct.pack("!B", self.version))
13343 packed.append(struct.pack("!B", self.type))
13344 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13345 packed.append(struct.pack("!L", self.xid))
13346 packed.append(struct.pack("!H", self.err_type))
13347 packed.append(struct.pack("!H", self.code))
13348 packed.append(self.data)
13349 length = sum([len(x) for x in packed])
13350 packed[2] = struct.pack("!H", length)
13351 return ''.join(packed)
13352
13353 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013354 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013355 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013356 _version = reader.read("!B")[0]
13357 assert(_version == 4)
13358 _type = reader.read("!B")[0]
13359 assert(_type == 1)
13360 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013361 orig_reader = reader
13362 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013363 obj.xid = reader.read("!L")[0]
13364 _err_type = reader.read("!H")[0]
13365 assert(_err_type == 10)
13366 obj.code = reader.read("!H")[0]
13367 obj.data = str(reader.read_all())
13368 return obj
13369
13370 def __eq__(self, other):
13371 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013372 if self.xid != other.xid: return False
13373 if self.code != other.code: return False
13374 if self.data != other.data: return False
13375 return True
13376
Rich Lane6f4978c2013-10-20 21:33:52 -070013377 def pretty_print(self, q):
13378 q.text("switch_config_failed_error_msg {")
13379 with q.group():
13380 with q.indent(2):
13381 q.breakable()
13382 q.text("xid = ");
13383 if self.xid != None:
13384 q.text("%#x" % self.xid)
13385 else:
13386 q.text('None')
13387 q.text(","); q.breakable()
13388 q.text("code = ");
13389 q.text("%#x" % self.code)
13390 q.text(","); q.breakable()
13391 q.text("data = ");
13392 q.pp(self.data)
13393 q.breakable()
13394 q.text('}')
13395
Rich Lane7dcdf022013-12-11 14:45:27 -080013396error_msg.subtypes[10] = switch_config_failed_error_msg
13397
13398class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013399 version = 4
13400 type = 1
13401 err_type = 13
13402
13403 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013404 if xid != None:
13405 self.xid = xid
13406 else:
13407 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013408 if code != None:
13409 self.code = code
13410 else:
13411 self.code = 0
13412 if data != None:
13413 self.data = data
13414 else:
13415 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013416 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013417
13418 def pack(self):
13419 packed = []
13420 packed.append(struct.pack("!B", self.version))
13421 packed.append(struct.pack("!B", self.type))
13422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13423 packed.append(struct.pack("!L", self.xid))
13424 packed.append(struct.pack("!H", self.err_type))
13425 packed.append(struct.pack("!H", self.code))
13426 packed.append(self.data)
13427 length = sum([len(x) for x in packed])
13428 packed[2] = struct.pack("!H", length)
13429 return ''.join(packed)
13430
13431 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013432 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013433 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013434 _version = reader.read("!B")[0]
13435 assert(_version == 4)
13436 _type = reader.read("!B")[0]
13437 assert(_type == 1)
13438 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013439 orig_reader = reader
13440 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013441 obj.xid = reader.read("!L")[0]
13442 _err_type = reader.read("!H")[0]
13443 assert(_err_type == 13)
13444 obj.code = reader.read("!H")[0]
13445 obj.data = str(reader.read_all())
13446 return obj
13447
13448 def __eq__(self, other):
13449 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013450 if self.xid != other.xid: return False
13451 if self.code != other.code: return False
13452 if self.data != other.data: return False
13453 return True
13454
Rich Lane6f4978c2013-10-20 21:33:52 -070013455 def pretty_print(self, q):
13456 q.text("table_features_failed_error_msg {")
13457 with q.group():
13458 with q.indent(2):
13459 q.breakable()
13460 q.text("xid = ");
13461 if self.xid != None:
13462 q.text("%#x" % self.xid)
13463 else:
13464 q.text('None')
13465 q.text(","); q.breakable()
13466 q.text("code = ");
13467 q.text("%#x" % self.code)
13468 q.text(","); q.breakable()
13469 q.text("data = ");
13470 q.pp(self.data)
13471 q.breakable()
13472 q.text('}')
13473
Rich Lane7dcdf022013-12-11 14:45:27 -080013474error_msg.subtypes[13] = table_features_failed_error_msg
13475
13476class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013477 version = 4
13478 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013479 stats_type = 12
13480
13481 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013482 if xid != None:
13483 self.xid = xid
13484 else:
13485 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013486 if flags != None:
13487 self.flags = flags
13488 else:
13489 self.flags = 0
13490 if entries != None:
13491 self.entries = entries
13492 else:
13493 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013494 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013495
13496 def pack(self):
13497 packed = []
13498 packed.append(struct.pack("!B", self.version))
13499 packed.append(struct.pack("!B", self.type))
13500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13501 packed.append(struct.pack("!L", self.xid))
13502 packed.append(struct.pack("!H", self.stats_type))
13503 packed.append(struct.pack("!H", self.flags))
13504 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013505 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013506 length = sum([len(x) for x in packed])
13507 packed[2] = struct.pack("!H", length)
13508 return ''.join(packed)
13509
13510 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013511 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013512 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013513 _version = reader.read("!B")[0]
13514 assert(_version == 4)
13515 _type = reader.read("!B")[0]
13516 assert(_type == 19)
13517 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013518 orig_reader = reader
13519 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013520 obj.xid = reader.read("!L")[0]
13521 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013522 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013523 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013524 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013525 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013526 return obj
13527
13528 def __eq__(self, other):
13529 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013530 if self.xid != other.xid: return False
13531 if self.flags != other.flags: return False
13532 if self.entries != other.entries: return False
13533 return True
13534
Rich Lanec2ee4b82013-04-24 17:12:38 -070013535 def pretty_print(self, q):
13536 q.text("table_features_stats_reply {")
13537 with q.group():
13538 with q.indent(2):
13539 q.breakable()
13540 q.text("xid = ");
13541 if self.xid != None:
13542 q.text("%#x" % self.xid)
13543 else:
13544 q.text('None')
13545 q.text(","); q.breakable()
13546 q.text("flags = ");
13547 q.text("%#x" % self.flags)
13548 q.text(","); q.breakable()
13549 q.text("entries = ");
13550 q.pp(self.entries)
13551 q.breakable()
13552 q.text('}')
13553
Rich Lane7dcdf022013-12-11 14:45:27 -080013554stats_reply.subtypes[12] = table_features_stats_reply
13555
13556class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013557 version = 4
13558 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013559 stats_type = 12
13560
13561 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013562 if xid != None:
13563 self.xid = xid
13564 else:
13565 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013566 if flags != None:
13567 self.flags = flags
13568 else:
13569 self.flags = 0
13570 if entries != None:
13571 self.entries = entries
13572 else:
13573 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013574 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013575
13576 def pack(self):
13577 packed = []
13578 packed.append(struct.pack("!B", self.version))
13579 packed.append(struct.pack("!B", self.type))
13580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13581 packed.append(struct.pack("!L", self.xid))
13582 packed.append(struct.pack("!H", self.stats_type))
13583 packed.append(struct.pack("!H", self.flags))
13584 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013585 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013586 length = sum([len(x) for x in packed])
13587 packed[2] = struct.pack("!H", length)
13588 return ''.join(packed)
13589
13590 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013591 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013592 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013593 _version = reader.read("!B")[0]
13594 assert(_version == 4)
13595 _type = reader.read("!B")[0]
13596 assert(_type == 18)
13597 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013598 orig_reader = reader
13599 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013600 obj.xid = reader.read("!L")[0]
13601 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013602 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013603 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013604 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013605 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013606 return obj
13607
13608 def __eq__(self, other):
13609 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013610 if self.xid != other.xid: return False
13611 if self.flags != other.flags: return False
13612 if self.entries != other.entries: return False
13613 return True
13614
Rich Lanec2ee4b82013-04-24 17:12:38 -070013615 def pretty_print(self, q):
13616 q.text("table_features_stats_request {")
13617 with q.group():
13618 with q.indent(2):
13619 q.breakable()
13620 q.text("xid = ");
13621 if self.xid != None:
13622 q.text("%#x" % self.xid)
13623 else:
13624 q.text('None')
13625 q.text(","); q.breakable()
13626 q.text("flags = ");
13627 q.text("%#x" % self.flags)
13628 q.text(","); q.breakable()
13629 q.text("entries = ");
13630 q.pp(self.entries)
13631 q.breakable()
13632 q.text('}')
13633
Rich Lane7dcdf022013-12-11 14:45:27 -080013634stats_request.subtypes[12] = table_features_stats_request
13635
13636class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013637 version = 4
13638 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070013639
13640 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013641 if xid != None:
13642 self.xid = xid
13643 else:
13644 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013645 if table_id != None:
13646 self.table_id = table_id
13647 else:
13648 self.table_id = 0
13649 if config != None:
13650 self.config = config
13651 else:
13652 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013653 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013654
13655 def pack(self):
13656 packed = []
13657 packed.append(struct.pack("!B", self.version))
13658 packed.append(struct.pack("!B", self.type))
13659 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13660 packed.append(struct.pack("!L", self.xid))
13661 packed.append(struct.pack("!B", self.table_id))
13662 packed.append('\x00' * 3)
13663 packed.append(struct.pack("!L", self.config))
13664 length = sum([len(x) for x in packed])
13665 packed[2] = struct.pack("!H", length)
13666 return ''.join(packed)
13667
13668 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013669 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013670 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013671 _version = reader.read("!B")[0]
13672 assert(_version == 4)
13673 _type = reader.read("!B")[0]
13674 assert(_type == 17)
13675 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013676 orig_reader = reader
13677 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013678 obj.xid = reader.read("!L")[0]
13679 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013680 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070013681 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013682 return obj
13683
13684 def __eq__(self, other):
13685 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013686 if self.xid != other.xid: return False
13687 if self.table_id != other.table_id: return False
13688 if self.config != other.config: return False
13689 return True
13690
Rich Lanec2ee4b82013-04-24 17:12:38 -070013691 def pretty_print(self, q):
13692 q.text("table_mod {")
13693 with q.group():
13694 with q.indent(2):
13695 q.breakable()
13696 q.text("xid = ");
13697 if self.xid != None:
13698 q.text("%#x" % self.xid)
13699 else:
13700 q.text('None')
13701 q.text(","); q.breakable()
13702 q.text("table_id = ");
13703 q.text("%#x" % self.table_id)
13704 q.text(","); q.breakable()
13705 q.text("config = ");
13706 q.text("%#x" % self.config)
13707 q.breakable()
13708 q.text('}')
13709
Rich Lane7dcdf022013-12-11 14:45:27 -080013710message.subtypes[17] = table_mod
13711
13712class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013713 version = 4
13714 type = 1
13715 err_type = 8
13716
13717 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013718 if xid != None:
13719 self.xid = xid
13720 else:
13721 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013722 if code != None:
13723 self.code = code
13724 else:
13725 self.code = 0
13726 if data != None:
13727 self.data = data
13728 else:
13729 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013730 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013731
13732 def pack(self):
13733 packed = []
13734 packed.append(struct.pack("!B", self.version))
13735 packed.append(struct.pack("!B", self.type))
13736 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13737 packed.append(struct.pack("!L", self.xid))
13738 packed.append(struct.pack("!H", self.err_type))
13739 packed.append(struct.pack("!H", self.code))
13740 packed.append(self.data)
13741 length = sum([len(x) for x in packed])
13742 packed[2] = struct.pack("!H", length)
13743 return ''.join(packed)
13744
13745 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013746 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013747 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013748 _version = reader.read("!B")[0]
13749 assert(_version == 4)
13750 _type = reader.read("!B")[0]
13751 assert(_type == 1)
13752 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013753 orig_reader = reader
13754 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013755 obj.xid = reader.read("!L")[0]
13756 _err_type = reader.read("!H")[0]
13757 assert(_err_type == 8)
13758 obj.code = reader.read("!H")[0]
13759 obj.data = str(reader.read_all())
13760 return obj
13761
13762 def __eq__(self, other):
13763 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013764 if self.xid != other.xid: return False
13765 if self.code != other.code: return False
13766 if self.data != other.data: return False
13767 return True
13768
Rich Lane6f4978c2013-10-20 21:33:52 -070013769 def pretty_print(self, q):
13770 q.text("table_mod_failed_error_msg {")
13771 with q.group():
13772 with q.indent(2):
13773 q.breakable()
13774 q.text("xid = ");
13775 if self.xid != None:
13776 q.text("%#x" % self.xid)
13777 else:
13778 q.text('None')
13779 q.text(","); q.breakable()
13780 q.text("code = ");
13781 q.text("%#x" % self.code)
13782 q.text(","); q.breakable()
13783 q.text("data = ");
13784 q.pp(self.data)
13785 q.breakable()
13786 q.text('}')
13787
Rich Lane7dcdf022013-12-11 14:45:27 -080013788error_msg.subtypes[8] = table_mod_failed_error_msg
13789
13790class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013791 version = 4
13792 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013793 stats_type = 3
13794
13795 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013796 if xid != None:
13797 self.xid = xid
13798 else:
13799 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013800 if flags != None:
13801 self.flags = flags
13802 else:
13803 self.flags = 0
13804 if entries != None:
13805 self.entries = entries
13806 else:
13807 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013808 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013809
13810 def pack(self):
13811 packed = []
13812 packed.append(struct.pack("!B", self.version))
13813 packed.append(struct.pack("!B", self.type))
13814 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13815 packed.append(struct.pack("!L", self.xid))
13816 packed.append(struct.pack("!H", self.stats_type))
13817 packed.append(struct.pack("!H", self.flags))
13818 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013819 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013820 length = sum([len(x) for x in packed])
13821 packed[2] = struct.pack("!H", length)
13822 return ''.join(packed)
13823
13824 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013825 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013826 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013827 _version = reader.read("!B")[0]
13828 assert(_version == 4)
13829 _type = reader.read("!B")[0]
13830 assert(_type == 19)
13831 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013832 orig_reader = reader
13833 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013834 obj.xid = reader.read("!L")[0]
13835 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013836 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013837 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013838 reader.skip(4)
13839 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
13840 return obj
13841
13842 def __eq__(self, other):
13843 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013844 if self.xid != other.xid: return False
13845 if self.flags != other.flags: return False
13846 if self.entries != other.entries: return False
13847 return True
13848
Rich Lanec2ee4b82013-04-24 17:12:38 -070013849 def pretty_print(self, q):
13850 q.text("table_stats_reply {")
13851 with q.group():
13852 with q.indent(2):
13853 q.breakable()
13854 q.text("xid = ");
13855 if self.xid != None:
13856 q.text("%#x" % self.xid)
13857 else:
13858 q.text('None')
13859 q.text(","); q.breakable()
13860 q.text("flags = ");
13861 q.text("%#x" % self.flags)
13862 q.text(","); q.breakable()
13863 q.text("entries = ");
13864 q.pp(self.entries)
13865 q.breakable()
13866 q.text('}')
13867
Rich Lane7dcdf022013-12-11 14:45:27 -080013868stats_reply.subtypes[3] = table_stats_reply
13869
13870class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013871 version = 4
13872 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013873 stats_type = 3
13874
13875 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013876 if xid != None:
13877 self.xid = xid
13878 else:
13879 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013880 if flags != None:
13881 self.flags = flags
13882 else:
13883 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013884 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013885
13886 def pack(self):
13887 packed = []
13888 packed.append(struct.pack("!B", self.version))
13889 packed.append(struct.pack("!B", self.type))
13890 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13891 packed.append(struct.pack("!L", self.xid))
13892 packed.append(struct.pack("!H", self.stats_type))
13893 packed.append(struct.pack("!H", self.flags))
13894 packed.append('\x00' * 4)
13895 length = sum([len(x) for x in packed])
13896 packed[2] = struct.pack("!H", length)
13897 return ''.join(packed)
13898
13899 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013900 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013901 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013902 _version = reader.read("!B")[0]
13903 assert(_version == 4)
13904 _type = reader.read("!B")[0]
13905 assert(_type == 18)
13906 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013907 orig_reader = reader
13908 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013909 obj.xid = reader.read("!L")[0]
13910 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013911 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013912 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013913 reader.skip(4)
13914 return obj
13915
13916 def __eq__(self, other):
13917 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013918 if self.xid != other.xid: return False
13919 if self.flags != other.flags: return False
13920 return True
13921
Rich Lanec2ee4b82013-04-24 17:12:38 -070013922 def pretty_print(self, q):
13923 q.text("table_stats_request {")
13924 with q.group():
13925 with q.indent(2):
13926 q.breakable()
13927 q.text("xid = ");
13928 if self.xid != None:
13929 q.text("%#x" % self.xid)
13930 else:
13931 q.text('None')
13932 q.text(","); q.breakable()
13933 q.text("flags = ");
13934 q.text("%#x" % self.flags)
13935 q.breakable()
13936 q.text('}')
13937
Rich Lane7dcdf022013-12-11 14:45:27 -080013938stats_request.subtypes[3] = table_stats_request
13939
Rich Lanec2ee4b82013-04-24 17:12:38 -070013940
13941def parse_header(buf):
13942 if len(buf) < 8:
13943 raise loxi.ProtocolError("too short to be an OpenFlow message")
13944 return struct.unpack_from("!BBHL", buf)
13945
13946def parse_message(buf):
13947 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070013948 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
13949 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013950 if len(buf) != msg_len:
13951 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080013952 return message.unpack(loxi.generic_util.OFReader(buf))