blob: 1ca1a73b48e7764b1bada19444023811a74242f8 [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
Rich Lane93b33132014-04-21 12:20:58 -07002294class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
Rich Lane9ec3fca2014-02-26 16:22:56 -08002295 version = 4
2296 type = 19
2297 stats_type = 65535
2298 experimenter = 6035143
Rich Lane93b33132014-04-21 12:20:58 -07002299 subtype = 13
Rich Lane9ec3fca2014-02-26 16:22:56 -08002300
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):
Rich Lane93b33132014-04-21 12:20:58 -07002334 obj = bsn_debug_counter_desc_stats_reply()
Rich Lane9ec3fca2014-02-26 16:22:56 -08002335 _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]
Rich Lane93b33132014-04-21 12:20:58 -07002350 assert(_subtype == 13)
2351 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_desc_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002352 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):
Rich Lane93b33132014-04-21 12:20:58 -07002362 q.text("bsn_debug_counter_desc_stats_reply {")
Rich Lane9ec3fca2014-02-26 16:22:56 -08002363 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
Rich Lane93b33132014-04-21 12:20:58 -07002380bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
Rich Lane9ec3fca2014-02-26 16:22:56 -08002381
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
Rich Lane93b33132014-04-21 12:20:58 -07002564class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2565 version = 4
2566 type = 18
2567 stats_type = 65535
2568 experimenter = 6035143
2569 subtype = 13
2570
2571 def __init__(self, xid=None, flags=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 return
2581
2582 def pack(self):
2583 packed = []
2584 packed.append(struct.pack("!B", self.version))
2585 packed.append(struct.pack("!B", self.type))
2586 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2587 packed.append(struct.pack("!L", self.xid))
2588 packed.append(struct.pack("!H", self.stats_type))
2589 packed.append(struct.pack("!H", self.flags))
2590 packed.append('\x00' * 4)
2591 packed.append(struct.pack("!L", self.experimenter))
2592 packed.append(struct.pack("!L", self.subtype))
2593 length = sum([len(x) for x in packed])
2594 packed[2] = struct.pack("!H", length)
2595 return ''.join(packed)
2596
2597 @staticmethod
2598 def unpack(reader):
2599 obj = bsn_debug_counter_desc_stats_request()
2600 _version = reader.read("!B")[0]
2601 assert(_version == 4)
2602 _type = reader.read("!B")[0]
2603 assert(_type == 18)
2604 _length = reader.read("!H")[0]
2605 orig_reader = reader
2606 reader = orig_reader.slice(_length - (2 + 2))
2607 obj.xid = reader.read("!L")[0]
2608 _stats_type = reader.read("!H")[0]
2609 assert(_stats_type == 65535)
2610 obj.flags = reader.read("!H")[0]
2611 reader.skip(4)
2612 _experimenter = reader.read("!L")[0]
2613 assert(_experimenter == 6035143)
2614 _subtype = reader.read("!L")[0]
2615 assert(_subtype == 13)
2616 return obj
2617
2618 def __eq__(self, other):
2619 if type(self) != type(other): return False
2620 if self.xid != other.xid: return False
2621 if self.flags != other.flags: return False
2622 return True
2623
2624 def pretty_print(self, q):
2625 q.text("bsn_debug_counter_desc_stats_request {")
2626 with q.group():
2627 with q.indent(2):
2628 q.breakable()
2629 q.text("xid = ");
2630 if self.xid != None:
2631 q.text("%#x" % self.xid)
2632 else:
2633 q.text('None')
2634 q.text(","); q.breakable()
2635 q.text("flags = ");
2636 q.text("%#x" % self.flags)
2637 q.breakable()
2638 q.text('}')
2639
2640bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2641
2642class bsn_debug_counter_stats_reply(bsn_stats_reply):
2643 version = 4
2644 type = 19
2645 stats_type = 65535
2646 experimenter = 6035143
2647 subtype = 12
2648
2649 def __init__(self, xid=None, flags=None, entries=None):
2650 if xid != None:
2651 self.xid = xid
2652 else:
2653 self.xid = None
2654 if flags != None:
2655 self.flags = flags
2656 else:
2657 self.flags = 0
2658 if entries != None:
2659 self.entries = entries
2660 else:
2661 self.entries = []
2662 return
2663
2664 def pack(self):
2665 packed = []
2666 packed.append(struct.pack("!B", self.version))
2667 packed.append(struct.pack("!B", self.type))
2668 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2669 packed.append(struct.pack("!L", self.xid))
2670 packed.append(struct.pack("!H", self.stats_type))
2671 packed.append(struct.pack("!H", self.flags))
2672 packed.append('\x00' * 4)
2673 packed.append(struct.pack("!L", self.experimenter))
2674 packed.append(struct.pack("!L", self.subtype))
2675 packed.append(loxi.generic_util.pack_list(self.entries))
2676 length = sum([len(x) for x in packed])
2677 packed[2] = struct.pack("!H", length)
2678 return ''.join(packed)
2679
2680 @staticmethod
2681 def unpack(reader):
2682 obj = bsn_debug_counter_stats_reply()
2683 _version = reader.read("!B")[0]
2684 assert(_version == 4)
2685 _type = reader.read("!B")[0]
2686 assert(_type == 19)
2687 _length = reader.read("!H")[0]
2688 orig_reader = reader
2689 reader = orig_reader.slice(_length - (2 + 2))
2690 obj.xid = reader.read("!L")[0]
2691 _stats_type = reader.read("!H")[0]
2692 assert(_stats_type == 65535)
2693 obj.flags = reader.read("!H")[0]
2694 reader.skip(4)
2695 _experimenter = reader.read("!L")[0]
2696 assert(_experimenter == 6035143)
2697 _subtype = reader.read("!L")[0]
2698 assert(_subtype == 12)
2699 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_stats_entry.unpack)
2700 return obj
2701
2702 def __eq__(self, other):
2703 if type(self) != type(other): return False
2704 if self.xid != other.xid: return False
2705 if self.flags != other.flags: return False
2706 if self.entries != other.entries: return False
2707 return True
2708
2709 def pretty_print(self, q):
2710 q.text("bsn_debug_counter_stats_reply {")
2711 with q.group():
2712 with q.indent(2):
2713 q.breakable()
2714 q.text("xid = ");
2715 if self.xid != None:
2716 q.text("%#x" % self.xid)
2717 else:
2718 q.text('None')
2719 q.text(","); q.breakable()
2720 q.text("flags = ");
2721 q.text("%#x" % self.flags)
2722 q.text(","); q.breakable()
2723 q.text("entries = ");
2724 q.pp(self.entries)
2725 q.breakable()
2726 q.text('}')
2727
2728bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2729
2730class bsn_debug_counter_stats_request(bsn_stats_request):
2731 version = 4
2732 type = 18
2733 stats_type = 65535
2734 experimenter = 6035143
2735 subtype = 12
2736
2737 def __init__(self, xid=None, flags=None):
2738 if xid != None:
2739 self.xid = xid
2740 else:
2741 self.xid = None
2742 if flags != None:
2743 self.flags = flags
2744 else:
2745 self.flags = 0
2746 return
2747
2748 def pack(self):
2749 packed = []
2750 packed.append(struct.pack("!B", self.version))
2751 packed.append(struct.pack("!B", self.type))
2752 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2753 packed.append(struct.pack("!L", self.xid))
2754 packed.append(struct.pack("!H", self.stats_type))
2755 packed.append(struct.pack("!H", self.flags))
2756 packed.append('\x00' * 4)
2757 packed.append(struct.pack("!L", self.experimenter))
2758 packed.append(struct.pack("!L", self.subtype))
2759 length = sum([len(x) for x in packed])
2760 packed[2] = struct.pack("!H", length)
2761 return ''.join(packed)
2762
2763 @staticmethod
2764 def unpack(reader):
2765 obj = bsn_debug_counter_stats_request()
2766 _version = reader.read("!B")[0]
2767 assert(_version == 4)
2768 _type = reader.read("!B")[0]
2769 assert(_type == 18)
2770 _length = reader.read("!H")[0]
2771 orig_reader = reader
2772 reader = orig_reader.slice(_length - (2 + 2))
2773 obj.xid = reader.read("!L")[0]
2774 _stats_type = reader.read("!H")[0]
2775 assert(_stats_type == 65535)
2776 obj.flags = reader.read("!H")[0]
2777 reader.skip(4)
2778 _experimenter = reader.read("!L")[0]
2779 assert(_experimenter == 6035143)
2780 _subtype = reader.read("!L")[0]
2781 assert(_subtype == 12)
2782 return obj
2783
2784 def __eq__(self, other):
2785 if type(self) != type(other): return False
2786 if self.xid != other.xid: return False
2787 if self.flags != other.flags: return False
2788 return True
2789
2790 def pretty_print(self, q):
2791 q.text("bsn_debug_counter_stats_request {")
2792 with q.group():
2793 with q.indent(2):
2794 q.breakable()
2795 q.text("xid = ");
2796 if self.xid != None:
2797 q.text("%#x" % self.xid)
2798 else:
2799 q.text('None')
2800 q.text(","); q.breakable()
2801 q.text("flags = ");
2802 q.text("%#x" % self.flags)
2803 q.breakable()
2804 q.text('}')
2805
2806bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2807
2808class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2809 version = 4
2810 type = 19
2811 stats_type = 65535
2812 experimenter = 6035143
2813 subtype = 10
2814
2815 def __init__(self, xid=None, flags=None, entries=None):
2816 if xid != None:
2817 self.xid = xid
2818 else:
2819 self.xid = None
2820 if flags != None:
2821 self.flags = flags
2822 else:
2823 self.flags = 0
2824 if entries != None:
2825 self.entries = entries
2826 else:
2827 self.entries = []
2828 return
2829
2830 def pack(self):
2831 packed = []
2832 packed.append(struct.pack("!B", self.version))
2833 packed.append(struct.pack("!B", self.type))
2834 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2835 packed.append(struct.pack("!L", self.xid))
2836 packed.append(struct.pack("!H", self.stats_type))
2837 packed.append(struct.pack("!H", self.flags))
2838 packed.append('\x00' * 4)
2839 packed.append(struct.pack("!L", self.experimenter))
2840 packed.append(struct.pack("!L", self.subtype))
2841 packed.append(loxi.generic_util.pack_list(self.entries))
2842 length = sum([len(x) for x in packed])
2843 packed[2] = struct.pack("!H", length)
2844 return ''.join(packed)
2845
2846 @staticmethod
2847 def unpack(reader):
2848 obj = bsn_flow_checksum_bucket_stats_reply()
2849 _version = reader.read("!B")[0]
2850 assert(_version == 4)
2851 _type = reader.read("!B")[0]
2852 assert(_type == 19)
2853 _length = reader.read("!H")[0]
2854 orig_reader = reader
2855 reader = orig_reader.slice(_length - (2 + 2))
2856 obj.xid = reader.read("!L")[0]
2857 _stats_type = reader.read("!H")[0]
2858 assert(_stats_type == 65535)
2859 obj.flags = reader.read("!H")[0]
2860 reader.skip(4)
2861 _experimenter = reader.read("!L")[0]
2862 assert(_experimenter == 6035143)
2863 _subtype = reader.read("!L")[0]
2864 assert(_subtype == 10)
2865 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack)
2866 return obj
2867
2868 def __eq__(self, other):
2869 if type(self) != type(other): return False
2870 if self.xid != other.xid: return False
2871 if self.flags != other.flags: return False
2872 if self.entries != other.entries: return False
2873 return True
2874
2875 def pretty_print(self, q):
2876 q.text("bsn_flow_checksum_bucket_stats_reply {")
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.text(","); q.breakable()
2886 q.text("flags = ");
2887 q.text("%#x" % self.flags)
2888 q.text(","); q.breakable()
2889 q.text("entries = ");
2890 q.pp(self.entries)
2891 q.breakable()
2892 q.text('}')
2893
2894bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2895
Rich Lane9ec3fca2014-02-26 16:22:56 -08002896class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2897 version = 4
2898 type = 18
2899 stats_type = 65535
2900 experimenter = 6035143
2901 subtype = 10
2902
2903 def __init__(self, xid=None, flags=None, table_id=None):
2904 if xid != None:
2905 self.xid = xid
2906 else:
2907 self.xid = None
2908 if flags != None:
2909 self.flags = flags
2910 else:
2911 self.flags = 0
2912 if table_id != None:
2913 self.table_id = table_id
2914 else:
2915 self.table_id = 0
2916 return
2917
2918 def pack(self):
2919 packed = []
2920 packed.append(struct.pack("!B", self.version))
2921 packed.append(struct.pack("!B", self.type))
2922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2923 packed.append(struct.pack("!L", self.xid))
2924 packed.append(struct.pack("!H", self.stats_type))
2925 packed.append(struct.pack("!H", self.flags))
2926 packed.append('\x00' * 4)
2927 packed.append(struct.pack("!L", self.experimenter))
2928 packed.append(struct.pack("!L", self.subtype))
2929 packed.append(struct.pack("!B", self.table_id))
2930 length = sum([len(x) for x in packed])
2931 packed[2] = struct.pack("!H", length)
2932 return ''.join(packed)
2933
2934 @staticmethod
2935 def unpack(reader):
2936 obj = bsn_flow_checksum_bucket_stats_request()
2937 _version = reader.read("!B")[0]
2938 assert(_version == 4)
2939 _type = reader.read("!B")[0]
2940 assert(_type == 18)
2941 _length = reader.read("!H")[0]
2942 orig_reader = reader
2943 reader = orig_reader.slice(_length - (2 + 2))
2944 obj.xid = reader.read("!L")[0]
2945 _stats_type = reader.read("!H")[0]
2946 assert(_stats_type == 65535)
2947 obj.flags = reader.read("!H")[0]
2948 reader.skip(4)
2949 _experimenter = reader.read("!L")[0]
2950 assert(_experimenter == 6035143)
2951 _subtype = reader.read("!L")[0]
2952 assert(_subtype == 10)
2953 obj.table_id = reader.read("!B")[0]
2954 return obj
2955
2956 def __eq__(self, other):
2957 if type(self) != type(other): return False
2958 if self.xid != other.xid: return False
2959 if self.flags != other.flags: return False
2960 if self.table_id != other.table_id: return False
2961 return True
2962
2963 def pretty_print(self, q):
2964 q.text("bsn_flow_checksum_bucket_stats_request {")
2965 with q.group():
2966 with q.indent(2):
2967 q.breakable()
2968 q.text("xid = ");
2969 if self.xid != None:
2970 q.text("%#x" % self.xid)
2971 else:
2972 q.text('None')
2973 q.text(","); q.breakable()
2974 q.text("flags = ");
2975 q.text("%#x" % self.flags)
2976 q.text(","); q.breakable()
2977 q.text("table_id = ");
2978 q.text("%#x" % self.table_id)
2979 q.breakable()
2980 q.text('}')
2981
2982bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2983
Rich Lane7dcdf022013-12-11 14:45:27 -08002984class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002985 version = 4
2986 type = 4
2987 experimenter = 6035143
2988 subtype = 40
2989
2990 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002991 if xid != None:
2992 self.xid = xid
2993 else:
2994 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002995 if cookie != None:
2996 self.cookie = cookie
2997 else:
2998 self.cookie = 0
2999 if priority != None:
3000 self.priority = priority
3001 else:
3002 self.priority = 0
3003 if table_id != None:
3004 self.table_id = table_id
3005 else:
3006 self.table_id = 0
3007 if match != None:
3008 self.match = match
3009 else:
3010 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08003011 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003012
3013 def pack(self):
3014 packed = []
3015 packed.append(struct.pack("!B", self.version))
3016 packed.append(struct.pack("!B", self.type))
3017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3018 packed.append(struct.pack("!L", self.xid))
3019 packed.append(struct.pack("!L", self.experimenter))
3020 packed.append(struct.pack("!L", self.subtype))
3021 packed.append(struct.pack("!Q", self.cookie))
3022 packed.append(struct.pack("!H", self.priority))
3023 packed.append(struct.pack("!B", self.table_id))
3024 packed.append('\x00' * 5)
3025 packed.append(self.match.pack())
3026 length = sum([len(x) for x in packed])
3027 packed[2] = struct.pack("!H", length)
3028 return ''.join(packed)
3029
3030 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003031 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003032 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07003033 _version = reader.read("!B")[0]
3034 assert(_version == 4)
3035 _type = reader.read("!B")[0]
3036 assert(_type == 4)
3037 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003038 orig_reader = reader
3039 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003040 obj.xid = reader.read("!L")[0]
3041 _experimenter = reader.read("!L")[0]
3042 assert(_experimenter == 6035143)
3043 _subtype = reader.read("!L")[0]
3044 assert(_subtype == 40)
3045 obj.cookie = reader.read("!Q")[0]
3046 obj.priority = reader.read("!H")[0]
3047 obj.table_id = reader.read("!B")[0]
3048 reader.skip(5)
3049 obj.match = common.match.unpack(reader)
3050 return obj
3051
3052 def __eq__(self, other):
3053 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003054 if self.xid != other.xid: return False
3055 if self.cookie != other.cookie: return False
3056 if self.priority != other.priority: return False
3057 if self.table_id != other.table_id: return False
3058 if self.match != other.match: return False
3059 return True
3060
Rich Lane6f4978c2013-10-20 21:33:52 -07003061 def pretty_print(self, q):
3062 q.text("bsn_flow_idle {")
3063 with q.group():
3064 with q.indent(2):
3065 q.breakable()
3066 q.text("xid = ");
3067 if self.xid != None:
3068 q.text("%#x" % self.xid)
3069 else:
3070 q.text('None')
3071 q.text(","); q.breakable()
3072 q.text("cookie = ");
3073 q.text("%#x" % self.cookie)
3074 q.text(","); q.breakable()
3075 q.text("priority = ");
3076 q.text("%#x" % self.priority)
3077 q.text(","); q.breakable()
3078 q.text("table_id = ");
3079 q.text("%#x" % self.table_id)
3080 q.text(","); q.breakable()
3081 q.text("match = ");
3082 q.pp(self.match)
3083 q.breakable()
3084 q.text('}')
3085
Rich Lane7dcdf022013-12-11 14:45:27 -08003086bsn_header.subtypes[40] = bsn_flow_idle
3087
3088class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003089 version = 4
3090 type = 4
3091 experimenter = 6035143
3092 subtype = 39
3093
3094 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003095 if xid != None:
3096 self.xid = xid
3097 else:
3098 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003099 if enabled != None:
3100 self.enabled = enabled
3101 else:
3102 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003103 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003104
3105 def pack(self):
3106 packed = []
3107 packed.append(struct.pack("!B", self.version))
3108 packed.append(struct.pack("!B", self.type))
3109 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3110 packed.append(struct.pack("!L", self.xid))
3111 packed.append(struct.pack("!L", self.experimenter))
3112 packed.append(struct.pack("!L", self.subtype))
3113 packed.append(struct.pack("!L", self.enabled))
3114 length = sum([len(x) for x in packed])
3115 packed[2] = struct.pack("!H", length)
3116 return ''.join(packed)
3117
3118 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003119 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003120 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003121 _version = reader.read("!B")[0]
3122 assert(_version == 4)
3123 _type = reader.read("!B")[0]
3124 assert(_type == 4)
3125 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003126 orig_reader = reader
3127 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003128 obj.xid = reader.read("!L")[0]
3129 _experimenter = reader.read("!L")[0]
3130 assert(_experimenter == 6035143)
3131 _subtype = reader.read("!L")[0]
3132 assert(_subtype == 39)
3133 obj.enabled = reader.read("!L")[0]
3134 return obj
3135
3136 def __eq__(self, other):
3137 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003138 if self.xid != other.xid: return False
3139 if self.enabled != other.enabled: return False
3140 return True
3141
Rich Lane6f4978c2013-10-20 21:33:52 -07003142 def pretty_print(self, q):
3143 q.text("bsn_flow_idle_enable_get_reply {")
3144 with q.group():
3145 with q.indent(2):
3146 q.breakable()
3147 q.text("xid = ");
3148 if self.xid != None:
3149 q.text("%#x" % self.xid)
3150 else:
3151 q.text('None')
3152 q.text(","); q.breakable()
3153 q.text("enabled = ");
3154 q.text("%#x" % self.enabled)
3155 q.breakable()
3156 q.text('}')
3157
Rich Lane7dcdf022013-12-11 14:45:27 -08003158bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3159
3160class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003161 version = 4
3162 type = 4
3163 experimenter = 6035143
3164 subtype = 38
3165
3166 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003167 if xid != None:
3168 self.xid = xid
3169 else:
3170 self.xid = None
3171 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003172
3173 def pack(self):
3174 packed = []
3175 packed.append(struct.pack("!B", self.version))
3176 packed.append(struct.pack("!B", self.type))
3177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3178 packed.append(struct.pack("!L", self.xid))
3179 packed.append(struct.pack("!L", self.experimenter))
3180 packed.append(struct.pack("!L", self.subtype))
3181 length = sum([len(x) for x in packed])
3182 packed[2] = struct.pack("!H", length)
3183 return ''.join(packed)
3184
3185 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003186 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003187 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003188 _version = reader.read("!B")[0]
3189 assert(_version == 4)
3190 _type = reader.read("!B")[0]
3191 assert(_type == 4)
3192 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003193 orig_reader = reader
3194 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003195 obj.xid = reader.read("!L")[0]
3196 _experimenter = reader.read("!L")[0]
3197 assert(_experimenter == 6035143)
3198 _subtype = reader.read("!L")[0]
3199 assert(_subtype == 38)
3200 return obj
3201
3202 def __eq__(self, other):
3203 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003204 if self.xid != other.xid: return False
3205 return True
3206
Rich Lane6f4978c2013-10-20 21:33:52 -07003207 def pretty_print(self, q):
3208 q.text("bsn_flow_idle_enable_get_request {")
3209 with q.group():
3210 with q.indent(2):
3211 q.breakable()
3212 q.text("xid = ");
3213 if self.xid != None:
3214 q.text("%#x" % self.xid)
3215 else:
3216 q.text('None')
3217 q.breakable()
3218 q.text('}')
3219
Rich Lane7dcdf022013-12-11 14:45:27 -08003220bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3221
3222class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003223 version = 4
3224 type = 4
3225 experimenter = 6035143
3226 subtype = 37
3227
3228 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003229 if xid != None:
3230 self.xid = xid
3231 else:
3232 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003233 if enable != None:
3234 self.enable = enable
3235 else:
3236 self.enable = 0
3237 if status != None:
3238 self.status = status
3239 else:
3240 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003241 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003242
3243 def pack(self):
3244 packed = []
3245 packed.append(struct.pack("!B", self.version))
3246 packed.append(struct.pack("!B", self.type))
3247 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3248 packed.append(struct.pack("!L", self.xid))
3249 packed.append(struct.pack("!L", self.experimenter))
3250 packed.append(struct.pack("!L", self.subtype))
3251 packed.append(struct.pack("!L", self.enable))
3252 packed.append(struct.pack("!L", self.status))
3253 length = sum([len(x) for x in packed])
3254 packed[2] = struct.pack("!H", length)
3255 return ''.join(packed)
3256
3257 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003258 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003259 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003260 _version = reader.read("!B")[0]
3261 assert(_version == 4)
3262 _type = reader.read("!B")[0]
3263 assert(_type == 4)
3264 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003265 orig_reader = reader
3266 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003267 obj.xid = reader.read("!L")[0]
3268 _experimenter = reader.read("!L")[0]
3269 assert(_experimenter == 6035143)
3270 _subtype = reader.read("!L")[0]
3271 assert(_subtype == 37)
3272 obj.enable = reader.read("!L")[0]
3273 obj.status = reader.read("!L")[0]
3274 return obj
3275
3276 def __eq__(self, other):
3277 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003278 if self.xid != other.xid: return False
3279 if self.enable != other.enable: return False
3280 if self.status != other.status: return False
3281 return True
3282
Rich Lane6f4978c2013-10-20 21:33:52 -07003283 def pretty_print(self, q):
3284 q.text("bsn_flow_idle_enable_set_reply {")
3285 with q.group():
3286 with q.indent(2):
3287 q.breakable()
3288 q.text("xid = ");
3289 if self.xid != None:
3290 q.text("%#x" % self.xid)
3291 else:
3292 q.text('None')
3293 q.text(","); q.breakable()
3294 q.text("enable = ");
3295 q.text("%#x" % self.enable)
3296 q.text(","); q.breakable()
3297 q.text("status = ");
3298 q.text("%#x" % self.status)
3299 q.breakable()
3300 q.text('}')
3301
Rich Lane7dcdf022013-12-11 14:45:27 -08003302bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3303
3304class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003305 version = 4
3306 type = 4
3307 experimenter = 6035143
3308 subtype = 36
3309
3310 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003311 if xid != None:
3312 self.xid = xid
3313 else:
3314 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003315 if enable != None:
3316 self.enable = enable
3317 else:
3318 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003319 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003320
3321 def pack(self):
3322 packed = []
3323 packed.append(struct.pack("!B", self.version))
3324 packed.append(struct.pack("!B", self.type))
3325 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3326 packed.append(struct.pack("!L", self.xid))
3327 packed.append(struct.pack("!L", self.experimenter))
3328 packed.append(struct.pack("!L", self.subtype))
3329 packed.append(struct.pack("!L", self.enable))
3330 length = sum([len(x) for x in packed])
3331 packed[2] = struct.pack("!H", length)
3332 return ''.join(packed)
3333
3334 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003335 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003336 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003337 _version = reader.read("!B")[0]
3338 assert(_version == 4)
3339 _type = reader.read("!B")[0]
3340 assert(_type == 4)
3341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003342 orig_reader = reader
3343 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003344 obj.xid = reader.read("!L")[0]
3345 _experimenter = reader.read("!L")[0]
3346 assert(_experimenter == 6035143)
3347 _subtype = reader.read("!L")[0]
3348 assert(_subtype == 36)
3349 obj.enable = reader.read("!L")[0]
3350 return obj
3351
3352 def __eq__(self, other):
3353 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003354 if self.xid != other.xid: return False
3355 if self.enable != other.enable: return False
3356 return True
3357
Rich Lane6f4978c2013-10-20 21:33:52 -07003358 def pretty_print(self, q):
3359 q.text("bsn_flow_idle_enable_set_request {")
3360 with q.group():
3361 with q.indent(2):
3362 q.breakable()
3363 q.text("xid = ");
3364 if self.xid != None:
3365 q.text("%#x" % self.xid)
3366 else:
3367 q.text('None')
3368 q.text(","); q.breakable()
3369 q.text("enable = ");
3370 q.text("%#x" % self.enable)
3371 q.breakable()
3372 q.text('}')
3373
Rich Lane7dcdf022013-12-11 14:45:27 -08003374bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3375
Rich Lane5454b682014-01-14 17:07:36 -08003376class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3377 version = 4
3378 type = 19
3379 stats_type = 65535
3380 experimenter = 6035143
3381 subtype = 5
3382
3383 def __init__(self, xid=None, flags=None, entries=None):
3384 if xid != None:
3385 self.xid = xid
3386 else:
3387 self.xid = None
3388 if flags != None:
3389 self.flags = flags
3390 else:
3391 self.flags = 0
3392 if entries != None:
3393 self.entries = entries
3394 else:
3395 self.entries = []
3396 return
3397
3398 def pack(self):
3399 packed = []
3400 packed.append(struct.pack("!B", self.version))
3401 packed.append(struct.pack("!B", self.type))
3402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3403 packed.append(struct.pack("!L", self.xid))
3404 packed.append(struct.pack("!H", self.stats_type))
3405 packed.append(struct.pack("!H", self.flags))
3406 packed.append('\x00' * 4)
3407 packed.append(struct.pack("!L", self.experimenter))
3408 packed.append(struct.pack("!L", self.subtype))
3409 packed.append(loxi.generic_util.pack_list(self.entries))
3410 length = sum([len(x) for x in packed])
3411 packed[2] = struct.pack("!H", length)
3412 return ''.join(packed)
3413
3414 @staticmethod
3415 def unpack(reader):
3416 obj = bsn_gentable_bucket_stats_reply()
3417 _version = reader.read("!B")[0]
3418 assert(_version == 4)
3419 _type = reader.read("!B")[0]
3420 assert(_type == 19)
3421 _length = reader.read("!H")[0]
3422 orig_reader = reader
3423 reader = orig_reader.slice(_length - (2 + 2))
3424 obj.xid = reader.read("!L")[0]
3425 _stats_type = reader.read("!H")[0]
3426 assert(_stats_type == 65535)
3427 obj.flags = reader.read("!H")[0]
3428 reader.skip(4)
3429 _experimenter = reader.read("!L")[0]
3430 assert(_experimenter == 6035143)
3431 _subtype = reader.read("!L")[0]
3432 assert(_subtype == 5)
3433 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
3434 return obj
3435
3436 def __eq__(self, other):
3437 if type(self) != type(other): return False
3438 if self.xid != other.xid: return False
3439 if self.flags != other.flags: return False
3440 if self.entries != other.entries: return False
3441 return True
3442
3443 def pretty_print(self, q):
3444 q.text("bsn_gentable_bucket_stats_reply {")
3445 with q.group():
3446 with q.indent(2):
3447 q.breakable()
3448 q.text("xid = ");
3449 if self.xid != None:
3450 q.text("%#x" % self.xid)
3451 else:
3452 q.text('None')
3453 q.text(","); q.breakable()
3454 q.text("flags = ");
3455 q.text("%#x" % self.flags)
3456 q.text(","); q.breakable()
3457 q.text("entries = ");
3458 q.pp(self.entries)
3459 q.breakable()
3460 q.text('}')
3461
3462bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3463
Rich Lane5454b682014-01-14 17:07:36 -08003464class bsn_gentable_bucket_stats_request(bsn_stats_request):
3465 version = 4
3466 type = 18
3467 stats_type = 65535
3468 experimenter = 6035143
3469 subtype = 5
3470
3471 def __init__(self, xid=None, flags=None, table_id=None):
3472 if xid != None:
3473 self.xid = xid
3474 else:
3475 self.xid = None
3476 if flags != None:
3477 self.flags = flags
3478 else:
3479 self.flags = 0
3480 if table_id != None:
3481 self.table_id = table_id
3482 else:
3483 self.table_id = 0
3484 return
3485
3486 def pack(self):
3487 packed = []
3488 packed.append(struct.pack("!B", self.version))
3489 packed.append(struct.pack("!B", self.type))
3490 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3491 packed.append(struct.pack("!L", self.xid))
3492 packed.append(struct.pack("!H", self.stats_type))
3493 packed.append(struct.pack("!H", self.flags))
3494 packed.append('\x00' * 4)
3495 packed.append(struct.pack("!L", self.experimenter))
3496 packed.append(struct.pack("!L", self.subtype))
3497 packed.append(struct.pack("!H", self.table_id))
3498 length = sum([len(x) for x in packed])
3499 packed[2] = struct.pack("!H", length)
3500 return ''.join(packed)
3501
3502 @staticmethod
3503 def unpack(reader):
3504 obj = bsn_gentable_bucket_stats_request()
3505 _version = reader.read("!B")[0]
3506 assert(_version == 4)
3507 _type = reader.read("!B")[0]
3508 assert(_type == 18)
3509 _length = reader.read("!H")[0]
3510 orig_reader = reader
3511 reader = orig_reader.slice(_length - (2 + 2))
3512 obj.xid = reader.read("!L")[0]
3513 _stats_type = reader.read("!H")[0]
3514 assert(_stats_type == 65535)
3515 obj.flags = reader.read("!H")[0]
3516 reader.skip(4)
3517 _experimenter = reader.read("!L")[0]
3518 assert(_experimenter == 6035143)
3519 _subtype = reader.read("!L")[0]
3520 assert(_subtype == 5)
3521 obj.table_id = reader.read("!H")[0]
3522 return obj
3523
3524 def __eq__(self, other):
3525 if type(self) != type(other): return False
3526 if self.xid != other.xid: return False
3527 if self.flags != other.flags: return False
3528 if self.table_id != other.table_id: return False
3529 return True
3530
3531 def pretty_print(self, q):
3532 q.text("bsn_gentable_bucket_stats_request {")
3533 with q.group():
3534 with q.indent(2):
3535 q.breakable()
3536 q.text("xid = ");
3537 if self.xid != None:
3538 q.text("%#x" % self.xid)
3539 else:
3540 q.text('None')
3541 q.text(","); q.breakable()
3542 q.text("flags = ");
3543 q.text("%#x" % self.flags)
3544 q.text(","); q.breakable()
3545 q.text("table_id = ");
3546 q.text("%#x" % self.table_id)
3547 q.breakable()
3548 q.text('}')
3549
3550bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3551
3552class bsn_gentable_clear_reply(bsn_header):
3553 version = 4
3554 type = 4
3555 experimenter = 6035143
3556 subtype = 49
3557
3558 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3559 if xid != None:
3560 self.xid = xid
3561 else:
3562 self.xid = None
3563 if table_id != None:
3564 self.table_id = table_id
3565 else:
3566 self.table_id = 0
3567 if deleted_count != None:
3568 self.deleted_count = deleted_count
3569 else:
3570 self.deleted_count = 0
3571 if error_count != None:
3572 self.error_count = error_count
3573 else:
3574 self.error_count = 0
3575 return
3576
3577 def pack(self):
3578 packed = []
3579 packed.append(struct.pack("!B", self.version))
3580 packed.append(struct.pack("!B", self.type))
3581 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3582 packed.append(struct.pack("!L", self.xid))
3583 packed.append(struct.pack("!L", self.experimenter))
3584 packed.append(struct.pack("!L", self.subtype))
3585 packed.append(struct.pack("!H", self.table_id))
3586 packed.append('\x00' * 2)
3587 packed.append(struct.pack("!L", self.deleted_count))
3588 packed.append(struct.pack("!L", self.error_count))
3589 length = sum([len(x) for x in packed])
3590 packed[2] = struct.pack("!H", length)
3591 return ''.join(packed)
3592
3593 @staticmethod
3594 def unpack(reader):
3595 obj = bsn_gentable_clear_reply()
3596 _version = reader.read("!B")[0]
3597 assert(_version == 4)
3598 _type = reader.read("!B")[0]
3599 assert(_type == 4)
3600 _length = reader.read("!H")[0]
3601 orig_reader = reader
3602 reader = orig_reader.slice(_length - (2 + 2))
3603 obj.xid = reader.read("!L")[0]
3604 _experimenter = reader.read("!L")[0]
3605 assert(_experimenter == 6035143)
3606 _subtype = reader.read("!L")[0]
3607 assert(_subtype == 49)
3608 obj.table_id = reader.read("!H")[0]
3609 reader.skip(2)
3610 obj.deleted_count = reader.read("!L")[0]
3611 obj.error_count = reader.read("!L")[0]
3612 return obj
3613
3614 def __eq__(self, other):
3615 if type(self) != type(other): return False
3616 if self.xid != other.xid: return False
3617 if self.table_id != other.table_id: return False
3618 if self.deleted_count != other.deleted_count: return False
3619 if self.error_count != other.error_count: return False
3620 return True
3621
3622 def pretty_print(self, q):
3623 q.text("bsn_gentable_clear_reply {")
3624 with q.group():
3625 with q.indent(2):
3626 q.breakable()
3627 q.text("xid = ");
3628 if self.xid != None:
3629 q.text("%#x" % self.xid)
3630 else:
3631 q.text('None')
3632 q.text(","); q.breakable()
3633 q.text("table_id = ");
3634 q.text("%#x" % self.table_id)
3635 q.text(","); q.breakable()
3636 q.text("deleted_count = ");
3637 q.text("%#x" % self.deleted_count)
3638 q.text(","); q.breakable()
3639 q.text("error_count = ");
3640 q.text("%#x" % self.error_count)
3641 q.breakable()
3642 q.text('}')
3643
3644bsn_header.subtypes[49] = bsn_gentable_clear_reply
3645
3646class bsn_gentable_clear_request(bsn_header):
3647 version = 4
3648 type = 4
3649 experimenter = 6035143
3650 subtype = 48
3651
3652 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3653 if xid != None:
3654 self.xid = xid
3655 else:
3656 self.xid = None
3657 if table_id != None:
3658 self.table_id = table_id
3659 else:
3660 self.table_id = 0
3661 if checksum != None:
3662 self.checksum = checksum
3663 else:
3664 self.checksum = 0
3665 if checksum_mask != None:
3666 self.checksum_mask = checksum_mask
3667 else:
3668 self.checksum_mask = 0
3669 return
3670
3671 def pack(self):
3672 packed = []
3673 packed.append(struct.pack("!B", self.version))
3674 packed.append(struct.pack("!B", self.type))
3675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3676 packed.append(struct.pack("!L", self.xid))
3677 packed.append(struct.pack("!L", self.experimenter))
3678 packed.append(struct.pack("!L", self.subtype))
3679 packed.append(struct.pack("!H", self.table_id))
3680 packed.append('\x00' * 2)
3681 packed.append(util.pack_checksum_128(self.checksum))
3682 packed.append(util.pack_checksum_128(self.checksum_mask))
3683 length = sum([len(x) for x in packed])
3684 packed[2] = struct.pack("!H", length)
3685 return ''.join(packed)
3686
3687 @staticmethod
3688 def unpack(reader):
3689 obj = bsn_gentable_clear_request()
3690 _version = reader.read("!B")[0]
3691 assert(_version == 4)
3692 _type = reader.read("!B")[0]
3693 assert(_type == 4)
3694 _length = reader.read("!H")[0]
3695 orig_reader = reader
3696 reader = orig_reader.slice(_length - (2 + 2))
3697 obj.xid = reader.read("!L")[0]
3698 _experimenter = reader.read("!L")[0]
3699 assert(_experimenter == 6035143)
3700 _subtype = reader.read("!L")[0]
3701 assert(_subtype == 48)
3702 obj.table_id = reader.read("!H")[0]
3703 reader.skip(2)
3704 obj.checksum = util.unpack_checksum_128(reader)
3705 obj.checksum_mask = util.unpack_checksum_128(reader)
3706 return obj
3707
3708 def __eq__(self, other):
3709 if type(self) != type(other): return False
3710 if self.xid != other.xid: return False
3711 if self.table_id != other.table_id: return False
3712 if self.checksum != other.checksum: return False
3713 if self.checksum_mask != other.checksum_mask: return False
3714 return True
3715
3716 def pretty_print(self, q):
3717 q.text("bsn_gentable_clear_request {")
3718 with q.group():
3719 with q.indent(2):
3720 q.breakable()
3721 q.text("xid = ");
3722 if self.xid != None:
3723 q.text("%#x" % self.xid)
3724 else:
3725 q.text('None')
3726 q.text(","); q.breakable()
3727 q.text("table_id = ");
3728 q.text("%#x" % self.table_id)
3729 q.text(","); q.breakable()
3730 q.text("checksum = ");
3731 q.pp(self.checksum)
3732 q.text(","); q.breakable()
3733 q.text("checksum_mask = ");
3734 q.pp(self.checksum_mask)
3735 q.breakable()
3736 q.text('}')
3737
3738bsn_header.subtypes[48] = bsn_gentable_clear_request
3739
3740class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3741 version = 4
3742 type = 19
3743 stats_type = 65535
3744 experimenter = 6035143
3745 subtype = 4
3746
3747 def __init__(self, xid=None, flags=None, entries=None):
3748 if xid != None:
3749 self.xid = xid
3750 else:
3751 self.xid = None
3752 if flags != None:
3753 self.flags = flags
3754 else:
3755 self.flags = 0
3756 if entries != None:
3757 self.entries = entries
3758 else:
3759 self.entries = []
3760 return
3761
3762 def pack(self):
3763 packed = []
3764 packed.append(struct.pack("!B", self.version))
3765 packed.append(struct.pack("!B", self.type))
3766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3767 packed.append(struct.pack("!L", self.xid))
3768 packed.append(struct.pack("!H", self.stats_type))
3769 packed.append(struct.pack("!H", self.flags))
3770 packed.append('\x00' * 4)
3771 packed.append(struct.pack("!L", self.experimenter))
3772 packed.append(struct.pack("!L", self.subtype))
3773 packed.append(loxi.generic_util.pack_list(self.entries))
3774 length = sum([len(x) for x in packed])
3775 packed[2] = struct.pack("!H", length)
3776 return ''.join(packed)
3777
3778 @staticmethod
3779 def unpack(reader):
3780 obj = bsn_gentable_desc_stats_reply()
3781 _version = reader.read("!B")[0]
3782 assert(_version == 4)
3783 _type = reader.read("!B")[0]
3784 assert(_type == 19)
3785 _length = reader.read("!H")[0]
3786 orig_reader = reader
3787 reader = orig_reader.slice(_length - (2 + 2))
3788 obj.xid = reader.read("!L")[0]
3789 _stats_type = reader.read("!H")[0]
3790 assert(_stats_type == 65535)
3791 obj.flags = reader.read("!H")[0]
3792 reader.skip(4)
3793 _experimenter = reader.read("!L")[0]
3794 assert(_experimenter == 6035143)
3795 _subtype = reader.read("!L")[0]
3796 assert(_subtype == 4)
3797 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3798 return obj
3799
3800 def __eq__(self, other):
3801 if type(self) != type(other): return False
3802 if self.xid != other.xid: return False
3803 if self.flags != other.flags: return False
3804 if self.entries != other.entries: return False
3805 return True
3806
3807 def pretty_print(self, q):
3808 q.text("bsn_gentable_desc_stats_reply {")
3809 with q.group():
3810 with q.indent(2):
3811 q.breakable()
3812 q.text("xid = ");
3813 if self.xid != None:
3814 q.text("%#x" % self.xid)
3815 else:
3816 q.text('None')
3817 q.text(","); q.breakable()
3818 q.text("flags = ");
3819 q.text("%#x" % self.flags)
3820 q.text(","); q.breakable()
3821 q.text("entries = ");
3822 q.pp(self.entries)
3823 q.breakable()
3824 q.text('}')
3825
3826bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
3827
3828class bsn_gentable_desc_stats_request(bsn_stats_request):
3829 version = 4
3830 type = 18
3831 stats_type = 65535
3832 experimenter = 6035143
3833 subtype = 4
3834
3835 def __init__(self, xid=None, flags=None):
3836 if xid != None:
3837 self.xid = xid
3838 else:
3839 self.xid = None
3840 if flags != None:
3841 self.flags = flags
3842 else:
3843 self.flags = 0
3844 return
3845
3846 def pack(self):
3847 packed = []
3848 packed.append(struct.pack("!B", self.version))
3849 packed.append(struct.pack("!B", self.type))
3850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3851 packed.append(struct.pack("!L", self.xid))
3852 packed.append(struct.pack("!H", self.stats_type))
3853 packed.append(struct.pack("!H", self.flags))
3854 packed.append('\x00' * 4)
3855 packed.append(struct.pack("!L", self.experimenter))
3856 packed.append(struct.pack("!L", self.subtype))
3857 length = sum([len(x) for x in packed])
3858 packed[2] = struct.pack("!H", length)
3859 return ''.join(packed)
3860
3861 @staticmethod
3862 def unpack(reader):
3863 obj = bsn_gentable_desc_stats_request()
3864 _version = reader.read("!B")[0]
3865 assert(_version == 4)
3866 _type = reader.read("!B")[0]
3867 assert(_type == 18)
3868 _length = reader.read("!H")[0]
3869 orig_reader = reader
3870 reader = orig_reader.slice(_length - (2 + 2))
3871 obj.xid = reader.read("!L")[0]
3872 _stats_type = reader.read("!H")[0]
3873 assert(_stats_type == 65535)
3874 obj.flags = reader.read("!H")[0]
3875 reader.skip(4)
3876 _experimenter = reader.read("!L")[0]
3877 assert(_experimenter == 6035143)
3878 _subtype = reader.read("!L")[0]
3879 assert(_subtype == 4)
3880 return obj
3881
3882 def __eq__(self, other):
3883 if type(self) != type(other): return False
3884 if self.xid != other.xid: return False
3885 if self.flags != other.flags: return False
3886 return True
3887
3888 def pretty_print(self, q):
3889 q.text("bsn_gentable_desc_stats_request {")
3890 with q.group():
3891 with q.indent(2):
3892 q.breakable()
3893 q.text("xid = ");
3894 if self.xid != None:
3895 q.text("%#x" % self.xid)
3896 else:
3897 q.text('None')
3898 q.text(","); q.breakable()
3899 q.text("flags = ");
3900 q.text("%#x" % self.flags)
3901 q.breakable()
3902 q.text('}')
3903
3904bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
3905
3906class bsn_gentable_entry_add(bsn_header):
3907 version = 4
3908 type = 4
3909 experimenter = 6035143
3910 subtype = 46
3911
3912 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
3913 if xid != None:
3914 self.xid = xid
3915 else:
3916 self.xid = None
3917 if table_id != None:
3918 self.table_id = table_id
3919 else:
3920 self.table_id = 0
3921 if checksum != None:
3922 self.checksum = checksum
3923 else:
3924 self.checksum = 0
3925 if key != None:
3926 self.key = key
3927 else:
3928 self.key = []
3929 if value != None:
3930 self.value = value
3931 else:
3932 self.value = []
3933 return
3934
3935 def pack(self):
3936 packed = []
3937 packed.append(struct.pack("!B", self.version))
3938 packed.append(struct.pack("!B", self.type))
3939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3940 packed.append(struct.pack("!L", self.xid))
3941 packed.append(struct.pack("!L", self.experimenter))
3942 packed.append(struct.pack("!L", self.subtype))
3943 packed.append(struct.pack("!H", self.table_id))
3944 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
3945 packed.append(util.pack_checksum_128(self.checksum))
3946 packed.append(loxi.generic_util.pack_list(self.key))
3947 packed[7] = struct.pack("!H", len(packed[-1]))
3948 packed.append(loxi.generic_util.pack_list(self.value))
3949 length = sum([len(x) for x in packed])
3950 packed[2] = struct.pack("!H", length)
3951 return ''.join(packed)
3952
3953 @staticmethod
3954 def unpack(reader):
3955 obj = bsn_gentable_entry_add()
3956 _version = reader.read("!B")[0]
3957 assert(_version == 4)
3958 _type = reader.read("!B")[0]
3959 assert(_type == 4)
3960 _length = reader.read("!H")[0]
3961 orig_reader = reader
3962 reader = orig_reader.slice(_length - (2 + 2))
3963 obj.xid = reader.read("!L")[0]
3964 _experimenter = reader.read("!L")[0]
3965 assert(_experimenter == 6035143)
3966 _subtype = reader.read("!L")[0]
3967 assert(_subtype == 46)
3968 obj.table_id = reader.read("!H")[0]
3969 _key_length = reader.read("!H")[0]
3970 obj.checksum = util.unpack_checksum_128(reader)
3971 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
3972 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3973 return obj
3974
3975 def __eq__(self, other):
3976 if type(self) != type(other): return False
3977 if self.xid != other.xid: return False
3978 if self.table_id != other.table_id: return False
3979 if self.checksum != other.checksum: return False
3980 if self.key != other.key: return False
3981 if self.value != other.value: return False
3982 return True
3983
3984 def pretty_print(self, q):
3985 q.text("bsn_gentable_entry_add {")
3986 with q.group():
3987 with q.indent(2):
3988 q.breakable()
3989 q.text("xid = ");
3990 if self.xid != None:
3991 q.text("%#x" % self.xid)
3992 else:
3993 q.text('None')
3994 q.text(","); q.breakable()
3995 q.text("table_id = ");
3996 q.text("%#x" % self.table_id)
3997 q.text(","); q.breakable()
3998 q.text("checksum = ");
3999 q.pp(self.checksum)
4000 q.text(","); q.breakable()
4001 q.text("key = ");
4002 q.pp(self.key)
4003 q.text(","); q.breakable()
4004 q.text("value = ");
4005 q.pp(self.value)
4006 q.breakable()
4007 q.text('}')
4008
4009bsn_header.subtypes[46] = bsn_gentable_entry_add
4010
4011class bsn_gentable_entry_delete(bsn_header):
4012 version = 4
4013 type = 4
4014 experimenter = 6035143
4015 subtype = 47
4016
4017 def __init__(self, xid=None, table_id=None, key=None):
4018 if xid != None:
4019 self.xid = xid
4020 else:
4021 self.xid = None
4022 if table_id != None:
4023 self.table_id = table_id
4024 else:
4025 self.table_id = 0
4026 if key != None:
4027 self.key = key
4028 else:
4029 self.key = []
4030 return
4031
4032 def pack(self):
4033 packed = []
4034 packed.append(struct.pack("!B", self.version))
4035 packed.append(struct.pack("!B", self.type))
4036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4037 packed.append(struct.pack("!L", self.xid))
4038 packed.append(struct.pack("!L", self.experimenter))
4039 packed.append(struct.pack("!L", self.subtype))
4040 packed.append(struct.pack("!H", self.table_id))
4041 packed.append(loxi.generic_util.pack_list(self.key))
4042 length = sum([len(x) for x in packed])
4043 packed[2] = struct.pack("!H", length)
4044 return ''.join(packed)
4045
4046 @staticmethod
4047 def unpack(reader):
4048 obj = bsn_gentable_entry_delete()
4049 _version = reader.read("!B")[0]
4050 assert(_version == 4)
4051 _type = reader.read("!B")[0]
4052 assert(_type == 4)
4053 _length = reader.read("!H")[0]
4054 orig_reader = reader
4055 reader = orig_reader.slice(_length - (2 + 2))
4056 obj.xid = reader.read("!L")[0]
4057 _experimenter = reader.read("!L")[0]
4058 assert(_experimenter == 6035143)
4059 _subtype = reader.read("!L")[0]
4060 assert(_subtype == 47)
4061 obj.table_id = reader.read("!H")[0]
4062 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4063 return obj
4064
4065 def __eq__(self, other):
4066 if type(self) != type(other): return False
4067 if self.xid != other.xid: return False
4068 if self.table_id != other.table_id: return False
4069 if self.key != other.key: return False
4070 return True
4071
4072 def pretty_print(self, q):
4073 q.text("bsn_gentable_entry_delete {")
4074 with q.group():
4075 with q.indent(2):
4076 q.breakable()
4077 q.text("xid = ");
4078 if self.xid != None:
4079 q.text("%#x" % self.xid)
4080 else:
4081 q.text('None')
4082 q.text(","); q.breakable()
4083 q.text("table_id = ");
4084 q.text("%#x" % self.table_id)
4085 q.text(","); q.breakable()
4086 q.text("key = ");
4087 q.pp(self.key)
4088 q.breakable()
4089 q.text('}')
4090
4091bsn_header.subtypes[47] = bsn_gentable_entry_delete
4092
4093class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4094 version = 4
4095 type = 19
4096 stats_type = 65535
4097 experimenter = 6035143
4098 subtype = 2
4099
4100 def __init__(self, xid=None, flags=None, entries=None):
4101 if xid != None:
4102 self.xid = xid
4103 else:
4104 self.xid = None
4105 if flags != None:
4106 self.flags = flags
4107 else:
4108 self.flags = 0
4109 if entries != None:
4110 self.entries = entries
4111 else:
4112 self.entries = []
4113 return
4114
4115 def pack(self):
4116 packed = []
4117 packed.append(struct.pack("!B", self.version))
4118 packed.append(struct.pack("!B", self.type))
4119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4120 packed.append(struct.pack("!L", self.xid))
4121 packed.append(struct.pack("!H", self.stats_type))
4122 packed.append(struct.pack("!H", self.flags))
4123 packed.append('\x00' * 4)
4124 packed.append(struct.pack("!L", self.experimenter))
4125 packed.append(struct.pack("!L", self.subtype))
4126 packed.append(loxi.generic_util.pack_list(self.entries))
4127 length = sum([len(x) for x in packed])
4128 packed[2] = struct.pack("!H", length)
4129 return ''.join(packed)
4130
4131 @staticmethod
4132 def unpack(reader):
4133 obj = bsn_gentable_entry_desc_stats_reply()
4134 _version = reader.read("!B")[0]
4135 assert(_version == 4)
4136 _type = reader.read("!B")[0]
4137 assert(_type == 19)
4138 _length = reader.read("!H")[0]
4139 orig_reader = reader
4140 reader = orig_reader.slice(_length - (2 + 2))
4141 obj.xid = reader.read("!L")[0]
4142 _stats_type = reader.read("!H")[0]
4143 assert(_stats_type == 65535)
4144 obj.flags = reader.read("!H")[0]
4145 reader.skip(4)
4146 _experimenter = reader.read("!L")[0]
4147 assert(_experimenter == 6035143)
4148 _subtype = reader.read("!L")[0]
4149 assert(_subtype == 2)
4150 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
4151 return obj
4152
4153 def __eq__(self, other):
4154 if type(self) != type(other): return False
4155 if self.xid != other.xid: return False
4156 if self.flags != other.flags: return False
4157 if self.entries != other.entries: return False
4158 return True
4159
4160 def pretty_print(self, q):
4161 q.text("bsn_gentable_entry_desc_stats_reply {")
4162 with q.group():
4163 with q.indent(2):
4164 q.breakable()
4165 q.text("xid = ");
4166 if self.xid != None:
4167 q.text("%#x" % self.xid)
4168 else:
4169 q.text('None')
4170 q.text(","); q.breakable()
4171 q.text("flags = ");
4172 q.text("%#x" % self.flags)
4173 q.text(","); q.breakable()
4174 q.text("entries = ");
4175 q.pp(self.entries)
4176 q.breakable()
4177 q.text('}')
4178
4179bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4180
4181class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4182 version = 4
4183 type = 18
4184 stats_type = 65535
4185 experimenter = 6035143
4186 subtype = 2
4187
4188 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4189 if xid != None:
4190 self.xid = xid
4191 else:
4192 self.xid = None
4193 if flags != None:
4194 self.flags = flags
4195 else:
4196 self.flags = 0
4197 if table_id != None:
4198 self.table_id = table_id
4199 else:
4200 self.table_id = 0
4201 if checksum != None:
4202 self.checksum = checksum
4203 else:
4204 self.checksum = 0
4205 if checksum_mask != None:
4206 self.checksum_mask = checksum_mask
4207 else:
4208 self.checksum_mask = 0
4209 return
4210
4211 def pack(self):
4212 packed = []
4213 packed.append(struct.pack("!B", self.version))
4214 packed.append(struct.pack("!B", self.type))
4215 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4216 packed.append(struct.pack("!L", self.xid))
4217 packed.append(struct.pack("!H", self.stats_type))
4218 packed.append(struct.pack("!H", self.flags))
4219 packed.append('\x00' * 4)
4220 packed.append(struct.pack("!L", self.experimenter))
4221 packed.append(struct.pack("!L", self.subtype))
4222 packed.append(struct.pack("!H", self.table_id))
4223 packed.append('\x00' * 2)
4224 packed.append(util.pack_checksum_128(self.checksum))
4225 packed.append(util.pack_checksum_128(self.checksum_mask))
4226 length = sum([len(x) for x in packed])
4227 packed[2] = struct.pack("!H", length)
4228 return ''.join(packed)
4229
4230 @staticmethod
4231 def unpack(reader):
4232 obj = bsn_gentable_entry_desc_stats_request()
4233 _version = reader.read("!B")[0]
4234 assert(_version == 4)
4235 _type = reader.read("!B")[0]
4236 assert(_type == 18)
4237 _length = reader.read("!H")[0]
4238 orig_reader = reader
4239 reader = orig_reader.slice(_length - (2 + 2))
4240 obj.xid = reader.read("!L")[0]
4241 _stats_type = reader.read("!H")[0]
4242 assert(_stats_type == 65535)
4243 obj.flags = reader.read("!H")[0]
4244 reader.skip(4)
4245 _experimenter = reader.read("!L")[0]
4246 assert(_experimenter == 6035143)
4247 _subtype = reader.read("!L")[0]
4248 assert(_subtype == 2)
4249 obj.table_id = reader.read("!H")[0]
4250 reader.skip(2)
4251 obj.checksum = util.unpack_checksum_128(reader)
4252 obj.checksum_mask = util.unpack_checksum_128(reader)
4253 return obj
4254
4255 def __eq__(self, other):
4256 if type(self) != type(other): return False
4257 if self.xid != other.xid: return False
4258 if self.flags != other.flags: return False
4259 if self.table_id != other.table_id: return False
4260 if self.checksum != other.checksum: return False
4261 if self.checksum_mask != other.checksum_mask: return False
4262 return True
4263
4264 def pretty_print(self, q):
4265 q.text("bsn_gentable_entry_desc_stats_request {")
4266 with q.group():
4267 with q.indent(2):
4268 q.breakable()
4269 q.text("xid = ");
4270 if self.xid != None:
4271 q.text("%#x" % self.xid)
4272 else:
4273 q.text('None')
4274 q.text(","); q.breakable()
4275 q.text("flags = ");
4276 q.text("%#x" % self.flags)
4277 q.text(","); q.breakable()
4278 q.text("table_id = ");
4279 q.text("%#x" % self.table_id)
4280 q.text(","); q.breakable()
4281 q.text("checksum = ");
4282 q.pp(self.checksum)
4283 q.text(","); q.breakable()
4284 q.text("checksum_mask = ");
4285 q.pp(self.checksum_mask)
4286 q.breakable()
4287 q.text('}')
4288
4289bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4290
4291class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4292 version = 4
4293 type = 19
4294 stats_type = 65535
4295 experimenter = 6035143
4296 subtype = 3
4297
4298 def __init__(self, xid=None, flags=None, entries=None):
4299 if xid != None:
4300 self.xid = xid
4301 else:
4302 self.xid = None
4303 if flags != None:
4304 self.flags = flags
4305 else:
4306 self.flags = 0
4307 if entries != None:
4308 self.entries = entries
4309 else:
4310 self.entries = []
4311 return
4312
4313 def pack(self):
4314 packed = []
4315 packed.append(struct.pack("!B", self.version))
4316 packed.append(struct.pack("!B", self.type))
4317 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4318 packed.append(struct.pack("!L", self.xid))
4319 packed.append(struct.pack("!H", self.stats_type))
4320 packed.append(struct.pack("!H", self.flags))
4321 packed.append('\x00' * 4)
4322 packed.append(struct.pack("!L", self.experimenter))
4323 packed.append(struct.pack("!L", self.subtype))
4324 packed.append(loxi.generic_util.pack_list(self.entries))
4325 length = sum([len(x) for x in packed])
4326 packed[2] = struct.pack("!H", length)
4327 return ''.join(packed)
4328
4329 @staticmethod
4330 def unpack(reader):
4331 obj = bsn_gentable_entry_stats_reply()
4332 _version = reader.read("!B")[0]
4333 assert(_version == 4)
4334 _type = reader.read("!B")[0]
4335 assert(_type == 19)
4336 _length = reader.read("!H")[0]
4337 orig_reader = reader
4338 reader = orig_reader.slice(_length - (2 + 2))
4339 obj.xid = reader.read("!L")[0]
4340 _stats_type = reader.read("!H")[0]
4341 assert(_stats_type == 65535)
4342 obj.flags = reader.read("!H")[0]
4343 reader.skip(4)
4344 _experimenter = reader.read("!L")[0]
4345 assert(_experimenter == 6035143)
4346 _subtype = reader.read("!L")[0]
4347 assert(_subtype == 3)
4348 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
4349 return obj
4350
4351 def __eq__(self, other):
4352 if type(self) != type(other): return False
4353 if self.xid != other.xid: return False
4354 if self.flags != other.flags: return False
4355 if self.entries != other.entries: return False
4356 return True
4357
4358 def pretty_print(self, q):
4359 q.text("bsn_gentable_entry_stats_reply {")
4360 with q.group():
4361 with q.indent(2):
4362 q.breakable()
4363 q.text("xid = ");
4364 if self.xid != None:
4365 q.text("%#x" % self.xid)
4366 else:
4367 q.text('None')
4368 q.text(","); q.breakable()
4369 q.text("flags = ");
4370 q.text("%#x" % self.flags)
4371 q.text(","); q.breakable()
4372 q.text("entries = ");
4373 q.pp(self.entries)
4374 q.breakable()
4375 q.text('}')
4376
4377bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4378
4379class bsn_gentable_entry_stats_request(bsn_stats_request):
4380 version = 4
4381 type = 18
4382 stats_type = 65535
4383 experimenter = 6035143
4384 subtype = 3
4385
4386 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4387 if xid != None:
4388 self.xid = xid
4389 else:
4390 self.xid = None
4391 if flags != None:
4392 self.flags = flags
4393 else:
4394 self.flags = 0
4395 if table_id != None:
4396 self.table_id = table_id
4397 else:
4398 self.table_id = 0
4399 if checksum != None:
4400 self.checksum = checksum
4401 else:
4402 self.checksum = 0
4403 if checksum_mask != None:
4404 self.checksum_mask = checksum_mask
4405 else:
4406 self.checksum_mask = 0
4407 return
4408
4409 def pack(self):
4410 packed = []
4411 packed.append(struct.pack("!B", self.version))
4412 packed.append(struct.pack("!B", self.type))
4413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4414 packed.append(struct.pack("!L", self.xid))
4415 packed.append(struct.pack("!H", self.stats_type))
4416 packed.append(struct.pack("!H", self.flags))
4417 packed.append('\x00' * 4)
4418 packed.append(struct.pack("!L", self.experimenter))
4419 packed.append(struct.pack("!L", self.subtype))
4420 packed.append(struct.pack("!H", self.table_id))
4421 packed.append('\x00' * 2)
4422 packed.append(util.pack_checksum_128(self.checksum))
4423 packed.append(util.pack_checksum_128(self.checksum_mask))
4424 length = sum([len(x) for x in packed])
4425 packed[2] = struct.pack("!H", length)
4426 return ''.join(packed)
4427
4428 @staticmethod
4429 def unpack(reader):
4430 obj = bsn_gentable_entry_stats_request()
4431 _version = reader.read("!B")[0]
4432 assert(_version == 4)
4433 _type = reader.read("!B")[0]
4434 assert(_type == 18)
4435 _length = reader.read("!H")[0]
4436 orig_reader = reader
4437 reader = orig_reader.slice(_length - (2 + 2))
4438 obj.xid = reader.read("!L")[0]
4439 _stats_type = reader.read("!H")[0]
4440 assert(_stats_type == 65535)
4441 obj.flags = reader.read("!H")[0]
4442 reader.skip(4)
4443 _experimenter = reader.read("!L")[0]
4444 assert(_experimenter == 6035143)
4445 _subtype = reader.read("!L")[0]
4446 assert(_subtype == 3)
4447 obj.table_id = reader.read("!H")[0]
4448 reader.skip(2)
4449 obj.checksum = util.unpack_checksum_128(reader)
4450 obj.checksum_mask = util.unpack_checksum_128(reader)
4451 return obj
4452
4453 def __eq__(self, other):
4454 if type(self) != type(other): return False
4455 if self.xid != other.xid: return False
4456 if self.flags != other.flags: return False
4457 if self.table_id != other.table_id: return False
4458 if self.checksum != other.checksum: return False
4459 if self.checksum_mask != other.checksum_mask: return False
4460 return True
4461
4462 def pretty_print(self, q):
4463 q.text("bsn_gentable_entry_stats_request {")
4464 with q.group():
4465 with q.indent(2):
4466 q.breakable()
4467 q.text("xid = ");
4468 if self.xid != None:
4469 q.text("%#x" % self.xid)
4470 else:
4471 q.text('None')
4472 q.text(","); q.breakable()
4473 q.text("flags = ");
4474 q.text("%#x" % self.flags)
4475 q.text(","); q.breakable()
4476 q.text("table_id = ");
4477 q.text("%#x" % self.table_id)
4478 q.text(","); q.breakable()
4479 q.text("checksum = ");
4480 q.pp(self.checksum)
4481 q.text(","); q.breakable()
4482 q.text("checksum_mask = ");
4483 q.pp(self.checksum_mask)
4484 q.breakable()
4485 q.text('}')
4486
4487bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4488
4489class bsn_gentable_set_buckets_size(bsn_header):
4490 version = 4
4491 type = 4
4492 experimenter = 6035143
4493 subtype = 50
4494
4495 def __init__(self, xid=None, table_id=None, buckets_size=None):
4496 if xid != None:
4497 self.xid = xid
4498 else:
4499 self.xid = None
4500 if table_id != None:
4501 self.table_id = table_id
4502 else:
4503 self.table_id = 0
4504 if buckets_size != None:
4505 self.buckets_size = buckets_size
4506 else:
4507 self.buckets_size = 0
4508 return
4509
4510 def pack(self):
4511 packed = []
4512 packed.append(struct.pack("!B", self.version))
4513 packed.append(struct.pack("!B", self.type))
4514 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4515 packed.append(struct.pack("!L", self.xid))
4516 packed.append(struct.pack("!L", self.experimenter))
4517 packed.append(struct.pack("!L", self.subtype))
4518 packed.append(struct.pack("!H", self.table_id))
4519 packed.append('\x00' * 2)
4520 packed.append(struct.pack("!L", self.buckets_size))
4521 length = sum([len(x) for x in packed])
4522 packed[2] = struct.pack("!H", length)
4523 return ''.join(packed)
4524
4525 @staticmethod
4526 def unpack(reader):
4527 obj = bsn_gentable_set_buckets_size()
4528 _version = reader.read("!B")[0]
4529 assert(_version == 4)
4530 _type = reader.read("!B")[0]
4531 assert(_type == 4)
4532 _length = reader.read("!H")[0]
4533 orig_reader = reader
4534 reader = orig_reader.slice(_length - (2 + 2))
4535 obj.xid = reader.read("!L")[0]
4536 _experimenter = reader.read("!L")[0]
4537 assert(_experimenter == 6035143)
4538 _subtype = reader.read("!L")[0]
4539 assert(_subtype == 50)
4540 obj.table_id = reader.read("!H")[0]
4541 reader.skip(2)
4542 obj.buckets_size = reader.read("!L")[0]
4543 return obj
4544
4545 def __eq__(self, other):
4546 if type(self) != type(other): return False
4547 if self.xid != other.xid: return False
4548 if self.table_id != other.table_id: return False
4549 if self.buckets_size != other.buckets_size: return False
4550 return True
4551
4552 def pretty_print(self, q):
4553 q.text("bsn_gentable_set_buckets_size {")
4554 with q.group():
4555 with q.indent(2):
4556 q.breakable()
4557 q.text("xid = ");
4558 if self.xid != None:
4559 q.text("%#x" % self.xid)
4560 else:
4561 q.text('None')
4562 q.text(","); q.breakable()
4563 q.text("table_id = ");
4564 q.text("%#x" % self.table_id)
4565 q.text(","); q.breakable()
4566 q.text("buckets_size = ");
4567 q.text("%#x" % self.buckets_size)
4568 q.breakable()
4569 q.text('}')
4570
4571bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4572
4573class bsn_gentable_stats_reply(bsn_stats_reply):
4574 version = 4
4575 type = 19
4576 stats_type = 65535
4577 experimenter = 6035143
4578 subtype = 7
4579
4580 def __init__(self, xid=None, flags=None, entries=None):
4581 if xid != None:
4582 self.xid = xid
4583 else:
4584 self.xid = None
4585 if flags != None:
4586 self.flags = flags
4587 else:
4588 self.flags = 0
4589 if entries != None:
4590 self.entries = entries
4591 else:
4592 self.entries = []
4593 return
4594
4595 def pack(self):
4596 packed = []
4597 packed.append(struct.pack("!B", self.version))
4598 packed.append(struct.pack("!B", self.type))
4599 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4600 packed.append(struct.pack("!L", self.xid))
4601 packed.append(struct.pack("!H", self.stats_type))
4602 packed.append(struct.pack("!H", self.flags))
4603 packed.append('\x00' * 4)
4604 packed.append(struct.pack("!L", self.experimenter))
4605 packed.append(struct.pack("!L", self.subtype))
4606 packed.append(loxi.generic_util.pack_list(self.entries))
4607 length = sum([len(x) for x in packed])
4608 packed[2] = struct.pack("!H", length)
4609 return ''.join(packed)
4610
4611 @staticmethod
4612 def unpack(reader):
4613 obj = bsn_gentable_stats_reply()
4614 _version = reader.read("!B")[0]
4615 assert(_version == 4)
4616 _type = reader.read("!B")[0]
4617 assert(_type == 19)
4618 _length = reader.read("!H")[0]
4619 orig_reader = reader
4620 reader = orig_reader.slice(_length - (2 + 2))
4621 obj.xid = reader.read("!L")[0]
4622 _stats_type = reader.read("!H")[0]
4623 assert(_stats_type == 65535)
4624 obj.flags = reader.read("!H")[0]
4625 reader.skip(4)
4626 _experimenter = reader.read("!L")[0]
4627 assert(_experimenter == 6035143)
4628 _subtype = reader.read("!L")[0]
4629 assert(_subtype == 7)
4630 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4631 return obj
4632
4633 def __eq__(self, other):
4634 if type(self) != type(other): return False
4635 if self.xid != other.xid: return False
4636 if self.flags != other.flags: return False
4637 if self.entries != other.entries: return False
4638 return True
4639
4640 def pretty_print(self, q):
4641 q.text("bsn_gentable_stats_reply {")
4642 with q.group():
4643 with q.indent(2):
4644 q.breakable()
4645 q.text("xid = ");
4646 if self.xid != None:
4647 q.text("%#x" % self.xid)
4648 else:
4649 q.text('None')
4650 q.text(","); q.breakable()
4651 q.text("flags = ");
4652 q.text("%#x" % self.flags)
4653 q.text(","); q.breakable()
4654 q.text("entries = ");
4655 q.pp(self.entries)
4656 q.breakable()
4657 q.text('}')
4658
4659bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4660
4661class bsn_gentable_stats_request(bsn_stats_request):
4662 version = 4
4663 type = 18
4664 stats_type = 65535
4665 experimenter = 6035143
4666 subtype = 7
4667
4668 def __init__(self, xid=None, flags=None):
4669 if xid != None:
4670 self.xid = xid
4671 else:
4672 self.xid = None
4673 if flags != None:
4674 self.flags = flags
4675 else:
4676 self.flags = 0
4677 return
4678
4679 def pack(self):
4680 packed = []
4681 packed.append(struct.pack("!B", self.version))
4682 packed.append(struct.pack("!B", self.type))
4683 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4684 packed.append(struct.pack("!L", self.xid))
4685 packed.append(struct.pack("!H", self.stats_type))
4686 packed.append(struct.pack("!H", self.flags))
4687 packed.append('\x00' * 4)
4688 packed.append(struct.pack("!L", self.experimenter))
4689 packed.append(struct.pack("!L", self.subtype))
4690 length = sum([len(x) for x in packed])
4691 packed[2] = struct.pack("!H", length)
4692 return ''.join(packed)
4693
4694 @staticmethod
4695 def unpack(reader):
4696 obj = bsn_gentable_stats_request()
4697 _version = reader.read("!B")[0]
4698 assert(_version == 4)
4699 _type = reader.read("!B")[0]
4700 assert(_type == 18)
4701 _length = reader.read("!H")[0]
4702 orig_reader = reader
4703 reader = orig_reader.slice(_length - (2 + 2))
4704 obj.xid = reader.read("!L")[0]
4705 _stats_type = reader.read("!H")[0]
4706 assert(_stats_type == 65535)
4707 obj.flags = reader.read("!H")[0]
4708 reader.skip(4)
4709 _experimenter = reader.read("!L")[0]
4710 assert(_experimenter == 6035143)
4711 _subtype = reader.read("!L")[0]
4712 assert(_subtype == 7)
4713 return obj
4714
4715 def __eq__(self, other):
4716 if type(self) != type(other): return False
4717 if self.xid != other.xid: return False
4718 if self.flags != other.flags: return False
4719 return True
4720
4721 def pretty_print(self, q):
4722 q.text("bsn_gentable_stats_request {")
4723 with q.group():
4724 with q.indent(2):
4725 q.breakable()
4726 q.text("xid = ");
4727 if self.xid != None:
4728 q.text("%#x" % self.xid)
4729 else:
4730 q.text('None')
4731 q.text(","); q.breakable()
4732 q.text("flags = ");
4733 q.text("%#x" % self.flags)
4734 q.breakable()
4735 q.text('}')
4736
4737bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4738
Rich Lane7dcdf022013-12-11 14:45:27 -08004739class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004740 version = 4
4741 type = 4
4742 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004743 subtype = 10
4744
4745 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004746 if xid != None:
4747 self.xid = xid
4748 else:
4749 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004750 if interfaces != None:
4751 self.interfaces = interfaces
4752 else:
4753 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004754 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004755
4756 def pack(self):
4757 packed = []
4758 packed.append(struct.pack("!B", self.version))
4759 packed.append(struct.pack("!B", self.type))
4760 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4761 packed.append(struct.pack("!L", self.xid))
4762 packed.append(struct.pack("!L", self.experimenter))
4763 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004764 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004765 length = sum([len(x) for x in packed])
4766 packed[2] = struct.pack("!H", length)
4767 return ''.join(packed)
4768
4769 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004770 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004771 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004772 _version = reader.read("!B")[0]
4773 assert(_version == 4)
4774 _type = reader.read("!B")[0]
4775 assert(_type == 4)
4776 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004777 orig_reader = reader
4778 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004779 obj.xid = reader.read("!L")[0]
4780 _experimenter = reader.read("!L")[0]
4781 assert(_experimenter == 6035143)
4782 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004783 assert(_subtype == 10)
4784 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4785 return obj
4786
4787 def __eq__(self, other):
4788 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004789 if self.xid != other.xid: return False
4790 if self.interfaces != other.interfaces: return False
4791 return True
4792
Rich Lanec2ee4b82013-04-24 17:12:38 -07004793 def pretty_print(self, q):
4794 q.text("bsn_get_interfaces_reply {")
4795 with q.group():
4796 with q.indent(2):
4797 q.breakable()
4798 q.text("xid = ");
4799 if self.xid != None:
4800 q.text("%#x" % self.xid)
4801 else:
4802 q.text('None')
4803 q.text(","); q.breakable()
4804 q.text("interfaces = ");
4805 q.pp(self.interfaces)
4806 q.breakable()
4807 q.text('}')
4808
Rich Lane7dcdf022013-12-11 14:45:27 -08004809bsn_header.subtypes[10] = bsn_get_interfaces_reply
4810
4811class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004812 version = 4
4813 type = 4
4814 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004815 subtype = 9
4816
4817 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004818 if xid != None:
4819 self.xid = xid
4820 else:
4821 self.xid = None
4822 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004823
4824 def pack(self):
4825 packed = []
4826 packed.append(struct.pack("!B", self.version))
4827 packed.append(struct.pack("!B", self.type))
4828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4829 packed.append(struct.pack("!L", self.xid))
4830 packed.append(struct.pack("!L", self.experimenter))
4831 packed.append(struct.pack("!L", self.subtype))
4832 length = sum([len(x) for x in packed])
4833 packed[2] = struct.pack("!H", length)
4834 return ''.join(packed)
4835
4836 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004837 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004838 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004839 _version = reader.read("!B")[0]
4840 assert(_version == 4)
4841 _type = reader.read("!B")[0]
4842 assert(_type == 4)
4843 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004844 orig_reader = reader
4845 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004846 obj.xid = reader.read("!L")[0]
4847 _experimenter = reader.read("!L")[0]
4848 assert(_experimenter == 6035143)
4849 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004850 assert(_subtype == 9)
4851 return obj
4852
4853 def __eq__(self, other):
4854 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004855 if self.xid != other.xid: return False
4856 return True
4857
Rich Lanec2ee4b82013-04-24 17:12:38 -07004858 def pretty_print(self, q):
4859 q.text("bsn_get_interfaces_request {")
4860 with q.group():
4861 with q.indent(2):
4862 q.breakable()
4863 q.text("xid = ");
4864 if self.xid != None:
4865 q.text("%#x" % self.xid)
4866 else:
4867 q.text('None')
4868 q.breakable()
4869 q.text('}')
4870
Rich Lane7dcdf022013-12-11 14:45:27 -08004871bsn_header.subtypes[9] = bsn_get_interfaces_request
4872
4873class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004874 version = 4
4875 type = 4
4876 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004877 subtype = 5
4878
4879 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004880 if xid != None:
4881 self.xid = xid
4882 else:
4883 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004884 if report_mirror_ports != None:
4885 self.report_mirror_ports = report_mirror_ports
4886 else:
4887 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004888 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004889
4890 def pack(self):
4891 packed = []
4892 packed.append(struct.pack("!B", self.version))
4893 packed.append(struct.pack("!B", self.type))
4894 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4895 packed.append(struct.pack("!L", self.xid))
4896 packed.append(struct.pack("!L", self.experimenter))
4897 packed.append(struct.pack("!L", self.subtype))
4898 packed.append(struct.pack("!B", self.report_mirror_ports))
4899 packed.append('\x00' * 3)
4900 length = sum([len(x) for x in packed])
4901 packed[2] = struct.pack("!H", length)
4902 return ''.join(packed)
4903
4904 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004905 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004906 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004907 _version = reader.read("!B")[0]
4908 assert(_version == 4)
4909 _type = reader.read("!B")[0]
4910 assert(_type == 4)
4911 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004912 orig_reader = reader
4913 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004914 obj.xid = reader.read("!L")[0]
4915 _experimenter = reader.read("!L")[0]
4916 assert(_experimenter == 6035143)
4917 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004918 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07004919 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004920 reader.skip(3)
4921 return obj
4922
4923 def __eq__(self, other):
4924 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004925 if self.xid != other.xid: return False
4926 if self.report_mirror_ports != other.report_mirror_ports: return False
4927 return True
4928
Rich Lanec2ee4b82013-04-24 17:12:38 -07004929 def pretty_print(self, q):
4930 q.text("bsn_get_mirroring_reply {")
4931 with q.group():
4932 with q.indent(2):
4933 q.breakable()
4934 q.text("xid = ");
4935 if self.xid != None:
4936 q.text("%#x" % self.xid)
4937 else:
4938 q.text('None')
4939 q.text(","); q.breakable()
4940 q.text("report_mirror_ports = ");
4941 q.text("%#x" % self.report_mirror_ports)
4942 q.breakable()
4943 q.text('}')
4944
Rich Lane7dcdf022013-12-11 14:45:27 -08004945bsn_header.subtypes[5] = bsn_get_mirroring_reply
4946
4947class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004948 version = 4
4949 type = 4
4950 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004951 subtype = 4
4952
4953 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004954 if xid != None:
4955 self.xid = xid
4956 else:
4957 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004958 if report_mirror_ports != None:
4959 self.report_mirror_ports = report_mirror_ports
4960 else:
4961 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004962 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004963
4964 def pack(self):
4965 packed = []
4966 packed.append(struct.pack("!B", self.version))
4967 packed.append(struct.pack("!B", self.type))
4968 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4969 packed.append(struct.pack("!L", self.xid))
4970 packed.append(struct.pack("!L", self.experimenter))
4971 packed.append(struct.pack("!L", self.subtype))
4972 packed.append(struct.pack("!B", self.report_mirror_ports))
4973 packed.append('\x00' * 3)
4974 length = sum([len(x) for x in packed])
4975 packed[2] = struct.pack("!H", length)
4976 return ''.join(packed)
4977
4978 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004979 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004980 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004981 _version = reader.read("!B")[0]
4982 assert(_version == 4)
4983 _type = reader.read("!B")[0]
4984 assert(_type == 4)
4985 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004986 orig_reader = reader
4987 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004988 obj.xid = reader.read("!L")[0]
4989 _experimenter = reader.read("!L")[0]
4990 assert(_experimenter == 6035143)
4991 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004992 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004993 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004994 reader.skip(3)
4995 return obj
4996
4997 def __eq__(self, other):
4998 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004999 if self.xid != other.xid: return False
5000 if self.report_mirror_ports != other.report_mirror_ports: return False
5001 return True
5002
Rich Lanec2ee4b82013-04-24 17:12:38 -07005003 def pretty_print(self, q):
5004 q.text("bsn_get_mirroring_request {")
5005 with q.group():
5006 with q.indent(2):
5007 q.breakable()
5008 q.text("xid = ");
5009 if self.xid != None:
5010 q.text("%#x" % self.xid)
5011 else:
5012 q.text('None')
5013 q.text(","); q.breakable()
5014 q.text("report_mirror_ports = ");
5015 q.text("%#x" % self.report_mirror_ports)
5016 q.breakable()
5017 q.text('}')
5018
Rich Lane7dcdf022013-12-11 14:45:27 -08005019bsn_header.subtypes[4] = bsn_get_mirroring_request
5020
5021class bsn_get_switch_pipeline_reply(bsn_header):
5022 version = 4
5023 type = 4
5024 experimenter = 6035143
5025 subtype = 52
5026
5027 def __init__(self, xid=None, pipeline=None):
5028 if xid != None:
5029 self.xid = xid
5030 else:
5031 self.xid = None
5032 if pipeline != None:
5033 self.pipeline = pipeline
5034 else:
5035 self.pipeline = ""
5036 return
5037
5038 def pack(self):
5039 packed = []
5040 packed.append(struct.pack("!B", self.version))
5041 packed.append(struct.pack("!B", self.type))
5042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5043 packed.append(struct.pack("!L", self.xid))
5044 packed.append(struct.pack("!L", self.experimenter))
5045 packed.append(struct.pack("!L", self.subtype))
5046 packed.append(struct.pack("!256s", self.pipeline))
5047 length = sum([len(x) for x in packed])
5048 packed[2] = struct.pack("!H", length)
5049 return ''.join(packed)
5050
5051 @staticmethod
5052 def unpack(reader):
5053 obj = bsn_get_switch_pipeline_reply()
5054 _version = reader.read("!B")[0]
5055 assert(_version == 4)
5056 _type = reader.read("!B")[0]
5057 assert(_type == 4)
5058 _length = reader.read("!H")[0]
5059 orig_reader = reader
5060 reader = orig_reader.slice(_length - (2 + 2))
5061 obj.xid = reader.read("!L")[0]
5062 _experimenter = reader.read("!L")[0]
5063 assert(_experimenter == 6035143)
5064 _subtype = reader.read("!L")[0]
5065 assert(_subtype == 52)
5066 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5067 return obj
5068
5069 def __eq__(self, other):
5070 if type(self) != type(other): return False
5071 if self.xid != other.xid: return False
5072 if self.pipeline != other.pipeline: return False
5073 return True
5074
5075 def pretty_print(self, q):
5076 q.text("bsn_get_switch_pipeline_reply {")
5077 with q.group():
5078 with q.indent(2):
5079 q.breakable()
5080 q.text("xid = ");
5081 if self.xid != None:
5082 q.text("%#x" % self.xid)
5083 else:
5084 q.text('None')
5085 q.text(","); q.breakable()
5086 q.text("pipeline = ");
5087 q.pp(self.pipeline)
5088 q.breakable()
5089 q.text('}')
5090
5091bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5092
5093class bsn_get_switch_pipeline_request(bsn_header):
5094 version = 4
5095 type = 4
5096 experimenter = 6035143
5097 subtype = 51
5098
5099 def __init__(self, xid=None):
5100 if xid != None:
5101 self.xid = xid
5102 else:
5103 self.xid = None
5104 return
5105
5106 def pack(self):
5107 packed = []
5108 packed.append(struct.pack("!B", self.version))
5109 packed.append(struct.pack("!B", self.type))
5110 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5111 packed.append(struct.pack("!L", self.xid))
5112 packed.append(struct.pack("!L", self.experimenter))
5113 packed.append(struct.pack("!L", self.subtype))
5114 length = sum([len(x) for x in packed])
5115 packed[2] = struct.pack("!H", length)
5116 return ''.join(packed)
5117
5118 @staticmethod
5119 def unpack(reader):
5120 obj = bsn_get_switch_pipeline_request()
5121 _version = reader.read("!B")[0]
5122 assert(_version == 4)
5123 _type = reader.read("!B")[0]
5124 assert(_type == 4)
5125 _length = reader.read("!H")[0]
5126 orig_reader = reader
5127 reader = orig_reader.slice(_length - (2 + 2))
5128 obj.xid = reader.read("!L")[0]
5129 _experimenter = reader.read("!L")[0]
5130 assert(_experimenter == 6035143)
5131 _subtype = reader.read("!L")[0]
5132 assert(_subtype == 51)
5133 return obj
5134
5135 def __eq__(self, other):
5136 if type(self) != type(other): return False
5137 if self.xid != other.xid: return False
5138 return True
5139
5140 def pretty_print(self, q):
5141 q.text("bsn_get_switch_pipeline_request {")
5142 with q.group():
5143 with q.indent(2):
5144 q.breakable()
5145 q.text("xid = ");
5146 if self.xid != None:
5147 q.text("%#x" % self.xid)
5148 else:
5149 q.text('None')
5150 q.breakable()
5151 q.text('}')
5152
5153bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5154
Rich Lane93b33132014-04-21 12:20:58 -07005155class bsn_image_desc_stats_reply(bsn_stats_reply):
5156 version = 4
5157 type = 19
5158 stats_type = 65535
5159 experimenter = 6035143
5160 subtype = 14
5161
5162 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5163 if xid != None:
5164 self.xid = xid
5165 else:
5166 self.xid = None
5167 if flags != None:
5168 self.flags = flags
5169 else:
5170 self.flags = 0
5171 if image_checksum != None:
5172 self.image_checksum = image_checksum
5173 else:
5174 self.image_checksum = ""
5175 if startup_config_checksum != None:
5176 self.startup_config_checksum = startup_config_checksum
5177 else:
5178 self.startup_config_checksum = ""
5179 return
5180
5181 def pack(self):
5182 packed = []
5183 packed.append(struct.pack("!B", self.version))
5184 packed.append(struct.pack("!B", self.type))
5185 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5186 packed.append(struct.pack("!L", self.xid))
5187 packed.append(struct.pack("!H", self.stats_type))
5188 packed.append(struct.pack("!H", self.flags))
5189 packed.append('\x00' * 4)
5190 packed.append(struct.pack("!L", self.experimenter))
5191 packed.append(struct.pack("!L", self.subtype))
5192 packed.append(struct.pack("!256s", self.image_checksum))
5193 packed.append(struct.pack("!256s", self.startup_config_checksum))
5194 length = sum([len(x) for x in packed])
5195 packed[2] = struct.pack("!H", length)
5196 return ''.join(packed)
5197
5198 @staticmethod
5199 def unpack(reader):
5200 obj = bsn_image_desc_stats_reply()
5201 _version = reader.read("!B")[0]
5202 assert(_version == 4)
5203 _type = reader.read("!B")[0]
5204 assert(_type == 19)
5205 _length = reader.read("!H")[0]
5206 orig_reader = reader
5207 reader = orig_reader.slice(_length - (2 + 2))
5208 obj.xid = reader.read("!L")[0]
5209 _stats_type = reader.read("!H")[0]
5210 assert(_stats_type == 65535)
5211 obj.flags = reader.read("!H")[0]
5212 reader.skip(4)
5213 _experimenter = reader.read("!L")[0]
5214 assert(_experimenter == 6035143)
5215 _subtype = reader.read("!L")[0]
5216 assert(_subtype == 14)
5217 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5218 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5219 return obj
5220
5221 def __eq__(self, other):
5222 if type(self) != type(other): return False
5223 if self.xid != other.xid: return False
5224 if self.flags != other.flags: return False
5225 if self.image_checksum != other.image_checksum: return False
5226 if self.startup_config_checksum != other.startup_config_checksum: return False
5227 return True
5228
5229 def pretty_print(self, q):
5230 q.text("bsn_image_desc_stats_reply {")
5231 with q.group():
5232 with q.indent(2):
5233 q.breakable()
5234 q.text("xid = ");
5235 if self.xid != None:
5236 q.text("%#x" % self.xid)
5237 else:
5238 q.text('None')
5239 q.text(","); q.breakable()
5240 q.text("flags = ");
5241 q.text("%#x" % self.flags)
5242 q.text(","); q.breakable()
5243 q.text("image_checksum = ");
5244 q.pp(self.image_checksum)
5245 q.text(","); q.breakable()
5246 q.text("startup_config_checksum = ");
5247 q.pp(self.startup_config_checksum)
5248 q.breakable()
5249 q.text('}')
5250
5251bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5252
5253class bsn_image_desc_stats_request(bsn_stats_request):
5254 version = 4
5255 type = 18
5256 stats_type = 65535
5257 experimenter = 6035143
5258 subtype = 14
5259
5260 def __init__(self, xid=None, flags=None):
5261 if xid != None:
5262 self.xid = xid
5263 else:
5264 self.xid = None
5265 if flags != None:
5266 self.flags = flags
5267 else:
5268 self.flags = 0
5269 return
5270
5271 def pack(self):
5272 packed = []
5273 packed.append(struct.pack("!B", self.version))
5274 packed.append(struct.pack("!B", self.type))
5275 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5276 packed.append(struct.pack("!L", self.xid))
5277 packed.append(struct.pack("!H", self.stats_type))
5278 packed.append(struct.pack("!H", self.flags))
5279 packed.append('\x00' * 4)
5280 packed.append(struct.pack("!L", self.experimenter))
5281 packed.append(struct.pack("!L", self.subtype))
5282 length = sum([len(x) for x in packed])
5283 packed[2] = struct.pack("!H", length)
5284 return ''.join(packed)
5285
5286 @staticmethod
5287 def unpack(reader):
5288 obj = bsn_image_desc_stats_request()
5289 _version = reader.read("!B")[0]
5290 assert(_version == 4)
5291 _type = reader.read("!B")[0]
5292 assert(_type == 18)
5293 _length = reader.read("!H")[0]
5294 orig_reader = reader
5295 reader = orig_reader.slice(_length - (2 + 2))
5296 obj.xid = reader.read("!L")[0]
5297 _stats_type = reader.read("!H")[0]
5298 assert(_stats_type == 65535)
5299 obj.flags = reader.read("!H")[0]
5300 reader.skip(4)
5301 _experimenter = reader.read("!L")[0]
5302 assert(_experimenter == 6035143)
5303 _subtype = reader.read("!L")[0]
5304 assert(_subtype == 14)
5305 return obj
5306
5307 def __eq__(self, other):
5308 if type(self) != type(other): return False
5309 if self.xid != other.xid: return False
5310 if self.flags != other.flags: return False
5311 return True
5312
5313 def pretty_print(self, q):
5314 q.text("bsn_image_desc_stats_request {")
5315 with q.group():
5316 with q.indent(2):
5317 q.breakable()
5318 q.text("xid = ");
5319 if self.xid != None:
5320 q.text("%#x" % self.xid)
5321 else:
5322 q.text('None')
5323 q.text(","); q.breakable()
5324 q.text("flags = ");
5325 q.text("%#x" % self.flags)
5326 q.breakable()
5327 q.text('}')
5328
5329bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5330
Rich Lane7dcdf022013-12-11 14:45:27 -08005331class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005332 version = 4
5333 type = 4
5334 experimenter = 6035143
5335 subtype = 43
5336
5337 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 -08005338 if xid != None:
5339 self.xid = xid
5340 else:
5341 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005342 if convergence_status != None:
5343 self.convergence_status = convergence_status
5344 else:
5345 self.convergence_status = 0
5346 if port_no != None:
5347 self.port_no = port_no
5348 else:
5349 self.port_no = 0
5350 if actor_sys_priority != None:
5351 self.actor_sys_priority = actor_sys_priority
5352 else:
5353 self.actor_sys_priority = 0
5354 if actor_sys_mac != None:
5355 self.actor_sys_mac = actor_sys_mac
5356 else:
5357 self.actor_sys_mac = [0,0,0,0,0,0]
5358 if actor_port_priority != None:
5359 self.actor_port_priority = actor_port_priority
5360 else:
5361 self.actor_port_priority = 0
5362 if actor_port_num != None:
5363 self.actor_port_num = actor_port_num
5364 else:
5365 self.actor_port_num = 0
5366 if actor_key != None:
5367 self.actor_key = actor_key
5368 else:
5369 self.actor_key = 0
5370 if partner_sys_priority != None:
5371 self.partner_sys_priority = partner_sys_priority
5372 else:
5373 self.partner_sys_priority = 0
5374 if partner_sys_mac != None:
5375 self.partner_sys_mac = partner_sys_mac
5376 else:
5377 self.partner_sys_mac = [0,0,0,0,0,0]
5378 if partner_port_priority != None:
5379 self.partner_port_priority = partner_port_priority
5380 else:
5381 self.partner_port_priority = 0
5382 if partner_port_num != None:
5383 self.partner_port_num = partner_port_num
5384 else:
5385 self.partner_port_num = 0
5386 if partner_key != None:
5387 self.partner_key = partner_key
5388 else:
5389 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005390 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005391
5392 def pack(self):
5393 packed = []
5394 packed.append(struct.pack("!B", self.version))
5395 packed.append(struct.pack("!B", self.type))
5396 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5397 packed.append(struct.pack("!L", self.xid))
5398 packed.append(struct.pack("!L", self.experimenter))
5399 packed.append(struct.pack("!L", self.subtype))
5400 packed.append(struct.pack("!B", self.convergence_status))
5401 packed.append('\x00' * 3)
5402 packed.append(util.pack_port_no(self.port_no))
5403 packed.append(struct.pack("!H", self.actor_sys_priority))
5404 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5405 packed.append(struct.pack("!H", self.actor_port_priority))
5406 packed.append(struct.pack("!H", self.actor_port_num))
5407 packed.append(struct.pack("!H", self.actor_key))
5408 packed.append(struct.pack("!H", self.partner_sys_priority))
5409 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5410 packed.append(struct.pack("!H", self.partner_port_priority))
5411 packed.append(struct.pack("!H", self.partner_port_num))
5412 packed.append(struct.pack("!H", self.partner_key))
5413 length = sum([len(x) for x in packed])
5414 packed[2] = struct.pack("!H", length)
5415 return ''.join(packed)
5416
5417 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005418 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005419 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08005420 _version = reader.read("!B")[0]
5421 assert(_version == 4)
5422 _type = reader.read("!B")[0]
5423 assert(_type == 4)
5424 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005425 orig_reader = reader
5426 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005427 obj.xid = reader.read("!L")[0]
5428 _experimenter = reader.read("!L")[0]
5429 assert(_experimenter == 6035143)
5430 _subtype = reader.read("!L")[0]
5431 assert(_subtype == 43)
5432 obj.convergence_status = reader.read("!B")[0]
5433 reader.skip(3)
5434 obj.port_no = util.unpack_port_no(reader)
5435 obj.actor_sys_priority = reader.read("!H")[0]
5436 obj.actor_sys_mac = list(reader.read('!6B'))
5437 obj.actor_port_priority = reader.read("!H")[0]
5438 obj.actor_port_num = reader.read("!H")[0]
5439 obj.actor_key = reader.read("!H")[0]
5440 obj.partner_sys_priority = reader.read("!H")[0]
5441 obj.partner_sys_mac = list(reader.read('!6B'))
5442 obj.partner_port_priority = reader.read("!H")[0]
5443 obj.partner_port_num = reader.read("!H")[0]
5444 obj.partner_key = reader.read("!H")[0]
5445 return obj
5446
5447 def __eq__(self, other):
5448 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005449 if self.xid != other.xid: return False
5450 if self.convergence_status != other.convergence_status: return False
5451 if self.port_no != other.port_no: return False
5452 if self.actor_sys_priority != other.actor_sys_priority: return False
5453 if self.actor_sys_mac != other.actor_sys_mac: return False
5454 if self.actor_port_priority != other.actor_port_priority: return False
5455 if self.actor_port_num != other.actor_port_num: return False
5456 if self.actor_key != other.actor_key: return False
5457 if self.partner_sys_priority != other.partner_sys_priority: return False
5458 if self.partner_sys_mac != other.partner_sys_mac: return False
5459 if self.partner_port_priority != other.partner_port_priority: return False
5460 if self.partner_port_num != other.partner_port_num: return False
5461 if self.partner_key != other.partner_key: return False
5462 return True
5463
Rich Lane7b0f2012013-11-22 14:15:26 -08005464 def pretty_print(self, q):
5465 q.text("bsn_lacp_convergence_notif {")
5466 with q.group():
5467 with q.indent(2):
5468 q.breakable()
5469 q.text("xid = ");
5470 if self.xid != None:
5471 q.text("%#x" % self.xid)
5472 else:
5473 q.text('None')
5474 q.text(","); q.breakable()
5475 q.text("convergence_status = ");
5476 q.text("%#x" % self.convergence_status)
5477 q.text(","); q.breakable()
5478 q.text("port_no = ");
5479 q.text(util.pretty_port(self.port_no))
5480 q.text(","); q.breakable()
5481 q.text("actor_sys_priority = ");
5482 q.text("%#x" % self.actor_sys_priority)
5483 q.text(","); q.breakable()
5484 q.text("actor_sys_mac = ");
5485 q.text(util.pretty_mac(self.actor_sys_mac))
5486 q.text(","); q.breakable()
5487 q.text("actor_port_priority = ");
5488 q.text("%#x" % self.actor_port_priority)
5489 q.text(","); q.breakable()
5490 q.text("actor_port_num = ");
5491 q.text("%#x" % self.actor_port_num)
5492 q.text(","); q.breakable()
5493 q.text("actor_key = ");
5494 q.text("%#x" % self.actor_key)
5495 q.text(","); q.breakable()
5496 q.text("partner_sys_priority = ");
5497 q.text("%#x" % self.partner_sys_priority)
5498 q.text(","); q.breakable()
5499 q.text("partner_sys_mac = ");
5500 q.text(util.pretty_mac(self.partner_sys_mac))
5501 q.text(","); q.breakable()
5502 q.text("partner_port_priority = ");
5503 q.text("%#x" % self.partner_port_priority)
5504 q.text(","); q.breakable()
5505 q.text("partner_port_num = ");
5506 q.text("%#x" % self.partner_port_num)
5507 q.text(","); q.breakable()
5508 q.text("partner_key = ");
5509 q.text("%#x" % self.partner_key)
5510 q.breakable()
5511 q.text('}')
5512
Rich Lane7dcdf022013-12-11 14:45:27 -08005513bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5514
Rich Lane7dcdf022013-12-11 14:45:27 -08005515class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08005516 version = 4
5517 type = 19
5518 stats_type = 65535
5519 experimenter = 6035143
5520 subtype = 1
5521
5522 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005523 if xid != None:
5524 self.xid = xid
5525 else:
5526 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005527 if flags != None:
5528 self.flags = flags
5529 else:
5530 self.flags = 0
5531 if entries != None:
5532 self.entries = entries
5533 else:
5534 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005535 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005536
5537 def pack(self):
5538 packed = []
5539 packed.append(struct.pack("!B", self.version))
5540 packed.append(struct.pack("!B", self.type))
5541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5542 packed.append(struct.pack("!L", self.xid))
5543 packed.append(struct.pack("!H", self.stats_type))
5544 packed.append(struct.pack("!H", self.flags))
5545 packed.append('\x00' * 4)
5546 packed.append(struct.pack("!L", self.experimenter))
5547 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08005548 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08005549 length = sum([len(x) for x in packed])
5550 packed[2] = struct.pack("!H", length)
5551 return ''.join(packed)
5552
5553 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005554 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005555 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005556 _version = reader.read("!B")[0]
5557 assert(_version == 4)
5558 _type = reader.read("!B")[0]
5559 assert(_type == 19)
5560 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005561 orig_reader = reader
5562 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005563 obj.xid = reader.read("!L")[0]
5564 _stats_type = reader.read("!H")[0]
5565 assert(_stats_type == 65535)
5566 obj.flags = reader.read("!H")[0]
5567 reader.skip(4)
5568 _experimenter = reader.read("!L")[0]
5569 assert(_experimenter == 6035143)
5570 _subtype = reader.read("!L")[0]
5571 assert(_subtype == 1)
5572 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
5573 return obj
5574
5575 def __eq__(self, other):
5576 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005577 if self.xid != other.xid: return False
5578 if self.flags != other.flags: return False
5579 if self.entries != other.entries: return False
5580 return True
5581
Rich Lane7b0f2012013-11-22 14:15:26 -08005582 def pretty_print(self, q):
5583 q.text("bsn_lacp_stats_reply {")
5584 with q.group():
5585 with q.indent(2):
5586 q.breakable()
5587 q.text("xid = ");
5588 if self.xid != None:
5589 q.text("%#x" % self.xid)
5590 else:
5591 q.text('None')
5592 q.text(","); q.breakable()
5593 q.text("flags = ");
5594 q.text("%#x" % self.flags)
5595 q.text(","); q.breakable()
5596 q.text("entries = ");
5597 q.pp(self.entries)
5598 q.breakable()
5599 q.text('}')
5600
Rich Lane7dcdf022013-12-11 14:45:27 -08005601bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5602
Rich Lane7dcdf022013-12-11 14:45:27 -08005603class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08005604 version = 4
5605 type = 18
5606 stats_type = 65535
5607 experimenter = 6035143
5608 subtype = 1
5609
5610 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005611 if xid != None:
5612 self.xid = xid
5613 else:
5614 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005615 if flags != None:
5616 self.flags = flags
5617 else:
5618 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005619 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005620
5621 def pack(self):
5622 packed = []
5623 packed.append(struct.pack("!B", self.version))
5624 packed.append(struct.pack("!B", self.type))
5625 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5626 packed.append(struct.pack("!L", self.xid))
5627 packed.append(struct.pack("!H", self.stats_type))
5628 packed.append(struct.pack("!H", self.flags))
5629 packed.append('\x00' * 4)
5630 packed.append(struct.pack("!L", self.experimenter))
5631 packed.append(struct.pack("!L", self.subtype))
5632 length = sum([len(x) for x in packed])
5633 packed[2] = struct.pack("!H", length)
5634 return ''.join(packed)
5635
5636 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005637 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005638 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005639 _version = reader.read("!B")[0]
5640 assert(_version == 4)
5641 _type = reader.read("!B")[0]
5642 assert(_type == 18)
5643 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005644 orig_reader = reader
5645 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005646 obj.xid = reader.read("!L")[0]
5647 _stats_type = reader.read("!H")[0]
5648 assert(_stats_type == 65535)
5649 obj.flags = reader.read("!H")[0]
5650 reader.skip(4)
5651 _experimenter = reader.read("!L")[0]
5652 assert(_experimenter == 6035143)
5653 _subtype = reader.read("!L")[0]
5654 assert(_subtype == 1)
5655 return obj
5656
5657 def __eq__(self, other):
5658 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005659 if self.xid != other.xid: return False
5660 if self.flags != other.flags: return False
5661 return True
5662
Rich Lane7b0f2012013-11-22 14:15:26 -08005663 def pretty_print(self, q):
5664 q.text("bsn_lacp_stats_request {")
5665 with q.group():
5666 with q.indent(2):
5667 q.breakable()
5668 q.text("xid = ");
5669 if self.xid != None:
5670 q.text("%#x" % self.xid)
5671 else:
5672 q.text('None')
5673 q.text(","); q.breakable()
5674 q.text("flags = ");
5675 q.text("%#x" % self.flags)
5676 q.breakable()
5677 q.text('}')
5678
Rich Lane7dcdf022013-12-11 14:45:27 -08005679bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5680
Rich Lane5587ab12014-06-30 11:19:09 -07005681class bsn_log(bsn_header):
5682 version = 4
5683 type = 4
5684 experimenter = 6035143
5685 subtype = 63
5686
5687 def __init__(self, xid=None, loglevel=None, data=None):
5688 if xid != None:
5689 self.xid = xid
5690 else:
5691 self.xid = None
5692 if loglevel != None:
5693 self.loglevel = loglevel
5694 else:
5695 self.loglevel = 0
5696 if data != None:
5697 self.data = data
5698 else:
5699 self.data = ''
5700 return
5701
5702 def pack(self):
5703 packed = []
5704 packed.append(struct.pack("!B", self.version))
5705 packed.append(struct.pack("!B", self.type))
5706 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5707 packed.append(struct.pack("!L", self.xid))
5708 packed.append(struct.pack("!L", self.experimenter))
5709 packed.append(struct.pack("!L", self.subtype))
5710 packed.append(struct.pack("!B", self.loglevel))
5711 packed.append(self.data)
5712 length = sum([len(x) for x in packed])
5713 packed[2] = struct.pack("!H", length)
5714 return ''.join(packed)
5715
5716 @staticmethod
5717 def unpack(reader):
5718 obj = bsn_log()
5719 _version = reader.read("!B")[0]
5720 assert(_version == 4)
5721 _type = reader.read("!B")[0]
5722 assert(_type == 4)
5723 _length = reader.read("!H")[0]
5724 orig_reader = reader
5725 reader = orig_reader.slice(_length - (2 + 2))
5726 obj.xid = reader.read("!L")[0]
5727 _experimenter = reader.read("!L")[0]
5728 assert(_experimenter == 6035143)
5729 _subtype = reader.read("!L")[0]
5730 assert(_subtype == 63)
5731 obj.loglevel = reader.read("!B")[0]
5732 obj.data = str(reader.read_all())
5733 return obj
5734
5735 def __eq__(self, other):
5736 if type(self) != type(other): return False
5737 if self.xid != other.xid: return False
5738 if self.loglevel != other.loglevel: return False
5739 if self.data != other.data: return False
5740 return True
5741
5742 def pretty_print(self, q):
5743 q.text("bsn_log {")
5744 with q.group():
5745 with q.indent(2):
5746 q.breakable()
5747 q.text("xid = ");
5748 if self.xid != None:
5749 q.text("%#x" % self.xid)
5750 else:
5751 q.text('None')
5752 q.text(","); q.breakable()
5753 q.text("loglevel = ");
5754 q.text("%#x" % self.loglevel)
5755 q.text(","); q.breakable()
5756 q.text("data = ");
5757 q.pp(self.data)
5758 q.breakable()
5759 q.text('}')
5760
5761bsn_header.subtypes[63] = bsn_log
5762
Rich Lane7dcdf022013-12-11 14:45:27 -08005763class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005764 version = 4
5765 type = 4
5766 experimenter = 6035143
5767 subtype = 34
5768
Rich Lane7b0f2012013-11-22 14:15:26 -08005769 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005770 if xid != None:
5771 self.xid = xid
5772 else:
5773 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005774 if status != None:
5775 self.status = status
5776 else:
5777 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005778 if port_no != None:
5779 self.port_no = port_no
5780 else:
5781 self.port_no = 0
5782 if slot_num != None:
5783 self.slot_num = slot_num
5784 else:
5785 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005786 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005787
5788 def pack(self):
5789 packed = []
5790 packed.append(struct.pack("!B", self.version))
5791 packed.append(struct.pack("!B", self.type))
5792 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5793 packed.append(struct.pack("!L", self.xid))
5794 packed.append(struct.pack("!L", self.experimenter))
5795 packed.append(struct.pack("!L", self.subtype))
5796 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005797 packed.append(util.pack_port_no(self.port_no))
5798 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005799 length = sum([len(x) for x in packed])
5800 packed[2] = struct.pack("!H", length)
5801 return ''.join(packed)
5802
5803 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005804 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005805 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005806 _version = reader.read("!B")[0]
5807 assert(_version == 4)
5808 _type = reader.read("!B")[0]
5809 assert(_type == 4)
5810 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005811 orig_reader = reader
5812 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005813 obj.xid = reader.read("!L")[0]
5814 _experimenter = reader.read("!L")[0]
5815 assert(_experimenter == 6035143)
5816 _subtype = reader.read("!L")[0]
5817 assert(_subtype == 34)
5818 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005819 obj.port_no = util.unpack_port_no(reader)
5820 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005821 return obj
5822
5823 def __eq__(self, other):
5824 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005825 if self.xid != other.xid: return False
5826 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005827 if self.port_no != other.port_no: return False
5828 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005829 return True
5830
Rich Lane6f4978c2013-10-20 21:33:52 -07005831 def pretty_print(self, q):
5832 q.text("bsn_pdu_rx_reply {")
5833 with q.group():
5834 with q.indent(2):
5835 q.breakable()
5836 q.text("xid = ");
5837 if self.xid != None:
5838 q.text("%#x" % self.xid)
5839 else:
5840 q.text('None')
5841 q.text(","); q.breakable()
5842 q.text("status = ");
5843 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005844 q.text(","); q.breakable()
5845 q.text("port_no = ");
5846 q.text(util.pretty_port(self.port_no))
5847 q.text(","); q.breakable()
5848 q.text("slot_num = ");
5849 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005850 q.breakable()
5851 q.text('}')
5852
Rich Lane7dcdf022013-12-11 14:45:27 -08005853bsn_header.subtypes[34] = bsn_pdu_rx_reply
5854
5855class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005856 version = 4
5857 type = 4
5858 experimenter = 6035143
5859 subtype = 33
5860
5861 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005862 if xid != None:
5863 self.xid = xid
5864 else:
5865 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005866 if timeout_ms != None:
5867 self.timeout_ms = timeout_ms
5868 else:
5869 self.timeout_ms = 0
5870 if port_no != None:
5871 self.port_no = port_no
5872 else:
5873 self.port_no = 0
5874 if slot_num != None:
5875 self.slot_num = slot_num
5876 else:
5877 self.slot_num = 0
5878 if data != None:
5879 self.data = data
5880 else:
5881 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005882 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005883
5884 def pack(self):
5885 packed = []
5886 packed.append(struct.pack("!B", self.version))
5887 packed.append(struct.pack("!B", self.type))
5888 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5889 packed.append(struct.pack("!L", self.xid))
5890 packed.append(struct.pack("!L", self.experimenter))
5891 packed.append(struct.pack("!L", self.subtype))
5892 packed.append(struct.pack("!L", self.timeout_ms))
5893 packed.append(util.pack_port_no(self.port_no))
5894 packed.append(struct.pack("!B", self.slot_num))
5895 packed.append('\x00' * 3)
5896 packed.append(self.data)
5897 length = sum([len(x) for x in packed])
5898 packed[2] = struct.pack("!H", length)
5899 return ''.join(packed)
5900
5901 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005902 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005903 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005904 _version = reader.read("!B")[0]
5905 assert(_version == 4)
5906 _type = reader.read("!B")[0]
5907 assert(_type == 4)
5908 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005909 orig_reader = reader
5910 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005911 obj.xid = reader.read("!L")[0]
5912 _experimenter = reader.read("!L")[0]
5913 assert(_experimenter == 6035143)
5914 _subtype = reader.read("!L")[0]
5915 assert(_subtype == 33)
5916 obj.timeout_ms = reader.read("!L")[0]
5917 obj.port_no = util.unpack_port_no(reader)
5918 obj.slot_num = reader.read("!B")[0]
5919 reader.skip(3)
5920 obj.data = str(reader.read_all())
5921 return obj
5922
5923 def __eq__(self, other):
5924 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005925 if self.xid != other.xid: return False
5926 if self.timeout_ms != other.timeout_ms: return False
5927 if self.port_no != other.port_no: return False
5928 if self.slot_num != other.slot_num: return False
5929 if self.data != other.data: return False
5930 return True
5931
Rich Lane6f4978c2013-10-20 21:33:52 -07005932 def pretty_print(self, q):
5933 q.text("bsn_pdu_rx_request {")
5934 with q.group():
5935 with q.indent(2):
5936 q.breakable()
5937 q.text("xid = ");
5938 if self.xid != None:
5939 q.text("%#x" % self.xid)
5940 else:
5941 q.text('None')
5942 q.text(","); q.breakable()
5943 q.text("timeout_ms = ");
5944 q.text("%#x" % self.timeout_ms)
5945 q.text(","); q.breakable()
5946 q.text("port_no = ");
5947 q.text(util.pretty_port(self.port_no))
5948 q.text(","); q.breakable()
5949 q.text("slot_num = ");
5950 q.text("%#x" % self.slot_num)
5951 q.text(","); q.breakable()
5952 q.text("data = ");
5953 q.pp(self.data)
5954 q.breakable()
5955 q.text('}')
5956
Rich Lane7dcdf022013-12-11 14:45:27 -08005957bsn_header.subtypes[33] = bsn_pdu_rx_request
5958
5959class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005960 version = 4
5961 type = 4
5962 experimenter = 6035143
5963 subtype = 35
5964
5965 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005966 if xid != None:
5967 self.xid = xid
5968 else:
5969 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005970 if port_no != None:
5971 self.port_no = port_no
5972 else:
5973 self.port_no = 0
5974 if slot_num != None:
5975 self.slot_num = slot_num
5976 else:
5977 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005978 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005979
5980 def pack(self):
5981 packed = []
5982 packed.append(struct.pack("!B", self.version))
5983 packed.append(struct.pack("!B", self.type))
5984 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5985 packed.append(struct.pack("!L", self.xid))
5986 packed.append(struct.pack("!L", self.experimenter))
5987 packed.append(struct.pack("!L", self.subtype))
5988 packed.append(util.pack_port_no(self.port_no))
5989 packed.append(struct.pack("!B", self.slot_num))
5990 length = sum([len(x) for x in packed])
5991 packed[2] = struct.pack("!H", length)
5992 return ''.join(packed)
5993
5994 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005995 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005996 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07005997 _version = reader.read("!B")[0]
5998 assert(_version == 4)
5999 _type = reader.read("!B")[0]
6000 assert(_type == 4)
6001 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006002 orig_reader = reader
6003 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006004 obj.xid = reader.read("!L")[0]
6005 _experimenter = reader.read("!L")[0]
6006 assert(_experimenter == 6035143)
6007 _subtype = reader.read("!L")[0]
6008 assert(_subtype == 35)
6009 obj.port_no = util.unpack_port_no(reader)
6010 obj.slot_num = reader.read("!B")[0]
6011 return obj
6012
6013 def __eq__(self, other):
6014 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006015 if self.xid != other.xid: return False
6016 if self.port_no != other.port_no: return False
6017 if self.slot_num != other.slot_num: return False
6018 return True
6019
Rich Lane6f4978c2013-10-20 21:33:52 -07006020 def pretty_print(self, q):
6021 q.text("bsn_pdu_rx_timeout {")
6022 with q.group():
6023 with q.indent(2):
6024 q.breakable()
6025 q.text("xid = ");
6026 if self.xid != None:
6027 q.text("%#x" % self.xid)
6028 else:
6029 q.text('None')
6030 q.text(","); q.breakable()
6031 q.text("port_no = ");
6032 q.text(util.pretty_port(self.port_no))
6033 q.text(","); q.breakable()
6034 q.text("slot_num = ");
6035 q.text("%#x" % self.slot_num)
6036 q.breakable()
6037 q.text('}')
6038
Rich Lane7dcdf022013-12-11 14:45:27 -08006039bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6040
6041class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006042 version = 4
6043 type = 4
6044 experimenter = 6035143
6045 subtype = 32
6046
Rich Lane7b0f2012013-11-22 14:15:26 -08006047 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006048 if xid != None:
6049 self.xid = xid
6050 else:
6051 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006052 if status != None:
6053 self.status = status
6054 else:
6055 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006056 if port_no != None:
6057 self.port_no = port_no
6058 else:
6059 self.port_no = 0
6060 if slot_num != None:
6061 self.slot_num = slot_num
6062 else:
6063 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006064 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006065
6066 def pack(self):
6067 packed = []
6068 packed.append(struct.pack("!B", self.version))
6069 packed.append(struct.pack("!B", self.type))
6070 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6071 packed.append(struct.pack("!L", self.xid))
6072 packed.append(struct.pack("!L", self.experimenter))
6073 packed.append(struct.pack("!L", self.subtype))
6074 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006075 packed.append(util.pack_port_no(self.port_no))
6076 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006077 length = sum([len(x) for x in packed])
6078 packed[2] = struct.pack("!H", length)
6079 return ''.join(packed)
6080
6081 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006082 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006083 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006084 _version = reader.read("!B")[0]
6085 assert(_version == 4)
6086 _type = reader.read("!B")[0]
6087 assert(_type == 4)
6088 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006089 orig_reader = reader
6090 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006091 obj.xid = reader.read("!L")[0]
6092 _experimenter = reader.read("!L")[0]
6093 assert(_experimenter == 6035143)
6094 _subtype = reader.read("!L")[0]
6095 assert(_subtype == 32)
6096 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006097 obj.port_no = util.unpack_port_no(reader)
6098 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006099 return obj
6100
6101 def __eq__(self, other):
6102 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006103 if self.xid != other.xid: return False
6104 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006105 if self.port_no != other.port_no: return False
6106 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006107 return True
6108
Rich Lane6f4978c2013-10-20 21:33:52 -07006109 def pretty_print(self, q):
6110 q.text("bsn_pdu_tx_reply {")
6111 with q.group():
6112 with q.indent(2):
6113 q.breakable()
6114 q.text("xid = ");
6115 if self.xid != None:
6116 q.text("%#x" % self.xid)
6117 else:
6118 q.text('None')
6119 q.text(","); q.breakable()
6120 q.text("status = ");
6121 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006122 q.text(","); q.breakable()
6123 q.text("port_no = ");
6124 q.text(util.pretty_port(self.port_no))
6125 q.text(","); q.breakable()
6126 q.text("slot_num = ");
6127 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006128 q.breakable()
6129 q.text('}')
6130
Rich Lane7dcdf022013-12-11 14:45:27 -08006131bsn_header.subtypes[32] = bsn_pdu_tx_reply
6132
6133class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006134 version = 4
6135 type = 4
6136 experimenter = 6035143
6137 subtype = 31
6138
6139 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006140 if xid != None:
6141 self.xid = xid
6142 else:
6143 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006144 if tx_interval_ms != None:
6145 self.tx_interval_ms = tx_interval_ms
6146 else:
6147 self.tx_interval_ms = 0
6148 if port_no != None:
6149 self.port_no = port_no
6150 else:
6151 self.port_no = 0
6152 if slot_num != None:
6153 self.slot_num = slot_num
6154 else:
6155 self.slot_num = 0
6156 if data != None:
6157 self.data = data
6158 else:
6159 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006160 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006161
6162 def pack(self):
6163 packed = []
6164 packed.append(struct.pack("!B", self.version))
6165 packed.append(struct.pack("!B", self.type))
6166 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6167 packed.append(struct.pack("!L", self.xid))
6168 packed.append(struct.pack("!L", self.experimenter))
6169 packed.append(struct.pack("!L", self.subtype))
6170 packed.append(struct.pack("!L", self.tx_interval_ms))
6171 packed.append(util.pack_port_no(self.port_no))
6172 packed.append(struct.pack("!B", self.slot_num))
6173 packed.append('\x00' * 3)
6174 packed.append(self.data)
6175 length = sum([len(x) for x in packed])
6176 packed[2] = struct.pack("!H", length)
6177 return ''.join(packed)
6178
6179 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006180 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006181 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006182 _version = reader.read("!B")[0]
6183 assert(_version == 4)
6184 _type = reader.read("!B")[0]
6185 assert(_type == 4)
6186 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006187 orig_reader = reader
6188 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006189 obj.xid = reader.read("!L")[0]
6190 _experimenter = reader.read("!L")[0]
6191 assert(_experimenter == 6035143)
6192 _subtype = reader.read("!L")[0]
6193 assert(_subtype == 31)
6194 obj.tx_interval_ms = reader.read("!L")[0]
6195 obj.port_no = util.unpack_port_no(reader)
6196 obj.slot_num = reader.read("!B")[0]
6197 reader.skip(3)
6198 obj.data = str(reader.read_all())
6199 return obj
6200
6201 def __eq__(self, other):
6202 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006203 if self.xid != other.xid: return False
6204 if self.tx_interval_ms != other.tx_interval_ms: return False
6205 if self.port_no != other.port_no: return False
6206 if self.slot_num != other.slot_num: return False
6207 if self.data != other.data: return False
6208 return True
6209
Rich Lane6f4978c2013-10-20 21:33:52 -07006210 def pretty_print(self, q):
6211 q.text("bsn_pdu_tx_request {")
6212 with q.group():
6213 with q.indent(2):
6214 q.breakable()
6215 q.text("xid = ");
6216 if self.xid != None:
6217 q.text("%#x" % self.xid)
6218 else:
6219 q.text('None')
6220 q.text(","); q.breakable()
6221 q.text("tx_interval_ms = ");
6222 q.text("%#x" % self.tx_interval_ms)
6223 q.text(","); q.breakable()
6224 q.text("port_no = ");
6225 q.text(util.pretty_port(self.port_no))
6226 q.text(","); q.breakable()
6227 q.text("slot_num = ");
6228 q.text("%#x" % self.slot_num)
6229 q.text(","); q.breakable()
6230 q.text("data = ");
6231 q.pp(self.data)
6232 q.breakable()
6233 q.text('}')
6234
Rich Lane7dcdf022013-12-11 14:45:27 -08006235bsn_header.subtypes[31] = bsn_pdu_tx_request
6236
6237class bsn_port_counter_stats_reply(bsn_stats_reply):
6238 version = 4
6239 type = 19
6240 stats_type = 65535
6241 experimenter = 6035143
6242 subtype = 8
6243
6244 def __init__(self, xid=None, flags=None, entries=None):
6245 if xid != None:
6246 self.xid = xid
6247 else:
6248 self.xid = None
6249 if flags != None:
6250 self.flags = flags
6251 else:
6252 self.flags = 0
6253 if entries != None:
6254 self.entries = entries
6255 else:
6256 self.entries = []
6257 return
6258
6259 def pack(self):
6260 packed = []
6261 packed.append(struct.pack("!B", self.version))
6262 packed.append(struct.pack("!B", self.type))
6263 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6264 packed.append(struct.pack("!L", self.xid))
6265 packed.append(struct.pack("!H", self.stats_type))
6266 packed.append(struct.pack("!H", self.flags))
6267 packed.append('\x00' * 4)
6268 packed.append(struct.pack("!L", self.experimenter))
6269 packed.append(struct.pack("!L", self.subtype))
6270 packed.append(loxi.generic_util.pack_list(self.entries))
6271 length = sum([len(x) for x in packed])
6272 packed[2] = struct.pack("!H", length)
6273 return ''.join(packed)
6274
6275 @staticmethod
6276 def unpack(reader):
6277 obj = bsn_port_counter_stats_reply()
6278 _version = reader.read("!B")[0]
6279 assert(_version == 4)
6280 _type = reader.read("!B")[0]
6281 assert(_type == 19)
6282 _length = reader.read("!H")[0]
6283 orig_reader = reader
6284 reader = orig_reader.slice(_length - (2 + 2))
6285 obj.xid = reader.read("!L")[0]
6286 _stats_type = reader.read("!H")[0]
6287 assert(_stats_type == 65535)
6288 obj.flags = reader.read("!H")[0]
6289 reader.skip(4)
6290 _experimenter = reader.read("!L")[0]
6291 assert(_experimenter == 6035143)
6292 _subtype = reader.read("!L")[0]
6293 assert(_subtype == 8)
6294 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6295 return obj
6296
6297 def __eq__(self, other):
6298 if type(self) != type(other): return False
6299 if self.xid != other.xid: return False
6300 if self.flags != other.flags: return False
6301 if self.entries != other.entries: return False
6302 return True
6303
6304 def pretty_print(self, q):
6305 q.text("bsn_port_counter_stats_reply {")
6306 with q.group():
6307 with q.indent(2):
6308 q.breakable()
6309 q.text("xid = ");
6310 if self.xid != None:
6311 q.text("%#x" % self.xid)
6312 else:
6313 q.text('None')
6314 q.text(","); q.breakable()
6315 q.text("flags = ");
6316 q.text("%#x" % self.flags)
6317 q.text(","); q.breakable()
6318 q.text("entries = ");
6319 q.pp(self.entries)
6320 q.breakable()
6321 q.text('}')
6322
6323bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6324
6325class bsn_port_counter_stats_request(bsn_stats_request):
6326 version = 4
6327 type = 18
6328 stats_type = 65535
6329 experimenter = 6035143
6330 subtype = 8
6331
6332 def __init__(self, xid=None, flags=None, port_no=None):
6333 if xid != None:
6334 self.xid = xid
6335 else:
6336 self.xid = None
6337 if flags != None:
6338 self.flags = flags
6339 else:
6340 self.flags = 0
6341 if port_no != None:
6342 self.port_no = port_no
6343 else:
6344 self.port_no = 0
6345 return
6346
6347 def pack(self):
6348 packed = []
6349 packed.append(struct.pack("!B", self.version))
6350 packed.append(struct.pack("!B", self.type))
6351 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6352 packed.append(struct.pack("!L", self.xid))
6353 packed.append(struct.pack("!H", self.stats_type))
6354 packed.append(struct.pack("!H", self.flags))
6355 packed.append('\x00' * 4)
6356 packed.append(struct.pack("!L", self.experimenter))
6357 packed.append(struct.pack("!L", self.subtype))
6358 packed.append(util.pack_port_no(self.port_no))
6359 length = sum([len(x) for x in packed])
6360 packed[2] = struct.pack("!H", length)
6361 return ''.join(packed)
6362
6363 @staticmethod
6364 def unpack(reader):
6365 obj = bsn_port_counter_stats_request()
6366 _version = reader.read("!B")[0]
6367 assert(_version == 4)
6368 _type = reader.read("!B")[0]
6369 assert(_type == 18)
6370 _length = reader.read("!H")[0]
6371 orig_reader = reader
6372 reader = orig_reader.slice(_length - (2 + 2))
6373 obj.xid = reader.read("!L")[0]
6374 _stats_type = reader.read("!H")[0]
6375 assert(_stats_type == 65535)
6376 obj.flags = reader.read("!H")[0]
6377 reader.skip(4)
6378 _experimenter = reader.read("!L")[0]
6379 assert(_experimenter == 6035143)
6380 _subtype = reader.read("!L")[0]
6381 assert(_subtype == 8)
6382 obj.port_no = util.unpack_port_no(reader)
6383 return obj
6384
6385 def __eq__(self, other):
6386 if type(self) != type(other): return False
6387 if self.xid != other.xid: return False
6388 if self.flags != other.flags: return False
6389 if self.port_no != other.port_no: return False
6390 return True
6391
6392 def pretty_print(self, q):
6393 q.text("bsn_port_counter_stats_request {")
6394 with q.group():
6395 with q.indent(2):
6396 q.breakable()
6397 q.text("xid = ");
6398 if self.xid != None:
6399 q.text("%#x" % self.xid)
6400 else:
6401 q.text('None')
6402 q.text(","); q.breakable()
6403 q.text("flags = ");
6404 q.text("%#x" % self.flags)
6405 q.text(","); q.breakable()
6406 q.text("port_no = ");
6407 q.text(util.pretty_port(self.port_no))
6408 q.breakable()
6409 q.text('}')
6410
6411bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6412
Rich Lane5454b682014-01-14 17:07:36 -08006413class bsn_role_status(bsn_header):
6414 version = 4
6415 type = 4
6416 experimenter = 6035143
6417 subtype = 55
6418
6419 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
6420 if xid != None:
6421 self.xid = xid
6422 else:
6423 self.xid = None
6424 if role != None:
6425 self.role = role
6426 else:
6427 self.role = 0
6428 if reason != None:
6429 self.reason = reason
6430 else:
6431 self.reason = 0
6432 if generation_id != None:
6433 self.generation_id = generation_id
6434 else:
6435 self.generation_id = 0
6436 return
6437
6438 def pack(self):
6439 packed = []
6440 packed.append(struct.pack("!B", self.version))
6441 packed.append(struct.pack("!B", self.type))
6442 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6443 packed.append(struct.pack("!L", self.xid))
6444 packed.append(struct.pack("!L", self.experimenter))
6445 packed.append(struct.pack("!L", self.subtype))
6446 packed.append(struct.pack("!L", self.role))
6447 packed.append(struct.pack("!B", self.reason))
6448 packed.append('\x00' * 3)
6449 packed.append(struct.pack("!Q", self.generation_id))
6450 length = sum([len(x) for x in packed])
6451 packed[2] = struct.pack("!H", length)
6452 return ''.join(packed)
6453
6454 @staticmethod
6455 def unpack(reader):
6456 obj = bsn_role_status()
6457 _version = reader.read("!B")[0]
6458 assert(_version == 4)
6459 _type = reader.read("!B")[0]
6460 assert(_type == 4)
6461 _length = reader.read("!H")[0]
6462 orig_reader = reader
6463 reader = orig_reader.slice(_length - (2 + 2))
6464 obj.xid = reader.read("!L")[0]
6465 _experimenter = reader.read("!L")[0]
6466 assert(_experimenter == 6035143)
6467 _subtype = reader.read("!L")[0]
6468 assert(_subtype == 55)
6469 obj.role = reader.read("!L")[0]
6470 obj.reason = reader.read("!B")[0]
6471 reader.skip(3)
6472 obj.generation_id = reader.read("!Q")[0]
6473 return obj
6474
6475 def __eq__(self, other):
6476 if type(self) != type(other): return False
6477 if self.xid != other.xid: return False
6478 if self.role != other.role: return False
6479 if self.reason != other.reason: return False
6480 if self.generation_id != other.generation_id: return False
6481 return True
6482
6483 def pretty_print(self, q):
6484 q.text("bsn_role_status {")
6485 with q.group():
6486 with q.indent(2):
6487 q.breakable()
6488 q.text("xid = ");
6489 if self.xid != None:
6490 q.text("%#x" % self.xid)
6491 else:
6492 q.text('None')
6493 q.text(","); q.breakable()
6494 q.text("role = ");
6495 q.text("%#x" % self.role)
6496 q.text(","); q.breakable()
6497 q.text("reason = ");
6498 q.text("%#x" % self.reason)
6499 q.text(","); q.breakable()
6500 q.text("generation_id = ");
6501 q.text("%#x" % self.generation_id)
6502 q.breakable()
6503 q.text('}')
6504
6505bsn_header.subtypes[55] = bsn_role_status
6506
Rich Lane95f7fc92014-01-27 17:08:16 -08006507class bsn_set_aux_cxns_reply(bsn_header):
6508 version = 4
6509 type = 4
6510 experimenter = 6035143
6511 subtype = 59
6512
6513 def __init__(self, xid=None, num_aux=None, status=None):
6514 if xid != None:
6515 self.xid = xid
6516 else:
6517 self.xid = None
6518 if num_aux != None:
6519 self.num_aux = num_aux
6520 else:
6521 self.num_aux = 0
6522 if status != None:
6523 self.status = status
6524 else:
6525 self.status = 0
6526 return
6527
6528 def pack(self):
6529 packed = []
6530 packed.append(struct.pack("!B", self.version))
6531 packed.append(struct.pack("!B", self.type))
6532 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6533 packed.append(struct.pack("!L", self.xid))
6534 packed.append(struct.pack("!L", self.experimenter))
6535 packed.append(struct.pack("!L", self.subtype))
6536 packed.append(struct.pack("!L", self.num_aux))
6537 packed.append(struct.pack("!L", self.status))
6538 length = sum([len(x) for x in packed])
6539 packed[2] = struct.pack("!H", length)
6540 return ''.join(packed)
6541
6542 @staticmethod
6543 def unpack(reader):
6544 obj = bsn_set_aux_cxns_reply()
6545 _version = reader.read("!B")[0]
6546 assert(_version == 4)
6547 _type = reader.read("!B")[0]
6548 assert(_type == 4)
6549 _length = reader.read("!H")[0]
6550 orig_reader = reader
6551 reader = orig_reader.slice(_length - (2 + 2))
6552 obj.xid = reader.read("!L")[0]
6553 _experimenter = reader.read("!L")[0]
6554 assert(_experimenter == 6035143)
6555 _subtype = reader.read("!L")[0]
6556 assert(_subtype == 59)
6557 obj.num_aux = reader.read("!L")[0]
6558 obj.status = reader.read("!L")[0]
6559 return obj
6560
6561 def __eq__(self, other):
6562 if type(self) != type(other): return False
6563 if self.xid != other.xid: return False
6564 if self.num_aux != other.num_aux: return False
6565 if self.status != other.status: return False
6566 return True
6567
6568 def pretty_print(self, q):
6569 q.text("bsn_set_aux_cxns_reply {")
6570 with q.group():
6571 with q.indent(2):
6572 q.breakable()
6573 q.text("xid = ");
6574 if self.xid != None:
6575 q.text("%#x" % self.xid)
6576 else:
6577 q.text('None')
6578 q.text(","); q.breakable()
6579 q.text("num_aux = ");
6580 q.text("%#x" % self.num_aux)
6581 q.text(","); q.breakable()
6582 q.text("status = ");
6583 q.text("%#x" % self.status)
6584 q.breakable()
6585 q.text('}')
6586
6587bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
6588
6589class bsn_set_aux_cxns_request(bsn_header):
6590 version = 4
6591 type = 4
6592 experimenter = 6035143
6593 subtype = 58
6594
6595 def __init__(self, xid=None, num_aux=None):
6596 if xid != None:
6597 self.xid = xid
6598 else:
6599 self.xid = None
6600 if num_aux != None:
6601 self.num_aux = num_aux
6602 else:
6603 self.num_aux = 0
6604 return
6605
6606 def pack(self):
6607 packed = []
6608 packed.append(struct.pack("!B", self.version))
6609 packed.append(struct.pack("!B", self.type))
6610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6611 packed.append(struct.pack("!L", self.xid))
6612 packed.append(struct.pack("!L", self.experimenter))
6613 packed.append(struct.pack("!L", self.subtype))
6614 packed.append(struct.pack("!L", self.num_aux))
6615 length = sum([len(x) for x in packed])
6616 packed[2] = struct.pack("!H", length)
6617 return ''.join(packed)
6618
6619 @staticmethod
6620 def unpack(reader):
6621 obj = bsn_set_aux_cxns_request()
6622 _version = reader.read("!B")[0]
6623 assert(_version == 4)
6624 _type = reader.read("!B")[0]
6625 assert(_type == 4)
6626 _length = reader.read("!H")[0]
6627 orig_reader = reader
6628 reader = orig_reader.slice(_length - (2 + 2))
6629 obj.xid = reader.read("!L")[0]
6630 _experimenter = reader.read("!L")[0]
6631 assert(_experimenter == 6035143)
6632 _subtype = reader.read("!L")[0]
6633 assert(_subtype == 58)
6634 obj.num_aux = reader.read("!L")[0]
6635 return obj
6636
6637 def __eq__(self, other):
6638 if type(self) != type(other): return False
6639 if self.xid != other.xid: return False
6640 if self.num_aux != other.num_aux: return False
6641 return True
6642
6643 def pretty_print(self, q):
6644 q.text("bsn_set_aux_cxns_request {")
6645 with q.group():
6646 with q.indent(2):
6647 q.breakable()
6648 q.text("xid = ");
6649 if self.xid != None:
6650 q.text("%#x" % self.xid)
6651 else:
6652 q.text('None')
6653 q.text(","); q.breakable()
6654 q.text("num_aux = ");
6655 q.text("%#x" % self.num_aux)
6656 q.breakable()
6657 q.text('}')
6658
6659bsn_header.subtypes[58] = bsn_set_aux_cxns_request
6660
Rich Lane7dcdf022013-12-11 14:45:27 -08006661class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006662 version = 4
6663 type = 4
6664 experimenter = 6035143
6665 subtype = 42
6666
6667 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006668 if xid != None:
6669 self.xid = xid
6670 else:
6671 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006672 if status != None:
6673 self.status = status
6674 else:
6675 self.status = 0
6676 if port_no != None:
6677 self.port_no = port_no
6678 else:
6679 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006680 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006681
6682 def pack(self):
6683 packed = []
6684 packed.append(struct.pack("!B", self.version))
6685 packed.append(struct.pack("!B", self.type))
6686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6687 packed.append(struct.pack("!L", self.xid))
6688 packed.append(struct.pack("!L", self.experimenter))
6689 packed.append(struct.pack("!L", self.subtype))
6690 packed.append(struct.pack("!L", self.status))
6691 packed.append(util.pack_port_no(self.port_no))
6692 length = sum([len(x) for x in packed])
6693 packed[2] = struct.pack("!H", length)
6694 return ''.join(packed)
6695
6696 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006697 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006698 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08006699 _version = reader.read("!B")[0]
6700 assert(_version == 4)
6701 _type = reader.read("!B")[0]
6702 assert(_type == 4)
6703 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006704 orig_reader = reader
6705 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006706 obj.xid = reader.read("!L")[0]
6707 _experimenter = reader.read("!L")[0]
6708 assert(_experimenter == 6035143)
6709 _subtype = reader.read("!L")[0]
6710 assert(_subtype == 42)
6711 obj.status = reader.read("!L")[0]
6712 obj.port_no = util.unpack_port_no(reader)
6713 return obj
6714
6715 def __eq__(self, other):
6716 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006717 if self.xid != other.xid: return False
6718 if self.status != other.status: return False
6719 if self.port_no != other.port_no: return False
6720 return True
6721
Rich Lane7b0f2012013-11-22 14:15:26 -08006722 def pretty_print(self, q):
6723 q.text("bsn_set_lacp_reply {")
6724 with q.group():
6725 with q.indent(2):
6726 q.breakable()
6727 q.text("xid = ");
6728 if self.xid != None:
6729 q.text("%#x" % self.xid)
6730 else:
6731 q.text('None')
6732 q.text(","); q.breakable()
6733 q.text("status = ");
6734 q.text("%#x" % self.status)
6735 q.text(","); q.breakable()
6736 q.text("port_no = ");
6737 q.text(util.pretty_port(self.port_no))
6738 q.breakable()
6739 q.text('}')
6740
Rich Lane7dcdf022013-12-11 14:45:27 -08006741bsn_header.subtypes[42] = bsn_set_lacp_reply
6742
6743class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006744 version = 4
6745 type = 4
6746 experimenter = 6035143
6747 subtype = 41
6748
6749 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 -08006750 if xid != None:
6751 self.xid = xid
6752 else:
6753 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006754 if enabled != None:
6755 self.enabled = enabled
6756 else:
6757 self.enabled = 0
6758 if port_no != None:
6759 self.port_no = port_no
6760 else:
6761 self.port_no = 0
6762 if actor_sys_priority != None:
6763 self.actor_sys_priority = actor_sys_priority
6764 else:
6765 self.actor_sys_priority = 0
6766 if actor_sys_mac != None:
6767 self.actor_sys_mac = actor_sys_mac
6768 else:
6769 self.actor_sys_mac = [0,0,0,0,0,0]
6770 if actor_port_priority != None:
6771 self.actor_port_priority = actor_port_priority
6772 else:
6773 self.actor_port_priority = 0
6774 if actor_port_num != None:
6775 self.actor_port_num = actor_port_num
6776 else:
6777 self.actor_port_num = 0
6778 if actor_key != None:
6779 self.actor_key = actor_key
6780 else:
6781 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006782 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006783
6784 def pack(self):
6785 packed = []
6786 packed.append(struct.pack("!B", self.version))
6787 packed.append(struct.pack("!B", self.type))
6788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6789 packed.append(struct.pack("!L", self.xid))
6790 packed.append(struct.pack("!L", self.experimenter))
6791 packed.append(struct.pack("!L", self.subtype))
6792 packed.append(struct.pack("!B", self.enabled))
6793 packed.append('\x00' * 3)
6794 packed.append(util.pack_port_no(self.port_no))
6795 packed.append(struct.pack("!H", self.actor_sys_priority))
6796 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6797 packed.append(struct.pack("!H", self.actor_port_priority))
6798 packed.append(struct.pack("!H", self.actor_port_num))
6799 packed.append(struct.pack("!H", self.actor_key))
6800 length = sum([len(x) for x in packed])
6801 packed[2] = struct.pack("!H", length)
6802 return ''.join(packed)
6803
6804 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006805 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006806 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006807 _version = reader.read("!B")[0]
6808 assert(_version == 4)
6809 _type = reader.read("!B")[0]
6810 assert(_type == 4)
6811 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006812 orig_reader = reader
6813 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006814 obj.xid = reader.read("!L")[0]
6815 _experimenter = reader.read("!L")[0]
6816 assert(_experimenter == 6035143)
6817 _subtype = reader.read("!L")[0]
6818 assert(_subtype == 41)
6819 obj.enabled = reader.read("!B")[0]
6820 reader.skip(3)
6821 obj.port_no = util.unpack_port_no(reader)
6822 obj.actor_sys_priority = reader.read("!H")[0]
6823 obj.actor_sys_mac = list(reader.read('!6B'))
6824 obj.actor_port_priority = reader.read("!H")[0]
6825 obj.actor_port_num = reader.read("!H")[0]
6826 obj.actor_key = reader.read("!H")[0]
6827 return obj
6828
6829 def __eq__(self, other):
6830 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006831 if self.xid != other.xid: return False
6832 if self.enabled != other.enabled: return False
6833 if self.port_no != other.port_no: return False
6834 if self.actor_sys_priority != other.actor_sys_priority: return False
6835 if self.actor_sys_mac != other.actor_sys_mac: return False
6836 if self.actor_port_priority != other.actor_port_priority: return False
6837 if self.actor_port_num != other.actor_port_num: return False
6838 if self.actor_key != other.actor_key: return False
6839 return True
6840
Rich Lane7b0f2012013-11-22 14:15:26 -08006841 def pretty_print(self, q):
6842 q.text("bsn_set_lacp_request {")
6843 with q.group():
6844 with q.indent(2):
6845 q.breakable()
6846 q.text("xid = ");
6847 if self.xid != None:
6848 q.text("%#x" % self.xid)
6849 else:
6850 q.text('None')
6851 q.text(","); q.breakable()
6852 q.text("enabled = ");
6853 q.text("%#x" % self.enabled)
6854 q.text(","); q.breakable()
6855 q.text("port_no = ");
6856 q.text(util.pretty_port(self.port_no))
6857 q.text(","); q.breakable()
6858 q.text("actor_sys_priority = ");
6859 q.text("%#x" % self.actor_sys_priority)
6860 q.text(","); q.breakable()
6861 q.text("actor_sys_mac = ");
6862 q.text(util.pretty_mac(self.actor_sys_mac))
6863 q.text(","); q.breakable()
6864 q.text("actor_port_priority = ");
6865 q.text("%#x" % self.actor_port_priority)
6866 q.text(","); q.breakable()
6867 q.text("actor_port_num = ");
6868 q.text("%#x" % self.actor_port_num)
6869 q.text(","); q.breakable()
6870 q.text("actor_key = ");
6871 q.text("%#x" % self.actor_key)
6872 q.breakable()
6873 q.text('}')
6874
Rich Lane7dcdf022013-12-11 14:45:27 -08006875bsn_header.subtypes[41] = bsn_set_lacp_request
6876
6877class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006878 version = 4
6879 type = 4
6880 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006881 subtype = 3
6882
6883 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006884 if xid != None:
6885 self.xid = xid
6886 else:
6887 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006888 if report_mirror_ports != None:
6889 self.report_mirror_ports = report_mirror_ports
6890 else:
6891 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006892 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006893
6894 def pack(self):
6895 packed = []
6896 packed.append(struct.pack("!B", self.version))
6897 packed.append(struct.pack("!B", self.type))
6898 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6899 packed.append(struct.pack("!L", self.xid))
6900 packed.append(struct.pack("!L", self.experimenter))
6901 packed.append(struct.pack("!L", self.subtype))
6902 packed.append(struct.pack("!B", self.report_mirror_ports))
6903 packed.append('\x00' * 3)
6904 length = sum([len(x) for x in packed])
6905 packed[2] = struct.pack("!H", length)
6906 return ''.join(packed)
6907
6908 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006909 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006910 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07006911 _version = reader.read("!B")[0]
6912 assert(_version == 4)
6913 _type = reader.read("!B")[0]
6914 assert(_type == 4)
6915 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006916 orig_reader = reader
6917 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006918 obj.xid = reader.read("!L")[0]
6919 _experimenter = reader.read("!L")[0]
6920 assert(_experimenter == 6035143)
6921 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006922 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07006923 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006924 reader.skip(3)
6925 return obj
6926
6927 def __eq__(self, other):
6928 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006929 if self.xid != other.xid: return False
6930 if self.report_mirror_ports != other.report_mirror_ports: return False
6931 return True
6932
Rich Lanec2ee4b82013-04-24 17:12:38 -07006933 def pretty_print(self, q):
6934 q.text("bsn_set_mirroring {")
6935 with q.group():
6936 with q.indent(2):
6937 q.breakable()
6938 q.text("xid = ");
6939 if self.xid != None:
6940 q.text("%#x" % self.xid)
6941 else:
6942 q.text('None')
6943 q.text(","); q.breakable()
6944 q.text("report_mirror_ports = ");
6945 q.text("%#x" % self.report_mirror_ports)
6946 q.breakable()
6947 q.text('}')
6948
Rich Lane7dcdf022013-12-11 14:45:27 -08006949bsn_header.subtypes[3] = bsn_set_mirroring
6950
6951class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006952 version = 4
6953 type = 4
6954 experimenter = 6035143
6955 subtype = 25
6956
6957 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006958 if xid != None:
6959 self.xid = xid
6960 else:
6961 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006962 if status != None:
6963 self.status = status
6964 else:
6965 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006966 return
Dan Talaycof6202252013-07-02 01:00:29 -07006967
6968 def pack(self):
6969 packed = []
6970 packed.append(struct.pack("!B", self.version))
6971 packed.append(struct.pack("!B", self.type))
6972 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6973 packed.append(struct.pack("!L", self.xid))
6974 packed.append(struct.pack("!L", self.experimenter))
6975 packed.append(struct.pack("!L", self.subtype))
6976 packed.append(struct.pack("!L", self.status))
6977 length = sum([len(x) for x in packed])
6978 packed[2] = struct.pack("!H", length)
6979 return ''.join(packed)
6980
6981 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006982 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006983 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006984 _version = reader.read("!B")[0]
6985 assert(_version == 4)
6986 _type = reader.read("!B")[0]
6987 assert(_type == 4)
6988 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006989 orig_reader = reader
6990 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006991 obj.xid = reader.read("!L")[0]
6992 _experimenter = reader.read("!L")[0]
6993 assert(_experimenter == 6035143)
6994 _subtype = reader.read("!L")[0]
6995 assert(_subtype == 25)
6996 obj.status = reader.read("!L")[0]
6997 return obj
6998
6999 def __eq__(self, other):
7000 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007001 if self.xid != other.xid: return False
7002 if self.status != other.status: return False
7003 return True
7004
Dan Talaycof6202252013-07-02 01:00:29 -07007005 def pretty_print(self, q):
7006 q.text("bsn_set_pktin_suppression_reply {")
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("status = ");
7017 q.text("%#x" % self.status)
7018 q.breakable()
7019 q.text('}')
7020
Rich Lane7dcdf022013-12-11 14:45:27 -08007021bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7022
7023class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007024 version = 4
7025 type = 4
7026 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007027 subtype = 11
7028
7029 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007030 if xid != None:
7031 self.xid = xid
7032 else:
7033 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007034 if enabled != None:
7035 self.enabled = enabled
7036 else:
7037 self.enabled = 0
7038 if idle_timeout != None:
7039 self.idle_timeout = idle_timeout
7040 else:
7041 self.idle_timeout = 0
7042 if hard_timeout != None:
7043 self.hard_timeout = hard_timeout
7044 else:
7045 self.hard_timeout = 0
7046 if priority != None:
7047 self.priority = priority
7048 else:
7049 self.priority = 0
7050 if cookie != None:
7051 self.cookie = cookie
7052 else:
7053 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007054 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007055
7056 def pack(self):
7057 packed = []
7058 packed.append(struct.pack("!B", self.version))
7059 packed.append(struct.pack("!B", self.type))
7060 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7061 packed.append(struct.pack("!L", self.xid))
7062 packed.append(struct.pack("!L", self.experimenter))
7063 packed.append(struct.pack("!L", self.subtype))
7064 packed.append(struct.pack("!B", self.enabled))
7065 packed.append('\x00' * 1)
7066 packed.append(struct.pack("!H", self.idle_timeout))
7067 packed.append(struct.pack("!H", self.hard_timeout))
7068 packed.append(struct.pack("!H", self.priority))
7069 packed.append(struct.pack("!Q", self.cookie))
7070 length = sum([len(x) for x in packed])
7071 packed[2] = struct.pack("!H", length)
7072 return ''.join(packed)
7073
7074 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007075 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007076 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007077 _version = reader.read("!B")[0]
7078 assert(_version == 4)
7079 _type = reader.read("!B")[0]
7080 assert(_type == 4)
7081 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007082 orig_reader = reader
7083 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007084 obj.xid = reader.read("!L")[0]
7085 _experimenter = reader.read("!L")[0]
7086 assert(_experimenter == 6035143)
7087 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007088 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07007089 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007090 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07007091 obj.idle_timeout = reader.read("!H")[0]
7092 obj.hard_timeout = reader.read("!H")[0]
7093 obj.priority = reader.read("!H")[0]
7094 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007095 return obj
7096
7097 def __eq__(self, other):
7098 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007099 if self.xid != other.xid: return False
7100 if self.enabled != other.enabled: return False
7101 if self.idle_timeout != other.idle_timeout: return False
7102 if self.hard_timeout != other.hard_timeout: return False
7103 if self.priority != other.priority: return False
7104 if self.cookie != other.cookie: return False
7105 return True
7106
Rich Lanec2ee4b82013-04-24 17:12:38 -07007107 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07007108 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007109 with q.group():
7110 with q.indent(2):
7111 q.breakable()
7112 q.text("xid = ");
7113 if self.xid != None:
7114 q.text("%#x" % self.xid)
7115 else:
7116 q.text('None')
7117 q.text(","); q.breakable()
7118 q.text("enabled = ");
7119 q.text("%#x" % self.enabled)
7120 q.text(","); q.breakable()
7121 q.text("idle_timeout = ");
7122 q.text("%#x" % self.idle_timeout)
7123 q.text(","); q.breakable()
7124 q.text("hard_timeout = ");
7125 q.text("%#x" % self.hard_timeout)
7126 q.text(","); q.breakable()
7127 q.text("priority = ");
7128 q.text("%#x" % self.priority)
7129 q.text(","); q.breakable()
7130 q.text("cookie = ");
7131 q.text("%#x" % self.cookie)
7132 q.breakable()
7133 q.text('}')
7134
Rich Lane7dcdf022013-12-11 14:45:27 -08007135bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7136
7137class bsn_set_switch_pipeline_reply(bsn_header):
7138 version = 4
7139 type = 4
7140 experimenter = 6035143
7141 subtype = 54
7142
7143 def __init__(self, xid=None, status=None):
7144 if xid != None:
7145 self.xid = xid
7146 else:
7147 self.xid = None
7148 if status != None:
7149 self.status = status
7150 else:
7151 self.status = 0
7152 return
7153
7154 def pack(self):
7155 packed = []
7156 packed.append(struct.pack("!B", self.version))
7157 packed.append(struct.pack("!B", self.type))
7158 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7159 packed.append(struct.pack("!L", self.xid))
7160 packed.append(struct.pack("!L", self.experimenter))
7161 packed.append(struct.pack("!L", self.subtype))
7162 packed.append(struct.pack("!L", self.status))
7163 length = sum([len(x) for x in packed])
7164 packed[2] = struct.pack("!H", length)
7165 return ''.join(packed)
7166
7167 @staticmethod
7168 def unpack(reader):
7169 obj = bsn_set_switch_pipeline_reply()
7170 _version = reader.read("!B")[0]
7171 assert(_version == 4)
7172 _type = reader.read("!B")[0]
7173 assert(_type == 4)
7174 _length = reader.read("!H")[0]
7175 orig_reader = reader
7176 reader = orig_reader.slice(_length - (2 + 2))
7177 obj.xid = reader.read("!L")[0]
7178 _experimenter = reader.read("!L")[0]
7179 assert(_experimenter == 6035143)
7180 _subtype = reader.read("!L")[0]
7181 assert(_subtype == 54)
7182 obj.status = reader.read("!L")[0]
7183 return obj
7184
7185 def __eq__(self, other):
7186 if type(self) != type(other): return False
7187 if self.xid != other.xid: return False
7188 if self.status != other.status: return False
7189 return True
7190
7191 def pretty_print(self, q):
7192 q.text("bsn_set_switch_pipeline_reply {")
7193 with q.group():
7194 with q.indent(2):
7195 q.breakable()
7196 q.text("xid = ");
7197 if self.xid != None:
7198 q.text("%#x" % self.xid)
7199 else:
7200 q.text('None')
7201 q.text(","); q.breakable()
7202 q.text("status = ");
7203 q.text("%#x" % self.status)
7204 q.breakable()
7205 q.text('}')
7206
7207bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7208
7209class bsn_set_switch_pipeline_request(bsn_header):
7210 version = 4
7211 type = 4
7212 experimenter = 6035143
7213 subtype = 53
7214
7215 def __init__(self, xid=None, pipeline=None):
7216 if xid != None:
7217 self.xid = xid
7218 else:
7219 self.xid = None
7220 if pipeline != None:
7221 self.pipeline = pipeline
7222 else:
7223 self.pipeline = ""
7224 return
7225
7226 def pack(self):
7227 packed = []
7228 packed.append(struct.pack("!B", self.version))
7229 packed.append(struct.pack("!B", self.type))
7230 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7231 packed.append(struct.pack("!L", self.xid))
7232 packed.append(struct.pack("!L", self.experimenter))
7233 packed.append(struct.pack("!L", self.subtype))
7234 packed.append(struct.pack("!256s", self.pipeline))
7235 length = sum([len(x) for x in packed])
7236 packed[2] = struct.pack("!H", length)
7237 return ''.join(packed)
7238
7239 @staticmethod
7240 def unpack(reader):
7241 obj = bsn_set_switch_pipeline_request()
7242 _version = reader.read("!B")[0]
7243 assert(_version == 4)
7244 _type = reader.read("!B")[0]
7245 assert(_type == 4)
7246 _length = reader.read("!H")[0]
7247 orig_reader = reader
7248 reader = orig_reader.slice(_length - (2 + 2))
7249 obj.xid = reader.read("!L")[0]
7250 _experimenter = reader.read("!L")[0]
7251 assert(_experimenter == 6035143)
7252 _subtype = reader.read("!L")[0]
7253 assert(_subtype == 53)
7254 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7255 return obj
7256
7257 def __eq__(self, other):
7258 if type(self) != type(other): return False
7259 if self.xid != other.xid: return False
7260 if self.pipeline != other.pipeline: return False
7261 return True
7262
7263 def pretty_print(self, q):
7264 q.text("bsn_set_switch_pipeline_request {")
7265 with q.group():
7266 with q.indent(2):
7267 q.breakable()
7268 q.text("xid = ");
7269 if self.xid != None:
7270 q.text("%#x" % self.xid)
7271 else:
7272 q.text('None')
7273 q.text(","); q.breakable()
7274 q.text("pipeline = ");
7275 q.pp(self.pipeline)
7276 q.breakable()
7277 q.text('}')
7278
7279bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7280
7281class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7282 version = 4
7283 type = 19
7284 stats_type = 65535
7285 experimenter = 6035143
7286 subtype = 6
7287
7288 def __init__(self, xid=None, flags=None, entries=None):
7289 if xid != None:
7290 self.xid = xid
7291 else:
7292 self.xid = None
7293 if flags != None:
7294 self.flags = flags
7295 else:
7296 self.flags = 0
7297 if entries != None:
7298 self.entries = entries
7299 else:
7300 self.entries = []
7301 return
7302
7303 def pack(self):
7304 packed = []
7305 packed.append(struct.pack("!B", self.version))
7306 packed.append(struct.pack("!B", self.type))
7307 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7308 packed.append(struct.pack("!L", self.xid))
7309 packed.append(struct.pack("!H", self.stats_type))
7310 packed.append(struct.pack("!H", self.flags))
7311 packed.append('\x00' * 4)
7312 packed.append(struct.pack("!L", self.experimenter))
7313 packed.append(struct.pack("!L", self.subtype))
7314 packed.append(loxi.generic_util.pack_list(self.entries))
7315 length = sum([len(x) for x in packed])
7316 packed[2] = struct.pack("!H", length)
7317 return ''.join(packed)
7318
7319 @staticmethod
7320 def unpack(reader):
7321 obj = bsn_switch_pipeline_stats_reply()
7322 _version = reader.read("!B")[0]
7323 assert(_version == 4)
7324 _type = reader.read("!B")[0]
7325 assert(_type == 19)
7326 _length = reader.read("!H")[0]
7327 orig_reader = reader
7328 reader = orig_reader.slice(_length - (2 + 2))
7329 obj.xid = reader.read("!L")[0]
7330 _stats_type = reader.read("!H")[0]
7331 assert(_stats_type == 65535)
7332 obj.flags = reader.read("!H")[0]
7333 reader.skip(4)
7334 _experimenter = reader.read("!L")[0]
7335 assert(_experimenter == 6035143)
7336 _subtype = reader.read("!L")[0]
7337 assert(_subtype == 6)
7338 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
7339 return obj
7340
7341 def __eq__(self, other):
7342 if type(self) != type(other): return False
7343 if self.xid != other.xid: return False
7344 if self.flags != other.flags: return False
7345 if self.entries != other.entries: return False
7346 return True
7347
7348 def pretty_print(self, q):
7349 q.text("bsn_switch_pipeline_stats_reply {")
7350 with q.group():
7351 with q.indent(2):
7352 q.breakable()
7353 q.text("xid = ");
7354 if self.xid != None:
7355 q.text("%#x" % self.xid)
7356 else:
7357 q.text('None')
7358 q.text(","); q.breakable()
7359 q.text("flags = ");
7360 q.text("%#x" % self.flags)
7361 q.text(","); q.breakable()
7362 q.text("entries = ");
7363 q.pp(self.entries)
7364 q.breakable()
7365 q.text('}')
7366
7367bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
7368
7369class bsn_switch_pipeline_stats_request(bsn_stats_request):
7370 version = 4
7371 type = 18
7372 stats_type = 65535
7373 experimenter = 6035143
7374 subtype = 6
7375
7376 def __init__(self, xid=None, flags=None):
7377 if xid != None:
7378 self.xid = xid
7379 else:
7380 self.xid = None
7381 if flags != None:
7382 self.flags = flags
7383 else:
7384 self.flags = 0
7385 return
7386
7387 def pack(self):
7388 packed = []
7389 packed.append(struct.pack("!B", self.version))
7390 packed.append(struct.pack("!B", self.type))
7391 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7392 packed.append(struct.pack("!L", self.xid))
7393 packed.append(struct.pack("!H", self.stats_type))
7394 packed.append(struct.pack("!H", self.flags))
7395 packed.append('\x00' * 4)
7396 packed.append(struct.pack("!L", self.experimenter))
7397 packed.append(struct.pack("!L", self.subtype))
7398 length = sum([len(x) for x in packed])
7399 packed[2] = struct.pack("!H", length)
7400 return ''.join(packed)
7401
7402 @staticmethod
7403 def unpack(reader):
7404 obj = bsn_switch_pipeline_stats_request()
7405 _version = reader.read("!B")[0]
7406 assert(_version == 4)
7407 _type = reader.read("!B")[0]
7408 assert(_type == 18)
7409 _length = reader.read("!H")[0]
7410 orig_reader = reader
7411 reader = orig_reader.slice(_length - (2 + 2))
7412 obj.xid = reader.read("!L")[0]
7413 _stats_type = reader.read("!H")[0]
7414 assert(_stats_type == 65535)
7415 obj.flags = reader.read("!H")[0]
7416 reader.skip(4)
7417 _experimenter = reader.read("!L")[0]
7418 assert(_experimenter == 6035143)
7419 _subtype = reader.read("!L")[0]
7420 assert(_subtype == 6)
7421 return obj
7422
7423 def __eq__(self, other):
7424 if type(self) != type(other): return False
7425 if self.xid != other.xid: return False
7426 if self.flags != other.flags: return False
7427 return True
7428
7429 def pretty_print(self, q):
7430 q.text("bsn_switch_pipeline_stats_request {")
7431 with q.group():
7432 with q.indent(2):
7433 q.breakable()
7434 q.text("xid = ");
7435 if self.xid != None:
7436 q.text("%#x" % self.xid)
7437 else:
7438 q.text('None')
7439 q.text(","); q.breakable()
7440 q.text("flags = ");
7441 q.text("%#x" % self.flags)
7442 q.breakable()
7443 q.text('}')
7444
7445bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7446
Rich Lane9ec3fca2014-02-26 16:22:56 -08007447class bsn_table_checksum_stats_reply(bsn_stats_reply):
7448 version = 4
7449 type = 19
7450 stats_type = 65535
7451 experimenter = 6035143
7452 subtype = 11
7453
7454 def __init__(self, xid=None, flags=None, entries=None):
7455 if xid != None:
7456 self.xid = xid
7457 else:
7458 self.xid = None
7459 if flags != None:
7460 self.flags = flags
7461 else:
7462 self.flags = 0
7463 if entries != None:
7464 self.entries = entries
7465 else:
7466 self.entries = []
7467 return
7468
7469 def pack(self):
7470 packed = []
7471 packed.append(struct.pack("!B", self.version))
7472 packed.append(struct.pack("!B", self.type))
7473 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7474 packed.append(struct.pack("!L", self.xid))
7475 packed.append(struct.pack("!H", self.stats_type))
7476 packed.append(struct.pack("!H", self.flags))
7477 packed.append('\x00' * 4)
7478 packed.append(struct.pack("!L", self.experimenter))
7479 packed.append(struct.pack("!L", self.subtype))
7480 packed.append(loxi.generic_util.pack_list(self.entries))
7481 length = sum([len(x) for x in packed])
7482 packed[2] = struct.pack("!H", length)
7483 return ''.join(packed)
7484
7485 @staticmethod
7486 def unpack(reader):
7487 obj = bsn_table_checksum_stats_reply()
7488 _version = reader.read("!B")[0]
7489 assert(_version == 4)
7490 _type = reader.read("!B")[0]
7491 assert(_type == 19)
7492 _length = reader.read("!H")[0]
7493 orig_reader = reader
7494 reader = orig_reader.slice(_length - (2 + 2))
7495 obj.xid = reader.read("!L")[0]
7496 _stats_type = reader.read("!H")[0]
7497 assert(_stats_type == 65535)
7498 obj.flags = reader.read("!H")[0]
7499 reader.skip(4)
7500 _experimenter = reader.read("!L")[0]
7501 assert(_experimenter == 6035143)
7502 _subtype = reader.read("!L")[0]
7503 assert(_subtype == 11)
7504 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
7505 return obj
7506
7507 def __eq__(self, other):
7508 if type(self) != type(other): return False
7509 if self.xid != other.xid: return False
7510 if self.flags != other.flags: return False
7511 if self.entries != other.entries: return False
7512 return True
7513
7514 def pretty_print(self, q):
7515 q.text("bsn_table_checksum_stats_reply {")
7516 with q.group():
7517 with q.indent(2):
7518 q.breakable()
7519 q.text("xid = ");
7520 if self.xid != None:
7521 q.text("%#x" % self.xid)
7522 else:
7523 q.text('None')
7524 q.text(","); q.breakable()
7525 q.text("flags = ");
7526 q.text("%#x" % self.flags)
7527 q.text(","); q.breakable()
7528 q.text("entries = ");
7529 q.pp(self.entries)
7530 q.breakable()
7531 q.text('}')
7532
7533bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7534
7535class bsn_table_checksum_stats_request(bsn_stats_request):
7536 version = 4
7537 type = 18
7538 stats_type = 65535
7539 experimenter = 6035143
7540 subtype = 11
7541
7542 def __init__(self, xid=None, flags=None):
7543 if xid != None:
7544 self.xid = xid
7545 else:
7546 self.xid = None
7547 if flags != None:
7548 self.flags = flags
7549 else:
7550 self.flags = 0
7551 return
7552
7553 def pack(self):
7554 packed = []
7555 packed.append(struct.pack("!B", self.version))
7556 packed.append(struct.pack("!B", self.type))
7557 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7558 packed.append(struct.pack("!L", self.xid))
7559 packed.append(struct.pack("!H", self.stats_type))
7560 packed.append(struct.pack("!H", self.flags))
7561 packed.append('\x00' * 4)
7562 packed.append(struct.pack("!L", self.experimenter))
7563 packed.append(struct.pack("!L", self.subtype))
7564 length = sum([len(x) for x in packed])
7565 packed[2] = struct.pack("!H", length)
7566 return ''.join(packed)
7567
7568 @staticmethod
7569 def unpack(reader):
7570 obj = bsn_table_checksum_stats_request()
7571 _version = reader.read("!B")[0]
7572 assert(_version == 4)
7573 _type = reader.read("!B")[0]
7574 assert(_type == 18)
7575 _length = reader.read("!H")[0]
7576 orig_reader = reader
7577 reader = orig_reader.slice(_length - (2 + 2))
7578 obj.xid = reader.read("!L")[0]
7579 _stats_type = reader.read("!H")[0]
7580 assert(_stats_type == 65535)
7581 obj.flags = reader.read("!H")[0]
7582 reader.skip(4)
7583 _experimenter = reader.read("!L")[0]
7584 assert(_experimenter == 6035143)
7585 _subtype = reader.read("!L")[0]
7586 assert(_subtype == 11)
7587 return obj
7588
7589 def __eq__(self, other):
7590 if type(self) != type(other): return False
7591 if self.xid != other.xid: return False
7592 if self.flags != other.flags: return False
7593 return True
7594
7595 def pretty_print(self, q):
7596 q.text("bsn_table_checksum_stats_request {")
7597 with q.group():
7598 with q.indent(2):
7599 q.breakable()
7600 q.text("xid = ");
7601 if self.xid != None:
7602 q.text("%#x" % self.xid)
7603 else:
7604 q.text('None')
7605 q.text(","); q.breakable()
7606 q.text("flags = ");
7607 q.text("%#x" % self.flags)
7608 q.breakable()
7609 q.text('}')
7610
7611bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
7612
7613class bsn_table_set_buckets_size(bsn_header):
7614 version = 4
7615 type = 4
7616 experimenter = 6035143
7617 subtype = 61
7618
7619 def __init__(self, xid=None, table_id=None, buckets_size=None):
7620 if xid != None:
7621 self.xid = xid
7622 else:
7623 self.xid = None
7624 if table_id != None:
7625 self.table_id = table_id
7626 else:
7627 self.table_id = 0
7628 if buckets_size != None:
7629 self.buckets_size = buckets_size
7630 else:
7631 self.buckets_size = 0
7632 return
7633
7634 def pack(self):
7635 packed = []
7636 packed.append(struct.pack("!B", self.version))
7637 packed.append(struct.pack("!B", self.type))
7638 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7639 packed.append(struct.pack("!L", self.xid))
7640 packed.append(struct.pack("!L", self.experimenter))
7641 packed.append(struct.pack("!L", self.subtype))
Rich Lane5587ab12014-06-30 11:19:09 -07007642 packed.append('\x00' * 1)
7643 packed.append(struct.pack("!B", self.table_id))
Rich Lane9ec3fca2014-02-26 16:22:56 -08007644 packed.append('\x00' * 2)
7645 packed.append(struct.pack("!L", self.buckets_size))
7646 length = sum([len(x) for x in packed])
7647 packed[2] = struct.pack("!H", length)
7648 return ''.join(packed)
7649
7650 @staticmethod
7651 def unpack(reader):
7652 obj = bsn_table_set_buckets_size()
7653 _version = reader.read("!B")[0]
7654 assert(_version == 4)
7655 _type = reader.read("!B")[0]
7656 assert(_type == 4)
7657 _length = reader.read("!H")[0]
7658 orig_reader = reader
7659 reader = orig_reader.slice(_length - (2 + 2))
7660 obj.xid = reader.read("!L")[0]
7661 _experimenter = reader.read("!L")[0]
7662 assert(_experimenter == 6035143)
7663 _subtype = reader.read("!L")[0]
7664 assert(_subtype == 61)
Rich Lane5587ab12014-06-30 11:19:09 -07007665 reader.skip(1)
7666 obj.table_id = reader.read("!B")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08007667 reader.skip(2)
7668 obj.buckets_size = reader.read("!L")[0]
7669 return obj
7670
7671 def __eq__(self, other):
7672 if type(self) != type(other): return False
7673 if self.xid != other.xid: return False
7674 if self.table_id != other.table_id: return False
7675 if self.buckets_size != other.buckets_size: return False
7676 return True
7677
7678 def pretty_print(self, q):
7679 q.text("bsn_table_set_buckets_size {")
7680 with q.group():
7681 with q.indent(2):
7682 q.breakable()
7683 q.text("xid = ");
7684 if self.xid != None:
7685 q.text("%#x" % self.xid)
7686 else:
7687 q.text('None')
7688 q.text(","); q.breakable()
7689 q.text("table_id = ");
7690 q.text("%#x" % self.table_id)
7691 q.text(","); q.breakable()
7692 q.text("buckets_size = ");
7693 q.text("%#x" % self.buckets_size)
7694 q.breakable()
7695 q.text('}')
7696
7697bsn_header.subtypes[61] = bsn_table_set_buckets_size
7698
Rich Lane7dcdf022013-12-11 14:45:27 -08007699class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007700 version = 4
7701 type = 4
7702 experimenter = 6035143
7703 subtype = 45
7704
7705 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007706 if xid != None:
7707 self.xid = xid
7708 else:
7709 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007710 if time_ms != None:
7711 self.time_ms = time_ms
7712 else:
7713 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007714 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007715
7716 def pack(self):
7717 packed = []
7718 packed.append(struct.pack("!B", self.version))
7719 packed.append(struct.pack("!B", self.type))
7720 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7721 packed.append(struct.pack("!L", self.xid))
7722 packed.append(struct.pack("!L", self.experimenter))
7723 packed.append(struct.pack("!L", self.subtype))
7724 packed.append(struct.pack("!Q", self.time_ms))
7725 length = sum([len(x) for x in packed])
7726 packed[2] = struct.pack("!H", length)
7727 return ''.join(packed)
7728
7729 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007730 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007731 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007732 _version = reader.read("!B")[0]
7733 assert(_version == 4)
7734 _type = reader.read("!B")[0]
7735 assert(_type == 4)
7736 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007737 orig_reader = reader
7738 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007739 obj.xid = reader.read("!L")[0]
7740 _experimenter = reader.read("!L")[0]
7741 assert(_experimenter == 6035143)
7742 _subtype = reader.read("!L")[0]
7743 assert(_subtype == 45)
7744 obj.time_ms = reader.read("!Q")[0]
7745 return obj
7746
7747 def __eq__(self, other):
7748 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007749 if self.xid != other.xid: return False
7750 if self.time_ms != other.time_ms: return False
7751 return True
7752
Rich Lane7b0f2012013-11-22 14:15:26 -08007753 def pretty_print(self, q):
7754 q.text("bsn_time_reply {")
7755 with q.group():
7756 with q.indent(2):
7757 q.breakable()
7758 q.text("xid = ");
7759 if self.xid != None:
7760 q.text("%#x" % self.xid)
7761 else:
7762 q.text('None')
7763 q.text(","); q.breakable()
7764 q.text("time_ms = ");
7765 q.text("%#x" % self.time_ms)
7766 q.breakable()
7767 q.text('}')
7768
Rich Lane7dcdf022013-12-11 14:45:27 -08007769bsn_header.subtypes[45] = bsn_time_reply
7770
7771class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007772 version = 4
7773 type = 4
7774 experimenter = 6035143
7775 subtype = 44
7776
7777 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007778 if xid != None:
7779 self.xid = xid
7780 else:
7781 self.xid = None
7782 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007783
7784 def pack(self):
7785 packed = []
7786 packed.append(struct.pack("!B", self.version))
7787 packed.append(struct.pack("!B", self.type))
7788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7789 packed.append(struct.pack("!L", self.xid))
7790 packed.append(struct.pack("!L", self.experimenter))
7791 packed.append(struct.pack("!L", self.subtype))
7792 length = sum([len(x) for x in packed])
7793 packed[2] = struct.pack("!H", length)
7794 return ''.join(packed)
7795
7796 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007797 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007798 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007799 _version = reader.read("!B")[0]
7800 assert(_version == 4)
7801 _type = reader.read("!B")[0]
7802 assert(_type == 4)
7803 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007804 orig_reader = reader
7805 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007806 obj.xid = reader.read("!L")[0]
7807 _experimenter = reader.read("!L")[0]
7808 assert(_experimenter == 6035143)
7809 _subtype = reader.read("!L")[0]
7810 assert(_subtype == 44)
7811 return obj
7812
7813 def __eq__(self, other):
7814 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007815 if self.xid != other.xid: return False
7816 return True
7817
Rich Lane7b0f2012013-11-22 14:15:26 -08007818 def pretty_print(self, q):
7819 q.text("bsn_time_request {")
7820 with q.group():
7821 with q.indent(2):
7822 q.breakable()
7823 q.text("xid = ");
7824 if self.xid != None:
7825 q.text("%#x" % self.xid)
7826 else:
7827 q.text('None')
7828 q.breakable()
7829 q.text('}')
7830
Rich Lane7dcdf022013-12-11 14:45:27 -08007831bsn_header.subtypes[44] = bsn_time_request
7832
7833class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007834 version = 4
7835 type = 4
7836 experimenter = 6035143
7837 subtype = 16
7838
7839 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007840 if xid != None:
7841 self.xid = xid
7842 else:
7843 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007844 if status != None:
7845 self.status = status
7846 else:
7847 self.status = 0
7848 if vport_no != None:
7849 self.vport_no = vport_no
7850 else:
7851 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007852 return
Dan Talaycof6202252013-07-02 01:00:29 -07007853
7854 def pack(self):
7855 packed = []
7856 packed.append(struct.pack("!B", self.version))
7857 packed.append(struct.pack("!B", self.type))
7858 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7859 packed.append(struct.pack("!L", self.xid))
7860 packed.append(struct.pack("!L", self.experimenter))
7861 packed.append(struct.pack("!L", self.subtype))
7862 packed.append(struct.pack("!L", self.status))
7863 packed.append(struct.pack("!L", self.vport_no))
7864 length = sum([len(x) for x in packed])
7865 packed[2] = struct.pack("!H", length)
7866 return ''.join(packed)
7867
7868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007869 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007870 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007871 _version = reader.read("!B")[0]
7872 assert(_version == 4)
7873 _type = reader.read("!B")[0]
7874 assert(_type == 4)
7875 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007876 orig_reader = reader
7877 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007878 obj.xid = reader.read("!L")[0]
7879 _experimenter = reader.read("!L")[0]
7880 assert(_experimenter == 6035143)
7881 _subtype = reader.read("!L")[0]
7882 assert(_subtype == 16)
7883 obj.status = reader.read("!L")[0]
7884 obj.vport_no = reader.read("!L")[0]
7885 return obj
7886
7887 def __eq__(self, other):
7888 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007889 if self.xid != other.xid: return False
7890 if self.status != other.status: return False
7891 if self.vport_no != other.vport_no: return False
7892 return True
7893
Dan Talaycof6202252013-07-02 01:00:29 -07007894 def pretty_print(self, q):
7895 q.text("bsn_virtual_port_create_reply {")
7896 with q.group():
7897 with q.indent(2):
7898 q.breakable()
7899 q.text("xid = ");
7900 if self.xid != None:
7901 q.text("%#x" % self.xid)
7902 else:
7903 q.text('None')
7904 q.text(","); q.breakable()
7905 q.text("status = ");
7906 q.text("%#x" % self.status)
7907 q.text(","); q.breakable()
7908 q.text("vport_no = ");
7909 q.text("%#x" % self.vport_no)
7910 q.breakable()
7911 q.text('}')
7912
Rich Lane7dcdf022013-12-11 14:45:27 -08007913bsn_header.subtypes[16] = bsn_virtual_port_create_reply
7914
7915class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007916 version = 4
7917 type = 4
7918 experimenter = 6035143
7919 subtype = 15
7920
7921 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007922 if xid != None:
7923 self.xid = xid
7924 else:
7925 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007926 if vport != None:
7927 self.vport = vport
7928 else:
Rich Lane93b33132014-04-21 12:20:58 -07007929 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08007930 return
Dan Talaycof6202252013-07-02 01:00:29 -07007931
7932 def pack(self):
7933 packed = []
7934 packed.append(struct.pack("!B", self.version))
7935 packed.append(struct.pack("!B", self.type))
7936 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7937 packed.append(struct.pack("!L", self.xid))
7938 packed.append(struct.pack("!L", self.experimenter))
7939 packed.append(struct.pack("!L", self.subtype))
7940 packed.append(self.vport.pack())
7941 length = sum([len(x) for x in packed])
7942 packed[2] = struct.pack("!H", length)
7943 return ''.join(packed)
7944
7945 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007946 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007947 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007948 _version = reader.read("!B")[0]
7949 assert(_version == 4)
7950 _type = reader.read("!B")[0]
7951 assert(_type == 4)
7952 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007953 orig_reader = reader
7954 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007955 obj.xid = reader.read("!L")[0]
7956 _experimenter = reader.read("!L")[0]
7957 assert(_experimenter == 6035143)
7958 _subtype = reader.read("!L")[0]
7959 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07007960 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07007961 return obj
7962
7963 def __eq__(self, other):
7964 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007965 if self.xid != other.xid: return False
7966 if self.vport != other.vport: return False
7967 return True
7968
Dan Talaycof6202252013-07-02 01:00:29 -07007969 def pretty_print(self, q):
7970 q.text("bsn_virtual_port_create_request {")
7971 with q.group():
7972 with q.indent(2):
7973 q.breakable()
7974 q.text("xid = ");
7975 if self.xid != None:
7976 q.text("%#x" % self.xid)
7977 else:
7978 q.text('None')
7979 q.text(","); q.breakable()
7980 q.text("vport = ");
7981 q.pp(self.vport)
7982 q.breakable()
7983 q.text('}')
7984
Rich Lane7dcdf022013-12-11 14:45:27 -08007985bsn_header.subtypes[15] = bsn_virtual_port_create_request
7986
7987class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007988 version = 4
7989 type = 4
7990 experimenter = 6035143
7991 subtype = 26
7992
7993 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007994 if xid != None:
7995 self.xid = xid
7996 else:
7997 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007998 if status != None:
7999 self.status = status
8000 else:
8001 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008002 return
Dan Talaycof6202252013-07-02 01:00:29 -07008003
8004 def pack(self):
8005 packed = []
8006 packed.append(struct.pack("!B", self.version))
8007 packed.append(struct.pack("!B", self.type))
8008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8009 packed.append(struct.pack("!L", self.xid))
8010 packed.append(struct.pack("!L", self.experimenter))
8011 packed.append(struct.pack("!L", self.subtype))
8012 packed.append(struct.pack("!L", self.status))
8013 length = sum([len(x) for x in packed])
8014 packed[2] = struct.pack("!H", length)
8015 return ''.join(packed)
8016
8017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008018 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008019 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008020 _version = reader.read("!B")[0]
8021 assert(_version == 4)
8022 _type = reader.read("!B")[0]
8023 assert(_type == 4)
8024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008025 orig_reader = reader
8026 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008027 obj.xid = reader.read("!L")[0]
8028 _experimenter = reader.read("!L")[0]
8029 assert(_experimenter == 6035143)
8030 _subtype = reader.read("!L")[0]
8031 assert(_subtype == 26)
8032 obj.status = reader.read("!L")[0]
8033 return obj
8034
8035 def __eq__(self, other):
8036 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008037 if self.xid != other.xid: return False
8038 if self.status != other.status: return False
8039 return True
8040
Dan Talaycof6202252013-07-02 01:00:29 -07008041 def pretty_print(self, q):
8042 q.text("bsn_virtual_port_remove_reply {")
8043 with q.group():
8044 with q.indent(2):
8045 q.breakable()
8046 q.text("xid = ");
8047 if self.xid != None:
8048 q.text("%#x" % self.xid)
8049 else:
8050 q.text('None')
8051 q.text(","); q.breakable()
8052 q.text("status = ");
8053 q.text("%#x" % self.status)
8054 q.breakable()
8055 q.text('}')
8056
Rich Lane7dcdf022013-12-11 14:45:27 -08008057bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8058
8059class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008060 version = 4
8061 type = 4
8062 experimenter = 6035143
8063 subtype = 17
8064
8065 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008066 if xid != None:
8067 self.xid = xid
8068 else:
8069 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008070 if vport_no != None:
8071 self.vport_no = vport_no
8072 else:
8073 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008074 return
Dan Talaycof6202252013-07-02 01:00:29 -07008075
8076 def pack(self):
8077 packed = []
8078 packed.append(struct.pack("!B", self.version))
8079 packed.append(struct.pack("!B", self.type))
8080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8081 packed.append(struct.pack("!L", self.xid))
8082 packed.append(struct.pack("!L", self.experimenter))
8083 packed.append(struct.pack("!L", self.subtype))
8084 packed.append(struct.pack("!L", self.vport_no))
8085 length = sum([len(x) for x in packed])
8086 packed[2] = struct.pack("!H", length)
8087 return ''.join(packed)
8088
8089 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008090 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008091 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008092 _version = reader.read("!B")[0]
8093 assert(_version == 4)
8094 _type = reader.read("!B")[0]
8095 assert(_type == 4)
8096 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008097 orig_reader = reader
8098 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008099 obj.xid = reader.read("!L")[0]
8100 _experimenter = reader.read("!L")[0]
8101 assert(_experimenter == 6035143)
8102 _subtype = reader.read("!L")[0]
8103 assert(_subtype == 17)
8104 obj.vport_no = reader.read("!L")[0]
8105 return obj
8106
8107 def __eq__(self, other):
8108 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008109 if self.xid != other.xid: return False
8110 if self.vport_no != other.vport_no: return False
8111 return True
8112
Dan Talaycof6202252013-07-02 01:00:29 -07008113 def pretty_print(self, q):
8114 q.text("bsn_virtual_port_remove_request {")
8115 with q.group():
8116 with q.indent(2):
8117 q.breakable()
8118 q.text("xid = ");
8119 if self.xid != None:
8120 q.text("%#x" % self.xid)
8121 else:
8122 q.text('None')
8123 q.text(","); q.breakable()
8124 q.text("vport_no = ");
8125 q.text("%#x" % self.vport_no)
8126 q.breakable()
8127 q.text('}')
8128
Rich Lane7dcdf022013-12-11 14:45:27 -08008129bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8130
8131class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8132 version = 4
8133 type = 19
8134 stats_type = 65535
8135 experimenter = 6035143
8136 subtype = 9
8137
8138 def __init__(self, xid=None, flags=None, entries=None):
8139 if xid != None:
8140 self.xid = xid
8141 else:
8142 self.xid = None
8143 if flags != None:
8144 self.flags = flags
8145 else:
8146 self.flags = 0
8147 if entries != None:
8148 self.entries = entries
8149 else:
8150 self.entries = []
8151 return
8152
8153 def pack(self):
8154 packed = []
8155 packed.append(struct.pack("!B", self.version))
8156 packed.append(struct.pack("!B", self.type))
8157 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8158 packed.append(struct.pack("!L", self.xid))
8159 packed.append(struct.pack("!H", self.stats_type))
8160 packed.append(struct.pack("!H", self.flags))
8161 packed.append('\x00' * 4)
8162 packed.append(struct.pack("!L", self.experimenter))
8163 packed.append(struct.pack("!L", self.subtype))
8164 packed.append(loxi.generic_util.pack_list(self.entries))
8165 length = sum([len(x) for x in packed])
8166 packed[2] = struct.pack("!H", length)
8167 return ''.join(packed)
8168
8169 @staticmethod
8170 def unpack(reader):
8171 obj = bsn_vlan_counter_stats_reply()
8172 _version = reader.read("!B")[0]
8173 assert(_version == 4)
8174 _type = reader.read("!B")[0]
8175 assert(_type == 19)
8176 _length = reader.read("!H")[0]
8177 orig_reader = reader
8178 reader = orig_reader.slice(_length - (2 + 2))
8179 obj.xid = reader.read("!L")[0]
8180 _stats_type = reader.read("!H")[0]
8181 assert(_stats_type == 65535)
8182 obj.flags = reader.read("!H")[0]
8183 reader.skip(4)
8184 _experimenter = reader.read("!L")[0]
8185 assert(_experimenter == 6035143)
8186 _subtype = reader.read("!L")[0]
8187 assert(_subtype == 9)
8188 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8189 return obj
8190
8191 def __eq__(self, other):
8192 if type(self) != type(other): return False
8193 if self.xid != other.xid: return False
8194 if self.flags != other.flags: return False
8195 if self.entries != other.entries: return False
8196 return True
8197
8198 def pretty_print(self, q):
8199 q.text("bsn_vlan_counter_stats_reply {")
8200 with q.group():
8201 with q.indent(2):
8202 q.breakable()
8203 q.text("xid = ");
8204 if self.xid != None:
8205 q.text("%#x" % self.xid)
8206 else:
8207 q.text('None')
8208 q.text(","); q.breakable()
8209 q.text("flags = ");
8210 q.text("%#x" % self.flags)
8211 q.text(","); q.breakable()
8212 q.text("entries = ");
8213 q.pp(self.entries)
8214 q.breakable()
8215 q.text('}')
8216
8217bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8218
8219class bsn_vlan_counter_stats_request(bsn_stats_request):
8220 version = 4
8221 type = 18
8222 stats_type = 65535
8223 experimenter = 6035143
8224 subtype = 9
8225
8226 def __init__(self, xid=None, flags=None, vlan_vid=None):
8227 if xid != None:
8228 self.xid = xid
8229 else:
8230 self.xid = None
8231 if flags != None:
8232 self.flags = flags
8233 else:
8234 self.flags = 0
8235 if vlan_vid != None:
8236 self.vlan_vid = vlan_vid
8237 else:
8238 self.vlan_vid = 0
8239 return
8240
8241 def pack(self):
8242 packed = []
8243 packed.append(struct.pack("!B", self.version))
8244 packed.append(struct.pack("!B", self.type))
8245 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8246 packed.append(struct.pack("!L", self.xid))
8247 packed.append(struct.pack("!H", self.stats_type))
8248 packed.append(struct.pack("!H", self.flags))
8249 packed.append('\x00' * 4)
8250 packed.append(struct.pack("!L", self.experimenter))
8251 packed.append(struct.pack("!L", self.subtype))
8252 packed.append(struct.pack("!H", self.vlan_vid))
8253 length = sum([len(x) for x in packed])
8254 packed[2] = struct.pack("!H", length)
8255 return ''.join(packed)
8256
8257 @staticmethod
8258 def unpack(reader):
8259 obj = bsn_vlan_counter_stats_request()
8260 _version = reader.read("!B")[0]
8261 assert(_version == 4)
8262 _type = reader.read("!B")[0]
8263 assert(_type == 18)
8264 _length = reader.read("!H")[0]
8265 orig_reader = reader
8266 reader = orig_reader.slice(_length - (2 + 2))
8267 obj.xid = reader.read("!L")[0]
8268 _stats_type = reader.read("!H")[0]
8269 assert(_stats_type == 65535)
8270 obj.flags = reader.read("!H")[0]
8271 reader.skip(4)
8272 _experimenter = reader.read("!L")[0]
8273 assert(_experimenter == 6035143)
8274 _subtype = reader.read("!L")[0]
8275 assert(_subtype == 9)
8276 obj.vlan_vid = reader.read("!H")[0]
8277 return obj
8278
8279 def __eq__(self, other):
8280 if type(self) != type(other): return False
8281 if self.xid != other.xid: return False
8282 if self.flags != other.flags: return False
8283 if self.vlan_vid != other.vlan_vid: return False
8284 return True
8285
8286 def pretty_print(self, q):
8287 q.text("bsn_vlan_counter_stats_request {")
8288 with q.group():
8289 with q.indent(2):
8290 q.breakable()
8291 q.text("xid = ");
8292 if self.xid != None:
8293 q.text("%#x" % self.xid)
8294 else:
8295 q.text('None')
8296 q.text(","); q.breakable()
8297 q.text("flags = ");
8298 q.text("%#x" % self.flags)
8299 q.text(","); q.breakable()
8300 q.text("vlan_vid = ");
8301 q.text("%#x" % self.vlan_vid)
8302 q.breakable()
8303 q.text('}')
8304
8305bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8306
Rich Lane5587ab12014-06-30 11:19:09 -07008307class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8308 version = 4
8309 type = 19
8310 stats_type = 65535
8311 experimenter = 6035143
8312 subtype = 15
8313
8314 def __init__(self, xid=None, flags=None, entries=None):
8315 if xid != None:
8316 self.xid = xid
8317 else:
8318 self.xid = None
8319 if flags != None:
8320 self.flags = flags
8321 else:
8322 self.flags = 0
8323 if entries != None:
8324 self.entries = entries
8325 else:
8326 self.entries = []
8327 return
8328
8329 def pack(self):
8330 packed = []
8331 packed.append(struct.pack("!B", self.version))
8332 packed.append(struct.pack("!B", self.type))
8333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8334 packed.append(struct.pack("!L", self.xid))
8335 packed.append(struct.pack("!H", self.stats_type))
8336 packed.append(struct.pack("!H", self.flags))
8337 packed.append('\x00' * 4)
8338 packed.append(struct.pack("!L", self.experimenter))
8339 packed.append(struct.pack("!L", self.subtype))
8340 packed.append(loxi.generic_util.pack_list(self.entries))
8341 length = sum([len(x) for x in packed])
8342 packed[2] = struct.pack("!H", length)
8343 return ''.join(packed)
8344
8345 @staticmethod
8346 def unpack(reader):
8347 obj = bsn_vrf_counter_stats_reply()
8348 _version = reader.read("!B")[0]
8349 assert(_version == 4)
8350 _type = reader.read("!B")[0]
8351 assert(_type == 19)
8352 _length = reader.read("!H")[0]
8353 orig_reader = reader
8354 reader = orig_reader.slice(_length - (2 + 2))
8355 obj.xid = reader.read("!L")[0]
8356 _stats_type = reader.read("!H")[0]
8357 assert(_stats_type == 65535)
8358 obj.flags = reader.read("!H")[0]
8359 reader.skip(4)
8360 _experimenter = reader.read("!L")[0]
8361 assert(_experimenter == 6035143)
8362 _subtype = reader.read("!L")[0]
8363 assert(_subtype == 15)
8364 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8365 return obj
8366
8367 def __eq__(self, other):
8368 if type(self) != type(other): return False
8369 if self.xid != other.xid: return False
8370 if self.flags != other.flags: return False
8371 if self.entries != other.entries: return False
8372 return True
8373
8374 def pretty_print(self, q):
8375 q.text("bsn_vrf_counter_stats_reply {")
8376 with q.group():
8377 with q.indent(2):
8378 q.breakable()
8379 q.text("xid = ");
8380 if self.xid != None:
8381 q.text("%#x" % self.xid)
8382 else:
8383 q.text('None')
8384 q.text(","); q.breakable()
8385 q.text("flags = ");
8386 q.text("%#x" % self.flags)
8387 q.text(","); q.breakable()
8388 q.text("entries = ");
8389 q.pp(self.entries)
8390 q.breakable()
8391 q.text('}')
8392
8393bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8394
8395class bsn_vrf_counter_stats_request(bsn_stats_request):
8396 version = 4
8397 type = 18
8398 stats_type = 65535
8399 experimenter = 6035143
8400 subtype = 15
8401
8402 def __init__(self, xid=None, flags=None, vrf=None):
8403 if xid != None:
8404 self.xid = xid
8405 else:
8406 self.xid = None
8407 if flags != None:
8408 self.flags = flags
8409 else:
8410 self.flags = 0
8411 if vrf != None:
8412 self.vrf = vrf
8413 else:
8414 self.vrf = 0
8415 return
8416
8417 def pack(self):
8418 packed = []
8419 packed.append(struct.pack("!B", self.version))
8420 packed.append(struct.pack("!B", self.type))
8421 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8422 packed.append(struct.pack("!L", self.xid))
8423 packed.append(struct.pack("!H", self.stats_type))
8424 packed.append(struct.pack("!H", self.flags))
8425 packed.append('\x00' * 4)
8426 packed.append(struct.pack("!L", self.experimenter))
8427 packed.append(struct.pack("!L", self.subtype))
8428 packed.append(struct.pack("!L", self.vrf))
8429 length = sum([len(x) for x in packed])
8430 packed[2] = struct.pack("!H", length)
8431 return ''.join(packed)
8432
8433 @staticmethod
8434 def unpack(reader):
8435 obj = bsn_vrf_counter_stats_request()
8436 _version = reader.read("!B")[0]
8437 assert(_version == 4)
8438 _type = reader.read("!B")[0]
8439 assert(_type == 18)
8440 _length = reader.read("!H")[0]
8441 orig_reader = reader
8442 reader = orig_reader.slice(_length - (2 + 2))
8443 obj.xid = reader.read("!L")[0]
8444 _stats_type = reader.read("!H")[0]
8445 assert(_stats_type == 65535)
8446 obj.flags = reader.read("!H")[0]
8447 reader.skip(4)
8448 _experimenter = reader.read("!L")[0]
8449 assert(_experimenter == 6035143)
8450 _subtype = reader.read("!L")[0]
8451 assert(_subtype == 15)
8452 obj.vrf = reader.read("!L")[0]
8453 return obj
8454
8455 def __eq__(self, other):
8456 if type(self) != type(other): return False
8457 if self.xid != other.xid: return False
8458 if self.flags != other.flags: return False
8459 if self.vrf != other.vrf: return False
8460 return True
8461
8462 def pretty_print(self, q):
8463 q.text("bsn_vrf_counter_stats_request {")
8464 with q.group():
8465 with q.indent(2):
8466 q.breakable()
8467 q.text("xid = ");
8468 if self.xid != None:
8469 q.text("%#x" % self.xid)
8470 else:
8471 q.text('None')
8472 q.text(","); q.breakable()
8473 q.text("flags = ");
8474 q.text("%#x" % self.flags)
8475 q.text(","); q.breakable()
8476 q.text("vrf = ");
8477 q.text("%#x" % self.vrf)
8478 q.breakable()
8479 q.text('}')
8480
8481bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8482
Rich Lane7dcdf022013-12-11 14:45:27 -08008483class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008484 version = 4
8485 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008486 stats_type = 0
8487
8488 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 -08008489 if xid != None:
8490 self.xid = xid
8491 else:
8492 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008493 if flags != None:
8494 self.flags = flags
8495 else:
8496 self.flags = 0
8497 if mfr_desc != None:
8498 self.mfr_desc = mfr_desc
8499 else:
8500 self.mfr_desc = ""
8501 if hw_desc != None:
8502 self.hw_desc = hw_desc
8503 else:
8504 self.hw_desc = ""
8505 if sw_desc != None:
8506 self.sw_desc = sw_desc
8507 else:
8508 self.sw_desc = ""
8509 if serial_num != None:
8510 self.serial_num = serial_num
8511 else:
8512 self.serial_num = ""
8513 if dp_desc != None:
8514 self.dp_desc = dp_desc
8515 else:
8516 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08008517 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008518
8519 def pack(self):
8520 packed = []
8521 packed.append(struct.pack("!B", self.version))
8522 packed.append(struct.pack("!B", self.type))
8523 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8524 packed.append(struct.pack("!L", self.xid))
8525 packed.append(struct.pack("!H", self.stats_type))
8526 packed.append(struct.pack("!H", self.flags))
8527 packed.append('\x00' * 4)
8528 packed.append(struct.pack("!256s", self.mfr_desc))
8529 packed.append(struct.pack("!256s", self.hw_desc))
8530 packed.append(struct.pack("!256s", self.sw_desc))
8531 packed.append(struct.pack("!32s", self.serial_num))
8532 packed.append(struct.pack("!256s", self.dp_desc))
8533 length = sum([len(x) for x in packed])
8534 packed[2] = struct.pack("!H", length)
8535 return ''.join(packed)
8536
8537 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008538 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008539 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008540 _version = reader.read("!B")[0]
8541 assert(_version == 4)
8542 _type = reader.read("!B")[0]
8543 assert(_type == 19)
8544 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008545 orig_reader = reader
8546 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008547 obj.xid = reader.read("!L")[0]
8548 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008549 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07008550 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008551 reader.skip(4)
8552 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
8553 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
8554 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
8555 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
8556 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
8557 return obj
8558
8559 def __eq__(self, other):
8560 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008561 if self.xid != other.xid: return False
8562 if self.flags != other.flags: return False
8563 if self.mfr_desc != other.mfr_desc: return False
8564 if self.hw_desc != other.hw_desc: return False
8565 if self.sw_desc != other.sw_desc: return False
8566 if self.serial_num != other.serial_num: return False
8567 if self.dp_desc != other.dp_desc: return False
8568 return True
8569
Rich Lanec2ee4b82013-04-24 17:12:38 -07008570 def pretty_print(self, q):
8571 q.text("desc_stats_reply {")
8572 with q.group():
8573 with q.indent(2):
8574 q.breakable()
8575 q.text("xid = ");
8576 if self.xid != None:
8577 q.text("%#x" % self.xid)
8578 else:
8579 q.text('None')
8580 q.text(","); q.breakable()
8581 q.text("flags = ");
8582 q.text("%#x" % self.flags)
8583 q.text(","); q.breakable()
8584 q.text("mfr_desc = ");
8585 q.pp(self.mfr_desc)
8586 q.text(","); q.breakable()
8587 q.text("hw_desc = ");
8588 q.pp(self.hw_desc)
8589 q.text(","); q.breakable()
8590 q.text("sw_desc = ");
8591 q.pp(self.sw_desc)
8592 q.text(","); q.breakable()
8593 q.text("serial_num = ");
8594 q.pp(self.serial_num)
8595 q.text(","); q.breakable()
8596 q.text("dp_desc = ");
8597 q.pp(self.dp_desc)
8598 q.breakable()
8599 q.text('}')
8600
Rich Lane7dcdf022013-12-11 14:45:27 -08008601stats_reply.subtypes[0] = desc_stats_reply
8602
8603class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07008604 version = 4
8605 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07008606 stats_type = 0
8607
8608 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008609 if xid != None:
8610 self.xid = xid
8611 else:
8612 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008613 if flags != None:
8614 self.flags = flags
8615 else:
8616 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008617 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008618
8619 def pack(self):
8620 packed = []
8621 packed.append(struct.pack("!B", self.version))
8622 packed.append(struct.pack("!B", self.type))
8623 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8624 packed.append(struct.pack("!L", self.xid))
8625 packed.append(struct.pack("!H", self.stats_type))
8626 packed.append(struct.pack("!H", self.flags))
8627 packed.append('\x00' * 4)
8628 length = sum([len(x) for x in packed])
8629 packed[2] = struct.pack("!H", length)
8630 return ''.join(packed)
8631
8632 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008633 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008634 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008635 _version = reader.read("!B")[0]
8636 assert(_version == 4)
8637 _type = reader.read("!B")[0]
8638 assert(_type == 18)
8639 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008640 orig_reader = reader
8641 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008642 obj.xid = reader.read("!L")[0]
8643 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008644 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07008645 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008646 reader.skip(4)
8647 return obj
8648
8649 def __eq__(self, other):
8650 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008651 if self.xid != other.xid: return False
8652 if self.flags != other.flags: return False
8653 return True
8654
Rich Lanec2ee4b82013-04-24 17:12:38 -07008655 def pretty_print(self, q):
8656 q.text("desc_stats_request {")
8657 with q.group():
8658 with q.indent(2):
8659 q.breakable()
8660 q.text("xid = ");
8661 if self.xid != None:
8662 q.text("%#x" % self.xid)
8663 else:
8664 q.text('None')
8665 q.text(","); q.breakable()
8666 q.text("flags = ");
8667 q.text("%#x" % self.flags)
8668 q.breakable()
8669 q.text('}')
8670
Rich Lane7dcdf022013-12-11 14:45:27 -08008671stats_request.subtypes[0] = desc_stats_request
8672
8673class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008674 version = 4
8675 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07008676
8677 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008678 if xid != None:
8679 self.xid = xid
8680 else:
8681 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008682 if data != None:
8683 self.data = data
8684 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008685 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008686 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008687
8688 def pack(self):
8689 packed = []
8690 packed.append(struct.pack("!B", self.version))
8691 packed.append(struct.pack("!B", self.type))
8692 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8693 packed.append(struct.pack("!L", self.xid))
8694 packed.append(self.data)
8695 length = sum([len(x) for x in packed])
8696 packed[2] = struct.pack("!H", length)
8697 return ''.join(packed)
8698
8699 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008700 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008701 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008702 _version = reader.read("!B")[0]
8703 assert(_version == 4)
8704 _type = reader.read("!B")[0]
8705 assert(_type == 3)
8706 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008707 orig_reader = reader
8708 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008709 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008710 obj.data = str(reader.read_all())
8711 return obj
8712
8713 def __eq__(self, other):
8714 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008715 if self.xid != other.xid: return False
8716 if self.data != other.data: return False
8717 return True
8718
Rich Lanec2ee4b82013-04-24 17:12:38 -07008719 def pretty_print(self, q):
8720 q.text("echo_reply {")
8721 with q.group():
8722 with q.indent(2):
8723 q.breakable()
8724 q.text("xid = ");
8725 if self.xid != None:
8726 q.text("%#x" % self.xid)
8727 else:
8728 q.text('None')
8729 q.text(","); q.breakable()
8730 q.text("data = ");
8731 q.pp(self.data)
8732 q.breakable()
8733 q.text('}')
8734
Rich Lane7dcdf022013-12-11 14:45:27 -08008735message.subtypes[3] = echo_reply
8736
8737class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008738 version = 4
8739 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07008740
8741 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008742 if xid != None:
8743 self.xid = xid
8744 else:
8745 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008746 if data != None:
8747 self.data = data
8748 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008749 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008750 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008751
8752 def pack(self):
8753 packed = []
8754 packed.append(struct.pack("!B", self.version))
8755 packed.append(struct.pack("!B", self.type))
8756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8757 packed.append(struct.pack("!L", self.xid))
8758 packed.append(self.data)
8759 length = sum([len(x) for x in packed])
8760 packed[2] = struct.pack("!H", length)
8761 return ''.join(packed)
8762
8763 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008764 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008765 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008766 _version = reader.read("!B")[0]
8767 assert(_version == 4)
8768 _type = reader.read("!B")[0]
8769 assert(_type == 2)
8770 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008771 orig_reader = reader
8772 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008773 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008774 obj.data = str(reader.read_all())
8775 return obj
8776
8777 def __eq__(self, other):
8778 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008779 if self.xid != other.xid: return False
8780 if self.data != other.data: return False
8781 return True
8782
Rich Lanec2ee4b82013-04-24 17:12:38 -07008783 def pretty_print(self, q):
8784 q.text("echo_request {")
8785 with q.group():
8786 with q.indent(2):
8787 q.breakable()
8788 q.text("xid = ");
8789 if self.xid != None:
8790 q.text("%#x" % self.xid)
8791 else:
8792 q.text('None')
8793 q.text(","); q.breakable()
8794 q.text("data = ");
8795 q.pp(self.data)
8796 q.breakable()
8797 q.text('}')
8798
Rich Lane7dcdf022013-12-11 14:45:27 -08008799message.subtypes[2] = echo_request
8800
8801class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07008802 version = 4
8803 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07008804 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07008805
Rich Lane6f4978c2013-10-20 21:33:52 -07008806 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008807 if xid != None:
8808 self.xid = xid
8809 else:
8810 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008811 if subtype != None:
8812 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07008813 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07008814 self.subtype = 0
8815 if experimenter != None:
8816 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07008817 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07008818 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07008819 if data != None:
8820 self.data = data
8821 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008822 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008823 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008824
8825 def pack(self):
8826 packed = []
8827 packed.append(struct.pack("!B", self.version))
8828 packed.append(struct.pack("!B", self.type))
8829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8830 packed.append(struct.pack("!L", self.xid))
8831 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07008832 packed.append(struct.pack("!H", self.subtype))
8833 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008834 packed.append(self.data)
8835 length = sum([len(x) for x in packed])
8836 packed[2] = struct.pack("!H", length)
8837 return ''.join(packed)
8838
8839 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008840 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07008841 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07008842 _version = reader.read("!B")[0]
8843 assert(_version == 4)
8844 _type = reader.read("!B")[0]
8845 assert(_type == 1)
8846 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008847 orig_reader = reader
8848 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008849 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07008850 _err_type = reader.read("!H")[0]
8851 assert(_err_type == 65535)
8852 obj.subtype = reader.read("!H")[0]
8853 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008854 obj.data = str(reader.read_all())
8855 return obj
8856
8857 def __eq__(self, other):
8858 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008859 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07008860 if self.subtype != other.subtype: return False
8861 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008862 if self.data != other.data: return False
8863 return True
8864
Rich Lanec2ee4b82013-04-24 17:12:38 -07008865 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07008866 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07008867 with q.group():
8868 with q.indent(2):
8869 q.breakable()
8870 q.text("xid = ");
8871 if self.xid != None:
8872 q.text("%#x" % self.xid)
8873 else:
8874 q.text('None')
8875 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07008876 q.text("subtype = ");
8877 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008878 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07008879 q.text("experimenter = ");
8880 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008881 q.text(","); q.breakable()
8882 q.text("data = ");
8883 q.pp(self.data)
8884 q.breakable()
8885 q.text('}')
8886
Rich Lane7dcdf022013-12-11 14:45:27 -08008887error_msg.subtypes[65535] = experimenter_error_msg
8888
8889class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008890 version = 4
8891 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07008892
8893 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 -08008894 if xid != None:
8895 self.xid = xid
8896 else:
8897 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008898 if datapath_id != None:
8899 self.datapath_id = datapath_id
8900 else:
8901 self.datapath_id = 0
8902 if n_buffers != None:
8903 self.n_buffers = n_buffers
8904 else:
8905 self.n_buffers = 0
8906 if n_tables != None:
8907 self.n_tables = n_tables
8908 else:
8909 self.n_tables = 0
8910 if auxiliary_id != None:
8911 self.auxiliary_id = auxiliary_id
8912 else:
8913 self.auxiliary_id = 0
8914 if capabilities != None:
8915 self.capabilities = capabilities
8916 else:
8917 self.capabilities = 0
8918 if reserved != None:
8919 self.reserved = reserved
8920 else:
8921 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008922 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008923
8924 def pack(self):
8925 packed = []
8926 packed.append(struct.pack("!B", self.version))
8927 packed.append(struct.pack("!B", self.type))
8928 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8929 packed.append(struct.pack("!L", self.xid))
8930 packed.append(struct.pack("!Q", self.datapath_id))
8931 packed.append(struct.pack("!L", self.n_buffers))
8932 packed.append(struct.pack("!B", self.n_tables))
8933 packed.append(struct.pack("!B", self.auxiliary_id))
8934 packed.append('\x00' * 2)
8935 packed.append(struct.pack("!L", self.capabilities))
8936 packed.append(struct.pack("!L", self.reserved))
8937 length = sum([len(x) for x in packed])
8938 packed[2] = struct.pack("!H", length)
8939 return ''.join(packed)
8940
8941 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008942 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008943 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008944 _version = reader.read("!B")[0]
8945 assert(_version == 4)
8946 _type = reader.read("!B")[0]
8947 assert(_type == 6)
8948 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008949 orig_reader = reader
8950 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008951 obj.xid = reader.read("!L")[0]
8952 obj.datapath_id = reader.read("!Q")[0]
8953 obj.n_buffers = reader.read("!L")[0]
8954 obj.n_tables = reader.read("!B")[0]
8955 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008956 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07008957 obj.capabilities = reader.read("!L")[0]
8958 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008959 return obj
8960
8961 def __eq__(self, other):
8962 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008963 if self.xid != other.xid: return False
8964 if self.datapath_id != other.datapath_id: return False
8965 if self.n_buffers != other.n_buffers: return False
8966 if self.n_tables != other.n_tables: return False
8967 if self.auxiliary_id != other.auxiliary_id: return False
8968 if self.capabilities != other.capabilities: return False
8969 if self.reserved != other.reserved: return False
8970 return True
8971
Rich Lanec2ee4b82013-04-24 17:12:38 -07008972 def pretty_print(self, q):
8973 q.text("features_reply {")
8974 with q.group():
8975 with q.indent(2):
8976 q.breakable()
8977 q.text("xid = ");
8978 if self.xid != None:
8979 q.text("%#x" % self.xid)
8980 else:
8981 q.text('None')
8982 q.text(","); q.breakable()
8983 q.text("datapath_id = ");
8984 q.text("%#x" % self.datapath_id)
8985 q.text(","); q.breakable()
8986 q.text("n_buffers = ");
8987 q.text("%#x" % self.n_buffers)
8988 q.text(","); q.breakable()
8989 q.text("n_tables = ");
8990 q.text("%#x" % self.n_tables)
8991 q.text(","); q.breakable()
8992 q.text("auxiliary_id = ");
8993 q.text("%#x" % self.auxiliary_id)
8994 q.text(","); q.breakable()
8995 q.text("capabilities = ");
8996 q.text("%#x" % self.capabilities)
8997 q.text(","); q.breakable()
8998 q.text("reserved = ");
8999 q.text("%#x" % self.reserved)
9000 q.breakable()
9001 q.text('}')
9002
Rich Lane7dcdf022013-12-11 14:45:27 -08009003message.subtypes[6] = features_reply
9004
9005class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009006 version = 4
9007 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07009008
9009 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009010 if xid != None:
9011 self.xid = xid
9012 else:
9013 self.xid = None
9014 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009015
9016 def pack(self):
9017 packed = []
9018 packed.append(struct.pack("!B", self.version))
9019 packed.append(struct.pack("!B", self.type))
9020 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9021 packed.append(struct.pack("!L", self.xid))
9022 length = sum([len(x) for x in packed])
9023 packed[2] = struct.pack("!H", length)
9024 return ''.join(packed)
9025
9026 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009027 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009028 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009029 _version = reader.read("!B")[0]
9030 assert(_version == 4)
9031 _type = reader.read("!B")[0]
9032 assert(_type == 5)
9033 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009034 orig_reader = reader
9035 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009036 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009037 return obj
9038
9039 def __eq__(self, other):
9040 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009041 if self.xid != other.xid: return False
9042 return True
9043
Rich Lanec2ee4b82013-04-24 17:12:38 -07009044 def pretty_print(self, q):
9045 q.text("features_request {")
9046 with q.group():
9047 with q.indent(2):
9048 q.breakable()
9049 q.text("xid = ");
9050 if self.xid != None:
9051 q.text("%#x" % self.xid)
9052 else:
9053 q.text('None')
9054 q.breakable()
9055 q.text('}')
9056
Rich Lane7dcdf022013-12-11 14:45:27 -08009057message.subtypes[5] = features_request
9058
9059class flow_mod(message):
9060 subtypes = {}
9061
Rich Lane95f7fc92014-01-27 17:08:16 -08009062 version = 4
9063 type = 14
9064
9065 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):
9066 if xid != None:
9067 self.xid = xid
9068 else:
9069 self.xid = None
9070 if cookie != None:
9071 self.cookie = cookie
9072 else:
9073 self.cookie = 0
9074 if cookie_mask != None:
9075 self.cookie_mask = cookie_mask
9076 else:
9077 self.cookie_mask = 0
9078 if table_id != None:
9079 self.table_id = table_id
9080 else:
9081 self.table_id = 0
9082 if _command != None:
9083 self._command = _command
9084 else:
9085 self._command = 0
9086 if idle_timeout != None:
9087 self.idle_timeout = idle_timeout
9088 else:
9089 self.idle_timeout = 0
9090 if hard_timeout != None:
9091 self.hard_timeout = hard_timeout
9092 else:
9093 self.hard_timeout = 0
9094 if priority != None:
9095 self.priority = priority
9096 else:
9097 self.priority = 0
9098 if buffer_id != None:
9099 self.buffer_id = buffer_id
9100 else:
9101 self.buffer_id = 0
9102 if out_port != None:
9103 self.out_port = out_port
9104 else:
9105 self.out_port = 0
9106 if out_group != None:
9107 self.out_group = out_group
9108 else:
9109 self.out_group = 0
9110 if flags != None:
9111 self.flags = flags
9112 else:
9113 self.flags = 0
9114 if match != None:
9115 self.match = match
9116 else:
9117 self.match = common.match()
9118 if instructions != None:
9119 self.instructions = instructions
9120 else:
9121 self.instructions = []
9122 return
9123
9124 def pack(self):
9125 packed = []
9126 packed.append(struct.pack("!B", self.version))
9127 packed.append(struct.pack("!B", self.type))
9128 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9129 packed.append(struct.pack("!L", self.xid))
9130 packed.append(struct.pack("!Q", self.cookie))
9131 packed.append(struct.pack("!Q", self.cookie_mask))
9132 packed.append(struct.pack("!B", self.table_id))
9133 packed.append(util.pack_fm_cmd(self._command))
9134 packed.append(struct.pack("!H", self.idle_timeout))
9135 packed.append(struct.pack("!H", self.hard_timeout))
9136 packed.append(struct.pack("!H", self.priority))
9137 packed.append(struct.pack("!L", self.buffer_id))
9138 packed.append(util.pack_port_no(self.out_port))
9139 packed.append(struct.pack("!L", self.out_group))
9140 packed.append(struct.pack("!H", self.flags))
9141 packed.append('\x00' * 2)
9142 packed.append(self.match.pack())
9143 packed.append(loxi.generic_util.pack_list(self.instructions))
9144 length = sum([len(x) for x in packed])
9145 packed[2] = struct.pack("!H", length)
9146 return ''.join(packed)
9147
Rich Lane7dcdf022013-12-11 14:45:27 -08009148 @staticmethod
9149 def unpack(reader):
9150 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08009151 subclass = flow_mod.subtypes.get(subtype)
9152 if subclass:
9153 return subclass.unpack(reader)
9154
9155 obj = flow_mod()
9156 _version = reader.read("!B")[0]
9157 assert(_version == 4)
9158 _type = reader.read("!B")[0]
9159 assert(_type == 14)
9160 _length = reader.read("!H")[0]
9161 orig_reader = reader
9162 reader = orig_reader.slice(_length - (2 + 2))
9163 obj.xid = reader.read("!L")[0]
9164 obj.cookie = reader.read("!Q")[0]
9165 obj.cookie_mask = reader.read("!Q")[0]
9166 obj.table_id = reader.read("!B")[0]
9167 obj._command = util.unpack_fm_cmd(reader)
9168 obj.idle_timeout = reader.read("!H")[0]
9169 obj.hard_timeout = reader.read("!H")[0]
9170 obj.priority = reader.read("!H")[0]
9171 obj.buffer_id = reader.read("!L")[0]
9172 obj.out_port = util.unpack_port_no(reader)
9173 obj.out_group = reader.read("!L")[0]
9174 obj.flags = reader.read("!H")[0]
9175 reader.skip(2)
9176 obj.match = common.match.unpack(reader)
9177 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9178 return obj
9179
9180 def __eq__(self, other):
9181 if type(self) != type(other): return False
9182 if self.xid != other.xid: return False
9183 if self.cookie != other.cookie: return False
9184 if self.cookie_mask != other.cookie_mask: return False
9185 if self.table_id != other.table_id: return False
9186 if self._command != other._command: return False
9187 if self.idle_timeout != other.idle_timeout: return False
9188 if self.hard_timeout != other.hard_timeout: return False
9189 if self.priority != other.priority: return False
9190 if self.buffer_id != other.buffer_id: return False
9191 if self.out_port != other.out_port: return False
9192 if self.out_group != other.out_group: return False
9193 if self.flags != other.flags: return False
9194 if self.match != other.match: return False
9195 if self.instructions != other.instructions: return False
9196 return True
9197
9198 def pretty_print(self, q):
9199 q.text("flow_mod {")
9200 with q.group():
9201 with q.indent(2):
9202 q.breakable()
9203 q.text("xid = ");
9204 if self.xid != None:
9205 q.text("%#x" % self.xid)
9206 else:
9207 q.text('None')
9208 q.text(","); q.breakable()
9209 q.text("cookie = ");
9210 q.text("%#x" % self.cookie)
9211 q.text(","); q.breakable()
9212 q.text("cookie_mask = ");
9213 q.text("%#x" % self.cookie_mask)
9214 q.text(","); q.breakable()
9215 q.text("table_id = ");
9216 q.text("%#x" % self.table_id)
9217 q.text(","); q.breakable()
9218 q.text("idle_timeout = ");
9219 q.text("%#x" % self.idle_timeout)
9220 q.text(","); q.breakable()
9221 q.text("hard_timeout = ");
9222 q.text("%#x" % self.hard_timeout)
9223 q.text(","); q.breakable()
9224 q.text("priority = ");
9225 q.text("%#x" % self.priority)
9226 q.text(","); q.breakable()
9227 q.text("buffer_id = ");
9228 q.text("%#x" % self.buffer_id)
9229 q.text(","); q.breakable()
9230 q.text("out_port = ");
9231 q.text(util.pretty_port(self.out_port))
9232 q.text(","); q.breakable()
9233 q.text("out_group = ");
9234 q.text("%#x" % self.out_group)
9235 q.text(","); q.breakable()
9236 q.text("flags = ");
9237 q.text("%#x" % self.flags)
9238 q.text(","); q.breakable()
9239 q.text("match = ");
9240 q.pp(self.match)
9241 q.text(","); q.breakable()
9242 q.text("instructions = ");
9243 q.pp(self.instructions)
9244 q.breakable()
9245 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009246
9247message.subtypes[14] = flow_mod
9248
9249class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009250 version = 4
9251 type = 14
9252 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009253
9254 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 -08009255 if xid != None:
9256 self.xid = xid
9257 else:
9258 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009259 if cookie != None:
9260 self.cookie = cookie
9261 else:
9262 self.cookie = 0
9263 if cookie_mask != None:
9264 self.cookie_mask = cookie_mask
9265 else:
9266 self.cookie_mask = 0
9267 if table_id != None:
9268 self.table_id = table_id
9269 else:
9270 self.table_id = 0
9271 if idle_timeout != None:
9272 self.idle_timeout = idle_timeout
9273 else:
9274 self.idle_timeout = 0
9275 if hard_timeout != None:
9276 self.hard_timeout = hard_timeout
9277 else:
9278 self.hard_timeout = 0
9279 if priority != None:
9280 self.priority = priority
9281 else:
9282 self.priority = 0
9283 if buffer_id != None:
9284 self.buffer_id = buffer_id
9285 else:
9286 self.buffer_id = 0
9287 if out_port != None:
9288 self.out_port = out_port
9289 else:
9290 self.out_port = 0
9291 if out_group != None:
9292 self.out_group = out_group
9293 else:
9294 self.out_group = 0
9295 if flags != None:
9296 self.flags = flags
9297 else:
9298 self.flags = 0
9299 if match != None:
9300 self.match = match
9301 else:
9302 self.match = common.match()
9303 if instructions != None:
9304 self.instructions = instructions
9305 else:
9306 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009307 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009308
9309 def pack(self):
9310 packed = []
9311 packed.append(struct.pack("!B", self.version))
9312 packed.append(struct.pack("!B", self.type))
9313 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9314 packed.append(struct.pack("!L", self.xid))
9315 packed.append(struct.pack("!Q", self.cookie))
9316 packed.append(struct.pack("!Q", self.cookie_mask))
9317 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009318 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009319 packed.append(struct.pack("!H", self.idle_timeout))
9320 packed.append(struct.pack("!H", self.hard_timeout))
9321 packed.append(struct.pack("!H", self.priority))
9322 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009323 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009324 packed.append(struct.pack("!L", self.out_group))
9325 packed.append(struct.pack("!H", self.flags))
9326 packed.append('\x00' * 2)
9327 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009328 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009329 length = sum([len(x) for x in packed])
9330 packed[2] = struct.pack("!H", length)
9331 return ''.join(packed)
9332
9333 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009334 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009335 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07009336 _version = reader.read("!B")[0]
9337 assert(_version == 4)
9338 _type = reader.read("!B")[0]
9339 assert(_type == 14)
9340 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009341 orig_reader = reader
9342 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009343 obj.xid = reader.read("!L")[0]
9344 obj.cookie = reader.read("!Q")[0]
9345 obj.cookie_mask = reader.read("!Q")[0]
9346 obj.table_id = reader.read("!B")[0]
9347 __command = util.unpack_fm_cmd(reader)
9348 assert(__command == 0)
9349 obj.idle_timeout = reader.read("!H")[0]
9350 obj.hard_timeout = reader.read("!H")[0]
9351 obj.priority = reader.read("!H")[0]
9352 obj.buffer_id = reader.read("!L")[0]
9353 obj.out_port = util.unpack_port_no(reader)
9354 obj.out_group = reader.read("!L")[0]
9355 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009356 reader.skip(2)
9357 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009358 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009359 return obj
9360
9361 def __eq__(self, other):
9362 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009363 if self.xid != other.xid: return False
9364 if self.cookie != other.cookie: return False
9365 if self.cookie_mask != other.cookie_mask: return False
9366 if self.table_id != other.table_id: return False
9367 if self.idle_timeout != other.idle_timeout: return False
9368 if self.hard_timeout != other.hard_timeout: return False
9369 if self.priority != other.priority: return False
9370 if self.buffer_id != other.buffer_id: return False
9371 if self.out_port != other.out_port: return False
9372 if self.out_group != other.out_group: return False
9373 if self.flags != other.flags: return False
9374 if self.match != other.match: return False
9375 if self.instructions != other.instructions: return False
9376 return True
9377
Rich Lanec2ee4b82013-04-24 17:12:38 -07009378 def pretty_print(self, q):
9379 q.text("flow_add {")
9380 with q.group():
9381 with q.indent(2):
9382 q.breakable()
9383 q.text("xid = ");
9384 if self.xid != None:
9385 q.text("%#x" % self.xid)
9386 else:
9387 q.text('None')
9388 q.text(","); q.breakable()
9389 q.text("cookie = ");
9390 q.text("%#x" % self.cookie)
9391 q.text(","); q.breakable()
9392 q.text("cookie_mask = ");
9393 q.text("%#x" % self.cookie_mask)
9394 q.text(","); q.breakable()
9395 q.text("table_id = ");
9396 q.text("%#x" % self.table_id)
9397 q.text(","); q.breakable()
9398 q.text("idle_timeout = ");
9399 q.text("%#x" % self.idle_timeout)
9400 q.text(","); q.breakable()
9401 q.text("hard_timeout = ");
9402 q.text("%#x" % self.hard_timeout)
9403 q.text(","); q.breakable()
9404 q.text("priority = ");
9405 q.text("%#x" % self.priority)
9406 q.text(","); q.breakable()
9407 q.text("buffer_id = ");
9408 q.text("%#x" % self.buffer_id)
9409 q.text(","); q.breakable()
9410 q.text("out_port = ");
9411 q.text(util.pretty_port(self.out_port))
9412 q.text(","); q.breakable()
9413 q.text("out_group = ");
9414 q.text("%#x" % self.out_group)
9415 q.text(","); q.breakable()
9416 q.text("flags = ");
9417 q.text("%#x" % self.flags)
9418 q.text(","); q.breakable()
9419 q.text("match = ");
9420 q.pp(self.match)
9421 q.text(","); q.breakable()
9422 q.text("instructions = ");
9423 q.pp(self.instructions)
9424 q.breakable()
9425 q.text('}')
9426
Rich Lane7dcdf022013-12-11 14:45:27 -08009427flow_mod.subtypes[0] = flow_add
9428
9429class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009430 version = 4
9431 type = 14
9432 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009433
9434 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 -08009435 if xid != None:
9436 self.xid = xid
9437 else:
9438 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009439 if cookie != None:
9440 self.cookie = cookie
9441 else:
9442 self.cookie = 0
9443 if cookie_mask != None:
9444 self.cookie_mask = cookie_mask
9445 else:
9446 self.cookie_mask = 0
9447 if table_id != None:
9448 self.table_id = table_id
9449 else:
9450 self.table_id = 0
9451 if idle_timeout != None:
9452 self.idle_timeout = idle_timeout
9453 else:
9454 self.idle_timeout = 0
9455 if hard_timeout != None:
9456 self.hard_timeout = hard_timeout
9457 else:
9458 self.hard_timeout = 0
9459 if priority != None:
9460 self.priority = priority
9461 else:
9462 self.priority = 0
9463 if buffer_id != None:
9464 self.buffer_id = buffer_id
9465 else:
9466 self.buffer_id = 0
9467 if out_port != None:
9468 self.out_port = out_port
9469 else:
9470 self.out_port = 0
9471 if out_group != None:
9472 self.out_group = out_group
9473 else:
9474 self.out_group = 0
9475 if flags != None:
9476 self.flags = flags
9477 else:
9478 self.flags = 0
9479 if match != None:
9480 self.match = match
9481 else:
9482 self.match = common.match()
9483 if instructions != None:
9484 self.instructions = instructions
9485 else:
9486 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009487 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009488
9489 def pack(self):
9490 packed = []
9491 packed.append(struct.pack("!B", self.version))
9492 packed.append(struct.pack("!B", self.type))
9493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9494 packed.append(struct.pack("!L", self.xid))
9495 packed.append(struct.pack("!Q", self.cookie))
9496 packed.append(struct.pack("!Q", self.cookie_mask))
9497 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009498 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009499 packed.append(struct.pack("!H", self.idle_timeout))
9500 packed.append(struct.pack("!H", self.hard_timeout))
9501 packed.append(struct.pack("!H", self.priority))
9502 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009503 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009504 packed.append(struct.pack("!L", self.out_group))
9505 packed.append(struct.pack("!H", self.flags))
9506 packed.append('\x00' * 2)
9507 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009508 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009509 length = sum([len(x) for x in packed])
9510 packed[2] = struct.pack("!H", length)
9511 return ''.join(packed)
9512
9513 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009514 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009515 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07009516 _version = reader.read("!B")[0]
9517 assert(_version == 4)
9518 _type = reader.read("!B")[0]
9519 assert(_type == 14)
9520 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009521 orig_reader = reader
9522 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009523 obj.xid = reader.read("!L")[0]
9524 obj.cookie = reader.read("!Q")[0]
9525 obj.cookie_mask = reader.read("!Q")[0]
9526 obj.table_id = reader.read("!B")[0]
9527 __command = util.unpack_fm_cmd(reader)
9528 assert(__command == 3)
9529 obj.idle_timeout = reader.read("!H")[0]
9530 obj.hard_timeout = reader.read("!H")[0]
9531 obj.priority = reader.read("!H")[0]
9532 obj.buffer_id = reader.read("!L")[0]
9533 obj.out_port = util.unpack_port_no(reader)
9534 obj.out_group = reader.read("!L")[0]
9535 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009536 reader.skip(2)
9537 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009538 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009539 return obj
9540
9541 def __eq__(self, other):
9542 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009543 if self.xid != other.xid: return False
9544 if self.cookie != other.cookie: return False
9545 if self.cookie_mask != other.cookie_mask: return False
9546 if self.table_id != other.table_id: return False
9547 if self.idle_timeout != other.idle_timeout: return False
9548 if self.hard_timeout != other.hard_timeout: return False
9549 if self.priority != other.priority: return False
9550 if self.buffer_id != other.buffer_id: return False
9551 if self.out_port != other.out_port: return False
9552 if self.out_group != other.out_group: return False
9553 if self.flags != other.flags: return False
9554 if self.match != other.match: return False
9555 if self.instructions != other.instructions: return False
9556 return True
9557
Rich Lanec2ee4b82013-04-24 17:12:38 -07009558 def pretty_print(self, q):
9559 q.text("flow_delete {")
9560 with q.group():
9561 with q.indent(2):
9562 q.breakable()
9563 q.text("xid = ");
9564 if self.xid != None:
9565 q.text("%#x" % self.xid)
9566 else:
9567 q.text('None')
9568 q.text(","); q.breakable()
9569 q.text("cookie = ");
9570 q.text("%#x" % self.cookie)
9571 q.text(","); q.breakable()
9572 q.text("cookie_mask = ");
9573 q.text("%#x" % self.cookie_mask)
9574 q.text(","); q.breakable()
9575 q.text("table_id = ");
9576 q.text("%#x" % self.table_id)
9577 q.text(","); q.breakable()
9578 q.text("idle_timeout = ");
9579 q.text("%#x" % self.idle_timeout)
9580 q.text(","); q.breakable()
9581 q.text("hard_timeout = ");
9582 q.text("%#x" % self.hard_timeout)
9583 q.text(","); q.breakable()
9584 q.text("priority = ");
9585 q.text("%#x" % self.priority)
9586 q.text(","); q.breakable()
9587 q.text("buffer_id = ");
9588 q.text("%#x" % self.buffer_id)
9589 q.text(","); q.breakable()
9590 q.text("out_port = ");
9591 q.text(util.pretty_port(self.out_port))
9592 q.text(","); q.breakable()
9593 q.text("out_group = ");
9594 q.text("%#x" % self.out_group)
9595 q.text(","); q.breakable()
9596 q.text("flags = ");
9597 q.text("%#x" % self.flags)
9598 q.text(","); q.breakable()
9599 q.text("match = ");
9600 q.pp(self.match)
9601 q.text(","); q.breakable()
9602 q.text("instructions = ");
9603 q.pp(self.instructions)
9604 q.breakable()
9605 q.text('}')
9606
Rich Lane7dcdf022013-12-11 14:45:27 -08009607flow_mod.subtypes[3] = flow_delete
9608
9609class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009610 version = 4
9611 type = 14
9612 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07009613
9614 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 -08009615 if xid != None:
9616 self.xid = xid
9617 else:
9618 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009619 if cookie != None:
9620 self.cookie = cookie
9621 else:
9622 self.cookie = 0
9623 if cookie_mask != None:
9624 self.cookie_mask = cookie_mask
9625 else:
9626 self.cookie_mask = 0
9627 if table_id != None:
9628 self.table_id = table_id
9629 else:
9630 self.table_id = 0
9631 if idle_timeout != None:
9632 self.idle_timeout = idle_timeout
9633 else:
9634 self.idle_timeout = 0
9635 if hard_timeout != None:
9636 self.hard_timeout = hard_timeout
9637 else:
9638 self.hard_timeout = 0
9639 if priority != None:
9640 self.priority = priority
9641 else:
9642 self.priority = 0
9643 if buffer_id != None:
9644 self.buffer_id = buffer_id
9645 else:
9646 self.buffer_id = 0
9647 if out_port != None:
9648 self.out_port = out_port
9649 else:
9650 self.out_port = 0
9651 if out_group != None:
9652 self.out_group = out_group
9653 else:
9654 self.out_group = 0
9655 if flags != None:
9656 self.flags = flags
9657 else:
9658 self.flags = 0
9659 if match != None:
9660 self.match = match
9661 else:
9662 self.match = common.match()
9663 if instructions != None:
9664 self.instructions = instructions
9665 else:
9666 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009667 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009668
9669 def pack(self):
9670 packed = []
9671 packed.append(struct.pack("!B", self.version))
9672 packed.append(struct.pack("!B", self.type))
9673 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9674 packed.append(struct.pack("!L", self.xid))
9675 packed.append(struct.pack("!Q", self.cookie))
9676 packed.append(struct.pack("!Q", self.cookie_mask))
9677 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009678 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009679 packed.append(struct.pack("!H", self.idle_timeout))
9680 packed.append(struct.pack("!H", self.hard_timeout))
9681 packed.append(struct.pack("!H", self.priority))
9682 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009683 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009684 packed.append(struct.pack("!L", self.out_group))
9685 packed.append(struct.pack("!H", self.flags))
9686 packed.append('\x00' * 2)
9687 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009688 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009689 length = sum([len(x) for x in packed])
9690 packed[2] = struct.pack("!H", length)
9691 return ''.join(packed)
9692
9693 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009694 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009695 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07009696 _version = reader.read("!B")[0]
9697 assert(_version == 4)
9698 _type = reader.read("!B")[0]
9699 assert(_type == 14)
9700 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009701 orig_reader = reader
9702 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009703 obj.xid = reader.read("!L")[0]
9704 obj.cookie = reader.read("!Q")[0]
9705 obj.cookie_mask = reader.read("!Q")[0]
9706 obj.table_id = reader.read("!B")[0]
9707 __command = util.unpack_fm_cmd(reader)
9708 assert(__command == 4)
9709 obj.idle_timeout = reader.read("!H")[0]
9710 obj.hard_timeout = reader.read("!H")[0]
9711 obj.priority = reader.read("!H")[0]
9712 obj.buffer_id = reader.read("!L")[0]
9713 obj.out_port = util.unpack_port_no(reader)
9714 obj.out_group = reader.read("!L")[0]
9715 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009716 reader.skip(2)
9717 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009718 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009719 return obj
9720
9721 def __eq__(self, other):
9722 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009723 if self.xid != other.xid: return False
9724 if self.cookie != other.cookie: return False
9725 if self.cookie_mask != other.cookie_mask: return False
9726 if self.table_id != other.table_id: return False
9727 if self.idle_timeout != other.idle_timeout: return False
9728 if self.hard_timeout != other.hard_timeout: return False
9729 if self.priority != other.priority: return False
9730 if self.buffer_id != other.buffer_id: return False
9731 if self.out_port != other.out_port: return False
9732 if self.out_group != other.out_group: return False
9733 if self.flags != other.flags: return False
9734 if self.match != other.match: return False
9735 if self.instructions != other.instructions: return False
9736 return True
9737
Rich Lanec2ee4b82013-04-24 17:12:38 -07009738 def pretty_print(self, q):
9739 q.text("flow_delete_strict {")
9740 with q.group():
9741 with q.indent(2):
9742 q.breakable()
9743 q.text("xid = ");
9744 if self.xid != None:
9745 q.text("%#x" % self.xid)
9746 else:
9747 q.text('None')
9748 q.text(","); q.breakable()
9749 q.text("cookie = ");
9750 q.text("%#x" % self.cookie)
9751 q.text(","); q.breakable()
9752 q.text("cookie_mask = ");
9753 q.text("%#x" % self.cookie_mask)
9754 q.text(","); q.breakable()
9755 q.text("table_id = ");
9756 q.text("%#x" % self.table_id)
9757 q.text(","); q.breakable()
9758 q.text("idle_timeout = ");
9759 q.text("%#x" % self.idle_timeout)
9760 q.text(","); q.breakable()
9761 q.text("hard_timeout = ");
9762 q.text("%#x" % self.hard_timeout)
9763 q.text(","); q.breakable()
9764 q.text("priority = ");
9765 q.text("%#x" % self.priority)
9766 q.text(","); q.breakable()
9767 q.text("buffer_id = ");
9768 q.text("%#x" % self.buffer_id)
9769 q.text(","); q.breakable()
9770 q.text("out_port = ");
9771 q.text(util.pretty_port(self.out_port))
9772 q.text(","); q.breakable()
9773 q.text("out_group = ");
9774 q.text("%#x" % self.out_group)
9775 q.text(","); q.breakable()
9776 q.text("flags = ");
9777 q.text("%#x" % self.flags)
9778 q.text(","); q.breakable()
9779 q.text("match = ");
9780 q.pp(self.match)
9781 q.text(","); q.breakable()
9782 q.text("instructions = ");
9783 q.pp(self.instructions)
9784 q.breakable()
9785 q.text('}')
9786
Rich Lane7dcdf022013-12-11 14:45:27 -08009787flow_mod.subtypes[4] = flow_delete_strict
9788
9789class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009790 version = 4
9791 type = 1
9792 err_type = 5
9793
9794 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009795 if xid != None:
9796 self.xid = xid
9797 else:
9798 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009799 if code != None:
9800 self.code = code
9801 else:
9802 self.code = 0
9803 if data != None:
9804 self.data = data
9805 else:
9806 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009807 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009808
9809 def pack(self):
9810 packed = []
9811 packed.append(struct.pack("!B", self.version))
9812 packed.append(struct.pack("!B", self.type))
9813 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9814 packed.append(struct.pack("!L", self.xid))
9815 packed.append(struct.pack("!H", self.err_type))
9816 packed.append(struct.pack("!H", self.code))
9817 packed.append(self.data)
9818 length = sum([len(x) for x in packed])
9819 packed[2] = struct.pack("!H", length)
9820 return ''.join(packed)
9821
9822 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009823 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009824 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07009825 _version = reader.read("!B")[0]
9826 assert(_version == 4)
9827 _type = reader.read("!B")[0]
9828 assert(_type == 1)
9829 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009830 orig_reader = reader
9831 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07009832 obj.xid = reader.read("!L")[0]
9833 _err_type = reader.read("!H")[0]
9834 assert(_err_type == 5)
9835 obj.code = reader.read("!H")[0]
9836 obj.data = str(reader.read_all())
9837 return obj
9838
9839 def __eq__(self, other):
9840 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009841 if self.xid != other.xid: return False
9842 if self.code != other.code: return False
9843 if self.data != other.data: return False
9844 return True
9845
Rich Lane6f4978c2013-10-20 21:33:52 -07009846 def pretty_print(self, q):
9847 q.text("flow_mod_failed_error_msg {")
9848 with q.group():
9849 with q.indent(2):
9850 q.breakable()
9851 q.text("xid = ");
9852 if self.xid != None:
9853 q.text("%#x" % self.xid)
9854 else:
9855 q.text('None')
9856 q.text(","); q.breakable()
9857 q.text("code = ");
9858 q.text("%#x" % self.code)
9859 q.text(","); q.breakable()
9860 q.text("data = ");
9861 q.pp(self.data)
9862 q.breakable()
9863 q.text('}')
9864
Rich Lane7dcdf022013-12-11 14:45:27 -08009865error_msg.subtypes[5] = flow_mod_failed_error_msg
9866
9867class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009868 version = 4
9869 type = 14
9870 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07009871
9872 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 -08009873 if xid != None:
9874 self.xid = xid
9875 else:
9876 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009877 if cookie != None:
9878 self.cookie = cookie
9879 else:
9880 self.cookie = 0
9881 if cookie_mask != None:
9882 self.cookie_mask = cookie_mask
9883 else:
9884 self.cookie_mask = 0
9885 if table_id != None:
9886 self.table_id = table_id
9887 else:
9888 self.table_id = 0
9889 if idle_timeout != None:
9890 self.idle_timeout = idle_timeout
9891 else:
9892 self.idle_timeout = 0
9893 if hard_timeout != None:
9894 self.hard_timeout = hard_timeout
9895 else:
9896 self.hard_timeout = 0
9897 if priority != None:
9898 self.priority = priority
9899 else:
9900 self.priority = 0
9901 if buffer_id != None:
9902 self.buffer_id = buffer_id
9903 else:
9904 self.buffer_id = 0
9905 if out_port != None:
9906 self.out_port = out_port
9907 else:
9908 self.out_port = 0
9909 if out_group != None:
9910 self.out_group = out_group
9911 else:
9912 self.out_group = 0
9913 if flags != None:
9914 self.flags = flags
9915 else:
9916 self.flags = 0
9917 if match != None:
9918 self.match = match
9919 else:
9920 self.match = common.match()
9921 if instructions != None:
9922 self.instructions = instructions
9923 else:
9924 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009925 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009926
9927 def pack(self):
9928 packed = []
9929 packed.append(struct.pack("!B", self.version))
9930 packed.append(struct.pack("!B", self.type))
9931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9932 packed.append(struct.pack("!L", self.xid))
9933 packed.append(struct.pack("!Q", self.cookie))
9934 packed.append(struct.pack("!Q", self.cookie_mask))
9935 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009936 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009937 packed.append(struct.pack("!H", self.idle_timeout))
9938 packed.append(struct.pack("!H", self.hard_timeout))
9939 packed.append(struct.pack("!H", self.priority))
9940 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009941 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009942 packed.append(struct.pack("!L", self.out_group))
9943 packed.append(struct.pack("!H", self.flags))
9944 packed.append('\x00' * 2)
9945 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009946 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009947 length = sum([len(x) for x in packed])
9948 packed[2] = struct.pack("!H", length)
9949 return ''.join(packed)
9950
9951 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009952 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009953 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07009954 _version = reader.read("!B")[0]
9955 assert(_version == 4)
9956 _type = reader.read("!B")[0]
9957 assert(_type == 14)
9958 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009959 orig_reader = reader
9960 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009961 obj.xid = reader.read("!L")[0]
9962 obj.cookie = reader.read("!Q")[0]
9963 obj.cookie_mask = reader.read("!Q")[0]
9964 obj.table_id = reader.read("!B")[0]
9965 __command = util.unpack_fm_cmd(reader)
9966 assert(__command == 1)
9967 obj.idle_timeout = reader.read("!H")[0]
9968 obj.hard_timeout = reader.read("!H")[0]
9969 obj.priority = reader.read("!H")[0]
9970 obj.buffer_id = reader.read("!L")[0]
9971 obj.out_port = util.unpack_port_no(reader)
9972 obj.out_group = reader.read("!L")[0]
9973 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009974 reader.skip(2)
9975 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009976 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009977 return obj
9978
9979 def __eq__(self, other):
9980 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009981 if self.xid != other.xid: return False
9982 if self.cookie != other.cookie: return False
9983 if self.cookie_mask != other.cookie_mask: return False
9984 if self.table_id != other.table_id: return False
9985 if self.idle_timeout != other.idle_timeout: return False
9986 if self.hard_timeout != other.hard_timeout: return False
9987 if self.priority != other.priority: return False
9988 if self.buffer_id != other.buffer_id: return False
9989 if self.out_port != other.out_port: return False
9990 if self.out_group != other.out_group: return False
9991 if self.flags != other.flags: return False
9992 if self.match != other.match: return False
9993 if self.instructions != other.instructions: return False
9994 return True
9995
Rich Lanec2ee4b82013-04-24 17:12:38 -07009996 def pretty_print(self, q):
9997 q.text("flow_modify {")
9998 with q.group():
9999 with q.indent(2):
10000 q.breakable()
10001 q.text("xid = ");
10002 if self.xid != None:
10003 q.text("%#x" % self.xid)
10004 else:
10005 q.text('None')
10006 q.text(","); q.breakable()
10007 q.text("cookie = ");
10008 q.text("%#x" % self.cookie)
10009 q.text(","); q.breakable()
10010 q.text("cookie_mask = ");
10011 q.text("%#x" % self.cookie_mask)
10012 q.text(","); q.breakable()
10013 q.text("table_id = ");
10014 q.text("%#x" % self.table_id)
10015 q.text(","); q.breakable()
10016 q.text("idle_timeout = ");
10017 q.text("%#x" % self.idle_timeout)
10018 q.text(","); q.breakable()
10019 q.text("hard_timeout = ");
10020 q.text("%#x" % self.hard_timeout)
10021 q.text(","); q.breakable()
10022 q.text("priority = ");
10023 q.text("%#x" % self.priority)
10024 q.text(","); q.breakable()
10025 q.text("buffer_id = ");
10026 q.text("%#x" % self.buffer_id)
10027 q.text(","); q.breakable()
10028 q.text("out_port = ");
10029 q.text(util.pretty_port(self.out_port))
10030 q.text(","); q.breakable()
10031 q.text("out_group = ");
10032 q.text("%#x" % self.out_group)
10033 q.text(","); q.breakable()
10034 q.text("flags = ");
10035 q.text("%#x" % self.flags)
10036 q.text(","); q.breakable()
10037 q.text("match = ");
10038 q.pp(self.match)
10039 q.text(","); q.breakable()
10040 q.text("instructions = ");
10041 q.pp(self.instructions)
10042 q.breakable()
10043 q.text('}')
10044
Rich Lane7dcdf022013-12-11 14:45:27 -080010045flow_mod.subtypes[1] = flow_modify
10046
10047class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010048 version = 4
10049 type = 14
10050 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -070010051
10052 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 -080010053 if xid != None:
10054 self.xid = xid
10055 else:
10056 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010057 if cookie != None:
10058 self.cookie = cookie
10059 else:
10060 self.cookie = 0
10061 if cookie_mask != None:
10062 self.cookie_mask = cookie_mask
10063 else:
10064 self.cookie_mask = 0
10065 if table_id != None:
10066 self.table_id = table_id
10067 else:
10068 self.table_id = 0
10069 if idle_timeout != None:
10070 self.idle_timeout = idle_timeout
10071 else:
10072 self.idle_timeout = 0
10073 if hard_timeout != None:
10074 self.hard_timeout = hard_timeout
10075 else:
10076 self.hard_timeout = 0
10077 if priority != None:
10078 self.priority = priority
10079 else:
10080 self.priority = 0
10081 if buffer_id != None:
10082 self.buffer_id = buffer_id
10083 else:
10084 self.buffer_id = 0
10085 if out_port != None:
10086 self.out_port = out_port
10087 else:
10088 self.out_port = 0
10089 if out_group != None:
10090 self.out_group = out_group
10091 else:
10092 self.out_group = 0
10093 if flags != None:
10094 self.flags = flags
10095 else:
10096 self.flags = 0
10097 if match != None:
10098 self.match = match
10099 else:
10100 self.match = common.match()
10101 if instructions != None:
10102 self.instructions = instructions
10103 else:
10104 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010105 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010106
10107 def pack(self):
10108 packed = []
10109 packed.append(struct.pack("!B", self.version))
10110 packed.append(struct.pack("!B", self.type))
10111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10112 packed.append(struct.pack("!L", self.xid))
10113 packed.append(struct.pack("!Q", self.cookie))
10114 packed.append(struct.pack("!Q", self.cookie_mask))
10115 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010116 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010117 packed.append(struct.pack("!H", self.idle_timeout))
10118 packed.append(struct.pack("!H", self.hard_timeout))
10119 packed.append(struct.pack("!H", self.priority))
10120 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010121 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010122 packed.append(struct.pack("!L", self.out_group))
10123 packed.append(struct.pack("!H", self.flags))
10124 packed.append('\x00' * 2)
10125 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010126 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010127 length = sum([len(x) for x in packed])
10128 packed[2] = struct.pack("!H", length)
10129 return ''.join(packed)
10130
10131 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010132 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010133 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010134 _version = reader.read("!B")[0]
10135 assert(_version == 4)
10136 _type = reader.read("!B")[0]
10137 assert(_type == 14)
10138 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010139 orig_reader = reader
10140 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010141 obj.xid = reader.read("!L")[0]
10142 obj.cookie = reader.read("!Q")[0]
10143 obj.cookie_mask = reader.read("!Q")[0]
10144 obj.table_id = reader.read("!B")[0]
10145 __command = util.unpack_fm_cmd(reader)
10146 assert(__command == 2)
10147 obj.idle_timeout = reader.read("!H")[0]
10148 obj.hard_timeout = reader.read("!H")[0]
10149 obj.priority = reader.read("!H")[0]
10150 obj.buffer_id = reader.read("!L")[0]
10151 obj.out_port = util.unpack_port_no(reader)
10152 obj.out_group = reader.read("!L")[0]
10153 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010154 reader.skip(2)
10155 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010156 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010157 return obj
10158
10159 def __eq__(self, other):
10160 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010161 if self.xid != other.xid: return False
10162 if self.cookie != other.cookie: return False
10163 if self.cookie_mask != other.cookie_mask: return False
10164 if self.table_id != other.table_id: return False
10165 if self.idle_timeout != other.idle_timeout: return False
10166 if self.hard_timeout != other.hard_timeout: return False
10167 if self.priority != other.priority: return False
10168 if self.buffer_id != other.buffer_id: return False
10169 if self.out_port != other.out_port: return False
10170 if self.out_group != other.out_group: return False
10171 if self.flags != other.flags: return False
10172 if self.match != other.match: return False
10173 if self.instructions != other.instructions: return False
10174 return True
10175
Rich Lanec2ee4b82013-04-24 17:12:38 -070010176 def pretty_print(self, q):
10177 q.text("flow_modify_strict {")
10178 with q.group():
10179 with q.indent(2):
10180 q.breakable()
10181 q.text("xid = ");
10182 if self.xid != None:
10183 q.text("%#x" % self.xid)
10184 else:
10185 q.text('None')
10186 q.text(","); q.breakable()
10187 q.text("cookie = ");
10188 q.text("%#x" % self.cookie)
10189 q.text(","); q.breakable()
10190 q.text("cookie_mask = ");
10191 q.text("%#x" % self.cookie_mask)
10192 q.text(","); q.breakable()
10193 q.text("table_id = ");
10194 q.text("%#x" % self.table_id)
10195 q.text(","); q.breakable()
10196 q.text("idle_timeout = ");
10197 q.text("%#x" % self.idle_timeout)
10198 q.text(","); q.breakable()
10199 q.text("hard_timeout = ");
10200 q.text("%#x" % self.hard_timeout)
10201 q.text(","); q.breakable()
10202 q.text("priority = ");
10203 q.text("%#x" % self.priority)
10204 q.text(","); q.breakable()
10205 q.text("buffer_id = ");
10206 q.text("%#x" % self.buffer_id)
10207 q.text(","); q.breakable()
10208 q.text("out_port = ");
10209 q.text(util.pretty_port(self.out_port))
10210 q.text(","); q.breakable()
10211 q.text("out_group = ");
10212 q.text("%#x" % self.out_group)
10213 q.text(","); q.breakable()
10214 q.text("flags = ");
10215 q.text("%#x" % self.flags)
10216 q.text(","); q.breakable()
10217 q.text("match = ");
10218 q.pp(self.match)
10219 q.text(","); q.breakable()
10220 q.text("instructions = ");
10221 q.pp(self.instructions)
10222 q.breakable()
10223 q.text('}')
10224
Rich Lane7dcdf022013-12-11 14:45:27 -080010225flow_mod.subtypes[2] = flow_modify_strict
10226
10227class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010228 version = 4
10229 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -070010230
10231 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 -080010232 if xid != None:
10233 self.xid = xid
10234 else:
10235 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010236 if cookie != None:
10237 self.cookie = cookie
10238 else:
10239 self.cookie = 0
10240 if priority != None:
10241 self.priority = priority
10242 else:
10243 self.priority = 0
10244 if reason != None:
10245 self.reason = reason
10246 else:
10247 self.reason = 0
10248 if table_id != None:
10249 self.table_id = table_id
10250 else:
10251 self.table_id = 0
10252 if duration_sec != None:
10253 self.duration_sec = duration_sec
10254 else:
10255 self.duration_sec = 0
10256 if duration_nsec != None:
10257 self.duration_nsec = duration_nsec
10258 else:
10259 self.duration_nsec = 0
10260 if idle_timeout != None:
10261 self.idle_timeout = idle_timeout
10262 else:
10263 self.idle_timeout = 0
10264 if hard_timeout != None:
10265 self.hard_timeout = hard_timeout
10266 else:
10267 self.hard_timeout = 0
10268 if packet_count != None:
10269 self.packet_count = packet_count
10270 else:
10271 self.packet_count = 0
10272 if byte_count != None:
10273 self.byte_count = byte_count
10274 else:
10275 self.byte_count = 0
10276 if match != None:
10277 self.match = match
10278 else:
10279 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010280 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010281
10282 def pack(self):
10283 packed = []
10284 packed.append(struct.pack("!B", self.version))
10285 packed.append(struct.pack("!B", self.type))
10286 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10287 packed.append(struct.pack("!L", self.xid))
10288 packed.append(struct.pack("!Q", self.cookie))
10289 packed.append(struct.pack("!H", self.priority))
10290 packed.append(struct.pack("!B", self.reason))
10291 packed.append(struct.pack("!B", self.table_id))
10292 packed.append(struct.pack("!L", self.duration_sec))
10293 packed.append(struct.pack("!L", self.duration_nsec))
10294 packed.append(struct.pack("!H", self.idle_timeout))
10295 packed.append(struct.pack("!H", self.hard_timeout))
10296 packed.append(struct.pack("!Q", self.packet_count))
10297 packed.append(struct.pack("!Q", self.byte_count))
10298 packed.append(self.match.pack())
10299 length = sum([len(x) for x in packed])
10300 packed[2] = struct.pack("!H", length)
10301 return ''.join(packed)
10302
10303 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010304 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010305 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -070010306 _version = reader.read("!B")[0]
10307 assert(_version == 4)
10308 _type = reader.read("!B")[0]
10309 assert(_type == 11)
10310 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010311 orig_reader = reader
10312 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010313 obj.xid = reader.read("!L")[0]
10314 obj.cookie = reader.read("!Q")[0]
10315 obj.priority = reader.read("!H")[0]
10316 obj.reason = reader.read("!B")[0]
10317 obj.table_id = reader.read("!B")[0]
10318 obj.duration_sec = reader.read("!L")[0]
10319 obj.duration_nsec = reader.read("!L")[0]
10320 obj.idle_timeout = reader.read("!H")[0]
10321 obj.hard_timeout = reader.read("!H")[0]
10322 obj.packet_count = reader.read("!Q")[0]
10323 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010324 obj.match = common.match.unpack(reader)
10325 return obj
10326
10327 def __eq__(self, other):
10328 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010329 if self.xid != other.xid: return False
10330 if self.cookie != other.cookie: return False
10331 if self.priority != other.priority: return False
10332 if self.reason != other.reason: return False
10333 if self.table_id != other.table_id: return False
10334 if self.duration_sec != other.duration_sec: return False
10335 if self.duration_nsec != other.duration_nsec: return False
10336 if self.idle_timeout != other.idle_timeout: return False
10337 if self.hard_timeout != other.hard_timeout: return False
10338 if self.packet_count != other.packet_count: return False
10339 if self.byte_count != other.byte_count: return False
10340 if self.match != other.match: return False
10341 return True
10342
Rich Lanec2ee4b82013-04-24 17:12:38 -070010343 def pretty_print(self, q):
10344 q.text("flow_removed {")
10345 with q.group():
10346 with q.indent(2):
10347 q.breakable()
10348 q.text("xid = ");
10349 if self.xid != None:
10350 q.text("%#x" % self.xid)
10351 else:
10352 q.text('None')
10353 q.text(","); q.breakable()
10354 q.text("cookie = ");
10355 q.text("%#x" % self.cookie)
10356 q.text(","); q.breakable()
10357 q.text("priority = ");
10358 q.text("%#x" % self.priority)
10359 q.text(","); q.breakable()
10360 q.text("reason = ");
10361 q.text("%#x" % self.reason)
10362 q.text(","); q.breakable()
10363 q.text("table_id = ");
10364 q.text("%#x" % self.table_id)
10365 q.text(","); q.breakable()
10366 q.text("duration_sec = ");
10367 q.text("%#x" % self.duration_sec)
10368 q.text(","); q.breakable()
10369 q.text("duration_nsec = ");
10370 q.text("%#x" % self.duration_nsec)
10371 q.text(","); q.breakable()
10372 q.text("idle_timeout = ");
10373 q.text("%#x" % self.idle_timeout)
10374 q.text(","); q.breakable()
10375 q.text("hard_timeout = ");
10376 q.text("%#x" % self.hard_timeout)
10377 q.text(","); q.breakable()
10378 q.text("packet_count = ");
10379 q.text("%#x" % self.packet_count)
10380 q.text(","); q.breakable()
10381 q.text("byte_count = ");
10382 q.text("%#x" % self.byte_count)
10383 q.text(","); q.breakable()
10384 q.text("match = ");
10385 q.pp(self.match)
10386 q.breakable()
10387 q.text('}')
10388
Rich Lane7dcdf022013-12-11 14:45:27 -080010389message.subtypes[11] = flow_removed
10390
10391class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010392 version = 4
10393 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010394 stats_type = 1
10395
10396 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010397 if xid != None:
10398 self.xid = xid
10399 else:
10400 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010401 if flags != None:
10402 self.flags = flags
10403 else:
10404 self.flags = 0
10405 if entries != None:
10406 self.entries = entries
10407 else:
10408 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010409 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010410
10411 def pack(self):
10412 packed = []
10413 packed.append(struct.pack("!B", self.version))
10414 packed.append(struct.pack("!B", self.type))
10415 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10416 packed.append(struct.pack("!L", self.xid))
10417 packed.append(struct.pack("!H", self.stats_type))
10418 packed.append(struct.pack("!H", self.flags))
10419 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010420 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010421 length = sum([len(x) for x in packed])
10422 packed[2] = struct.pack("!H", length)
10423 return ''.join(packed)
10424
10425 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010426 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010427 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010428 _version = reader.read("!B")[0]
10429 assert(_version == 4)
10430 _type = reader.read("!B")[0]
10431 assert(_type == 19)
10432 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010433 orig_reader = reader
10434 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010435 obj.xid = reader.read("!L")[0]
10436 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010437 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010438 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010439 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010440 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010441 return obj
10442
10443 def __eq__(self, other):
10444 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010445 if self.xid != other.xid: return False
10446 if self.flags != other.flags: return False
10447 if self.entries != other.entries: return False
10448 return True
10449
Rich Lanec2ee4b82013-04-24 17:12:38 -070010450 def pretty_print(self, q):
10451 q.text("flow_stats_reply {")
10452 with q.group():
10453 with q.indent(2):
10454 q.breakable()
10455 q.text("xid = ");
10456 if self.xid != None:
10457 q.text("%#x" % self.xid)
10458 else:
10459 q.text('None')
10460 q.text(","); q.breakable()
10461 q.text("flags = ");
10462 q.text("%#x" % self.flags)
10463 q.text(","); q.breakable()
10464 q.text("entries = ");
10465 q.pp(self.entries)
10466 q.breakable()
10467 q.text('}')
10468
Rich Lane7dcdf022013-12-11 14:45:27 -080010469stats_reply.subtypes[1] = flow_stats_reply
10470
10471class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010472 version = 4
10473 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010474 stats_type = 1
10475
10476 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 -080010477 if xid != None:
10478 self.xid = xid
10479 else:
10480 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010481 if flags != None:
10482 self.flags = flags
10483 else:
10484 self.flags = 0
10485 if table_id != None:
10486 self.table_id = table_id
10487 else:
10488 self.table_id = 0
10489 if out_port != None:
10490 self.out_port = out_port
10491 else:
10492 self.out_port = 0
10493 if out_group != None:
10494 self.out_group = out_group
10495 else:
10496 self.out_group = 0
10497 if cookie != None:
10498 self.cookie = cookie
10499 else:
10500 self.cookie = 0
10501 if cookie_mask != None:
10502 self.cookie_mask = cookie_mask
10503 else:
10504 self.cookie_mask = 0
10505 if match != None:
10506 self.match = match
10507 else:
10508 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010509 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010510
10511 def pack(self):
10512 packed = []
10513 packed.append(struct.pack("!B", self.version))
10514 packed.append(struct.pack("!B", self.type))
10515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10516 packed.append(struct.pack("!L", self.xid))
10517 packed.append(struct.pack("!H", self.stats_type))
10518 packed.append(struct.pack("!H", self.flags))
10519 packed.append('\x00' * 4)
10520 packed.append(struct.pack("!B", self.table_id))
10521 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -070010522 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010523 packed.append(struct.pack("!L", self.out_group))
10524 packed.append('\x00' * 4)
10525 packed.append(struct.pack("!Q", self.cookie))
10526 packed.append(struct.pack("!Q", self.cookie_mask))
10527 packed.append(self.match.pack())
10528 length = sum([len(x) for x in packed])
10529 packed[2] = struct.pack("!H", length)
10530 return ''.join(packed)
10531
10532 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010533 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010534 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010535 _version = reader.read("!B")[0]
10536 assert(_version == 4)
10537 _type = reader.read("!B")[0]
10538 assert(_type == 18)
10539 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010540 orig_reader = reader
10541 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010542 obj.xid = reader.read("!L")[0]
10543 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010544 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010545 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010546 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010547 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010548 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070010549 obj.out_port = util.unpack_port_no(reader)
10550 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010551 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010552 obj.cookie = reader.read("!Q")[0]
10553 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010554 obj.match = common.match.unpack(reader)
10555 return obj
10556
10557 def __eq__(self, other):
10558 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010559 if self.xid != other.xid: return False
10560 if self.flags != other.flags: return False
10561 if self.table_id != other.table_id: return False
10562 if self.out_port != other.out_port: return False
10563 if self.out_group != other.out_group: return False
10564 if self.cookie != other.cookie: return False
10565 if self.cookie_mask != other.cookie_mask: return False
10566 if self.match != other.match: return False
10567 return True
10568
Rich Lanec2ee4b82013-04-24 17:12:38 -070010569 def pretty_print(self, q):
10570 q.text("flow_stats_request {")
10571 with q.group():
10572 with q.indent(2):
10573 q.breakable()
10574 q.text("xid = ");
10575 if self.xid != None:
10576 q.text("%#x" % self.xid)
10577 else:
10578 q.text('None')
10579 q.text(","); q.breakable()
10580 q.text("flags = ");
10581 q.text("%#x" % self.flags)
10582 q.text(","); q.breakable()
10583 q.text("table_id = ");
10584 q.text("%#x" % self.table_id)
10585 q.text(","); q.breakable()
10586 q.text("out_port = ");
10587 q.text(util.pretty_port(self.out_port))
10588 q.text(","); q.breakable()
10589 q.text("out_group = ");
10590 q.text("%#x" % self.out_group)
10591 q.text(","); q.breakable()
10592 q.text("cookie = ");
10593 q.text("%#x" % self.cookie)
10594 q.text(","); q.breakable()
10595 q.text("cookie_mask = ");
10596 q.text("%#x" % self.cookie_mask)
10597 q.text(","); q.breakable()
10598 q.text("match = ");
10599 q.pp(self.match)
10600 q.breakable()
10601 q.text('}')
10602
Rich Lane7dcdf022013-12-11 14:45:27 -080010603stats_request.subtypes[1] = flow_stats_request
10604
10605class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010606 version = 4
10607 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -070010608
10609 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010610 if xid != None:
10611 self.xid = xid
10612 else:
10613 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010614 if flags != None:
10615 self.flags = flags
10616 else:
10617 self.flags = 0
10618 if miss_send_len != None:
10619 self.miss_send_len = miss_send_len
10620 else:
10621 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010622 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010623
10624 def pack(self):
10625 packed = []
10626 packed.append(struct.pack("!B", self.version))
10627 packed.append(struct.pack("!B", self.type))
10628 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10629 packed.append(struct.pack("!L", self.xid))
10630 packed.append(struct.pack("!H", self.flags))
10631 packed.append(struct.pack("!H", self.miss_send_len))
10632 length = sum([len(x) for x in packed])
10633 packed[2] = struct.pack("!H", length)
10634 return ''.join(packed)
10635
10636 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010637 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010638 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010639 _version = reader.read("!B")[0]
10640 assert(_version == 4)
10641 _type = reader.read("!B")[0]
10642 assert(_type == 8)
10643 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010644 orig_reader = reader
10645 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010646 obj.xid = reader.read("!L")[0]
10647 obj.flags = reader.read("!H")[0]
10648 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010649 return obj
10650
10651 def __eq__(self, other):
10652 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010653 if self.xid != other.xid: return False
10654 if self.flags != other.flags: return False
10655 if self.miss_send_len != other.miss_send_len: return False
10656 return True
10657
Rich Lanec2ee4b82013-04-24 17:12:38 -070010658 def pretty_print(self, q):
10659 q.text("get_config_reply {")
10660 with q.group():
10661 with q.indent(2):
10662 q.breakable()
10663 q.text("xid = ");
10664 if self.xid != None:
10665 q.text("%#x" % self.xid)
10666 else:
10667 q.text('None')
10668 q.text(","); q.breakable()
10669 q.text("flags = ");
10670 q.text("%#x" % self.flags)
10671 q.text(","); q.breakable()
10672 q.text("miss_send_len = ");
10673 q.text("%#x" % self.miss_send_len)
10674 q.breakable()
10675 q.text('}')
10676
Rich Lane7dcdf022013-12-11 14:45:27 -080010677message.subtypes[8] = get_config_reply
10678
10679class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010680 version = 4
10681 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -070010682
10683 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010684 if xid != None:
10685 self.xid = xid
10686 else:
10687 self.xid = None
10688 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010689
10690 def pack(self):
10691 packed = []
10692 packed.append(struct.pack("!B", self.version))
10693 packed.append(struct.pack("!B", self.type))
10694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10695 packed.append(struct.pack("!L", self.xid))
10696 length = sum([len(x) for x in packed])
10697 packed[2] = struct.pack("!H", length)
10698 return ''.join(packed)
10699
10700 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010701 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010702 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010703 _version = reader.read("!B")[0]
10704 assert(_version == 4)
10705 _type = reader.read("!B")[0]
10706 assert(_type == 7)
10707 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010708 orig_reader = reader
10709 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010710 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010711 return obj
10712
10713 def __eq__(self, other):
10714 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010715 if self.xid != other.xid: return False
10716 return True
10717
Rich Lanec2ee4b82013-04-24 17:12:38 -070010718 def pretty_print(self, q):
10719 q.text("get_config_request {")
10720 with q.group():
10721 with q.indent(2):
10722 q.breakable()
10723 q.text("xid = ");
10724 if self.xid != None:
10725 q.text("%#x" % self.xid)
10726 else:
10727 q.text('None')
10728 q.breakable()
10729 q.text('}')
10730
Rich Lane7dcdf022013-12-11 14:45:27 -080010731message.subtypes[7] = get_config_request
10732
10733class group_mod(message):
10734 subtypes = {}
10735
Rich Lane95f7fc92014-01-27 17:08:16 -080010736 version = 4
10737 type = 15
10738
10739 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
10740 if xid != None:
10741 self.xid = xid
10742 else:
10743 self.xid = None
10744 if command != None:
10745 self.command = command
10746 else:
10747 self.command = 0
10748 if group_type != None:
10749 self.group_type = group_type
10750 else:
10751 self.group_type = 0
10752 if group_id != None:
10753 self.group_id = group_id
10754 else:
10755 self.group_id = 0
10756 if buckets != None:
10757 self.buckets = buckets
10758 else:
10759 self.buckets = []
10760 return
10761
10762 def pack(self):
10763 packed = []
10764 packed.append(struct.pack("!B", self.version))
10765 packed.append(struct.pack("!B", self.type))
10766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10767 packed.append(struct.pack("!L", self.xid))
10768 packed.append(struct.pack("!H", self.command))
10769 packed.append(struct.pack("!B", self.group_type))
10770 packed.append('\x00' * 1)
10771 packed.append(struct.pack("!L", self.group_id))
10772 packed.append(loxi.generic_util.pack_list(self.buckets))
10773 length = sum([len(x) for x in packed])
10774 packed[2] = struct.pack("!H", length)
10775 return ''.join(packed)
10776
Rich Lane7dcdf022013-12-11 14:45:27 -080010777 @staticmethod
10778 def unpack(reader):
10779 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080010780 subclass = group_mod.subtypes.get(subtype)
10781 if subclass:
10782 return subclass.unpack(reader)
10783
10784 obj = group_mod()
10785 _version = reader.read("!B")[0]
10786 assert(_version == 4)
10787 _type = reader.read("!B")[0]
10788 assert(_type == 15)
10789 _length = reader.read("!H")[0]
10790 orig_reader = reader
10791 reader = orig_reader.slice(_length - (2 + 2))
10792 obj.xid = reader.read("!L")[0]
10793 obj.command = reader.read("!H")[0]
10794 obj.group_type = reader.read("!B")[0]
10795 reader.skip(1)
10796 obj.group_id = reader.read("!L")[0]
10797 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
10798 return obj
10799
10800 def __eq__(self, other):
10801 if type(self) != type(other): return False
10802 if self.xid != other.xid: return False
10803 if self.command != other.command: return False
10804 if self.group_type != other.group_type: return False
10805 if self.group_id != other.group_id: return False
10806 if self.buckets != other.buckets: return False
10807 return True
10808
10809 def pretty_print(self, q):
10810 q.text("group_mod {")
10811 with q.group():
10812 with q.indent(2):
10813 q.breakable()
10814 q.text("xid = ");
10815 if self.xid != None:
10816 q.text("%#x" % self.xid)
10817 else:
10818 q.text('None')
10819 q.text(","); q.breakable()
10820 q.text("group_type = ");
10821 q.text("%#x" % self.group_type)
10822 q.text(","); q.breakable()
10823 q.text("group_id = ");
10824 q.text("%#x" % self.group_id)
10825 q.text(","); q.breakable()
10826 q.text("buckets = ");
10827 q.pp(self.buckets)
10828 q.breakable()
10829 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080010830
10831message.subtypes[15] = group_mod
10832
10833class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010834 version = 4
10835 type = 15
10836 command = 0
10837
10838 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010839 if xid != None:
10840 self.xid = xid
10841 else:
10842 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010843 if group_type != None:
10844 self.group_type = group_type
10845 else:
10846 self.group_type = 0
10847 if group_id != None:
10848 self.group_id = group_id
10849 else:
10850 self.group_id = 0
10851 if buckets != None:
10852 self.buckets = buckets
10853 else:
10854 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010855 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010856
10857 def pack(self):
10858 packed = []
10859 packed.append(struct.pack("!B", self.version))
10860 packed.append(struct.pack("!B", self.type))
10861 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10862 packed.append(struct.pack("!L", self.xid))
10863 packed.append(struct.pack("!H", self.command))
10864 packed.append(struct.pack("!B", self.group_type))
10865 packed.append('\x00' * 1)
10866 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010867 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010868 length = sum([len(x) for x in packed])
10869 packed[2] = struct.pack("!H", length)
10870 return ''.join(packed)
10871
10872 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010873 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010874 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080010875 _version = reader.read("!B")[0]
10876 assert(_version == 4)
10877 _type = reader.read("!B")[0]
10878 assert(_type == 15)
10879 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010880 orig_reader = reader
10881 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010882 obj.xid = reader.read("!L")[0]
10883 _command = reader.read("!H")[0]
10884 assert(_command == 0)
10885 obj.group_type = reader.read("!B")[0]
10886 reader.skip(1)
10887 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010888 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010889 return obj
10890
10891 def __eq__(self, other):
10892 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010893 if self.xid != other.xid: return False
10894 if self.group_type != other.group_type: return False
10895 if self.group_id != other.group_id: return False
10896 if self.buckets != other.buckets: return False
10897 return True
10898
Rich Lane7b0f2012013-11-22 14:15:26 -080010899 def pretty_print(self, q):
10900 q.text("group_add {")
10901 with q.group():
10902 with q.indent(2):
10903 q.breakable()
10904 q.text("xid = ");
10905 if self.xid != None:
10906 q.text("%#x" % self.xid)
10907 else:
10908 q.text('None')
10909 q.text(","); q.breakable()
10910 q.text("group_type = ");
10911 q.text("%#x" % self.group_type)
10912 q.text(","); q.breakable()
10913 q.text("group_id = ");
10914 q.text("%#x" % self.group_id)
10915 q.text(","); q.breakable()
10916 q.text("buckets = ");
10917 q.pp(self.buckets)
10918 q.breakable()
10919 q.text('}')
10920
Rich Lane7dcdf022013-12-11 14:45:27 -080010921group_mod.subtypes[0] = group_add
10922
10923class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010924 version = 4
10925 type = 15
10926 command = 2
10927
10928 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010929 if xid != None:
10930 self.xid = xid
10931 else:
10932 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010933 if group_type != None:
10934 self.group_type = group_type
10935 else:
10936 self.group_type = 0
10937 if group_id != None:
10938 self.group_id = group_id
10939 else:
10940 self.group_id = 0
10941 if buckets != None:
10942 self.buckets = buckets
10943 else:
10944 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010945 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010946
10947 def pack(self):
10948 packed = []
10949 packed.append(struct.pack("!B", self.version))
10950 packed.append(struct.pack("!B", self.type))
10951 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10952 packed.append(struct.pack("!L", self.xid))
10953 packed.append(struct.pack("!H", self.command))
10954 packed.append(struct.pack("!B", self.group_type))
10955 packed.append('\x00' * 1)
10956 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010957 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010958 length = sum([len(x) for x in packed])
10959 packed[2] = struct.pack("!H", length)
10960 return ''.join(packed)
10961
10962 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010963 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010964 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080010965 _version = reader.read("!B")[0]
10966 assert(_version == 4)
10967 _type = reader.read("!B")[0]
10968 assert(_type == 15)
10969 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010970 orig_reader = reader
10971 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010972 obj.xid = reader.read("!L")[0]
10973 _command = reader.read("!H")[0]
10974 assert(_command == 2)
10975 obj.group_type = reader.read("!B")[0]
10976 reader.skip(1)
10977 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010978 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010979 return obj
10980
10981 def __eq__(self, other):
10982 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010983 if self.xid != other.xid: return False
10984 if self.group_type != other.group_type: return False
10985 if self.group_id != other.group_id: return False
10986 if self.buckets != other.buckets: return False
10987 return True
10988
Rich Lane7b0f2012013-11-22 14:15:26 -080010989 def pretty_print(self, q):
10990 q.text("group_delete {")
10991 with q.group():
10992 with q.indent(2):
10993 q.breakable()
10994 q.text("xid = ");
10995 if self.xid != None:
10996 q.text("%#x" % self.xid)
10997 else:
10998 q.text('None')
10999 q.text(","); q.breakable()
11000 q.text("group_type = ");
11001 q.text("%#x" % self.group_type)
11002 q.text(","); q.breakable()
11003 q.text("group_id = ");
11004 q.text("%#x" % self.group_id)
11005 q.text(","); q.breakable()
11006 q.text("buckets = ");
11007 q.pp(self.buckets)
11008 q.breakable()
11009 q.text('}')
11010
Rich Lane7dcdf022013-12-11 14:45:27 -080011011group_mod.subtypes[2] = group_delete
11012
11013class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011014 version = 4
11015 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011016 stats_type = 7
11017
11018 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011019 if xid != None:
11020 self.xid = xid
11021 else:
11022 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011023 if flags != None:
11024 self.flags = flags
11025 else:
11026 self.flags = 0
11027 if entries != None:
11028 self.entries = entries
11029 else:
11030 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011031 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011032
11033 def pack(self):
11034 packed = []
11035 packed.append(struct.pack("!B", self.version))
11036 packed.append(struct.pack("!B", self.type))
11037 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11038 packed.append(struct.pack("!L", self.xid))
11039 packed.append(struct.pack("!H", self.stats_type))
11040 packed.append(struct.pack("!H", self.flags))
11041 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011042 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011043 length = sum([len(x) for x in packed])
11044 packed[2] = struct.pack("!H", length)
11045 return ''.join(packed)
11046
11047 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011048 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011049 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011050 _version = reader.read("!B")[0]
11051 assert(_version == 4)
11052 _type = reader.read("!B")[0]
11053 assert(_type == 19)
11054 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011055 orig_reader = reader
11056 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011057 obj.xid = reader.read("!L")[0]
11058 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011059 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011060 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011061 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011062 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011063 return obj
11064
11065 def __eq__(self, other):
11066 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011067 if self.xid != other.xid: return False
11068 if self.flags != other.flags: return False
11069 if self.entries != other.entries: return False
11070 return True
11071
Rich Lanec2ee4b82013-04-24 17:12:38 -070011072 def pretty_print(self, q):
11073 q.text("group_desc_stats_reply {")
11074 with q.group():
11075 with q.indent(2):
11076 q.breakable()
11077 q.text("xid = ");
11078 if self.xid != None:
11079 q.text("%#x" % self.xid)
11080 else:
11081 q.text('None')
11082 q.text(","); q.breakable()
11083 q.text("flags = ");
11084 q.text("%#x" % self.flags)
11085 q.text(","); q.breakable()
11086 q.text("entries = ");
11087 q.pp(self.entries)
11088 q.breakable()
11089 q.text('}')
11090
Rich Lane7dcdf022013-12-11 14:45:27 -080011091stats_reply.subtypes[7] = group_desc_stats_reply
11092
11093class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011094 version = 4
11095 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011096 stats_type = 7
11097
11098 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011099 if xid != None:
11100 self.xid = xid
11101 else:
11102 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011103 if flags != None:
11104 self.flags = flags
11105 else:
11106 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011107 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011108
11109 def pack(self):
11110 packed = []
11111 packed.append(struct.pack("!B", self.version))
11112 packed.append(struct.pack("!B", self.type))
11113 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11114 packed.append(struct.pack("!L", self.xid))
11115 packed.append(struct.pack("!H", self.stats_type))
11116 packed.append(struct.pack("!H", self.flags))
11117 packed.append('\x00' * 4)
11118 length = sum([len(x) for x in packed])
11119 packed[2] = struct.pack("!H", length)
11120 return ''.join(packed)
11121
11122 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011123 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011124 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011125 _version = reader.read("!B")[0]
11126 assert(_version == 4)
11127 _type = reader.read("!B")[0]
11128 assert(_type == 18)
11129 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011130 orig_reader = reader
11131 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011132 obj.xid = reader.read("!L")[0]
11133 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011134 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011135 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011136 reader.skip(4)
11137 return obj
11138
11139 def __eq__(self, other):
11140 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011141 if self.xid != other.xid: return False
11142 if self.flags != other.flags: return False
11143 return True
11144
Rich Lanec2ee4b82013-04-24 17:12:38 -070011145 def pretty_print(self, q):
11146 q.text("group_desc_stats_request {")
11147 with q.group():
11148 with q.indent(2):
11149 q.breakable()
11150 q.text("xid = ");
11151 if self.xid != None:
11152 q.text("%#x" % self.xid)
11153 else:
11154 q.text('None')
11155 q.text(","); q.breakable()
11156 q.text("flags = ");
11157 q.text("%#x" % self.flags)
11158 q.breakable()
11159 q.text('}')
11160
Rich Lane7dcdf022013-12-11 14:45:27 -080011161stats_request.subtypes[7] = group_desc_stats_request
11162
11163class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011164 version = 4
11165 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011166 stats_type = 8
11167
11168 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 -080011169 if xid != None:
11170 self.xid = xid
11171 else:
11172 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011173 if flags != None:
11174 self.flags = flags
11175 else:
11176 self.flags = 0
11177 if types != None:
11178 self.types = types
11179 else:
11180 self.types = 0
11181 if capabilities != None:
11182 self.capabilities = capabilities
11183 else:
11184 self.capabilities = 0
11185 if max_groups_all != None:
11186 self.max_groups_all = max_groups_all
11187 else:
11188 self.max_groups_all = 0
11189 if max_groups_select != None:
11190 self.max_groups_select = max_groups_select
11191 else:
11192 self.max_groups_select = 0
11193 if max_groups_indirect != None:
11194 self.max_groups_indirect = max_groups_indirect
11195 else:
11196 self.max_groups_indirect = 0
11197 if max_groups_ff != None:
11198 self.max_groups_ff = max_groups_ff
11199 else:
11200 self.max_groups_ff = 0
11201 if actions_all != None:
11202 self.actions_all = actions_all
11203 else:
11204 self.actions_all = 0
11205 if actions_select != None:
11206 self.actions_select = actions_select
11207 else:
11208 self.actions_select = 0
11209 if actions_indirect != None:
11210 self.actions_indirect = actions_indirect
11211 else:
11212 self.actions_indirect = 0
11213 if actions_ff != None:
11214 self.actions_ff = actions_ff
11215 else:
11216 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011217 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011218
11219 def pack(self):
11220 packed = []
11221 packed.append(struct.pack("!B", self.version))
11222 packed.append(struct.pack("!B", self.type))
11223 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11224 packed.append(struct.pack("!L", self.xid))
11225 packed.append(struct.pack("!H", self.stats_type))
11226 packed.append(struct.pack("!H", self.flags))
11227 packed.append('\x00' * 4)
11228 packed.append(struct.pack("!L", self.types))
11229 packed.append(struct.pack("!L", self.capabilities))
11230 packed.append(struct.pack("!L", self.max_groups_all))
11231 packed.append(struct.pack("!L", self.max_groups_select))
11232 packed.append(struct.pack("!L", self.max_groups_indirect))
11233 packed.append(struct.pack("!L", self.max_groups_ff))
11234 packed.append(struct.pack("!L", self.actions_all))
11235 packed.append(struct.pack("!L", self.actions_select))
11236 packed.append(struct.pack("!L", self.actions_indirect))
11237 packed.append(struct.pack("!L", self.actions_ff))
11238 length = sum([len(x) for x in packed])
11239 packed[2] = struct.pack("!H", length)
11240 return ''.join(packed)
11241
11242 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011243 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011244 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011245 _version = reader.read("!B")[0]
11246 assert(_version == 4)
11247 _type = reader.read("!B")[0]
11248 assert(_type == 19)
11249 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011250 orig_reader = reader
11251 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011252 obj.xid = reader.read("!L")[0]
11253 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011254 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011255 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011256 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011257 obj.types = reader.read("!L")[0]
11258 obj.capabilities = reader.read("!L")[0]
11259 obj.max_groups_all = reader.read("!L")[0]
11260 obj.max_groups_select = reader.read("!L")[0]
11261 obj.max_groups_indirect = reader.read("!L")[0]
11262 obj.max_groups_ff = reader.read("!L")[0]
11263 obj.actions_all = reader.read("!L")[0]
11264 obj.actions_select = reader.read("!L")[0]
11265 obj.actions_indirect = reader.read("!L")[0]
11266 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011267 return obj
11268
11269 def __eq__(self, other):
11270 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011271 if self.xid != other.xid: return False
11272 if self.flags != other.flags: return False
11273 if self.types != other.types: return False
11274 if self.capabilities != other.capabilities: return False
11275 if self.max_groups_all != other.max_groups_all: return False
11276 if self.max_groups_select != other.max_groups_select: return False
11277 if self.max_groups_indirect != other.max_groups_indirect: return False
11278 if self.max_groups_ff != other.max_groups_ff: return False
11279 if self.actions_all != other.actions_all: return False
11280 if self.actions_select != other.actions_select: return False
11281 if self.actions_indirect != other.actions_indirect: return False
11282 if self.actions_ff != other.actions_ff: return False
11283 return True
11284
Rich Lanec2ee4b82013-04-24 17:12:38 -070011285 def pretty_print(self, q):
11286 q.text("group_features_stats_reply {")
11287 with q.group():
11288 with q.indent(2):
11289 q.breakable()
11290 q.text("xid = ");
11291 if self.xid != None:
11292 q.text("%#x" % self.xid)
11293 else:
11294 q.text('None')
11295 q.text(","); q.breakable()
11296 q.text("flags = ");
11297 q.text("%#x" % self.flags)
11298 q.text(","); q.breakable()
11299 q.text("types = ");
11300 q.text("%#x" % self.types)
11301 q.text(","); q.breakable()
11302 q.text("capabilities = ");
11303 q.text("%#x" % self.capabilities)
11304 q.text(","); q.breakable()
11305 q.text("max_groups_all = ");
11306 q.text("%#x" % self.max_groups_all)
11307 q.text(","); q.breakable()
11308 q.text("max_groups_select = ");
11309 q.text("%#x" % self.max_groups_select)
11310 q.text(","); q.breakable()
11311 q.text("max_groups_indirect = ");
11312 q.text("%#x" % self.max_groups_indirect)
11313 q.text(","); q.breakable()
11314 q.text("max_groups_ff = ");
11315 q.text("%#x" % self.max_groups_ff)
11316 q.text(","); q.breakable()
11317 q.text("actions_all = ");
11318 q.text("%#x" % self.actions_all)
11319 q.text(","); q.breakable()
11320 q.text("actions_select = ");
11321 q.text("%#x" % self.actions_select)
11322 q.text(","); q.breakable()
11323 q.text("actions_indirect = ");
11324 q.text("%#x" % self.actions_indirect)
11325 q.text(","); q.breakable()
11326 q.text("actions_ff = ");
11327 q.text("%#x" % self.actions_ff)
11328 q.breakable()
11329 q.text('}')
11330
Rich Lane7dcdf022013-12-11 14:45:27 -080011331stats_reply.subtypes[8] = group_features_stats_reply
11332
11333class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011334 version = 4
11335 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011336 stats_type = 8
11337
11338 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011339 if xid != None:
11340 self.xid = xid
11341 else:
11342 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011343 if flags != None:
11344 self.flags = flags
11345 else:
11346 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011347 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011348
11349 def pack(self):
11350 packed = []
11351 packed.append(struct.pack("!B", self.version))
11352 packed.append(struct.pack("!B", self.type))
11353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11354 packed.append(struct.pack("!L", self.xid))
11355 packed.append(struct.pack("!H", self.stats_type))
11356 packed.append(struct.pack("!H", self.flags))
11357 packed.append('\x00' * 4)
11358 length = sum([len(x) for x in packed])
11359 packed[2] = struct.pack("!H", length)
11360 return ''.join(packed)
11361
11362 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011363 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011364 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011365 _version = reader.read("!B")[0]
11366 assert(_version == 4)
11367 _type = reader.read("!B")[0]
11368 assert(_type == 18)
11369 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011370 orig_reader = reader
11371 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011372 obj.xid = reader.read("!L")[0]
11373 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011374 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011375 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011376 reader.skip(4)
11377 return obj
11378
11379 def __eq__(self, other):
11380 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011381 if self.xid != other.xid: return False
11382 if self.flags != other.flags: return False
11383 return True
11384
Rich Lanec2ee4b82013-04-24 17:12:38 -070011385 def pretty_print(self, q):
11386 q.text("group_features_stats_request {")
11387 with q.group():
11388 with q.indent(2):
11389 q.breakable()
11390 q.text("xid = ");
11391 if self.xid != None:
11392 q.text("%#x" % self.xid)
11393 else:
11394 q.text('None')
11395 q.text(","); q.breakable()
11396 q.text("flags = ");
11397 q.text("%#x" % self.flags)
11398 q.breakable()
11399 q.text('}')
11400
Rich Lane7dcdf022013-12-11 14:45:27 -080011401stats_request.subtypes[8] = group_features_stats_request
11402
11403class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011404 version = 4
11405 type = 1
11406 err_type = 6
11407
11408 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011409 if xid != None:
11410 self.xid = xid
11411 else:
11412 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011413 if code != None:
11414 self.code = code
11415 else:
11416 self.code = 0
11417 if data != None:
11418 self.data = data
11419 else:
11420 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011421 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011422
11423 def pack(self):
11424 packed = []
11425 packed.append(struct.pack("!B", self.version))
11426 packed.append(struct.pack("!B", self.type))
11427 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11428 packed.append(struct.pack("!L", self.xid))
11429 packed.append(struct.pack("!H", self.err_type))
11430 packed.append(struct.pack("!H", self.code))
11431 packed.append(self.data)
11432 length = sum([len(x) for x in packed])
11433 packed[2] = struct.pack("!H", length)
11434 return ''.join(packed)
11435
11436 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011437 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011438 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011439 _version = reader.read("!B")[0]
11440 assert(_version == 4)
11441 _type = reader.read("!B")[0]
11442 assert(_type == 1)
11443 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011444 orig_reader = reader
11445 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011446 obj.xid = reader.read("!L")[0]
11447 _err_type = reader.read("!H")[0]
11448 assert(_err_type == 6)
11449 obj.code = reader.read("!H")[0]
11450 obj.data = str(reader.read_all())
11451 return obj
11452
11453 def __eq__(self, other):
11454 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011455 if self.xid != other.xid: return False
11456 if self.code != other.code: return False
11457 if self.data != other.data: return False
11458 return True
11459
Rich Lane6f4978c2013-10-20 21:33:52 -070011460 def pretty_print(self, q):
11461 q.text("group_mod_failed_error_msg {")
11462 with q.group():
11463 with q.indent(2):
11464 q.breakable()
11465 q.text("xid = ");
11466 if self.xid != None:
11467 q.text("%#x" % self.xid)
11468 else:
11469 q.text('None')
11470 q.text(","); q.breakable()
11471 q.text("code = ");
11472 q.text("%#x" % self.code)
11473 q.text(","); q.breakable()
11474 q.text("data = ");
11475 q.pp(self.data)
11476 q.breakable()
11477 q.text('}')
11478
Rich Lane7dcdf022013-12-11 14:45:27 -080011479error_msg.subtypes[6] = group_mod_failed_error_msg
11480
11481class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011482 version = 4
11483 type = 15
11484 command = 1
11485
11486 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011487 if xid != None:
11488 self.xid = xid
11489 else:
11490 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011491 if group_type != None:
11492 self.group_type = group_type
11493 else:
11494 self.group_type = 0
11495 if group_id != None:
11496 self.group_id = group_id
11497 else:
11498 self.group_id = 0
11499 if buckets != None:
11500 self.buckets = buckets
11501 else:
11502 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011503 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011504
11505 def pack(self):
11506 packed = []
11507 packed.append(struct.pack("!B", self.version))
11508 packed.append(struct.pack("!B", self.type))
11509 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11510 packed.append(struct.pack("!L", self.xid))
11511 packed.append(struct.pack("!H", self.command))
11512 packed.append(struct.pack("!B", self.group_type))
11513 packed.append('\x00' * 1)
11514 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011515 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011516 length = sum([len(x) for x in packed])
11517 packed[2] = struct.pack("!H", length)
11518 return ''.join(packed)
11519
11520 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011521 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011522 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080011523 _version = reader.read("!B")[0]
11524 assert(_version == 4)
11525 _type = reader.read("!B")[0]
11526 assert(_type == 15)
11527 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011528 orig_reader = reader
11529 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080011530 obj.xid = reader.read("!L")[0]
11531 _command = reader.read("!H")[0]
11532 assert(_command == 1)
11533 obj.group_type = reader.read("!B")[0]
11534 reader.skip(1)
11535 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011536 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011537 return obj
11538
11539 def __eq__(self, other):
11540 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011541 if self.xid != other.xid: return False
11542 if self.group_type != other.group_type: return False
11543 if self.group_id != other.group_id: return False
11544 if self.buckets != other.buckets: return False
11545 return True
11546
Rich Lane7b0f2012013-11-22 14:15:26 -080011547 def pretty_print(self, q):
11548 q.text("group_modify {")
11549 with q.group():
11550 with q.indent(2):
11551 q.breakable()
11552 q.text("xid = ");
11553 if self.xid != None:
11554 q.text("%#x" % self.xid)
11555 else:
11556 q.text('None')
11557 q.text(","); q.breakable()
11558 q.text("group_type = ");
11559 q.text("%#x" % self.group_type)
11560 q.text(","); q.breakable()
11561 q.text("group_id = ");
11562 q.text("%#x" % self.group_id)
11563 q.text(","); q.breakable()
11564 q.text("buckets = ");
11565 q.pp(self.buckets)
11566 q.breakable()
11567 q.text('}')
11568
Rich Lane7dcdf022013-12-11 14:45:27 -080011569group_mod.subtypes[1] = group_modify
11570
11571class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011572 version = 4
11573 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011574 stats_type = 6
11575
11576 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011577 if xid != None:
11578 self.xid = xid
11579 else:
11580 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011581 if flags != None:
11582 self.flags = flags
11583 else:
11584 self.flags = 0
11585 if entries != None:
11586 self.entries = entries
11587 else:
11588 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011589 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011590
11591 def pack(self):
11592 packed = []
11593 packed.append(struct.pack("!B", self.version))
11594 packed.append(struct.pack("!B", self.type))
11595 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11596 packed.append(struct.pack("!L", self.xid))
11597 packed.append(struct.pack("!H", self.stats_type))
11598 packed.append(struct.pack("!H", self.flags))
11599 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011600 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011601 length = sum([len(x) for x in packed])
11602 packed[2] = struct.pack("!H", length)
11603 return ''.join(packed)
11604
11605 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011606 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011607 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011608 _version = reader.read("!B")[0]
11609 assert(_version == 4)
11610 _type = reader.read("!B")[0]
11611 assert(_type == 19)
11612 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011613 orig_reader = reader
11614 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011615 obj.xid = reader.read("!L")[0]
11616 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011617 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070011618 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011619 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011620 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011621 return obj
11622
11623 def __eq__(self, other):
11624 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011625 if self.xid != other.xid: return False
11626 if self.flags != other.flags: return False
11627 if self.entries != other.entries: return False
11628 return True
11629
Rich Lanec2ee4b82013-04-24 17:12:38 -070011630 def pretty_print(self, q):
11631 q.text("group_stats_reply {")
11632 with q.group():
11633 with q.indent(2):
11634 q.breakable()
11635 q.text("xid = ");
11636 if self.xid != None:
11637 q.text("%#x" % self.xid)
11638 else:
11639 q.text('None')
11640 q.text(","); q.breakable()
11641 q.text("flags = ");
11642 q.text("%#x" % self.flags)
11643 q.text(","); q.breakable()
11644 q.text("entries = ");
11645 q.pp(self.entries)
11646 q.breakable()
11647 q.text('}')
11648
Rich Lane7dcdf022013-12-11 14:45:27 -080011649stats_reply.subtypes[6] = group_stats_reply
11650
11651class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011652 version = 4
11653 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011654 stats_type = 6
11655
11656 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011657 if xid != None:
11658 self.xid = xid
11659 else:
11660 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011661 if flags != None:
11662 self.flags = flags
11663 else:
11664 self.flags = 0
11665 if group_id != None:
11666 self.group_id = group_id
11667 else:
11668 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011669 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011670
11671 def pack(self):
11672 packed = []
11673 packed.append(struct.pack("!B", self.version))
11674 packed.append(struct.pack("!B", self.type))
11675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11676 packed.append(struct.pack("!L", self.xid))
11677 packed.append(struct.pack("!H", self.stats_type))
11678 packed.append(struct.pack("!H", self.flags))
11679 packed.append('\x00' * 4)
11680 packed.append(struct.pack("!L", self.group_id))
11681 packed.append('\x00' * 4)
11682 length = sum([len(x) for x in packed])
11683 packed[2] = struct.pack("!H", length)
11684 return ''.join(packed)
11685
11686 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011687 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011688 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011689 _version = reader.read("!B")[0]
11690 assert(_version == 4)
11691 _type = reader.read("!B")[0]
11692 assert(_type == 18)
11693 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011694 orig_reader = reader
11695 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011696 obj.xid = reader.read("!L")[0]
11697 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011698 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070011699 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011700 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011701 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011702 reader.skip(4)
11703 return obj
11704
11705 def __eq__(self, other):
11706 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011707 if self.xid != other.xid: return False
11708 if self.flags != other.flags: return False
11709 if self.group_id != other.group_id: return False
11710 return True
11711
Rich Lanec2ee4b82013-04-24 17:12:38 -070011712 def pretty_print(self, q):
11713 q.text("group_stats_request {")
11714 with q.group():
11715 with q.indent(2):
11716 q.breakable()
11717 q.text("xid = ");
11718 if self.xid != None:
11719 q.text("%#x" % self.xid)
11720 else:
11721 q.text('None')
11722 q.text(","); q.breakable()
11723 q.text("flags = ");
11724 q.text("%#x" % self.flags)
11725 q.text(","); q.breakable()
11726 q.text("group_id = ");
11727 q.text("%#x" % self.group_id)
11728 q.breakable()
11729 q.text('}')
11730
Rich Lane7dcdf022013-12-11 14:45:27 -080011731stats_request.subtypes[6] = group_stats_request
11732
11733class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011734 version = 4
11735 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070011736
11737 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011738 if xid != None:
11739 self.xid = xid
11740 else:
11741 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011742 if elements != None:
11743 self.elements = elements
11744 else:
11745 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011746 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011747
11748 def pack(self):
11749 packed = []
11750 packed.append(struct.pack("!B", self.version))
11751 packed.append(struct.pack("!B", self.type))
11752 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11753 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080011754 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011755 length = sum([len(x) for x in packed])
11756 packed[2] = struct.pack("!H", length)
11757 return ''.join(packed)
11758
11759 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011760 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011761 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070011762 _version = reader.read("!B")[0]
11763 assert(_version == 4)
11764 _type = reader.read("!B")[0]
11765 assert(_type == 0)
11766 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011767 orig_reader = reader
11768 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011769 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080011770 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011771 return obj
11772
11773 def __eq__(self, other):
11774 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011775 if self.xid != other.xid: return False
11776 if self.elements != other.elements: return False
11777 return True
11778
Rich Lanec2ee4b82013-04-24 17:12:38 -070011779 def pretty_print(self, q):
11780 q.text("hello {")
11781 with q.group():
11782 with q.indent(2):
11783 q.breakable()
11784 q.text("xid = ");
11785 if self.xid != None:
11786 q.text("%#x" % self.xid)
11787 else:
11788 q.text('None')
11789 q.text(","); q.breakable()
11790 q.text("elements = ");
11791 q.pp(self.elements)
11792 q.breakable()
11793 q.text('}')
11794
Rich Lane7dcdf022013-12-11 14:45:27 -080011795message.subtypes[0] = hello
11796
11797class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011798 version = 4
11799 type = 1
11800 err_type = 0
11801
11802 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011803 if xid != None:
11804 self.xid = xid
11805 else:
11806 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011807 if code != None:
11808 self.code = code
11809 else:
11810 self.code = 0
11811 if data != None:
11812 self.data = data
11813 else:
11814 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011815 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011816
11817 def pack(self):
11818 packed = []
11819 packed.append(struct.pack("!B", self.version))
11820 packed.append(struct.pack("!B", self.type))
11821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11822 packed.append(struct.pack("!L", self.xid))
11823 packed.append(struct.pack("!H", self.err_type))
11824 packed.append(struct.pack("!H", self.code))
11825 packed.append(self.data)
11826 length = sum([len(x) for x in packed])
11827 packed[2] = struct.pack("!H", length)
11828 return ''.join(packed)
11829
11830 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011831 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011832 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011833 _version = reader.read("!B")[0]
11834 assert(_version == 4)
11835 _type = reader.read("!B")[0]
11836 assert(_type == 1)
11837 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011838 orig_reader = reader
11839 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011840 obj.xid = reader.read("!L")[0]
11841 _err_type = reader.read("!H")[0]
11842 assert(_err_type == 0)
11843 obj.code = reader.read("!H")[0]
11844 obj.data = str(reader.read_all())
11845 return obj
11846
11847 def __eq__(self, other):
11848 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011849 if self.xid != other.xid: return False
11850 if self.code != other.code: return False
11851 if self.data != other.data: return False
11852 return True
11853
Rich Lane6f4978c2013-10-20 21:33:52 -070011854 def pretty_print(self, q):
11855 q.text("hello_failed_error_msg {")
11856 with q.group():
11857 with q.indent(2):
11858 q.breakable()
11859 q.text("xid = ");
11860 if self.xid != None:
11861 q.text("%#x" % self.xid)
11862 else:
11863 q.text('None')
11864 q.text(","); q.breakable()
11865 q.text("code = ");
11866 q.text("%#x" % self.code)
11867 q.text(","); q.breakable()
11868 q.text("data = ");
11869 q.pp(self.data)
11870 q.breakable()
11871 q.text('}')
11872
Rich Lane7dcdf022013-12-11 14:45:27 -080011873error_msg.subtypes[0] = hello_failed_error_msg
11874
11875class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011876 version = 4
11877 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011878 stats_type = 10
11879
11880 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011881 if xid != None:
11882 self.xid = xid
11883 else:
11884 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011885 if flags != None:
11886 self.flags = flags
11887 else:
11888 self.flags = 0
11889 if entries != None:
11890 self.entries = entries
11891 else:
11892 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011893 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011894
11895 def pack(self):
11896 packed = []
11897 packed.append(struct.pack("!B", self.version))
11898 packed.append(struct.pack("!B", self.type))
11899 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11900 packed.append(struct.pack("!L", self.xid))
11901 packed.append(struct.pack("!H", self.stats_type))
11902 packed.append(struct.pack("!H", self.flags))
11903 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011904 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011905 length = sum([len(x) for x in packed])
11906 packed[2] = struct.pack("!H", length)
11907 return ''.join(packed)
11908
11909 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011910 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011911 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011912 _version = reader.read("!B")[0]
11913 assert(_version == 4)
11914 _type = reader.read("!B")[0]
11915 assert(_type == 19)
11916 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011917 orig_reader = reader
11918 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011919 obj.xid = reader.read("!L")[0]
11920 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011921 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070011922 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011923 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011924 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011925 return obj
11926
11927 def __eq__(self, other):
11928 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011929 if self.xid != other.xid: return False
11930 if self.flags != other.flags: return False
11931 if self.entries != other.entries: return False
11932 return True
11933
Rich Lanec2ee4b82013-04-24 17:12:38 -070011934 def pretty_print(self, q):
11935 q.text("meter_config_stats_reply {")
11936 with q.group():
11937 with q.indent(2):
11938 q.breakable()
11939 q.text("xid = ");
11940 if self.xid != None:
11941 q.text("%#x" % self.xid)
11942 else:
11943 q.text('None')
11944 q.text(","); q.breakable()
11945 q.text("flags = ");
11946 q.text("%#x" % self.flags)
11947 q.text(","); q.breakable()
11948 q.text("entries = ");
11949 q.pp(self.entries)
11950 q.breakable()
11951 q.text('}')
11952
Rich Lane7dcdf022013-12-11 14:45:27 -080011953stats_reply.subtypes[10] = meter_config_stats_reply
11954
11955class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011956 version = 4
11957 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011958 stats_type = 10
11959
11960 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011961 if xid != None:
11962 self.xid = xid
11963 else:
11964 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011965 if flags != None:
11966 self.flags = flags
11967 else:
11968 self.flags = 0
11969 if meter_id != None:
11970 self.meter_id = meter_id
11971 else:
11972 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011973 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011974
11975 def pack(self):
11976 packed = []
11977 packed.append(struct.pack("!B", self.version))
11978 packed.append(struct.pack("!B", self.type))
11979 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11980 packed.append(struct.pack("!L", self.xid))
11981 packed.append(struct.pack("!H", self.stats_type))
11982 packed.append(struct.pack("!H", self.flags))
11983 packed.append('\x00' * 4)
11984 packed.append(struct.pack("!L", self.meter_id))
11985 packed.append('\x00' * 4)
11986 length = sum([len(x) for x in packed])
11987 packed[2] = struct.pack("!H", length)
11988 return ''.join(packed)
11989
11990 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011991 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011992 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011993 _version = reader.read("!B")[0]
11994 assert(_version == 4)
11995 _type = reader.read("!B")[0]
11996 assert(_type == 18)
11997 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011998 orig_reader = reader
11999 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012000 obj.xid = reader.read("!L")[0]
12001 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012002 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012003 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012004 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012005 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012006 reader.skip(4)
12007 return obj
12008
12009 def __eq__(self, other):
12010 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012011 if self.xid != other.xid: return False
12012 if self.flags != other.flags: return False
12013 if self.meter_id != other.meter_id: return False
12014 return True
12015
Rich Lanec2ee4b82013-04-24 17:12:38 -070012016 def pretty_print(self, q):
12017 q.text("meter_config_stats_request {")
12018 with q.group():
12019 with q.indent(2):
12020 q.breakable()
12021 q.text("xid = ");
12022 if self.xid != None:
12023 q.text("%#x" % self.xid)
12024 else:
12025 q.text('None')
12026 q.text(","); q.breakable()
12027 q.text("flags = ");
12028 q.text("%#x" % self.flags)
12029 q.text(","); q.breakable()
12030 q.text("meter_id = ");
12031 q.text("%#x" % self.meter_id)
12032 q.breakable()
12033 q.text('}')
12034
Rich Lane7dcdf022013-12-11 14:45:27 -080012035stats_request.subtypes[10] = meter_config_stats_request
12036
12037class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012038 version = 4
12039 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012040 stats_type = 11
12041
12042 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012043 if xid != None:
12044 self.xid = xid
12045 else:
12046 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012047 if flags != None:
12048 self.flags = flags
12049 else:
12050 self.flags = 0
12051 if features != None:
12052 self.features = features
12053 else:
12054 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080012055 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012056
12057 def pack(self):
12058 packed = []
12059 packed.append(struct.pack("!B", self.version))
12060 packed.append(struct.pack("!B", self.type))
12061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12062 packed.append(struct.pack("!L", self.xid))
12063 packed.append(struct.pack("!H", self.stats_type))
12064 packed.append(struct.pack("!H", self.flags))
12065 packed.append('\x00' * 4)
12066 packed.append(self.features.pack())
12067 length = sum([len(x) for x in packed])
12068 packed[2] = struct.pack("!H", length)
12069 return ''.join(packed)
12070
12071 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012072 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012073 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012074 _version = reader.read("!B")[0]
12075 assert(_version == 4)
12076 _type = reader.read("!B")[0]
12077 assert(_type == 19)
12078 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012079 orig_reader = reader
12080 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012081 obj.xid = reader.read("!L")[0]
12082 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012083 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012084 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012085 reader.skip(4)
12086 obj.features = common.meter_features.unpack(reader)
12087 return obj
12088
12089 def __eq__(self, other):
12090 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012091 if self.xid != other.xid: return False
12092 if self.flags != other.flags: return False
12093 if self.features != other.features: return False
12094 return True
12095
Rich Lanec2ee4b82013-04-24 17:12:38 -070012096 def pretty_print(self, q):
12097 q.text("meter_features_stats_reply {")
12098 with q.group():
12099 with q.indent(2):
12100 q.breakable()
12101 q.text("xid = ");
12102 if self.xid != None:
12103 q.text("%#x" % self.xid)
12104 else:
12105 q.text('None')
12106 q.text(","); q.breakable()
12107 q.text("flags = ");
12108 q.text("%#x" % self.flags)
12109 q.text(","); q.breakable()
12110 q.text("features = ");
12111 q.pp(self.features)
12112 q.breakable()
12113 q.text('}')
12114
Rich Lane7dcdf022013-12-11 14:45:27 -080012115stats_reply.subtypes[11] = meter_features_stats_reply
12116
12117class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012118 version = 4
12119 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012120 stats_type = 11
12121
12122 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012123 if xid != None:
12124 self.xid = xid
12125 else:
12126 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012127 if flags != None:
12128 self.flags = flags
12129 else:
12130 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012131 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012132
12133 def pack(self):
12134 packed = []
12135 packed.append(struct.pack("!B", self.version))
12136 packed.append(struct.pack("!B", self.type))
12137 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12138 packed.append(struct.pack("!L", self.xid))
12139 packed.append(struct.pack("!H", self.stats_type))
12140 packed.append(struct.pack("!H", self.flags))
12141 packed.append('\x00' * 4)
12142 length = sum([len(x) for x in packed])
12143 packed[2] = struct.pack("!H", length)
12144 return ''.join(packed)
12145
12146 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012147 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012148 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012149 _version = reader.read("!B")[0]
12150 assert(_version == 4)
12151 _type = reader.read("!B")[0]
12152 assert(_type == 18)
12153 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012154 orig_reader = reader
12155 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012156 obj.xid = reader.read("!L")[0]
12157 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012158 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012159 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012160 reader.skip(4)
12161 return obj
12162
12163 def __eq__(self, other):
12164 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012165 if self.xid != other.xid: return False
12166 if self.flags != other.flags: return False
12167 return True
12168
Rich Lanec2ee4b82013-04-24 17:12:38 -070012169 def pretty_print(self, q):
12170 q.text("meter_features_stats_request {")
12171 with q.group():
12172 with q.indent(2):
12173 q.breakable()
12174 q.text("xid = ");
12175 if self.xid != None:
12176 q.text("%#x" % self.xid)
12177 else:
12178 q.text('None')
12179 q.text(","); q.breakable()
12180 q.text("flags = ");
12181 q.text("%#x" % self.flags)
12182 q.breakable()
12183 q.text('}')
12184
Rich Lane7dcdf022013-12-11 14:45:27 -080012185stats_request.subtypes[11] = meter_features_stats_request
12186
12187class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012188 version = 4
12189 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070012190
12191 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012192 if xid != None:
12193 self.xid = xid
12194 else:
12195 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012196 if command != None:
12197 self.command = command
12198 else:
12199 self.command = 0
12200 if flags != None:
12201 self.flags = flags
12202 else:
12203 self.flags = 0
12204 if meter_id != None:
12205 self.meter_id = meter_id
12206 else:
12207 self.meter_id = 0
12208 if meters != None:
12209 self.meters = meters
12210 else:
12211 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012212 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012213
12214 def pack(self):
12215 packed = []
12216 packed.append(struct.pack("!B", self.version))
12217 packed.append(struct.pack("!B", self.type))
12218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12219 packed.append(struct.pack("!L", self.xid))
12220 packed.append(struct.pack("!H", self.command))
12221 packed.append(struct.pack("!H", self.flags))
12222 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012223 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012224 length = sum([len(x) for x in packed])
12225 packed[2] = struct.pack("!H", length)
12226 return ''.join(packed)
12227
12228 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012229 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012230 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012231 _version = reader.read("!B")[0]
12232 assert(_version == 4)
12233 _type = reader.read("!B")[0]
12234 assert(_type == 29)
12235 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012236 orig_reader = reader
12237 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012238 obj.xid = reader.read("!L")[0]
12239 obj.command = reader.read("!H")[0]
12240 obj.flags = reader.read("!H")[0]
12241 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012242 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012243 return obj
12244
12245 def __eq__(self, other):
12246 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012247 if self.xid != other.xid: return False
12248 if self.command != other.command: return False
12249 if self.flags != other.flags: return False
12250 if self.meter_id != other.meter_id: return False
12251 if self.meters != other.meters: return False
12252 return True
12253
Rich Lanec2ee4b82013-04-24 17:12:38 -070012254 def pretty_print(self, q):
12255 q.text("meter_mod {")
12256 with q.group():
12257 with q.indent(2):
12258 q.breakable()
12259 q.text("xid = ");
12260 if self.xid != None:
12261 q.text("%#x" % self.xid)
12262 else:
12263 q.text('None')
12264 q.text(","); q.breakable()
12265 q.text("command = ");
12266 q.text("%#x" % self.command)
12267 q.text(","); q.breakable()
12268 q.text("flags = ");
12269 q.text("%#x" % self.flags)
12270 q.text(","); q.breakable()
12271 q.text("meter_id = ");
12272 q.text("%#x" % self.meter_id)
12273 q.text(","); q.breakable()
12274 q.text("meters = ");
12275 q.pp(self.meters)
12276 q.breakable()
12277 q.text('}')
12278
Rich Lane7dcdf022013-12-11 14:45:27 -080012279message.subtypes[29] = meter_mod
12280
12281class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012282 version = 4
12283 type = 1
12284 err_type = 12
12285
12286 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012287 if xid != None:
12288 self.xid = xid
12289 else:
12290 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012291 if code != None:
12292 self.code = code
12293 else:
12294 self.code = 0
12295 if data != None:
12296 self.data = data
12297 else:
12298 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012299 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012300
12301 def pack(self):
12302 packed = []
12303 packed.append(struct.pack("!B", self.version))
12304 packed.append(struct.pack("!B", self.type))
12305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12306 packed.append(struct.pack("!L", self.xid))
12307 packed.append(struct.pack("!H", self.err_type))
12308 packed.append(struct.pack("!H", self.code))
12309 packed.append(self.data)
12310 length = sum([len(x) for x in packed])
12311 packed[2] = struct.pack("!H", length)
12312 return ''.join(packed)
12313
12314 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012315 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012316 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012317 _version = reader.read("!B")[0]
12318 assert(_version == 4)
12319 _type = reader.read("!B")[0]
12320 assert(_type == 1)
12321 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012322 orig_reader = reader
12323 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012324 obj.xid = reader.read("!L")[0]
12325 _err_type = reader.read("!H")[0]
12326 assert(_err_type == 12)
12327 obj.code = reader.read("!H")[0]
12328 obj.data = str(reader.read_all())
12329 return obj
12330
12331 def __eq__(self, other):
12332 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012333 if self.xid != other.xid: return False
12334 if self.code != other.code: return False
12335 if self.data != other.data: return False
12336 return True
12337
Rich Lane6f4978c2013-10-20 21:33:52 -070012338 def pretty_print(self, q):
12339 q.text("meter_mod_failed_error_msg {")
12340 with q.group():
12341 with q.indent(2):
12342 q.breakable()
12343 q.text("xid = ");
12344 if self.xid != None:
12345 q.text("%#x" % self.xid)
12346 else:
12347 q.text('None')
12348 q.text(","); q.breakable()
12349 q.text("code = ");
12350 q.text("%#x" % self.code)
12351 q.text(","); q.breakable()
12352 q.text("data = ");
12353 q.pp(self.data)
12354 q.breakable()
12355 q.text('}')
12356
Rich Lane7dcdf022013-12-11 14:45:27 -080012357error_msg.subtypes[12] = meter_mod_failed_error_msg
12358
12359class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012360 version = 4
12361 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012362 stats_type = 9
12363
12364 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012365 if xid != None:
12366 self.xid = xid
12367 else:
12368 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012369 if flags != None:
12370 self.flags = flags
12371 else:
12372 self.flags = 0
12373 if entries != None:
12374 self.entries = entries
12375 else:
12376 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012377 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012378
12379 def pack(self):
12380 packed = []
12381 packed.append(struct.pack("!B", self.version))
12382 packed.append(struct.pack("!B", self.type))
12383 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12384 packed.append(struct.pack("!L", self.xid))
12385 packed.append(struct.pack("!H", self.stats_type))
12386 packed.append(struct.pack("!H", self.flags))
12387 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012388 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012389 length = sum([len(x) for x in packed])
12390 packed[2] = struct.pack("!H", length)
12391 return ''.join(packed)
12392
12393 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012394 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012395 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012396 _version = reader.read("!B")[0]
12397 assert(_version == 4)
12398 _type = reader.read("!B")[0]
12399 assert(_type == 19)
12400 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012401 orig_reader = reader
12402 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012403 obj.xid = reader.read("!L")[0]
12404 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012405 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012406 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012407 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012408 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012409 return obj
12410
12411 def __eq__(self, other):
12412 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012413 if self.xid != other.xid: return False
12414 if self.flags != other.flags: return False
12415 if self.entries != other.entries: return False
12416 return True
12417
Rich Lanec2ee4b82013-04-24 17:12:38 -070012418 def pretty_print(self, q):
12419 q.text("meter_stats_reply {")
12420 with q.group():
12421 with q.indent(2):
12422 q.breakable()
12423 q.text("xid = ");
12424 if self.xid != None:
12425 q.text("%#x" % self.xid)
12426 else:
12427 q.text('None')
12428 q.text(","); q.breakable()
12429 q.text("flags = ");
12430 q.text("%#x" % self.flags)
12431 q.text(","); q.breakable()
12432 q.text("entries = ");
12433 q.pp(self.entries)
12434 q.breakable()
12435 q.text('}')
12436
Rich Lane7dcdf022013-12-11 14:45:27 -080012437stats_reply.subtypes[9] = meter_stats_reply
12438
12439class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012440 version = 4
12441 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012442 stats_type = 9
12443
12444 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012445 if xid != None:
12446 self.xid = xid
12447 else:
12448 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012449 if flags != None:
12450 self.flags = flags
12451 else:
12452 self.flags = 0
12453 if meter_id != None:
12454 self.meter_id = meter_id
12455 else:
12456 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012457 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012458
12459 def pack(self):
12460 packed = []
12461 packed.append(struct.pack("!B", self.version))
12462 packed.append(struct.pack("!B", self.type))
12463 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12464 packed.append(struct.pack("!L", self.xid))
12465 packed.append(struct.pack("!H", self.stats_type))
12466 packed.append(struct.pack("!H", self.flags))
12467 packed.append('\x00' * 4)
12468 packed.append(struct.pack("!L", self.meter_id))
12469 packed.append('\x00' * 4)
12470 length = sum([len(x) for x in packed])
12471 packed[2] = struct.pack("!H", length)
12472 return ''.join(packed)
12473
12474 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012475 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012476 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012477 _version = reader.read("!B")[0]
12478 assert(_version == 4)
12479 _type = reader.read("!B")[0]
12480 assert(_type == 18)
12481 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012482 orig_reader = reader
12483 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012484 obj.xid = reader.read("!L")[0]
12485 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012486 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012487 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012488 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012489 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012490 reader.skip(4)
12491 return obj
12492
12493 def __eq__(self, other):
12494 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012495 if self.xid != other.xid: return False
12496 if self.flags != other.flags: return False
12497 if self.meter_id != other.meter_id: return False
12498 return True
12499
Rich Lanec2ee4b82013-04-24 17:12:38 -070012500 def pretty_print(self, q):
12501 q.text("meter_stats_request {")
12502 with q.group():
12503 with q.indent(2):
12504 q.breakable()
12505 q.text("xid = ");
12506 if self.xid != None:
12507 q.text("%#x" % self.xid)
12508 else:
12509 q.text('None')
12510 q.text(","); q.breakable()
12511 q.text("flags = ");
12512 q.text("%#x" % self.flags)
12513 q.text(","); q.breakable()
12514 q.text("meter_id = ");
12515 q.text("%#x" % self.meter_id)
12516 q.breakable()
12517 q.text('}')
12518
Rich Lane7dcdf022013-12-11 14:45:27 -080012519stats_request.subtypes[9] = meter_stats_request
12520
12521class nicira_header(experimenter):
12522 subtypes = {}
12523
Rich Lane95f7fc92014-01-27 17:08:16 -080012524 version = 4
12525 type = 4
12526 experimenter = 8992
12527
12528 def __init__(self, xid=None, subtype=None):
12529 if xid != None:
12530 self.xid = xid
12531 else:
12532 self.xid = None
12533 if subtype != None:
12534 self.subtype = subtype
12535 else:
12536 self.subtype = 0
12537 return
12538
12539 def pack(self):
12540 packed = []
12541 packed.append(struct.pack("!B", self.version))
12542 packed.append(struct.pack("!B", self.type))
12543 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12544 packed.append(struct.pack("!L", self.xid))
12545 packed.append(struct.pack("!L", self.experimenter))
12546 packed.append(struct.pack("!L", self.subtype))
12547 length = sum([len(x) for x in packed])
12548 packed[2] = struct.pack("!H", length)
12549 return ''.join(packed)
12550
Rich Lane7dcdf022013-12-11 14:45:27 -080012551 @staticmethod
12552 def unpack(reader):
12553 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080012554 subclass = nicira_header.subtypes.get(subtype)
12555 if subclass:
12556 return subclass.unpack(reader)
12557
12558 obj = nicira_header()
12559 _version = reader.read("!B")[0]
12560 assert(_version == 4)
12561 _type = reader.read("!B")[0]
12562 assert(_type == 4)
12563 _length = reader.read("!H")[0]
12564 orig_reader = reader
12565 reader = orig_reader.slice(_length - (2 + 2))
12566 obj.xid = reader.read("!L")[0]
12567 _experimenter = reader.read("!L")[0]
12568 assert(_experimenter == 8992)
12569 obj.subtype = reader.read("!L")[0]
12570 return obj
12571
12572 def __eq__(self, other):
12573 if type(self) != type(other): return False
12574 if self.xid != other.xid: return False
12575 if self.subtype != other.subtype: return False
12576 return True
12577
12578 def pretty_print(self, q):
12579 q.text("nicira_header {")
12580 with q.group():
12581 with q.indent(2):
12582 q.breakable()
12583 q.text("xid = ");
12584 if self.xid != None:
12585 q.text("%#x" % self.xid)
12586 else:
12587 q.text('None')
12588 q.breakable()
12589 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080012590
12591experimenter.subtypes[8992] = nicira_header
12592
12593class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012594 version = 4
12595 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070012596
12597 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 -080012598 if xid != None:
12599 self.xid = xid
12600 else:
12601 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012602 if buffer_id != None:
12603 self.buffer_id = buffer_id
12604 else:
12605 self.buffer_id = 0
12606 if total_len != None:
12607 self.total_len = total_len
12608 else:
12609 self.total_len = 0
12610 if reason != None:
12611 self.reason = reason
12612 else:
12613 self.reason = 0
12614 if table_id != None:
12615 self.table_id = table_id
12616 else:
12617 self.table_id = 0
12618 if cookie != None:
12619 self.cookie = cookie
12620 else:
12621 self.cookie = 0
12622 if match != None:
12623 self.match = match
12624 else:
12625 self.match = common.match()
12626 if data != None:
12627 self.data = data
12628 else:
Dan Talaycof6202252013-07-02 01:00:29 -070012629 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012630 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012631
12632 def pack(self):
12633 packed = []
12634 packed.append(struct.pack("!B", self.version))
12635 packed.append(struct.pack("!B", self.type))
12636 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12637 packed.append(struct.pack("!L", self.xid))
12638 packed.append(struct.pack("!L", self.buffer_id))
12639 packed.append(struct.pack("!H", self.total_len))
12640 packed.append(struct.pack("!B", self.reason))
12641 packed.append(struct.pack("!B", self.table_id))
12642 packed.append(struct.pack("!Q", self.cookie))
12643 packed.append(self.match.pack())
12644 packed.append('\x00' * 2)
12645 packed.append(self.data)
12646 length = sum([len(x) for x in packed])
12647 packed[2] = struct.pack("!H", length)
12648 return ''.join(packed)
12649
12650 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012651 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012652 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070012653 _version = reader.read("!B")[0]
12654 assert(_version == 4)
12655 _type = reader.read("!B")[0]
12656 assert(_type == 10)
12657 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012658 orig_reader = reader
12659 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012660 obj.xid = reader.read("!L")[0]
12661 obj.buffer_id = reader.read("!L")[0]
12662 obj.total_len = reader.read("!H")[0]
12663 obj.reason = reader.read("!B")[0]
12664 obj.table_id = reader.read("!B")[0]
12665 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012666 obj.match = common.match.unpack(reader)
12667 reader.skip(2)
12668 obj.data = str(reader.read_all())
12669 return obj
12670
12671 def __eq__(self, other):
12672 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012673 if self.xid != other.xid: return False
12674 if self.buffer_id != other.buffer_id: return False
12675 if self.total_len != other.total_len: return False
12676 if self.reason != other.reason: return False
12677 if self.table_id != other.table_id: return False
12678 if self.cookie != other.cookie: return False
12679 if self.match != other.match: return False
12680 if self.data != other.data: return False
12681 return True
12682
Rich Lanec2ee4b82013-04-24 17:12:38 -070012683 def pretty_print(self, q):
12684 q.text("packet_in {")
12685 with q.group():
12686 with q.indent(2):
12687 q.breakable()
12688 q.text("xid = ");
12689 if self.xid != None:
12690 q.text("%#x" % self.xid)
12691 else:
12692 q.text('None')
12693 q.text(","); q.breakable()
12694 q.text("buffer_id = ");
12695 q.text("%#x" % self.buffer_id)
12696 q.text(","); q.breakable()
12697 q.text("total_len = ");
12698 q.text("%#x" % self.total_len)
12699 q.text(","); q.breakable()
12700 q.text("reason = ");
12701 q.text("%#x" % self.reason)
12702 q.text(","); q.breakable()
12703 q.text("table_id = ");
12704 q.text("%#x" % self.table_id)
12705 q.text(","); q.breakable()
12706 q.text("cookie = ");
12707 q.text("%#x" % self.cookie)
12708 q.text(","); q.breakable()
12709 q.text("match = ");
12710 q.pp(self.match)
12711 q.text(","); q.breakable()
12712 q.text("data = ");
12713 q.pp(self.data)
12714 q.breakable()
12715 q.text('}')
12716
Rich Lane7dcdf022013-12-11 14:45:27 -080012717message.subtypes[10] = packet_in
12718
12719class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012720 version = 4
12721 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070012722
12723 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012724 if xid != None:
12725 self.xid = xid
12726 else:
12727 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012728 if buffer_id != None:
12729 self.buffer_id = buffer_id
12730 else:
12731 self.buffer_id = 0
12732 if in_port != None:
12733 self.in_port = in_port
12734 else:
12735 self.in_port = 0
12736 if actions != None:
12737 self.actions = actions
12738 else:
12739 self.actions = []
12740 if data != None:
12741 self.data = data
12742 else:
Dan Talaycof6202252013-07-02 01:00:29 -070012743 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012744 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012745
12746 def pack(self):
12747 packed = []
12748 packed.append(struct.pack("!B", self.version))
12749 packed.append(struct.pack("!B", self.type))
12750 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12751 packed.append(struct.pack("!L", self.xid))
12752 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070012753 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012754 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
12755 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080012756 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012757 packed[6] = struct.pack("!H", len(packed[-1]))
12758 packed.append(self.data)
12759 length = sum([len(x) for x in packed])
12760 packed[2] = struct.pack("!H", length)
12761 return ''.join(packed)
12762
12763 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012764 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012765 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070012766 _version = reader.read("!B")[0]
12767 assert(_version == 4)
12768 _type = reader.read("!B")[0]
12769 assert(_type == 13)
12770 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012771 orig_reader = reader
12772 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012773 obj.xid = reader.read("!L")[0]
12774 obj.buffer_id = reader.read("!L")[0]
12775 obj.in_port = util.unpack_port_no(reader)
12776 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012777 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080012778 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012779 obj.data = str(reader.read_all())
12780 return obj
12781
12782 def __eq__(self, other):
12783 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012784 if self.xid != other.xid: return False
12785 if self.buffer_id != other.buffer_id: return False
12786 if self.in_port != other.in_port: return False
12787 if self.actions != other.actions: return False
12788 if self.data != other.data: return False
12789 return True
12790
Rich Lanec2ee4b82013-04-24 17:12:38 -070012791 def pretty_print(self, q):
12792 q.text("packet_out {")
12793 with q.group():
12794 with q.indent(2):
12795 q.breakable()
12796 q.text("xid = ");
12797 if self.xid != None:
12798 q.text("%#x" % self.xid)
12799 else:
12800 q.text('None')
12801 q.text(","); q.breakable()
12802 q.text("buffer_id = ");
12803 q.text("%#x" % self.buffer_id)
12804 q.text(","); q.breakable()
12805 q.text("in_port = ");
12806 q.text(util.pretty_port(self.in_port))
12807 q.text(","); q.breakable()
12808 q.text("actions = ");
12809 q.pp(self.actions)
12810 q.text(","); q.breakable()
12811 q.text("data = ");
12812 q.pp(self.data)
12813 q.breakable()
12814 q.text('}')
12815
Rich Lane7dcdf022013-12-11 14:45:27 -080012816message.subtypes[13] = packet_out
12817
12818class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012819 version = 4
12820 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012821 stats_type = 13
12822
12823 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012824 if xid != None:
12825 self.xid = xid
12826 else:
12827 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012828 if flags != None:
12829 self.flags = flags
12830 else:
12831 self.flags = 0
12832 if entries != None:
12833 self.entries = entries
12834 else:
12835 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012836 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012837
12838 def pack(self):
12839 packed = []
12840 packed.append(struct.pack("!B", self.version))
12841 packed.append(struct.pack("!B", self.type))
12842 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12843 packed.append(struct.pack("!L", self.xid))
12844 packed.append(struct.pack("!H", self.stats_type))
12845 packed.append(struct.pack("!H", self.flags))
12846 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012847 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012848 length = sum([len(x) for x in packed])
12849 packed[2] = struct.pack("!H", length)
12850 return ''.join(packed)
12851
12852 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012853 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012854 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012855 _version = reader.read("!B")[0]
12856 assert(_version == 4)
12857 _type = reader.read("!B")[0]
12858 assert(_type == 19)
12859 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012860 orig_reader = reader
12861 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012862 obj.xid = reader.read("!L")[0]
12863 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012864 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070012865 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012866 reader.skip(4)
12867 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
12868 return obj
12869
12870 def __eq__(self, other):
12871 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012872 if self.xid != other.xid: return False
12873 if self.flags != other.flags: return False
12874 if self.entries != other.entries: return False
12875 return True
12876
Rich Lanec2ee4b82013-04-24 17:12:38 -070012877 def pretty_print(self, q):
12878 q.text("port_desc_stats_reply {")
12879 with q.group():
12880 with q.indent(2):
12881 q.breakable()
12882 q.text("xid = ");
12883 if self.xid != None:
12884 q.text("%#x" % self.xid)
12885 else:
12886 q.text('None')
12887 q.text(","); q.breakable()
12888 q.text("flags = ");
12889 q.text("%#x" % self.flags)
12890 q.text(","); q.breakable()
12891 q.text("entries = ");
12892 q.pp(self.entries)
12893 q.breakable()
12894 q.text('}')
12895
Rich Lane7dcdf022013-12-11 14:45:27 -080012896stats_reply.subtypes[13] = port_desc_stats_reply
12897
12898class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012899 version = 4
12900 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012901 stats_type = 13
12902
12903 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012904 if xid != None:
12905 self.xid = xid
12906 else:
12907 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012908 if flags != None:
12909 self.flags = flags
12910 else:
12911 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012912 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012913
12914 def pack(self):
12915 packed = []
12916 packed.append(struct.pack("!B", self.version))
12917 packed.append(struct.pack("!B", self.type))
12918 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12919 packed.append(struct.pack("!L", self.xid))
12920 packed.append(struct.pack("!H", self.stats_type))
12921 packed.append(struct.pack("!H", self.flags))
12922 packed.append('\x00' * 4)
12923 length = sum([len(x) for x in packed])
12924 packed[2] = struct.pack("!H", length)
12925 return ''.join(packed)
12926
12927 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012928 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012929 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012930 _version = reader.read("!B")[0]
12931 assert(_version == 4)
12932 _type = reader.read("!B")[0]
12933 assert(_type == 18)
12934 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012935 orig_reader = reader
12936 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012937 obj.xid = reader.read("!L")[0]
12938 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012939 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070012940 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012941 reader.skip(4)
12942 return obj
12943
12944 def __eq__(self, other):
12945 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012946 if self.xid != other.xid: return False
12947 if self.flags != other.flags: return False
12948 return True
12949
Rich Lanec2ee4b82013-04-24 17:12:38 -070012950 def pretty_print(self, q):
12951 q.text("port_desc_stats_request {")
12952 with q.group():
12953 with q.indent(2):
12954 q.breakable()
12955 q.text("xid = ");
12956 if self.xid != None:
12957 q.text("%#x" % self.xid)
12958 else:
12959 q.text('None')
12960 q.text(","); q.breakable()
12961 q.text("flags = ");
12962 q.text("%#x" % self.flags)
12963 q.breakable()
12964 q.text('}')
12965
Rich Lane7dcdf022013-12-11 14:45:27 -080012966stats_request.subtypes[13] = port_desc_stats_request
12967
12968class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012969 version = 4
12970 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070012971
12972 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012973 if xid != None:
12974 self.xid = xid
12975 else:
12976 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012977 if port_no != None:
12978 self.port_no = port_no
12979 else:
12980 self.port_no = 0
12981 if hw_addr != None:
12982 self.hw_addr = hw_addr
12983 else:
12984 self.hw_addr = [0,0,0,0,0,0]
12985 if config != None:
12986 self.config = config
12987 else:
12988 self.config = 0
12989 if mask != None:
12990 self.mask = mask
12991 else:
12992 self.mask = 0
12993 if advertise != None:
12994 self.advertise = advertise
12995 else:
12996 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012997 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012998
12999 def pack(self):
13000 packed = []
13001 packed.append(struct.pack("!B", self.version))
13002 packed.append(struct.pack("!B", self.type))
13003 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13004 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013005 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013006 packed.append('\x00' * 4)
13007 packed.append(struct.pack("!6B", *self.hw_addr))
13008 packed.append('\x00' * 2)
13009 packed.append(struct.pack("!L", self.config))
13010 packed.append(struct.pack("!L", self.mask))
13011 packed.append(struct.pack("!L", self.advertise))
13012 packed.append('\x00' * 4)
13013 length = sum([len(x) for x in packed])
13014 packed[2] = struct.pack("!H", length)
13015 return ''.join(packed)
13016
13017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013018 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013019 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013020 _version = reader.read("!B")[0]
13021 assert(_version == 4)
13022 _type = reader.read("!B")[0]
13023 assert(_type == 16)
13024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013025 orig_reader = reader
13026 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013027 obj.xid = reader.read("!L")[0]
13028 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013029 reader.skip(4)
13030 obj.hw_addr = list(reader.read('!6B'))
13031 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070013032 obj.config = reader.read("!L")[0]
13033 obj.mask = reader.read("!L")[0]
13034 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013035 reader.skip(4)
13036 return obj
13037
13038 def __eq__(self, other):
13039 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013040 if self.xid != other.xid: return False
13041 if self.port_no != other.port_no: return False
13042 if self.hw_addr != other.hw_addr: return False
13043 if self.config != other.config: return False
13044 if self.mask != other.mask: return False
13045 if self.advertise != other.advertise: return False
13046 return True
13047
Rich Lanec2ee4b82013-04-24 17:12:38 -070013048 def pretty_print(self, q):
13049 q.text("port_mod {")
13050 with q.group():
13051 with q.indent(2):
13052 q.breakable()
13053 q.text("xid = ");
13054 if self.xid != None:
13055 q.text("%#x" % self.xid)
13056 else:
13057 q.text('None')
13058 q.text(","); q.breakable()
13059 q.text("port_no = ");
13060 q.text(util.pretty_port(self.port_no))
13061 q.text(","); q.breakable()
13062 q.text("hw_addr = ");
13063 q.text(util.pretty_mac(self.hw_addr))
13064 q.text(","); q.breakable()
13065 q.text("config = ");
13066 q.text("%#x" % self.config)
13067 q.text(","); q.breakable()
13068 q.text("mask = ");
13069 q.text("%#x" % self.mask)
13070 q.text(","); q.breakable()
13071 q.text("advertise = ");
13072 q.text("%#x" % self.advertise)
13073 q.breakable()
13074 q.text('}')
13075
Rich Lane7dcdf022013-12-11 14:45:27 -080013076message.subtypes[16] = port_mod
13077
13078class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013079 version = 4
13080 type = 1
13081 err_type = 7
13082
13083 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013084 if xid != None:
13085 self.xid = xid
13086 else:
13087 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013088 if code != None:
13089 self.code = code
13090 else:
13091 self.code = 0
13092 if data != None:
13093 self.data = data
13094 else:
13095 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013096 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013097
13098 def pack(self):
13099 packed = []
13100 packed.append(struct.pack("!B", self.version))
13101 packed.append(struct.pack("!B", self.type))
13102 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13103 packed.append(struct.pack("!L", self.xid))
13104 packed.append(struct.pack("!H", self.err_type))
13105 packed.append(struct.pack("!H", self.code))
13106 packed.append(self.data)
13107 length = sum([len(x) for x in packed])
13108 packed[2] = struct.pack("!H", length)
13109 return ''.join(packed)
13110
13111 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013112 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013113 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013114 _version = reader.read("!B")[0]
13115 assert(_version == 4)
13116 _type = reader.read("!B")[0]
13117 assert(_type == 1)
13118 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013119 orig_reader = reader
13120 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013121 obj.xid = reader.read("!L")[0]
13122 _err_type = reader.read("!H")[0]
13123 assert(_err_type == 7)
13124 obj.code = reader.read("!H")[0]
13125 obj.data = str(reader.read_all())
13126 return obj
13127
13128 def __eq__(self, other):
13129 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013130 if self.xid != other.xid: return False
13131 if self.code != other.code: return False
13132 if self.data != other.data: return False
13133 return True
13134
Rich Lane6f4978c2013-10-20 21:33:52 -070013135 def pretty_print(self, q):
13136 q.text("port_mod_failed_error_msg {")
13137 with q.group():
13138 with q.indent(2):
13139 q.breakable()
13140 q.text("xid = ");
13141 if self.xid != None:
13142 q.text("%#x" % self.xid)
13143 else:
13144 q.text('None')
13145 q.text(","); q.breakable()
13146 q.text("code = ");
13147 q.text("%#x" % self.code)
13148 q.text(","); q.breakable()
13149 q.text("data = ");
13150 q.pp(self.data)
13151 q.breakable()
13152 q.text('}')
13153
Rich Lane7dcdf022013-12-11 14:45:27 -080013154error_msg.subtypes[7] = port_mod_failed_error_msg
13155
13156class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013157 version = 4
13158 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013159 stats_type = 4
13160
13161 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013162 if xid != None:
13163 self.xid = xid
13164 else:
13165 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013166 if flags != None:
13167 self.flags = flags
13168 else:
13169 self.flags = 0
13170 if entries != None:
13171 self.entries = entries
13172 else:
13173 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013174 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013175
13176 def pack(self):
13177 packed = []
13178 packed.append(struct.pack("!B", self.version))
13179 packed.append(struct.pack("!B", self.type))
13180 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13181 packed.append(struct.pack("!L", self.xid))
13182 packed.append(struct.pack("!H", self.stats_type))
13183 packed.append(struct.pack("!H", self.flags))
13184 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013185 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013186 length = sum([len(x) for x in packed])
13187 packed[2] = struct.pack("!H", length)
13188 return ''.join(packed)
13189
13190 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013191 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013192 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013193 _version = reader.read("!B")[0]
13194 assert(_version == 4)
13195 _type = reader.read("!B")[0]
13196 assert(_type == 19)
13197 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013198 orig_reader = reader
13199 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013200 obj.xid = reader.read("!L")[0]
13201 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013202 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013203 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013204 reader.skip(4)
13205 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13206 return obj
13207
13208 def __eq__(self, other):
13209 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013210 if self.xid != other.xid: return False
13211 if self.flags != other.flags: return False
13212 if self.entries != other.entries: return False
13213 return True
13214
Rich Lanec2ee4b82013-04-24 17:12:38 -070013215 def pretty_print(self, q):
13216 q.text("port_stats_reply {")
13217 with q.group():
13218 with q.indent(2):
13219 q.breakable()
13220 q.text("xid = ");
13221 if self.xid != None:
13222 q.text("%#x" % self.xid)
13223 else:
13224 q.text('None')
13225 q.text(","); q.breakable()
13226 q.text("flags = ");
13227 q.text("%#x" % self.flags)
13228 q.text(","); q.breakable()
13229 q.text("entries = ");
13230 q.pp(self.entries)
13231 q.breakable()
13232 q.text('}')
13233
Rich Lane7dcdf022013-12-11 14:45:27 -080013234stats_reply.subtypes[4] = port_stats_reply
13235
13236class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013237 version = 4
13238 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013239 stats_type = 4
13240
13241 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013242 if xid != None:
13243 self.xid = xid
13244 else:
13245 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013246 if flags != None:
13247 self.flags = flags
13248 else:
13249 self.flags = 0
13250 if port_no != None:
13251 self.port_no = port_no
13252 else:
13253 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013254 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013255
13256 def pack(self):
13257 packed = []
13258 packed.append(struct.pack("!B", self.version))
13259 packed.append(struct.pack("!B", self.type))
13260 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13261 packed.append(struct.pack("!L", self.xid))
13262 packed.append(struct.pack("!H", self.stats_type))
13263 packed.append(struct.pack("!H", self.flags))
13264 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013265 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013266 packed.append('\x00' * 4)
13267 length = sum([len(x) for x in packed])
13268 packed[2] = struct.pack("!H", length)
13269 return ''.join(packed)
13270
13271 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013272 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013273 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013274 _version = reader.read("!B")[0]
13275 assert(_version == 4)
13276 _type = reader.read("!B")[0]
13277 assert(_type == 18)
13278 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013279 orig_reader = reader
13280 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013281 obj.xid = reader.read("!L")[0]
13282 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013283 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013284 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013285 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013286 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013287 reader.skip(4)
13288 return obj
13289
13290 def __eq__(self, other):
13291 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013292 if self.xid != other.xid: return False
13293 if self.flags != other.flags: return False
13294 if self.port_no != other.port_no: return False
13295 return True
13296
Rich Lanec2ee4b82013-04-24 17:12:38 -070013297 def pretty_print(self, q):
13298 q.text("port_stats_request {")
13299 with q.group():
13300 with q.indent(2):
13301 q.breakable()
13302 q.text("xid = ");
13303 if self.xid != None:
13304 q.text("%#x" % self.xid)
13305 else:
13306 q.text('None')
13307 q.text(","); q.breakable()
13308 q.text("flags = ");
13309 q.text("%#x" % self.flags)
13310 q.text(","); q.breakable()
13311 q.text("port_no = ");
13312 q.text(util.pretty_port(self.port_no))
13313 q.breakable()
13314 q.text('}')
13315
Rich Lane7dcdf022013-12-11 14:45:27 -080013316stats_request.subtypes[4] = port_stats_request
13317
13318class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013319 version = 4
13320 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070013321
13322 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013323 if xid != None:
13324 self.xid = xid
13325 else:
13326 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013327 if reason != None:
13328 self.reason = reason
13329 else:
13330 self.reason = 0
13331 if desc != None:
13332 self.desc = desc
13333 else:
13334 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080013335 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013336
13337 def pack(self):
13338 packed = []
13339 packed.append(struct.pack("!B", self.version))
13340 packed.append(struct.pack("!B", self.type))
13341 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13342 packed.append(struct.pack("!L", self.xid))
13343 packed.append(struct.pack("!B", self.reason))
13344 packed.append('\x00' * 7)
13345 packed.append(self.desc.pack())
13346 length = sum([len(x) for x in packed])
13347 packed[2] = struct.pack("!H", length)
13348 return ''.join(packed)
13349
13350 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013351 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013352 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070013353 _version = reader.read("!B")[0]
13354 assert(_version == 4)
13355 _type = reader.read("!B")[0]
13356 assert(_type == 12)
13357 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013358 orig_reader = reader
13359 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013360 obj.xid = reader.read("!L")[0]
13361 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013362 reader.skip(7)
13363 obj.desc = common.port_desc.unpack(reader)
13364 return obj
13365
13366 def __eq__(self, other):
13367 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013368 if self.xid != other.xid: return False
13369 if self.reason != other.reason: return False
13370 if self.desc != other.desc: return False
13371 return True
13372
Rich Lanec2ee4b82013-04-24 17:12:38 -070013373 def pretty_print(self, q):
13374 q.text("port_status {")
13375 with q.group():
13376 with q.indent(2):
13377 q.breakable()
13378 q.text("xid = ");
13379 if self.xid != None:
13380 q.text("%#x" % self.xid)
13381 else:
13382 q.text('None')
13383 q.text(","); q.breakable()
13384 q.text("reason = ");
13385 q.text("%#x" % self.reason)
13386 q.text(","); q.breakable()
13387 q.text("desc = ");
13388 q.pp(self.desc)
13389 q.breakable()
13390 q.text('}')
13391
Rich Lane7dcdf022013-12-11 14:45:27 -080013392message.subtypes[12] = port_status
13393
13394class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013395 version = 4
13396 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070013397
13398 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013399 if xid != None:
13400 self.xid = xid
13401 else:
13402 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013403 if port != None:
13404 self.port = port
13405 else:
13406 self.port = 0
13407 if queues != None:
13408 self.queues = queues
13409 else:
13410 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013411 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013412
13413 def pack(self):
13414 packed = []
13415 packed.append(struct.pack("!B", self.version))
13416 packed.append(struct.pack("!B", self.type))
13417 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13418 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013419 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013420 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013421 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013422 length = sum([len(x) for x in packed])
13423 packed[2] = struct.pack("!H", length)
13424 return ''.join(packed)
13425
13426 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013427 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013428 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013429 _version = reader.read("!B")[0]
13430 assert(_version == 4)
13431 _type = reader.read("!B")[0]
13432 assert(_type == 23)
13433 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013434 orig_reader = reader
13435 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013436 obj.xid = reader.read("!L")[0]
13437 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013438 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013439 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013440 return obj
13441
13442 def __eq__(self, other):
13443 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013444 if self.xid != other.xid: return False
13445 if self.port != other.port: return False
13446 if self.queues != other.queues: return False
13447 return True
13448
Rich Lanec2ee4b82013-04-24 17:12:38 -070013449 def pretty_print(self, q):
13450 q.text("queue_get_config_reply {")
13451 with q.group():
13452 with q.indent(2):
13453 q.breakable()
13454 q.text("xid = ");
13455 if self.xid != None:
13456 q.text("%#x" % self.xid)
13457 else:
13458 q.text('None')
13459 q.text(","); q.breakable()
13460 q.text("port = ");
13461 q.text(util.pretty_port(self.port))
13462 q.text(","); q.breakable()
13463 q.text("queues = ");
13464 q.pp(self.queues)
13465 q.breakable()
13466 q.text('}')
13467
Rich Lane7dcdf022013-12-11 14:45:27 -080013468message.subtypes[23] = queue_get_config_reply
13469
13470class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013471 version = 4
13472 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070013473
13474 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013475 if xid != None:
13476 self.xid = xid
13477 else:
13478 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013479 if port != None:
13480 self.port = port
13481 else:
13482 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013483 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013484
13485 def pack(self):
13486 packed = []
13487 packed.append(struct.pack("!B", self.version))
13488 packed.append(struct.pack("!B", self.type))
13489 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13490 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013491 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013492 packed.append('\x00' * 4)
13493 length = sum([len(x) for x in packed])
13494 packed[2] = struct.pack("!H", length)
13495 return ''.join(packed)
13496
13497 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013498 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013499 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013500 _version = reader.read("!B")[0]
13501 assert(_version == 4)
13502 _type = reader.read("!B")[0]
13503 assert(_type == 22)
13504 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013505 orig_reader = reader
13506 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013507 obj.xid = reader.read("!L")[0]
13508 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013509 reader.skip(4)
13510 return obj
13511
13512 def __eq__(self, other):
13513 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013514 if self.xid != other.xid: return False
13515 if self.port != other.port: return False
13516 return True
13517
Rich Lanec2ee4b82013-04-24 17:12:38 -070013518 def pretty_print(self, q):
13519 q.text("queue_get_config_request {")
13520 with q.group():
13521 with q.indent(2):
13522 q.breakable()
13523 q.text("xid = ");
13524 if self.xid != None:
13525 q.text("%#x" % self.xid)
13526 else:
13527 q.text('None')
13528 q.text(","); q.breakable()
13529 q.text("port = ");
13530 q.text(util.pretty_port(self.port))
13531 q.breakable()
13532 q.text('}')
13533
Rich Lane7dcdf022013-12-11 14:45:27 -080013534message.subtypes[22] = queue_get_config_request
13535
13536class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013537 version = 4
13538 type = 1
13539 err_type = 9
13540
13541 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013542 if xid != None:
13543 self.xid = xid
13544 else:
13545 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013546 if code != None:
13547 self.code = code
13548 else:
13549 self.code = 0
13550 if data != None:
13551 self.data = data
13552 else:
13553 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013554 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013555
13556 def pack(self):
13557 packed = []
13558 packed.append(struct.pack("!B", self.version))
13559 packed.append(struct.pack("!B", self.type))
13560 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13561 packed.append(struct.pack("!L", self.xid))
13562 packed.append(struct.pack("!H", self.err_type))
13563 packed.append(struct.pack("!H", self.code))
13564 packed.append(self.data)
13565 length = sum([len(x) for x in packed])
13566 packed[2] = struct.pack("!H", length)
13567 return ''.join(packed)
13568
13569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013570 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013571 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013572 _version = reader.read("!B")[0]
13573 assert(_version == 4)
13574 _type = reader.read("!B")[0]
13575 assert(_type == 1)
13576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013577 orig_reader = reader
13578 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013579 obj.xid = reader.read("!L")[0]
13580 _err_type = reader.read("!H")[0]
13581 assert(_err_type == 9)
13582 obj.code = reader.read("!H")[0]
13583 obj.data = str(reader.read_all())
13584 return obj
13585
13586 def __eq__(self, other):
13587 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013588 if self.xid != other.xid: return False
13589 if self.code != other.code: return False
13590 if self.data != other.data: return False
13591 return True
13592
Rich Lane6f4978c2013-10-20 21:33:52 -070013593 def pretty_print(self, q):
13594 q.text("queue_op_failed_error_msg {")
13595 with q.group():
13596 with q.indent(2):
13597 q.breakable()
13598 q.text("xid = ");
13599 if self.xid != None:
13600 q.text("%#x" % self.xid)
13601 else:
13602 q.text('None')
13603 q.text(","); q.breakable()
13604 q.text("code = ");
13605 q.text("%#x" % self.code)
13606 q.text(","); q.breakable()
13607 q.text("data = ");
13608 q.pp(self.data)
13609 q.breakable()
13610 q.text('}')
13611
Rich Lane7dcdf022013-12-11 14:45:27 -080013612error_msg.subtypes[9] = queue_op_failed_error_msg
13613
13614class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013615 version = 4
13616 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013617 stats_type = 5
13618
13619 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013620 if xid != None:
13621 self.xid = xid
13622 else:
13623 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013624 if flags != None:
13625 self.flags = flags
13626 else:
13627 self.flags = 0
13628 if entries != None:
13629 self.entries = entries
13630 else:
13631 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013632 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013633
13634 def pack(self):
13635 packed = []
13636 packed.append(struct.pack("!B", self.version))
13637 packed.append(struct.pack("!B", self.type))
13638 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13639 packed.append(struct.pack("!L", self.xid))
13640 packed.append(struct.pack("!H", self.stats_type))
13641 packed.append(struct.pack("!H", self.flags))
13642 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013643 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013644 length = sum([len(x) for x in packed])
13645 packed[2] = struct.pack("!H", length)
13646 return ''.join(packed)
13647
13648 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013649 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013650 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013651 _version = reader.read("!B")[0]
13652 assert(_version == 4)
13653 _type = reader.read("!B")[0]
13654 assert(_type == 19)
13655 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013656 orig_reader = reader
13657 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013658 obj.xid = reader.read("!L")[0]
13659 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013660 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070013661 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013662 reader.skip(4)
13663 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
13664 return obj
13665
13666 def __eq__(self, other):
13667 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013668 if self.xid != other.xid: return False
13669 if self.flags != other.flags: return False
13670 if self.entries != other.entries: return False
13671 return True
13672
Rich Lanec2ee4b82013-04-24 17:12:38 -070013673 def pretty_print(self, q):
13674 q.text("queue_stats_reply {")
13675 with q.group():
13676 with q.indent(2):
13677 q.breakable()
13678 q.text("xid = ");
13679 if self.xid != None:
13680 q.text("%#x" % self.xid)
13681 else:
13682 q.text('None')
13683 q.text(","); q.breakable()
13684 q.text("flags = ");
13685 q.text("%#x" % self.flags)
13686 q.text(","); q.breakable()
13687 q.text("entries = ");
13688 q.pp(self.entries)
13689 q.breakable()
13690 q.text('}')
13691
Rich Lane7dcdf022013-12-11 14:45:27 -080013692stats_reply.subtypes[5] = queue_stats_reply
13693
13694class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013695 version = 4
13696 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013697 stats_type = 5
13698
13699 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013700 if xid != None:
13701 self.xid = xid
13702 else:
13703 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013704 if flags != None:
13705 self.flags = flags
13706 else:
13707 self.flags = 0
13708 if port_no != None:
13709 self.port_no = port_no
13710 else:
13711 self.port_no = 0
13712 if queue_id != None:
13713 self.queue_id = queue_id
13714 else:
13715 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013716 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013717
13718 def pack(self):
13719 packed = []
13720 packed.append(struct.pack("!B", self.version))
13721 packed.append(struct.pack("!B", self.type))
13722 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13723 packed.append(struct.pack("!L", self.xid))
13724 packed.append(struct.pack("!H", self.stats_type))
13725 packed.append(struct.pack("!H", self.flags))
13726 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013727 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013728 packed.append(struct.pack("!L", self.queue_id))
13729 length = sum([len(x) for x in packed])
13730 packed[2] = struct.pack("!H", length)
13731 return ''.join(packed)
13732
13733 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013734 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013735 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013736 _version = reader.read("!B")[0]
13737 assert(_version == 4)
13738 _type = reader.read("!B")[0]
13739 assert(_type == 18)
13740 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013741 orig_reader = reader
13742 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013743 obj.xid = reader.read("!L")[0]
13744 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013745 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070013746 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013747 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013748 obj.port_no = util.unpack_port_no(reader)
13749 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013750 return obj
13751
13752 def __eq__(self, other):
13753 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013754 if self.xid != other.xid: return False
13755 if self.flags != other.flags: return False
13756 if self.port_no != other.port_no: return False
13757 if self.queue_id != other.queue_id: return False
13758 return True
13759
Rich Lanec2ee4b82013-04-24 17:12:38 -070013760 def pretty_print(self, q):
13761 q.text("queue_stats_request {")
13762 with q.group():
13763 with q.indent(2):
13764 q.breakable()
13765 q.text("xid = ");
13766 if self.xid != None:
13767 q.text("%#x" % self.xid)
13768 else:
13769 q.text('None')
13770 q.text(","); q.breakable()
13771 q.text("flags = ");
13772 q.text("%#x" % self.flags)
13773 q.text(","); q.breakable()
13774 q.text("port_no = ");
13775 q.text(util.pretty_port(self.port_no))
13776 q.text(","); q.breakable()
13777 q.text("queue_id = ");
13778 q.text("%#x" % self.queue_id)
13779 q.breakable()
13780 q.text('}')
13781
Rich Lane7dcdf022013-12-11 14:45:27 -080013782stats_request.subtypes[5] = queue_stats_request
13783
13784class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013785 version = 4
13786 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070013787
Rich Laned9e3f7b2013-11-04 11:40:43 -080013788 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013789 if xid != None:
13790 self.xid = xid
13791 else:
13792 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080013793 if role != None:
13794 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070013795 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080013796 self.role = 0
13797 if generation_id != None:
13798 self.generation_id = generation_id
13799 else:
13800 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013801 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013802
13803 def pack(self):
13804 packed = []
13805 packed.append(struct.pack("!B", self.version))
13806 packed.append(struct.pack("!B", self.type))
13807 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13808 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080013809 packed.append(struct.pack("!L", self.role))
13810 packed.append('\x00' * 4)
13811 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013812 length = sum([len(x) for x in packed])
13813 packed[2] = struct.pack("!H", length)
13814 return ''.join(packed)
13815
13816 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013817 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013818 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013819 _version = reader.read("!B")[0]
13820 assert(_version == 4)
13821 _type = reader.read("!B")[0]
13822 assert(_type == 25)
13823 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013824 orig_reader = reader
13825 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013826 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080013827 obj.role = reader.read("!L")[0]
13828 reader.skip(4)
13829 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013830 return obj
13831
13832 def __eq__(self, other):
13833 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013834 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080013835 if self.role != other.role: return False
13836 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013837 return True
13838
Rich Lanec2ee4b82013-04-24 17:12:38 -070013839 def pretty_print(self, q):
13840 q.text("role_reply {")
13841 with q.group():
13842 with q.indent(2):
13843 q.breakable()
13844 q.text("xid = ");
13845 if self.xid != None:
13846 q.text("%#x" % self.xid)
13847 else:
13848 q.text('None')
13849 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080013850 q.text("role = ");
13851 q.text("%#x" % self.role)
13852 q.text(","); q.breakable()
13853 q.text("generation_id = ");
13854 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013855 q.breakable()
13856 q.text('}')
13857
Rich Lane7dcdf022013-12-11 14:45:27 -080013858message.subtypes[25] = role_reply
13859
13860class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013861 version = 4
13862 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070013863
13864 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013865 if xid != None:
13866 self.xid = xid
13867 else:
13868 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013869 if role != None:
13870 self.role = role
13871 else:
13872 self.role = 0
13873 if generation_id != None:
13874 self.generation_id = generation_id
13875 else:
13876 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013877 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013878
13879 def pack(self):
13880 packed = []
13881 packed.append(struct.pack("!B", self.version))
13882 packed.append(struct.pack("!B", self.type))
13883 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13884 packed.append(struct.pack("!L", self.xid))
13885 packed.append(struct.pack("!L", self.role))
13886 packed.append('\x00' * 4)
13887 packed.append(struct.pack("!Q", self.generation_id))
13888 length = sum([len(x) for x in packed])
13889 packed[2] = struct.pack("!H", length)
13890 return ''.join(packed)
13891
13892 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013893 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013894 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013895 _version = reader.read("!B")[0]
13896 assert(_version == 4)
13897 _type = reader.read("!B")[0]
13898 assert(_type == 24)
13899 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013900 orig_reader = reader
13901 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013902 obj.xid = reader.read("!L")[0]
13903 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013904 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013905 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013906 return obj
13907
13908 def __eq__(self, other):
13909 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013910 if self.xid != other.xid: return False
13911 if self.role != other.role: return False
13912 if self.generation_id != other.generation_id: return False
13913 return True
13914
Rich Lanec2ee4b82013-04-24 17:12:38 -070013915 def pretty_print(self, q):
13916 q.text("role_request {")
13917 with q.group():
13918 with q.indent(2):
13919 q.breakable()
13920 q.text("xid = ");
13921 if self.xid != None:
13922 q.text("%#x" % self.xid)
13923 else:
13924 q.text('None')
13925 q.text(","); q.breakable()
13926 q.text("role = ");
13927 q.text("%#x" % self.role)
13928 q.text(","); q.breakable()
13929 q.text("generation_id = ");
13930 q.text("%#x" % self.generation_id)
13931 q.breakable()
13932 q.text('}')
13933
Rich Lane7dcdf022013-12-11 14:45:27 -080013934message.subtypes[24] = role_request
13935
13936class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013937 version = 4
13938 type = 1
13939 err_type = 11
13940
13941 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013942 if xid != None:
13943 self.xid = xid
13944 else:
13945 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013946 if code != None:
13947 self.code = code
13948 else:
13949 self.code = 0
13950 if data != None:
13951 self.data = data
13952 else:
13953 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013954 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013955
13956 def pack(self):
13957 packed = []
13958 packed.append(struct.pack("!B", self.version))
13959 packed.append(struct.pack("!B", self.type))
13960 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13961 packed.append(struct.pack("!L", self.xid))
13962 packed.append(struct.pack("!H", self.err_type))
13963 packed.append(struct.pack("!H", self.code))
13964 packed.append(self.data)
13965 length = sum([len(x) for x in packed])
13966 packed[2] = struct.pack("!H", length)
13967 return ''.join(packed)
13968
13969 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013970 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013971 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013972 _version = reader.read("!B")[0]
13973 assert(_version == 4)
13974 _type = reader.read("!B")[0]
13975 assert(_type == 1)
13976 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013977 orig_reader = reader
13978 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013979 obj.xid = reader.read("!L")[0]
13980 _err_type = reader.read("!H")[0]
13981 assert(_err_type == 11)
13982 obj.code = reader.read("!H")[0]
13983 obj.data = str(reader.read_all())
13984 return obj
13985
13986 def __eq__(self, other):
13987 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013988 if self.xid != other.xid: return False
13989 if self.code != other.code: return False
13990 if self.data != other.data: return False
13991 return True
13992
Rich Lane6f4978c2013-10-20 21:33:52 -070013993 def pretty_print(self, q):
13994 q.text("role_request_failed_error_msg {")
13995 with q.group():
13996 with q.indent(2):
13997 q.breakable()
13998 q.text("xid = ");
13999 if self.xid != None:
14000 q.text("%#x" % self.xid)
14001 else:
14002 q.text('None')
14003 q.text(","); q.breakable()
14004 q.text("code = ");
14005 q.text("%#x" % self.code)
14006 q.text(","); q.breakable()
14007 q.text("data = ");
14008 q.pp(self.data)
14009 q.breakable()
14010 q.text('}')
14011
Rich Lane7dcdf022013-12-11 14:45:27 -080014012error_msg.subtypes[11] = role_request_failed_error_msg
14013
14014class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014015 version = 4
14016 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070014017
14018 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014019 if xid != None:
14020 self.xid = xid
14021 else:
14022 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014023 if flags != None:
14024 self.flags = flags
14025 else:
14026 self.flags = 0
14027 if miss_send_len != None:
14028 self.miss_send_len = miss_send_len
14029 else:
14030 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014031 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014032
14033 def pack(self):
14034 packed = []
14035 packed.append(struct.pack("!B", self.version))
14036 packed.append(struct.pack("!B", self.type))
14037 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14038 packed.append(struct.pack("!L", self.xid))
14039 packed.append(struct.pack("!H", self.flags))
14040 packed.append(struct.pack("!H", self.miss_send_len))
14041 length = sum([len(x) for x in packed])
14042 packed[2] = struct.pack("!H", length)
14043 return ''.join(packed)
14044
14045 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014046 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014047 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070014048 _version = reader.read("!B")[0]
14049 assert(_version == 4)
14050 _type = reader.read("!B")[0]
14051 assert(_type == 9)
14052 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014053 orig_reader = reader
14054 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014055 obj.xid = reader.read("!L")[0]
14056 obj.flags = reader.read("!H")[0]
14057 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014058 return obj
14059
14060 def __eq__(self, other):
14061 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014062 if self.xid != other.xid: return False
14063 if self.flags != other.flags: return False
14064 if self.miss_send_len != other.miss_send_len: return False
14065 return True
14066
Rich Lanec2ee4b82013-04-24 17:12:38 -070014067 def pretty_print(self, q):
14068 q.text("set_config {")
14069 with q.group():
14070 with q.indent(2):
14071 q.breakable()
14072 q.text("xid = ");
14073 if self.xid != None:
14074 q.text("%#x" % self.xid)
14075 else:
14076 q.text('None')
14077 q.text(","); q.breakable()
14078 q.text("flags = ");
14079 q.text("%#x" % self.flags)
14080 q.text(","); q.breakable()
14081 q.text("miss_send_len = ");
14082 q.text("%#x" % self.miss_send_len)
14083 q.breakable()
14084 q.text('}')
14085
Rich Lane7dcdf022013-12-11 14:45:27 -080014086message.subtypes[9] = set_config
14087
14088class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014089 version = 4
14090 type = 1
14091 err_type = 10
14092
14093 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014094 if xid != None:
14095 self.xid = xid
14096 else:
14097 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014098 if code != None:
14099 self.code = code
14100 else:
14101 self.code = 0
14102 if data != None:
14103 self.data = data
14104 else:
14105 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014106 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014107
14108 def pack(self):
14109 packed = []
14110 packed.append(struct.pack("!B", self.version))
14111 packed.append(struct.pack("!B", self.type))
14112 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14113 packed.append(struct.pack("!L", self.xid))
14114 packed.append(struct.pack("!H", self.err_type))
14115 packed.append(struct.pack("!H", self.code))
14116 packed.append(self.data)
14117 length = sum([len(x) for x in packed])
14118 packed[2] = struct.pack("!H", length)
14119 return ''.join(packed)
14120
14121 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014122 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014123 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014124 _version = reader.read("!B")[0]
14125 assert(_version == 4)
14126 _type = reader.read("!B")[0]
14127 assert(_type == 1)
14128 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014129 orig_reader = reader
14130 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070014131 obj.xid = reader.read("!L")[0]
14132 _err_type = reader.read("!H")[0]
14133 assert(_err_type == 10)
14134 obj.code = reader.read("!H")[0]
14135 obj.data = str(reader.read_all())
14136 return obj
14137
14138 def __eq__(self, other):
14139 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014140 if self.xid != other.xid: return False
14141 if self.code != other.code: return False
14142 if self.data != other.data: return False
14143 return True
14144
Rich Lane6f4978c2013-10-20 21:33:52 -070014145 def pretty_print(self, q):
14146 q.text("switch_config_failed_error_msg {")
14147 with q.group():
14148 with q.indent(2):
14149 q.breakable()
14150 q.text("xid = ");
14151 if self.xid != None:
14152 q.text("%#x" % self.xid)
14153 else:
14154 q.text('None')
14155 q.text(","); q.breakable()
14156 q.text("code = ");
14157 q.text("%#x" % self.code)
14158 q.text(","); q.breakable()
14159 q.text("data = ");
14160 q.pp(self.data)
14161 q.breakable()
14162 q.text('}')
14163
Rich Lane7dcdf022013-12-11 14:45:27 -080014164error_msg.subtypes[10] = switch_config_failed_error_msg
14165
14166class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014167 version = 4
14168 type = 1
14169 err_type = 13
14170
14171 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014172 if xid != None:
14173 self.xid = xid
14174 else:
14175 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014176 if code != None:
14177 self.code = code
14178 else:
14179 self.code = 0
14180 if data != None:
14181 self.data = data
14182 else:
14183 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014184 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014185
14186 def pack(self):
14187 packed = []
14188 packed.append(struct.pack("!B", self.version))
14189 packed.append(struct.pack("!B", self.type))
14190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14191 packed.append(struct.pack("!L", self.xid))
14192 packed.append(struct.pack("!H", self.err_type))
14193 packed.append(struct.pack("!H", self.code))
14194 packed.append(self.data)
14195 length = sum([len(x) for x in packed])
14196 packed[2] = struct.pack("!H", length)
14197 return ''.join(packed)
14198
14199 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014200 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014201 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014202 _version = reader.read("!B")[0]
14203 assert(_version == 4)
14204 _type = reader.read("!B")[0]
14205 assert(_type == 1)
14206 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014207 orig_reader = reader
14208 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070014209 obj.xid = reader.read("!L")[0]
14210 _err_type = reader.read("!H")[0]
14211 assert(_err_type == 13)
14212 obj.code = reader.read("!H")[0]
14213 obj.data = str(reader.read_all())
14214 return obj
14215
14216 def __eq__(self, other):
14217 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014218 if self.xid != other.xid: return False
14219 if self.code != other.code: return False
14220 if self.data != other.data: return False
14221 return True
14222
Rich Lane6f4978c2013-10-20 21:33:52 -070014223 def pretty_print(self, q):
14224 q.text("table_features_failed_error_msg {")
14225 with q.group():
14226 with q.indent(2):
14227 q.breakable()
14228 q.text("xid = ");
14229 if self.xid != None:
14230 q.text("%#x" % self.xid)
14231 else:
14232 q.text('None')
14233 q.text(","); q.breakable()
14234 q.text("code = ");
14235 q.text("%#x" % self.code)
14236 q.text(","); q.breakable()
14237 q.text("data = ");
14238 q.pp(self.data)
14239 q.breakable()
14240 q.text('}')
14241
Rich Lane7dcdf022013-12-11 14:45:27 -080014242error_msg.subtypes[13] = table_features_failed_error_msg
14243
14244class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014245 version = 4
14246 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014247 stats_type = 12
14248
14249 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014250 if xid != None:
14251 self.xid = xid
14252 else:
14253 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014254 if flags != None:
14255 self.flags = flags
14256 else:
14257 self.flags = 0
14258 if entries != None:
14259 self.entries = entries
14260 else:
14261 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014262 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014263
14264 def pack(self):
14265 packed = []
14266 packed.append(struct.pack("!B", self.version))
14267 packed.append(struct.pack("!B", self.type))
14268 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14269 packed.append(struct.pack("!L", self.xid))
14270 packed.append(struct.pack("!H", self.stats_type))
14271 packed.append(struct.pack("!H", self.flags))
14272 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014273 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014274 length = sum([len(x) for x in packed])
14275 packed[2] = struct.pack("!H", length)
14276 return ''.join(packed)
14277
14278 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014279 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014280 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014281 _version = reader.read("!B")[0]
14282 assert(_version == 4)
14283 _type = reader.read("!B")[0]
14284 assert(_type == 19)
14285 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014286 orig_reader = reader
14287 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014288 obj.xid = reader.read("!L")[0]
14289 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014290 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014291 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014292 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014293 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014294 return obj
14295
14296 def __eq__(self, other):
14297 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014298 if self.xid != other.xid: return False
14299 if self.flags != other.flags: return False
14300 if self.entries != other.entries: return False
14301 return True
14302
Rich Lanec2ee4b82013-04-24 17:12:38 -070014303 def pretty_print(self, q):
14304 q.text("table_features_stats_reply {")
14305 with q.group():
14306 with q.indent(2):
14307 q.breakable()
14308 q.text("xid = ");
14309 if self.xid != None:
14310 q.text("%#x" % self.xid)
14311 else:
14312 q.text('None')
14313 q.text(","); q.breakable()
14314 q.text("flags = ");
14315 q.text("%#x" % self.flags)
14316 q.text(","); q.breakable()
14317 q.text("entries = ");
14318 q.pp(self.entries)
14319 q.breakable()
14320 q.text('}')
14321
Rich Lane7dcdf022013-12-11 14:45:27 -080014322stats_reply.subtypes[12] = table_features_stats_reply
14323
14324class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014325 version = 4
14326 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014327 stats_type = 12
14328
14329 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014330 if xid != None:
14331 self.xid = xid
14332 else:
14333 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014334 if flags != None:
14335 self.flags = flags
14336 else:
14337 self.flags = 0
14338 if entries != None:
14339 self.entries = entries
14340 else:
14341 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014342 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014343
14344 def pack(self):
14345 packed = []
14346 packed.append(struct.pack("!B", self.version))
14347 packed.append(struct.pack("!B", self.type))
14348 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14349 packed.append(struct.pack("!L", self.xid))
14350 packed.append(struct.pack("!H", self.stats_type))
14351 packed.append(struct.pack("!H", self.flags))
14352 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014353 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014354 length = sum([len(x) for x in packed])
14355 packed[2] = struct.pack("!H", length)
14356 return ''.join(packed)
14357
14358 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014359 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014360 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014361 _version = reader.read("!B")[0]
14362 assert(_version == 4)
14363 _type = reader.read("!B")[0]
14364 assert(_type == 18)
14365 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014366 orig_reader = reader
14367 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014368 obj.xid = reader.read("!L")[0]
14369 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014370 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014371 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014372 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014373 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014374 return obj
14375
14376 def __eq__(self, other):
14377 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014378 if self.xid != other.xid: return False
14379 if self.flags != other.flags: return False
14380 if self.entries != other.entries: return False
14381 return True
14382
Rich Lanec2ee4b82013-04-24 17:12:38 -070014383 def pretty_print(self, q):
14384 q.text("table_features_stats_request {")
14385 with q.group():
14386 with q.indent(2):
14387 q.breakable()
14388 q.text("xid = ");
14389 if self.xid != None:
14390 q.text("%#x" % self.xid)
14391 else:
14392 q.text('None')
14393 q.text(","); q.breakable()
14394 q.text("flags = ");
14395 q.text("%#x" % self.flags)
14396 q.text(","); q.breakable()
14397 q.text("entries = ");
14398 q.pp(self.entries)
14399 q.breakable()
14400 q.text('}')
14401
Rich Lane7dcdf022013-12-11 14:45:27 -080014402stats_request.subtypes[12] = table_features_stats_request
14403
14404class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014405 version = 4
14406 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070014407
14408 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014409 if xid != None:
14410 self.xid = xid
14411 else:
14412 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014413 if table_id != None:
14414 self.table_id = table_id
14415 else:
14416 self.table_id = 0
14417 if config != None:
14418 self.config = config
14419 else:
14420 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014421 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014422
14423 def pack(self):
14424 packed = []
14425 packed.append(struct.pack("!B", self.version))
14426 packed.append(struct.pack("!B", self.type))
14427 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14428 packed.append(struct.pack("!L", self.xid))
14429 packed.append(struct.pack("!B", self.table_id))
14430 packed.append('\x00' * 3)
14431 packed.append(struct.pack("!L", self.config))
14432 length = sum([len(x) for x in packed])
14433 packed[2] = struct.pack("!H", length)
14434 return ''.join(packed)
14435
14436 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014437 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014438 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070014439 _version = reader.read("!B")[0]
14440 assert(_version == 4)
14441 _type = reader.read("!B")[0]
14442 assert(_type == 17)
14443 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014444 orig_reader = reader
14445 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014446 obj.xid = reader.read("!L")[0]
14447 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014448 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070014449 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014450 return obj
14451
14452 def __eq__(self, other):
14453 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014454 if self.xid != other.xid: return False
14455 if self.table_id != other.table_id: return False
14456 if self.config != other.config: return False
14457 return True
14458
Rich Lanec2ee4b82013-04-24 17:12:38 -070014459 def pretty_print(self, q):
14460 q.text("table_mod {")
14461 with q.group():
14462 with q.indent(2):
14463 q.breakable()
14464 q.text("xid = ");
14465 if self.xid != None:
14466 q.text("%#x" % self.xid)
14467 else:
14468 q.text('None')
14469 q.text(","); q.breakable()
14470 q.text("table_id = ");
14471 q.text("%#x" % self.table_id)
14472 q.text(","); q.breakable()
14473 q.text("config = ");
14474 q.text("%#x" % self.config)
14475 q.breakable()
14476 q.text('}')
14477
Rich Lane7dcdf022013-12-11 14:45:27 -080014478message.subtypes[17] = table_mod
14479
14480class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014481 version = 4
14482 type = 1
14483 err_type = 8
14484
14485 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014486 if xid != None:
14487 self.xid = xid
14488 else:
14489 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014490 if code != None:
14491 self.code = code
14492 else:
14493 self.code = 0
14494 if data != None:
14495 self.data = data
14496 else:
14497 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014498 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014499
14500 def pack(self):
14501 packed = []
14502 packed.append(struct.pack("!B", self.version))
14503 packed.append(struct.pack("!B", self.type))
14504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14505 packed.append(struct.pack("!L", self.xid))
14506 packed.append(struct.pack("!H", self.err_type))
14507 packed.append(struct.pack("!H", self.code))
14508 packed.append(self.data)
14509 length = sum([len(x) for x in packed])
14510 packed[2] = struct.pack("!H", length)
14511 return ''.join(packed)
14512
14513 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014514 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014515 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014516 _version = reader.read("!B")[0]
14517 assert(_version == 4)
14518 _type = reader.read("!B")[0]
14519 assert(_type == 1)
14520 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014521 orig_reader = reader
14522 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070014523 obj.xid = reader.read("!L")[0]
14524 _err_type = reader.read("!H")[0]
14525 assert(_err_type == 8)
14526 obj.code = reader.read("!H")[0]
14527 obj.data = str(reader.read_all())
14528 return obj
14529
14530 def __eq__(self, other):
14531 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014532 if self.xid != other.xid: return False
14533 if self.code != other.code: return False
14534 if self.data != other.data: return False
14535 return True
14536
Rich Lane6f4978c2013-10-20 21:33:52 -070014537 def pretty_print(self, q):
14538 q.text("table_mod_failed_error_msg {")
14539 with q.group():
14540 with q.indent(2):
14541 q.breakable()
14542 q.text("xid = ");
14543 if self.xid != None:
14544 q.text("%#x" % self.xid)
14545 else:
14546 q.text('None')
14547 q.text(","); q.breakable()
14548 q.text("code = ");
14549 q.text("%#x" % self.code)
14550 q.text(","); q.breakable()
14551 q.text("data = ");
14552 q.pp(self.data)
14553 q.breakable()
14554 q.text('}')
14555
Rich Lane7dcdf022013-12-11 14:45:27 -080014556error_msg.subtypes[8] = table_mod_failed_error_msg
14557
14558class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014559 version = 4
14560 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014561 stats_type = 3
14562
14563 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014564 if xid != None:
14565 self.xid = xid
14566 else:
14567 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014568 if flags != None:
14569 self.flags = flags
14570 else:
14571 self.flags = 0
14572 if entries != None:
14573 self.entries = entries
14574 else:
14575 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014576 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014577
14578 def pack(self):
14579 packed = []
14580 packed.append(struct.pack("!B", self.version))
14581 packed.append(struct.pack("!B", self.type))
14582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14583 packed.append(struct.pack("!L", self.xid))
14584 packed.append(struct.pack("!H", self.stats_type))
14585 packed.append(struct.pack("!H", self.flags))
14586 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014587 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014588 length = sum([len(x) for x in packed])
14589 packed[2] = struct.pack("!H", length)
14590 return ''.join(packed)
14591
14592 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014593 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014594 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014595 _version = reader.read("!B")[0]
14596 assert(_version == 4)
14597 _type = reader.read("!B")[0]
14598 assert(_type == 19)
14599 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014600 orig_reader = reader
14601 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014602 obj.xid = reader.read("!L")[0]
14603 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014604 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070014605 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014606 reader.skip(4)
14607 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
14608 return obj
14609
14610 def __eq__(self, other):
14611 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014612 if self.xid != other.xid: return False
14613 if self.flags != other.flags: return False
14614 if self.entries != other.entries: return False
14615 return True
14616
Rich Lanec2ee4b82013-04-24 17:12:38 -070014617 def pretty_print(self, q):
14618 q.text("table_stats_reply {")
14619 with q.group():
14620 with q.indent(2):
14621 q.breakable()
14622 q.text("xid = ");
14623 if self.xid != None:
14624 q.text("%#x" % self.xid)
14625 else:
14626 q.text('None')
14627 q.text(","); q.breakable()
14628 q.text("flags = ");
14629 q.text("%#x" % self.flags)
14630 q.text(","); q.breakable()
14631 q.text("entries = ");
14632 q.pp(self.entries)
14633 q.breakable()
14634 q.text('}')
14635
Rich Lane7dcdf022013-12-11 14:45:27 -080014636stats_reply.subtypes[3] = table_stats_reply
14637
14638class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014639 version = 4
14640 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014641 stats_type = 3
14642
14643 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014644 if xid != None:
14645 self.xid = xid
14646 else:
14647 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014648 if flags != None:
14649 self.flags = flags
14650 else:
14651 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014652 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014653
14654 def pack(self):
14655 packed = []
14656 packed.append(struct.pack("!B", self.version))
14657 packed.append(struct.pack("!B", self.type))
14658 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14659 packed.append(struct.pack("!L", self.xid))
14660 packed.append(struct.pack("!H", self.stats_type))
14661 packed.append(struct.pack("!H", self.flags))
14662 packed.append('\x00' * 4)
14663 length = sum([len(x) for x in packed])
14664 packed[2] = struct.pack("!H", length)
14665 return ''.join(packed)
14666
14667 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014668 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014669 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014670 _version = reader.read("!B")[0]
14671 assert(_version == 4)
14672 _type = reader.read("!B")[0]
14673 assert(_type == 18)
14674 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014675 orig_reader = reader
14676 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070014677 obj.xid = reader.read("!L")[0]
14678 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014679 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070014680 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014681 reader.skip(4)
14682 return obj
14683
14684 def __eq__(self, other):
14685 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014686 if self.xid != other.xid: return False
14687 if self.flags != other.flags: return False
14688 return True
14689
Rich Lanec2ee4b82013-04-24 17:12:38 -070014690 def pretty_print(self, q):
14691 q.text("table_stats_request {")
14692 with q.group():
14693 with q.indent(2):
14694 q.breakable()
14695 q.text("xid = ");
14696 if self.xid != None:
14697 q.text("%#x" % self.xid)
14698 else:
14699 q.text('None')
14700 q.text(","); q.breakable()
14701 q.text("flags = ");
14702 q.text("%#x" % self.flags)
14703 q.breakable()
14704 q.text('}')
14705
Rich Lane7dcdf022013-12-11 14:45:27 -080014706stats_request.subtypes[3] = table_stats_request
14707
Rich Lanec2ee4b82013-04-24 17:12:38 -070014708
14709def parse_header(buf):
14710 if len(buf) < 8:
14711 raise loxi.ProtocolError("too short to be an OpenFlow message")
14712 return struct.unpack_from("!BBHL", buf)
14713
14714def parse_message(buf):
14715 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070014716 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
14717 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014718 if len(buf) != msg_len:
14719 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080014720 return message.unpack(loxi.generic_util.OFReader(buf))