blob: f4716fccd45503de1ca80d0fcd89ee51ef9e3915 [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 Lane7dcdf022013-12-11 14:45:27 -08002112class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002113 version = 4
2114 type = 4
2115 experimenter = 6035143
2116 subtype = 40
2117
2118 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002119 if xid != None:
2120 self.xid = xid
2121 else:
2122 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002123 if cookie != None:
2124 self.cookie = cookie
2125 else:
2126 self.cookie = 0
2127 if priority != None:
2128 self.priority = priority
2129 else:
2130 self.priority = 0
2131 if table_id != None:
2132 self.table_id = table_id
2133 else:
2134 self.table_id = 0
2135 if match != None:
2136 self.match = match
2137 else:
2138 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08002139 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002140
2141 def pack(self):
2142 packed = []
2143 packed.append(struct.pack("!B", self.version))
2144 packed.append(struct.pack("!B", self.type))
2145 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2146 packed.append(struct.pack("!L", self.xid))
2147 packed.append(struct.pack("!L", self.experimenter))
2148 packed.append(struct.pack("!L", self.subtype))
2149 packed.append(struct.pack("!Q", self.cookie))
2150 packed.append(struct.pack("!H", self.priority))
2151 packed.append(struct.pack("!B", self.table_id))
2152 packed.append('\x00' * 5)
2153 packed.append(self.match.pack())
2154 length = sum([len(x) for x in packed])
2155 packed[2] = struct.pack("!H", length)
2156 return ''.join(packed)
2157
2158 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002159 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002160 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07002161 _version = reader.read("!B")[0]
2162 assert(_version == 4)
2163 _type = reader.read("!B")[0]
2164 assert(_type == 4)
2165 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002166 orig_reader = reader
2167 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002168 obj.xid = reader.read("!L")[0]
2169 _experimenter = reader.read("!L")[0]
2170 assert(_experimenter == 6035143)
2171 _subtype = reader.read("!L")[0]
2172 assert(_subtype == 40)
2173 obj.cookie = reader.read("!Q")[0]
2174 obj.priority = reader.read("!H")[0]
2175 obj.table_id = reader.read("!B")[0]
2176 reader.skip(5)
2177 obj.match = common.match.unpack(reader)
2178 return obj
2179
2180 def __eq__(self, other):
2181 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002182 if self.xid != other.xid: return False
2183 if self.cookie != other.cookie: return False
2184 if self.priority != other.priority: return False
2185 if self.table_id != other.table_id: return False
2186 if self.match != other.match: return False
2187 return True
2188
Rich Lane6f4978c2013-10-20 21:33:52 -07002189 def pretty_print(self, q):
2190 q.text("bsn_flow_idle {")
2191 with q.group():
2192 with q.indent(2):
2193 q.breakable()
2194 q.text("xid = ");
2195 if self.xid != None:
2196 q.text("%#x" % self.xid)
2197 else:
2198 q.text('None')
2199 q.text(","); q.breakable()
2200 q.text("cookie = ");
2201 q.text("%#x" % self.cookie)
2202 q.text(","); q.breakable()
2203 q.text("priority = ");
2204 q.text("%#x" % self.priority)
2205 q.text(","); q.breakable()
2206 q.text("table_id = ");
2207 q.text("%#x" % self.table_id)
2208 q.text(","); q.breakable()
2209 q.text("match = ");
2210 q.pp(self.match)
2211 q.breakable()
2212 q.text('}')
2213
Rich Lane7dcdf022013-12-11 14:45:27 -08002214bsn_header.subtypes[40] = bsn_flow_idle
2215
2216class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002217 version = 4
2218 type = 4
2219 experimenter = 6035143
2220 subtype = 39
2221
2222 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002223 if xid != None:
2224 self.xid = xid
2225 else:
2226 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002227 if enabled != None:
2228 self.enabled = enabled
2229 else:
2230 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002231 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002232
2233 def pack(self):
2234 packed = []
2235 packed.append(struct.pack("!B", self.version))
2236 packed.append(struct.pack("!B", self.type))
2237 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2238 packed.append(struct.pack("!L", self.xid))
2239 packed.append(struct.pack("!L", self.experimenter))
2240 packed.append(struct.pack("!L", self.subtype))
2241 packed.append(struct.pack("!L", self.enabled))
2242 length = sum([len(x) for x in packed])
2243 packed[2] = struct.pack("!H", length)
2244 return ''.join(packed)
2245
2246 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002247 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002248 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002249 _version = reader.read("!B")[0]
2250 assert(_version == 4)
2251 _type = reader.read("!B")[0]
2252 assert(_type == 4)
2253 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002254 orig_reader = reader
2255 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002256 obj.xid = reader.read("!L")[0]
2257 _experimenter = reader.read("!L")[0]
2258 assert(_experimenter == 6035143)
2259 _subtype = reader.read("!L")[0]
2260 assert(_subtype == 39)
2261 obj.enabled = reader.read("!L")[0]
2262 return obj
2263
2264 def __eq__(self, other):
2265 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002266 if self.xid != other.xid: return False
2267 if self.enabled != other.enabled: return False
2268 return True
2269
Rich Lane6f4978c2013-10-20 21:33:52 -07002270 def pretty_print(self, q):
2271 q.text("bsn_flow_idle_enable_get_reply {")
2272 with q.group():
2273 with q.indent(2):
2274 q.breakable()
2275 q.text("xid = ");
2276 if self.xid != None:
2277 q.text("%#x" % self.xid)
2278 else:
2279 q.text('None')
2280 q.text(","); q.breakable()
2281 q.text("enabled = ");
2282 q.text("%#x" % self.enabled)
2283 q.breakable()
2284 q.text('}')
2285
Rich Lane7dcdf022013-12-11 14:45:27 -08002286bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
2287
2288class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002289 version = 4
2290 type = 4
2291 experimenter = 6035143
2292 subtype = 38
2293
2294 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002295 if xid != None:
2296 self.xid = xid
2297 else:
2298 self.xid = None
2299 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002300
2301 def pack(self):
2302 packed = []
2303 packed.append(struct.pack("!B", self.version))
2304 packed.append(struct.pack("!B", self.type))
2305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2306 packed.append(struct.pack("!L", self.xid))
2307 packed.append(struct.pack("!L", self.experimenter))
2308 packed.append(struct.pack("!L", self.subtype))
2309 length = sum([len(x) for x in packed])
2310 packed[2] = struct.pack("!H", length)
2311 return ''.join(packed)
2312
2313 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002314 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002315 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002316 _version = reader.read("!B")[0]
2317 assert(_version == 4)
2318 _type = reader.read("!B")[0]
2319 assert(_type == 4)
2320 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002321 orig_reader = reader
2322 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002323 obj.xid = reader.read("!L")[0]
2324 _experimenter = reader.read("!L")[0]
2325 assert(_experimenter == 6035143)
2326 _subtype = reader.read("!L")[0]
2327 assert(_subtype == 38)
2328 return obj
2329
2330 def __eq__(self, other):
2331 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002332 if self.xid != other.xid: return False
2333 return True
2334
Rich Lane6f4978c2013-10-20 21:33:52 -07002335 def pretty_print(self, q):
2336 q.text("bsn_flow_idle_enable_get_request {")
2337 with q.group():
2338 with q.indent(2):
2339 q.breakable()
2340 q.text("xid = ");
2341 if self.xid != None:
2342 q.text("%#x" % self.xid)
2343 else:
2344 q.text('None')
2345 q.breakable()
2346 q.text('}')
2347
Rich Lane7dcdf022013-12-11 14:45:27 -08002348bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
2349
2350class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002351 version = 4
2352 type = 4
2353 experimenter = 6035143
2354 subtype = 37
2355
2356 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002357 if xid != None:
2358 self.xid = xid
2359 else:
2360 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002361 if enable != None:
2362 self.enable = enable
2363 else:
2364 self.enable = 0
2365 if status != None:
2366 self.status = status
2367 else:
2368 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002369 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002370
2371 def pack(self):
2372 packed = []
2373 packed.append(struct.pack("!B", self.version))
2374 packed.append(struct.pack("!B", self.type))
2375 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2376 packed.append(struct.pack("!L", self.xid))
2377 packed.append(struct.pack("!L", self.experimenter))
2378 packed.append(struct.pack("!L", self.subtype))
2379 packed.append(struct.pack("!L", self.enable))
2380 packed.append(struct.pack("!L", self.status))
2381 length = sum([len(x) for x in packed])
2382 packed[2] = struct.pack("!H", length)
2383 return ''.join(packed)
2384
2385 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002386 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002387 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002388 _version = reader.read("!B")[0]
2389 assert(_version == 4)
2390 _type = reader.read("!B")[0]
2391 assert(_type == 4)
2392 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002393 orig_reader = reader
2394 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002395 obj.xid = reader.read("!L")[0]
2396 _experimenter = reader.read("!L")[0]
2397 assert(_experimenter == 6035143)
2398 _subtype = reader.read("!L")[0]
2399 assert(_subtype == 37)
2400 obj.enable = reader.read("!L")[0]
2401 obj.status = reader.read("!L")[0]
2402 return obj
2403
2404 def __eq__(self, other):
2405 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002406 if self.xid != other.xid: return False
2407 if self.enable != other.enable: return False
2408 if self.status != other.status: return False
2409 return True
2410
Rich Lane6f4978c2013-10-20 21:33:52 -07002411 def pretty_print(self, q):
2412 q.text("bsn_flow_idle_enable_set_reply {")
2413 with q.group():
2414 with q.indent(2):
2415 q.breakable()
2416 q.text("xid = ");
2417 if self.xid != None:
2418 q.text("%#x" % self.xid)
2419 else:
2420 q.text('None')
2421 q.text(","); q.breakable()
2422 q.text("enable = ");
2423 q.text("%#x" % self.enable)
2424 q.text(","); q.breakable()
2425 q.text("status = ");
2426 q.text("%#x" % self.status)
2427 q.breakable()
2428 q.text('}')
2429
Rich Lane7dcdf022013-12-11 14:45:27 -08002430bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
2431
2432class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002433 version = 4
2434 type = 4
2435 experimenter = 6035143
2436 subtype = 36
2437
2438 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002439 if xid != None:
2440 self.xid = xid
2441 else:
2442 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002443 if enable != None:
2444 self.enable = enable
2445 else:
2446 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002447 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002448
2449 def pack(self):
2450 packed = []
2451 packed.append(struct.pack("!B", self.version))
2452 packed.append(struct.pack("!B", self.type))
2453 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2454 packed.append(struct.pack("!L", self.xid))
2455 packed.append(struct.pack("!L", self.experimenter))
2456 packed.append(struct.pack("!L", self.subtype))
2457 packed.append(struct.pack("!L", self.enable))
2458 length = sum([len(x) for x in packed])
2459 packed[2] = struct.pack("!H", length)
2460 return ''.join(packed)
2461
2462 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002463 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002464 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002465 _version = reader.read("!B")[0]
2466 assert(_version == 4)
2467 _type = reader.read("!B")[0]
2468 assert(_type == 4)
2469 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002470 orig_reader = reader
2471 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002472 obj.xid = reader.read("!L")[0]
2473 _experimenter = reader.read("!L")[0]
2474 assert(_experimenter == 6035143)
2475 _subtype = reader.read("!L")[0]
2476 assert(_subtype == 36)
2477 obj.enable = reader.read("!L")[0]
2478 return obj
2479
2480 def __eq__(self, other):
2481 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002482 if self.xid != other.xid: return False
2483 if self.enable != other.enable: return False
2484 return True
2485
Rich Lane6f4978c2013-10-20 21:33:52 -07002486 def pretty_print(self, q):
2487 q.text("bsn_flow_idle_enable_set_request {")
2488 with q.group():
2489 with q.indent(2):
2490 q.breakable()
2491 q.text("xid = ");
2492 if self.xid != None:
2493 q.text("%#x" % self.xid)
2494 else:
2495 q.text('None')
2496 q.text(","); q.breakable()
2497 q.text("enable = ");
2498 q.text("%#x" % self.enable)
2499 q.breakable()
2500 q.text('}')
2501
Rich Lane7dcdf022013-12-11 14:45:27 -08002502bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
2503
Rich Lane5454b682014-01-14 17:07:36 -08002504class experimenter_stats_reply(stats_reply):
2505 subtypes = {}
2506
Rich Lane95f7fc92014-01-27 17:08:16 -08002507 version = 4
2508 type = 19
2509 stats_type = 65535
2510
2511 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2512 if xid != None:
2513 self.xid = xid
2514 else:
2515 self.xid = None
2516 if flags != None:
2517 self.flags = flags
2518 else:
2519 self.flags = 0
2520 if experimenter != None:
2521 self.experimenter = experimenter
2522 else:
2523 self.experimenter = 0
2524 if subtype != None:
2525 self.subtype = subtype
2526 else:
2527 self.subtype = 0
2528 return
2529
2530 def pack(self):
2531 packed = []
2532 packed.append(struct.pack("!B", self.version))
2533 packed.append(struct.pack("!B", self.type))
2534 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2535 packed.append(struct.pack("!L", self.xid))
2536 packed.append(struct.pack("!H", self.stats_type))
2537 packed.append(struct.pack("!H", self.flags))
2538 packed.append('\x00' * 4)
2539 packed.append(struct.pack("!L", self.experimenter))
2540 packed.append(struct.pack("!L", self.subtype))
2541 length = sum([len(x) for x in packed])
2542 packed[2] = struct.pack("!H", length)
2543 return ''.join(packed)
2544
Rich Lane5454b682014-01-14 17:07:36 -08002545 @staticmethod
2546 def unpack(reader):
2547 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002548 subclass = experimenter_stats_reply.subtypes.get(subtype)
2549 if subclass:
2550 return subclass.unpack(reader)
2551
2552 obj = experimenter_stats_reply()
2553 _version = reader.read("!B")[0]
2554 assert(_version == 4)
2555 _type = reader.read("!B")[0]
2556 assert(_type == 19)
2557 _length = reader.read("!H")[0]
2558 orig_reader = reader
2559 reader = orig_reader.slice(_length - (2 + 2))
2560 obj.xid = reader.read("!L")[0]
2561 _stats_type = reader.read("!H")[0]
2562 assert(_stats_type == 65535)
2563 obj.flags = reader.read("!H")[0]
2564 reader.skip(4)
2565 obj.experimenter = reader.read("!L")[0]
2566 obj.subtype = reader.read("!L")[0]
2567 return obj
2568
2569 def __eq__(self, other):
2570 if type(self) != type(other): return False
2571 if self.xid != other.xid: return False
2572 if self.flags != other.flags: return False
2573 if self.experimenter != other.experimenter: return False
2574 if self.subtype != other.subtype: return False
2575 return True
2576
2577 def pretty_print(self, q):
2578 q.text("experimenter_stats_reply {")
2579 with q.group():
2580 with q.indent(2):
2581 q.breakable()
2582 q.text("xid = ");
2583 if self.xid != None:
2584 q.text("%#x" % self.xid)
2585 else:
2586 q.text('None')
2587 q.text(","); q.breakable()
2588 q.text("flags = ");
2589 q.text("%#x" % self.flags)
2590 q.text(","); q.breakable()
2591 q.text("subtype = ");
2592 q.text("%#x" % self.subtype)
2593 q.breakable()
2594 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002595
2596stats_reply.subtypes[65535] = experimenter_stats_reply
2597
2598class bsn_stats_reply(experimenter_stats_reply):
2599 subtypes = {}
2600
Rich Lane95f7fc92014-01-27 17:08:16 -08002601 version = 4
2602 type = 19
2603 stats_type = 65535
2604 experimenter = 6035143
2605
2606 def __init__(self, xid=None, flags=None, subtype=None):
2607 if xid != None:
2608 self.xid = xid
2609 else:
2610 self.xid = None
2611 if flags != None:
2612 self.flags = flags
2613 else:
2614 self.flags = 0
2615 if subtype != None:
2616 self.subtype = subtype
2617 else:
2618 self.subtype = 0
2619 return
2620
2621 def pack(self):
2622 packed = []
2623 packed.append(struct.pack("!B", self.version))
2624 packed.append(struct.pack("!B", self.type))
2625 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2626 packed.append(struct.pack("!L", self.xid))
2627 packed.append(struct.pack("!H", self.stats_type))
2628 packed.append(struct.pack("!H", self.flags))
2629 packed.append('\x00' * 4)
2630 packed.append(struct.pack("!L", self.experimenter))
2631 packed.append(struct.pack("!L", self.subtype))
2632 length = sum([len(x) for x in packed])
2633 packed[2] = struct.pack("!H", length)
2634 return ''.join(packed)
2635
Rich Lane5454b682014-01-14 17:07:36 -08002636 @staticmethod
2637 def unpack(reader):
2638 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002639 subclass = bsn_stats_reply.subtypes.get(subtype)
2640 if subclass:
2641 return subclass.unpack(reader)
2642
2643 obj = bsn_stats_reply()
2644 _version = reader.read("!B")[0]
2645 assert(_version == 4)
2646 _type = reader.read("!B")[0]
2647 assert(_type == 19)
2648 _length = reader.read("!H")[0]
2649 orig_reader = reader
2650 reader = orig_reader.slice(_length - (2 + 2))
2651 obj.xid = reader.read("!L")[0]
2652 _stats_type = reader.read("!H")[0]
2653 assert(_stats_type == 65535)
2654 obj.flags = reader.read("!H")[0]
2655 reader.skip(4)
2656 _experimenter = reader.read("!L")[0]
2657 assert(_experimenter == 6035143)
2658 obj.subtype = reader.read("!L")[0]
2659 return obj
2660
2661 def __eq__(self, other):
2662 if type(self) != type(other): return False
2663 if self.xid != other.xid: return False
2664 if self.flags != other.flags: return False
2665 if self.subtype != other.subtype: return False
2666 return True
2667
2668 def pretty_print(self, q):
2669 q.text("bsn_stats_reply {")
2670 with q.group():
2671 with q.indent(2):
2672 q.breakable()
2673 q.text("xid = ");
2674 if self.xid != None:
2675 q.text("%#x" % self.xid)
2676 else:
2677 q.text('None')
2678 q.text(","); q.breakable()
2679 q.text("flags = ");
2680 q.text("%#x" % self.flags)
2681 q.breakable()
2682 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002683
2684experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2685
2686class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
2687 version = 4
2688 type = 19
2689 stats_type = 65535
2690 experimenter = 6035143
2691 subtype = 5
2692
2693 def __init__(self, xid=None, flags=None, entries=None):
2694 if xid != None:
2695 self.xid = xid
2696 else:
2697 self.xid = None
2698 if flags != None:
2699 self.flags = flags
2700 else:
2701 self.flags = 0
2702 if entries != None:
2703 self.entries = entries
2704 else:
2705 self.entries = []
2706 return
2707
2708 def pack(self):
2709 packed = []
2710 packed.append(struct.pack("!B", self.version))
2711 packed.append(struct.pack("!B", self.type))
2712 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2713 packed.append(struct.pack("!L", self.xid))
2714 packed.append(struct.pack("!H", self.stats_type))
2715 packed.append(struct.pack("!H", self.flags))
2716 packed.append('\x00' * 4)
2717 packed.append(struct.pack("!L", self.experimenter))
2718 packed.append(struct.pack("!L", self.subtype))
2719 packed.append(loxi.generic_util.pack_list(self.entries))
2720 length = sum([len(x) for x in packed])
2721 packed[2] = struct.pack("!H", length)
2722 return ''.join(packed)
2723
2724 @staticmethod
2725 def unpack(reader):
2726 obj = bsn_gentable_bucket_stats_reply()
2727 _version = reader.read("!B")[0]
2728 assert(_version == 4)
2729 _type = reader.read("!B")[0]
2730 assert(_type == 19)
2731 _length = reader.read("!H")[0]
2732 orig_reader = reader
2733 reader = orig_reader.slice(_length - (2 + 2))
2734 obj.xid = reader.read("!L")[0]
2735 _stats_type = reader.read("!H")[0]
2736 assert(_stats_type == 65535)
2737 obj.flags = reader.read("!H")[0]
2738 reader.skip(4)
2739 _experimenter = reader.read("!L")[0]
2740 assert(_experimenter == 6035143)
2741 _subtype = reader.read("!L")[0]
2742 assert(_subtype == 5)
2743 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
2744 return obj
2745
2746 def __eq__(self, other):
2747 if type(self) != type(other): return False
2748 if self.xid != other.xid: return False
2749 if self.flags != other.flags: return False
2750 if self.entries != other.entries: return False
2751 return True
2752
2753 def pretty_print(self, q):
2754 q.text("bsn_gentable_bucket_stats_reply {")
2755 with q.group():
2756 with q.indent(2):
2757 q.breakable()
2758 q.text("xid = ");
2759 if self.xid != None:
2760 q.text("%#x" % self.xid)
2761 else:
2762 q.text('None')
2763 q.text(","); q.breakable()
2764 q.text("flags = ");
2765 q.text("%#x" % self.flags)
2766 q.text(","); q.breakable()
2767 q.text("entries = ");
2768 q.pp(self.entries)
2769 q.breakable()
2770 q.text('}')
2771
2772bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
2773
2774class experimenter_stats_request(stats_request):
2775 subtypes = {}
2776
Rich Lane95f7fc92014-01-27 17:08:16 -08002777 version = 4
2778 type = 18
2779 stats_type = 65535
2780
2781 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2782 if xid != None:
2783 self.xid = xid
2784 else:
2785 self.xid = None
2786 if flags != None:
2787 self.flags = flags
2788 else:
2789 self.flags = 0
2790 if experimenter != None:
2791 self.experimenter = experimenter
2792 else:
2793 self.experimenter = 0
2794 if subtype != None:
2795 self.subtype = subtype
2796 else:
2797 self.subtype = 0
2798 return
2799
2800 def pack(self):
2801 packed = []
2802 packed.append(struct.pack("!B", self.version))
2803 packed.append(struct.pack("!B", self.type))
2804 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2805 packed.append(struct.pack("!L", self.xid))
2806 packed.append(struct.pack("!H", self.stats_type))
2807 packed.append(struct.pack("!H", self.flags))
2808 packed.append('\x00' * 4)
2809 packed.append(struct.pack("!L", self.experimenter))
2810 packed.append(struct.pack("!L", self.subtype))
2811 length = sum([len(x) for x in packed])
2812 packed[2] = struct.pack("!H", length)
2813 return ''.join(packed)
2814
Rich Lane5454b682014-01-14 17:07:36 -08002815 @staticmethod
2816 def unpack(reader):
2817 subtype, = reader.peek('!L', 16)
Rich Lane95f7fc92014-01-27 17:08:16 -08002818 subclass = experimenter_stats_request.subtypes.get(subtype)
2819 if subclass:
2820 return subclass.unpack(reader)
2821
2822 obj = experimenter_stats_request()
2823 _version = reader.read("!B")[0]
2824 assert(_version == 4)
2825 _type = reader.read("!B")[0]
2826 assert(_type == 18)
2827 _length = reader.read("!H")[0]
2828 orig_reader = reader
2829 reader = orig_reader.slice(_length - (2 + 2))
2830 obj.xid = reader.read("!L")[0]
2831 _stats_type = reader.read("!H")[0]
2832 assert(_stats_type == 65535)
2833 obj.flags = reader.read("!H")[0]
2834 reader.skip(4)
2835 obj.experimenter = reader.read("!L")[0]
2836 obj.subtype = reader.read("!L")[0]
2837 return obj
2838
2839 def __eq__(self, other):
2840 if type(self) != type(other): return False
2841 if self.xid != other.xid: return False
2842 if self.flags != other.flags: return False
2843 if self.experimenter != other.experimenter: return False
2844 if self.subtype != other.subtype: return False
2845 return True
2846
2847 def pretty_print(self, q):
2848 q.text("experimenter_stats_request {")
2849 with q.group():
2850 with q.indent(2):
2851 q.breakable()
2852 q.text("xid = ");
2853 if self.xid != None:
2854 q.text("%#x" % self.xid)
2855 else:
2856 q.text('None')
2857 q.text(","); q.breakable()
2858 q.text("flags = ");
2859 q.text("%#x" % self.flags)
2860 q.text(","); q.breakable()
2861 q.text("subtype = ");
2862 q.text("%#x" % self.subtype)
2863 q.breakable()
2864 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002865
2866stats_request.subtypes[65535] = experimenter_stats_request
2867
2868class bsn_stats_request(experimenter_stats_request):
2869 subtypes = {}
2870
Rich Lane95f7fc92014-01-27 17:08:16 -08002871 version = 4
2872 type = 18
2873 stats_type = 65535
2874 experimenter = 6035143
2875
2876 def __init__(self, xid=None, flags=None, subtype=None):
2877 if xid != None:
2878 self.xid = xid
2879 else:
2880 self.xid = None
2881 if flags != None:
2882 self.flags = flags
2883 else:
2884 self.flags = 0
2885 if subtype != None:
2886 self.subtype = subtype
2887 else:
2888 self.subtype = 0
2889 return
2890
2891 def pack(self):
2892 packed = []
2893 packed.append(struct.pack("!B", self.version))
2894 packed.append(struct.pack("!B", self.type))
2895 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2896 packed.append(struct.pack("!L", self.xid))
2897 packed.append(struct.pack("!H", self.stats_type))
2898 packed.append(struct.pack("!H", self.flags))
2899 packed.append('\x00' * 4)
2900 packed.append(struct.pack("!L", self.experimenter))
2901 packed.append(struct.pack("!L", self.subtype))
2902 length = sum([len(x) for x in packed])
2903 packed[2] = struct.pack("!H", length)
2904 return ''.join(packed)
2905
Rich Lane5454b682014-01-14 17:07:36 -08002906 @staticmethod
2907 def unpack(reader):
2908 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08002909 subclass = bsn_stats_request.subtypes.get(subtype)
2910 if subclass:
2911 return subclass.unpack(reader)
2912
2913 obj = bsn_stats_request()
2914 _version = reader.read("!B")[0]
2915 assert(_version == 4)
2916 _type = reader.read("!B")[0]
2917 assert(_type == 18)
2918 _length = reader.read("!H")[0]
2919 orig_reader = reader
2920 reader = orig_reader.slice(_length - (2 + 2))
2921 obj.xid = reader.read("!L")[0]
2922 _stats_type = reader.read("!H")[0]
2923 assert(_stats_type == 65535)
2924 obj.flags = reader.read("!H")[0]
2925 reader.skip(4)
2926 _experimenter = reader.read("!L")[0]
2927 assert(_experimenter == 6035143)
2928 obj.subtype = reader.read("!L")[0]
2929 return obj
2930
2931 def __eq__(self, other):
2932 if type(self) != type(other): return False
2933 if self.xid != other.xid: return False
2934 if self.flags != other.flags: return False
2935 if self.subtype != other.subtype: return False
2936 return True
2937
2938 def pretty_print(self, q):
2939 q.text("bsn_stats_request {")
2940 with q.group():
2941 with q.indent(2):
2942 q.breakable()
2943 q.text("xid = ");
2944 if self.xid != None:
2945 q.text("%#x" % self.xid)
2946 else:
2947 q.text('None')
2948 q.text(","); q.breakable()
2949 q.text("flags = ");
2950 q.text("%#x" % self.flags)
2951 q.breakable()
2952 q.text('}')
Rich Lane5454b682014-01-14 17:07:36 -08002953
2954experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2955
2956class bsn_gentable_bucket_stats_request(bsn_stats_request):
2957 version = 4
2958 type = 18
2959 stats_type = 65535
2960 experimenter = 6035143
2961 subtype = 5
2962
2963 def __init__(self, xid=None, flags=None, table_id=None):
2964 if xid != None:
2965 self.xid = xid
2966 else:
2967 self.xid = None
2968 if flags != None:
2969 self.flags = flags
2970 else:
2971 self.flags = 0
2972 if table_id != None:
2973 self.table_id = table_id
2974 else:
2975 self.table_id = 0
2976 return
2977
2978 def pack(self):
2979 packed = []
2980 packed.append(struct.pack("!B", self.version))
2981 packed.append(struct.pack("!B", self.type))
2982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2983 packed.append(struct.pack("!L", self.xid))
2984 packed.append(struct.pack("!H", self.stats_type))
2985 packed.append(struct.pack("!H", self.flags))
2986 packed.append('\x00' * 4)
2987 packed.append(struct.pack("!L", self.experimenter))
2988 packed.append(struct.pack("!L", self.subtype))
2989 packed.append(struct.pack("!H", self.table_id))
2990 length = sum([len(x) for x in packed])
2991 packed[2] = struct.pack("!H", length)
2992 return ''.join(packed)
2993
2994 @staticmethod
2995 def unpack(reader):
2996 obj = bsn_gentable_bucket_stats_request()
2997 _version = reader.read("!B")[0]
2998 assert(_version == 4)
2999 _type = reader.read("!B")[0]
3000 assert(_type == 18)
3001 _length = reader.read("!H")[0]
3002 orig_reader = reader
3003 reader = orig_reader.slice(_length - (2 + 2))
3004 obj.xid = reader.read("!L")[0]
3005 _stats_type = reader.read("!H")[0]
3006 assert(_stats_type == 65535)
3007 obj.flags = reader.read("!H")[0]
3008 reader.skip(4)
3009 _experimenter = reader.read("!L")[0]
3010 assert(_experimenter == 6035143)
3011 _subtype = reader.read("!L")[0]
3012 assert(_subtype == 5)
3013 obj.table_id = reader.read("!H")[0]
3014 return obj
3015
3016 def __eq__(self, other):
3017 if type(self) != type(other): return False
3018 if self.xid != other.xid: return False
3019 if self.flags != other.flags: return False
3020 if self.table_id != other.table_id: return False
3021 return True
3022
3023 def pretty_print(self, q):
3024 q.text("bsn_gentable_bucket_stats_request {")
3025 with q.group():
3026 with q.indent(2):
3027 q.breakable()
3028 q.text("xid = ");
3029 if self.xid != None:
3030 q.text("%#x" % self.xid)
3031 else:
3032 q.text('None')
3033 q.text(","); q.breakable()
3034 q.text("flags = ");
3035 q.text("%#x" % self.flags)
3036 q.text(","); q.breakable()
3037 q.text("table_id = ");
3038 q.text("%#x" % self.table_id)
3039 q.breakable()
3040 q.text('}')
3041
3042bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3043
3044class bsn_gentable_clear_reply(bsn_header):
3045 version = 4
3046 type = 4
3047 experimenter = 6035143
3048 subtype = 49
3049
3050 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3051 if xid != None:
3052 self.xid = xid
3053 else:
3054 self.xid = None
3055 if table_id != None:
3056 self.table_id = table_id
3057 else:
3058 self.table_id = 0
3059 if deleted_count != None:
3060 self.deleted_count = deleted_count
3061 else:
3062 self.deleted_count = 0
3063 if error_count != None:
3064 self.error_count = error_count
3065 else:
3066 self.error_count = 0
3067 return
3068
3069 def pack(self):
3070 packed = []
3071 packed.append(struct.pack("!B", self.version))
3072 packed.append(struct.pack("!B", self.type))
3073 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3074 packed.append(struct.pack("!L", self.xid))
3075 packed.append(struct.pack("!L", self.experimenter))
3076 packed.append(struct.pack("!L", self.subtype))
3077 packed.append(struct.pack("!H", self.table_id))
3078 packed.append('\x00' * 2)
3079 packed.append(struct.pack("!L", self.deleted_count))
3080 packed.append(struct.pack("!L", self.error_count))
3081 length = sum([len(x) for x in packed])
3082 packed[2] = struct.pack("!H", length)
3083 return ''.join(packed)
3084
3085 @staticmethod
3086 def unpack(reader):
3087 obj = bsn_gentable_clear_reply()
3088 _version = reader.read("!B")[0]
3089 assert(_version == 4)
3090 _type = reader.read("!B")[0]
3091 assert(_type == 4)
3092 _length = reader.read("!H")[0]
3093 orig_reader = reader
3094 reader = orig_reader.slice(_length - (2 + 2))
3095 obj.xid = reader.read("!L")[0]
3096 _experimenter = reader.read("!L")[0]
3097 assert(_experimenter == 6035143)
3098 _subtype = reader.read("!L")[0]
3099 assert(_subtype == 49)
3100 obj.table_id = reader.read("!H")[0]
3101 reader.skip(2)
3102 obj.deleted_count = reader.read("!L")[0]
3103 obj.error_count = reader.read("!L")[0]
3104 return obj
3105
3106 def __eq__(self, other):
3107 if type(self) != type(other): return False
3108 if self.xid != other.xid: return False
3109 if self.table_id != other.table_id: return False
3110 if self.deleted_count != other.deleted_count: return False
3111 if self.error_count != other.error_count: return False
3112 return True
3113
3114 def pretty_print(self, q):
3115 q.text("bsn_gentable_clear_reply {")
3116 with q.group():
3117 with q.indent(2):
3118 q.breakable()
3119 q.text("xid = ");
3120 if self.xid != None:
3121 q.text("%#x" % self.xid)
3122 else:
3123 q.text('None')
3124 q.text(","); q.breakable()
3125 q.text("table_id = ");
3126 q.text("%#x" % self.table_id)
3127 q.text(","); q.breakable()
3128 q.text("deleted_count = ");
3129 q.text("%#x" % self.deleted_count)
3130 q.text(","); q.breakable()
3131 q.text("error_count = ");
3132 q.text("%#x" % self.error_count)
3133 q.breakable()
3134 q.text('}')
3135
3136bsn_header.subtypes[49] = bsn_gentable_clear_reply
3137
3138class bsn_gentable_clear_request(bsn_header):
3139 version = 4
3140 type = 4
3141 experimenter = 6035143
3142 subtype = 48
3143
3144 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3145 if xid != None:
3146 self.xid = xid
3147 else:
3148 self.xid = None
3149 if table_id != None:
3150 self.table_id = table_id
3151 else:
3152 self.table_id = 0
3153 if checksum != None:
3154 self.checksum = checksum
3155 else:
3156 self.checksum = 0
3157 if checksum_mask != None:
3158 self.checksum_mask = checksum_mask
3159 else:
3160 self.checksum_mask = 0
3161 return
3162
3163 def pack(self):
3164 packed = []
3165 packed.append(struct.pack("!B", self.version))
3166 packed.append(struct.pack("!B", self.type))
3167 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3168 packed.append(struct.pack("!L", self.xid))
3169 packed.append(struct.pack("!L", self.experimenter))
3170 packed.append(struct.pack("!L", self.subtype))
3171 packed.append(struct.pack("!H", self.table_id))
3172 packed.append('\x00' * 2)
3173 packed.append(util.pack_checksum_128(self.checksum))
3174 packed.append(util.pack_checksum_128(self.checksum_mask))
3175 length = sum([len(x) for x in packed])
3176 packed[2] = struct.pack("!H", length)
3177 return ''.join(packed)
3178
3179 @staticmethod
3180 def unpack(reader):
3181 obj = bsn_gentable_clear_request()
3182 _version = reader.read("!B")[0]
3183 assert(_version == 4)
3184 _type = reader.read("!B")[0]
3185 assert(_type == 4)
3186 _length = reader.read("!H")[0]
3187 orig_reader = reader
3188 reader = orig_reader.slice(_length - (2 + 2))
3189 obj.xid = reader.read("!L")[0]
3190 _experimenter = reader.read("!L")[0]
3191 assert(_experimenter == 6035143)
3192 _subtype = reader.read("!L")[0]
3193 assert(_subtype == 48)
3194 obj.table_id = reader.read("!H")[0]
3195 reader.skip(2)
3196 obj.checksum = util.unpack_checksum_128(reader)
3197 obj.checksum_mask = util.unpack_checksum_128(reader)
3198 return obj
3199
3200 def __eq__(self, other):
3201 if type(self) != type(other): return False
3202 if self.xid != other.xid: return False
3203 if self.table_id != other.table_id: return False
3204 if self.checksum != other.checksum: return False
3205 if self.checksum_mask != other.checksum_mask: return False
3206 return True
3207
3208 def pretty_print(self, q):
3209 q.text("bsn_gentable_clear_request {")
3210 with q.group():
3211 with q.indent(2):
3212 q.breakable()
3213 q.text("xid = ");
3214 if self.xid != None:
3215 q.text("%#x" % self.xid)
3216 else:
3217 q.text('None')
3218 q.text(","); q.breakable()
3219 q.text("table_id = ");
3220 q.text("%#x" % self.table_id)
3221 q.text(","); q.breakable()
3222 q.text("checksum = ");
3223 q.pp(self.checksum)
3224 q.text(","); q.breakable()
3225 q.text("checksum_mask = ");
3226 q.pp(self.checksum_mask)
3227 q.breakable()
3228 q.text('}')
3229
3230bsn_header.subtypes[48] = bsn_gentable_clear_request
3231
3232class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3233 version = 4
3234 type = 19
3235 stats_type = 65535
3236 experimenter = 6035143
3237 subtype = 4
3238
3239 def __init__(self, xid=None, flags=None, entries=None):
3240 if xid != None:
3241 self.xid = xid
3242 else:
3243 self.xid = None
3244 if flags != None:
3245 self.flags = flags
3246 else:
3247 self.flags = 0
3248 if entries != None:
3249 self.entries = entries
3250 else:
3251 self.entries = []
3252 return
3253
3254 def pack(self):
3255 packed = []
3256 packed.append(struct.pack("!B", self.version))
3257 packed.append(struct.pack("!B", self.type))
3258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3259 packed.append(struct.pack("!L", self.xid))
3260 packed.append(struct.pack("!H", self.stats_type))
3261 packed.append(struct.pack("!H", self.flags))
3262 packed.append('\x00' * 4)
3263 packed.append(struct.pack("!L", self.experimenter))
3264 packed.append(struct.pack("!L", self.subtype))
3265 packed.append(loxi.generic_util.pack_list(self.entries))
3266 length = sum([len(x) for x in packed])
3267 packed[2] = struct.pack("!H", length)
3268 return ''.join(packed)
3269
3270 @staticmethod
3271 def unpack(reader):
3272 obj = bsn_gentable_desc_stats_reply()
3273 _version = reader.read("!B")[0]
3274 assert(_version == 4)
3275 _type = reader.read("!B")[0]
3276 assert(_type == 19)
3277 _length = reader.read("!H")[0]
3278 orig_reader = reader
3279 reader = orig_reader.slice(_length - (2 + 2))
3280 obj.xid = reader.read("!L")[0]
3281 _stats_type = reader.read("!H")[0]
3282 assert(_stats_type == 65535)
3283 obj.flags = reader.read("!H")[0]
3284 reader.skip(4)
3285 _experimenter = reader.read("!L")[0]
3286 assert(_experimenter == 6035143)
3287 _subtype = reader.read("!L")[0]
3288 assert(_subtype == 4)
3289 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3290 return obj
3291
3292 def __eq__(self, other):
3293 if type(self) != type(other): return False
3294 if self.xid != other.xid: return False
3295 if self.flags != other.flags: return False
3296 if self.entries != other.entries: return False
3297 return True
3298
3299 def pretty_print(self, q):
3300 q.text("bsn_gentable_desc_stats_reply {")
3301 with q.group():
3302 with q.indent(2):
3303 q.breakable()
3304 q.text("xid = ");
3305 if self.xid != None:
3306 q.text("%#x" % self.xid)
3307 else:
3308 q.text('None')
3309 q.text(","); q.breakable()
3310 q.text("flags = ");
3311 q.text("%#x" % self.flags)
3312 q.text(","); q.breakable()
3313 q.text("entries = ");
3314 q.pp(self.entries)
3315 q.breakable()
3316 q.text('}')
3317
3318bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
3319
3320class bsn_gentable_desc_stats_request(bsn_stats_request):
3321 version = 4
3322 type = 18
3323 stats_type = 65535
3324 experimenter = 6035143
3325 subtype = 4
3326
3327 def __init__(self, xid=None, flags=None):
3328 if xid != None:
3329 self.xid = xid
3330 else:
3331 self.xid = None
3332 if flags != None:
3333 self.flags = flags
3334 else:
3335 self.flags = 0
3336 return
3337
3338 def pack(self):
3339 packed = []
3340 packed.append(struct.pack("!B", self.version))
3341 packed.append(struct.pack("!B", self.type))
3342 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3343 packed.append(struct.pack("!L", self.xid))
3344 packed.append(struct.pack("!H", self.stats_type))
3345 packed.append(struct.pack("!H", self.flags))
3346 packed.append('\x00' * 4)
3347 packed.append(struct.pack("!L", self.experimenter))
3348 packed.append(struct.pack("!L", self.subtype))
3349 length = sum([len(x) for x in packed])
3350 packed[2] = struct.pack("!H", length)
3351 return ''.join(packed)
3352
3353 @staticmethod
3354 def unpack(reader):
3355 obj = bsn_gentable_desc_stats_request()
3356 _version = reader.read("!B")[0]
3357 assert(_version == 4)
3358 _type = reader.read("!B")[0]
3359 assert(_type == 18)
3360 _length = reader.read("!H")[0]
3361 orig_reader = reader
3362 reader = orig_reader.slice(_length - (2 + 2))
3363 obj.xid = reader.read("!L")[0]
3364 _stats_type = reader.read("!H")[0]
3365 assert(_stats_type == 65535)
3366 obj.flags = reader.read("!H")[0]
3367 reader.skip(4)
3368 _experimenter = reader.read("!L")[0]
3369 assert(_experimenter == 6035143)
3370 _subtype = reader.read("!L")[0]
3371 assert(_subtype == 4)
3372 return obj
3373
3374 def __eq__(self, other):
3375 if type(self) != type(other): return False
3376 if self.xid != other.xid: return False
3377 if self.flags != other.flags: return False
3378 return True
3379
3380 def pretty_print(self, q):
3381 q.text("bsn_gentable_desc_stats_request {")
3382 with q.group():
3383 with q.indent(2):
3384 q.breakable()
3385 q.text("xid = ");
3386 if self.xid != None:
3387 q.text("%#x" % self.xid)
3388 else:
3389 q.text('None')
3390 q.text(","); q.breakable()
3391 q.text("flags = ");
3392 q.text("%#x" % self.flags)
3393 q.breakable()
3394 q.text('}')
3395
3396bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
3397
3398class bsn_gentable_entry_add(bsn_header):
3399 version = 4
3400 type = 4
3401 experimenter = 6035143
3402 subtype = 46
3403
3404 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
3405 if xid != None:
3406 self.xid = xid
3407 else:
3408 self.xid = None
3409 if table_id != None:
3410 self.table_id = table_id
3411 else:
3412 self.table_id = 0
3413 if checksum != None:
3414 self.checksum = checksum
3415 else:
3416 self.checksum = 0
3417 if key != None:
3418 self.key = key
3419 else:
3420 self.key = []
3421 if value != None:
3422 self.value = value
3423 else:
3424 self.value = []
3425 return
3426
3427 def pack(self):
3428 packed = []
3429 packed.append(struct.pack("!B", self.version))
3430 packed.append(struct.pack("!B", self.type))
3431 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3432 packed.append(struct.pack("!L", self.xid))
3433 packed.append(struct.pack("!L", self.experimenter))
3434 packed.append(struct.pack("!L", self.subtype))
3435 packed.append(struct.pack("!H", self.table_id))
3436 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
3437 packed.append(util.pack_checksum_128(self.checksum))
3438 packed.append(loxi.generic_util.pack_list(self.key))
3439 packed[7] = struct.pack("!H", len(packed[-1]))
3440 packed.append(loxi.generic_util.pack_list(self.value))
3441 length = sum([len(x) for x in packed])
3442 packed[2] = struct.pack("!H", length)
3443 return ''.join(packed)
3444
3445 @staticmethod
3446 def unpack(reader):
3447 obj = bsn_gentable_entry_add()
3448 _version = reader.read("!B")[0]
3449 assert(_version == 4)
3450 _type = reader.read("!B")[0]
3451 assert(_type == 4)
3452 _length = reader.read("!H")[0]
3453 orig_reader = reader
3454 reader = orig_reader.slice(_length - (2 + 2))
3455 obj.xid = reader.read("!L")[0]
3456 _experimenter = reader.read("!L")[0]
3457 assert(_experimenter == 6035143)
3458 _subtype = reader.read("!L")[0]
3459 assert(_subtype == 46)
3460 obj.table_id = reader.read("!H")[0]
3461 _key_length = reader.read("!H")[0]
3462 obj.checksum = util.unpack_checksum_128(reader)
3463 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
3464 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3465 return obj
3466
3467 def __eq__(self, other):
3468 if type(self) != type(other): return False
3469 if self.xid != other.xid: return False
3470 if self.table_id != other.table_id: return False
3471 if self.checksum != other.checksum: return False
3472 if self.key != other.key: return False
3473 if self.value != other.value: return False
3474 return True
3475
3476 def pretty_print(self, q):
3477 q.text("bsn_gentable_entry_add {")
3478 with q.group():
3479 with q.indent(2):
3480 q.breakable()
3481 q.text("xid = ");
3482 if self.xid != None:
3483 q.text("%#x" % self.xid)
3484 else:
3485 q.text('None')
3486 q.text(","); q.breakable()
3487 q.text("table_id = ");
3488 q.text("%#x" % self.table_id)
3489 q.text(","); q.breakable()
3490 q.text("checksum = ");
3491 q.pp(self.checksum)
3492 q.text(","); q.breakable()
3493 q.text("key = ");
3494 q.pp(self.key)
3495 q.text(","); q.breakable()
3496 q.text("value = ");
3497 q.pp(self.value)
3498 q.breakable()
3499 q.text('}')
3500
3501bsn_header.subtypes[46] = bsn_gentable_entry_add
3502
3503class bsn_gentable_entry_delete(bsn_header):
3504 version = 4
3505 type = 4
3506 experimenter = 6035143
3507 subtype = 47
3508
3509 def __init__(self, xid=None, table_id=None, key=None):
3510 if xid != None:
3511 self.xid = xid
3512 else:
3513 self.xid = None
3514 if table_id != None:
3515 self.table_id = table_id
3516 else:
3517 self.table_id = 0
3518 if key != None:
3519 self.key = key
3520 else:
3521 self.key = []
3522 return
3523
3524 def pack(self):
3525 packed = []
3526 packed.append(struct.pack("!B", self.version))
3527 packed.append(struct.pack("!B", self.type))
3528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3529 packed.append(struct.pack("!L", self.xid))
3530 packed.append(struct.pack("!L", self.experimenter))
3531 packed.append(struct.pack("!L", self.subtype))
3532 packed.append(struct.pack("!H", self.table_id))
3533 packed.append(loxi.generic_util.pack_list(self.key))
3534 length = sum([len(x) for x in packed])
3535 packed[2] = struct.pack("!H", length)
3536 return ''.join(packed)
3537
3538 @staticmethod
3539 def unpack(reader):
3540 obj = bsn_gentable_entry_delete()
3541 _version = reader.read("!B")[0]
3542 assert(_version == 4)
3543 _type = reader.read("!B")[0]
3544 assert(_type == 4)
3545 _length = reader.read("!H")[0]
3546 orig_reader = reader
3547 reader = orig_reader.slice(_length - (2 + 2))
3548 obj.xid = reader.read("!L")[0]
3549 _experimenter = reader.read("!L")[0]
3550 assert(_experimenter == 6035143)
3551 _subtype = reader.read("!L")[0]
3552 assert(_subtype == 47)
3553 obj.table_id = reader.read("!H")[0]
3554 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3555 return obj
3556
3557 def __eq__(self, other):
3558 if type(self) != type(other): return False
3559 if self.xid != other.xid: return False
3560 if self.table_id != other.table_id: return False
3561 if self.key != other.key: return False
3562 return True
3563
3564 def pretty_print(self, q):
3565 q.text("bsn_gentable_entry_delete {")
3566 with q.group():
3567 with q.indent(2):
3568 q.breakable()
3569 q.text("xid = ");
3570 if self.xid != None:
3571 q.text("%#x" % self.xid)
3572 else:
3573 q.text('None')
3574 q.text(","); q.breakable()
3575 q.text("table_id = ");
3576 q.text("%#x" % self.table_id)
3577 q.text(","); q.breakable()
3578 q.text("key = ");
3579 q.pp(self.key)
3580 q.breakable()
3581 q.text('}')
3582
3583bsn_header.subtypes[47] = bsn_gentable_entry_delete
3584
3585class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
3586 version = 4
3587 type = 19
3588 stats_type = 65535
3589 experimenter = 6035143
3590 subtype = 2
3591
3592 def __init__(self, xid=None, flags=None, entries=None):
3593 if xid != None:
3594 self.xid = xid
3595 else:
3596 self.xid = None
3597 if flags != None:
3598 self.flags = flags
3599 else:
3600 self.flags = 0
3601 if entries != None:
3602 self.entries = entries
3603 else:
3604 self.entries = []
3605 return
3606
3607 def pack(self):
3608 packed = []
3609 packed.append(struct.pack("!B", self.version))
3610 packed.append(struct.pack("!B", self.type))
3611 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3612 packed.append(struct.pack("!L", self.xid))
3613 packed.append(struct.pack("!H", self.stats_type))
3614 packed.append(struct.pack("!H", self.flags))
3615 packed.append('\x00' * 4)
3616 packed.append(struct.pack("!L", self.experimenter))
3617 packed.append(struct.pack("!L", self.subtype))
3618 packed.append(loxi.generic_util.pack_list(self.entries))
3619 length = sum([len(x) for x in packed])
3620 packed[2] = struct.pack("!H", length)
3621 return ''.join(packed)
3622
3623 @staticmethod
3624 def unpack(reader):
3625 obj = bsn_gentable_entry_desc_stats_reply()
3626 _version = reader.read("!B")[0]
3627 assert(_version == 4)
3628 _type = reader.read("!B")[0]
3629 assert(_type == 19)
3630 _length = reader.read("!H")[0]
3631 orig_reader = reader
3632 reader = orig_reader.slice(_length - (2 + 2))
3633 obj.xid = reader.read("!L")[0]
3634 _stats_type = reader.read("!H")[0]
3635 assert(_stats_type == 65535)
3636 obj.flags = reader.read("!H")[0]
3637 reader.skip(4)
3638 _experimenter = reader.read("!L")[0]
3639 assert(_experimenter == 6035143)
3640 _subtype = reader.read("!L")[0]
3641 assert(_subtype == 2)
3642 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
3643 return obj
3644
3645 def __eq__(self, other):
3646 if type(self) != type(other): return False
3647 if self.xid != other.xid: return False
3648 if self.flags != other.flags: return False
3649 if self.entries != other.entries: return False
3650 return True
3651
3652 def pretty_print(self, q):
3653 q.text("bsn_gentable_entry_desc_stats_reply {")
3654 with q.group():
3655 with q.indent(2):
3656 q.breakable()
3657 q.text("xid = ");
3658 if self.xid != None:
3659 q.text("%#x" % self.xid)
3660 else:
3661 q.text('None')
3662 q.text(","); q.breakable()
3663 q.text("flags = ");
3664 q.text("%#x" % self.flags)
3665 q.text(","); q.breakable()
3666 q.text("entries = ");
3667 q.pp(self.entries)
3668 q.breakable()
3669 q.text('}')
3670
3671bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
3672
3673class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
3674 version = 4
3675 type = 18
3676 stats_type = 65535
3677 experimenter = 6035143
3678 subtype = 2
3679
3680 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
3681 if xid != None:
3682 self.xid = xid
3683 else:
3684 self.xid = None
3685 if flags != None:
3686 self.flags = flags
3687 else:
3688 self.flags = 0
3689 if table_id != None:
3690 self.table_id = table_id
3691 else:
3692 self.table_id = 0
3693 if checksum != None:
3694 self.checksum = checksum
3695 else:
3696 self.checksum = 0
3697 if checksum_mask != None:
3698 self.checksum_mask = checksum_mask
3699 else:
3700 self.checksum_mask = 0
3701 return
3702
3703 def pack(self):
3704 packed = []
3705 packed.append(struct.pack("!B", self.version))
3706 packed.append(struct.pack("!B", self.type))
3707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3708 packed.append(struct.pack("!L", self.xid))
3709 packed.append(struct.pack("!H", self.stats_type))
3710 packed.append(struct.pack("!H", self.flags))
3711 packed.append('\x00' * 4)
3712 packed.append(struct.pack("!L", self.experimenter))
3713 packed.append(struct.pack("!L", self.subtype))
3714 packed.append(struct.pack("!H", self.table_id))
3715 packed.append('\x00' * 2)
3716 packed.append(util.pack_checksum_128(self.checksum))
3717 packed.append(util.pack_checksum_128(self.checksum_mask))
3718 length = sum([len(x) for x in packed])
3719 packed[2] = struct.pack("!H", length)
3720 return ''.join(packed)
3721
3722 @staticmethod
3723 def unpack(reader):
3724 obj = bsn_gentable_entry_desc_stats_request()
3725 _version = reader.read("!B")[0]
3726 assert(_version == 4)
3727 _type = reader.read("!B")[0]
3728 assert(_type == 18)
3729 _length = reader.read("!H")[0]
3730 orig_reader = reader
3731 reader = orig_reader.slice(_length - (2 + 2))
3732 obj.xid = reader.read("!L")[0]
3733 _stats_type = reader.read("!H")[0]
3734 assert(_stats_type == 65535)
3735 obj.flags = reader.read("!H")[0]
3736 reader.skip(4)
3737 _experimenter = reader.read("!L")[0]
3738 assert(_experimenter == 6035143)
3739 _subtype = reader.read("!L")[0]
3740 assert(_subtype == 2)
3741 obj.table_id = reader.read("!H")[0]
3742 reader.skip(2)
3743 obj.checksum = util.unpack_checksum_128(reader)
3744 obj.checksum_mask = util.unpack_checksum_128(reader)
3745 return obj
3746
3747 def __eq__(self, other):
3748 if type(self) != type(other): return False
3749 if self.xid != other.xid: return False
3750 if self.flags != other.flags: return False
3751 if self.table_id != other.table_id: return False
3752 if self.checksum != other.checksum: return False
3753 if self.checksum_mask != other.checksum_mask: return False
3754 return True
3755
3756 def pretty_print(self, q):
3757 q.text("bsn_gentable_entry_desc_stats_request {")
3758 with q.group():
3759 with q.indent(2):
3760 q.breakable()
3761 q.text("xid = ");
3762 if self.xid != None:
3763 q.text("%#x" % self.xid)
3764 else:
3765 q.text('None')
3766 q.text(","); q.breakable()
3767 q.text("flags = ");
3768 q.text("%#x" % self.flags)
3769 q.text(","); q.breakable()
3770 q.text("table_id = ");
3771 q.text("%#x" % self.table_id)
3772 q.text(","); q.breakable()
3773 q.text("checksum = ");
3774 q.pp(self.checksum)
3775 q.text(","); q.breakable()
3776 q.text("checksum_mask = ");
3777 q.pp(self.checksum_mask)
3778 q.breakable()
3779 q.text('}')
3780
3781bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
3782
3783class bsn_gentable_entry_stats_reply(bsn_stats_reply):
3784 version = 4
3785 type = 19
3786 stats_type = 65535
3787 experimenter = 6035143
3788 subtype = 3
3789
3790 def __init__(self, xid=None, flags=None, entries=None):
3791 if xid != None:
3792 self.xid = xid
3793 else:
3794 self.xid = None
3795 if flags != None:
3796 self.flags = flags
3797 else:
3798 self.flags = 0
3799 if entries != None:
3800 self.entries = entries
3801 else:
3802 self.entries = []
3803 return
3804
3805 def pack(self):
3806 packed = []
3807 packed.append(struct.pack("!B", self.version))
3808 packed.append(struct.pack("!B", self.type))
3809 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3810 packed.append(struct.pack("!L", self.xid))
3811 packed.append(struct.pack("!H", self.stats_type))
3812 packed.append(struct.pack("!H", self.flags))
3813 packed.append('\x00' * 4)
3814 packed.append(struct.pack("!L", self.experimenter))
3815 packed.append(struct.pack("!L", self.subtype))
3816 packed.append(loxi.generic_util.pack_list(self.entries))
3817 length = sum([len(x) for x in packed])
3818 packed[2] = struct.pack("!H", length)
3819 return ''.join(packed)
3820
3821 @staticmethod
3822 def unpack(reader):
3823 obj = bsn_gentable_entry_stats_reply()
3824 _version = reader.read("!B")[0]
3825 assert(_version == 4)
3826 _type = reader.read("!B")[0]
3827 assert(_type == 19)
3828 _length = reader.read("!H")[0]
3829 orig_reader = reader
3830 reader = orig_reader.slice(_length - (2 + 2))
3831 obj.xid = reader.read("!L")[0]
3832 _stats_type = reader.read("!H")[0]
3833 assert(_stats_type == 65535)
3834 obj.flags = reader.read("!H")[0]
3835 reader.skip(4)
3836 _experimenter = reader.read("!L")[0]
3837 assert(_experimenter == 6035143)
3838 _subtype = reader.read("!L")[0]
3839 assert(_subtype == 3)
3840 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
3841 return obj
3842
3843 def __eq__(self, other):
3844 if type(self) != type(other): return False
3845 if self.xid != other.xid: return False
3846 if self.flags != other.flags: return False
3847 if self.entries != other.entries: return False
3848 return True
3849
3850 def pretty_print(self, q):
3851 q.text("bsn_gentable_entry_stats_reply {")
3852 with q.group():
3853 with q.indent(2):
3854 q.breakable()
3855 q.text("xid = ");
3856 if self.xid != None:
3857 q.text("%#x" % self.xid)
3858 else:
3859 q.text('None')
3860 q.text(","); q.breakable()
3861 q.text("flags = ");
3862 q.text("%#x" % self.flags)
3863 q.text(","); q.breakable()
3864 q.text("entries = ");
3865 q.pp(self.entries)
3866 q.breakable()
3867 q.text('}')
3868
3869bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
3870
3871class bsn_gentable_entry_stats_request(bsn_stats_request):
3872 version = 4
3873 type = 18
3874 stats_type = 65535
3875 experimenter = 6035143
3876 subtype = 3
3877
3878 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
3879 if xid != None:
3880 self.xid = xid
3881 else:
3882 self.xid = None
3883 if flags != None:
3884 self.flags = flags
3885 else:
3886 self.flags = 0
3887 if table_id != None:
3888 self.table_id = table_id
3889 else:
3890 self.table_id = 0
3891 if checksum != None:
3892 self.checksum = checksum
3893 else:
3894 self.checksum = 0
3895 if checksum_mask != None:
3896 self.checksum_mask = checksum_mask
3897 else:
3898 self.checksum_mask = 0
3899 return
3900
3901 def pack(self):
3902 packed = []
3903 packed.append(struct.pack("!B", self.version))
3904 packed.append(struct.pack("!B", self.type))
3905 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3906 packed.append(struct.pack("!L", self.xid))
3907 packed.append(struct.pack("!H", self.stats_type))
3908 packed.append(struct.pack("!H", self.flags))
3909 packed.append('\x00' * 4)
3910 packed.append(struct.pack("!L", self.experimenter))
3911 packed.append(struct.pack("!L", self.subtype))
3912 packed.append(struct.pack("!H", self.table_id))
3913 packed.append('\x00' * 2)
3914 packed.append(util.pack_checksum_128(self.checksum))
3915 packed.append(util.pack_checksum_128(self.checksum_mask))
3916 length = sum([len(x) for x in packed])
3917 packed[2] = struct.pack("!H", length)
3918 return ''.join(packed)
3919
3920 @staticmethod
3921 def unpack(reader):
3922 obj = bsn_gentable_entry_stats_request()
3923 _version = reader.read("!B")[0]
3924 assert(_version == 4)
3925 _type = reader.read("!B")[0]
3926 assert(_type == 18)
3927 _length = reader.read("!H")[0]
3928 orig_reader = reader
3929 reader = orig_reader.slice(_length - (2 + 2))
3930 obj.xid = reader.read("!L")[0]
3931 _stats_type = reader.read("!H")[0]
3932 assert(_stats_type == 65535)
3933 obj.flags = reader.read("!H")[0]
3934 reader.skip(4)
3935 _experimenter = reader.read("!L")[0]
3936 assert(_experimenter == 6035143)
3937 _subtype = reader.read("!L")[0]
3938 assert(_subtype == 3)
3939 obj.table_id = reader.read("!H")[0]
3940 reader.skip(2)
3941 obj.checksum = util.unpack_checksum_128(reader)
3942 obj.checksum_mask = util.unpack_checksum_128(reader)
3943 return obj
3944
3945 def __eq__(self, other):
3946 if type(self) != type(other): return False
3947 if self.xid != other.xid: return False
3948 if self.flags != other.flags: return False
3949 if self.table_id != other.table_id: return False
3950 if self.checksum != other.checksum: return False
3951 if self.checksum_mask != other.checksum_mask: return False
3952 return True
3953
3954 def pretty_print(self, q):
3955 q.text("bsn_gentable_entry_stats_request {")
3956 with q.group():
3957 with q.indent(2):
3958 q.breakable()
3959 q.text("xid = ");
3960 if self.xid != None:
3961 q.text("%#x" % self.xid)
3962 else:
3963 q.text('None')
3964 q.text(","); q.breakable()
3965 q.text("flags = ");
3966 q.text("%#x" % self.flags)
3967 q.text(","); q.breakable()
3968 q.text("table_id = ");
3969 q.text("%#x" % self.table_id)
3970 q.text(","); q.breakable()
3971 q.text("checksum = ");
3972 q.pp(self.checksum)
3973 q.text(","); q.breakable()
3974 q.text("checksum_mask = ");
3975 q.pp(self.checksum_mask)
3976 q.breakable()
3977 q.text('}')
3978
3979bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
3980
3981class bsn_gentable_set_buckets_size(bsn_header):
3982 version = 4
3983 type = 4
3984 experimenter = 6035143
3985 subtype = 50
3986
3987 def __init__(self, xid=None, table_id=None, buckets_size=None):
3988 if xid != None:
3989 self.xid = xid
3990 else:
3991 self.xid = None
3992 if table_id != None:
3993 self.table_id = table_id
3994 else:
3995 self.table_id = 0
3996 if buckets_size != None:
3997 self.buckets_size = buckets_size
3998 else:
3999 self.buckets_size = 0
4000 return
4001
4002 def pack(self):
4003 packed = []
4004 packed.append(struct.pack("!B", self.version))
4005 packed.append(struct.pack("!B", self.type))
4006 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4007 packed.append(struct.pack("!L", self.xid))
4008 packed.append(struct.pack("!L", self.experimenter))
4009 packed.append(struct.pack("!L", self.subtype))
4010 packed.append(struct.pack("!H", self.table_id))
4011 packed.append('\x00' * 2)
4012 packed.append(struct.pack("!L", self.buckets_size))
4013 length = sum([len(x) for x in packed])
4014 packed[2] = struct.pack("!H", length)
4015 return ''.join(packed)
4016
4017 @staticmethod
4018 def unpack(reader):
4019 obj = bsn_gentable_set_buckets_size()
4020 _version = reader.read("!B")[0]
4021 assert(_version == 4)
4022 _type = reader.read("!B")[0]
4023 assert(_type == 4)
4024 _length = reader.read("!H")[0]
4025 orig_reader = reader
4026 reader = orig_reader.slice(_length - (2 + 2))
4027 obj.xid = reader.read("!L")[0]
4028 _experimenter = reader.read("!L")[0]
4029 assert(_experimenter == 6035143)
4030 _subtype = reader.read("!L")[0]
4031 assert(_subtype == 50)
4032 obj.table_id = reader.read("!H")[0]
4033 reader.skip(2)
4034 obj.buckets_size = reader.read("!L")[0]
4035 return obj
4036
4037 def __eq__(self, other):
4038 if type(self) != type(other): return False
4039 if self.xid != other.xid: return False
4040 if self.table_id != other.table_id: return False
4041 if self.buckets_size != other.buckets_size: return False
4042 return True
4043
4044 def pretty_print(self, q):
4045 q.text("bsn_gentable_set_buckets_size {")
4046 with q.group():
4047 with q.indent(2):
4048 q.breakable()
4049 q.text("xid = ");
4050 if self.xid != None:
4051 q.text("%#x" % self.xid)
4052 else:
4053 q.text('None')
4054 q.text(","); q.breakable()
4055 q.text("table_id = ");
4056 q.text("%#x" % self.table_id)
4057 q.text(","); q.breakable()
4058 q.text("buckets_size = ");
4059 q.text("%#x" % self.buckets_size)
4060 q.breakable()
4061 q.text('}')
4062
4063bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4064
4065class bsn_gentable_stats_reply(bsn_stats_reply):
4066 version = 4
4067 type = 19
4068 stats_type = 65535
4069 experimenter = 6035143
4070 subtype = 7
4071
4072 def __init__(self, xid=None, flags=None, entries=None):
4073 if xid != None:
4074 self.xid = xid
4075 else:
4076 self.xid = None
4077 if flags != None:
4078 self.flags = flags
4079 else:
4080 self.flags = 0
4081 if entries != None:
4082 self.entries = entries
4083 else:
4084 self.entries = []
4085 return
4086
4087 def pack(self):
4088 packed = []
4089 packed.append(struct.pack("!B", self.version))
4090 packed.append(struct.pack("!B", self.type))
4091 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4092 packed.append(struct.pack("!L", self.xid))
4093 packed.append(struct.pack("!H", self.stats_type))
4094 packed.append(struct.pack("!H", self.flags))
4095 packed.append('\x00' * 4)
4096 packed.append(struct.pack("!L", self.experimenter))
4097 packed.append(struct.pack("!L", self.subtype))
4098 packed.append(loxi.generic_util.pack_list(self.entries))
4099 length = sum([len(x) for x in packed])
4100 packed[2] = struct.pack("!H", length)
4101 return ''.join(packed)
4102
4103 @staticmethod
4104 def unpack(reader):
4105 obj = bsn_gentable_stats_reply()
4106 _version = reader.read("!B")[0]
4107 assert(_version == 4)
4108 _type = reader.read("!B")[0]
4109 assert(_type == 19)
4110 _length = reader.read("!H")[0]
4111 orig_reader = reader
4112 reader = orig_reader.slice(_length - (2 + 2))
4113 obj.xid = reader.read("!L")[0]
4114 _stats_type = reader.read("!H")[0]
4115 assert(_stats_type == 65535)
4116 obj.flags = reader.read("!H")[0]
4117 reader.skip(4)
4118 _experimenter = reader.read("!L")[0]
4119 assert(_experimenter == 6035143)
4120 _subtype = reader.read("!L")[0]
4121 assert(_subtype == 7)
4122 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4123 return obj
4124
4125 def __eq__(self, other):
4126 if type(self) != type(other): return False
4127 if self.xid != other.xid: return False
4128 if self.flags != other.flags: return False
4129 if self.entries != other.entries: return False
4130 return True
4131
4132 def pretty_print(self, q):
4133 q.text("bsn_gentable_stats_reply {")
4134 with q.group():
4135 with q.indent(2):
4136 q.breakable()
4137 q.text("xid = ");
4138 if self.xid != None:
4139 q.text("%#x" % self.xid)
4140 else:
4141 q.text('None')
4142 q.text(","); q.breakable()
4143 q.text("flags = ");
4144 q.text("%#x" % self.flags)
4145 q.text(","); q.breakable()
4146 q.text("entries = ");
4147 q.pp(self.entries)
4148 q.breakable()
4149 q.text('}')
4150
4151bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4152
4153class bsn_gentable_stats_request(bsn_stats_request):
4154 version = 4
4155 type = 18
4156 stats_type = 65535
4157 experimenter = 6035143
4158 subtype = 7
4159
4160 def __init__(self, xid=None, flags=None):
4161 if xid != None:
4162 self.xid = xid
4163 else:
4164 self.xid = None
4165 if flags != None:
4166 self.flags = flags
4167 else:
4168 self.flags = 0
4169 return
4170
4171 def pack(self):
4172 packed = []
4173 packed.append(struct.pack("!B", self.version))
4174 packed.append(struct.pack("!B", self.type))
4175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4176 packed.append(struct.pack("!L", self.xid))
4177 packed.append(struct.pack("!H", self.stats_type))
4178 packed.append(struct.pack("!H", self.flags))
4179 packed.append('\x00' * 4)
4180 packed.append(struct.pack("!L", self.experimenter))
4181 packed.append(struct.pack("!L", self.subtype))
4182 length = sum([len(x) for x in packed])
4183 packed[2] = struct.pack("!H", length)
4184 return ''.join(packed)
4185
4186 @staticmethod
4187 def unpack(reader):
4188 obj = bsn_gentable_stats_request()
4189 _version = reader.read("!B")[0]
4190 assert(_version == 4)
4191 _type = reader.read("!B")[0]
4192 assert(_type == 18)
4193 _length = reader.read("!H")[0]
4194 orig_reader = reader
4195 reader = orig_reader.slice(_length - (2 + 2))
4196 obj.xid = reader.read("!L")[0]
4197 _stats_type = reader.read("!H")[0]
4198 assert(_stats_type == 65535)
4199 obj.flags = reader.read("!H")[0]
4200 reader.skip(4)
4201 _experimenter = reader.read("!L")[0]
4202 assert(_experimenter == 6035143)
4203 _subtype = reader.read("!L")[0]
4204 assert(_subtype == 7)
4205 return obj
4206
4207 def __eq__(self, other):
4208 if type(self) != type(other): return False
4209 if self.xid != other.xid: return False
4210 if self.flags != other.flags: return False
4211 return True
4212
4213 def pretty_print(self, q):
4214 q.text("bsn_gentable_stats_request {")
4215 with q.group():
4216 with q.indent(2):
4217 q.breakable()
4218 q.text("xid = ");
4219 if self.xid != None:
4220 q.text("%#x" % self.xid)
4221 else:
4222 q.text('None')
4223 q.text(","); q.breakable()
4224 q.text("flags = ");
4225 q.text("%#x" % self.flags)
4226 q.breakable()
4227 q.text('}')
4228
4229bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4230
Rich Lane7dcdf022013-12-11 14:45:27 -08004231class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004232 version = 4
4233 type = 4
4234 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004235 subtype = 10
4236
4237 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004238 if xid != None:
4239 self.xid = xid
4240 else:
4241 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004242 if interfaces != None:
4243 self.interfaces = interfaces
4244 else:
4245 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004246 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004247
4248 def pack(self):
4249 packed = []
4250 packed.append(struct.pack("!B", self.version))
4251 packed.append(struct.pack("!B", self.type))
4252 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4253 packed.append(struct.pack("!L", self.xid))
4254 packed.append(struct.pack("!L", self.experimenter))
4255 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004256 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004257 length = sum([len(x) for x in packed])
4258 packed[2] = struct.pack("!H", length)
4259 return ''.join(packed)
4260
4261 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004262 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004263 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004264 _version = reader.read("!B")[0]
4265 assert(_version == 4)
4266 _type = reader.read("!B")[0]
4267 assert(_type == 4)
4268 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004269 orig_reader = reader
4270 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004271 obj.xid = reader.read("!L")[0]
4272 _experimenter = reader.read("!L")[0]
4273 assert(_experimenter == 6035143)
4274 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004275 assert(_subtype == 10)
4276 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4277 return obj
4278
4279 def __eq__(self, other):
4280 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004281 if self.xid != other.xid: return False
4282 if self.interfaces != other.interfaces: return False
4283 return True
4284
Rich Lanec2ee4b82013-04-24 17:12:38 -07004285 def pretty_print(self, q):
4286 q.text("bsn_get_interfaces_reply {")
4287 with q.group():
4288 with q.indent(2):
4289 q.breakable()
4290 q.text("xid = ");
4291 if self.xid != None:
4292 q.text("%#x" % self.xid)
4293 else:
4294 q.text('None')
4295 q.text(","); q.breakable()
4296 q.text("interfaces = ");
4297 q.pp(self.interfaces)
4298 q.breakable()
4299 q.text('}')
4300
Rich Lane7dcdf022013-12-11 14:45:27 -08004301bsn_header.subtypes[10] = bsn_get_interfaces_reply
4302
4303class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004304 version = 4
4305 type = 4
4306 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004307 subtype = 9
4308
4309 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004310 if xid != None:
4311 self.xid = xid
4312 else:
4313 self.xid = None
4314 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004315
4316 def pack(self):
4317 packed = []
4318 packed.append(struct.pack("!B", self.version))
4319 packed.append(struct.pack("!B", self.type))
4320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4321 packed.append(struct.pack("!L", self.xid))
4322 packed.append(struct.pack("!L", self.experimenter))
4323 packed.append(struct.pack("!L", self.subtype))
4324 length = sum([len(x) for x in packed])
4325 packed[2] = struct.pack("!H", length)
4326 return ''.join(packed)
4327
4328 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004329 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004330 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004331 _version = reader.read("!B")[0]
4332 assert(_version == 4)
4333 _type = reader.read("!B")[0]
4334 assert(_type == 4)
4335 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004336 orig_reader = reader
4337 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004338 obj.xid = reader.read("!L")[0]
4339 _experimenter = reader.read("!L")[0]
4340 assert(_experimenter == 6035143)
4341 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004342 assert(_subtype == 9)
4343 return obj
4344
4345 def __eq__(self, other):
4346 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004347 if self.xid != other.xid: return False
4348 return True
4349
Rich Lanec2ee4b82013-04-24 17:12:38 -07004350 def pretty_print(self, q):
4351 q.text("bsn_get_interfaces_request {")
4352 with q.group():
4353 with q.indent(2):
4354 q.breakable()
4355 q.text("xid = ");
4356 if self.xid != None:
4357 q.text("%#x" % self.xid)
4358 else:
4359 q.text('None')
4360 q.breakable()
4361 q.text('}')
4362
Rich Lane7dcdf022013-12-11 14:45:27 -08004363bsn_header.subtypes[9] = bsn_get_interfaces_request
4364
4365class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004366 version = 4
4367 type = 4
4368 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004369 subtype = 5
4370
4371 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004372 if xid != None:
4373 self.xid = xid
4374 else:
4375 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004376 if report_mirror_ports != None:
4377 self.report_mirror_ports = report_mirror_ports
4378 else:
4379 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004380 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004381
4382 def pack(self):
4383 packed = []
4384 packed.append(struct.pack("!B", self.version))
4385 packed.append(struct.pack("!B", self.type))
4386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4387 packed.append(struct.pack("!L", self.xid))
4388 packed.append(struct.pack("!L", self.experimenter))
4389 packed.append(struct.pack("!L", self.subtype))
4390 packed.append(struct.pack("!B", self.report_mirror_ports))
4391 packed.append('\x00' * 3)
4392 length = sum([len(x) for x in packed])
4393 packed[2] = struct.pack("!H", length)
4394 return ''.join(packed)
4395
4396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004397 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004398 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004399 _version = reader.read("!B")[0]
4400 assert(_version == 4)
4401 _type = reader.read("!B")[0]
4402 assert(_type == 4)
4403 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004404 orig_reader = reader
4405 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004406 obj.xid = reader.read("!L")[0]
4407 _experimenter = reader.read("!L")[0]
4408 assert(_experimenter == 6035143)
4409 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004410 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07004411 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004412 reader.skip(3)
4413 return obj
4414
4415 def __eq__(self, other):
4416 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004417 if self.xid != other.xid: return False
4418 if self.report_mirror_ports != other.report_mirror_ports: return False
4419 return True
4420
Rich Lanec2ee4b82013-04-24 17:12:38 -07004421 def pretty_print(self, q):
4422 q.text("bsn_get_mirroring_reply {")
4423 with q.group():
4424 with q.indent(2):
4425 q.breakable()
4426 q.text("xid = ");
4427 if self.xid != None:
4428 q.text("%#x" % self.xid)
4429 else:
4430 q.text('None')
4431 q.text(","); q.breakable()
4432 q.text("report_mirror_ports = ");
4433 q.text("%#x" % self.report_mirror_ports)
4434 q.breakable()
4435 q.text('}')
4436
Rich Lane7dcdf022013-12-11 14:45:27 -08004437bsn_header.subtypes[5] = bsn_get_mirroring_reply
4438
4439class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004440 version = 4
4441 type = 4
4442 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004443 subtype = 4
4444
4445 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004446 if xid != None:
4447 self.xid = xid
4448 else:
4449 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004450 if report_mirror_ports != None:
4451 self.report_mirror_ports = report_mirror_ports
4452 else:
4453 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004454 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004455
4456 def pack(self):
4457 packed = []
4458 packed.append(struct.pack("!B", self.version))
4459 packed.append(struct.pack("!B", self.type))
4460 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4461 packed.append(struct.pack("!L", self.xid))
4462 packed.append(struct.pack("!L", self.experimenter))
4463 packed.append(struct.pack("!L", self.subtype))
4464 packed.append(struct.pack("!B", self.report_mirror_ports))
4465 packed.append('\x00' * 3)
4466 length = sum([len(x) for x in packed])
4467 packed[2] = struct.pack("!H", length)
4468 return ''.join(packed)
4469
4470 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004471 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004472 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004473 _version = reader.read("!B")[0]
4474 assert(_version == 4)
4475 _type = reader.read("!B")[0]
4476 assert(_type == 4)
4477 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004478 orig_reader = reader
4479 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004480 obj.xid = reader.read("!L")[0]
4481 _experimenter = reader.read("!L")[0]
4482 assert(_experimenter == 6035143)
4483 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004484 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004485 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004486 reader.skip(3)
4487 return obj
4488
4489 def __eq__(self, other):
4490 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004491 if self.xid != other.xid: return False
4492 if self.report_mirror_ports != other.report_mirror_ports: return False
4493 return True
4494
Rich Lanec2ee4b82013-04-24 17:12:38 -07004495 def pretty_print(self, q):
4496 q.text("bsn_get_mirroring_request {")
4497 with q.group():
4498 with q.indent(2):
4499 q.breakable()
4500 q.text("xid = ");
4501 if self.xid != None:
4502 q.text("%#x" % self.xid)
4503 else:
4504 q.text('None')
4505 q.text(","); q.breakable()
4506 q.text("report_mirror_ports = ");
4507 q.text("%#x" % self.report_mirror_ports)
4508 q.breakable()
4509 q.text('}')
4510
Rich Lane7dcdf022013-12-11 14:45:27 -08004511bsn_header.subtypes[4] = bsn_get_mirroring_request
4512
4513class bsn_get_switch_pipeline_reply(bsn_header):
4514 version = 4
4515 type = 4
4516 experimenter = 6035143
4517 subtype = 52
4518
4519 def __init__(self, xid=None, pipeline=None):
4520 if xid != None:
4521 self.xid = xid
4522 else:
4523 self.xid = None
4524 if pipeline != None:
4525 self.pipeline = pipeline
4526 else:
4527 self.pipeline = ""
4528 return
4529
4530 def pack(self):
4531 packed = []
4532 packed.append(struct.pack("!B", self.version))
4533 packed.append(struct.pack("!B", self.type))
4534 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4535 packed.append(struct.pack("!L", self.xid))
4536 packed.append(struct.pack("!L", self.experimenter))
4537 packed.append(struct.pack("!L", self.subtype))
4538 packed.append(struct.pack("!256s", self.pipeline))
4539 length = sum([len(x) for x in packed])
4540 packed[2] = struct.pack("!H", length)
4541 return ''.join(packed)
4542
4543 @staticmethod
4544 def unpack(reader):
4545 obj = bsn_get_switch_pipeline_reply()
4546 _version = reader.read("!B")[0]
4547 assert(_version == 4)
4548 _type = reader.read("!B")[0]
4549 assert(_type == 4)
4550 _length = reader.read("!H")[0]
4551 orig_reader = reader
4552 reader = orig_reader.slice(_length - (2 + 2))
4553 obj.xid = reader.read("!L")[0]
4554 _experimenter = reader.read("!L")[0]
4555 assert(_experimenter == 6035143)
4556 _subtype = reader.read("!L")[0]
4557 assert(_subtype == 52)
4558 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
4559 return obj
4560
4561 def __eq__(self, other):
4562 if type(self) != type(other): return False
4563 if self.xid != other.xid: return False
4564 if self.pipeline != other.pipeline: return False
4565 return True
4566
4567 def pretty_print(self, q):
4568 q.text("bsn_get_switch_pipeline_reply {")
4569 with q.group():
4570 with q.indent(2):
4571 q.breakable()
4572 q.text("xid = ");
4573 if self.xid != None:
4574 q.text("%#x" % self.xid)
4575 else:
4576 q.text('None')
4577 q.text(","); q.breakable()
4578 q.text("pipeline = ");
4579 q.pp(self.pipeline)
4580 q.breakable()
4581 q.text('}')
4582
4583bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
4584
4585class bsn_get_switch_pipeline_request(bsn_header):
4586 version = 4
4587 type = 4
4588 experimenter = 6035143
4589 subtype = 51
4590
4591 def __init__(self, xid=None):
4592 if xid != None:
4593 self.xid = xid
4594 else:
4595 self.xid = None
4596 return
4597
4598 def pack(self):
4599 packed = []
4600 packed.append(struct.pack("!B", self.version))
4601 packed.append(struct.pack("!B", self.type))
4602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4603 packed.append(struct.pack("!L", self.xid))
4604 packed.append(struct.pack("!L", self.experimenter))
4605 packed.append(struct.pack("!L", self.subtype))
4606 length = sum([len(x) for x in packed])
4607 packed[2] = struct.pack("!H", length)
4608 return ''.join(packed)
4609
4610 @staticmethod
4611 def unpack(reader):
4612 obj = bsn_get_switch_pipeline_request()
4613 _version = reader.read("!B")[0]
4614 assert(_version == 4)
4615 _type = reader.read("!B")[0]
4616 assert(_type == 4)
4617 _length = reader.read("!H")[0]
4618 orig_reader = reader
4619 reader = orig_reader.slice(_length - (2 + 2))
4620 obj.xid = reader.read("!L")[0]
4621 _experimenter = reader.read("!L")[0]
4622 assert(_experimenter == 6035143)
4623 _subtype = reader.read("!L")[0]
4624 assert(_subtype == 51)
4625 return obj
4626
4627 def __eq__(self, other):
4628 if type(self) != type(other): return False
4629 if self.xid != other.xid: return False
4630 return True
4631
4632 def pretty_print(self, q):
4633 q.text("bsn_get_switch_pipeline_request {")
4634 with q.group():
4635 with q.indent(2):
4636 q.breakable()
4637 q.text("xid = ");
4638 if self.xid != None:
4639 q.text("%#x" % self.xid)
4640 else:
4641 q.text('None')
4642 q.breakable()
4643 q.text('}')
4644
4645bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
4646
4647class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08004648 version = 4
4649 type = 4
4650 experimenter = 6035143
4651 subtype = 43
4652
4653 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 -08004654 if xid != None:
4655 self.xid = xid
4656 else:
4657 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004658 if convergence_status != None:
4659 self.convergence_status = convergence_status
4660 else:
4661 self.convergence_status = 0
4662 if port_no != None:
4663 self.port_no = port_no
4664 else:
4665 self.port_no = 0
4666 if actor_sys_priority != None:
4667 self.actor_sys_priority = actor_sys_priority
4668 else:
4669 self.actor_sys_priority = 0
4670 if actor_sys_mac != None:
4671 self.actor_sys_mac = actor_sys_mac
4672 else:
4673 self.actor_sys_mac = [0,0,0,0,0,0]
4674 if actor_port_priority != None:
4675 self.actor_port_priority = actor_port_priority
4676 else:
4677 self.actor_port_priority = 0
4678 if actor_port_num != None:
4679 self.actor_port_num = actor_port_num
4680 else:
4681 self.actor_port_num = 0
4682 if actor_key != None:
4683 self.actor_key = actor_key
4684 else:
4685 self.actor_key = 0
4686 if partner_sys_priority != None:
4687 self.partner_sys_priority = partner_sys_priority
4688 else:
4689 self.partner_sys_priority = 0
4690 if partner_sys_mac != None:
4691 self.partner_sys_mac = partner_sys_mac
4692 else:
4693 self.partner_sys_mac = [0,0,0,0,0,0]
4694 if partner_port_priority != None:
4695 self.partner_port_priority = partner_port_priority
4696 else:
4697 self.partner_port_priority = 0
4698 if partner_port_num != None:
4699 self.partner_port_num = partner_port_num
4700 else:
4701 self.partner_port_num = 0
4702 if partner_key != None:
4703 self.partner_key = partner_key
4704 else:
4705 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004706 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004707
4708 def pack(self):
4709 packed = []
4710 packed.append(struct.pack("!B", self.version))
4711 packed.append(struct.pack("!B", self.type))
4712 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4713 packed.append(struct.pack("!L", self.xid))
4714 packed.append(struct.pack("!L", self.experimenter))
4715 packed.append(struct.pack("!L", self.subtype))
4716 packed.append(struct.pack("!B", self.convergence_status))
4717 packed.append('\x00' * 3)
4718 packed.append(util.pack_port_no(self.port_no))
4719 packed.append(struct.pack("!H", self.actor_sys_priority))
4720 packed.append(struct.pack("!6B", *self.actor_sys_mac))
4721 packed.append(struct.pack("!H", self.actor_port_priority))
4722 packed.append(struct.pack("!H", self.actor_port_num))
4723 packed.append(struct.pack("!H", self.actor_key))
4724 packed.append(struct.pack("!H", self.partner_sys_priority))
4725 packed.append(struct.pack("!6B", *self.partner_sys_mac))
4726 packed.append(struct.pack("!H", self.partner_port_priority))
4727 packed.append(struct.pack("!H", self.partner_port_num))
4728 packed.append(struct.pack("!H", self.partner_key))
4729 length = sum([len(x) for x in packed])
4730 packed[2] = struct.pack("!H", length)
4731 return ''.join(packed)
4732
4733 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004734 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004735 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08004736 _version = reader.read("!B")[0]
4737 assert(_version == 4)
4738 _type = reader.read("!B")[0]
4739 assert(_type == 4)
4740 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004741 orig_reader = reader
4742 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004743 obj.xid = reader.read("!L")[0]
4744 _experimenter = reader.read("!L")[0]
4745 assert(_experimenter == 6035143)
4746 _subtype = reader.read("!L")[0]
4747 assert(_subtype == 43)
4748 obj.convergence_status = reader.read("!B")[0]
4749 reader.skip(3)
4750 obj.port_no = util.unpack_port_no(reader)
4751 obj.actor_sys_priority = reader.read("!H")[0]
4752 obj.actor_sys_mac = list(reader.read('!6B'))
4753 obj.actor_port_priority = reader.read("!H")[0]
4754 obj.actor_port_num = reader.read("!H")[0]
4755 obj.actor_key = reader.read("!H")[0]
4756 obj.partner_sys_priority = reader.read("!H")[0]
4757 obj.partner_sys_mac = list(reader.read('!6B'))
4758 obj.partner_port_priority = reader.read("!H")[0]
4759 obj.partner_port_num = reader.read("!H")[0]
4760 obj.partner_key = reader.read("!H")[0]
4761 return obj
4762
4763 def __eq__(self, other):
4764 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004765 if self.xid != other.xid: return False
4766 if self.convergence_status != other.convergence_status: return False
4767 if self.port_no != other.port_no: return False
4768 if self.actor_sys_priority != other.actor_sys_priority: return False
4769 if self.actor_sys_mac != other.actor_sys_mac: return False
4770 if self.actor_port_priority != other.actor_port_priority: return False
4771 if self.actor_port_num != other.actor_port_num: return False
4772 if self.actor_key != other.actor_key: return False
4773 if self.partner_sys_priority != other.partner_sys_priority: return False
4774 if self.partner_sys_mac != other.partner_sys_mac: return False
4775 if self.partner_port_priority != other.partner_port_priority: return False
4776 if self.partner_port_num != other.partner_port_num: return False
4777 if self.partner_key != other.partner_key: return False
4778 return True
4779
Rich Lane7b0f2012013-11-22 14:15:26 -08004780 def pretty_print(self, q):
4781 q.text("bsn_lacp_convergence_notif {")
4782 with q.group():
4783 with q.indent(2):
4784 q.breakable()
4785 q.text("xid = ");
4786 if self.xid != None:
4787 q.text("%#x" % self.xid)
4788 else:
4789 q.text('None')
4790 q.text(","); q.breakable()
4791 q.text("convergence_status = ");
4792 q.text("%#x" % self.convergence_status)
4793 q.text(","); q.breakable()
4794 q.text("port_no = ");
4795 q.text(util.pretty_port(self.port_no))
4796 q.text(","); q.breakable()
4797 q.text("actor_sys_priority = ");
4798 q.text("%#x" % self.actor_sys_priority)
4799 q.text(","); q.breakable()
4800 q.text("actor_sys_mac = ");
4801 q.text(util.pretty_mac(self.actor_sys_mac))
4802 q.text(","); q.breakable()
4803 q.text("actor_port_priority = ");
4804 q.text("%#x" % self.actor_port_priority)
4805 q.text(","); q.breakable()
4806 q.text("actor_port_num = ");
4807 q.text("%#x" % self.actor_port_num)
4808 q.text(","); q.breakable()
4809 q.text("actor_key = ");
4810 q.text("%#x" % self.actor_key)
4811 q.text(","); q.breakable()
4812 q.text("partner_sys_priority = ");
4813 q.text("%#x" % self.partner_sys_priority)
4814 q.text(","); q.breakable()
4815 q.text("partner_sys_mac = ");
4816 q.text(util.pretty_mac(self.partner_sys_mac))
4817 q.text(","); q.breakable()
4818 q.text("partner_port_priority = ");
4819 q.text("%#x" % self.partner_port_priority)
4820 q.text(","); q.breakable()
4821 q.text("partner_port_num = ");
4822 q.text("%#x" % self.partner_port_num)
4823 q.text(","); q.breakable()
4824 q.text("partner_key = ");
4825 q.text("%#x" % self.partner_key)
4826 q.breakable()
4827 q.text('}')
4828
Rich Lane7dcdf022013-12-11 14:45:27 -08004829bsn_header.subtypes[43] = bsn_lacp_convergence_notif
4830
Rich Lane7dcdf022013-12-11 14:45:27 -08004831class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08004832 version = 4
4833 type = 19
4834 stats_type = 65535
4835 experimenter = 6035143
4836 subtype = 1
4837
4838 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004839 if xid != None:
4840 self.xid = xid
4841 else:
4842 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004843 if flags != None:
4844 self.flags = flags
4845 else:
4846 self.flags = 0
4847 if entries != None:
4848 self.entries = entries
4849 else:
4850 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004851 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004852
4853 def pack(self):
4854 packed = []
4855 packed.append(struct.pack("!B", self.version))
4856 packed.append(struct.pack("!B", self.type))
4857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4858 packed.append(struct.pack("!L", self.xid))
4859 packed.append(struct.pack("!H", self.stats_type))
4860 packed.append(struct.pack("!H", self.flags))
4861 packed.append('\x00' * 4)
4862 packed.append(struct.pack("!L", self.experimenter))
4863 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004864 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08004865 length = sum([len(x) for x in packed])
4866 packed[2] = struct.pack("!H", length)
4867 return ''.join(packed)
4868
4869 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004870 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004871 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08004872 _version = reader.read("!B")[0]
4873 assert(_version == 4)
4874 _type = reader.read("!B")[0]
4875 assert(_type == 19)
4876 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004877 orig_reader = reader
4878 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004879 obj.xid = reader.read("!L")[0]
4880 _stats_type = reader.read("!H")[0]
4881 assert(_stats_type == 65535)
4882 obj.flags = reader.read("!H")[0]
4883 reader.skip(4)
4884 _experimenter = reader.read("!L")[0]
4885 assert(_experimenter == 6035143)
4886 _subtype = reader.read("!L")[0]
4887 assert(_subtype == 1)
4888 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
4889 return obj
4890
4891 def __eq__(self, other):
4892 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004893 if self.xid != other.xid: return False
4894 if self.flags != other.flags: return False
4895 if self.entries != other.entries: return False
4896 return True
4897
Rich Lane7b0f2012013-11-22 14:15:26 -08004898 def pretty_print(self, q):
4899 q.text("bsn_lacp_stats_reply {")
4900 with q.group():
4901 with q.indent(2):
4902 q.breakable()
4903 q.text("xid = ");
4904 if self.xid != None:
4905 q.text("%#x" % self.xid)
4906 else:
4907 q.text('None')
4908 q.text(","); q.breakable()
4909 q.text("flags = ");
4910 q.text("%#x" % self.flags)
4911 q.text(","); q.breakable()
4912 q.text("entries = ");
4913 q.pp(self.entries)
4914 q.breakable()
4915 q.text('}')
4916
Rich Lane7dcdf022013-12-11 14:45:27 -08004917bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
4918
Rich Lane7dcdf022013-12-11 14:45:27 -08004919class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08004920 version = 4
4921 type = 18
4922 stats_type = 65535
4923 experimenter = 6035143
4924 subtype = 1
4925
4926 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004927 if xid != None:
4928 self.xid = xid
4929 else:
4930 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004931 if flags != None:
4932 self.flags = flags
4933 else:
4934 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004935 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004936
4937 def pack(self):
4938 packed = []
4939 packed.append(struct.pack("!B", self.version))
4940 packed.append(struct.pack("!B", self.type))
4941 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4942 packed.append(struct.pack("!L", self.xid))
4943 packed.append(struct.pack("!H", self.stats_type))
4944 packed.append(struct.pack("!H", self.flags))
4945 packed.append('\x00' * 4)
4946 packed.append(struct.pack("!L", self.experimenter))
4947 packed.append(struct.pack("!L", self.subtype))
4948 length = sum([len(x) for x in packed])
4949 packed[2] = struct.pack("!H", length)
4950 return ''.join(packed)
4951
4952 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004953 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004954 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08004955 _version = reader.read("!B")[0]
4956 assert(_version == 4)
4957 _type = reader.read("!B")[0]
4958 assert(_type == 18)
4959 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004960 orig_reader = reader
4961 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004962 obj.xid = reader.read("!L")[0]
4963 _stats_type = reader.read("!H")[0]
4964 assert(_stats_type == 65535)
4965 obj.flags = reader.read("!H")[0]
4966 reader.skip(4)
4967 _experimenter = reader.read("!L")[0]
4968 assert(_experimenter == 6035143)
4969 _subtype = reader.read("!L")[0]
4970 assert(_subtype == 1)
4971 return obj
4972
4973 def __eq__(self, other):
4974 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004975 if self.xid != other.xid: return False
4976 if self.flags != other.flags: return False
4977 return True
4978
Rich Lane7b0f2012013-11-22 14:15:26 -08004979 def pretty_print(self, q):
4980 q.text("bsn_lacp_stats_request {")
4981 with q.group():
4982 with q.indent(2):
4983 q.breakable()
4984 q.text("xid = ");
4985 if self.xid != None:
4986 q.text("%#x" % self.xid)
4987 else:
4988 q.text('None')
4989 q.text(","); q.breakable()
4990 q.text("flags = ");
4991 q.text("%#x" % self.flags)
4992 q.breakable()
4993 q.text('}')
4994
Rich Lane7dcdf022013-12-11 14:45:27 -08004995bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
4996
4997class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07004998 version = 4
4999 type = 4
5000 experimenter = 6035143
5001 subtype = 34
5002
Rich Lane7b0f2012013-11-22 14:15:26 -08005003 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005004 if xid != None:
5005 self.xid = xid
5006 else:
5007 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005008 if status != None:
5009 self.status = status
5010 else:
5011 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005012 if port_no != None:
5013 self.port_no = port_no
5014 else:
5015 self.port_no = 0
5016 if slot_num != None:
5017 self.slot_num = slot_num
5018 else:
5019 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005020 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005021
5022 def pack(self):
5023 packed = []
5024 packed.append(struct.pack("!B", self.version))
5025 packed.append(struct.pack("!B", self.type))
5026 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5027 packed.append(struct.pack("!L", self.xid))
5028 packed.append(struct.pack("!L", self.experimenter))
5029 packed.append(struct.pack("!L", self.subtype))
5030 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005031 packed.append(util.pack_port_no(self.port_no))
5032 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005033 length = sum([len(x) for x in packed])
5034 packed[2] = struct.pack("!H", length)
5035 return ''.join(packed)
5036
5037 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005038 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005039 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005040 _version = reader.read("!B")[0]
5041 assert(_version == 4)
5042 _type = reader.read("!B")[0]
5043 assert(_type == 4)
5044 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005045 orig_reader = reader
5046 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005047 obj.xid = reader.read("!L")[0]
5048 _experimenter = reader.read("!L")[0]
5049 assert(_experimenter == 6035143)
5050 _subtype = reader.read("!L")[0]
5051 assert(_subtype == 34)
5052 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005053 obj.port_no = util.unpack_port_no(reader)
5054 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005055 return obj
5056
5057 def __eq__(self, other):
5058 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005059 if self.xid != other.xid: return False
5060 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005061 if self.port_no != other.port_no: return False
5062 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005063 return True
5064
Rich Lane6f4978c2013-10-20 21:33:52 -07005065 def pretty_print(self, q):
5066 q.text("bsn_pdu_rx_reply {")
5067 with q.group():
5068 with q.indent(2):
5069 q.breakable()
5070 q.text("xid = ");
5071 if self.xid != None:
5072 q.text("%#x" % self.xid)
5073 else:
5074 q.text('None')
5075 q.text(","); q.breakable()
5076 q.text("status = ");
5077 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005078 q.text(","); q.breakable()
5079 q.text("port_no = ");
5080 q.text(util.pretty_port(self.port_no))
5081 q.text(","); q.breakable()
5082 q.text("slot_num = ");
5083 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005084 q.breakable()
5085 q.text('}')
5086
Rich Lane7dcdf022013-12-11 14:45:27 -08005087bsn_header.subtypes[34] = bsn_pdu_rx_reply
5088
5089class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005090 version = 4
5091 type = 4
5092 experimenter = 6035143
5093 subtype = 33
5094
5095 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005096 if xid != None:
5097 self.xid = xid
5098 else:
5099 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005100 if timeout_ms != None:
5101 self.timeout_ms = timeout_ms
5102 else:
5103 self.timeout_ms = 0
5104 if port_no != None:
5105 self.port_no = port_no
5106 else:
5107 self.port_no = 0
5108 if slot_num != None:
5109 self.slot_num = slot_num
5110 else:
5111 self.slot_num = 0
5112 if data != None:
5113 self.data = data
5114 else:
5115 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005116 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005117
5118 def pack(self):
5119 packed = []
5120 packed.append(struct.pack("!B", self.version))
5121 packed.append(struct.pack("!B", self.type))
5122 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5123 packed.append(struct.pack("!L", self.xid))
5124 packed.append(struct.pack("!L", self.experimenter))
5125 packed.append(struct.pack("!L", self.subtype))
5126 packed.append(struct.pack("!L", self.timeout_ms))
5127 packed.append(util.pack_port_no(self.port_no))
5128 packed.append(struct.pack("!B", self.slot_num))
5129 packed.append('\x00' * 3)
5130 packed.append(self.data)
5131 length = sum([len(x) for x in packed])
5132 packed[2] = struct.pack("!H", length)
5133 return ''.join(packed)
5134
5135 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005136 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005137 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005138 _version = reader.read("!B")[0]
5139 assert(_version == 4)
5140 _type = reader.read("!B")[0]
5141 assert(_type == 4)
5142 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005143 orig_reader = reader
5144 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005145 obj.xid = reader.read("!L")[0]
5146 _experimenter = reader.read("!L")[0]
5147 assert(_experimenter == 6035143)
5148 _subtype = reader.read("!L")[0]
5149 assert(_subtype == 33)
5150 obj.timeout_ms = reader.read("!L")[0]
5151 obj.port_no = util.unpack_port_no(reader)
5152 obj.slot_num = reader.read("!B")[0]
5153 reader.skip(3)
5154 obj.data = str(reader.read_all())
5155 return obj
5156
5157 def __eq__(self, other):
5158 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005159 if self.xid != other.xid: return False
5160 if self.timeout_ms != other.timeout_ms: return False
5161 if self.port_no != other.port_no: return False
5162 if self.slot_num != other.slot_num: return False
5163 if self.data != other.data: return False
5164 return True
5165
Rich Lane6f4978c2013-10-20 21:33:52 -07005166 def pretty_print(self, q):
5167 q.text("bsn_pdu_rx_request {")
5168 with q.group():
5169 with q.indent(2):
5170 q.breakable()
5171 q.text("xid = ");
5172 if self.xid != None:
5173 q.text("%#x" % self.xid)
5174 else:
5175 q.text('None')
5176 q.text(","); q.breakable()
5177 q.text("timeout_ms = ");
5178 q.text("%#x" % self.timeout_ms)
5179 q.text(","); q.breakable()
5180 q.text("port_no = ");
5181 q.text(util.pretty_port(self.port_no))
5182 q.text(","); q.breakable()
5183 q.text("slot_num = ");
5184 q.text("%#x" % self.slot_num)
5185 q.text(","); q.breakable()
5186 q.text("data = ");
5187 q.pp(self.data)
5188 q.breakable()
5189 q.text('}')
5190
Rich Lane7dcdf022013-12-11 14:45:27 -08005191bsn_header.subtypes[33] = bsn_pdu_rx_request
5192
5193class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005194 version = 4
5195 type = 4
5196 experimenter = 6035143
5197 subtype = 35
5198
5199 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005200 if xid != None:
5201 self.xid = xid
5202 else:
5203 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005204 if port_no != None:
5205 self.port_no = port_no
5206 else:
5207 self.port_no = 0
5208 if slot_num != None:
5209 self.slot_num = slot_num
5210 else:
5211 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005212 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005213
5214 def pack(self):
5215 packed = []
5216 packed.append(struct.pack("!B", self.version))
5217 packed.append(struct.pack("!B", self.type))
5218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5219 packed.append(struct.pack("!L", self.xid))
5220 packed.append(struct.pack("!L", self.experimenter))
5221 packed.append(struct.pack("!L", self.subtype))
5222 packed.append(util.pack_port_no(self.port_no))
5223 packed.append(struct.pack("!B", self.slot_num))
5224 length = sum([len(x) for x in packed])
5225 packed[2] = struct.pack("!H", length)
5226 return ''.join(packed)
5227
5228 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005229 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005230 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07005231 _version = reader.read("!B")[0]
5232 assert(_version == 4)
5233 _type = reader.read("!B")[0]
5234 assert(_type == 4)
5235 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005236 orig_reader = reader
5237 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005238 obj.xid = reader.read("!L")[0]
5239 _experimenter = reader.read("!L")[0]
5240 assert(_experimenter == 6035143)
5241 _subtype = reader.read("!L")[0]
5242 assert(_subtype == 35)
5243 obj.port_no = util.unpack_port_no(reader)
5244 obj.slot_num = reader.read("!B")[0]
5245 return obj
5246
5247 def __eq__(self, other):
5248 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005249 if self.xid != other.xid: return False
5250 if self.port_no != other.port_no: return False
5251 if self.slot_num != other.slot_num: return False
5252 return True
5253
Rich Lane6f4978c2013-10-20 21:33:52 -07005254 def pretty_print(self, q):
5255 q.text("bsn_pdu_rx_timeout {")
5256 with q.group():
5257 with q.indent(2):
5258 q.breakable()
5259 q.text("xid = ");
5260 if self.xid != None:
5261 q.text("%#x" % self.xid)
5262 else:
5263 q.text('None')
5264 q.text(","); q.breakable()
5265 q.text("port_no = ");
5266 q.text(util.pretty_port(self.port_no))
5267 q.text(","); q.breakable()
5268 q.text("slot_num = ");
5269 q.text("%#x" % self.slot_num)
5270 q.breakable()
5271 q.text('}')
5272
Rich Lane7dcdf022013-12-11 14:45:27 -08005273bsn_header.subtypes[35] = bsn_pdu_rx_timeout
5274
5275class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005276 version = 4
5277 type = 4
5278 experimenter = 6035143
5279 subtype = 32
5280
Rich Lane7b0f2012013-11-22 14:15:26 -08005281 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005282 if xid != None:
5283 self.xid = xid
5284 else:
5285 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005286 if status != None:
5287 self.status = status
5288 else:
5289 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005290 if port_no != None:
5291 self.port_no = port_no
5292 else:
5293 self.port_no = 0
5294 if slot_num != None:
5295 self.slot_num = slot_num
5296 else:
5297 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005298 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005299
5300 def pack(self):
5301 packed = []
5302 packed.append(struct.pack("!B", self.version))
5303 packed.append(struct.pack("!B", self.type))
5304 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5305 packed.append(struct.pack("!L", self.xid))
5306 packed.append(struct.pack("!L", self.experimenter))
5307 packed.append(struct.pack("!L", self.subtype))
5308 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005309 packed.append(util.pack_port_no(self.port_no))
5310 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005311 length = sum([len(x) for x in packed])
5312 packed[2] = struct.pack("!H", length)
5313 return ''.join(packed)
5314
5315 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005316 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005317 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005318 _version = reader.read("!B")[0]
5319 assert(_version == 4)
5320 _type = reader.read("!B")[0]
5321 assert(_type == 4)
5322 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005323 orig_reader = reader
5324 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005325 obj.xid = reader.read("!L")[0]
5326 _experimenter = reader.read("!L")[0]
5327 assert(_experimenter == 6035143)
5328 _subtype = reader.read("!L")[0]
5329 assert(_subtype == 32)
5330 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08005331 obj.port_no = util.unpack_port_no(reader)
5332 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005333 return obj
5334
5335 def __eq__(self, other):
5336 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005337 if self.xid != other.xid: return False
5338 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005339 if self.port_no != other.port_no: return False
5340 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005341 return True
5342
Rich Lane6f4978c2013-10-20 21:33:52 -07005343 def pretty_print(self, q):
5344 q.text("bsn_pdu_tx_reply {")
5345 with q.group():
5346 with q.indent(2):
5347 q.breakable()
5348 q.text("xid = ");
5349 if self.xid != None:
5350 q.text("%#x" % self.xid)
5351 else:
5352 q.text('None')
5353 q.text(","); q.breakable()
5354 q.text("status = ");
5355 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08005356 q.text(","); q.breakable()
5357 q.text("port_no = ");
5358 q.text(util.pretty_port(self.port_no))
5359 q.text(","); q.breakable()
5360 q.text("slot_num = ");
5361 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07005362 q.breakable()
5363 q.text('}')
5364
Rich Lane7dcdf022013-12-11 14:45:27 -08005365bsn_header.subtypes[32] = bsn_pdu_tx_reply
5366
5367class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005368 version = 4
5369 type = 4
5370 experimenter = 6035143
5371 subtype = 31
5372
5373 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005374 if xid != None:
5375 self.xid = xid
5376 else:
5377 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005378 if tx_interval_ms != None:
5379 self.tx_interval_ms = tx_interval_ms
5380 else:
5381 self.tx_interval_ms = 0
5382 if port_no != None:
5383 self.port_no = port_no
5384 else:
5385 self.port_no = 0
5386 if slot_num != None:
5387 self.slot_num = slot_num
5388 else:
5389 self.slot_num = 0
5390 if data != None:
5391 self.data = data
5392 else:
5393 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005394 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005395
5396 def pack(self):
5397 packed = []
5398 packed.append(struct.pack("!B", self.version))
5399 packed.append(struct.pack("!B", self.type))
5400 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5401 packed.append(struct.pack("!L", self.xid))
5402 packed.append(struct.pack("!L", self.experimenter))
5403 packed.append(struct.pack("!L", self.subtype))
5404 packed.append(struct.pack("!L", self.tx_interval_ms))
5405 packed.append(util.pack_port_no(self.port_no))
5406 packed.append(struct.pack("!B", self.slot_num))
5407 packed.append('\x00' * 3)
5408 packed.append(self.data)
5409 length = sum([len(x) for x in packed])
5410 packed[2] = struct.pack("!H", length)
5411 return ''.join(packed)
5412
5413 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005414 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005415 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07005416 _version = reader.read("!B")[0]
5417 assert(_version == 4)
5418 _type = reader.read("!B")[0]
5419 assert(_type == 4)
5420 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005421 orig_reader = reader
5422 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005423 obj.xid = reader.read("!L")[0]
5424 _experimenter = reader.read("!L")[0]
5425 assert(_experimenter == 6035143)
5426 _subtype = reader.read("!L")[0]
5427 assert(_subtype == 31)
5428 obj.tx_interval_ms = reader.read("!L")[0]
5429 obj.port_no = util.unpack_port_no(reader)
5430 obj.slot_num = reader.read("!B")[0]
5431 reader.skip(3)
5432 obj.data = str(reader.read_all())
5433 return obj
5434
5435 def __eq__(self, other):
5436 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005437 if self.xid != other.xid: return False
5438 if self.tx_interval_ms != other.tx_interval_ms: return False
5439 if self.port_no != other.port_no: return False
5440 if self.slot_num != other.slot_num: return False
5441 if self.data != other.data: return False
5442 return True
5443
Rich Lane6f4978c2013-10-20 21:33:52 -07005444 def pretty_print(self, q):
5445 q.text("bsn_pdu_tx_request {")
5446 with q.group():
5447 with q.indent(2):
5448 q.breakable()
5449 q.text("xid = ");
5450 if self.xid != None:
5451 q.text("%#x" % self.xid)
5452 else:
5453 q.text('None')
5454 q.text(","); q.breakable()
5455 q.text("tx_interval_ms = ");
5456 q.text("%#x" % self.tx_interval_ms)
5457 q.text(","); q.breakable()
5458 q.text("port_no = ");
5459 q.text(util.pretty_port(self.port_no))
5460 q.text(","); q.breakable()
5461 q.text("slot_num = ");
5462 q.text("%#x" % self.slot_num)
5463 q.text(","); q.breakable()
5464 q.text("data = ");
5465 q.pp(self.data)
5466 q.breakable()
5467 q.text('}')
5468
Rich Lane7dcdf022013-12-11 14:45:27 -08005469bsn_header.subtypes[31] = bsn_pdu_tx_request
5470
5471class bsn_port_counter_stats_reply(bsn_stats_reply):
5472 version = 4
5473 type = 19
5474 stats_type = 65535
5475 experimenter = 6035143
5476 subtype = 8
5477
5478 def __init__(self, xid=None, flags=None, entries=None):
5479 if xid != None:
5480 self.xid = xid
5481 else:
5482 self.xid = None
5483 if flags != None:
5484 self.flags = flags
5485 else:
5486 self.flags = 0
5487 if entries != None:
5488 self.entries = entries
5489 else:
5490 self.entries = []
5491 return
5492
5493 def pack(self):
5494 packed = []
5495 packed.append(struct.pack("!B", self.version))
5496 packed.append(struct.pack("!B", self.type))
5497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5498 packed.append(struct.pack("!L", self.xid))
5499 packed.append(struct.pack("!H", self.stats_type))
5500 packed.append(struct.pack("!H", self.flags))
5501 packed.append('\x00' * 4)
5502 packed.append(struct.pack("!L", self.experimenter))
5503 packed.append(struct.pack("!L", self.subtype))
5504 packed.append(loxi.generic_util.pack_list(self.entries))
5505 length = sum([len(x) for x in packed])
5506 packed[2] = struct.pack("!H", length)
5507 return ''.join(packed)
5508
5509 @staticmethod
5510 def unpack(reader):
5511 obj = bsn_port_counter_stats_reply()
5512 _version = reader.read("!B")[0]
5513 assert(_version == 4)
5514 _type = reader.read("!B")[0]
5515 assert(_type == 19)
5516 _length = reader.read("!H")[0]
5517 orig_reader = reader
5518 reader = orig_reader.slice(_length - (2 + 2))
5519 obj.xid = reader.read("!L")[0]
5520 _stats_type = reader.read("!H")[0]
5521 assert(_stats_type == 65535)
5522 obj.flags = reader.read("!H")[0]
5523 reader.skip(4)
5524 _experimenter = reader.read("!L")[0]
5525 assert(_experimenter == 6035143)
5526 _subtype = reader.read("!L")[0]
5527 assert(_subtype == 8)
5528 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
5529 return obj
5530
5531 def __eq__(self, other):
5532 if type(self) != type(other): return False
5533 if self.xid != other.xid: return False
5534 if self.flags != other.flags: return False
5535 if self.entries != other.entries: return False
5536 return True
5537
5538 def pretty_print(self, q):
5539 q.text("bsn_port_counter_stats_reply {")
5540 with q.group():
5541 with q.indent(2):
5542 q.breakable()
5543 q.text("xid = ");
5544 if self.xid != None:
5545 q.text("%#x" % self.xid)
5546 else:
5547 q.text('None')
5548 q.text(","); q.breakable()
5549 q.text("flags = ");
5550 q.text("%#x" % self.flags)
5551 q.text(","); q.breakable()
5552 q.text("entries = ");
5553 q.pp(self.entries)
5554 q.breakable()
5555 q.text('}')
5556
5557bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
5558
5559class bsn_port_counter_stats_request(bsn_stats_request):
5560 version = 4
5561 type = 18
5562 stats_type = 65535
5563 experimenter = 6035143
5564 subtype = 8
5565
5566 def __init__(self, xid=None, flags=None, port_no=None):
5567 if xid != None:
5568 self.xid = xid
5569 else:
5570 self.xid = None
5571 if flags != None:
5572 self.flags = flags
5573 else:
5574 self.flags = 0
5575 if port_no != None:
5576 self.port_no = port_no
5577 else:
5578 self.port_no = 0
5579 return
5580
5581 def pack(self):
5582 packed = []
5583 packed.append(struct.pack("!B", self.version))
5584 packed.append(struct.pack("!B", self.type))
5585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5586 packed.append(struct.pack("!L", self.xid))
5587 packed.append(struct.pack("!H", self.stats_type))
5588 packed.append(struct.pack("!H", self.flags))
5589 packed.append('\x00' * 4)
5590 packed.append(struct.pack("!L", self.experimenter))
5591 packed.append(struct.pack("!L", self.subtype))
5592 packed.append(util.pack_port_no(self.port_no))
5593 length = sum([len(x) for x in packed])
5594 packed[2] = struct.pack("!H", length)
5595 return ''.join(packed)
5596
5597 @staticmethod
5598 def unpack(reader):
5599 obj = bsn_port_counter_stats_request()
5600 _version = reader.read("!B")[0]
5601 assert(_version == 4)
5602 _type = reader.read("!B")[0]
5603 assert(_type == 18)
5604 _length = reader.read("!H")[0]
5605 orig_reader = reader
5606 reader = orig_reader.slice(_length - (2 + 2))
5607 obj.xid = reader.read("!L")[0]
5608 _stats_type = reader.read("!H")[0]
5609 assert(_stats_type == 65535)
5610 obj.flags = reader.read("!H")[0]
5611 reader.skip(4)
5612 _experimenter = reader.read("!L")[0]
5613 assert(_experimenter == 6035143)
5614 _subtype = reader.read("!L")[0]
5615 assert(_subtype == 8)
5616 obj.port_no = util.unpack_port_no(reader)
5617 return obj
5618
5619 def __eq__(self, other):
5620 if type(self) != type(other): return False
5621 if self.xid != other.xid: return False
5622 if self.flags != other.flags: return False
5623 if self.port_no != other.port_no: return False
5624 return True
5625
5626 def pretty_print(self, q):
5627 q.text("bsn_port_counter_stats_request {")
5628 with q.group():
5629 with q.indent(2):
5630 q.breakable()
5631 q.text("xid = ");
5632 if self.xid != None:
5633 q.text("%#x" % self.xid)
5634 else:
5635 q.text('None')
5636 q.text(","); q.breakable()
5637 q.text("flags = ");
5638 q.text("%#x" % self.flags)
5639 q.text(","); q.breakable()
5640 q.text("port_no = ");
5641 q.text(util.pretty_port(self.port_no))
5642 q.breakable()
5643 q.text('}')
5644
5645bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
5646
Rich Lane5454b682014-01-14 17:07:36 -08005647class bsn_role_status(bsn_header):
5648 version = 4
5649 type = 4
5650 experimenter = 6035143
5651 subtype = 55
5652
5653 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
5654 if xid != None:
5655 self.xid = xid
5656 else:
5657 self.xid = None
5658 if role != None:
5659 self.role = role
5660 else:
5661 self.role = 0
5662 if reason != None:
5663 self.reason = reason
5664 else:
5665 self.reason = 0
5666 if generation_id != None:
5667 self.generation_id = generation_id
5668 else:
5669 self.generation_id = 0
5670 return
5671
5672 def pack(self):
5673 packed = []
5674 packed.append(struct.pack("!B", self.version))
5675 packed.append(struct.pack("!B", self.type))
5676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5677 packed.append(struct.pack("!L", self.xid))
5678 packed.append(struct.pack("!L", self.experimenter))
5679 packed.append(struct.pack("!L", self.subtype))
5680 packed.append(struct.pack("!L", self.role))
5681 packed.append(struct.pack("!B", self.reason))
5682 packed.append('\x00' * 3)
5683 packed.append(struct.pack("!Q", self.generation_id))
5684 length = sum([len(x) for x in packed])
5685 packed[2] = struct.pack("!H", length)
5686 return ''.join(packed)
5687
5688 @staticmethod
5689 def unpack(reader):
5690 obj = bsn_role_status()
5691 _version = reader.read("!B")[0]
5692 assert(_version == 4)
5693 _type = reader.read("!B")[0]
5694 assert(_type == 4)
5695 _length = reader.read("!H")[0]
5696 orig_reader = reader
5697 reader = orig_reader.slice(_length - (2 + 2))
5698 obj.xid = reader.read("!L")[0]
5699 _experimenter = reader.read("!L")[0]
5700 assert(_experimenter == 6035143)
5701 _subtype = reader.read("!L")[0]
5702 assert(_subtype == 55)
5703 obj.role = reader.read("!L")[0]
5704 obj.reason = reader.read("!B")[0]
5705 reader.skip(3)
5706 obj.generation_id = reader.read("!Q")[0]
5707 return obj
5708
5709 def __eq__(self, other):
5710 if type(self) != type(other): return False
5711 if self.xid != other.xid: return False
5712 if self.role != other.role: return False
5713 if self.reason != other.reason: return False
5714 if self.generation_id != other.generation_id: return False
5715 return True
5716
5717 def pretty_print(self, q):
5718 q.text("bsn_role_status {")
5719 with q.group():
5720 with q.indent(2):
5721 q.breakable()
5722 q.text("xid = ");
5723 if self.xid != None:
5724 q.text("%#x" % self.xid)
5725 else:
5726 q.text('None')
5727 q.text(","); q.breakable()
5728 q.text("role = ");
5729 q.text("%#x" % self.role)
5730 q.text(","); q.breakable()
5731 q.text("reason = ");
5732 q.text("%#x" % self.reason)
5733 q.text(","); q.breakable()
5734 q.text("generation_id = ");
5735 q.text("%#x" % self.generation_id)
5736 q.breakable()
5737 q.text('}')
5738
5739bsn_header.subtypes[55] = bsn_role_status
5740
Rich Lane95f7fc92014-01-27 17:08:16 -08005741class bsn_set_aux_cxns_reply(bsn_header):
5742 version = 4
5743 type = 4
5744 experimenter = 6035143
5745 subtype = 59
5746
5747 def __init__(self, xid=None, num_aux=None, status=None):
5748 if xid != None:
5749 self.xid = xid
5750 else:
5751 self.xid = None
5752 if num_aux != None:
5753 self.num_aux = num_aux
5754 else:
5755 self.num_aux = 0
5756 if status != None:
5757 self.status = status
5758 else:
5759 self.status = 0
5760 return
5761
5762 def pack(self):
5763 packed = []
5764 packed.append(struct.pack("!B", self.version))
5765 packed.append(struct.pack("!B", self.type))
5766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5767 packed.append(struct.pack("!L", self.xid))
5768 packed.append(struct.pack("!L", self.experimenter))
5769 packed.append(struct.pack("!L", self.subtype))
5770 packed.append(struct.pack("!L", self.num_aux))
5771 packed.append(struct.pack("!L", self.status))
5772 length = sum([len(x) for x in packed])
5773 packed[2] = struct.pack("!H", length)
5774 return ''.join(packed)
5775
5776 @staticmethod
5777 def unpack(reader):
5778 obj = bsn_set_aux_cxns_reply()
5779 _version = reader.read("!B")[0]
5780 assert(_version == 4)
5781 _type = reader.read("!B")[0]
5782 assert(_type == 4)
5783 _length = reader.read("!H")[0]
5784 orig_reader = reader
5785 reader = orig_reader.slice(_length - (2 + 2))
5786 obj.xid = reader.read("!L")[0]
5787 _experimenter = reader.read("!L")[0]
5788 assert(_experimenter == 6035143)
5789 _subtype = reader.read("!L")[0]
5790 assert(_subtype == 59)
5791 obj.num_aux = reader.read("!L")[0]
5792 obj.status = reader.read("!L")[0]
5793 return obj
5794
5795 def __eq__(self, other):
5796 if type(self) != type(other): return False
5797 if self.xid != other.xid: return False
5798 if self.num_aux != other.num_aux: return False
5799 if self.status != other.status: return False
5800 return True
5801
5802 def pretty_print(self, q):
5803 q.text("bsn_set_aux_cxns_reply {")
5804 with q.group():
5805 with q.indent(2):
5806 q.breakable()
5807 q.text("xid = ");
5808 if self.xid != None:
5809 q.text("%#x" % self.xid)
5810 else:
5811 q.text('None')
5812 q.text(","); q.breakable()
5813 q.text("num_aux = ");
5814 q.text("%#x" % self.num_aux)
5815 q.text(","); q.breakable()
5816 q.text("status = ");
5817 q.text("%#x" % self.status)
5818 q.breakable()
5819 q.text('}')
5820
5821bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
5822
5823class bsn_set_aux_cxns_request(bsn_header):
5824 version = 4
5825 type = 4
5826 experimenter = 6035143
5827 subtype = 58
5828
5829 def __init__(self, xid=None, num_aux=None):
5830 if xid != None:
5831 self.xid = xid
5832 else:
5833 self.xid = None
5834 if num_aux != None:
5835 self.num_aux = num_aux
5836 else:
5837 self.num_aux = 0
5838 return
5839
5840 def pack(self):
5841 packed = []
5842 packed.append(struct.pack("!B", self.version))
5843 packed.append(struct.pack("!B", self.type))
5844 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5845 packed.append(struct.pack("!L", self.xid))
5846 packed.append(struct.pack("!L", self.experimenter))
5847 packed.append(struct.pack("!L", self.subtype))
5848 packed.append(struct.pack("!L", self.num_aux))
5849 length = sum([len(x) for x in packed])
5850 packed[2] = struct.pack("!H", length)
5851 return ''.join(packed)
5852
5853 @staticmethod
5854 def unpack(reader):
5855 obj = bsn_set_aux_cxns_request()
5856 _version = reader.read("!B")[0]
5857 assert(_version == 4)
5858 _type = reader.read("!B")[0]
5859 assert(_type == 4)
5860 _length = reader.read("!H")[0]
5861 orig_reader = reader
5862 reader = orig_reader.slice(_length - (2 + 2))
5863 obj.xid = reader.read("!L")[0]
5864 _experimenter = reader.read("!L")[0]
5865 assert(_experimenter == 6035143)
5866 _subtype = reader.read("!L")[0]
5867 assert(_subtype == 58)
5868 obj.num_aux = reader.read("!L")[0]
5869 return obj
5870
5871 def __eq__(self, other):
5872 if type(self) != type(other): return False
5873 if self.xid != other.xid: return False
5874 if self.num_aux != other.num_aux: return False
5875 return True
5876
5877 def pretty_print(self, q):
5878 q.text("bsn_set_aux_cxns_request {")
5879 with q.group():
5880 with q.indent(2):
5881 q.breakable()
5882 q.text("xid = ");
5883 if self.xid != None:
5884 q.text("%#x" % self.xid)
5885 else:
5886 q.text('None')
5887 q.text(","); q.breakable()
5888 q.text("num_aux = ");
5889 q.text("%#x" % self.num_aux)
5890 q.breakable()
5891 q.text('}')
5892
5893bsn_header.subtypes[58] = bsn_set_aux_cxns_request
5894
Rich Lane7dcdf022013-12-11 14:45:27 -08005895class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005896 version = 4
5897 type = 4
5898 experimenter = 6035143
5899 subtype = 42
5900
5901 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005902 if xid != None:
5903 self.xid = xid
5904 else:
5905 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005906 if status != None:
5907 self.status = status
5908 else:
5909 self.status = 0
5910 if port_no != None:
5911 self.port_no = port_no
5912 else:
5913 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005914 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005915
5916 def pack(self):
5917 packed = []
5918 packed.append(struct.pack("!B", self.version))
5919 packed.append(struct.pack("!B", self.type))
5920 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5921 packed.append(struct.pack("!L", self.xid))
5922 packed.append(struct.pack("!L", self.experimenter))
5923 packed.append(struct.pack("!L", self.subtype))
5924 packed.append(struct.pack("!L", self.status))
5925 packed.append(util.pack_port_no(self.port_no))
5926 length = sum([len(x) for x in packed])
5927 packed[2] = struct.pack("!H", length)
5928 return ''.join(packed)
5929
5930 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005931 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005932 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005933 _version = reader.read("!B")[0]
5934 assert(_version == 4)
5935 _type = reader.read("!B")[0]
5936 assert(_type == 4)
5937 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005938 orig_reader = reader
5939 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08005940 obj.xid = reader.read("!L")[0]
5941 _experimenter = reader.read("!L")[0]
5942 assert(_experimenter == 6035143)
5943 _subtype = reader.read("!L")[0]
5944 assert(_subtype == 42)
5945 obj.status = reader.read("!L")[0]
5946 obj.port_no = util.unpack_port_no(reader)
5947 return obj
5948
5949 def __eq__(self, other):
5950 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005951 if self.xid != other.xid: return False
5952 if self.status != other.status: return False
5953 if self.port_no != other.port_no: return False
5954 return True
5955
Rich Lane7b0f2012013-11-22 14:15:26 -08005956 def pretty_print(self, q):
5957 q.text("bsn_set_lacp_reply {")
5958 with q.group():
5959 with q.indent(2):
5960 q.breakable()
5961 q.text("xid = ");
5962 if self.xid != None:
5963 q.text("%#x" % self.xid)
5964 else:
5965 q.text('None')
5966 q.text(","); q.breakable()
5967 q.text("status = ");
5968 q.text("%#x" % self.status)
5969 q.text(","); q.breakable()
5970 q.text("port_no = ");
5971 q.text(util.pretty_port(self.port_no))
5972 q.breakable()
5973 q.text('}')
5974
Rich Lane7dcdf022013-12-11 14:45:27 -08005975bsn_header.subtypes[42] = bsn_set_lacp_reply
5976
5977class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005978 version = 4
5979 type = 4
5980 experimenter = 6035143
5981 subtype = 41
5982
5983 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 -08005984 if xid != None:
5985 self.xid = xid
5986 else:
5987 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005988 if enabled != None:
5989 self.enabled = enabled
5990 else:
5991 self.enabled = 0
5992 if port_no != None:
5993 self.port_no = port_no
5994 else:
5995 self.port_no = 0
5996 if actor_sys_priority != None:
5997 self.actor_sys_priority = actor_sys_priority
5998 else:
5999 self.actor_sys_priority = 0
6000 if actor_sys_mac != None:
6001 self.actor_sys_mac = actor_sys_mac
6002 else:
6003 self.actor_sys_mac = [0,0,0,0,0,0]
6004 if actor_port_priority != None:
6005 self.actor_port_priority = actor_port_priority
6006 else:
6007 self.actor_port_priority = 0
6008 if actor_port_num != None:
6009 self.actor_port_num = actor_port_num
6010 else:
6011 self.actor_port_num = 0
6012 if actor_key != None:
6013 self.actor_key = actor_key
6014 else:
6015 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006016 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006017
6018 def pack(self):
6019 packed = []
6020 packed.append(struct.pack("!B", self.version))
6021 packed.append(struct.pack("!B", self.type))
6022 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6023 packed.append(struct.pack("!L", self.xid))
6024 packed.append(struct.pack("!L", self.experimenter))
6025 packed.append(struct.pack("!L", self.subtype))
6026 packed.append(struct.pack("!B", self.enabled))
6027 packed.append('\x00' * 3)
6028 packed.append(util.pack_port_no(self.port_no))
6029 packed.append(struct.pack("!H", self.actor_sys_priority))
6030 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6031 packed.append(struct.pack("!H", self.actor_port_priority))
6032 packed.append(struct.pack("!H", self.actor_port_num))
6033 packed.append(struct.pack("!H", self.actor_key))
6034 length = sum([len(x) for x in packed])
6035 packed[2] = struct.pack("!H", length)
6036 return ''.join(packed)
6037
6038 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006039 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006040 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006041 _version = reader.read("!B")[0]
6042 assert(_version == 4)
6043 _type = reader.read("!B")[0]
6044 assert(_type == 4)
6045 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006046 orig_reader = reader
6047 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006048 obj.xid = reader.read("!L")[0]
6049 _experimenter = reader.read("!L")[0]
6050 assert(_experimenter == 6035143)
6051 _subtype = reader.read("!L")[0]
6052 assert(_subtype == 41)
6053 obj.enabled = reader.read("!B")[0]
6054 reader.skip(3)
6055 obj.port_no = util.unpack_port_no(reader)
6056 obj.actor_sys_priority = reader.read("!H")[0]
6057 obj.actor_sys_mac = list(reader.read('!6B'))
6058 obj.actor_port_priority = reader.read("!H")[0]
6059 obj.actor_port_num = reader.read("!H")[0]
6060 obj.actor_key = reader.read("!H")[0]
6061 return obj
6062
6063 def __eq__(self, other):
6064 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006065 if self.xid != other.xid: return False
6066 if self.enabled != other.enabled: return False
6067 if self.port_no != other.port_no: return False
6068 if self.actor_sys_priority != other.actor_sys_priority: return False
6069 if self.actor_sys_mac != other.actor_sys_mac: return False
6070 if self.actor_port_priority != other.actor_port_priority: return False
6071 if self.actor_port_num != other.actor_port_num: return False
6072 if self.actor_key != other.actor_key: return False
6073 return True
6074
Rich Lane7b0f2012013-11-22 14:15:26 -08006075 def pretty_print(self, q):
6076 q.text("bsn_set_lacp_request {")
6077 with q.group():
6078 with q.indent(2):
6079 q.breakable()
6080 q.text("xid = ");
6081 if self.xid != None:
6082 q.text("%#x" % self.xid)
6083 else:
6084 q.text('None')
6085 q.text(","); q.breakable()
6086 q.text("enabled = ");
6087 q.text("%#x" % self.enabled)
6088 q.text(","); q.breakable()
6089 q.text("port_no = ");
6090 q.text(util.pretty_port(self.port_no))
6091 q.text(","); q.breakable()
6092 q.text("actor_sys_priority = ");
6093 q.text("%#x" % self.actor_sys_priority)
6094 q.text(","); q.breakable()
6095 q.text("actor_sys_mac = ");
6096 q.text(util.pretty_mac(self.actor_sys_mac))
6097 q.text(","); q.breakable()
6098 q.text("actor_port_priority = ");
6099 q.text("%#x" % self.actor_port_priority)
6100 q.text(","); q.breakable()
6101 q.text("actor_port_num = ");
6102 q.text("%#x" % self.actor_port_num)
6103 q.text(","); q.breakable()
6104 q.text("actor_key = ");
6105 q.text("%#x" % self.actor_key)
6106 q.breakable()
6107 q.text('}')
6108
Rich Lane7dcdf022013-12-11 14:45:27 -08006109bsn_header.subtypes[41] = bsn_set_lacp_request
6110
6111class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006112 version = 4
6113 type = 4
6114 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006115 subtype = 3
6116
6117 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006118 if xid != None:
6119 self.xid = xid
6120 else:
6121 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006122 if report_mirror_ports != None:
6123 self.report_mirror_ports = report_mirror_ports
6124 else:
6125 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006126 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006127
6128 def pack(self):
6129 packed = []
6130 packed.append(struct.pack("!B", self.version))
6131 packed.append(struct.pack("!B", self.type))
6132 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6133 packed.append(struct.pack("!L", self.xid))
6134 packed.append(struct.pack("!L", self.experimenter))
6135 packed.append(struct.pack("!L", self.subtype))
6136 packed.append(struct.pack("!B", self.report_mirror_ports))
6137 packed.append('\x00' * 3)
6138 length = sum([len(x) for x in packed])
6139 packed[2] = struct.pack("!H", length)
6140 return ''.join(packed)
6141
6142 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006143 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006144 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07006145 _version = reader.read("!B")[0]
6146 assert(_version == 4)
6147 _type = reader.read("!B")[0]
6148 assert(_type == 4)
6149 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006150 orig_reader = reader
6151 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006152 obj.xid = reader.read("!L")[0]
6153 _experimenter = reader.read("!L")[0]
6154 assert(_experimenter == 6035143)
6155 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006156 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07006157 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006158 reader.skip(3)
6159 return obj
6160
6161 def __eq__(self, other):
6162 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006163 if self.xid != other.xid: return False
6164 if self.report_mirror_ports != other.report_mirror_ports: return False
6165 return True
6166
Rich Lanec2ee4b82013-04-24 17:12:38 -07006167 def pretty_print(self, q):
6168 q.text("bsn_set_mirroring {")
6169 with q.group():
6170 with q.indent(2):
6171 q.breakable()
6172 q.text("xid = ");
6173 if self.xid != None:
6174 q.text("%#x" % self.xid)
6175 else:
6176 q.text('None')
6177 q.text(","); q.breakable()
6178 q.text("report_mirror_ports = ");
6179 q.text("%#x" % self.report_mirror_ports)
6180 q.breakable()
6181 q.text('}')
6182
Rich Lane7dcdf022013-12-11 14:45:27 -08006183bsn_header.subtypes[3] = bsn_set_mirroring
6184
6185class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006186 version = 4
6187 type = 4
6188 experimenter = 6035143
6189 subtype = 25
6190
6191 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006192 if xid != None:
6193 self.xid = xid
6194 else:
6195 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006196 if status != None:
6197 self.status = status
6198 else:
6199 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006200 return
Dan Talaycof6202252013-07-02 01:00:29 -07006201
6202 def pack(self):
6203 packed = []
6204 packed.append(struct.pack("!B", self.version))
6205 packed.append(struct.pack("!B", self.type))
6206 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6207 packed.append(struct.pack("!L", self.xid))
6208 packed.append(struct.pack("!L", self.experimenter))
6209 packed.append(struct.pack("!L", self.subtype))
6210 packed.append(struct.pack("!L", self.status))
6211 length = sum([len(x) for x in packed])
6212 packed[2] = struct.pack("!H", length)
6213 return ''.join(packed)
6214
6215 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006216 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006217 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006218 _version = reader.read("!B")[0]
6219 assert(_version == 4)
6220 _type = reader.read("!B")[0]
6221 assert(_type == 4)
6222 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006223 orig_reader = reader
6224 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006225 obj.xid = reader.read("!L")[0]
6226 _experimenter = reader.read("!L")[0]
6227 assert(_experimenter == 6035143)
6228 _subtype = reader.read("!L")[0]
6229 assert(_subtype == 25)
6230 obj.status = reader.read("!L")[0]
6231 return obj
6232
6233 def __eq__(self, other):
6234 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006235 if self.xid != other.xid: return False
6236 if self.status != other.status: return False
6237 return True
6238
Dan Talaycof6202252013-07-02 01:00:29 -07006239 def pretty_print(self, q):
6240 q.text("bsn_set_pktin_suppression_reply {")
6241 with q.group():
6242 with q.indent(2):
6243 q.breakable()
6244 q.text("xid = ");
6245 if self.xid != None:
6246 q.text("%#x" % self.xid)
6247 else:
6248 q.text('None')
6249 q.text(","); q.breakable()
6250 q.text("status = ");
6251 q.text("%#x" % self.status)
6252 q.breakable()
6253 q.text('}')
6254
Rich Lane7dcdf022013-12-11 14:45:27 -08006255bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
6256
6257class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006258 version = 4
6259 type = 4
6260 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07006261 subtype = 11
6262
6263 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006264 if xid != None:
6265 self.xid = xid
6266 else:
6267 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006268 if enabled != None:
6269 self.enabled = enabled
6270 else:
6271 self.enabled = 0
6272 if idle_timeout != None:
6273 self.idle_timeout = idle_timeout
6274 else:
6275 self.idle_timeout = 0
6276 if hard_timeout != None:
6277 self.hard_timeout = hard_timeout
6278 else:
6279 self.hard_timeout = 0
6280 if priority != None:
6281 self.priority = priority
6282 else:
6283 self.priority = 0
6284 if cookie != None:
6285 self.cookie = cookie
6286 else:
6287 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006288 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006289
6290 def pack(self):
6291 packed = []
6292 packed.append(struct.pack("!B", self.version))
6293 packed.append(struct.pack("!B", self.type))
6294 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6295 packed.append(struct.pack("!L", self.xid))
6296 packed.append(struct.pack("!L", self.experimenter))
6297 packed.append(struct.pack("!L", self.subtype))
6298 packed.append(struct.pack("!B", self.enabled))
6299 packed.append('\x00' * 1)
6300 packed.append(struct.pack("!H", self.idle_timeout))
6301 packed.append(struct.pack("!H", self.hard_timeout))
6302 packed.append(struct.pack("!H", self.priority))
6303 packed.append(struct.pack("!Q", self.cookie))
6304 length = sum([len(x) for x in packed])
6305 packed[2] = struct.pack("!H", length)
6306 return ''.join(packed)
6307
6308 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006309 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006310 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006311 _version = reader.read("!B")[0]
6312 assert(_version == 4)
6313 _type = reader.read("!B")[0]
6314 assert(_type == 4)
6315 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006316 orig_reader = reader
6317 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006318 obj.xid = reader.read("!L")[0]
6319 _experimenter = reader.read("!L")[0]
6320 assert(_experimenter == 6035143)
6321 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006322 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006323 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006324 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07006325 obj.idle_timeout = reader.read("!H")[0]
6326 obj.hard_timeout = reader.read("!H")[0]
6327 obj.priority = reader.read("!H")[0]
6328 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006329 return obj
6330
6331 def __eq__(self, other):
6332 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006333 if self.xid != other.xid: return False
6334 if self.enabled != other.enabled: return False
6335 if self.idle_timeout != other.idle_timeout: return False
6336 if self.hard_timeout != other.hard_timeout: return False
6337 if self.priority != other.priority: return False
6338 if self.cookie != other.cookie: return False
6339 return True
6340
Rich Lanec2ee4b82013-04-24 17:12:38 -07006341 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07006342 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07006343 with q.group():
6344 with q.indent(2):
6345 q.breakable()
6346 q.text("xid = ");
6347 if self.xid != None:
6348 q.text("%#x" % self.xid)
6349 else:
6350 q.text('None')
6351 q.text(","); q.breakable()
6352 q.text("enabled = ");
6353 q.text("%#x" % self.enabled)
6354 q.text(","); q.breakable()
6355 q.text("idle_timeout = ");
6356 q.text("%#x" % self.idle_timeout)
6357 q.text(","); q.breakable()
6358 q.text("hard_timeout = ");
6359 q.text("%#x" % self.hard_timeout)
6360 q.text(","); q.breakable()
6361 q.text("priority = ");
6362 q.text("%#x" % self.priority)
6363 q.text(","); q.breakable()
6364 q.text("cookie = ");
6365 q.text("%#x" % self.cookie)
6366 q.breakable()
6367 q.text('}')
6368
Rich Lane7dcdf022013-12-11 14:45:27 -08006369bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
6370
6371class bsn_set_switch_pipeline_reply(bsn_header):
6372 version = 4
6373 type = 4
6374 experimenter = 6035143
6375 subtype = 54
6376
6377 def __init__(self, xid=None, status=None):
6378 if xid != None:
6379 self.xid = xid
6380 else:
6381 self.xid = None
6382 if status != None:
6383 self.status = status
6384 else:
6385 self.status = 0
6386 return
6387
6388 def pack(self):
6389 packed = []
6390 packed.append(struct.pack("!B", self.version))
6391 packed.append(struct.pack("!B", self.type))
6392 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6393 packed.append(struct.pack("!L", self.xid))
6394 packed.append(struct.pack("!L", self.experimenter))
6395 packed.append(struct.pack("!L", self.subtype))
6396 packed.append(struct.pack("!L", self.status))
6397 length = sum([len(x) for x in packed])
6398 packed[2] = struct.pack("!H", length)
6399 return ''.join(packed)
6400
6401 @staticmethod
6402 def unpack(reader):
6403 obj = bsn_set_switch_pipeline_reply()
6404 _version = reader.read("!B")[0]
6405 assert(_version == 4)
6406 _type = reader.read("!B")[0]
6407 assert(_type == 4)
6408 _length = reader.read("!H")[0]
6409 orig_reader = reader
6410 reader = orig_reader.slice(_length - (2 + 2))
6411 obj.xid = reader.read("!L")[0]
6412 _experimenter = reader.read("!L")[0]
6413 assert(_experimenter == 6035143)
6414 _subtype = reader.read("!L")[0]
6415 assert(_subtype == 54)
6416 obj.status = reader.read("!L")[0]
6417 return obj
6418
6419 def __eq__(self, other):
6420 if type(self) != type(other): return False
6421 if self.xid != other.xid: return False
6422 if self.status != other.status: return False
6423 return True
6424
6425 def pretty_print(self, q):
6426 q.text("bsn_set_switch_pipeline_reply {")
6427 with q.group():
6428 with q.indent(2):
6429 q.breakable()
6430 q.text("xid = ");
6431 if self.xid != None:
6432 q.text("%#x" % self.xid)
6433 else:
6434 q.text('None')
6435 q.text(","); q.breakable()
6436 q.text("status = ");
6437 q.text("%#x" % self.status)
6438 q.breakable()
6439 q.text('}')
6440
6441bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
6442
6443class bsn_set_switch_pipeline_request(bsn_header):
6444 version = 4
6445 type = 4
6446 experimenter = 6035143
6447 subtype = 53
6448
6449 def __init__(self, xid=None, pipeline=None):
6450 if xid != None:
6451 self.xid = xid
6452 else:
6453 self.xid = None
6454 if pipeline != None:
6455 self.pipeline = pipeline
6456 else:
6457 self.pipeline = ""
6458 return
6459
6460 def pack(self):
6461 packed = []
6462 packed.append(struct.pack("!B", self.version))
6463 packed.append(struct.pack("!B", self.type))
6464 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6465 packed.append(struct.pack("!L", self.xid))
6466 packed.append(struct.pack("!L", self.experimenter))
6467 packed.append(struct.pack("!L", self.subtype))
6468 packed.append(struct.pack("!256s", self.pipeline))
6469 length = sum([len(x) for x in packed])
6470 packed[2] = struct.pack("!H", length)
6471 return ''.join(packed)
6472
6473 @staticmethod
6474 def unpack(reader):
6475 obj = bsn_set_switch_pipeline_request()
6476 _version = reader.read("!B")[0]
6477 assert(_version == 4)
6478 _type = reader.read("!B")[0]
6479 assert(_type == 4)
6480 _length = reader.read("!H")[0]
6481 orig_reader = reader
6482 reader = orig_reader.slice(_length - (2 + 2))
6483 obj.xid = reader.read("!L")[0]
6484 _experimenter = reader.read("!L")[0]
6485 assert(_experimenter == 6035143)
6486 _subtype = reader.read("!L")[0]
6487 assert(_subtype == 53)
6488 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
6489 return obj
6490
6491 def __eq__(self, other):
6492 if type(self) != type(other): return False
6493 if self.xid != other.xid: return False
6494 if self.pipeline != other.pipeline: return False
6495 return True
6496
6497 def pretty_print(self, q):
6498 q.text("bsn_set_switch_pipeline_request {")
6499 with q.group():
6500 with q.indent(2):
6501 q.breakable()
6502 q.text("xid = ");
6503 if self.xid != None:
6504 q.text("%#x" % self.xid)
6505 else:
6506 q.text('None')
6507 q.text(","); q.breakable()
6508 q.text("pipeline = ");
6509 q.pp(self.pipeline)
6510 q.breakable()
6511 q.text('}')
6512
6513bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
6514
6515class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
6516 version = 4
6517 type = 19
6518 stats_type = 65535
6519 experimenter = 6035143
6520 subtype = 6
6521
6522 def __init__(self, xid=None, flags=None, entries=None):
6523 if xid != None:
6524 self.xid = xid
6525 else:
6526 self.xid = None
6527 if flags != None:
6528 self.flags = flags
6529 else:
6530 self.flags = 0
6531 if entries != None:
6532 self.entries = entries
6533 else:
6534 self.entries = []
6535 return
6536
6537 def pack(self):
6538 packed = []
6539 packed.append(struct.pack("!B", self.version))
6540 packed.append(struct.pack("!B", self.type))
6541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6542 packed.append(struct.pack("!L", self.xid))
6543 packed.append(struct.pack("!H", self.stats_type))
6544 packed.append(struct.pack("!H", self.flags))
6545 packed.append('\x00' * 4)
6546 packed.append(struct.pack("!L", self.experimenter))
6547 packed.append(struct.pack("!L", self.subtype))
6548 packed.append(loxi.generic_util.pack_list(self.entries))
6549 length = sum([len(x) for x in packed])
6550 packed[2] = struct.pack("!H", length)
6551 return ''.join(packed)
6552
6553 @staticmethod
6554 def unpack(reader):
6555 obj = bsn_switch_pipeline_stats_reply()
6556 _version = reader.read("!B")[0]
6557 assert(_version == 4)
6558 _type = reader.read("!B")[0]
6559 assert(_type == 19)
6560 _length = reader.read("!H")[0]
6561 orig_reader = reader
6562 reader = orig_reader.slice(_length - (2 + 2))
6563 obj.xid = reader.read("!L")[0]
6564 _stats_type = reader.read("!H")[0]
6565 assert(_stats_type == 65535)
6566 obj.flags = reader.read("!H")[0]
6567 reader.skip(4)
6568 _experimenter = reader.read("!L")[0]
6569 assert(_experimenter == 6035143)
6570 _subtype = reader.read("!L")[0]
6571 assert(_subtype == 6)
6572 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
6573 return obj
6574
6575 def __eq__(self, other):
6576 if type(self) != type(other): return False
6577 if self.xid != other.xid: return False
6578 if self.flags != other.flags: return False
6579 if self.entries != other.entries: return False
6580 return True
6581
6582 def pretty_print(self, q):
6583 q.text("bsn_switch_pipeline_stats_reply {")
6584 with q.group():
6585 with q.indent(2):
6586 q.breakable()
6587 q.text("xid = ");
6588 if self.xid != None:
6589 q.text("%#x" % self.xid)
6590 else:
6591 q.text('None')
6592 q.text(","); q.breakable()
6593 q.text("flags = ");
6594 q.text("%#x" % self.flags)
6595 q.text(","); q.breakable()
6596 q.text("entries = ");
6597 q.pp(self.entries)
6598 q.breakable()
6599 q.text('}')
6600
6601bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
6602
6603class bsn_switch_pipeline_stats_request(bsn_stats_request):
6604 version = 4
6605 type = 18
6606 stats_type = 65535
6607 experimenter = 6035143
6608 subtype = 6
6609
6610 def __init__(self, xid=None, flags=None):
6611 if xid != None:
6612 self.xid = xid
6613 else:
6614 self.xid = None
6615 if flags != None:
6616 self.flags = flags
6617 else:
6618 self.flags = 0
6619 return
6620
6621 def pack(self):
6622 packed = []
6623 packed.append(struct.pack("!B", self.version))
6624 packed.append(struct.pack("!B", self.type))
6625 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6626 packed.append(struct.pack("!L", self.xid))
6627 packed.append(struct.pack("!H", self.stats_type))
6628 packed.append(struct.pack("!H", self.flags))
6629 packed.append('\x00' * 4)
6630 packed.append(struct.pack("!L", self.experimenter))
6631 packed.append(struct.pack("!L", self.subtype))
6632 length = sum([len(x) for x in packed])
6633 packed[2] = struct.pack("!H", length)
6634 return ''.join(packed)
6635
6636 @staticmethod
6637 def unpack(reader):
6638 obj = bsn_switch_pipeline_stats_request()
6639 _version = reader.read("!B")[0]
6640 assert(_version == 4)
6641 _type = reader.read("!B")[0]
6642 assert(_type == 18)
6643 _length = reader.read("!H")[0]
6644 orig_reader = reader
6645 reader = orig_reader.slice(_length - (2 + 2))
6646 obj.xid = reader.read("!L")[0]
6647 _stats_type = reader.read("!H")[0]
6648 assert(_stats_type == 65535)
6649 obj.flags = reader.read("!H")[0]
6650 reader.skip(4)
6651 _experimenter = reader.read("!L")[0]
6652 assert(_experimenter == 6035143)
6653 _subtype = reader.read("!L")[0]
6654 assert(_subtype == 6)
6655 return obj
6656
6657 def __eq__(self, other):
6658 if type(self) != type(other): return False
6659 if self.xid != other.xid: return False
6660 if self.flags != other.flags: return False
6661 return True
6662
6663 def pretty_print(self, q):
6664 q.text("bsn_switch_pipeline_stats_request {")
6665 with q.group():
6666 with q.indent(2):
6667 q.breakable()
6668 q.text("xid = ");
6669 if self.xid != None:
6670 q.text("%#x" % self.xid)
6671 else:
6672 q.text('None')
6673 q.text(","); q.breakable()
6674 q.text("flags = ");
6675 q.text("%#x" % self.flags)
6676 q.breakable()
6677 q.text('}')
6678
6679bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
6680
6681class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006682 version = 4
6683 type = 4
6684 experimenter = 6035143
6685 subtype = 45
6686
6687 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006688 if xid != None:
6689 self.xid = xid
6690 else:
6691 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006692 if time_ms != None:
6693 self.time_ms = time_ms
6694 else:
6695 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006696 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006697
6698 def pack(self):
6699 packed = []
6700 packed.append(struct.pack("!B", self.version))
6701 packed.append(struct.pack("!B", self.type))
6702 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6703 packed.append(struct.pack("!L", self.xid))
6704 packed.append(struct.pack("!L", self.experimenter))
6705 packed.append(struct.pack("!L", self.subtype))
6706 packed.append(struct.pack("!Q", self.time_ms))
6707 length = sum([len(x) for x in packed])
6708 packed[2] = struct.pack("!H", length)
6709 return ''.join(packed)
6710
6711 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006712 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006713 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08006714 _version = reader.read("!B")[0]
6715 assert(_version == 4)
6716 _type = reader.read("!B")[0]
6717 assert(_type == 4)
6718 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006719 orig_reader = reader
6720 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006721 obj.xid = reader.read("!L")[0]
6722 _experimenter = reader.read("!L")[0]
6723 assert(_experimenter == 6035143)
6724 _subtype = reader.read("!L")[0]
6725 assert(_subtype == 45)
6726 obj.time_ms = reader.read("!Q")[0]
6727 return obj
6728
6729 def __eq__(self, other):
6730 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006731 if self.xid != other.xid: return False
6732 if self.time_ms != other.time_ms: return False
6733 return True
6734
Rich Lane7b0f2012013-11-22 14:15:26 -08006735 def pretty_print(self, q):
6736 q.text("bsn_time_reply {")
6737 with q.group():
6738 with q.indent(2):
6739 q.breakable()
6740 q.text("xid = ");
6741 if self.xid != None:
6742 q.text("%#x" % self.xid)
6743 else:
6744 q.text('None')
6745 q.text(","); q.breakable()
6746 q.text("time_ms = ");
6747 q.text("%#x" % self.time_ms)
6748 q.breakable()
6749 q.text('}')
6750
Rich Lane7dcdf022013-12-11 14:45:27 -08006751bsn_header.subtypes[45] = bsn_time_reply
6752
6753class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006754 version = 4
6755 type = 4
6756 experimenter = 6035143
6757 subtype = 44
6758
6759 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006760 if xid != None:
6761 self.xid = xid
6762 else:
6763 self.xid = None
6764 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006765
6766 def pack(self):
6767 packed = []
6768 packed.append(struct.pack("!B", self.version))
6769 packed.append(struct.pack("!B", self.type))
6770 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6771 packed.append(struct.pack("!L", self.xid))
6772 packed.append(struct.pack("!L", self.experimenter))
6773 packed.append(struct.pack("!L", self.subtype))
6774 length = sum([len(x) for x in packed])
6775 packed[2] = struct.pack("!H", length)
6776 return ''.join(packed)
6777
6778 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006779 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006780 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006781 _version = reader.read("!B")[0]
6782 assert(_version == 4)
6783 _type = reader.read("!B")[0]
6784 assert(_type == 4)
6785 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006786 orig_reader = reader
6787 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006788 obj.xid = reader.read("!L")[0]
6789 _experimenter = reader.read("!L")[0]
6790 assert(_experimenter == 6035143)
6791 _subtype = reader.read("!L")[0]
6792 assert(_subtype == 44)
6793 return obj
6794
6795 def __eq__(self, other):
6796 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006797 if self.xid != other.xid: return False
6798 return True
6799
Rich Lane7b0f2012013-11-22 14:15:26 -08006800 def pretty_print(self, q):
6801 q.text("bsn_time_request {")
6802 with q.group():
6803 with q.indent(2):
6804 q.breakable()
6805 q.text("xid = ");
6806 if self.xid != None:
6807 q.text("%#x" % self.xid)
6808 else:
6809 q.text('None')
6810 q.breakable()
6811 q.text('}')
6812
Rich Lane7dcdf022013-12-11 14:45:27 -08006813bsn_header.subtypes[44] = bsn_time_request
6814
6815class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006816 version = 4
6817 type = 4
6818 experimenter = 6035143
6819 subtype = 16
6820
6821 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006822 if xid != None:
6823 self.xid = xid
6824 else:
6825 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006826 if status != None:
6827 self.status = status
6828 else:
6829 self.status = 0
6830 if vport_no != None:
6831 self.vport_no = vport_no
6832 else:
6833 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006834 return
Dan Talaycof6202252013-07-02 01:00:29 -07006835
6836 def pack(self):
6837 packed = []
6838 packed.append(struct.pack("!B", self.version))
6839 packed.append(struct.pack("!B", self.type))
6840 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6841 packed.append(struct.pack("!L", self.xid))
6842 packed.append(struct.pack("!L", self.experimenter))
6843 packed.append(struct.pack("!L", self.subtype))
6844 packed.append(struct.pack("!L", self.status))
6845 packed.append(struct.pack("!L", self.vport_no))
6846 length = sum([len(x) for x in packed])
6847 packed[2] = struct.pack("!H", length)
6848 return ''.join(packed)
6849
6850 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006851 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006852 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006853 _version = reader.read("!B")[0]
6854 assert(_version == 4)
6855 _type = reader.read("!B")[0]
6856 assert(_type == 4)
6857 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006858 orig_reader = reader
6859 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006860 obj.xid = reader.read("!L")[0]
6861 _experimenter = reader.read("!L")[0]
6862 assert(_experimenter == 6035143)
6863 _subtype = reader.read("!L")[0]
6864 assert(_subtype == 16)
6865 obj.status = reader.read("!L")[0]
6866 obj.vport_no = reader.read("!L")[0]
6867 return obj
6868
6869 def __eq__(self, other):
6870 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006871 if self.xid != other.xid: return False
6872 if self.status != other.status: return False
6873 if self.vport_no != other.vport_no: return False
6874 return True
6875
Dan Talaycof6202252013-07-02 01:00:29 -07006876 def pretty_print(self, q):
6877 q.text("bsn_virtual_port_create_reply {")
6878 with q.group():
6879 with q.indent(2):
6880 q.breakable()
6881 q.text("xid = ");
6882 if self.xid != None:
6883 q.text("%#x" % self.xid)
6884 else:
6885 q.text('None')
6886 q.text(","); q.breakable()
6887 q.text("status = ");
6888 q.text("%#x" % self.status)
6889 q.text(","); q.breakable()
6890 q.text("vport_no = ");
6891 q.text("%#x" % self.vport_no)
6892 q.breakable()
6893 q.text('}')
6894
Rich Lane7dcdf022013-12-11 14:45:27 -08006895bsn_header.subtypes[16] = bsn_virtual_port_create_reply
6896
6897class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006898 version = 4
6899 type = 4
6900 experimenter = 6035143
6901 subtype = 15
6902
6903 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006904 if xid != None:
6905 self.xid = xid
6906 else:
6907 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006908 if vport != None:
6909 self.vport = vport
6910 else:
6911 self.vport = common.bsn_vport_q_in_q()
Rich Lane7dcdf022013-12-11 14:45:27 -08006912 return
Dan Talaycof6202252013-07-02 01:00:29 -07006913
6914 def pack(self):
6915 packed = []
6916 packed.append(struct.pack("!B", self.version))
6917 packed.append(struct.pack("!B", self.type))
6918 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6919 packed.append(struct.pack("!L", self.xid))
6920 packed.append(struct.pack("!L", self.experimenter))
6921 packed.append(struct.pack("!L", self.subtype))
6922 packed.append(self.vport.pack())
6923 length = sum([len(x) for x in packed])
6924 packed[2] = struct.pack("!H", length)
6925 return ''.join(packed)
6926
6927 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006928 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07006929 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006930 _version = reader.read("!B")[0]
6931 assert(_version == 4)
6932 _type = reader.read("!B")[0]
6933 assert(_type == 4)
6934 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006935 orig_reader = reader
6936 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006937 obj.xid = reader.read("!L")[0]
6938 _experimenter = reader.read("!L")[0]
6939 assert(_experimenter == 6035143)
6940 _subtype = reader.read("!L")[0]
6941 assert(_subtype == 15)
6942 obj.vport = common.bsn_vport_q_in_q.unpack(reader)
6943 return obj
6944
6945 def __eq__(self, other):
6946 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07006947 if self.xid != other.xid: return False
6948 if self.vport != other.vport: return False
6949 return True
6950
Dan Talaycof6202252013-07-02 01:00:29 -07006951 def pretty_print(self, q):
6952 q.text("bsn_virtual_port_create_request {")
6953 with q.group():
6954 with q.indent(2):
6955 q.breakable()
6956 q.text("xid = ");
6957 if self.xid != None:
6958 q.text("%#x" % self.xid)
6959 else:
6960 q.text('None')
6961 q.text(","); q.breakable()
6962 q.text("vport = ");
6963 q.pp(self.vport)
6964 q.breakable()
6965 q.text('}')
6966
Rich Lane7dcdf022013-12-11 14:45:27 -08006967bsn_header.subtypes[15] = bsn_virtual_port_create_request
6968
6969class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006970 version = 4
6971 type = 4
6972 experimenter = 6035143
6973 subtype = 26
6974
6975 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006976 if xid != None:
6977 self.xid = xid
6978 else:
6979 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07006980 if status != None:
6981 self.status = status
6982 else:
6983 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006984 return
Dan Talaycof6202252013-07-02 01:00:29 -07006985
6986 def pack(self):
6987 packed = []
6988 packed.append(struct.pack("!B", self.version))
6989 packed.append(struct.pack("!B", self.type))
6990 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6991 packed.append(struct.pack("!L", self.xid))
6992 packed.append(struct.pack("!L", self.experimenter))
6993 packed.append(struct.pack("!L", self.subtype))
6994 packed.append(struct.pack("!L", self.status))
6995 length = sum([len(x) for x in packed])
6996 packed[2] = struct.pack("!H", length)
6997 return ''.join(packed)
6998
6999 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007000 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007001 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007002 _version = reader.read("!B")[0]
7003 assert(_version == 4)
7004 _type = reader.read("!B")[0]
7005 assert(_type == 4)
7006 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007007 orig_reader = reader
7008 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007009 obj.xid = reader.read("!L")[0]
7010 _experimenter = reader.read("!L")[0]
7011 assert(_experimenter == 6035143)
7012 _subtype = reader.read("!L")[0]
7013 assert(_subtype == 26)
7014 obj.status = reader.read("!L")[0]
7015 return obj
7016
7017 def __eq__(self, other):
7018 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007019 if self.xid != other.xid: return False
7020 if self.status != other.status: return False
7021 return True
7022
Dan Talaycof6202252013-07-02 01:00:29 -07007023 def pretty_print(self, q):
7024 q.text("bsn_virtual_port_remove_reply {")
7025 with q.group():
7026 with q.indent(2):
7027 q.breakable()
7028 q.text("xid = ");
7029 if self.xid != None:
7030 q.text("%#x" % self.xid)
7031 else:
7032 q.text('None')
7033 q.text(","); q.breakable()
7034 q.text("status = ");
7035 q.text("%#x" % self.status)
7036 q.breakable()
7037 q.text('}')
7038
Rich Lane7dcdf022013-12-11 14:45:27 -08007039bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
7040
7041class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007042 version = 4
7043 type = 4
7044 experimenter = 6035143
7045 subtype = 17
7046
7047 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007048 if xid != None:
7049 self.xid = xid
7050 else:
7051 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007052 if vport_no != None:
7053 self.vport_no = vport_no
7054 else:
7055 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007056 return
Dan Talaycof6202252013-07-02 01:00:29 -07007057
7058 def pack(self):
7059 packed = []
7060 packed.append(struct.pack("!B", self.version))
7061 packed.append(struct.pack("!B", self.type))
7062 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7063 packed.append(struct.pack("!L", self.xid))
7064 packed.append(struct.pack("!L", self.experimenter))
7065 packed.append(struct.pack("!L", self.subtype))
7066 packed.append(struct.pack("!L", self.vport_no))
7067 length = sum([len(x) for x in packed])
7068 packed[2] = struct.pack("!H", length)
7069 return ''.join(packed)
7070
7071 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007072 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007073 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007074 _version = reader.read("!B")[0]
7075 assert(_version == 4)
7076 _type = reader.read("!B")[0]
7077 assert(_type == 4)
7078 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007079 orig_reader = reader
7080 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007081 obj.xid = reader.read("!L")[0]
7082 _experimenter = reader.read("!L")[0]
7083 assert(_experimenter == 6035143)
7084 _subtype = reader.read("!L")[0]
7085 assert(_subtype == 17)
7086 obj.vport_no = reader.read("!L")[0]
7087 return obj
7088
7089 def __eq__(self, other):
7090 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007091 if self.xid != other.xid: return False
7092 if self.vport_no != other.vport_no: return False
7093 return True
7094
Dan Talaycof6202252013-07-02 01:00:29 -07007095 def pretty_print(self, q):
7096 q.text("bsn_virtual_port_remove_request {")
7097 with q.group():
7098 with q.indent(2):
7099 q.breakable()
7100 q.text("xid = ");
7101 if self.xid != None:
7102 q.text("%#x" % self.xid)
7103 else:
7104 q.text('None')
7105 q.text(","); q.breakable()
7106 q.text("vport_no = ");
7107 q.text("%#x" % self.vport_no)
7108 q.breakable()
7109 q.text('}')
7110
Rich Lane7dcdf022013-12-11 14:45:27 -08007111bsn_header.subtypes[17] = bsn_virtual_port_remove_request
7112
7113class bsn_vlan_counter_stats_reply(bsn_stats_reply):
7114 version = 4
7115 type = 19
7116 stats_type = 65535
7117 experimenter = 6035143
7118 subtype = 9
7119
7120 def __init__(self, xid=None, flags=None, entries=None):
7121 if xid != None:
7122 self.xid = xid
7123 else:
7124 self.xid = None
7125 if flags != None:
7126 self.flags = flags
7127 else:
7128 self.flags = 0
7129 if entries != None:
7130 self.entries = entries
7131 else:
7132 self.entries = []
7133 return
7134
7135 def pack(self):
7136 packed = []
7137 packed.append(struct.pack("!B", self.version))
7138 packed.append(struct.pack("!B", self.type))
7139 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7140 packed.append(struct.pack("!L", self.xid))
7141 packed.append(struct.pack("!H", self.stats_type))
7142 packed.append(struct.pack("!H", self.flags))
7143 packed.append('\x00' * 4)
7144 packed.append(struct.pack("!L", self.experimenter))
7145 packed.append(struct.pack("!L", self.subtype))
7146 packed.append(loxi.generic_util.pack_list(self.entries))
7147 length = sum([len(x) for x in packed])
7148 packed[2] = struct.pack("!H", length)
7149 return ''.join(packed)
7150
7151 @staticmethod
7152 def unpack(reader):
7153 obj = bsn_vlan_counter_stats_reply()
7154 _version = reader.read("!B")[0]
7155 assert(_version == 4)
7156 _type = reader.read("!B")[0]
7157 assert(_type == 19)
7158 _length = reader.read("!H")[0]
7159 orig_reader = reader
7160 reader = orig_reader.slice(_length - (2 + 2))
7161 obj.xid = reader.read("!L")[0]
7162 _stats_type = reader.read("!H")[0]
7163 assert(_stats_type == 65535)
7164 obj.flags = reader.read("!H")[0]
7165 reader.skip(4)
7166 _experimenter = reader.read("!L")[0]
7167 assert(_experimenter == 6035143)
7168 _subtype = reader.read("!L")[0]
7169 assert(_subtype == 9)
7170 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
7171 return obj
7172
7173 def __eq__(self, other):
7174 if type(self) != type(other): return False
7175 if self.xid != other.xid: return False
7176 if self.flags != other.flags: return False
7177 if self.entries != other.entries: return False
7178 return True
7179
7180 def pretty_print(self, q):
7181 q.text("bsn_vlan_counter_stats_reply {")
7182 with q.group():
7183 with q.indent(2):
7184 q.breakable()
7185 q.text("xid = ");
7186 if self.xid != None:
7187 q.text("%#x" % self.xid)
7188 else:
7189 q.text('None')
7190 q.text(","); q.breakable()
7191 q.text("flags = ");
7192 q.text("%#x" % self.flags)
7193 q.text(","); q.breakable()
7194 q.text("entries = ");
7195 q.pp(self.entries)
7196 q.breakable()
7197 q.text('}')
7198
7199bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
7200
7201class bsn_vlan_counter_stats_request(bsn_stats_request):
7202 version = 4
7203 type = 18
7204 stats_type = 65535
7205 experimenter = 6035143
7206 subtype = 9
7207
7208 def __init__(self, xid=None, flags=None, vlan_vid=None):
7209 if xid != None:
7210 self.xid = xid
7211 else:
7212 self.xid = None
7213 if flags != None:
7214 self.flags = flags
7215 else:
7216 self.flags = 0
7217 if vlan_vid != None:
7218 self.vlan_vid = vlan_vid
7219 else:
7220 self.vlan_vid = 0
7221 return
7222
7223 def pack(self):
7224 packed = []
7225 packed.append(struct.pack("!B", self.version))
7226 packed.append(struct.pack("!B", self.type))
7227 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7228 packed.append(struct.pack("!L", self.xid))
7229 packed.append(struct.pack("!H", self.stats_type))
7230 packed.append(struct.pack("!H", self.flags))
7231 packed.append('\x00' * 4)
7232 packed.append(struct.pack("!L", self.experimenter))
7233 packed.append(struct.pack("!L", self.subtype))
7234 packed.append(struct.pack("!H", self.vlan_vid))
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_vlan_counter_stats_request()
7242 _version = reader.read("!B")[0]
7243 assert(_version == 4)
7244 _type = reader.read("!B")[0]
7245 assert(_type == 18)
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 _stats_type = reader.read("!H")[0]
7251 assert(_stats_type == 65535)
7252 obj.flags = reader.read("!H")[0]
7253 reader.skip(4)
7254 _experimenter = reader.read("!L")[0]
7255 assert(_experimenter == 6035143)
7256 _subtype = reader.read("!L")[0]
7257 assert(_subtype == 9)
7258 obj.vlan_vid = reader.read("!H")[0]
7259 return obj
7260
7261 def __eq__(self, other):
7262 if type(self) != type(other): return False
7263 if self.xid != other.xid: return False
7264 if self.flags != other.flags: return False
7265 if self.vlan_vid != other.vlan_vid: return False
7266 return True
7267
7268 def pretty_print(self, q):
7269 q.text("bsn_vlan_counter_stats_request {")
7270 with q.group():
7271 with q.indent(2):
7272 q.breakable()
7273 q.text("xid = ");
7274 if self.xid != None:
7275 q.text("%#x" % self.xid)
7276 else:
7277 q.text('None')
7278 q.text(","); q.breakable()
7279 q.text("flags = ");
7280 q.text("%#x" % self.flags)
7281 q.text(","); q.breakable()
7282 q.text("vlan_vid = ");
7283 q.text("%#x" % self.vlan_vid)
7284 q.breakable()
7285 q.text('}')
7286
7287bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
7288
7289class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007290 version = 4
7291 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007292 stats_type = 0
7293
7294 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 -08007295 if xid != None:
7296 self.xid = xid
7297 else:
7298 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007299 if flags != None:
7300 self.flags = flags
7301 else:
7302 self.flags = 0
7303 if mfr_desc != None:
7304 self.mfr_desc = mfr_desc
7305 else:
7306 self.mfr_desc = ""
7307 if hw_desc != None:
7308 self.hw_desc = hw_desc
7309 else:
7310 self.hw_desc = ""
7311 if sw_desc != None:
7312 self.sw_desc = sw_desc
7313 else:
7314 self.sw_desc = ""
7315 if serial_num != None:
7316 self.serial_num = serial_num
7317 else:
7318 self.serial_num = ""
7319 if dp_desc != None:
7320 self.dp_desc = dp_desc
7321 else:
7322 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08007323 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007324
7325 def pack(self):
7326 packed = []
7327 packed.append(struct.pack("!B", self.version))
7328 packed.append(struct.pack("!B", self.type))
7329 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7330 packed.append(struct.pack("!L", self.xid))
7331 packed.append(struct.pack("!H", self.stats_type))
7332 packed.append(struct.pack("!H", self.flags))
7333 packed.append('\x00' * 4)
7334 packed.append(struct.pack("!256s", self.mfr_desc))
7335 packed.append(struct.pack("!256s", self.hw_desc))
7336 packed.append(struct.pack("!256s", self.sw_desc))
7337 packed.append(struct.pack("!32s", self.serial_num))
7338 packed.append(struct.pack("!256s", self.dp_desc))
7339 length = sum([len(x) for x in packed])
7340 packed[2] = struct.pack("!H", length)
7341 return ''.join(packed)
7342
7343 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007344 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007345 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007346 _version = reader.read("!B")[0]
7347 assert(_version == 4)
7348 _type = reader.read("!B")[0]
7349 assert(_type == 19)
7350 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007351 orig_reader = reader
7352 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007353 obj.xid = reader.read("!L")[0]
7354 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007355 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007356 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007357 reader.skip(4)
7358 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
7359 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
7360 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
7361 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
7362 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
7363 return obj
7364
7365 def __eq__(self, other):
7366 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007367 if self.xid != other.xid: return False
7368 if self.flags != other.flags: return False
7369 if self.mfr_desc != other.mfr_desc: return False
7370 if self.hw_desc != other.hw_desc: return False
7371 if self.sw_desc != other.sw_desc: return False
7372 if self.serial_num != other.serial_num: return False
7373 if self.dp_desc != other.dp_desc: return False
7374 return True
7375
Rich Lanec2ee4b82013-04-24 17:12:38 -07007376 def pretty_print(self, q):
7377 q.text("desc_stats_reply {")
7378 with q.group():
7379 with q.indent(2):
7380 q.breakable()
7381 q.text("xid = ");
7382 if self.xid != None:
7383 q.text("%#x" % self.xid)
7384 else:
7385 q.text('None')
7386 q.text(","); q.breakable()
7387 q.text("flags = ");
7388 q.text("%#x" % self.flags)
7389 q.text(","); q.breakable()
7390 q.text("mfr_desc = ");
7391 q.pp(self.mfr_desc)
7392 q.text(","); q.breakable()
7393 q.text("hw_desc = ");
7394 q.pp(self.hw_desc)
7395 q.text(","); q.breakable()
7396 q.text("sw_desc = ");
7397 q.pp(self.sw_desc)
7398 q.text(","); q.breakable()
7399 q.text("serial_num = ");
7400 q.pp(self.serial_num)
7401 q.text(","); q.breakable()
7402 q.text("dp_desc = ");
7403 q.pp(self.dp_desc)
7404 q.breakable()
7405 q.text('}')
7406
Rich Lane7dcdf022013-12-11 14:45:27 -08007407stats_reply.subtypes[0] = desc_stats_reply
7408
7409class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007410 version = 4
7411 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007412 stats_type = 0
7413
7414 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007415 if xid != None:
7416 self.xid = xid
7417 else:
7418 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007419 if flags != None:
7420 self.flags = flags
7421 else:
7422 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007423 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007424
7425 def pack(self):
7426 packed = []
7427 packed.append(struct.pack("!B", self.version))
7428 packed.append(struct.pack("!B", self.type))
7429 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7430 packed.append(struct.pack("!L", self.xid))
7431 packed.append(struct.pack("!H", self.stats_type))
7432 packed.append(struct.pack("!H", self.flags))
7433 packed.append('\x00' * 4)
7434 length = sum([len(x) for x in packed])
7435 packed[2] = struct.pack("!H", length)
7436 return ''.join(packed)
7437
7438 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007439 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007440 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007441 _version = reader.read("!B")[0]
7442 assert(_version == 4)
7443 _type = reader.read("!B")[0]
7444 assert(_type == 18)
7445 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007446 orig_reader = reader
7447 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007448 obj.xid = reader.read("!L")[0]
7449 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007450 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07007451 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007452 reader.skip(4)
7453 return obj
7454
7455 def __eq__(self, other):
7456 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007457 if self.xid != other.xid: return False
7458 if self.flags != other.flags: return False
7459 return True
7460
Rich Lanec2ee4b82013-04-24 17:12:38 -07007461 def pretty_print(self, q):
7462 q.text("desc_stats_request {")
7463 with q.group():
7464 with q.indent(2):
7465 q.breakable()
7466 q.text("xid = ");
7467 if self.xid != None:
7468 q.text("%#x" % self.xid)
7469 else:
7470 q.text('None')
7471 q.text(","); q.breakable()
7472 q.text("flags = ");
7473 q.text("%#x" % self.flags)
7474 q.breakable()
7475 q.text('}')
7476
Rich Lane7dcdf022013-12-11 14:45:27 -08007477stats_request.subtypes[0] = desc_stats_request
7478
7479class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007480 version = 4
7481 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07007482
7483 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007484 if xid != None:
7485 self.xid = xid
7486 else:
7487 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007488 if data != None:
7489 self.data = data
7490 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007491 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007492 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007493
7494 def pack(self):
7495 packed = []
7496 packed.append(struct.pack("!B", self.version))
7497 packed.append(struct.pack("!B", self.type))
7498 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7499 packed.append(struct.pack("!L", self.xid))
7500 packed.append(self.data)
7501 length = sum([len(x) for x in packed])
7502 packed[2] = struct.pack("!H", length)
7503 return ''.join(packed)
7504
7505 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007506 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007507 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007508 _version = reader.read("!B")[0]
7509 assert(_version == 4)
7510 _type = reader.read("!B")[0]
7511 assert(_type == 3)
7512 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007513 orig_reader = reader
7514 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007515 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007516 obj.data = str(reader.read_all())
7517 return obj
7518
7519 def __eq__(self, other):
7520 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007521 if self.xid != other.xid: return False
7522 if self.data != other.data: return False
7523 return True
7524
Rich Lanec2ee4b82013-04-24 17:12:38 -07007525 def pretty_print(self, q):
7526 q.text("echo_reply {")
7527 with q.group():
7528 with q.indent(2):
7529 q.breakable()
7530 q.text("xid = ");
7531 if self.xid != None:
7532 q.text("%#x" % self.xid)
7533 else:
7534 q.text('None')
7535 q.text(","); q.breakable()
7536 q.text("data = ");
7537 q.pp(self.data)
7538 q.breakable()
7539 q.text('}')
7540
Rich Lane7dcdf022013-12-11 14:45:27 -08007541message.subtypes[3] = echo_reply
7542
7543class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007544 version = 4
7545 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07007546
7547 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007548 if xid != None:
7549 self.xid = xid
7550 else:
7551 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007552 if data != None:
7553 self.data = data
7554 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007555 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007556 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007557
7558 def pack(self):
7559 packed = []
7560 packed.append(struct.pack("!B", self.version))
7561 packed.append(struct.pack("!B", self.type))
7562 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7563 packed.append(struct.pack("!L", self.xid))
7564 packed.append(self.data)
7565 length = sum([len(x) for x in packed])
7566 packed[2] = struct.pack("!H", length)
7567 return ''.join(packed)
7568
7569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007570 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007571 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007572 _version = reader.read("!B")[0]
7573 assert(_version == 4)
7574 _type = reader.read("!B")[0]
7575 assert(_type == 2)
7576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007577 orig_reader = reader
7578 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007579 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007580 obj.data = str(reader.read_all())
7581 return obj
7582
7583 def __eq__(self, other):
7584 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007585 if self.xid != other.xid: return False
7586 if self.data != other.data: return False
7587 return True
7588
Rich Lanec2ee4b82013-04-24 17:12:38 -07007589 def pretty_print(self, q):
7590 q.text("echo_request {")
7591 with q.group():
7592 with q.indent(2):
7593 q.breakable()
7594 q.text("xid = ");
7595 if self.xid != None:
7596 q.text("%#x" % self.xid)
7597 else:
7598 q.text('None')
7599 q.text(","); q.breakable()
7600 q.text("data = ");
7601 q.pp(self.data)
7602 q.breakable()
7603 q.text('}')
7604
Rich Lane7dcdf022013-12-11 14:45:27 -08007605message.subtypes[2] = echo_request
7606
7607class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07007608 version = 4
7609 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07007610 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07007611
Rich Lane6f4978c2013-10-20 21:33:52 -07007612 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007613 if xid != None:
7614 self.xid = xid
7615 else:
7616 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007617 if subtype != None:
7618 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07007619 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07007620 self.subtype = 0
7621 if experimenter != None:
7622 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07007623 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07007624 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07007625 if data != None:
7626 self.data = data
7627 else:
Dan Talaycof6202252013-07-02 01:00:29 -07007628 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007629 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007630
7631 def pack(self):
7632 packed = []
7633 packed.append(struct.pack("!B", self.version))
7634 packed.append(struct.pack("!B", self.type))
7635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7636 packed.append(struct.pack("!L", self.xid))
7637 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07007638 packed.append(struct.pack("!H", self.subtype))
7639 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007640 packed.append(self.data)
7641 length = sum([len(x) for x in packed])
7642 packed[2] = struct.pack("!H", length)
7643 return ''.join(packed)
7644
7645 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007646 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007647 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07007648 _version = reader.read("!B")[0]
7649 assert(_version == 4)
7650 _type = reader.read("!B")[0]
7651 assert(_type == 1)
7652 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007653 orig_reader = reader
7654 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007655 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07007656 _err_type = reader.read("!H")[0]
7657 assert(_err_type == 65535)
7658 obj.subtype = reader.read("!H")[0]
7659 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007660 obj.data = str(reader.read_all())
7661 return obj
7662
7663 def __eq__(self, other):
7664 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007665 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007666 if self.subtype != other.subtype: return False
7667 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007668 if self.data != other.data: return False
7669 return True
7670
Rich Lanec2ee4b82013-04-24 17:12:38 -07007671 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07007672 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007673 with q.group():
7674 with q.indent(2):
7675 q.breakable()
7676 q.text("xid = ");
7677 if self.xid != None:
7678 q.text("%#x" % self.xid)
7679 else:
7680 q.text('None')
7681 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07007682 q.text("subtype = ");
7683 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007684 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07007685 q.text("experimenter = ");
7686 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007687 q.text(","); q.breakable()
7688 q.text("data = ");
7689 q.pp(self.data)
7690 q.breakable()
7691 q.text('}')
7692
Rich Lane7dcdf022013-12-11 14:45:27 -08007693error_msg.subtypes[65535] = experimenter_error_msg
7694
7695class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007696 version = 4
7697 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07007698
7699 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 -08007700 if xid != None:
7701 self.xid = xid
7702 else:
7703 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007704 if datapath_id != None:
7705 self.datapath_id = datapath_id
7706 else:
7707 self.datapath_id = 0
7708 if n_buffers != None:
7709 self.n_buffers = n_buffers
7710 else:
7711 self.n_buffers = 0
7712 if n_tables != None:
7713 self.n_tables = n_tables
7714 else:
7715 self.n_tables = 0
7716 if auxiliary_id != None:
7717 self.auxiliary_id = auxiliary_id
7718 else:
7719 self.auxiliary_id = 0
7720 if capabilities != None:
7721 self.capabilities = capabilities
7722 else:
7723 self.capabilities = 0
7724 if reserved != None:
7725 self.reserved = reserved
7726 else:
7727 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007728 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007729
7730 def pack(self):
7731 packed = []
7732 packed.append(struct.pack("!B", self.version))
7733 packed.append(struct.pack("!B", self.type))
7734 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7735 packed.append(struct.pack("!L", self.xid))
7736 packed.append(struct.pack("!Q", self.datapath_id))
7737 packed.append(struct.pack("!L", self.n_buffers))
7738 packed.append(struct.pack("!B", self.n_tables))
7739 packed.append(struct.pack("!B", self.auxiliary_id))
7740 packed.append('\x00' * 2)
7741 packed.append(struct.pack("!L", self.capabilities))
7742 packed.append(struct.pack("!L", self.reserved))
7743 length = sum([len(x) for x in packed])
7744 packed[2] = struct.pack("!H", length)
7745 return ''.join(packed)
7746
7747 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007748 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007749 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007750 _version = reader.read("!B")[0]
7751 assert(_version == 4)
7752 _type = reader.read("!B")[0]
7753 assert(_type == 6)
7754 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007755 orig_reader = reader
7756 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007757 obj.xid = reader.read("!L")[0]
7758 obj.datapath_id = reader.read("!Q")[0]
7759 obj.n_buffers = reader.read("!L")[0]
7760 obj.n_tables = reader.read("!B")[0]
7761 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007762 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007763 obj.capabilities = reader.read("!L")[0]
7764 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007765 return obj
7766
7767 def __eq__(self, other):
7768 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007769 if self.xid != other.xid: return False
7770 if self.datapath_id != other.datapath_id: return False
7771 if self.n_buffers != other.n_buffers: return False
7772 if self.n_tables != other.n_tables: return False
7773 if self.auxiliary_id != other.auxiliary_id: return False
7774 if self.capabilities != other.capabilities: return False
7775 if self.reserved != other.reserved: return False
7776 return True
7777
Rich Lanec2ee4b82013-04-24 17:12:38 -07007778 def pretty_print(self, q):
7779 q.text("features_reply {")
7780 with q.group():
7781 with q.indent(2):
7782 q.breakable()
7783 q.text("xid = ");
7784 if self.xid != None:
7785 q.text("%#x" % self.xid)
7786 else:
7787 q.text('None')
7788 q.text(","); q.breakable()
7789 q.text("datapath_id = ");
7790 q.text("%#x" % self.datapath_id)
7791 q.text(","); q.breakable()
7792 q.text("n_buffers = ");
7793 q.text("%#x" % self.n_buffers)
7794 q.text(","); q.breakable()
7795 q.text("n_tables = ");
7796 q.text("%#x" % self.n_tables)
7797 q.text(","); q.breakable()
7798 q.text("auxiliary_id = ");
7799 q.text("%#x" % self.auxiliary_id)
7800 q.text(","); q.breakable()
7801 q.text("capabilities = ");
7802 q.text("%#x" % self.capabilities)
7803 q.text(","); q.breakable()
7804 q.text("reserved = ");
7805 q.text("%#x" % self.reserved)
7806 q.breakable()
7807 q.text('}')
7808
Rich Lane7dcdf022013-12-11 14:45:27 -08007809message.subtypes[6] = features_reply
7810
7811class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007812 version = 4
7813 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07007814
7815 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007816 if xid != None:
7817 self.xid = xid
7818 else:
7819 self.xid = None
7820 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007821
7822 def pack(self):
7823 packed = []
7824 packed.append(struct.pack("!B", self.version))
7825 packed.append(struct.pack("!B", self.type))
7826 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7827 packed.append(struct.pack("!L", self.xid))
7828 length = sum([len(x) for x in packed])
7829 packed[2] = struct.pack("!H", length)
7830 return ''.join(packed)
7831
7832 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007833 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007834 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007835 _version = reader.read("!B")[0]
7836 assert(_version == 4)
7837 _type = reader.read("!B")[0]
7838 assert(_type == 5)
7839 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007840 orig_reader = reader
7841 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007842 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007843 return obj
7844
7845 def __eq__(self, other):
7846 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007847 if self.xid != other.xid: return False
7848 return True
7849
Rich Lanec2ee4b82013-04-24 17:12:38 -07007850 def pretty_print(self, q):
7851 q.text("features_request {")
7852 with q.group():
7853 with q.indent(2):
7854 q.breakable()
7855 q.text("xid = ");
7856 if self.xid != None:
7857 q.text("%#x" % self.xid)
7858 else:
7859 q.text('None')
7860 q.breakable()
7861 q.text('}')
7862
Rich Lane7dcdf022013-12-11 14:45:27 -08007863message.subtypes[5] = features_request
7864
7865class flow_mod(message):
7866 subtypes = {}
7867
Rich Lane95f7fc92014-01-27 17:08:16 -08007868 version = 4
7869 type = 14
7870
7871 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):
7872 if xid != None:
7873 self.xid = xid
7874 else:
7875 self.xid = None
7876 if cookie != None:
7877 self.cookie = cookie
7878 else:
7879 self.cookie = 0
7880 if cookie_mask != None:
7881 self.cookie_mask = cookie_mask
7882 else:
7883 self.cookie_mask = 0
7884 if table_id != None:
7885 self.table_id = table_id
7886 else:
7887 self.table_id = 0
7888 if _command != None:
7889 self._command = _command
7890 else:
7891 self._command = 0
7892 if idle_timeout != None:
7893 self.idle_timeout = idle_timeout
7894 else:
7895 self.idle_timeout = 0
7896 if hard_timeout != None:
7897 self.hard_timeout = hard_timeout
7898 else:
7899 self.hard_timeout = 0
7900 if priority != None:
7901 self.priority = priority
7902 else:
7903 self.priority = 0
7904 if buffer_id != None:
7905 self.buffer_id = buffer_id
7906 else:
7907 self.buffer_id = 0
7908 if out_port != None:
7909 self.out_port = out_port
7910 else:
7911 self.out_port = 0
7912 if out_group != None:
7913 self.out_group = out_group
7914 else:
7915 self.out_group = 0
7916 if flags != None:
7917 self.flags = flags
7918 else:
7919 self.flags = 0
7920 if match != None:
7921 self.match = match
7922 else:
7923 self.match = common.match()
7924 if instructions != None:
7925 self.instructions = instructions
7926 else:
7927 self.instructions = []
7928 return
7929
7930 def pack(self):
7931 packed = []
7932 packed.append(struct.pack("!B", self.version))
7933 packed.append(struct.pack("!B", self.type))
7934 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7935 packed.append(struct.pack("!L", self.xid))
7936 packed.append(struct.pack("!Q", self.cookie))
7937 packed.append(struct.pack("!Q", self.cookie_mask))
7938 packed.append(struct.pack("!B", self.table_id))
7939 packed.append(util.pack_fm_cmd(self._command))
7940 packed.append(struct.pack("!H", self.idle_timeout))
7941 packed.append(struct.pack("!H", self.hard_timeout))
7942 packed.append(struct.pack("!H", self.priority))
7943 packed.append(struct.pack("!L", self.buffer_id))
7944 packed.append(util.pack_port_no(self.out_port))
7945 packed.append(struct.pack("!L", self.out_group))
7946 packed.append(struct.pack("!H", self.flags))
7947 packed.append('\x00' * 2)
7948 packed.append(self.match.pack())
7949 packed.append(loxi.generic_util.pack_list(self.instructions))
7950 length = sum([len(x) for x in packed])
7951 packed[2] = struct.pack("!H", length)
7952 return ''.join(packed)
7953
Rich Lane7dcdf022013-12-11 14:45:27 -08007954 @staticmethod
7955 def unpack(reader):
7956 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08007957 subclass = flow_mod.subtypes.get(subtype)
7958 if subclass:
7959 return subclass.unpack(reader)
7960
7961 obj = flow_mod()
7962 _version = reader.read("!B")[0]
7963 assert(_version == 4)
7964 _type = reader.read("!B")[0]
7965 assert(_type == 14)
7966 _length = reader.read("!H")[0]
7967 orig_reader = reader
7968 reader = orig_reader.slice(_length - (2 + 2))
7969 obj.xid = reader.read("!L")[0]
7970 obj.cookie = reader.read("!Q")[0]
7971 obj.cookie_mask = reader.read("!Q")[0]
7972 obj.table_id = reader.read("!B")[0]
7973 obj._command = util.unpack_fm_cmd(reader)
7974 obj.idle_timeout = reader.read("!H")[0]
7975 obj.hard_timeout = reader.read("!H")[0]
7976 obj.priority = reader.read("!H")[0]
7977 obj.buffer_id = reader.read("!L")[0]
7978 obj.out_port = util.unpack_port_no(reader)
7979 obj.out_group = reader.read("!L")[0]
7980 obj.flags = reader.read("!H")[0]
7981 reader.skip(2)
7982 obj.match = common.match.unpack(reader)
7983 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
7984 return obj
7985
7986 def __eq__(self, other):
7987 if type(self) != type(other): return False
7988 if self.xid != other.xid: return False
7989 if self.cookie != other.cookie: return False
7990 if self.cookie_mask != other.cookie_mask: return False
7991 if self.table_id != other.table_id: return False
7992 if self._command != other._command: return False
7993 if self.idle_timeout != other.idle_timeout: return False
7994 if self.hard_timeout != other.hard_timeout: return False
7995 if self.priority != other.priority: return False
7996 if self.buffer_id != other.buffer_id: return False
7997 if self.out_port != other.out_port: return False
7998 if self.out_group != other.out_group: return False
7999 if self.flags != other.flags: return False
8000 if self.match != other.match: return False
8001 if self.instructions != other.instructions: return False
8002 return True
8003
8004 def pretty_print(self, q):
8005 q.text("flow_mod {")
8006 with q.group():
8007 with q.indent(2):
8008 q.breakable()
8009 q.text("xid = ");
8010 if self.xid != None:
8011 q.text("%#x" % self.xid)
8012 else:
8013 q.text('None')
8014 q.text(","); q.breakable()
8015 q.text("cookie = ");
8016 q.text("%#x" % self.cookie)
8017 q.text(","); q.breakable()
8018 q.text("cookie_mask = ");
8019 q.text("%#x" % self.cookie_mask)
8020 q.text(","); q.breakable()
8021 q.text("table_id = ");
8022 q.text("%#x" % self.table_id)
8023 q.text(","); q.breakable()
8024 q.text("idle_timeout = ");
8025 q.text("%#x" % self.idle_timeout)
8026 q.text(","); q.breakable()
8027 q.text("hard_timeout = ");
8028 q.text("%#x" % self.hard_timeout)
8029 q.text(","); q.breakable()
8030 q.text("priority = ");
8031 q.text("%#x" % self.priority)
8032 q.text(","); q.breakable()
8033 q.text("buffer_id = ");
8034 q.text("%#x" % self.buffer_id)
8035 q.text(","); q.breakable()
8036 q.text("out_port = ");
8037 q.text(util.pretty_port(self.out_port))
8038 q.text(","); q.breakable()
8039 q.text("out_group = ");
8040 q.text("%#x" % self.out_group)
8041 q.text(","); q.breakable()
8042 q.text("flags = ");
8043 q.text("%#x" % self.flags)
8044 q.text(","); q.breakable()
8045 q.text("match = ");
8046 q.pp(self.match)
8047 q.text(","); q.breakable()
8048 q.text("instructions = ");
8049 q.pp(self.instructions)
8050 q.breakable()
8051 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08008052
8053message.subtypes[14] = flow_mod
8054
8055class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008056 version = 4
8057 type = 14
8058 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07008059
8060 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 -08008061 if xid != None:
8062 self.xid = xid
8063 else:
8064 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008065 if cookie != None:
8066 self.cookie = cookie
8067 else:
8068 self.cookie = 0
8069 if cookie_mask != None:
8070 self.cookie_mask = cookie_mask
8071 else:
8072 self.cookie_mask = 0
8073 if table_id != None:
8074 self.table_id = table_id
8075 else:
8076 self.table_id = 0
8077 if idle_timeout != None:
8078 self.idle_timeout = idle_timeout
8079 else:
8080 self.idle_timeout = 0
8081 if hard_timeout != None:
8082 self.hard_timeout = hard_timeout
8083 else:
8084 self.hard_timeout = 0
8085 if priority != None:
8086 self.priority = priority
8087 else:
8088 self.priority = 0
8089 if buffer_id != None:
8090 self.buffer_id = buffer_id
8091 else:
8092 self.buffer_id = 0
8093 if out_port != None:
8094 self.out_port = out_port
8095 else:
8096 self.out_port = 0
8097 if out_group != None:
8098 self.out_group = out_group
8099 else:
8100 self.out_group = 0
8101 if flags != None:
8102 self.flags = flags
8103 else:
8104 self.flags = 0
8105 if match != None:
8106 self.match = match
8107 else:
8108 self.match = common.match()
8109 if instructions != None:
8110 self.instructions = instructions
8111 else:
8112 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008113 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008114
8115 def pack(self):
8116 packed = []
8117 packed.append(struct.pack("!B", self.version))
8118 packed.append(struct.pack("!B", self.type))
8119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8120 packed.append(struct.pack("!L", self.xid))
8121 packed.append(struct.pack("!Q", self.cookie))
8122 packed.append(struct.pack("!Q", self.cookie_mask))
8123 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008124 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008125 packed.append(struct.pack("!H", self.idle_timeout))
8126 packed.append(struct.pack("!H", self.hard_timeout))
8127 packed.append(struct.pack("!H", self.priority))
8128 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008129 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008130 packed.append(struct.pack("!L", self.out_group))
8131 packed.append(struct.pack("!H", self.flags))
8132 packed.append('\x00' * 2)
8133 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008134 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008135 length = sum([len(x) for x in packed])
8136 packed[2] = struct.pack("!H", length)
8137 return ''.join(packed)
8138
8139 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008140 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008141 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07008142 _version = reader.read("!B")[0]
8143 assert(_version == 4)
8144 _type = reader.read("!B")[0]
8145 assert(_type == 14)
8146 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008147 orig_reader = reader
8148 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008149 obj.xid = reader.read("!L")[0]
8150 obj.cookie = reader.read("!Q")[0]
8151 obj.cookie_mask = reader.read("!Q")[0]
8152 obj.table_id = reader.read("!B")[0]
8153 __command = util.unpack_fm_cmd(reader)
8154 assert(__command == 0)
8155 obj.idle_timeout = reader.read("!H")[0]
8156 obj.hard_timeout = reader.read("!H")[0]
8157 obj.priority = reader.read("!H")[0]
8158 obj.buffer_id = reader.read("!L")[0]
8159 obj.out_port = util.unpack_port_no(reader)
8160 obj.out_group = reader.read("!L")[0]
8161 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008162 reader.skip(2)
8163 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008164 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008165 return obj
8166
8167 def __eq__(self, other):
8168 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008169 if self.xid != other.xid: return False
8170 if self.cookie != other.cookie: return False
8171 if self.cookie_mask != other.cookie_mask: return False
8172 if self.table_id != other.table_id: return False
8173 if self.idle_timeout != other.idle_timeout: return False
8174 if self.hard_timeout != other.hard_timeout: return False
8175 if self.priority != other.priority: return False
8176 if self.buffer_id != other.buffer_id: return False
8177 if self.out_port != other.out_port: return False
8178 if self.out_group != other.out_group: return False
8179 if self.flags != other.flags: return False
8180 if self.match != other.match: return False
8181 if self.instructions != other.instructions: return False
8182 return True
8183
Rich Lanec2ee4b82013-04-24 17:12:38 -07008184 def pretty_print(self, q):
8185 q.text("flow_add {")
8186 with q.group():
8187 with q.indent(2):
8188 q.breakable()
8189 q.text("xid = ");
8190 if self.xid != None:
8191 q.text("%#x" % self.xid)
8192 else:
8193 q.text('None')
8194 q.text(","); q.breakable()
8195 q.text("cookie = ");
8196 q.text("%#x" % self.cookie)
8197 q.text(","); q.breakable()
8198 q.text("cookie_mask = ");
8199 q.text("%#x" % self.cookie_mask)
8200 q.text(","); q.breakable()
8201 q.text("table_id = ");
8202 q.text("%#x" % self.table_id)
8203 q.text(","); q.breakable()
8204 q.text("idle_timeout = ");
8205 q.text("%#x" % self.idle_timeout)
8206 q.text(","); q.breakable()
8207 q.text("hard_timeout = ");
8208 q.text("%#x" % self.hard_timeout)
8209 q.text(","); q.breakable()
8210 q.text("priority = ");
8211 q.text("%#x" % self.priority)
8212 q.text(","); q.breakable()
8213 q.text("buffer_id = ");
8214 q.text("%#x" % self.buffer_id)
8215 q.text(","); q.breakable()
8216 q.text("out_port = ");
8217 q.text(util.pretty_port(self.out_port))
8218 q.text(","); q.breakable()
8219 q.text("out_group = ");
8220 q.text("%#x" % self.out_group)
8221 q.text(","); q.breakable()
8222 q.text("flags = ");
8223 q.text("%#x" % self.flags)
8224 q.text(","); q.breakable()
8225 q.text("match = ");
8226 q.pp(self.match)
8227 q.text(","); q.breakable()
8228 q.text("instructions = ");
8229 q.pp(self.instructions)
8230 q.breakable()
8231 q.text('}')
8232
Rich Lane7dcdf022013-12-11 14:45:27 -08008233flow_mod.subtypes[0] = flow_add
8234
8235class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008236 version = 4
8237 type = 14
8238 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07008239
8240 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 -08008241 if xid != None:
8242 self.xid = xid
8243 else:
8244 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008245 if cookie != None:
8246 self.cookie = cookie
8247 else:
8248 self.cookie = 0
8249 if cookie_mask != None:
8250 self.cookie_mask = cookie_mask
8251 else:
8252 self.cookie_mask = 0
8253 if table_id != None:
8254 self.table_id = table_id
8255 else:
8256 self.table_id = 0
8257 if idle_timeout != None:
8258 self.idle_timeout = idle_timeout
8259 else:
8260 self.idle_timeout = 0
8261 if hard_timeout != None:
8262 self.hard_timeout = hard_timeout
8263 else:
8264 self.hard_timeout = 0
8265 if priority != None:
8266 self.priority = priority
8267 else:
8268 self.priority = 0
8269 if buffer_id != None:
8270 self.buffer_id = buffer_id
8271 else:
8272 self.buffer_id = 0
8273 if out_port != None:
8274 self.out_port = out_port
8275 else:
8276 self.out_port = 0
8277 if out_group != None:
8278 self.out_group = out_group
8279 else:
8280 self.out_group = 0
8281 if flags != None:
8282 self.flags = flags
8283 else:
8284 self.flags = 0
8285 if match != None:
8286 self.match = match
8287 else:
8288 self.match = common.match()
8289 if instructions != None:
8290 self.instructions = instructions
8291 else:
8292 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008293 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008294
8295 def pack(self):
8296 packed = []
8297 packed.append(struct.pack("!B", self.version))
8298 packed.append(struct.pack("!B", self.type))
8299 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8300 packed.append(struct.pack("!L", self.xid))
8301 packed.append(struct.pack("!Q", self.cookie))
8302 packed.append(struct.pack("!Q", self.cookie_mask))
8303 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008304 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008305 packed.append(struct.pack("!H", self.idle_timeout))
8306 packed.append(struct.pack("!H", self.hard_timeout))
8307 packed.append(struct.pack("!H", self.priority))
8308 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008309 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008310 packed.append(struct.pack("!L", self.out_group))
8311 packed.append(struct.pack("!H", self.flags))
8312 packed.append('\x00' * 2)
8313 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008314 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008315 length = sum([len(x) for x in packed])
8316 packed[2] = struct.pack("!H", length)
8317 return ''.join(packed)
8318
8319 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008320 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008321 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07008322 _version = reader.read("!B")[0]
8323 assert(_version == 4)
8324 _type = reader.read("!B")[0]
8325 assert(_type == 14)
8326 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008327 orig_reader = reader
8328 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008329 obj.xid = reader.read("!L")[0]
8330 obj.cookie = reader.read("!Q")[0]
8331 obj.cookie_mask = reader.read("!Q")[0]
8332 obj.table_id = reader.read("!B")[0]
8333 __command = util.unpack_fm_cmd(reader)
8334 assert(__command == 3)
8335 obj.idle_timeout = reader.read("!H")[0]
8336 obj.hard_timeout = reader.read("!H")[0]
8337 obj.priority = reader.read("!H")[0]
8338 obj.buffer_id = reader.read("!L")[0]
8339 obj.out_port = util.unpack_port_no(reader)
8340 obj.out_group = reader.read("!L")[0]
8341 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008342 reader.skip(2)
8343 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008344 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008345 return obj
8346
8347 def __eq__(self, other):
8348 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008349 if self.xid != other.xid: return False
8350 if self.cookie != other.cookie: return False
8351 if self.cookie_mask != other.cookie_mask: return False
8352 if self.table_id != other.table_id: return False
8353 if self.idle_timeout != other.idle_timeout: return False
8354 if self.hard_timeout != other.hard_timeout: return False
8355 if self.priority != other.priority: return False
8356 if self.buffer_id != other.buffer_id: return False
8357 if self.out_port != other.out_port: return False
8358 if self.out_group != other.out_group: return False
8359 if self.flags != other.flags: return False
8360 if self.match != other.match: return False
8361 if self.instructions != other.instructions: return False
8362 return True
8363
Rich Lanec2ee4b82013-04-24 17:12:38 -07008364 def pretty_print(self, q):
8365 q.text("flow_delete {")
8366 with q.group():
8367 with q.indent(2):
8368 q.breakable()
8369 q.text("xid = ");
8370 if self.xid != None:
8371 q.text("%#x" % self.xid)
8372 else:
8373 q.text('None')
8374 q.text(","); q.breakable()
8375 q.text("cookie = ");
8376 q.text("%#x" % self.cookie)
8377 q.text(","); q.breakable()
8378 q.text("cookie_mask = ");
8379 q.text("%#x" % self.cookie_mask)
8380 q.text(","); q.breakable()
8381 q.text("table_id = ");
8382 q.text("%#x" % self.table_id)
8383 q.text(","); q.breakable()
8384 q.text("idle_timeout = ");
8385 q.text("%#x" % self.idle_timeout)
8386 q.text(","); q.breakable()
8387 q.text("hard_timeout = ");
8388 q.text("%#x" % self.hard_timeout)
8389 q.text(","); q.breakable()
8390 q.text("priority = ");
8391 q.text("%#x" % self.priority)
8392 q.text(","); q.breakable()
8393 q.text("buffer_id = ");
8394 q.text("%#x" % self.buffer_id)
8395 q.text(","); q.breakable()
8396 q.text("out_port = ");
8397 q.text(util.pretty_port(self.out_port))
8398 q.text(","); q.breakable()
8399 q.text("out_group = ");
8400 q.text("%#x" % self.out_group)
8401 q.text(","); q.breakable()
8402 q.text("flags = ");
8403 q.text("%#x" % self.flags)
8404 q.text(","); q.breakable()
8405 q.text("match = ");
8406 q.pp(self.match)
8407 q.text(","); q.breakable()
8408 q.text("instructions = ");
8409 q.pp(self.instructions)
8410 q.breakable()
8411 q.text('}')
8412
Rich Lane7dcdf022013-12-11 14:45:27 -08008413flow_mod.subtypes[3] = flow_delete
8414
8415class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008416 version = 4
8417 type = 14
8418 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07008419
8420 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 -08008421 if xid != None:
8422 self.xid = xid
8423 else:
8424 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008425 if cookie != None:
8426 self.cookie = cookie
8427 else:
8428 self.cookie = 0
8429 if cookie_mask != None:
8430 self.cookie_mask = cookie_mask
8431 else:
8432 self.cookie_mask = 0
8433 if table_id != None:
8434 self.table_id = table_id
8435 else:
8436 self.table_id = 0
8437 if idle_timeout != None:
8438 self.idle_timeout = idle_timeout
8439 else:
8440 self.idle_timeout = 0
8441 if hard_timeout != None:
8442 self.hard_timeout = hard_timeout
8443 else:
8444 self.hard_timeout = 0
8445 if priority != None:
8446 self.priority = priority
8447 else:
8448 self.priority = 0
8449 if buffer_id != None:
8450 self.buffer_id = buffer_id
8451 else:
8452 self.buffer_id = 0
8453 if out_port != None:
8454 self.out_port = out_port
8455 else:
8456 self.out_port = 0
8457 if out_group != None:
8458 self.out_group = out_group
8459 else:
8460 self.out_group = 0
8461 if flags != None:
8462 self.flags = flags
8463 else:
8464 self.flags = 0
8465 if match != None:
8466 self.match = match
8467 else:
8468 self.match = common.match()
8469 if instructions != None:
8470 self.instructions = instructions
8471 else:
8472 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008473 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008474
8475 def pack(self):
8476 packed = []
8477 packed.append(struct.pack("!B", self.version))
8478 packed.append(struct.pack("!B", self.type))
8479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8480 packed.append(struct.pack("!L", self.xid))
8481 packed.append(struct.pack("!Q", self.cookie))
8482 packed.append(struct.pack("!Q", self.cookie_mask))
8483 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008484 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008485 packed.append(struct.pack("!H", self.idle_timeout))
8486 packed.append(struct.pack("!H", self.hard_timeout))
8487 packed.append(struct.pack("!H", self.priority))
8488 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008489 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008490 packed.append(struct.pack("!L", self.out_group))
8491 packed.append(struct.pack("!H", self.flags))
8492 packed.append('\x00' * 2)
8493 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008494 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008495 length = sum([len(x) for x in packed])
8496 packed[2] = struct.pack("!H", length)
8497 return ''.join(packed)
8498
8499 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008500 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008501 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07008502 _version = reader.read("!B")[0]
8503 assert(_version == 4)
8504 _type = reader.read("!B")[0]
8505 assert(_type == 14)
8506 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008507 orig_reader = reader
8508 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008509 obj.xid = reader.read("!L")[0]
8510 obj.cookie = reader.read("!Q")[0]
8511 obj.cookie_mask = reader.read("!Q")[0]
8512 obj.table_id = reader.read("!B")[0]
8513 __command = util.unpack_fm_cmd(reader)
8514 assert(__command == 4)
8515 obj.idle_timeout = reader.read("!H")[0]
8516 obj.hard_timeout = reader.read("!H")[0]
8517 obj.priority = reader.read("!H")[0]
8518 obj.buffer_id = reader.read("!L")[0]
8519 obj.out_port = util.unpack_port_no(reader)
8520 obj.out_group = reader.read("!L")[0]
8521 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008522 reader.skip(2)
8523 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008524 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008525 return obj
8526
8527 def __eq__(self, other):
8528 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008529 if self.xid != other.xid: return False
8530 if self.cookie != other.cookie: return False
8531 if self.cookie_mask != other.cookie_mask: return False
8532 if self.table_id != other.table_id: return False
8533 if self.idle_timeout != other.idle_timeout: return False
8534 if self.hard_timeout != other.hard_timeout: return False
8535 if self.priority != other.priority: return False
8536 if self.buffer_id != other.buffer_id: return False
8537 if self.out_port != other.out_port: return False
8538 if self.out_group != other.out_group: return False
8539 if self.flags != other.flags: return False
8540 if self.match != other.match: return False
8541 if self.instructions != other.instructions: return False
8542 return True
8543
Rich Lanec2ee4b82013-04-24 17:12:38 -07008544 def pretty_print(self, q):
8545 q.text("flow_delete_strict {")
8546 with q.group():
8547 with q.indent(2):
8548 q.breakable()
8549 q.text("xid = ");
8550 if self.xid != None:
8551 q.text("%#x" % self.xid)
8552 else:
8553 q.text('None')
8554 q.text(","); q.breakable()
8555 q.text("cookie = ");
8556 q.text("%#x" % self.cookie)
8557 q.text(","); q.breakable()
8558 q.text("cookie_mask = ");
8559 q.text("%#x" % self.cookie_mask)
8560 q.text(","); q.breakable()
8561 q.text("table_id = ");
8562 q.text("%#x" % self.table_id)
8563 q.text(","); q.breakable()
8564 q.text("idle_timeout = ");
8565 q.text("%#x" % self.idle_timeout)
8566 q.text(","); q.breakable()
8567 q.text("hard_timeout = ");
8568 q.text("%#x" % self.hard_timeout)
8569 q.text(","); q.breakable()
8570 q.text("priority = ");
8571 q.text("%#x" % self.priority)
8572 q.text(","); q.breakable()
8573 q.text("buffer_id = ");
8574 q.text("%#x" % self.buffer_id)
8575 q.text(","); q.breakable()
8576 q.text("out_port = ");
8577 q.text(util.pretty_port(self.out_port))
8578 q.text(","); q.breakable()
8579 q.text("out_group = ");
8580 q.text("%#x" % self.out_group)
8581 q.text(","); q.breakable()
8582 q.text("flags = ");
8583 q.text("%#x" % self.flags)
8584 q.text(","); q.breakable()
8585 q.text("match = ");
8586 q.pp(self.match)
8587 q.text(","); q.breakable()
8588 q.text("instructions = ");
8589 q.pp(self.instructions)
8590 q.breakable()
8591 q.text('}')
8592
Rich Lane7dcdf022013-12-11 14:45:27 -08008593flow_mod.subtypes[4] = flow_delete_strict
8594
8595class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07008596 version = 4
8597 type = 1
8598 err_type = 5
8599
8600 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008601 if xid != None:
8602 self.xid = xid
8603 else:
8604 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008605 if code != None:
8606 self.code = code
8607 else:
8608 self.code = 0
8609 if data != None:
8610 self.data = data
8611 else:
8612 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008613 return
Rich Lane6f4978c2013-10-20 21:33:52 -07008614
8615 def pack(self):
8616 packed = []
8617 packed.append(struct.pack("!B", self.version))
8618 packed.append(struct.pack("!B", self.type))
8619 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8620 packed.append(struct.pack("!L", self.xid))
8621 packed.append(struct.pack("!H", self.err_type))
8622 packed.append(struct.pack("!H", self.code))
8623 packed.append(self.data)
8624 length = sum([len(x) for x in packed])
8625 packed[2] = struct.pack("!H", length)
8626 return ''.join(packed)
8627
8628 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008629 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07008630 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07008631 _version = reader.read("!B")[0]
8632 assert(_version == 4)
8633 _type = reader.read("!B")[0]
8634 assert(_type == 1)
8635 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008636 orig_reader = reader
8637 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07008638 obj.xid = reader.read("!L")[0]
8639 _err_type = reader.read("!H")[0]
8640 assert(_err_type == 5)
8641 obj.code = reader.read("!H")[0]
8642 obj.data = str(reader.read_all())
8643 return obj
8644
8645 def __eq__(self, other):
8646 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07008647 if self.xid != other.xid: return False
8648 if self.code != other.code: return False
8649 if self.data != other.data: return False
8650 return True
8651
Rich Lane6f4978c2013-10-20 21:33:52 -07008652 def pretty_print(self, q):
8653 q.text("flow_mod_failed_error_msg {")
8654 with q.group():
8655 with q.indent(2):
8656 q.breakable()
8657 q.text("xid = ");
8658 if self.xid != None:
8659 q.text("%#x" % self.xid)
8660 else:
8661 q.text('None')
8662 q.text(","); q.breakable()
8663 q.text("code = ");
8664 q.text("%#x" % self.code)
8665 q.text(","); q.breakable()
8666 q.text("data = ");
8667 q.pp(self.data)
8668 q.breakable()
8669 q.text('}')
8670
Rich Lane7dcdf022013-12-11 14:45:27 -08008671error_msg.subtypes[5] = flow_mod_failed_error_msg
8672
8673class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008674 version = 4
8675 type = 14
8676 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07008677
8678 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 -08008679 if xid != None:
8680 self.xid = xid
8681 else:
8682 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008683 if cookie != None:
8684 self.cookie = cookie
8685 else:
8686 self.cookie = 0
8687 if cookie_mask != None:
8688 self.cookie_mask = cookie_mask
8689 else:
8690 self.cookie_mask = 0
8691 if table_id != None:
8692 self.table_id = table_id
8693 else:
8694 self.table_id = 0
8695 if idle_timeout != None:
8696 self.idle_timeout = idle_timeout
8697 else:
8698 self.idle_timeout = 0
8699 if hard_timeout != None:
8700 self.hard_timeout = hard_timeout
8701 else:
8702 self.hard_timeout = 0
8703 if priority != None:
8704 self.priority = priority
8705 else:
8706 self.priority = 0
8707 if buffer_id != None:
8708 self.buffer_id = buffer_id
8709 else:
8710 self.buffer_id = 0
8711 if out_port != None:
8712 self.out_port = out_port
8713 else:
8714 self.out_port = 0
8715 if out_group != None:
8716 self.out_group = out_group
8717 else:
8718 self.out_group = 0
8719 if flags != None:
8720 self.flags = flags
8721 else:
8722 self.flags = 0
8723 if match != None:
8724 self.match = match
8725 else:
8726 self.match = common.match()
8727 if instructions != None:
8728 self.instructions = instructions
8729 else:
8730 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008731 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008732
8733 def pack(self):
8734 packed = []
8735 packed.append(struct.pack("!B", self.version))
8736 packed.append(struct.pack("!B", self.type))
8737 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8738 packed.append(struct.pack("!L", self.xid))
8739 packed.append(struct.pack("!Q", self.cookie))
8740 packed.append(struct.pack("!Q", self.cookie_mask))
8741 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008742 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008743 packed.append(struct.pack("!H", self.idle_timeout))
8744 packed.append(struct.pack("!H", self.hard_timeout))
8745 packed.append(struct.pack("!H", self.priority))
8746 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008747 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008748 packed.append(struct.pack("!L", self.out_group))
8749 packed.append(struct.pack("!H", self.flags))
8750 packed.append('\x00' * 2)
8751 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008752 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008753 length = sum([len(x) for x in packed])
8754 packed[2] = struct.pack("!H", length)
8755 return ''.join(packed)
8756
8757 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008758 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008759 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07008760 _version = reader.read("!B")[0]
8761 assert(_version == 4)
8762 _type = reader.read("!B")[0]
8763 assert(_type == 14)
8764 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008765 orig_reader = reader
8766 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008767 obj.xid = reader.read("!L")[0]
8768 obj.cookie = reader.read("!Q")[0]
8769 obj.cookie_mask = reader.read("!Q")[0]
8770 obj.table_id = reader.read("!B")[0]
8771 __command = util.unpack_fm_cmd(reader)
8772 assert(__command == 1)
8773 obj.idle_timeout = reader.read("!H")[0]
8774 obj.hard_timeout = reader.read("!H")[0]
8775 obj.priority = reader.read("!H")[0]
8776 obj.buffer_id = reader.read("!L")[0]
8777 obj.out_port = util.unpack_port_no(reader)
8778 obj.out_group = reader.read("!L")[0]
8779 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008780 reader.skip(2)
8781 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008782 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008783 return obj
8784
8785 def __eq__(self, other):
8786 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008787 if self.xid != other.xid: return False
8788 if self.cookie != other.cookie: return False
8789 if self.cookie_mask != other.cookie_mask: return False
8790 if self.table_id != other.table_id: return False
8791 if self.idle_timeout != other.idle_timeout: return False
8792 if self.hard_timeout != other.hard_timeout: return False
8793 if self.priority != other.priority: return False
8794 if self.buffer_id != other.buffer_id: return False
8795 if self.out_port != other.out_port: return False
8796 if self.out_group != other.out_group: return False
8797 if self.flags != other.flags: return False
8798 if self.match != other.match: return False
8799 if self.instructions != other.instructions: return False
8800 return True
8801
Rich Lanec2ee4b82013-04-24 17:12:38 -07008802 def pretty_print(self, q):
8803 q.text("flow_modify {")
8804 with q.group():
8805 with q.indent(2):
8806 q.breakable()
8807 q.text("xid = ");
8808 if self.xid != None:
8809 q.text("%#x" % self.xid)
8810 else:
8811 q.text('None')
8812 q.text(","); q.breakable()
8813 q.text("cookie = ");
8814 q.text("%#x" % self.cookie)
8815 q.text(","); q.breakable()
8816 q.text("cookie_mask = ");
8817 q.text("%#x" % self.cookie_mask)
8818 q.text(","); q.breakable()
8819 q.text("table_id = ");
8820 q.text("%#x" % self.table_id)
8821 q.text(","); q.breakable()
8822 q.text("idle_timeout = ");
8823 q.text("%#x" % self.idle_timeout)
8824 q.text(","); q.breakable()
8825 q.text("hard_timeout = ");
8826 q.text("%#x" % self.hard_timeout)
8827 q.text(","); q.breakable()
8828 q.text("priority = ");
8829 q.text("%#x" % self.priority)
8830 q.text(","); q.breakable()
8831 q.text("buffer_id = ");
8832 q.text("%#x" % self.buffer_id)
8833 q.text(","); q.breakable()
8834 q.text("out_port = ");
8835 q.text(util.pretty_port(self.out_port))
8836 q.text(","); q.breakable()
8837 q.text("out_group = ");
8838 q.text("%#x" % self.out_group)
8839 q.text(","); q.breakable()
8840 q.text("flags = ");
8841 q.text("%#x" % self.flags)
8842 q.text(","); q.breakable()
8843 q.text("match = ");
8844 q.pp(self.match)
8845 q.text(","); q.breakable()
8846 q.text("instructions = ");
8847 q.pp(self.instructions)
8848 q.breakable()
8849 q.text('}')
8850
Rich Lane7dcdf022013-12-11 14:45:27 -08008851flow_mod.subtypes[1] = flow_modify
8852
8853class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07008854 version = 4
8855 type = 14
8856 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07008857
8858 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 -08008859 if xid != None:
8860 self.xid = xid
8861 else:
8862 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008863 if cookie != None:
8864 self.cookie = cookie
8865 else:
8866 self.cookie = 0
8867 if cookie_mask != None:
8868 self.cookie_mask = cookie_mask
8869 else:
8870 self.cookie_mask = 0
8871 if table_id != None:
8872 self.table_id = table_id
8873 else:
8874 self.table_id = 0
8875 if idle_timeout != None:
8876 self.idle_timeout = idle_timeout
8877 else:
8878 self.idle_timeout = 0
8879 if hard_timeout != None:
8880 self.hard_timeout = hard_timeout
8881 else:
8882 self.hard_timeout = 0
8883 if priority != None:
8884 self.priority = priority
8885 else:
8886 self.priority = 0
8887 if buffer_id != None:
8888 self.buffer_id = buffer_id
8889 else:
8890 self.buffer_id = 0
8891 if out_port != None:
8892 self.out_port = out_port
8893 else:
8894 self.out_port = 0
8895 if out_group != None:
8896 self.out_group = out_group
8897 else:
8898 self.out_group = 0
8899 if flags != None:
8900 self.flags = flags
8901 else:
8902 self.flags = 0
8903 if match != None:
8904 self.match = match
8905 else:
8906 self.match = common.match()
8907 if instructions != None:
8908 self.instructions = instructions
8909 else:
8910 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008911 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008912
8913 def pack(self):
8914 packed = []
8915 packed.append(struct.pack("!B", self.version))
8916 packed.append(struct.pack("!B", self.type))
8917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8918 packed.append(struct.pack("!L", self.xid))
8919 packed.append(struct.pack("!Q", self.cookie))
8920 packed.append(struct.pack("!Q", self.cookie_mask))
8921 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008922 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008923 packed.append(struct.pack("!H", self.idle_timeout))
8924 packed.append(struct.pack("!H", self.hard_timeout))
8925 packed.append(struct.pack("!H", self.priority))
8926 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008927 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008928 packed.append(struct.pack("!L", self.out_group))
8929 packed.append(struct.pack("!H", self.flags))
8930 packed.append('\x00' * 2)
8931 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08008932 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008933 length = sum([len(x) for x in packed])
8934 packed[2] = struct.pack("!H", length)
8935 return ''.join(packed)
8936
8937 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008938 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008939 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07008940 _version = reader.read("!B")[0]
8941 assert(_version == 4)
8942 _type = reader.read("!B")[0]
8943 assert(_type == 14)
8944 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008945 orig_reader = reader
8946 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008947 obj.xid = reader.read("!L")[0]
8948 obj.cookie = reader.read("!Q")[0]
8949 obj.cookie_mask = reader.read("!Q")[0]
8950 obj.table_id = reader.read("!B")[0]
8951 __command = util.unpack_fm_cmd(reader)
8952 assert(__command == 2)
8953 obj.idle_timeout = reader.read("!H")[0]
8954 obj.hard_timeout = reader.read("!H")[0]
8955 obj.priority = reader.read("!H")[0]
8956 obj.buffer_id = reader.read("!L")[0]
8957 obj.out_port = util.unpack_port_no(reader)
8958 obj.out_group = reader.read("!L")[0]
8959 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008960 reader.skip(2)
8961 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08008962 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008963 return obj
8964
8965 def __eq__(self, other):
8966 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008967 if self.xid != other.xid: return False
8968 if self.cookie != other.cookie: return False
8969 if self.cookie_mask != other.cookie_mask: return False
8970 if self.table_id != other.table_id: return False
8971 if self.idle_timeout != other.idle_timeout: return False
8972 if self.hard_timeout != other.hard_timeout: return False
8973 if self.priority != other.priority: return False
8974 if self.buffer_id != other.buffer_id: return False
8975 if self.out_port != other.out_port: return False
8976 if self.out_group != other.out_group: return False
8977 if self.flags != other.flags: return False
8978 if self.match != other.match: return False
8979 if self.instructions != other.instructions: return False
8980 return True
8981
Rich Lanec2ee4b82013-04-24 17:12:38 -07008982 def pretty_print(self, q):
8983 q.text("flow_modify_strict {")
8984 with q.group():
8985 with q.indent(2):
8986 q.breakable()
8987 q.text("xid = ");
8988 if self.xid != None:
8989 q.text("%#x" % self.xid)
8990 else:
8991 q.text('None')
8992 q.text(","); q.breakable()
8993 q.text("cookie = ");
8994 q.text("%#x" % self.cookie)
8995 q.text(","); q.breakable()
8996 q.text("cookie_mask = ");
8997 q.text("%#x" % self.cookie_mask)
8998 q.text(","); q.breakable()
8999 q.text("table_id = ");
9000 q.text("%#x" % self.table_id)
9001 q.text(","); q.breakable()
9002 q.text("idle_timeout = ");
9003 q.text("%#x" % self.idle_timeout)
9004 q.text(","); q.breakable()
9005 q.text("hard_timeout = ");
9006 q.text("%#x" % self.hard_timeout)
9007 q.text(","); q.breakable()
9008 q.text("priority = ");
9009 q.text("%#x" % self.priority)
9010 q.text(","); q.breakable()
9011 q.text("buffer_id = ");
9012 q.text("%#x" % self.buffer_id)
9013 q.text(","); q.breakable()
9014 q.text("out_port = ");
9015 q.text(util.pretty_port(self.out_port))
9016 q.text(","); q.breakable()
9017 q.text("out_group = ");
9018 q.text("%#x" % self.out_group)
9019 q.text(","); q.breakable()
9020 q.text("flags = ");
9021 q.text("%#x" % self.flags)
9022 q.text(","); q.breakable()
9023 q.text("match = ");
9024 q.pp(self.match)
9025 q.text(","); q.breakable()
9026 q.text("instructions = ");
9027 q.pp(self.instructions)
9028 q.breakable()
9029 q.text('}')
9030
Rich Lane7dcdf022013-12-11 14:45:27 -08009031flow_mod.subtypes[2] = flow_modify_strict
9032
9033class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009034 version = 4
9035 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07009036
9037 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 -08009038 if xid != None:
9039 self.xid = xid
9040 else:
9041 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009042 if cookie != None:
9043 self.cookie = cookie
9044 else:
9045 self.cookie = 0
9046 if priority != None:
9047 self.priority = priority
9048 else:
9049 self.priority = 0
9050 if reason != None:
9051 self.reason = reason
9052 else:
9053 self.reason = 0
9054 if table_id != None:
9055 self.table_id = table_id
9056 else:
9057 self.table_id = 0
9058 if duration_sec != None:
9059 self.duration_sec = duration_sec
9060 else:
9061 self.duration_sec = 0
9062 if duration_nsec != None:
9063 self.duration_nsec = duration_nsec
9064 else:
9065 self.duration_nsec = 0
9066 if idle_timeout != None:
9067 self.idle_timeout = idle_timeout
9068 else:
9069 self.idle_timeout = 0
9070 if hard_timeout != None:
9071 self.hard_timeout = hard_timeout
9072 else:
9073 self.hard_timeout = 0
9074 if packet_count != None:
9075 self.packet_count = packet_count
9076 else:
9077 self.packet_count = 0
9078 if byte_count != None:
9079 self.byte_count = byte_count
9080 else:
9081 self.byte_count = 0
9082 if match != None:
9083 self.match = match
9084 else:
9085 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009086 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009087
9088 def pack(self):
9089 packed = []
9090 packed.append(struct.pack("!B", self.version))
9091 packed.append(struct.pack("!B", self.type))
9092 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9093 packed.append(struct.pack("!L", self.xid))
9094 packed.append(struct.pack("!Q", self.cookie))
9095 packed.append(struct.pack("!H", self.priority))
9096 packed.append(struct.pack("!B", self.reason))
9097 packed.append(struct.pack("!B", self.table_id))
9098 packed.append(struct.pack("!L", self.duration_sec))
9099 packed.append(struct.pack("!L", self.duration_nsec))
9100 packed.append(struct.pack("!H", self.idle_timeout))
9101 packed.append(struct.pack("!H", self.hard_timeout))
9102 packed.append(struct.pack("!Q", self.packet_count))
9103 packed.append(struct.pack("!Q", self.byte_count))
9104 packed.append(self.match.pack())
9105 length = sum([len(x) for x in packed])
9106 packed[2] = struct.pack("!H", length)
9107 return ''.join(packed)
9108
9109 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009110 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009111 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07009112 _version = reader.read("!B")[0]
9113 assert(_version == 4)
9114 _type = reader.read("!B")[0]
9115 assert(_type == 11)
9116 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009117 orig_reader = reader
9118 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009119 obj.xid = reader.read("!L")[0]
9120 obj.cookie = reader.read("!Q")[0]
9121 obj.priority = reader.read("!H")[0]
9122 obj.reason = reader.read("!B")[0]
9123 obj.table_id = reader.read("!B")[0]
9124 obj.duration_sec = reader.read("!L")[0]
9125 obj.duration_nsec = reader.read("!L")[0]
9126 obj.idle_timeout = reader.read("!H")[0]
9127 obj.hard_timeout = reader.read("!H")[0]
9128 obj.packet_count = reader.read("!Q")[0]
9129 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009130 obj.match = common.match.unpack(reader)
9131 return obj
9132
9133 def __eq__(self, other):
9134 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009135 if self.xid != other.xid: return False
9136 if self.cookie != other.cookie: return False
9137 if self.priority != other.priority: return False
9138 if self.reason != other.reason: return False
9139 if self.table_id != other.table_id: return False
9140 if self.duration_sec != other.duration_sec: return False
9141 if self.duration_nsec != other.duration_nsec: return False
9142 if self.idle_timeout != other.idle_timeout: return False
9143 if self.hard_timeout != other.hard_timeout: return False
9144 if self.packet_count != other.packet_count: return False
9145 if self.byte_count != other.byte_count: return False
9146 if self.match != other.match: return False
9147 return True
9148
Rich Lanec2ee4b82013-04-24 17:12:38 -07009149 def pretty_print(self, q):
9150 q.text("flow_removed {")
9151 with q.group():
9152 with q.indent(2):
9153 q.breakable()
9154 q.text("xid = ");
9155 if self.xid != None:
9156 q.text("%#x" % self.xid)
9157 else:
9158 q.text('None')
9159 q.text(","); q.breakable()
9160 q.text("cookie = ");
9161 q.text("%#x" % self.cookie)
9162 q.text(","); q.breakable()
9163 q.text("priority = ");
9164 q.text("%#x" % self.priority)
9165 q.text(","); q.breakable()
9166 q.text("reason = ");
9167 q.text("%#x" % self.reason)
9168 q.text(","); q.breakable()
9169 q.text("table_id = ");
9170 q.text("%#x" % self.table_id)
9171 q.text(","); q.breakable()
9172 q.text("duration_sec = ");
9173 q.text("%#x" % self.duration_sec)
9174 q.text(","); q.breakable()
9175 q.text("duration_nsec = ");
9176 q.text("%#x" % self.duration_nsec)
9177 q.text(","); q.breakable()
9178 q.text("idle_timeout = ");
9179 q.text("%#x" % self.idle_timeout)
9180 q.text(","); q.breakable()
9181 q.text("hard_timeout = ");
9182 q.text("%#x" % self.hard_timeout)
9183 q.text(","); q.breakable()
9184 q.text("packet_count = ");
9185 q.text("%#x" % self.packet_count)
9186 q.text(","); q.breakable()
9187 q.text("byte_count = ");
9188 q.text("%#x" % self.byte_count)
9189 q.text(","); q.breakable()
9190 q.text("match = ");
9191 q.pp(self.match)
9192 q.breakable()
9193 q.text('}')
9194
Rich Lane7dcdf022013-12-11 14:45:27 -08009195message.subtypes[11] = flow_removed
9196
9197class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009198 version = 4
9199 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009200 stats_type = 1
9201
9202 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009203 if xid != None:
9204 self.xid = xid
9205 else:
9206 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009207 if flags != None:
9208 self.flags = flags
9209 else:
9210 self.flags = 0
9211 if entries != None:
9212 self.entries = entries
9213 else:
9214 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009215 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009216
9217 def pack(self):
9218 packed = []
9219 packed.append(struct.pack("!B", self.version))
9220 packed.append(struct.pack("!B", self.type))
9221 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9222 packed.append(struct.pack("!L", self.xid))
9223 packed.append(struct.pack("!H", self.stats_type))
9224 packed.append(struct.pack("!H", self.flags))
9225 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009226 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009227 length = sum([len(x) for x in packed])
9228 packed[2] = struct.pack("!H", length)
9229 return ''.join(packed)
9230
9231 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009232 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009233 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009234 _version = reader.read("!B")[0]
9235 assert(_version == 4)
9236 _type = reader.read("!B")[0]
9237 assert(_type == 19)
9238 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009239 orig_reader = reader
9240 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009241 obj.xid = reader.read("!L")[0]
9242 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009243 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009244 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009245 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009246 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009247 return obj
9248
9249 def __eq__(self, other):
9250 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009251 if self.xid != other.xid: return False
9252 if self.flags != other.flags: return False
9253 if self.entries != other.entries: return False
9254 return True
9255
Rich Lanec2ee4b82013-04-24 17:12:38 -07009256 def pretty_print(self, q):
9257 q.text("flow_stats_reply {")
9258 with q.group():
9259 with q.indent(2):
9260 q.breakable()
9261 q.text("xid = ");
9262 if self.xid != None:
9263 q.text("%#x" % self.xid)
9264 else:
9265 q.text('None')
9266 q.text(","); q.breakable()
9267 q.text("flags = ");
9268 q.text("%#x" % self.flags)
9269 q.text(","); q.breakable()
9270 q.text("entries = ");
9271 q.pp(self.entries)
9272 q.breakable()
9273 q.text('}')
9274
Rich Lane7dcdf022013-12-11 14:45:27 -08009275stats_reply.subtypes[1] = flow_stats_reply
9276
9277class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009278 version = 4
9279 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009280 stats_type = 1
9281
9282 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 -08009283 if xid != None:
9284 self.xid = xid
9285 else:
9286 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009287 if flags != None:
9288 self.flags = flags
9289 else:
9290 self.flags = 0
9291 if table_id != None:
9292 self.table_id = table_id
9293 else:
9294 self.table_id = 0
9295 if out_port != None:
9296 self.out_port = out_port
9297 else:
9298 self.out_port = 0
9299 if out_group != None:
9300 self.out_group = out_group
9301 else:
9302 self.out_group = 0
9303 if cookie != None:
9304 self.cookie = cookie
9305 else:
9306 self.cookie = 0
9307 if cookie_mask != None:
9308 self.cookie_mask = cookie_mask
9309 else:
9310 self.cookie_mask = 0
9311 if match != None:
9312 self.match = match
9313 else:
9314 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08009315 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009316
9317 def pack(self):
9318 packed = []
9319 packed.append(struct.pack("!B", self.version))
9320 packed.append(struct.pack("!B", self.type))
9321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9322 packed.append(struct.pack("!L", self.xid))
9323 packed.append(struct.pack("!H", self.stats_type))
9324 packed.append(struct.pack("!H", self.flags))
9325 packed.append('\x00' * 4)
9326 packed.append(struct.pack("!B", self.table_id))
9327 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07009328 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009329 packed.append(struct.pack("!L", self.out_group))
9330 packed.append('\x00' * 4)
9331 packed.append(struct.pack("!Q", self.cookie))
9332 packed.append(struct.pack("!Q", self.cookie_mask))
9333 packed.append(self.match.pack())
9334 length = sum([len(x) for x in packed])
9335 packed[2] = struct.pack("!H", length)
9336 return ''.join(packed)
9337
9338 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009339 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009340 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009341 _version = reader.read("!B")[0]
9342 assert(_version == 4)
9343 _type = reader.read("!B")[0]
9344 assert(_type == 18)
9345 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009346 orig_reader = reader
9347 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009348 obj.xid = reader.read("!L")[0]
9349 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009350 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07009351 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009352 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009353 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009354 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07009355 obj.out_port = util.unpack_port_no(reader)
9356 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009357 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009358 obj.cookie = reader.read("!Q")[0]
9359 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009360 obj.match = common.match.unpack(reader)
9361 return obj
9362
9363 def __eq__(self, other):
9364 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009365 if self.xid != other.xid: return False
9366 if self.flags != other.flags: return False
9367 if self.table_id != other.table_id: return False
9368 if self.out_port != other.out_port: return False
9369 if self.out_group != other.out_group: return False
9370 if self.cookie != other.cookie: return False
9371 if self.cookie_mask != other.cookie_mask: return False
9372 if self.match != other.match: return False
9373 return True
9374
Rich Lanec2ee4b82013-04-24 17:12:38 -07009375 def pretty_print(self, q):
9376 q.text("flow_stats_request {")
9377 with q.group():
9378 with q.indent(2):
9379 q.breakable()
9380 q.text("xid = ");
9381 if self.xid != None:
9382 q.text("%#x" % self.xid)
9383 else:
9384 q.text('None')
9385 q.text(","); q.breakable()
9386 q.text("flags = ");
9387 q.text("%#x" % self.flags)
9388 q.text(","); q.breakable()
9389 q.text("table_id = ");
9390 q.text("%#x" % self.table_id)
9391 q.text(","); q.breakable()
9392 q.text("out_port = ");
9393 q.text(util.pretty_port(self.out_port))
9394 q.text(","); q.breakable()
9395 q.text("out_group = ");
9396 q.text("%#x" % self.out_group)
9397 q.text(","); q.breakable()
9398 q.text("cookie = ");
9399 q.text("%#x" % self.cookie)
9400 q.text(","); q.breakable()
9401 q.text("cookie_mask = ");
9402 q.text("%#x" % self.cookie_mask)
9403 q.text(","); q.breakable()
9404 q.text("match = ");
9405 q.pp(self.match)
9406 q.breakable()
9407 q.text('}')
9408
Rich Lane7dcdf022013-12-11 14:45:27 -08009409stats_request.subtypes[1] = flow_stats_request
9410
9411class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009412 version = 4
9413 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07009414
9415 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009416 if xid != None:
9417 self.xid = xid
9418 else:
9419 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009420 if flags != None:
9421 self.flags = flags
9422 else:
9423 self.flags = 0
9424 if miss_send_len != None:
9425 self.miss_send_len = miss_send_len
9426 else:
9427 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009428 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009429
9430 def pack(self):
9431 packed = []
9432 packed.append(struct.pack("!B", self.version))
9433 packed.append(struct.pack("!B", self.type))
9434 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9435 packed.append(struct.pack("!L", self.xid))
9436 packed.append(struct.pack("!H", self.flags))
9437 packed.append(struct.pack("!H", self.miss_send_len))
9438 length = sum([len(x) for x in packed])
9439 packed[2] = struct.pack("!H", length)
9440 return ''.join(packed)
9441
9442 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009443 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009444 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009445 _version = reader.read("!B")[0]
9446 assert(_version == 4)
9447 _type = reader.read("!B")[0]
9448 assert(_type == 8)
9449 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009450 orig_reader = reader
9451 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009452 obj.xid = reader.read("!L")[0]
9453 obj.flags = reader.read("!H")[0]
9454 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009455 return obj
9456
9457 def __eq__(self, other):
9458 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009459 if self.xid != other.xid: return False
9460 if self.flags != other.flags: return False
9461 if self.miss_send_len != other.miss_send_len: return False
9462 return True
9463
Rich Lanec2ee4b82013-04-24 17:12:38 -07009464 def pretty_print(self, q):
9465 q.text("get_config_reply {")
9466 with q.group():
9467 with q.indent(2):
9468 q.breakable()
9469 q.text("xid = ");
9470 if self.xid != None:
9471 q.text("%#x" % self.xid)
9472 else:
9473 q.text('None')
9474 q.text(","); q.breakable()
9475 q.text("flags = ");
9476 q.text("%#x" % self.flags)
9477 q.text(","); q.breakable()
9478 q.text("miss_send_len = ");
9479 q.text("%#x" % self.miss_send_len)
9480 q.breakable()
9481 q.text('}')
9482
Rich Lane7dcdf022013-12-11 14:45:27 -08009483message.subtypes[8] = get_config_reply
9484
9485class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009486 version = 4
9487 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07009488
9489 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009490 if xid != None:
9491 self.xid = xid
9492 else:
9493 self.xid = None
9494 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009495
9496 def pack(self):
9497 packed = []
9498 packed.append(struct.pack("!B", self.version))
9499 packed.append(struct.pack("!B", self.type))
9500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9501 packed.append(struct.pack("!L", self.xid))
9502 length = sum([len(x) for x in packed])
9503 packed[2] = struct.pack("!H", length)
9504 return ''.join(packed)
9505
9506 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009507 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009508 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009509 _version = reader.read("!B")[0]
9510 assert(_version == 4)
9511 _type = reader.read("!B")[0]
9512 assert(_type == 7)
9513 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009514 orig_reader = reader
9515 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009516 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009517 return obj
9518
9519 def __eq__(self, other):
9520 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009521 if self.xid != other.xid: return False
9522 return True
9523
Rich Lanec2ee4b82013-04-24 17:12:38 -07009524 def pretty_print(self, q):
9525 q.text("get_config_request {")
9526 with q.group():
9527 with q.indent(2):
9528 q.breakable()
9529 q.text("xid = ");
9530 if self.xid != None:
9531 q.text("%#x" % self.xid)
9532 else:
9533 q.text('None')
9534 q.breakable()
9535 q.text('}')
9536
Rich Lane7dcdf022013-12-11 14:45:27 -08009537message.subtypes[7] = get_config_request
9538
9539class group_mod(message):
9540 subtypes = {}
9541
Rich Lane95f7fc92014-01-27 17:08:16 -08009542 version = 4
9543 type = 15
9544
9545 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
9546 if xid != None:
9547 self.xid = xid
9548 else:
9549 self.xid = None
9550 if command != None:
9551 self.command = command
9552 else:
9553 self.command = 0
9554 if group_type != None:
9555 self.group_type = group_type
9556 else:
9557 self.group_type = 0
9558 if group_id != None:
9559 self.group_id = group_id
9560 else:
9561 self.group_id = 0
9562 if buckets != None:
9563 self.buckets = buckets
9564 else:
9565 self.buckets = []
9566 return
9567
9568 def pack(self):
9569 packed = []
9570 packed.append(struct.pack("!B", self.version))
9571 packed.append(struct.pack("!B", self.type))
9572 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9573 packed.append(struct.pack("!L", self.xid))
9574 packed.append(struct.pack("!H", self.command))
9575 packed.append(struct.pack("!B", self.group_type))
9576 packed.append('\x00' * 1)
9577 packed.append(struct.pack("!L", self.group_id))
9578 packed.append(loxi.generic_util.pack_list(self.buckets))
9579 length = sum([len(x) for x in packed])
9580 packed[2] = struct.pack("!H", length)
9581 return ''.join(packed)
9582
Rich Lane7dcdf022013-12-11 14:45:27 -08009583 @staticmethod
9584 def unpack(reader):
9585 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08009586 subclass = group_mod.subtypes.get(subtype)
9587 if subclass:
9588 return subclass.unpack(reader)
9589
9590 obj = group_mod()
9591 _version = reader.read("!B")[0]
9592 assert(_version == 4)
9593 _type = reader.read("!B")[0]
9594 assert(_type == 15)
9595 _length = reader.read("!H")[0]
9596 orig_reader = reader
9597 reader = orig_reader.slice(_length - (2 + 2))
9598 obj.xid = reader.read("!L")[0]
9599 obj.command = reader.read("!H")[0]
9600 obj.group_type = reader.read("!B")[0]
9601 reader.skip(1)
9602 obj.group_id = reader.read("!L")[0]
9603 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
9604 return obj
9605
9606 def __eq__(self, other):
9607 if type(self) != type(other): return False
9608 if self.xid != other.xid: return False
9609 if self.command != other.command: return False
9610 if self.group_type != other.group_type: return False
9611 if self.group_id != other.group_id: return False
9612 if self.buckets != other.buckets: return False
9613 return True
9614
9615 def pretty_print(self, q):
9616 q.text("group_mod {")
9617 with q.group():
9618 with q.indent(2):
9619 q.breakable()
9620 q.text("xid = ");
9621 if self.xid != None:
9622 q.text("%#x" % self.xid)
9623 else:
9624 q.text('None')
9625 q.text(","); q.breakable()
9626 q.text("group_type = ");
9627 q.text("%#x" % self.group_type)
9628 q.text(","); q.breakable()
9629 q.text("group_id = ");
9630 q.text("%#x" % self.group_id)
9631 q.text(","); q.breakable()
9632 q.text("buckets = ");
9633 q.pp(self.buckets)
9634 q.breakable()
9635 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009636
9637message.subtypes[15] = group_mod
9638
9639class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08009640 version = 4
9641 type = 15
9642 command = 0
9643
9644 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009645 if xid != None:
9646 self.xid = xid
9647 else:
9648 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08009649 if group_type != None:
9650 self.group_type = group_type
9651 else:
9652 self.group_type = 0
9653 if group_id != None:
9654 self.group_id = group_id
9655 else:
9656 self.group_id = 0
9657 if buckets != None:
9658 self.buckets = buckets
9659 else:
9660 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009661 return
Rich Lane7b0f2012013-11-22 14:15:26 -08009662
9663 def pack(self):
9664 packed = []
9665 packed.append(struct.pack("!B", self.version))
9666 packed.append(struct.pack("!B", self.type))
9667 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9668 packed.append(struct.pack("!L", self.xid))
9669 packed.append(struct.pack("!H", self.command))
9670 packed.append(struct.pack("!B", self.group_type))
9671 packed.append('\x00' * 1)
9672 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08009673 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08009674 length = sum([len(x) for x in packed])
9675 packed[2] = struct.pack("!H", length)
9676 return ''.join(packed)
9677
9678 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009679 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08009680 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -08009681 _version = reader.read("!B")[0]
9682 assert(_version == 4)
9683 _type = reader.read("!B")[0]
9684 assert(_type == 15)
9685 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009686 orig_reader = reader
9687 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08009688 obj.xid = reader.read("!L")[0]
9689 _command = reader.read("!H")[0]
9690 assert(_command == 0)
9691 obj.group_type = reader.read("!B")[0]
9692 reader.skip(1)
9693 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009694 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08009695 return obj
9696
9697 def __eq__(self, other):
9698 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08009699 if self.xid != other.xid: return False
9700 if self.group_type != other.group_type: return False
9701 if self.group_id != other.group_id: return False
9702 if self.buckets != other.buckets: return False
9703 return True
9704
Rich Lane7b0f2012013-11-22 14:15:26 -08009705 def pretty_print(self, q):
9706 q.text("group_add {")
9707 with q.group():
9708 with q.indent(2):
9709 q.breakable()
9710 q.text("xid = ");
9711 if self.xid != None:
9712 q.text("%#x" % self.xid)
9713 else:
9714 q.text('None')
9715 q.text(","); q.breakable()
9716 q.text("group_type = ");
9717 q.text("%#x" % self.group_type)
9718 q.text(","); q.breakable()
9719 q.text("group_id = ");
9720 q.text("%#x" % self.group_id)
9721 q.text(","); q.breakable()
9722 q.text("buckets = ");
9723 q.pp(self.buckets)
9724 q.breakable()
9725 q.text('}')
9726
Rich Lane7dcdf022013-12-11 14:45:27 -08009727group_mod.subtypes[0] = group_add
9728
9729class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08009730 version = 4
9731 type = 15
9732 command = 2
9733
9734 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009735 if xid != None:
9736 self.xid = xid
9737 else:
9738 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08009739 if group_type != None:
9740 self.group_type = group_type
9741 else:
9742 self.group_type = 0
9743 if group_id != None:
9744 self.group_id = group_id
9745 else:
9746 self.group_id = 0
9747 if buckets != None:
9748 self.buckets = buckets
9749 else:
9750 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009751 return
Rich Lane7b0f2012013-11-22 14:15:26 -08009752
9753 def pack(self):
9754 packed = []
9755 packed.append(struct.pack("!B", self.version))
9756 packed.append(struct.pack("!B", self.type))
9757 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9758 packed.append(struct.pack("!L", self.xid))
9759 packed.append(struct.pack("!H", self.command))
9760 packed.append(struct.pack("!B", self.group_type))
9761 packed.append('\x00' * 1)
9762 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08009763 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08009764 length = sum([len(x) for x in packed])
9765 packed[2] = struct.pack("!H", length)
9766 return ''.join(packed)
9767
9768 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009769 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08009770 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -08009771 _version = reader.read("!B")[0]
9772 assert(_version == 4)
9773 _type = reader.read("!B")[0]
9774 assert(_type == 15)
9775 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009776 orig_reader = reader
9777 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08009778 obj.xid = reader.read("!L")[0]
9779 _command = reader.read("!H")[0]
9780 assert(_command == 2)
9781 obj.group_type = reader.read("!B")[0]
9782 reader.skip(1)
9783 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009784 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08009785 return obj
9786
9787 def __eq__(self, other):
9788 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08009789 if self.xid != other.xid: return False
9790 if self.group_type != other.group_type: return False
9791 if self.group_id != other.group_id: return False
9792 if self.buckets != other.buckets: return False
9793 return True
9794
Rich Lane7b0f2012013-11-22 14:15:26 -08009795 def pretty_print(self, q):
9796 q.text("group_delete {")
9797 with q.group():
9798 with q.indent(2):
9799 q.breakable()
9800 q.text("xid = ");
9801 if self.xid != None:
9802 q.text("%#x" % self.xid)
9803 else:
9804 q.text('None')
9805 q.text(","); q.breakable()
9806 q.text("group_type = ");
9807 q.text("%#x" % self.group_type)
9808 q.text(","); q.breakable()
9809 q.text("group_id = ");
9810 q.text("%#x" % self.group_id)
9811 q.text(","); q.breakable()
9812 q.text("buckets = ");
9813 q.pp(self.buckets)
9814 q.breakable()
9815 q.text('}')
9816
Rich Lane7dcdf022013-12-11 14:45:27 -08009817group_mod.subtypes[2] = group_delete
9818
9819class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009820 version = 4
9821 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009822 stats_type = 7
9823
9824 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009825 if xid != None:
9826 self.xid = xid
9827 else:
9828 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009829 if flags != None:
9830 self.flags = flags
9831 else:
9832 self.flags = 0
9833 if entries != None:
9834 self.entries = entries
9835 else:
9836 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009837 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009838
9839 def pack(self):
9840 packed = []
9841 packed.append(struct.pack("!B", self.version))
9842 packed.append(struct.pack("!B", self.type))
9843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9844 packed.append(struct.pack("!L", self.xid))
9845 packed.append(struct.pack("!H", self.stats_type))
9846 packed.append(struct.pack("!H", self.flags))
9847 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009848 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009849 length = sum([len(x) for x in packed])
9850 packed[2] = struct.pack("!H", length)
9851 return ''.join(packed)
9852
9853 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009854 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009855 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009856 _version = reader.read("!B")[0]
9857 assert(_version == 4)
9858 _type = reader.read("!B")[0]
9859 assert(_type == 19)
9860 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009861 orig_reader = reader
9862 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009863 obj.xid = reader.read("!L")[0]
9864 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009865 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07009866 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009867 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009868 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009869 return obj
9870
9871 def __eq__(self, other):
9872 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009873 if self.xid != other.xid: return False
9874 if self.flags != other.flags: return False
9875 if self.entries != other.entries: return False
9876 return True
9877
Rich Lanec2ee4b82013-04-24 17:12:38 -07009878 def pretty_print(self, q):
9879 q.text("group_desc_stats_reply {")
9880 with q.group():
9881 with q.indent(2):
9882 q.breakable()
9883 q.text("xid = ");
9884 if self.xid != None:
9885 q.text("%#x" % self.xid)
9886 else:
9887 q.text('None')
9888 q.text(","); q.breakable()
9889 q.text("flags = ");
9890 q.text("%#x" % self.flags)
9891 q.text(","); q.breakable()
9892 q.text("entries = ");
9893 q.pp(self.entries)
9894 q.breakable()
9895 q.text('}')
9896
Rich Lane7dcdf022013-12-11 14:45:27 -08009897stats_reply.subtypes[7] = group_desc_stats_reply
9898
9899class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009900 version = 4
9901 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009902 stats_type = 7
9903
9904 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009905 if xid != None:
9906 self.xid = xid
9907 else:
9908 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009909 if flags != None:
9910 self.flags = flags
9911 else:
9912 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009913 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009914
9915 def pack(self):
9916 packed = []
9917 packed.append(struct.pack("!B", self.version))
9918 packed.append(struct.pack("!B", self.type))
9919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9920 packed.append(struct.pack("!L", self.xid))
9921 packed.append(struct.pack("!H", self.stats_type))
9922 packed.append(struct.pack("!H", self.flags))
9923 packed.append('\x00' * 4)
9924 length = sum([len(x) for x in packed])
9925 packed[2] = struct.pack("!H", length)
9926 return ''.join(packed)
9927
9928 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009929 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009930 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009931 _version = reader.read("!B")[0]
9932 assert(_version == 4)
9933 _type = reader.read("!B")[0]
9934 assert(_type == 18)
9935 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009936 orig_reader = reader
9937 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009938 obj.xid = reader.read("!L")[0]
9939 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009940 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07009941 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009942 reader.skip(4)
9943 return obj
9944
9945 def __eq__(self, other):
9946 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009947 if self.xid != other.xid: return False
9948 if self.flags != other.flags: return False
9949 return True
9950
Rich Lanec2ee4b82013-04-24 17:12:38 -07009951 def pretty_print(self, q):
9952 q.text("group_desc_stats_request {")
9953 with q.group():
9954 with q.indent(2):
9955 q.breakable()
9956 q.text("xid = ");
9957 if self.xid != None:
9958 q.text("%#x" % self.xid)
9959 else:
9960 q.text('None')
9961 q.text(","); q.breakable()
9962 q.text("flags = ");
9963 q.text("%#x" % self.flags)
9964 q.breakable()
9965 q.text('}')
9966
Rich Lane7dcdf022013-12-11 14:45:27 -08009967stats_request.subtypes[7] = group_desc_stats_request
9968
9969class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009970 version = 4
9971 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009972 stats_type = 8
9973
9974 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 -08009975 if xid != None:
9976 self.xid = xid
9977 else:
9978 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009979 if flags != None:
9980 self.flags = flags
9981 else:
9982 self.flags = 0
9983 if types != None:
9984 self.types = types
9985 else:
9986 self.types = 0
9987 if capabilities != None:
9988 self.capabilities = capabilities
9989 else:
9990 self.capabilities = 0
9991 if max_groups_all != None:
9992 self.max_groups_all = max_groups_all
9993 else:
9994 self.max_groups_all = 0
9995 if max_groups_select != None:
9996 self.max_groups_select = max_groups_select
9997 else:
9998 self.max_groups_select = 0
9999 if max_groups_indirect != None:
10000 self.max_groups_indirect = max_groups_indirect
10001 else:
10002 self.max_groups_indirect = 0
10003 if max_groups_ff != None:
10004 self.max_groups_ff = max_groups_ff
10005 else:
10006 self.max_groups_ff = 0
10007 if actions_all != None:
10008 self.actions_all = actions_all
10009 else:
10010 self.actions_all = 0
10011 if actions_select != None:
10012 self.actions_select = actions_select
10013 else:
10014 self.actions_select = 0
10015 if actions_indirect != None:
10016 self.actions_indirect = actions_indirect
10017 else:
10018 self.actions_indirect = 0
10019 if actions_ff != None:
10020 self.actions_ff = actions_ff
10021 else:
10022 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010023 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010024
10025 def pack(self):
10026 packed = []
10027 packed.append(struct.pack("!B", self.version))
10028 packed.append(struct.pack("!B", self.type))
10029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10030 packed.append(struct.pack("!L", self.xid))
10031 packed.append(struct.pack("!H", self.stats_type))
10032 packed.append(struct.pack("!H", self.flags))
10033 packed.append('\x00' * 4)
10034 packed.append(struct.pack("!L", self.types))
10035 packed.append(struct.pack("!L", self.capabilities))
10036 packed.append(struct.pack("!L", self.max_groups_all))
10037 packed.append(struct.pack("!L", self.max_groups_select))
10038 packed.append(struct.pack("!L", self.max_groups_indirect))
10039 packed.append(struct.pack("!L", self.max_groups_ff))
10040 packed.append(struct.pack("!L", self.actions_all))
10041 packed.append(struct.pack("!L", self.actions_select))
10042 packed.append(struct.pack("!L", self.actions_indirect))
10043 packed.append(struct.pack("!L", self.actions_ff))
10044 length = sum([len(x) for x in packed])
10045 packed[2] = struct.pack("!H", length)
10046 return ''.join(packed)
10047
10048 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010049 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010050 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010051 _version = reader.read("!B")[0]
10052 assert(_version == 4)
10053 _type = reader.read("!B")[0]
10054 assert(_type == 19)
10055 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010056 orig_reader = reader
10057 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010058 obj.xid = reader.read("!L")[0]
10059 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010060 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070010061 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010062 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010063 obj.types = reader.read("!L")[0]
10064 obj.capabilities = reader.read("!L")[0]
10065 obj.max_groups_all = reader.read("!L")[0]
10066 obj.max_groups_select = reader.read("!L")[0]
10067 obj.max_groups_indirect = reader.read("!L")[0]
10068 obj.max_groups_ff = reader.read("!L")[0]
10069 obj.actions_all = reader.read("!L")[0]
10070 obj.actions_select = reader.read("!L")[0]
10071 obj.actions_indirect = reader.read("!L")[0]
10072 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010073 return obj
10074
10075 def __eq__(self, other):
10076 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010077 if self.xid != other.xid: return False
10078 if self.flags != other.flags: return False
10079 if self.types != other.types: return False
10080 if self.capabilities != other.capabilities: return False
10081 if self.max_groups_all != other.max_groups_all: return False
10082 if self.max_groups_select != other.max_groups_select: return False
10083 if self.max_groups_indirect != other.max_groups_indirect: return False
10084 if self.max_groups_ff != other.max_groups_ff: return False
10085 if self.actions_all != other.actions_all: return False
10086 if self.actions_select != other.actions_select: return False
10087 if self.actions_indirect != other.actions_indirect: return False
10088 if self.actions_ff != other.actions_ff: return False
10089 return True
10090
Rich Lanec2ee4b82013-04-24 17:12:38 -070010091 def pretty_print(self, q):
10092 q.text("group_features_stats_reply {")
10093 with q.group():
10094 with q.indent(2):
10095 q.breakable()
10096 q.text("xid = ");
10097 if self.xid != None:
10098 q.text("%#x" % self.xid)
10099 else:
10100 q.text('None')
10101 q.text(","); q.breakable()
10102 q.text("flags = ");
10103 q.text("%#x" % self.flags)
10104 q.text(","); q.breakable()
10105 q.text("types = ");
10106 q.text("%#x" % self.types)
10107 q.text(","); q.breakable()
10108 q.text("capabilities = ");
10109 q.text("%#x" % self.capabilities)
10110 q.text(","); q.breakable()
10111 q.text("max_groups_all = ");
10112 q.text("%#x" % self.max_groups_all)
10113 q.text(","); q.breakable()
10114 q.text("max_groups_select = ");
10115 q.text("%#x" % self.max_groups_select)
10116 q.text(","); q.breakable()
10117 q.text("max_groups_indirect = ");
10118 q.text("%#x" % self.max_groups_indirect)
10119 q.text(","); q.breakable()
10120 q.text("max_groups_ff = ");
10121 q.text("%#x" % self.max_groups_ff)
10122 q.text(","); q.breakable()
10123 q.text("actions_all = ");
10124 q.text("%#x" % self.actions_all)
10125 q.text(","); q.breakable()
10126 q.text("actions_select = ");
10127 q.text("%#x" % self.actions_select)
10128 q.text(","); q.breakable()
10129 q.text("actions_indirect = ");
10130 q.text("%#x" % self.actions_indirect)
10131 q.text(","); q.breakable()
10132 q.text("actions_ff = ");
10133 q.text("%#x" % self.actions_ff)
10134 q.breakable()
10135 q.text('}')
10136
Rich Lane7dcdf022013-12-11 14:45:27 -080010137stats_reply.subtypes[8] = group_features_stats_reply
10138
10139class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010140 version = 4
10141 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010142 stats_type = 8
10143
10144 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010145 if xid != None:
10146 self.xid = xid
10147 else:
10148 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010149 if flags != None:
10150 self.flags = flags
10151 else:
10152 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010153 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010154
10155 def pack(self):
10156 packed = []
10157 packed.append(struct.pack("!B", self.version))
10158 packed.append(struct.pack("!B", self.type))
10159 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10160 packed.append(struct.pack("!L", self.xid))
10161 packed.append(struct.pack("!H", self.stats_type))
10162 packed.append(struct.pack("!H", self.flags))
10163 packed.append('\x00' * 4)
10164 length = sum([len(x) for x in packed])
10165 packed[2] = struct.pack("!H", length)
10166 return ''.join(packed)
10167
10168 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010169 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010170 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010171 _version = reader.read("!B")[0]
10172 assert(_version == 4)
10173 _type = reader.read("!B")[0]
10174 assert(_type == 18)
10175 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010176 orig_reader = reader
10177 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010178 obj.xid = reader.read("!L")[0]
10179 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010180 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070010181 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010182 reader.skip(4)
10183 return obj
10184
10185 def __eq__(self, other):
10186 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010187 if self.xid != other.xid: return False
10188 if self.flags != other.flags: return False
10189 return True
10190
Rich Lanec2ee4b82013-04-24 17:12:38 -070010191 def pretty_print(self, q):
10192 q.text("group_features_stats_request {")
10193 with q.group():
10194 with q.indent(2):
10195 q.breakable()
10196 q.text("xid = ");
10197 if self.xid != None:
10198 q.text("%#x" % self.xid)
10199 else:
10200 q.text('None')
10201 q.text(","); q.breakable()
10202 q.text("flags = ");
10203 q.text("%#x" % self.flags)
10204 q.breakable()
10205 q.text('}')
10206
Rich Lane7dcdf022013-12-11 14:45:27 -080010207stats_request.subtypes[8] = group_features_stats_request
10208
10209class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010210 version = 4
10211 type = 1
10212 err_type = 6
10213
10214 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010215 if xid != None:
10216 self.xid = xid
10217 else:
10218 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010219 if code != None:
10220 self.code = code
10221 else:
10222 self.code = 0
10223 if data != None:
10224 self.data = data
10225 else:
10226 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010227 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010228
10229 def pack(self):
10230 packed = []
10231 packed.append(struct.pack("!B", self.version))
10232 packed.append(struct.pack("!B", self.type))
10233 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10234 packed.append(struct.pack("!L", self.xid))
10235 packed.append(struct.pack("!H", self.err_type))
10236 packed.append(struct.pack("!H", self.code))
10237 packed.append(self.data)
10238 length = sum([len(x) for x in packed])
10239 packed[2] = struct.pack("!H", length)
10240 return ''.join(packed)
10241
10242 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010243 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010244 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010245 _version = reader.read("!B")[0]
10246 assert(_version == 4)
10247 _type = reader.read("!B")[0]
10248 assert(_type == 1)
10249 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010250 orig_reader = reader
10251 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010252 obj.xid = reader.read("!L")[0]
10253 _err_type = reader.read("!H")[0]
10254 assert(_err_type == 6)
10255 obj.code = reader.read("!H")[0]
10256 obj.data = str(reader.read_all())
10257 return obj
10258
10259 def __eq__(self, other):
10260 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010261 if self.xid != other.xid: return False
10262 if self.code != other.code: return False
10263 if self.data != other.data: return False
10264 return True
10265
Rich Lane6f4978c2013-10-20 21:33:52 -070010266 def pretty_print(self, q):
10267 q.text("group_mod_failed_error_msg {")
10268 with q.group():
10269 with q.indent(2):
10270 q.breakable()
10271 q.text("xid = ");
10272 if self.xid != None:
10273 q.text("%#x" % self.xid)
10274 else:
10275 q.text('None')
10276 q.text(","); q.breakable()
10277 q.text("code = ");
10278 q.text("%#x" % self.code)
10279 q.text(","); q.breakable()
10280 q.text("data = ");
10281 q.pp(self.data)
10282 q.breakable()
10283 q.text('}')
10284
Rich Lane7dcdf022013-12-11 14:45:27 -080010285error_msg.subtypes[6] = group_mod_failed_error_msg
10286
10287class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080010288 version = 4
10289 type = 15
10290 command = 1
10291
10292 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010293 if xid != None:
10294 self.xid = xid
10295 else:
10296 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080010297 if group_type != None:
10298 self.group_type = group_type
10299 else:
10300 self.group_type = 0
10301 if group_id != None:
10302 self.group_id = group_id
10303 else:
10304 self.group_id = 0
10305 if buckets != None:
10306 self.buckets = buckets
10307 else:
10308 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010309 return
Rich Lane7b0f2012013-11-22 14:15:26 -080010310
10311 def pack(self):
10312 packed = []
10313 packed.append(struct.pack("!B", self.version))
10314 packed.append(struct.pack("!B", self.type))
10315 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10316 packed.append(struct.pack("!L", self.xid))
10317 packed.append(struct.pack("!H", self.command))
10318 packed.append(struct.pack("!B", self.group_type))
10319 packed.append('\x00' * 1)
10320 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080010321 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080010322 length = sum([len(x) for x in packed])
10323 packed[2] = struct.pack("!H", length)
10324 return ''.join(packed)
10325
10326 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010327 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080010328 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080010329 _version = reader.read("!B")[0]
10330 assert(_version == 4)
10331 _type = reader.read("!B")[0]
10332 assert(_type == 15)
10333 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010334 orig_reader = reader
10335 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -080010336 obj.xid = reader.read("!L")[0]
10337 _command = reader.read("!H")[0]
10338 assert(_command == 1)
10339 obj.group_type = reader.read("!B")[0]
10340 reader.skip(1)
10341 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010342 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080010343 return obj
10344
10345 def __eq__(self, other):
10346 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080010347 if self.xid != other.xid: return False
10348 if self.group_type != other.group_type: return False
10349 if self.group_id != other.group_id: return False
10350 if self.buckets != other.buckets: return False
10351 return True
10352
Rich Lane7b0f2012013-11-22 14:15:26 -080010353 def pretty_print(self, q):
10354 q.text("group_modify {")
10355 with q.group():
10356 with q.indent(2):
10357 q.breakable()
10358 q.text("xid = ");
10359 if self.xid != None:
10360 q.text("%#x" % self.xid)
10361 else:
10362 q.text('None')
10363 q.text(","); q.breakable()
10364 q.text("group_type = ");
10365 q.text("%#x" % self.group_type)
10366 q.text(","); q.breakable()
10367 q.text("group_id = ");
10368 q.text("%#x" % self.group_id)
10369 q.text(","); q.breakable()
10370 q.text("buckets = ");
10371 q.pp(self.buckets)
10372 q.breakable()
10373 q.text('}')
10374
Rich Lane7dcdf022013-12-11 14:45:27 -080010375group_mod.subtypes[1] = group_modify
10376
10377class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010378 version = 4
10379 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010380 stats_type = 6
10381
10382 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010383 if xid != None:
10384 self.xid = xid
10385 else:
10386 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010387 if flags != None:
10388 self.flags = flags
10389 else:
10390 self.flags = 0
10391 if entries != None:
10392 self.entries = entries
10393 else:
10394 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010395 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010396
10397 def pack(self):
10398 packed = []
10399 packed.append(struct.pack("!B", self.version))
10400 packed.append(struct.pack("!B", self.type))
10401 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10402 packed.append(struct.pack("!L", self.xid))
10403 packed.append(struct.pack("!H", self.stats_type))
10404 packed.append(struct.pack("!H", self.flags))
10405 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010406 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010407 length = sum([len(x) for x in packed])
10408 packed[2] = struct.pack("!H", length)
10409 return ''.join(packed)
10410
10411 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010412 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010413 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010414 _version = reader.read("!B")[0]
10415 assert(_version == 4)
10416 _type = reader.read("!B")[0]
10417 assert(_type == 19)
10418 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010419 orig_reader = reader
10420 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010421 obj.xid = reader.read("!L")[0]
10422 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010423 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010424 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010425 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010426 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010427 return obj
10428
10429 def __eq__(self, other):
10430 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010431 if self.xid != other.xid: return False
10432 if self.flags != other.flags: return False
10433 if self.entries != other.entries: return False
10434 return True
10435
Rich Lanec2ee4b82013-04-24 17:12:38 -070010436 def pretty_print(self, q):
10437 q.text("group_stats_reply {")
10438 with q.group():
10439 with q.indent(2):
10440 q.breakable()
10441 q.text("xid = ");
10442 if self.xid != None:
10443 q.text("%#x" % self.xid)
10444 else:
10445 q.text('None')
10446 q.text(","); q.breakable()
10447 q.text("flags = ");
10448 q.text("%#x" % self.flags)
10449 q.text(","); q.breakable()
10450 q.text("entries = ");
10451 q.pp(self.entries)
10452 q.breakable()
10453 q.text('}')
10454
Rich Lane7dcdf022013-12-11 14:45:27 -080010455stats_reply.subtypes[6] = group_stats_reply
10456
10457class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010458 version = 4
10459 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010460 stats_type = 6
10461
10462 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010463 if xid != None:
10464 self.xid = xid
10465 else:
10466 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010467 if flags != None:
10468 self.flags = flags
10469 else:
10470 self.flags = 0
10471 if group_id != None:
10472 self.group_id = group_id
10473 else:
10474 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010475 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010476
10477 def pack(self):
10478 packed = []
10479 packed.append(struct.pack("!B", self.version))
10480 packed.append(struct.pack("!B", self.type))
10481 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10482 packed.append(struct.pack("!L", self.xid))
10483 packed.append(struct.pack("!H", self.stats_type))
10484 packed.append(struct.pack("!H", self.flags))
10485 packed.append('\x00' * 4)
10486 packed.append(struct.pack("!L", self.group_id))
10487 packed.append('\x00' * 4)
10488 length = sum([len(x) for x in packed])
10489 packed[2] = struct.pack("!H", length)
10490 return ''.join(packed)
10491
10492 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010493 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010494 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010495 _version = reader.read("!B")[0]
10496 assert(_version == 4)
10497 _type = reader.read("!B")[0]
10498 assert(_type == 18)
10499 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010500 orig_reader = reader
10501 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010502 obj.xid = reader.read("!L")[0]
10503 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010504 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070010505 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010506 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010507 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010508 reader.skip(4)
10509 return obj
10510
10511 def __eq__(self, other):
10512 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010513 if self.xid != other.xid: return False
10514 if self.flags != other.flags: return False
10515 if self.group_id != other.group_id: return False
10516 return True
10517
Rich Lanec2ee4b82013-04-24 17:12:38 -070010518 def pretty_print(self, q):
10519 q.text("group_stats_request {")
10520 with q.group():
10521 with q.indent(2):
10522 q.breakable()
10523 q.text("xid = ");
10524 if self.xid != None:
10525 q.text("%#x" % self.xid)
10526 else:
10527 q.text('None')
10528 q.text(","); q.breakable()
10529 q.text("flags = ");
10530 q.text("%#x" % self.flags)
10531 q.text(","); q.breakable()
10532 q.text("group_id = ");
10533 q.text("%#x" % self.group_id)
10534 q.breakable()
10535 q.text('}')
10536
Rich Lane7dcdf022013-12-11 14:45:27 -080010537stats_request.subtypes[6] = group_stats_request
10538
10539class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010540 version = 4
10541 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070010542
10543 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010544 if xid != None:
10545 self.xid = xid
10546 else:
10547 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010548 if elements != None:
10549 self.elements = elements
10550 else:
10551 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010552 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010553
10554 def pack(self):
10555 packed = []
10556 packed.append(struct.pack("!B", self.version))
10557 packed.append(struct.pack("!B", self.type))
10558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10559 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080010560 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010561 length = sum([len(x) for x in packed])
10562 packed[2] = struct.pack("!H", length)
10563 return ''.join(packed)
10564
10565 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010566 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010567 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070010568 _version = reader.read("!B")[0]
10569 assert(_version == 4)
10570 _type = reader.read("!B")[0]
10571 assert(_type == 0)
10572 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010573 orig_reader = reader
10574 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010575 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080010576 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010577 return obj
10578
10579 def __eq__(self, other):
10580 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010581 if self.xid != other.xid: return False
10582 if self.elements != other.elements: return False
10583 return True
10584
Rich Lanec2ee4b82013-04-24 17:12:38 -070010585 def pretty_print(self, q):
10586 q.text("hello {")
10587 with q.group():
10588 with q.indent(2):
10589 q.breakable()
10590 q.text("xid = ");
10591 if self.xid != None:
10592 q.text("%#x" % self.xid)
10593 else:
10594 q.text('None')
10595 q.text(","); q.breakable()
10596 q.text("elements = ");
10597 q.pp(self.elements)
10598 q.breakable()
10599 q.text('}')
10600
Rich Lane7dcdf022013-12-11 14:45:27 -080010601message.subtypes[0] = hello
10602
10603class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010604 version = 4
10605 type = 1
10606 err_type = 0
10607
10608 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010609 if xid != None:
10610 self.xid = xid
10611 else:
10612 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010613 if code != None:
10614 self.code = code
10615 else:
10616 self.code = 0
10617 if data != None:
10618 self.data = data
10619 else:
10620 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010621 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010622
10623 def pack(self):
10624 packed = []
10625 packed.append(struct.pack("!B", self.version))
10626 packed.append(struct.pack("!B", self.type))
10627 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10628 packed.append(struct.pack("!L", self.xid))
10629 packed.append(struct.pack("!H", self.err_type))
10630 packed.append(struct.pack("!H", self.code))
10631 packed.append(self.data)
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 Lane6f4978c2013-10-20 21:33:52 -070010638 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010639 _version = reader.read("!B")[0]
10640 assert(_version == 4)
10641 _type = reader.read("!B")[0]
10642 assert(_type == 1)
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))
Rich Lane6f4978c2013-10-20 21:33:52 -070010646 obj.xid = reader.read("!L")[0]
10647 _err_type = reader.read("!H")[0]
10648 assert(_err_type == 0)
10649 obj.code = reader.read("!H")[0]
10650 obj.data = str(reader.read_all())
10651 return obj
10652
10653 def __eq__(self, other):
10654 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010655 if self.xid != other.xid: return False
10656 if self.code != other.code: return False
10657 if self.data != other.data: return False
10658 return True
10659
Rich Lane6f4978c2013-10-20 21:33:52 -070010660 def pretty_print(self, q):
10661 q.text("hello_failed_error_msg {")
10662 with q.group():
10663 with q.indent(2):
10664 q.breakable()
10665 q.text("xid = ");
10666 if self.xid != None:
10667 q.text("%#x" % self.xid)
10668 else:
10669 q.text('None')
10670 q.text(","); q.breakable()
10671 q.text("code = ");
10672 q.text("%#x" % self.code)
10673 q.text(","); q.breakable()
10674 q.text("data = ");
10675 q.pp(self.data)
10676 q.breakable()
10677 q.text('}')
10678
Rich Lane7dcdf022013-12-11 14:45:27 -080010679error_msg.subtypes[0] = hello_failed_error_msg
10680
10681class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010682 version = 4
10683 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010684 stats_type = 10
10685
10686 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010687 if xid != None:
10688 self.xid = xid
10689 else:
10690 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010691 if flags != None:
10692 self.flags = flags
10693 else:
10694 self.flags = 0
10695 if entries != None:
10696 self.entries = entries
10697 else:
10698 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010699 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010700
10701 def pack(self):
10702 packed = []
10703 packed.append(struct.pack("!B", self.version))
10704 packed.append(struct.pack("!B", self.type))
10705 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10706 packed.append(struct.pack("!L", self.xid))
10707 packed.append(struct.pack("!H", self.stats_type))
10708 packed.append(struct.pack("!H", self.flags))
10709 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010710 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010711 length = sum([len(x) for x in packed])
10712 packed[2] = struct.pack("!H", length)
10713 return ''.join(packed)
10714
10715 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010716 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010717 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010718 _version = reader.read("!B")[0]
10719 assert(_version == 4)
10720 _type = reader.read("!B")[0]
10721 assert(_type == 19)
10722 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010723 orig_reader = reader
10724 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010725 obj.xid = reader.read("!L")[0]
10726 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010727 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070010728 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010729 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010730 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010731 return obj
10732
10733 def __eq__(self, other):
10734 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010735 if self.xid != other.xid: return False
10736 if self.flags != other.flags: return False
10737 if self.entries != other.entries: return False
10738 return True
10739
Rich Lanec2ee4b82013-04-24 17:12:38 -070010740 def pretty_print(self, q):
10741 q.text("meter_config_stats_reply {")
10742 with q.group():
10743 with q.indent(2):
10744 q.breakable()
10745 q.text("xid = ");
10746 if self.xid != None:
10747 q.text("%#x" % self.xid)
10748 else:
10749 q.text('None')
10750 q.text(","); q.breakable()
10751 q.text("flags = ");
10752 q.text("%#x" % self.flags)
10753 q.text(","); q.breakable()
10754 q.text("entries = ");
10755 q.pp(self.entries)
10756 q.breakable()
10757 q.text('}')
10758
Rich Lane7dcdf022013-12-11 14:45:27 -080010759stats_reply.subtypes[10] = meter_config_stats_reply
10760
10761class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010762 version = 4
10763 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010764 stats_type = 10
10765
10766 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010767 if xid != None:
10768 self.xid = xid
10769 else:
10770 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010771 if flags != None:
10772 self.flags = flags
10773 else:
10774 self.flags = 0
10775 if meter_id != None:
10776 self.meter_id = meter_id
10777 else:
10778 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010779 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010780
10781 def pack(self):
10782 packed = []
10783 packed.append(struct.pack("!B", self.version))
10784 packed.append(struct.pack("!B", self.type))
10785 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10786 packed.append(struct.pack("!L", self.xid))
10787 packed.append(struct.pack("!H", self.stats_type))
10788 packed.append(struct.pack("!H", self.flags))
10789 packed.append('\x00' * 4)
10790 packed.append(struct.pack("!L", self.meter_id))
10791 packed.append('\x00' * 4)
10792 length = sum([len(x) for x in packed])
10793 packed[2] = struct.pack("!H", length)
10794 return ''.join(packed)
10795
10796 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010797 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010798 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010799 _version = reader.read("!B")[0]
10800 assert(_version == 4)
10801 _type = reader.read("!B")[0]
10802 assert(_type == 18)
10803 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010804 orig_reader = reader
10805 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010806 obj.xid = reader.read("!L")[0]
10807 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010808 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070010809 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010810 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010811 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010812 reader.skip(4)
10813 return obj
10814
10815 def __eq__(self, other):
10816 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010817 if self.xid != other.xid: return False
10818 if self.flags != other.flags: return False
10819 if self.meter_id != other.meter_id: return False
10820 return True
10821
Rich Lanec2ee4b82013-04-24 17:12:38 -070010822 def pretty_print(self, q):
10823 q.text("meter_config_stats_request {")
10824 with q.group():
10825 with q.indent(2):
10826 q.breakable()
10827 q.text("xid = ");
10828 if self.xid != None:
10829 q.text("%#x" % self.xid)
10830 else:
10831 q.text('None')
10832 q.text(","); q.breakable()
10833 q.text("flags = ");
10834 q.text("%#x" % self.flags)
10835 q.text(","); q.breakable()
10836 q.text("meter_id = ");
10837 q.text("%#x" % self.meter_id)
10838 q.breakable()
10839 q.text('}')
10840
Rich Lane7dcdf022013-12-11 14:45:27 -080010841stats_request.subtypes[10] = meter_config_stats_request
10842
10843class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010844 version = 4
10845 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010846 stats_type = 11
10847
10848 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010849 if xid != None:
10850 self.xid = xid
10851 else:
10852 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010853 if flags != None:
10854 self.flags = flags
10855 else:
10856 self.flags = 0
10857 if features != None:
10858 self.features = features
10859 else:
10860 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080010861 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010862
10863 def pack(self):
10864 packed = []
10865 packed.append(struct.pack("!B", self.version))
10866 packed.append(struct.pack("!B", self.type))
10867 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10868 packed.append(struct.pack("!L", self.xid))
10869 packed.append(struct.pack("!H", self.stats_type))
10870 packed.append(struct.pack("!H", self.flags))
10871 packed.append('\x00' * 4)
10872 packed.append(self.features.pack())
10873 length = sum([len(x) for x in packed])
10874 packed[2] = struct.pack("!H", length)
10875 return ''.join(packed)
10876
10877 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010878 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010879 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010880 _version = reader.read("!B")[0]
10881 assert(_version == 4)
10882 _type = reader.read("!B")[0]
10883 assert(_type == 19)
10884 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010885 orig_reader = reader
10886 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010887 obj.xid = reader.read("!L")[0]
10888 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010889 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070010890 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010891 reader.skip(4)
10892 obj.features = common.meter_features.unpack(reader)
10893 return obj
10894
10895 def __eq__(self, other):
10896 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010897 if self.xid != other.xid: return False
10898 if self.flags != other.flags: return False
10899 if self.features != other.features: return False
10900 return True
10901
Rich Lanec2ee4b82013-04-24 17:12:38 -070010902 def pretty_print(self, q):
10903 q.text("meter_features_stats_reply {")
10904 with q.group():
10905 with q.indent(2):
10906 q.breakable()
10907 q.text("xid = ");
10908 if self.xid != None:
10909 q.text("%#x" % self.xid)
10910 else:
10911 q.text('None')
10912 q.text(","); q.breakable()
10913 q.text("flags = ");
10914 q.text("%#x" % self.flags)
10915 q.text(","); q.breakable()
10916 q.text("features = ");
10917 q.pp(self.features)
10918 q.breakable()
10919 q.text('}')
10920
Rich Lane7dcdf022013-12-11 14:45:27 -080010921stats_reply.subtypes[11] = meter_features_stats_reply
10922
10923class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010924 version = 4
10925 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010926 stats_type = 11
10927
10928 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010929 if xid != None:
10930 self.xid = xid
10931 else:
10932 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010933 if flags != None:
10934 self.flags = flags
10935 else:
10936 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010937 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010938
10939 def pack(self):
10940 packed = []
10941 packed.append(struct.pack("!B", self.version))
10942 packed.append(struct.pack("!B", self.type))
10943 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10944 packed.append(struct.pack("!L", self.xid))
10945 packed.append(struct.pack("!H", self.stats_type))
10946 packed.append(struct.pack("!H", self.flags))
10947 packed.append('\x00' * 4)
10948 length = sum([len(x) for x in packed])
10949 packed[2] = struct.pack("!H", length)
10950 return ''.join(packed)
10951
10952 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010953 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010954 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010955 _version = reader.read("!B")[0]
10956 assert(_version == 4)
10957 _type = reader.read("!B")[0]
10958 assert(_type == 18)
10959 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010960 orig_reader = reader
10961 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010962 obj.xid = reader.read("!L")[0]
10963 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010964 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070010965 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010966 reader.skip(4)
10967 return obj
10968
10969 def __eq__(self, other):
10970 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010971 if self.xid != other.xid: return False
10972 if self.flags != other.flags: return False
10973 return True
10974
Rich Lanec2ee4b82013-04-24 17:12:38 -070010975 def pretty_print(self, q):
10976 q.text("meter_features_stats_request {")
10977 with q.group():
10978 with q.indent(2):
10979 q.breakable()
10980 q.text("xid = ");
10981 if self.xid != None:
10982 q.text("%#x" % self.xid)
10983 else:
10984 q.text('None')
10985 q.text(","); q.breakable()
10986 q.text("flags = ");
10987 q.text("%#x" % self.flags)
10988 q.breakable()
10989 q.text('}')
10990
Rich Lane7dcdf022013-12-11 14:45:27 -080010991stats_request.subtypes[11] = meter_features_stats_request
10992
10993class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010994 version = 4
10995 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070010996
10997 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010998 if xid != None:
10999 self.xid = xid
11000 else:
11001 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011002 if command != None:
11003 self.command = command
11004 else:
11005 self.command = 0
11006 if flags != None:
11007 self.flags = flags
11008 else:
11009 self.flags = 0
11010 if meter_id != None:
11011 self.meter_id = meter_id
11012 else:
11013 self.meter_id = 0
11014 if meters != None:
11015 self.meters = meters
11016 else:
11017 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011018 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011019
11020 def pack(self):
11021 packed = []
11022 packed.append(struct.pack("!B", self.version))
11023 packed.append(struct.pack("!B", self.type))
11024 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11025 packed.append(struct.pack("!L", self.xid))
11026 packed.append(struct.pack("!H", self.command))
11027 packed.append(struct.pack("!H", self.flags))
11028 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011029 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011030 length = sum([len(x) for x in packed])
11031 packed[2] = struct.pack("!H", length)
11032 return ''.join(packed)
11033
11034 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011035 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011036 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070011037 _version = reader.read("!B")[0]
11038 assert(_version == 4)
11039 _type = reader.read("!B")[0]
11040 assert(_type == 29)
11041 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011042 orig_reader = reader
11043 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011044 obj.xid = reader.read("!L")[0]
11045 obj.command = reader.read("!H")[0]
11046 obj.flags = reader.read("!H")[0]
11047 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011048 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011049 return obj
11050
11051 def __eq__(self, other):
11052 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011053 if self.xid != other.xid: return False
11054 if self.command != other.command: return False
11055 if self.flags != other.flags: return False
11056 if self.meter_id != other.meter_id: return False
11057 if self.meters != other.meters: return False
11058 return True
11059
Rich Lanec2ee4b82013-04-24 17:12:38 -070011060 def pretty_print(self, q):
11061 q.text("meter_mod {")
11062 with q.group():
11063 with q.indent(2):
11064 q.breakable()
11065 q.text("xid = ");
11066 if self.xid != None:
11067 q.text("%#x" % self.xid)
11068 else:
11069 q.text('None')
11070 q.text(","); q.breakable()
11071 q.text("command = ");
11072 q.text("%#x" % self.command)
11073 q.text(","); q.breakable()
11074 q.text("flags = ");
11075 q.text("%#x" % self.flags)
11076 q.text(","); q.breakable()
11077 q.text("meter_id = ");
11078 q.text("%#x" % self.meter_id)
11079 q.text(","); q.breakable()
11080 q.text("meters = ");
11081 q.pp(self.meters)
11082 q.breakable()
11083 q.text('}')
11084
Rich Lane7dcdf022013-12-11 14:45:27 -080011085message.subtypes[29] = meter_mod
11086
11087class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011088 version = 4
11089 type = 1
11090 err_type = 12
11091
11092 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011093 if xid != None:
11094 self.xid = xid
11095 else:
11096 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011097 if code != None:
11098 self.code = code
11099 else:
11100 self.code = 0
11101 if data != None:
11102 self.data = data
11103 else:
11104 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011105 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011106
11107 def pack(self):
11108 packed = []
11109 packed.append(struct.pack("!B", self.version))
11110 packed.append(struct.pack("!B", self.type))
11111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11112 packed.append(struct.pack("!L", self.xid))
11113 packed.append(struct.pack("!H", self.err_type))
11114 packed.append(struct.pack("!H", self.code))
11115 packed.append(self.data)
11116 length = sum([len(x) for x in packed])
11117 packed[2] = struct.pack("!H", length)
11118 return ''.join(packed)
11119
11120 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011121 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011122 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011123 _version = reader.read("!B")[0]
11124 assert(_version == 4)
11125 _type = reader.read("!B")[0]
11126 assert(_type == 1)
11127 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011128 orig_reader = reader
11129 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011130 obj.xid = reader.read("!L")[0]
11131 _err_type = reader.read("!H")[0]
11132 assert(_err_type == 12)
11133 obj.code = reader.read("!H")[0]
11134 obj.data = str(reader.read_all())
11135 return obj
11136
11137 def __eq__(self, other):
11138 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011139 if self.xid != other.xid: return False
11140 if self.code != other.code: return False
11141 if self.data != other.data: return False
11142 return True
11143
Rich Lane6f4978c2013-10-20 21:33:52 -070011144 def pretty_print(self, q):
11145 q.text("meter_mod_failed_error_msg {")
11146 with q.group():
11147 with q.indent(2):
11148 q.breakable()
11149 q.text("xid = ");
11150 if self.xid != None:
11151 q.text("%#x" % self.xid)
11152 else:
11153 q.text('None')
11154 q.text(","); q.breakable()
11155 q.text("code = ");
11156 q.text("%#x" % self.code)
11157 q.text(","); q.breakable()
11158 q.text("data = ");
11159 q.pp(self.data)
11160 q.breakable()
11161 q.text('}')
11162
Rich Lane7dcdf022013-12-11 14:45:27 -080011163error_msg.subtypes[12] = meter_mod_failed_error_msg
11164
11165class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011166 version = 4
11167 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011168 stats_type = 9
11169
11170 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011171 if xid != None:
11172 self.xid = xid
11173 else:
11174 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011175 if flags != None:
11176 self.flags = flags
11177 else:
11178 self.flags = 0
11179 if entries != None:
11180 self.entries = entries
11181 else:
11182 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011183 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011184
11185 def pack(self):
11186 packed = []
11187 packed.append(struct.pack("!B", self.version))
11188 packed.append(struct.pack("!B", self.type))
11189 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11190 packed.append(struct.pack("!L", self.xid))
11191 packed.append(struct.pack("!H", self.stats_type))
11192 packed.append(struct.pack("!H", self.flags))
11193 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011194 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011195 length = sum([len(x) for x in packed])
11196 packed[2] = struct.pack("!H", length)
11197 return ''.join(packed)
11198
11199 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011200 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011201 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011202 _version = reader.read("!B")[0]
11203 assert(_version == 4)
11204 _type = reader.read("!B")[0]
11205 assert(_type == 19)
11206 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011207 orig_reader = reader
11208 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011209 obj.xid = reader.read("!L")[0]
11210 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011211 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011212 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011213 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011214 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011215 return obj
11216
11217 def __eq__(self, other):
11218 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011219 if self.xid != other.xid: return False
11220 if self.flags != other.flags: return False
11221 if self.entries != other.entries: return False
11222 return True
11223
Rich Lanec2ee4b82013-04-24 17:12:38 -070011224 def pretty_print(self, q):
11225 q.text("meter_stats_reply {")
11226 with q.group():
11227 with q.indent(2):
11228 q.breakable()
11229 q.text("xid = ");
11230 if self.xid != None:
11231 q.text("%#x" % self.xid)
11232 else:
11233 q.text('None')
11234 q.text(","); q.breakable()
11235 q.text("flags = ");
11236 q.text("%#x" % self.flags)
11237 q.text(","); q.breakable()
11238 q.text("entries = ");
11239 q.pp(self.entries)
11240 q.breakable()
11241 q.text('}')
11242
Rich Lane7dcdf022013-12-11 14:45:27 -080011243stats_reply.subtypes[9] = meter_stats_reply
11244
11245class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011246 version = 4
11247 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011248 stats_type = 9
11249
11250 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011251 if xid != None:
11252 self.xid = xid
11253 else:
11254 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011255 if flags != None:
11256 self.flags = flags
11257 else:
11258 self.flags = 0
11259 if meter_id != None:
11260 self.meter_id = meter_id
11261 else:
11262 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011263 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011264
11265 def pack(self):
11266 packed = []
11267 packed.append(struct.pack("!B", self.version))
11268 packed.append(struct.pack("!B", self.type))
11269 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11270 packed.append(struct.pack("!L", self.xid))
11271 packed.append(struct.pack("!H", self.stats_type))
11272 packed.append(struct.pack("!H", self.flags))
11273 packed.append('\x00' * 4)
11274 packed.append(struct.pack("!L", self.meter_id))
11275 packed.append('\x00' * 4)
11276 length = sum([len(x) for x in packed])
11277 packed[2] = struct.pack("!H", length)
11278 return ''.join(packed)
11279
11280 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011281 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011282 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011283 _version = reader.read("!B")[0]
11284 assert(_version == 4)
11285 _type = reader.read("!B")[0]
11286 assert(_type == 18)
11287 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011288 orig_reader = reader
11289 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011290 obj.xid = reader.read("!L")[0]
11291 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011292 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070011293 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011294 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011295 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011296 reader.skip(4)
11297 return obj
11298
11299 def __eq__(self, other):
11300 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011301 if self.xid != other.xid: return False
11302 if self.flags != other.flags: return False
11303 if self.meter_id != other.meter_id: return False
11304 return True
11305
Rich Lanec2ee4b82013-04-24 17:12:38 -070011306 def pretty_print(self, q):
11307 q.text("meter_stats_request {")
11308 with q.group():
11309 with q.indent(2):
11310 q.breakable()
11311 q.text("xid = ");
11312 if self.xid != None:
11313 q.text("%#x" % self.xid)
11314 else:
11315 q.text('None')
11316 q.text(","); q.breakable()
11317 q.text("flags = ");
11318 q.text("%#x" % self.flags)
11319 q.text(","); q.breakable()
11320 q.text("meter_id = ");
11321 q.text("%#x" % self.meter_id)
11322 q.breakable()
11323 q.text('}')
11324
Rich Lane7dcdf022013-12-11 14:45:27 -080011325stats_request.subtypes[9] = meter_stats_request
11326
11327class nicira_header(experimenter):
11328 subtypes = {}
11329
Rich Lane95f7fc92014-01-27 17:08:16 -080011330 version = 4
11331 type = 4
11332 experimenter = 8992
11333
11334 def __init__(self, xid=None, subtype=None):
11335 if xid != None:
11336 self.xid = xid
11337 else:
11338 self.xid = None
11339 if subtype != None:
11340 self.subtype = subtype
11341 else:
11342 self.subtype = 0
11343 return
11344
11345 def pack(self):
11346 packed = []
11347 packed.append(struct.pack("!B", self.version))
11348 packed.append(struct.pack("!B", self.type))
11349 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11350 packed.append(struct.pack("!L", self.xid))
11351 packed.append(struct.pack("!L", self.experimenter))
11352 packed.append(struct.pack("!L", self.subtype))
11353 length = sum([len(x) for x in packed])
11354 packed[2] = struct.pack("!H", length)
11355 return ''.join(packed)
11356
Rich Lane7dcdf022013-12-11 14:45:27 -080011357 @staticmethod
11358 def unpack(reader):
11359 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080011360 subclass = nicira_header.subtypes.get(subtype)
11361 if subclass:
11362 return subclass.unpack(reader)
11363
11364 obj = nicira_header()
11365 _version = reader.read("!B")[0]
11366 assert(_version == 4)
11367 _type = reader.read("!B")[0]
11368 assert(_type == 4)
11369 _length = reader.read("!H")[0]
11370 orig_reader = reader
11371 reader = orig_reader.slice(_length - (2 + 2))
11372 obj.xid = reader.read("!L")[0]
11373 _experimenter = reader.read("!L")[0]
11374 assert(_experimenter == 8992)
11375 obj.subtype = reader.read("!L")[0]
11376 return obj
11377
11378 def __eq__(self, other):
11379 if type(self) != type(other): return False
11380 if self.xid != other.xid: return False
11381 if self.subtype != other.subtype: return False
11382 return True
11383
11384 def pretty_print(self, q):
11385 q.text("nicira_header {")
11386 with q.group():
11387 with q.indent(2):
11388 q.breakable()
11389 q.text("xid = ");
11390 if self.xid != None:
11391 q.text("%#x" % self.xid)
11392 else:
11393 q.text('None')
11394 q.breakable()
11395 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011396
11397experimenter.subtypes[8992] = nicira_header
11398
11399class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011400 version = 4
11401 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070011402
11403 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 -080011404 if xid != None:
11405 self.xid = xid
11406 else:
11407 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011408 if buffer_id != None:
11409 self.buffer_id = buffer_id
11410 else:
11411 self.buffer_id = 0
11412 if total_len != None:
11413 self.total_len = total_len
11414 else:
11415 self.total_len = 0
11416 if reason != None:
11417 self.reason = reason
11418 else:
11419 self.reason = 0
11420 if table_id != None:
11421 self.table_id = table_id
11422 else:
11423 self.table_id = 0
11424 if cookie != None:
11425 self.cookie = cookie
11426 else:
11427 self.cookie = 0
11428 if match != None:
11429 self.match = match
11430 else:
11431 self.match = common.match()
11432 if data != None:
11433 self.data = data
11434 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011435 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011436 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011437
11438 def pack(self):
11439 packed = []
11440 packed.append(struct.pack("!B", self.version))
11441 packed.append(struct.pack("!B", self.type))
11442 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11443 packed.append(struct.pack("!L", self.xid))
11444 packed.append(struct.pack("!L", self.buffer_id))
11445 packed.append(struct.pack("!H", self.total_len))
11446 packed.append(struct.pack("!B", self.reason))
11447 packed.append(struct.pack("!B", self.table_id))
11448 packed.append(struct.pack("!Q", self.cookie))
11449 packed.append(self.match.pack())
11450 packed.append('\x00' * 2)
11451 packed.append(self.data)
11452 length = sum([len(x) for x in packed])
11453 packed[2] = struct.pack("!H", length)
11454 return ''.join(packed)
11455
11456 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011457 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011458 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070011459 _version = reader.read("!B")[0]
11460 assert(_version == 4)
11461 _type = reader.read("!B")[0]
11462 assert(_type == 10)
11463 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011464 orig_reader = reader
11465 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011466 obj.xid = reader.read("!L")[0]
11467 obj.buffer_id = reader.read("!L")[0]
11468 obj.total_len = reader.read("!H")[0]
11469 obj.reason = reader.read("!B")[0]
11470 obj.table_id = reader.read("!B")[0]
11471 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011472 obj.match = common.match.unpack(reader)
11473 reader.skip(2)
11474 obj.data = str(reader.read_all())
11475 return obj
11476
11477 def __eq__(self, other):
11478 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011479 if self.xid != other.xid: return False
11480 if self.buffer_id != other.buffer_id: return False
11481 if self.total_len != other.total_len: return False
11482 if self.reason != other.reason: return False
11483 if self.table_id != other.table_id: return False
11484 if self.cookie != other.cookie: return False
11485 if self.match != other.match: return False
11486 if self.data != other.data: return False
11487 return True
11488
Rich Lanec2ee4b82013-04-24 17:12:38 -070011489 def pretty_print(self, q):
11490 q.text("packet_in {")
11491 with q.group():
11492 with q.indent(2):
11493 q.breakable()
11494 q.text("xid = ");
11495 if self.xid != None:
11496 q.text("%#x" % self.xid)
11497 else:
11498 q.text('None')
11499 q.text(","); q.breakable()
11500 q.text("buffer_id = ");
11501 q.text("%#x" % self.buffer_id)
11502 q.text(","); q.breakable()
11503 q.text("total_len = ");
11504 q.text("%#x" % self.total_len)
11505 q.text(","); q.breakable()
11506 q.text("reason = ");
11507 q.text("%#x" % self.reason)
11508 q.text(","); q.breakable()
11509 q.text("table_id = ");
11510 q.text("%#x" % self.table_id)
11511 q.text(","); q.breakable()
11512 q.text("cookie = ");
11513 q.text("%#x" % self.cookie)
11514 q.text(","); q.breakable()
11515 q.text("match = ");
11516 q.pp(self.match)
11517 q.text(","); q.breakable()
11518 q.text("data = ");
11519 q.pp(self.data)
11520 q.breakable()
11521 q.text('}')
11522
Rich Lane7dcdf022013-12-11 14:45:27 -080011523message.subtypes[10] = packet_in
11524
11525class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011526 version = 4
11527 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070011528
11529 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011530 if xid != None:
11531 self.xid = xid
11532 else:
11533 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011534 if buffer_id != None:
11535 self.buffer_id = buffer_id
11536 else:
11537 self.buffer_id = 0
11538 if in_port != None:
11539 self.in_port = in_port
11540 else:
11541 self.in_port = 0
11542 if actions != None:
11543 self.actions = actions
11544 else:
11545 self.actions = []
11546 if data != None:
11547 self.data = data
11548 else:
Dan Talaycof6202252013-07-02 01:00:29 -070011549 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011550 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011551
11552 def pack(self):
11553 packed = []
11554 packed.append(struct.pack("!B", self.version))
11555 packed.append(struct.pack("!B", self.type))
11556 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11557 packed.append(struct.pack("!L", self.xid))
11558 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070011559 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011560 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
11561 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080011562 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011563 packed[6] = struct.pack("!H", len(packed[-1]))
11564 packed.append(self.data)
11565 length = sum([len(x) for x in packed])
11566 packed[2] = struct.pack("!H", length)
11567 return ''.join(packed)
11568
11569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011570 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011571 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070011572 _version = reader.read("!B")[0]
11573 assert(_version == 4)
11574 _type = reader.read("!B")[0]
11575 assert(_type == 13)
11576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011577 orig_reader = reader
11578 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011579 obj.xid = reader.read("!L")[0]
11580 obj.buffer_id = reader.read("!L")[0]
11581 obj.in_port = util.unpack_port_no(reader)
11582 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011583 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080011584 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011585 obj.data = str(reader.read_all())
11586 return obj
11587
11588 def __eq__(self, other):
11589 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011590 if self.xid != other.xid: return False
11591 if self.buffer_id != other.buffer_id: return False
11592 if self.in_port != other.in_port: return False
11593 if self.actions != other.actions: return False
11594 if self.data != other.data: return False
11595 return True
11596
Rich Lanec2ee4b82013-04-24 17:12:38 -070011597 def pretty_print(self, q):
11598 q.text("packet_out {")
11599 with q.group():
11600 with q.indent(2):
11601 q.breakable()
11602 q.text("xid = ");
11603 if self.xid != None:
11604 q.text("%#x" % self.xid)
11605 else:
11606 q.text('None')
11607 q.text(","); q.breakable()
11608 q.text("buffer_id = ");
11609 q.text("%#x" % self.buffer_id)
11610 q.text(","); q.breakable()
11611 q.text("in_port = ");
11612 q.text(util.pretty_port(self.in_port))
11613 q.text(","); q.breakable()
11614 q.text("actions = ");
11615 q.pp(self.actions)
11616 q.text(","); q.breakable()
11617 q.text("data = ");
11618 q.pp(self.data)
11619 q.breakable()
11620 q.text('}')
11621
Rich Lane7dcdf022013-12-11 14:45:27 -080011622message.subtypes[13] = packet_out
11623
11624class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011625 version = 4
11626 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011627 stats_type = 13
11628
11629 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011630 if xid != None:
11631 self.xid = xid
11632 else:
11633 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011634 if flags != None:
11635 self.flags = flags
11636 else:
11637 self.flags = 0
11638 if entries != None:
11639 self.entries = entries
11640 else:
11641 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011642 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011643
11644 def pack(self):
11645 packed = []
11646 packed.append(struct.pack("!B", self.version))
11647 packed.append(struct.pack("!B", self.type))
11648 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11649 packed.append(struct.pack("!L", self.xid))
11650 packed.append(struct.pack("!H", self.stats_type))
11651 packed.append(struct.pack("!H", self.flags))
11652 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011653 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011654 length = sum([len(x) for x in packed])
11655 packed[2] = struct.pack("!H", length)
11656 return ''.join(packed)
11657
11658 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011659 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011660 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011661 _version = reader.read("!B")[0]
11662 assert(_version == 4)
11663 _type = reader.read("!B")[0]
11664 assert(_type == 19)
11665 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011666 orig_reader = reader
11667 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011668 obj.xid = reader.read("!L")[0]
11669 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011670 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070011671 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011672 reader.skip(4)
11673 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
11674 return obj
11675
11676 def __eq__(self, other):
11677 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011678 if self.xid != other.xid: return False
11679 if self.flags != other.flags: return False
11680 if self.entries != other.entries: return False
11681 return True
11682
Rich Lanec2ee4b82013-04-24 17:12:38 -070011683 def pretty_print(self, q):
11684 q.text("port_desc_stats_reply {")
11685 with q.group():
11686 with q.indent(2):
11687 q.breakable()
11688 q.text("xid = ");
11689 if self.xid != None:
11690 q.text("%#x" % self.xid)
11691 else:
11692 q.text('None')
11693 q.text(","); q.breakable()
11694 q.text("flags = ");
11695 q.text("%#x" % self.flags)
11696 q.text(","); q.breakable()
11697 q.text("entries = ");
11698 q.pp(self.entries)
11699 q.breakable()
11700 q.text('}')
11701
Rich Lane7dcdf022013-12-11 14:45:27 -080011702stats_reply.subtypes[13] = port_desc_stats_reply
11703
11704class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011705 version = 4
11706 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011707 stats_type = 13
11708
11709 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011710 if xid != None:
11711 self.xid = xid
11712 else:
11713 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011714 if flags != None:
11715 self.flags = flags
11716 else:
11717 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011718 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011719
11720 def pack(self):
11721 packed = []
11722 packed.append(struct.pack("!B", self.version))
11723 packed.append(struct.pack("!B", self.type))
11724 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11725 packed.append(struct.pack("!L", self.xid))
11726 packed.append(struct.pack("!H", self.stats_type))
11727 packed.append(struct.pack("!H", self.flags))
11728 packed.append('\x00' * 4)
11729 length = sum([len(x) for x in packed])
11730 packed[2] = struct.pack("!H", length)
11731 return ''.join(packed)
11732
11733 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011734 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011735 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011736 _version = reader.read("!B")[0]
11737 assert(_version == 4)
11738 _type = reader.read("!B")[0]
11739 assert(_type == 18)
11740 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011741 orig_reader = reader
11742 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011743 obj.xid = reader.read("!L")[0]
11744 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011745 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070011746 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011747 reader.skip(4)
11748 return obj
11749
11750 def __eq__(self, other):
11751 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011752 if self.xid != other.xid: return False
11753 if self.flags != other.flags: return False
11754 return True
11755
Rich Lanec2ee4b82013-04-24 17:12:38 -070011756 def pretty_print(self, q):
11757 q.text("port_desc_stats_request {")
11758 with q.group():
11759 with q.indent(2):
11760 q.breakable()
11761 q.text("xid = ");
11762 if self.xid != None:
11763 q.text("%#x" % self.xid)
11764 else:
11765 q.text('None')
11766 q.text(","); q.breakable()
11767 q.text("flags = ");
11768 q.text("%#x" % self.flags)
11769 q.breakable()
11770 q.text('}')
11771
Rich Lane7dcdf022013-12-11 14:45:27 -080011772stats_request.subtypes[13] = port_desc_stats_request
11773
11774class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011775 version = 4
11776 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070011777
11778 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011779 if xid != None:
11780 self.xid = xid
11781 else:
11782 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011783 if port_no != None:
11784 self.port_no = port_no
11785 else:
11786 self.port_no = 0
11787 if hw_addr != None:
11788 self.hw_addr = hw_addr
11789 else:
11790 self.hw_addr = [0,0,0,0,0,0]
11791 if config != None:
11792 self.config = config
11793 else:
11794 self.config = 0
11795 if mask != None:
11796 self.mask = mask
11797 else:
11798 self.mask = 0
11799 if advertise != None:
11800 self.advertise = advertise
11801 else:
11802 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011803 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011804
11805 def pack(self):
11806 packed = []
11807 packed.append(struct.pack("!B", self.version))
11808 packed.append(struct.pack("!B", self.type))
11809 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11810 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070011811 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011812 packed.append('\x00' * 4)
11813 packed.append(struct.pack("!6B", *self.hw_addr))
11814 packed.append('\x00' * 2)
11815 packed.append(struct.pack("!L", self.config))
11816 packed.append(struct.pack("!L", self.mask))
11817 packed.append(struct.pack("!L", self.advertise))
11818 packed.append('\x00' * 4)
11819 length = sum([len(x) for x in packed])
11820 packed[2] = struct.pack("!H", length)
11821 return ''.join(packed)
11822
11823 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011824 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011825 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070011826 _version = reader.read("!B")[0]
11827 assert(_version == 4)
11828 _type = reader.read("!B")[0]
11829 assert(_type == 16)
11830 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011831 orig_reader = reader
11832 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070011833 obj.xid = reader.read("!L")[0]
11834 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011835 reader.skip(4)
11836 obj.hw_addr = list(reader.read('!6B'))
11837 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070011838 obj.config = reader.read("!L")[0]
11839 obj.mask = reader.read("!L")[0]
11840 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011841 reader.skip(4)
11842 return obj
11843
11844 def __eq__(self, other):
11845 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011846 if self.xid != other.xid: return False
11847 if self.port_no != other.port_no: return False
11848 if self.hw_addr != other.hw_addr: return False
11849 if self.config != other.config: return False
11850 if self.mask != other.mask: return False
11851 if self.advertise != other.advertise: return False
11852 return True
11853
Rich Lanec2ee4b82013-04-24 17:12:38 -070011854 def pretty_print(self, q):
11855 q.text("port_mod {")
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("port_no = ");
11866 q.text(util.pretty_port(self.port_no))
11867 q.text(","); q.breakable()
11868 q.text("hw_addr = ");
11869 q.text(util.pretty_mac(self.hw_addr))
11870 q.text(","); q.breakable()
11871 q.text("config = ");
11872 q.text("%#x" % self.config)
11873 q.text(","); q.breakable()
11874 q.text("mask = ");
11875 q.text("%#x" % self.mask)
11876 q.text(","); q.breakable()
11877 q.text("advertise = ");
11878 q.text("%#x" % self.advertise)
11879 q.breakable()
11880 q.text('}')
11881
Rich Lane7dcdf022013-12-11 14:45:27 -080011882message.subtypes[16] = port_mod
11883
11884class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011885 version = 4
11886 type = 1
11887 err_type = 7
11888
11889 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011890 if xid != None:
11891 self.xid = xid
11892 else:
11893 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011894 if code != None:
11895 self.code = code
11896 else:
11897 self.code = 0
11898 if data != None:
11899 self.data = data
11900 else:
11901 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011902 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011903
11904 def pack(self):
11905 packed = []
11906 packed.append(struct.pack("!B", self.version))
11907 packed.append(struct.pack("!B", self.type))
11908 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11909 packed.append(struct.pack("!L", self.xid))
11910 packed.append(struct.pack("!H", self.err_type))
11911 packed.append(struct.pack("!H", self.code))
11912 packed.append(self.data)
11913 length = sum([len(x) for x in packed])
11914 packed[2] = struct.pack("!H", length)
11915 return ''.join(packed)
11916
11917 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011918 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011919 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011920 _version = reader.read("!B")[0]
11921 assert(_version == 4)
11922 _type = reader.read("!B")[0]
11923 assert(_type == 1)
11924 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011925 orig_reader = reader
11926 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070011927 obj.xid = reader.read("!L")[0]
11928 _err_type = reader.read("!H")[0]
11929 assert(_err_type == 7)
11930 obj.code = reader.read("!H")[0]
11931 obj.data = str(reader.read_all())
11932 return obj
11933
11934 def __eq__(self, other):
11935 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011936 if self.xid != other.xid: return False
11937 if self.code != other.code: return False
11938 if self.data != other.data: return False
11939 return True
11940
Rich Lane6f4978c2013-10-20 21:33:52 -070011941 def pretty_print(self, q):
11942 q.text("port_mod_failed_error_msg {")
11943 with q.group():
11944 with q.indent(2):
11945 q.breakable()
11946 q.text("xid = ");
11947 if self.xid != None:
11948 q.text("%#x" % self.xid)
11949 else:
11950 q.text('None')
11951 q.text(","); q.breakable()
11952 q.text("code = ");
11953 q.text("%#x" % self.code)
11954 q.text(","); q.breakable()
11955 q.text("data = ");
11956 q.pp(self.data)
11957 q.breakable()
11958 q.text('}')
11959
Rich Lane7dcdf022013-12-11 14:45:27 -080011960error_msg.subtypes[7] = port_mod_failed_error_msg
11961
11962class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011963 version = 4
11964 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011965 stats_type = 4
11966
11967 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011968 if xid != None:
11969 self.xid = xid
11970 else:
11971 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011972 if flags != None:
11973 self.flags = flags
11974 else:
11975 self.flags = 0
11976 if entries != None:
11977 self.entries = entries
11978 else:
11979 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011980 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011981
11982 def pack(self):
11983 packed = []
11984 packed.append(struct.pack("!B", self.version))
11985 packed.append(struct.pack("!B", self.type))
11986 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11987 packed.append(struct.pack("!L", self.xid))
11988 packed.append(struct.pack("!H", self.stats_type))
11989 packed.append(struct.pack("!H", self.flags))
11990 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011991 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011992 length = sum([len(x) for x in packed])
11993 packed[2] = struct.pack("!H", length)
11994 return ''.join(packed)
11995
11996 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011997 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011998 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011999 _version = reader.read("!B")[0]
12000 assert(_version == 4)
12001 _type = reader.read("!B")[0]
12002 assert(_type == 19)
12003 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012004 orig_reader = reader
12005 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012006 obj.xid = reader.read("!L")[0]
12007 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012008 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012009 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012010 reader.skip(4)
12011 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
12012 return obj
12013
12014 def __eq__(self, other):
12015 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012016 if self.xid != other.xid: return False
12017 if self.flags != other.flags: return False
12018 if self.entries != other.entries: return False
12019 return True
12020
Rich Lanec2ee4b82013-04-24 17:12:38 -070012021 def pretty_print(self, q):
12022 q.text("port_stats_reply {")
12023 with q.group():
12024 with q.indent(2):
12025 q.breakable()
12026 q.text("xid = ");
12027 if self.xid != None:
12028 q.text("%#x" % self.xid)
12029 else:
12030 q.text('None')
12031 q.text(","); q.breakable()
12032 q.text("flags = ");
12033 q.text("%#x" % self.flags)
12034 q.text(","); q.breakable()
12035 q.text("entries = ");
12036 q.pp(self.entries)
12037 q.breakable()
12038 q.text('}')
12039
Rich Lane7dcdf022013-12-11 14:45:27 -080012040stats_reply.subtypes[4] = port_stats_reply
12041
12042class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012043 version = 4
12044 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012045 stats_type = 4
12046
12047 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012048 if xid != None:
12049 self.xid = xid
12050 else:
12051 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012052 if flags != None:
12053 self.flags = flags
12054 else:
12055 self.flags = 0
12056 if port_no != None:
12057 self.port_no = port_no
12058 else:
12059 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012060 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012061
12062 def pack(self):
12063 packed = []
12064 packed.append(struct.pack("!B", self.version))
12065 packed.append(struct.pack("!B", self.type))
12066 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12067 packed.append(struct.pack("!L", self.xid))
12068 packed.append(struct.pack("!H", self.stats_type))
12069 packed.append(struct.pack("!H", self.flags))
12070 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012071 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012072 packed.append('\x00' * 4)
12073 length = sum([len(x) for x in packed])
12074 packed[2] = struct.pack("!H", length)
12075 return ''.join(packed)
12076
12077 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012078 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012079 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012080 _version = reader.read("!B")[0]
12081 assert(_version == 4)
12082 _type = reader.read("!B")[0]
12083 assert(_type == 18)
12084 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012085 orig_reader = reader
12086 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012087 obj.xid = reader.read("!L")[0]
12088 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012089 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012090 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012091 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012092 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012093 reader.skip(4)
12094 return obj
12095
12096 def __eq__(self, other):
12097 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012098 if self.xid != other.xid: return False
12099 if self.flags != other.flags: return False
12100 if self.port_no != other.port_no: return False
12101 return True
12102
Rich Lanec2ee4b82013-04-24 17:12:38 -070012103 def pretty_print(self, q):
12104 q.text("port_stats_request {")
12105 with q.group():
12106 with q.indent(2):
12107 q.breakable()
12108 q.text("xid = ");
12109 if self.xid != None:
12110 q.text("%#x" % self.xid)
12111 else:
12112 q.text('None')
12113 q.text(","); q.breakable()
12114 q.text("flags = ");
12115 q.text("%#x" % self.flags)
12116 q.text(","); q.breakable()
12117 q.text("port_no = ");
12118 q.text(util.pretty_port(self.port_no))
12119 q.breakable()
12120 q.text('}')
12121
Rich Lane7dcdf022013-12-11 14:45:27 -080012122stats_request.subtypes[4] = port_stats_request
12123
12124class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012125 version = 4
12126 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070012127
12128 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012129 if xid != None:
12130 self.xid = xid
12131 else:
12132 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012133 if reason != None:
12134 self.reason = reason
12135 else:
12136 self.reason = 0
12137 if desc != None:
12138 self.desc = desc
12139 else:
12140 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080012141 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012142
12143 def pack(self):
12144 packed = []
12145 packed.append(struct.pack("!B", self.version))
12146 packed.append(struct.pack("!B", self.type))
12147 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12148 packed.append(struct.pack("!L", self.xid))
12149 packed.append(struct.pack("!B", self.reason))
12150 packed.append('\x00' * 7)
12151 packed.append(self.desc.pack())
12152 length = sum([len(x) for x in packed])
12153 packed[2] = struct.pack("!H", length)
12154 return ''.join(packed)
12155
12156 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012157 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012158 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070012159 _version = reader.read("!B")[0]
12160 assert(_version == 4)
12161 _type = reader.read("!B")[0]
12162 assert(_type == 12)
12163 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012164 orig_reader = reader
12165 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012166 obj.xid = reader.read("!L")[0]
12167 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012168 reader.skip(7)
12169 obj.desc = common.port_desc.unpack(reader)
12170 return obj
12171
12172 def __eq__(self, other):
12173 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012174 if self.xid != other.xid: return False
12175 if self.reason != other.reason: return False
12176 if self.desc != other.desc: return False
12177 return True
12178
Rich Lanec2ee4b82013-04-24 17:12:38 -070012179 def pretty_print(self, q):
12180 q.text("port_status {")
12181 with q.group():
12182 with q.indent(2):
12183 q.breakable()
12184 q.text("xid = ");
12185 if self.xid != None:
12186 q.text("%#x" % self.xid)
12187 else:
12188 q.text('None')
12189 q.text(","); q.breakable()
12190 q.text("reason = ");
12191 q.text("%#x" % self.reason)
12192 q.text(","); q.breakable()
12193 q.text("desc = ");
12194 q.pp(self.desc)
12195 q.breakable()
12196 q.text('}')
12197
Rich Lane7dcdf022013-12-11 14:45:27 -080012198message.subtypes[12] = port_status
12199
12200class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012201 version = 4
12202 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070012203
12204 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012205 if xid != None:
12206 self.xid = xid
12207 else:
12208 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012209 if port != None:
12210 self.port = port
12211 else:
12212 self.port = 0
12213 if queues != None:
12214 self.queues = queues
12215 else:
12216 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012217 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012218
12219 def pack(self):
12220 packed = []
12221 packed.append(struct.pack("!B", self.version))
12222 packed.append(struct.pack("!B", self.type))
12223 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12224 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012225 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012226 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012227 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012228 length = sum([len(x) for x in packed])
12229 packed[2] = struct.pack("!H", length)
12230 return ''.join(packed)
12231
12232 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012233 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012234 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012235 _version = reader.read("!B")[0]
12236 assert(_version == 4)
12237 _type = reader.read("!B")[0]
12238 assert(_type == 23)
12239 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012240 orig_reader = reader
12241 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012242 obj.xid = reader.read("!L")[0]
12243 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012244 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012245 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012246 return obj
12247
12248 def __eq__(self, other):
12249 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012250 if self.xid != other.xid: return False
12251 if self.port != other.port: return False
12252 if self.queues != other.queues: return False
12253 return True
12254
Rich Lanec2ee4b82013-04-24 17:12:38 -070012255 def pretty_print(self, q):
12256 q.text("queue_get_config_reply {")
12257 with q.group():
12258 with q.indent(2):
12259 q.breakable()
12260 q.text("xid = ");
12261 if self.xid != None:
12262 q.text("%#x" % self.xid)
12263 else:
12264 q.text('None')
12265 q.text(","); q.breakable()
12266 q.text("port = ");
12267 q.text(util.pretty_port(self.port))
12268 q.text(","); q.breakable()
12269 q.text("queues = ");
12270 q.pp(self.queues)
12271 q.breakable()
12272 q.text('}')
12273
Rich Lane7dcdf022013-12-11 14:45:27 -080012274message.subtypes[23] = queue_get_config_reply
12275
12276class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012277 version = 4
12278 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070012279
12280 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012281 if xid != None:
12282 self.xid = xid
12283 else:
12284 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012285 if port != None:
12286 self.port = port
12287 else:
12288 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012289 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012290
12291 def pack(self):
12292 packed = []
12293 packed.append(struct.pack("!B", self.version))
12294 packed.append(struct.pack("!B", self.type))
12295 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12296 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070012297 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012298 packed.append('\x00' * 4)
12299 length = sum([len(x) for x in packed])
12300 packed[2] = struct.pack("!H", length)
12301 return ''.join(packed)
12302
12303 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012304 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012305 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012306 _version = reader.read("!B")[0]
12307 assert(_version == 4)
12308 _type = reader.read("!B")[0]
12309 assert(_type == 22)
12310 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012311 orig_reader = reader
12312 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012313 obj.xid = reader.read("!L")[0]
12314 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012315 reader.skip(4)
12316 return obj
12317
12318 def __eq__(self, other):
12319 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012320 if self.xid != other.xid: return False
12321 if self.port != other.port: return False
12322 return True
12323
Rich Lanec2ee4b82013-04-24 17:12:38 -070012324 def pretty_print(self, q):
12325 q.text("queue_get_config_request {")
12326 with q.group():
12327 with q.indent(2):
12328 q.breakable()
12329 q.text("xid = ");
12330 if self.xid != None:
12331 q.text("%#x" % self.xid)
12332 else:
12333 q.text('None')
12334 q.text(","); q.breakable()
12335 q.text("port = ");
12336 q.text(util.pretty_port(self.port))
12337 q.breakable()
12338 q.text('}')
12339
Rich Lane7dcdf022013-12-11 14:45:27 -080012340message.subtypes[22] = queue_get_config_request
12341
12342class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012343 version = 4
12344 type = 1
12345 err_type = 9
12346
12347 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012348 if xid != None:
12349 self.xid = xid
12350 else:
12351 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012352 if code != None:
12353 self.code = code
12354 else:
12355 self.code = 0
12356 if data != None:
12357 self.data = data
12358 else:
12359 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012360 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012361
12362 def pack(self):
12363 packed = []
12364 packed.append(struct.pack("!B", self.version))
12365 packed.append(struct.pack("!B", self.type))
12366 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12367 packed.append(struct.pack("!L", self.xid))
12368 packed.append(struct.pack("!H", self.err_type))
12369 packed.append(struct.pack("!H", self.code))
12370 packed.append(self.data)
12371 length = sum([len(x) for x in packed])
12372 packed[2] = struct.pack("!H", length)
12373 return ''.join(packed)
12374
12375 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012376 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012377 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012378 _version = reader.read("!B")[0]
12379 assert(_version == 4)
12380 _type = reader.read("!B")[0]
12381 assert(_type == 1)
12382 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012383 orig_reader = reader
12384 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012385 obj.xid = reader.read("!L")[0]
12386 _err_type = reader.read("!H")[0]
12387 assert(_err_type == 9)
12388 obj.code = reader.read("!H")[0]
12389 obj.data = str(reader.read_all())
12390 return obj
12391
12392 def __eq__(self, other):
12393 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012394 if self.xid != other.xid: return False
12395 if self.code != other.code: return False
12396 if self.data != other.data: return False
12397 return True
12398
Rich Lane6f4978c2013-10-20 21:33:52 -070012399 def pretty_print(self, q):
12400 q.text("queue_op_failed_error_msg {")
12401 with q.group():
12402 with q.indent(2):
12403 q.breakable()
12404 q.text("xid = ");
12405 if self.xid != None:
12406 q.text("%#x" % self.xid)
12407 else:
12408 q.text('None')
12409 q.text(","); q.breakable()
12410 q.text("code = ");
12411 q.text("%#x" % self.code)
12412 q.text(","); q.breakable()
12413 q.text("data = ");
12414 q.pp(self.data)
12415 q.breakable()
12416 q.text('}')
12417
Rich Lane7dcdf022013-12-11 14:45:27 -080012418error_msg.subtypes[9] = queue_op_failed_error_msg
12419
12420class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012421 version = 4
12422 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012423 stats_type = 5
12424
12425 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012426 if xid != None:
12427 self.xid = xid
12428 else:
12429 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012430 if flags != None:
12431 self.flags = flags
12432 else:
12433 self.flags = 0
12434 if entries != None:
12435 self.entries = entries
12436 else:
12437 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012438 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012439
12440 def pack(self):
12441 packed = []
12442 packed.append(struct.pack("!B", self.version))
12443 packed.append(struct.pack("!B", self.type))
12444 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12445 packed.append(struct.pack("!L", self.xid))
12446 packed.append(struct.pack("!H", self.stats_type))
12447 packed.append(struct.pack("!H", self.flags))
12448 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012449 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012450 length = sum([len(x) for x in packed])
12451 packed[2] = struct.pack("!H", length)
12452 return ''.join(packed)
12453
12454 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012455 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012456 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012457 _version = reader.read("!B")[0]
12458 assert(_version == 4)
12459 _type = reader.read("!B")[0]
12460 assert(_type == 19)
12461 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012462 orig_reader = reader
12463 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012464 obj.xid = reader.read("!L")[0]
12465 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012466 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012467 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012468 reader.skip(4)
12469 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
12470 return obj
12471
12472 def __eq__(self, other):
12473 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012474 if self.xid != other.xid: return False
12475 if self.flags != other.flags: return False
12476 if self.entries != other.entries: return False
12477 return True
12478
Rich Lanec2ee4b82013-04-24 17:12:38 -070012479 def pretty_print(self, q):
12480 q.text("queue_stats_reply {")
12481 with q.group():
12482 with q.indent(2):
12483 q.breakable()
12484 q.text("xid = ");
12485 if self.xid != None:
12486 q.text("%#x" % self.xid)
12487 else:
12488 q.text('None')
12489 q.text(","); q.breakable()
12490 q.text("flags = ");
12491 q.text("%#x" % self.flags)
12492 q.text(","); q.breakable()
12493 q.text("entries = ");
12494 q.pp(self.entries)
12495 q.breakable()
12496 q.text('}')
12497
Rich Lane7dcdf022013-12-11 14:45:27 -080012498stats_reply.subtypes[5] = queue_stats_reply
12499
12500class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012501 version = 4
12502 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012503 stats_type = 5
12504
12505 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012506 if xid != None:
12507 self.xid = xid
12508 else:
12509 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012510 if flags != None:
12511 self.flags = flags
12512 else:
12513 self.flags = 0
12514 if port_no != None:
12515 self.port_no = port_no
12516 else:
12517 self.port_no = 0
12518 if queue_id != None:
12519 self.queue_id = queue_id
12520 else:
12521 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012522 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012523
12524 def pack(self):
12525 packed = []
12526 packed.append(struct.pack("!B", self.version))
12527 packed.append(struct.pack("!B", self.type))
12528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12529 packed.append(struct.pack("!L", self.xid))
12530 packed.append(struct.pack("!H", self.stats_type))
12531 packed.append(struct.pack("!H", self.flags))
12532 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012533 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012534 packed.append(struct.pack("!L", self.queue_id))
12535 length = sum([len(x) for x in packed])
12536 packed[2] = struct.pack("!H", length)
12537 return ''.join(packed)
12538
12539 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012540 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012541 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012542 _version = reader.read("!B")[0]
12543 assert(_version == 4)
12544 _type = reader.read("!B")[0]
12545 assert(_type == 18)
12546 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012547 orig_reader = reader
12548 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012549 obj.xid = reader.read("!L")[0]
12550 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012551 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070012552 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012553 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012554 obj.port_no = util.unpack_port_no(reader)
12555 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012556 return obj
12557
12558 def __eq__(self, other):
12559 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012560 if self.xid != other.xid: return False
12561 if self.flags != other.flags: return False
12562 if self.port_no != other.port_no: return False
12563 if self.queue_id != other.queue_id: return False
12564 return True
12565
Rich Lanec2ee4b82013-04-24 17:12:38 -070012566 def pretty_print(self, q):
12567 q.text("queue_stats_request {")
12568 with q.group():
12569 with q.indent(2):
12570 q.breakable()
12571 q.text("xid = ");
12572 if self.xid != None:
12573 q.text("%#x" % self.xid)
12574 else:
12575 q.text('None')
12576 q.text(","); q.breakable()
12577 q.text("flags = ");
12578 q.text("%#x" % self.flags)
12579 q.text(","); q.breakable()
12580 q.text("port_no = ");
12581 q.text(util.pretty_port(self.port_no))
12582 q.text(","); q.breakable()
12583 q.text("queue_id = ");
12584 q.text("%#x" % self.queue_id)
12585 q.breakable()
12586 q.text('}')
12587
Rich Lane7dcdf022013-12-11 14:45:27 -080012588stats_request.subtypes[5] = queue_stats_request
12589
12590class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012591 version = 4
12592 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070012593
Rich Laned9e3f7b2013-11-04 11:40:43 -080012594 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012595 if xid != None:
12596 self.xid = xid
12597 else:
12598 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080012599 if role != None:
12600 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070012601 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080012602 self.role = 0
12603 if generation_id != None:
12604 self.generation_id = generation_id
12605 else:
12606 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012607 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012608
12609 def pack(self):
12610 packed = []
12611 packed.append(struct.pack("!B", self.version))
12612 packed.append(struct.pack("!B", self.type))
12613 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12614 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080012615 packed.append(struct.pack("!L", self.role))
12616 packed.append('\x00' * 4)
12617 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012618 length = sum([len(x) for x in packed])
12619 packed[2] = struct.pack("!H", length)
12620 return ''.join(packed)
12621
12622 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012623 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012624 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012625 _version = reader.read("!B")[0]
12626 assert(_version == 4)
12627 _type = reader.read("!B")[0]
12628 assert(_type == 25)
12629 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012630 orig_reader = reader
12631 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012632 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080012633 obj.role = reader.read("!L")[0]
12634 reader.skip(4)
12635 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012636 return obj
12637
12638 def __eq__(self, other):
12639 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012640 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080012641 if self.role != other.role: return False
12642 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012643 return True
12644
Rich Lanec2ee4b82013-04-24 17:12:38 -070012645 def pretty_print(self, q):
12646 q.text("role_reply {")
12647 with q.group():
12648 with q.indent(2):
12649 q.breakable()
12650 q.text("xid = ");
12651 if self.xid != None:
12652 q.text("%#x" % self.xid)
12653 else:
12654 q.text('None')
12655 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080012656 q.text("role = ");
12657 q.text("%#x" % self.role)
12658 q.text(","); q.breakable()
12659 q.text("generation_id = ");
12660 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012661 q.breakable()
12662 q.text('}')
12663
Rich Lane7dcdf022013-12-11 14:45:27 -080012664message.subtypes[25] = role_reply
12665
12666class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012667 version = 4
12668 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070012669
12670 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012671 if xid != None:
12672 self.xid = xid
12673 else:
12674 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012675 if role != None:
12676 self.role = role
12677 else:
12678 self.role = 0
12679 if generation_id != None:
12680 self.generation_id = generation_id
12681 else:
12682 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012683 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012684
12685 def pack(self):
12686 packed = []
12687 packed.append(struct.pack("!B", self.version))
12688 packed.append(struct.pack("!B", self.type))
12689 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12690 packed.append(struct.pack("!L", self.xid))
12691 packed.append(struct.pack("!L", self.role))
12692 packed.append('\x00' * 4)
12693 packed.append(struct.pack("!Q", self.generation_id))
12694 length = sum([len(x) for x in packed])
12695 packed[2] = struct.pack("!H", length)
12696 return ''.join(packed)
12697
12698 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012699 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012700 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012701 _version = reader.read("!B")[0]
12702 assert(_version == 4)
12703 _type = reader.read("!B")[0]
12704 assert(_type == 24)
12705 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012706 orig_reader = reader
12707 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012708 obj.xid = reader.read("!L")[0]
12709 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012710 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012711 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012712 return obj
12713
12714 def __eq__(self, other):
12715 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012716 if self.xid != other.xid: return False
12717 if self.role != other.role: return False
12718 if self.generation_id != other.generation_id: return False
12719 return True
12720
Rich Lanec2ee4b82013-04-24 17:12:38 -070012721 def pretty_print(self, q):
12722 q.text("role_request {")
12723 with q.group():
12724 with q.indent(2):
12725 q.breakable()
12726 q.text("xid = ");
12727 if self.xid != None:
12728 q.text("%#x" % self.xid)
12729 else:
12730 q.text('None')
12731 q.text(","); q.breakable()
12732 q.text("role = ");
12733 q.text("%#x" % self.role)
12734 q.text(","); q.breakable()
12735 q.text("generation_id = ");
12736 q.text("%#x" % self.generation_id)
12737 q.breakable()
12738 q.text('}')
12739
Rich Lane7dcdf022013-12-11 14:45:27 -080012740message.subtypes[24] = role_request
12741
12742class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012743 version = 4
12744 type = 1
12745 err_type = 11
12746
12747 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012748 if xid != None:
12749 self.xid = xid
12750 else:
12751 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012752 if code != None:
12753 self.code = code
12754 else:
12755 self.code = 0
12756 if data != None:
12757 self.data = data
12758 else:
12759 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012760 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012761
12762 def pack(self):
12763 packed = []
12764 packed.append(struct.pack("!B", self.version))
12765 packed.append(struct.pack("!B", self.type))
12766 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12767 packed.append(struct.pack("!L", self.xid))
12768 packed.append(struct.pack("!H", self.err_type))
12769 packed.append(struct.pack("!H", self.code))
12770 packed.append(self.data)
12771 length = sum([len(x) for x in packed])
12772 packed[2] = struct.pack("!H", length)
12773 return ''.join(packed)
12774
12775 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012776 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012777 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012778 _version = reader.read("!B")[0]
12779 assert(_version == 4)
12780 _type = reader.read("!B")[0]
12781 assert(_type == 1)
12782 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012783 orig_reader = reader
12784 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070012785 obj.xid = reader.read("!L")[0]
12786 _err_type = reader.read("!H")[0]
12787 assert(_err_type == 11)
12788 obj.code = reader.read("!H")[0]
12789 obj.data = str(reader.read_all())
12790 return obj
12791
12792 def __eq__(self, other):
12793 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012794 if self.xid != other.xid: return False
12795 if self.code != other.code: return False
12796 if self.data != other.data: return False
12797 return True
12798
Rich Lane6f4978c2013-10-20 21:33:52 -070012799 def pretty_print(self, q):
12800 q.text("role_request_failed_error_msg {")
12801 with q.group():
12802 with q.indent(2):
12803 q.breakable()
12804 q.text("xid = ");
12805 if self.xid != None:
12806 q.text("%#x" % self.xid)
12807 else:
12808 q.text('None')
12809 q.text(","); q.breakable()
12810 q.text("code = ");
12811 q.text("%#x" % self.code)
12812 q.text(","); q.breakable()
12813 q.text("data = ");
12814 q.pp(self.data)
12815 q.breakable()
12816 q.text('}')
12817
Rich Lane7dcdf022013-12-11 14:45:27 -080012818error_msg.subtypes[11] = role_request_failed_error_msg
12819
12820class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012821 version = 4
12822 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070012823
12824 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012825 if xid != None:
12826 self.xid = xid
12827 else:
12828 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012829 if flags != None:
12830 self.flags = flags
12831 else:
12832 self.flags = 0
12833 if miss_send_len != None:
12834 self.miss_send_len = miss_send_len
12835 else:
12836 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012837 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012838
12839 def pack(self):
12840 packed = []
12841 packed.append(struct.pack("!B", self.version))
12842 packed.append(struct.pack("!B", self.type))
12843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12844 packed.append(struct.pack("!L", self.xid))
12845 packed.append(struct.pack("!H", self.flags))
12846 packed.append(struct.pack("!H", self.miss_send_len))
12847 length = sum([len(x) for x in packed])
12848 packed[2] = struct.pack("!H", length)
12849 return ''.join(packed)
12850
12851 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012852 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012853 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070012854 _version = reader.read("!B")[0]
12855 assert(_version == 4)
12856 _type = reader.read("!B")[0]
12857 assert(_type == 9)
12858 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012859 orig_reader = reader
12860 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070012861 obj.xid = reader.read("!L")[0]
12862 obj.flags = reader.read("!H")[0]
12863 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012864 return obj
12865
12866 def __eq__(self, other):
12867 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012868 if self.xid != other.xid: return False
12869 if self.flags != other.flags: return False
12870 if self.miss_send_len != other.miss_send_len: return False
12871 return True
12872
Rich Lanec2ee4b82013-04-24 17:12:38 -070012873 def pretty_print(self, q):
12874 q.text("set_config {")
12875 with q.group():
12876 with q.indent(2):
12877 q.breakable()
12878 q.text("xid = ");
12879 if self.xid != None:
12880 q.text("%#x" % self.xid)
12881 else:
12882 q.text('None')
12883 q.text(","); q.breakable()
12884 q.text("flags = ");
12885 q.text("%#x" % self.flags)
12886 q.text(","); q.breakable()
12887 q.text("miss_send_len = ");
12888 q.text("%#x" % self.miss_send_len)
12889 q.breakable()
12890 q.text('}')
12891
Rich Lane7dcdf022013-12-11 14:45:27 -080012892message.subtypes[9] = set_config
12893
12894class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012895 version = 4
12896 type = 1
12897 err_type = 10
12898
12899 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012900 if xid != None:
12901 self.xid = xid
12902 else:
12903 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012904 if code != None:
12905 self.code = code
12906 else:
12907 self.code = 0
12908 if data != None:
12909 self.data = data
12910 else:
12911 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012912 return
Rich Lane6f4978c2013-10-20 21:33:52 -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.err_type))
12921 packed.append(struct.pack("!H", self.code))
12922 packed.append(self.data)
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 Lane6f4978c2013-10-20 21:33:52 -070012929 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012930 _version = reader.read("!B")[0]
12931 assert(_version == 4)
12932 _type = reader.read("!B")[0]
12933 assert(_type == 1)
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))
Rich Lane6f4978c2013-10-20 21:33:52 -070012937 obj.xid = reader.read("!L")[0]
12938 _err_type = reader.read("!H")[0]
12939 assert(_err_type == 10)
12940 obj.code = reader.read("!H")[0]
12941 obj.data = str(reader.read_all())
12942 return obj
12943
12944 def __eq__(self, other):
12945 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012946 if self.xid != other.xid: return False
12947 if self.code != other.code: return False
12948 if self.data != other.data: return False
12949 return True
12950
Rich Lane6f4978c2013-10-20 21:33:52 -070012951 def pretty_print(self, q):
12952 q.text("switch_config_failed_error_msg {")
12953 with q.group():
12954 with q.indent(2):
12955 q.breakable()
12956 q.text("xid = ");
12957 if self.xid != None:
12958 q.text("%#x" % self.xid)
12959 else:
12960 q.text('None')
12961 q.text(","); q.breakable()
12962 q.text("code = ");
12963 q.text("%#x" % self.code)
12964 q.text(","); q.breakable()
12965 q.text("data = ");
12966 q.pp(self.data)
12967 q.breakable()
12968 q.text('}')
12969
Rich Lane7dcdf022013-12-11 14:45:27 -080012970error_msg.subtypes[10] = switch_config_failed_error_msg
12971
12972class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012973 version = 4
12974 type = 1
12975 err_type = 13
12976
12977 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012978 if xid != None:
12979 self.xid = xid
12980 else:
12981 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012982 if code != None:
12983 self.code = code
12984 else:
12985 self.code = 0
12986 if data != None:
12987 self.data = data
12988 else:
12989 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012990 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012991
12992 def pack(self):
12993 packed = []
12994 packed.append(struct.pack("!B", self.version))
12995 packed.append(struct.pack("!B", self.type))
12996 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12997 packed.append(struct.pack("!L", self.xid))
12998 packed.append(struct.pack("!H", self.err_type))
12999 packed.append(struct.pack("!H", self.code))
13000 packed.append(self.data)
13001 length = sum([len(x) for x in packed])
13002 packed[2] = struct.pack("!H", length)
13003 return ''.join(packed)
13004
13005 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013006 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013007 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013008 _version = reader.read("!B")[0]
13009 assert(_version == 4)
13010 _type = reader.read("!B")[0]
13011 assert(_type == 1)
13012 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013013 orig_reader = reader
13014 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013015 obj.xid = reader.read("!L")[0]
13016 _err_type = reader.read("!H")[0]
13017 assert(_err_type == 13)
13018 obj.code = reader.read("!H")[0]
13019 obj.data = str(reader.read_all())
13020 return obj
13021
13022 def __eq__(self, other):
13023 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013024 if self.xid != other.xid: return False
13025 if self.code != other.code: return False
13026 if self.data != other.data: return False
13027 return True
13028
Rich Lane6f4978c2013-10-20 21:33:52 -070013029 def pretty_print(self, q):
13030 q.text("table_features_failed_error_msg {")
13031 with q.group():
13032 with q.indent(2):
13033 q.breakable()
13034 q.text("xid = ");
13035 if self.xid != None:
13036 q.text("%#x" % self.xid)
13037 else:
13038 q.text('None')
13039 q.text(","); q.breakable()
13040 q.text("code = ");
13041 q.text("%#x" % self.code)
13042 q.text(","); q.breakable()
13043 q.text("data = ");
13044 q.pp(self.data)
13045 q.breakable()
13046 q.text('}')
13047
Rich Lane7dcdf022013-12-11 14:45:27 -080013048error_msg.subtypes[13] = table_features_failed_error_msg
13049
13050class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013051 version = 4
13052 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013053 stats_type = 12
13054
13055 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013056 if xid != None:
13057 self.xid = xid
13058 else:
13059 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013060 if flags != None:
13061 self.flags = flags
13062 else:
13063 self.flags = 0
13064 if entries != None:
13065 self.entries = entries
13066 else:
13067 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013068 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013069
13070 def pack(self):
13071 packed = []
13072 packed.append(struct.pack("!B", self.version))
13073 packed.append(struct.pack("!B", self.type))
13074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13075 packed.append(struct.pack("!L", self.xid))
13076 packed.append(struct.pack("!H", self.stats_type))
13077 packed.append(struct.pack("!H", self.flags))
13078 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013079 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013080 length = sum([len(x) for x in packed])
13081 packed[2] = struct.pack("!H", length)
13082 return ''.join(packed)
13083
13084 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013085 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013086 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013087 _version = reader.read("!B")[0]
13088 assert(_version == 4)
13089 _type = reader.read("!B")[0]
13090 assert(_type == 19)
13091 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013092 orig_reader = reader
13093 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013094 obj.xid = reader.read("!L")[0]
13095 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013096 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013097 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013098 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013099 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013100 return obj
13101
13102 def __eq__(self, other):
13103 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013104 if self.xid != other.xid: return False
13105 if self.flags != other.flags: return False
13106 if self.entries != other.entries: return False
13107 return True
13108
Rich Lanec2ee4b82013-04-24 17:12:38 -070013109 def pretty_print(self, q):
13110 q.text("table_features_stats_reply {")
13111 with q.group():
13112 with q.indent(2):
13113 q.breakable()
13114 q.text("xid = ");
13115 if self.xid != None:
13116 q.text("%#x" % self.xid)
13117 else:
13118 q.text('None')
13119 q.text(","); q.breakable()
13120 q.text("flags = ");
13121 q.text("%#x" % self.flags)
13122 q.text(","); q.breakable()
13123 q.text("entries = ");
13124 q.pp(self.entries)
13125 q.breakable()
13126 q.text('}')
13127
Rich Lane7dcdf022013-12-11 14:45:27 -080013128stats_reply.subtypes[12] = table_features_stats_reply
13129
13130class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013131 version = 4
13132 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013133 stats_type = 12
13134
13135 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013136 if xid != None:
13137 self.xid = xid
13138 else:
13139 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013140 if flags != None:
13141 self.flags = flags
13142 else:
13143 self.flags = 0
13144 if entries != None:
13145 self.entries = entries
13146 else:
13147 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013148 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013149
13150 def pack(self):
13151 packed = []
13152 packed.append(struct.pack("!B", self.version))
13153 packed.append(struct.pack("!B", self.type))
13154 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13155 packed.append(struct.pack("!L", self.xid))
13156 packed.append(struct.pack("!H", self.stats_type))
13157 packed.append(struct.pack("!H", self.flags))
13158 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013159 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013160 length = sum([len(x) for x in packed])
13161 packed[2] = struct.pack("!H", length)
13162 return ''.join(packed)
13163
13164 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013165 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013166 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013167 _version = reader.read("!B")[0]
13168 assert(_version == 4)
13169 _type = reader.read("!B")[0]
13170 assert(_type == 18)
13171 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013172 orig_reader = reader
13173 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013174 obj.xid = reader.read("!L")[0]
13175 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013176 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070013177 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013178 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013179 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013180 return obj
13181
13182 def __eq__(self, other):
13183 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013184 if self.xid != other.xid: return False
13185 if self.flags != other.flags: return False
13186 if self.entries != other.entries: return False
13187 return True
13188
Rich Lanec2ee4b82013-04-24 17:12:38 -070013189 def pretty_print(self, q):
13190 q.text("table_features_stats_request {")
13191 with q.group():
13192 with q.indent(2):
13193 q.breakable()
13194 q.text("xid = ");
13195 if self.xid != None:
13196 q.text("%#x" % self.xid)
13197 else:
13198 q.text('None')
13199 q.text(","); q.breakable()
13200 q.text("flags = ");
13201 q.text("%#x" % self.flags)
13202 q.text(","); q.breakable()
13203 q.text("entries = ");
13204 q.pp(self.entries)
13205 q.breakable()
13206 q.text('}')
13207
Rich Lane7dcdf022013-12-11 14:45:27 -080013208stats_request.subtypes[12] = table_features_stats_request
13209
13210class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013211 version = 4
13212 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070013213
13214 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013215 if xid != None:
13216 self.xid = xid
13217 else:
13218 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013219 if table_id != None:
13220 self.table_id = table_id
13221 else:
13222 self.table_id = 0
13223 if config != None:
13224 self.config = config
13225 else:
13226 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013227 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013228
13229 def pack(self):
13230 packed = []
13231 packed.append(struct.pack("!B", self.version))
13232 packed.append(struct.pack("!B", self.type))
13233 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13234 packed.append(struct.pack("!L", self.xid))
13235 packed.append(struct.pack("!B", self.table_id))
13236 packed.append('\x00' * 3)
13237 packed.append(struct.pack("!L", self.config))
13238 length = sum([len(x) for x in packed])
13239 packed[2] = struct.pack("!H", length)
13240 return ''.join(packed)
13241
13242 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013243 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013244 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013245 _version = reader.read("!B")[0]
13246 assert(_version == 4)
13247 _type = reader.read("!B")[0]
13248 assert(_type == 17)
13249 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013250 orig_reader = reader
13251 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013252 obj.xid = reader.read("!L")[0]
13253 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013254 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070013255 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013256 return obj
13257
13258 def __eq__(self, other):
13259 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013260 if self.xid != other.xid: return False
13261 if self.table_id != other.table_id: return False
13262 if self.config != other.config: return False
13263 return True
13264
Rich Lanec2ee4b82013-04-24 17:12:38 -070013265 def pretty_print(self, q):
13266 q.text("table_mod {")
13267 with q.group():
13268 with q.indent(2):
13269 q.breakable()
13270 q.text("xid = ");
13271 if self.xid != None:
13272 q.text("%#x" % self.xid)
13273 else:
13274 q.text('None')
13275 q.text(","); q.breakable()
13276 q.text("table_id = ");
13277 q.text("%#x" % self.table_id)
13278 q.text(","); q.breakable()
13279 q.text("config = ");
13280 q.text("%#x" % self.config)
13281 q.breakable()
13282 q.text('}')
13283
Rich Lane7dcdf022013-12-11 14:45:27 -080013284message.subtypes[17] = table_mod
13285
13286class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013287 version = 4
13288 type = 1
13289 err_type = 8
13290
13291 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013292 if xid != None:
13293 self.xid = xid
13294 else:
13295 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013296 if code != None:
13297 self.code = code
13298 else:
13299 self.code = 0
13300 if data != None:
13301 self.data = data
13302 else:
13303 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013304 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013305
13306 def pack(self):
13307 packed = []
13308 packed.append(struct.pack("!B", self.version))
13309 packed.append(struct.pack("!B", self.type))
13310 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13311 packed.append(struct.pack("!L", self.xid))
13312 packed.append(struct.pack("!H", self.err_type))
13313 packed.append(struct.pack("!H", self.code))
13314 packed.append(self.data)
13315 length = sum([len(x) for x in packed])
13316 packed[2] = struct.pack("!H", length)
13317 return ''.join(packed)
13318
13319 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013320 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013321 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013322 _version = reader.read("!B")[0]
13323 assert(_version == 4)
13324 _type = reader.read("!B")[0]
13325 assert(_type == 1)
13326 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013327 orig_reader = reader
13328 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070013329 obj.xid = reader.read("!L")[0]
13330 _err_type = reader.read("!H")[0]
13331 assert(_err_type == 8)
13332 obj.code = reader.read("!H")[0]
13333 obj.data = str(reader.read_all())
13334 return obj
13335
13336 def __eq__(self, other):
13337 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013338 if self.xid != other.xid: return False
13339 if self.code != other.code: return False
13340 if self.data != other.data: return False
13341 return True
13342
Rich Lane6f4978c2013-10-20 21:33:52 -070013343 def pretty_print(self, q):
13344 q.text("table_mod_failed_error_msg {")
13345 with q.group():
13346 with q.indent(2):
13347 q.breakable()
13348 q.text("xid = ");
13349 if self.xid != None:
13350 q.text("%#x" % self.xid)
13351 else:
13352 q.text('None')
13353 q.text(","); q.breakable()
13354 q.text("code = ");
13355 q.text("%#x" % self.code)
13356 q.text(","); q.breakable()
13357 q.text("data = ");
13358 q.pp(self.data)
13359 q.breakable()
13360 q.text('}')
13361
Rich Lane7dcdf022013-12-11 14:45:27 -080013362error_msg.subtypes[8] = table_mod_failed_error_msg
13363
13364class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013365 version = 4
13366 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013367 stats_type = 3
13368
13369 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013370 if xid != None:
13371 self.xid = xid
13372 else:
13373 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013374 if flags != None:
13375 self.flags = flags
13376 else:
13377 self.flags = 0
13378 if entries != None:
13379 self.entries = entries
13380 else:
13381 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013382 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013383
13384 def pack(self):
13385 packed = []
13386 packed.append(struct.pack("!B", self.version))
13387 packed.append(struct.pack("!B", self.type))
13388 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13389 packed.append(struct.pack("!L", self.xid))
13390 packed.append(struct.pack("!H", self.stats_type))
13391 packed.append(struct.pack("!H", self.flags))
13392 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013393 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013394 length = sum([len(x) for x in packed])
13395 packed[2] = struct.pack("!H", length)
13396 return ''.join(packed)
13397
13398 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013399 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013400 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013401 _version = reader.read("!B")[0]
13402 assert(_version == 4)
13403 _type = reader.read("!B")[0]
13404 assert(_type == 19)
13405 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013406 orig_reader = reader
13407 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013408 obj.xid = reader.read("!L")[0]
13409 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013410 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013411 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013412 reader.skip(4)
13413 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
13414 return obj
13415
13416 def __eq__(self, other):
13417 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013418 if self.xid != other.xid: return False
13419 if self.flags != other.flags: return False
13420 if self.entries != other.entries: return False
13421 return True
13422
Rich Lanec2ee4b82013-04-24 17:12:38 -070013423 def pretty_print(self, q):
13424 q.text("table_stats_reply {")
13425 with q.group():
13426 with q.indent(2):
13427 q.breakable()
13428 q.text("xid = ");
13429 if self.xid != None:
13430 q.text("%#x" % self.xid)
13431 else:
13432 q.text('None')
13433 q.text(","); q.breakable()
13434 q.text("flags = ");
13435 q.text("%#x" % self.flags)
13436 q.text(","); q.breakable()
13437 q.text("entries = ");
13438 q.pp(self.entries)
13439 q.breakable()
13440 q.text('}')
13441
Rich Lane7dcdf022013-12-11 14:45:27 -080013442stats_reply.subtypes[3] = table_stats_reply
13443
13444class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013445 version = 4
13446 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013447 stats_type = 3
13448
13449 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013450 if xid != None:
13451 self.xid = xid
13452 else:
13453 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013454 if flags != None:
13455 self.flags = flags
13456 else:
13457 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013458 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013459
13460 def pack(self):
13461 packed = []
13462 packed.append(struct.pack("!B", self.version))
13463 packed.append(struct.pack("!B", self.type))
13464 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13465 packed.append(struct.pack("!L", self.xid))
13466 packed.append(struct.pack("!H", self.stats_type))
13467 packed.append(struct.pack("!H", self.flags))
13468 packed.append('\x00' * 4)
13469 length = sum([len(x) for x in packed])
13470 packed[2] = struct.pack("!H", length)
13471 return ''.join(packed)
13472
13473 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013474 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013475 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013476 _version = reader.read("!B")[0]
13477 assert(_version == 4)
13478 _type = reader.read("!B")[0]
13479 assert(_type == 18)
13480 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013481 orig_reader = reader
13482 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070013483 obj.xid = reader.read("!L")[0]
13484 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013485 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070013486 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013487 reader.skip(4)
13488 return obj
13489
13490 def __eq__(self, other):
13491 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013492 if self.xid != other.xid: return False
13493 if self.flags != other.flags: return False
13494 return True
13495
Rich Lanec2ee4b82013-04-24 17:12:38 -070013496 def pretty_print(self, q):
13497 q.text("table_stats_request {")
13498 with q.group():
13499 with q.indent(2):
13500 q.breakable()
13501 q.text("xid = ");
13502 if self.xid != None:
13503 q.text("%#x" % self.xid)
13504 else:
13505 q.text('None')
13506 q.text(","); q.breakable()
13507 q.text("flags = ");
13508 q.text("%#x" % self.flags)
13509 q.breakable()
13510 q.text('}')
13511
Rich Lane7dcdf022013-12-11 14:45:27 -080013512stats_request.subtypes[3] = table_stats_request
13513
Rich Lanec2ee4b82013-04-24 17:12:38 -070013514
13515def parse_header(buf):
13516 if len(buf) < 8:
13517 raise loxi.ProtocolError("too short to be an OpenFlow message")
13518 return struct.unpack_from("!BBHL", buf)
13519
13520def parse_message(buf):
13521 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070013522 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
13523 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013524 if len(buf) != msg_len:
13525 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080013526 return message.unpack(loxi.generic_util.OFReader(buf))