blob: 85db91d4954377ccf7380d4552e5571e9d2ee299 [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
Harshmeet Singh1db46332014-10-14 16:29:13 -070012import bsn_tlv
13import meter_band
Rich Lane7dcdf022013-12-11 14:45:27 -080014import instruction
15import oxm
Harshmeet Singh1db46332014-10-14 16:29:13 -070016import common
Rich Lane7dcdf022013-12-11 14:45:27 -080017import instruction_id
Harshmeet Singh1db46332014-10-14 16:29:13 -070018import action
19import message
20import action_id
Rich Lanec2ee4b82013-04-24 17:12:38 -070021import util
22import loxi.generic_util
23
Rich Lane7dcdf022013-12-11 14:45:27 -080024class message(loxi.OFObject):
25 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070026
Rich Lane95f7fc92014-01-27 17:08:16 -080027 version = 4
28
29 def __init__(self, type=None, xid=None):
30 if type != None:
31 self.type = type
32 else:
33 self.type = 0
34 if xid != None:
35 self.xid = xid
36 else:
37 self.xid = None
38 return
39
40 def pack(self):
41 packed = []
42 packed.append(struct.pack("!B", self.version))
43 packed.append(struct.pack("!B", self.type))
44 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
45 packed.append(struct.pack("!L", self.xid))
46 length = sum([len(x) for x in packed])
47 packed[2] = struct.pack("!H", length)
48 return ''.join(packed)
49
Rich Lane7dcdf022013-12-11 14:45:27 -080050 @staticmethod
51 def unpack(reader):
52 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080053 subclass = message.subtypes.get(subtype)
54 if subclass:
55 return subclass.unpack(reader)
56
57 obj = message()
58 _version = reader.read("!B")[0]
59 assert(_version == 4)
60 obj.type = reader.read("!B")[0]
61 _length = reader.read("!H")[0]
62 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080063 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080064 obj.xid = reader.read("!L")[0]
65 return obj
66
67 def __eq__(self, other):
68 if type(self) != type(other): return False
69 if self.type != other.type: return False
70 if self.xid != other.xid: return False
71 return True
72
73 def pretty_print(self, q):
74 q.text("message {")
75 with q.group():
76 with q.indent(2):
77 q.breakable()
78 q.text("xid = ");
79 if self.xid != None:
80 q.text("%#x" % self.xid)
81 else:
82 q.text('None')
83 q.breakable()
84 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080085
86
87class stats_reply(message):
88 subtypes = {}
89
Rich Lane95f7fc92014-01-27 17:08:16 -080090 version = 4
91 type = 19
92
93 def __init__(self, xid=None, stats_type=None, flags=None):
94 if xid != None:
95 self.xid = xid
96 else:
97 self.xid = None
98 if stats_type != None:
99 self.stats_type = stats_type
100 else:
101 self.stats_type = 0
102 if flags != None:
103 self.flags = flags
104 else:
105 self.flags = 0
106 return
107
108 def pack(self):
109 packed = []
110 packed.append(struct.pack("!B", self.version))
111 packed.append(struct.pack("!B", self.type))
112 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
113 packed.append(struct.pack("!L", self.xid))
114 packed.append(struct.pack("!H", self.stats_type))
115 packed.append(struct.pack("!H", self.flags))
116 packed.append('\x00' * 4)
117 length = sum([len(x) for x in packed])
118 packed[2] = struct.pack("!H", length)
119 return ''.join(packed)
120
Rich Lane7dcdf022013-12-11 14:45:27 -0800121 @staticmethod
122 def unpack(reader):
123 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800124 subclass = stats_reply.subtypes.get(subtype)
125 if subclass:
126 return subclass.unpack(reader)
127
128 obj = stats_reply()
129 _version = reader.read("!B")[0]
130 assert(_version == 4)
131 _type = reader.read("!B")[0]
132 assert(_type == 19)
133 _length = reader.read("!H")[0]
134 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800135 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800136 obj.xid = reader.read("!L")[0]
137 obj.stats_type = reader.read("!H")[0]
138 obj.flags = reader.read("!H")[0]
139 reader.skip(4)
140 return obj
141
142 def __eq__(self, other):
143 if type(self) != type(other): return False
144 if self.xid != other.xid: return False
145 if self.stats_type != other.stats_type: return False
146 if self.flags != other.flags: return False
147 return True
148
149 def pretty_print(self, q):
150 q.text("stats_reply {")
151 with q.group():
152 with q.indent(2):
153 q.breakable()
154 q.text("xid = ");
155 if self.xid != None:
156 q.text("%#x" % self.xid)
157 else:
158 q.text('None')
159 q.text(","); q.breakable()
160 q.text("flags = ");
161 q.text("%#x" % self.flags)
162 q.breakable()
163 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800164
165message.subtypes[19] = stats_reply
166
167class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700168 version = 4
169 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700170 stats_type = 2
171
172 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800173 if xid != None:
174 self.xid = xid
175 else:
176 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700177 if flags != None:
178 self.flags = flags
179 else:
180 self.flags = 0
181 if packet_count != None:
182 self.packet_count = packet_count
183 else:
184 self.packet_count = 0
185 if byte_count != None:
186 self.byte_count = byte_count
187 else:
188 self.byte_count = 0
189 if flow_count != None:
190 self.flow_count = flow_count
191 else:
192 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800193 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700194
195 def pack(self):
196 packed = []
197 packed.append(struct.pack("!B", self.version))
198 packed.append(struct.pack("!B", self.type))
199 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
200 packed.append(struct.pack("!L", self.xid))
201 packed.append(struct.pack("!H", self.stats_type))
202 packed.append(struct.pack("!H", self.flags))
203 packed.append('\x00' * 4)
204 packed.append(struct.pack("!Q", self.packet_count))
205 packed.append(struct.pack("!Q", self.byte_count))
206 packed.append(struct.pack("!L", self.flow_count))
207 packed.append('\x00' * 4)
208 length = sum([len(x) for x in packed])
209 packed[2] = struct.pack("!H", length)
210 return ''.join(packed)
211
212 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800213 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700214 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700215 _version = reader.read("!B")[0]
216 assert(_version == 4)
217 _type = reader.read("!B")[0]
218 assert(_type == 19)
219 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800220 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800221 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700222 obj.xid = reader.read("!L")[0]
223 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700224 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700225 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700226 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700227 obj.packet_count = reader.read("!Q")[0]
228 obj.byte_count = reader.read("!Q")[0]
229 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700230 reader.skip(4)
231 return obj
232
233 def __eq__(self, other):
234 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700235 if self.xid != other.xid: return False
236 if self.flags != other.flags: return False
237 if self.packet_count != other.packet_count: return False
238 if self.byte_count != other.byte_count: return False
239 if self.flow_count != other.flow_count: return False
240 return True
241
Rich Lanec2ee4b82013-04-24 17:12:38 -0700242 def pretty_print(self, q):
243 q.text("aggregate_stats_reply {")
244 with q.group():
245 with q.indent(2):
246 q.breakable()
247 q.text("xid = ");
248 if self.xid != None:
249 q.text("%#x" % self.xid)
250 else:
251 q.text('None')
252 q.text(","); q.breakable()
253 q.text("flags = ");
254 q.text("%#x" % self.flags)
255 q.text(","); q.breakable()
256 q.text("packet_count = ");
257 q.text("%#x" % self.packet_count)
258 q.text(","); q.breakable()
259 q.text("byte_count = ");
260 q.text("%#x" % self.byte_count)
261 q.text(","); q.breakable()
262 q.text("flow_count = ");
263 q.text("%#x" % self.flow_count)
264 q.breakable()
265 q.text('}')
266
Rich Lane7dcdf022013-12-11 14:45:27 -0800267stats_reply.subtypes[2] = aggregate_stats_reply
268
269class stats_request(message):
270 subtypes = {}
271
Rich Lane95f7fc92014-01-27 17:08:16 -0800272 version = 4
273 type = 18
274
275 def __init__(self, xid=None, stats_type=None, flags=None):
276 if xid != None:
277 self.xid = xid
278 else:
279 self.xid = None
280 if stats_type != None:
281 self.stats_type = stats_type
282 else:
283 self.stats_type = 0
284 if flags != None:
285 self.flags = flags
286 else:
287 self.flags = 0
288 return
289
290 def pack(self):
291 packed = []
292 packed.append(struct.pack("!B", self.version))
293 packed.append(struct.pack("!B", self.type))
294 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
295 packed.append(struct.pack("!L", self.xid))
296 packed.append(struct.pack("!H", self.stats_type))
297 packed.append(struct.pack("!H", self.flags))
298 packed.append('\x00' * 4)
299 length = sum([len(x) for x in packed])
300 packed[2] = struct.pack("!H", length)
301 return ''.join(packed)
302
Rich Lane7dcdf022013-12-11 14:45:27 -0800303 @staticmethod
304 def unpack(reader):
305 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800306 subclass = stats_request.subtypes.get(subtype)
307 if subclass:
308 return subclass.unpack(reader)
309
310 obj = stats_request()
311 _version = reader.read("!B")[0]
312 assert(_version == 4)
313 _type = reader.read("!B")[0]
314 assert(_type == 18)
315 _length = reader.read("!H")[0]
316 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800317 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800318 obj.xid = reader.read("!L")[0]
319 obj.stats_type = reader.read("!H")[0]
320 obj.flags = reader.read("!H")[0]
321 reader.skip(4)
322 return obj
323
324 def __eq__(self, other):
325 if type(self) != type(other): return False
326 if self.xid != other.xid: return False
327 if self.stats_type != other.stats_type: return False
328 if self.flags != other.flags: return False
329 return True
330
331 def pretty_print(self, q):
332 q.text("stats_request {")
333 with q.group():
334 with q.indent(2):
335 q.breakable()
336 q.text("xid = ");
337 if self.xid != None:
338 q.text("%#x" % self.xid)
339 else:
340 q.text('None')
341 q.text(","); q.breakable()
342 q.text("flags = ");
343 q.text("%#x" % self.flags)
344 q.breakable()
345 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800346
347message.subtypes[18] = stats_request
348
349class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700350 version = 4
351 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700352 stats_type = 2
353
354 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 -0800355 if xid != None:
356 self.xid = xid
357 else:
358 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700359 if flags != None:
360 self.flags = flags
361 else:
362 self.flags = 0
363 if table_id != None:
364 self.table_id = table_id
365 else:
366 self.table_id = 0
367 if out_port != None:
368 self.out_port = out_port
369 else:
370 self.out_port = 0
371 if out_group != None:
372 self.out_group = out_group
373 else:
374 self.out_group = 0
375 if cookie != None:
376 self.cookie = cookie
377 else:
378 self.cookie = 0
379 if cookie_mask != None:
380 self.cookie_mask = cookie_mask
381 else:
382 self.cookie_mask = 0
383 if match != None:
384 self.match = match
385 else:
386 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800387 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700388
389 def pack(self):
390 packed = []
391 packed.append(struct.pack("!B", self.version))
392 packed.append(struct.pack("!B", self.type))
393 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
394 packed.append(struct.pack("!L", self.xid))
395 packed.append(struct.pack("!H", self.stats_type))
396 packed.append(struct.pack("!H", self.flags))
397 packed.append('\x00' * 4)
398 packed.append(struct.pack("!B", self.table_id))
399 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700400 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700401 packed.append(struct.pack("!L", self.out_group))
402 packed.append('\x00' * 4)
403 packed.append(struct.pack("!Q", self.cookie))
404 packed.append(struct.pack("!Q", self.cookie_mask))
405 packed.append(self.match.pack())
406 length = sum([len(x) for x in packed])
407 packed[2] = struct.pack("!H", length)
408 return ''.join(packed)
409
410 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800411 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700412 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700413 _version = reader.read("!B")[0]
414 assert(_version == 4)
415 _type = reader.read("!B")[0]
416 assert(_type == 18)
417 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800418 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800419 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700420 obj.xid = reader.read("!L")[0]
421 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700423 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700424 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700425 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700426 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700427 obj.out_port = util.unpack_port_no(reader)
428 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700429 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700430 obj.cookie = reader.read("!Q")[0]
431 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700432 obj.match = common.match.unpack(reader)
433 return obj
434
435 def __eq__(self, other):
436 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700437 if self.xid != other.xid: return False
438 if self.flags != other.flags: return False
439 if self.table_id != other.table_id: return False
440 if self.out_port != other.out_port: return False
441 if self.out_group != other.out_group: return False
442 if self.cookie != other.cookie: return False
443 if self.cookie_mask != other.cookie_mask: return False
444 if self.match != other.match: return False
445 return True
446
Rich Lanec2ee4b82013-04-24 17:12:38 -0700447 def pretty_print(self, q):
448 q.text("aggregate_stats_request {")
449 with q.group():
450 with q.indent(2):
451 q.breakable()
452 q.text("xid = ");
453 if self.xid != None:
454 q.text("%#x" % self.xid)
455 else:
456 q.text('None')
457 q.text(","); q.breakable()
458 q.text("flags = ");
459 q.text("%#x" % self.flags)
460 q.text(","); q.breakable()
461 q.text("table_id = ");
462 q.text("%#x" % self.table_id)
463 q.text(","); q.breakable()
464 q.text("out_port = ");
465 q.text(util.pretty_port(self.out_port))
466 q.text(","); q.breakable()
467 q.text("out_group = ");
468 q.text("%#x" % self.out_group)
469 q.text(","); q.breakable()
470 q.text("cookie = ");
471 q.text("%#x" % self.cookie)
472 q.text(","); q.breakable()
473 q.text("cookie_mask = ");
474 q.text("%#x" % self.cookie_mask)
475 q.text(","); q.breakable()
476 q.text("match = ");
477 q.pp(self.match)
478 q.breakable()
479 q.text('}')
480
Rich Lane7dcdf022013-12-11 14:45:27 -0800481stats_request.subtypes[2] = aggregate_stats_request
482
483class async_get_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700484 version = 4
485 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700486
487 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 -0800488 if xid != None:
489 self.xid = xid
490 else:
491 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700492 if packet_in_mask_equal_master != None:
493 self.packet_in_mask_equal_master = packet_in_mask_equal_master
494 else:
495 self.packet_in_mask_equal_master = 0
496 if packet_in_mask_slave != None:
497 self.packet_in_mask_slave = packet_in_mask_slave
498 else:
499 self.packet_in_mask_slave = 0
500 if port_status_mask_equal_master != None:
501 self.port_status_mask_equal_master = port_status_mask_equal_master
502 else:
503 self.port_status_mask_equal_master = 0
504 if port_status_mask_slave != None:
505 self.port_status_mask_slave = port_status_mask_slave
506 else:
507 self.port_status_mask_slave = 0
508 if flow_removed_mask_equal_master != None:
509 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
510 else:
511 self.flow_removed_mask_equal_master = 0
512 if flow_removed_mask_slave != None:
513 self.flow_removed_mask_slave = flow_removed_mask_slave
514 else:
515 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800516 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700517
518 def pack(self):
519 packed = []
520 packed.append(struct.pack("!B", self.version))
521 packed.append(struct.pack("!B", self.type))
522 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
523 packed.append(struct.pack("!L", self.xid))
524 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
525 packed.append(struct.pack("!L", self.packet_in_mask_slave))
526 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
527 packed.append(struct.pack("!L", self.port_status_mask_slave))
528 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
529 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
530 length = sum([len(x) for x in packed])
531 packed[2] = struct.pack("!H", length)
532 return ''.join(packed)
533
534 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800535 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700536 obj = async_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700537 _version = reader.read("!B")[0]
538 assert(_version == 4)
539 _type = reader.read("!B")[0]
540 assert(_type == 27)
541 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800542 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800543 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700544 obj.xid = reader.read("!L")[0]
545 obj.packet_in_mask_equal_master = reader.read("!L")[0]
546 obj.packet_in_mask_slave = reader.read("!L")[0]
547 obj.port_status_mask_equal_master = reader.read("!L")[0]
548 obj.port_status_mask_slave = reader.read("!L")[0]
549 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
550 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700551 return obj
552
553 def __eq__(self, other):
554 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700555 if self.xid != other.xid: return False
556 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
557 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
558 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
559 if self.port_status_mask_slave != other.port_status_mask_slave: return False
560 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
561 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
562 return True
563
Rich Lanec2ee4b82013-04-24 17:12:38 -0700564 def pretty_print(self, q):
565 q.text("async_get_reply {")
566 with q.group():
567 with q.indent(2):
568 q.breakable()
569 q.text("xid = ");
570 if self.xid != None:
571 q.text("%#x" % self.xid)
572 else:
573 q.text('None')
574 q.text(","); q.breakable()
575 q.text("packet_in_mask_equal_master = ");
576 q.text("%#x" % self.packet_in_mask_equal_master)
577 q.text(","); q.breakable()
578 q.text("packet_in_mask_slave = ");
579 q.text("%#x" % self.packet_in_mask_slave)
580 q.text(","); q.breakable()
581 q.text("port_status_mask_equal_master = ");
582 q.text("%#x" % self.port_status_mask_equal_master)
583 q.text(","); q.breakable()
584 q.text("port_status_mask_slave = ");
585 q.text("%#x" % self.port_status_mask_slave)
586 q.text(","); q.breakable()
587 q.text("flow_removed_mask_equal_master = ");
588 q.text("%#x" % self.flow_removed_mask_equal_master)
589 q.text(","); q.breakable()
590 q.text("flow_removed_mask_slave = ");
591 q.text("%#x" % self.flow_removed_mask_slave)
592 q.breakable()
593 q.text('}')
594
Rich Lane7dcdf022013-12-11 14:45:27 -0800595message.subtypes[27] = async_get_reply
596
597class async_get_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700598 version = 4
599 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700600
601 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 -0800602 if xid != None:
603 self.xid = xid
604 else:
605 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700606 if packet_in_mask_equal_master != None:
607 self.packet_in_mask_equal_master = packet_in_mask_equal_master
608 else:
609 self.packet_in_mask_equal_master = 0
610 if packet_in_mask_slave != None:
611 self.packet_in_mask_slave = packet_in_mask_slave
612 else:
613 self.packet_in_mask_slave = 0
614 if port_status_mask_equal_master != None:
615 self.port_status_mask_equal_master = port_status_mask_equal_master
616 else:
617 self.port_status_mask_equal_master = 0
618 if port_status_mask_slave != None:
619 self.port_status_mask_slave = port_status_mask_slave
620 else:
621 self.port_status_mask_slave = 0
622 if flow_removed_mask_equal_master != None:
623 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
624 else:
625 self.flow_removed_mask_equal_master = 0
626 if flow_removed_mask_slave != None:
627 self.flow_removed_mask_slave = flow_removed_mask_slave
628 else:
629 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800630 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700631
632 def pack(self):
633 packed = []
634 packed.append(struct.pack("!B", self.version))
635 packed.append(struct.pack("!B", self.type))
636 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
637 packed.append(struct.pack("!L", self.xid))
638 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
639 packed.append(struct.pack("!L", self.packet_in_mask_slave))
640 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
641 packed.append(struct.pack("!L", self.port_status_mask_slave))
642 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
643 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
644 length = sum([len(x) for x in packed])
645 packed[2] = struct.pack("!H", length)
646 return ''.join(packed)
647
648 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800649 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700650 obj = async_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700651 _version = reader.read("!B")[0]
652 assert(_version == 4)
653 _type = reader.read("!B")[0]
654 assert(_type == 26)
655 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800656 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800657 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700658 obj.xid = reader.read("!L")[0]
659 obj.packet_in_mask_equal_master = reader.read("!L")[0]
660 obj.packet_in_mask_slave = reader.read("!L")[0]
661 obj.port_status_mask_equal_master = reader.read("!L")[0]
662 obj.port_status_mask_slave = reader.read("!L")[0]
663 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
664 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700665 return obj
666
667 def __eq__(self, other):
668 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700669 if self.xid != other.xid: return False
670 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
671 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
672 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
673 if self.port_status_mask_slave != other.port_status_mask_slave: return False
674 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
675 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
676 return True
677
Rich Lanec2ee4b82013-04-24 17:12:38 -0700678 def pretty_print(self, q):
679 q.text("async_get_request {")
680 with q.group():
681 with q.indent(2):
682 q.breakable()
683 q.text("xid = ");
684 if self.xid != None:
685 q.text("%#x" % self.xid)
686 else:
687 q.text('None')
688 q.text(","); q.breakable()
689 q.text("packet_in_mask_equal_master = ");
690 q.text("%#x" % self.packet_in_mask_equal_master)
691 q.text(","); q.breakable()
692 q.text("packet_in_mask_slave = ");
693 q.text("%#x" % self.packet_in_mask_slave)
694 q.text(","); q.breakable()
695 q.text("port_status_mask_equal_master = ");
696 q.text("%#x" % self.port_status_mask_equal_master)
697 q.text(","); q.breakable()
698 q.text("port_status_mask_slave = ");
699 q.text("%#x" % self.port_status_mask_slave)
700 q.text(","); q.breakable()
701 q.text("flow_removed_mask_equal_master = ");
702 q.text("%#x" % self.flow_removed_mask_equal_master)
703 q.text(","); q.breakable()
704 q.text("flow_removed_mask_slave = ");
705 q.text("%#x" % self.flow_removed_mask_slave)
706 q.breakable()
707 q.text('}')
708
Rich Lane7dcdf022013-12-11 14:45:27 -0800709message.subtypes[26] = async_get_request
710
711class async_set(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700712 version = 4
713 type = 28
Rich Lanec2ee4b82013-04-24 17:12:38 -0700714
715 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 -0800716 if xid != None:
717 self.xid = xid
718 else:
719 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700720 if packet_in_mask_equal_master != None:
721 self.packet_in_mask_equal_master = packet_in_mask_equal_master
722 else:
723 self.packet_in_mask_equal_master = 0
724 if packet_in_mask_slave != None:
725 self.packet_in_mask_slave = packet_in_mask_slave
726 else:
727 self.packet_in_mask_slave = 0
728 if port_status_mask_equal_master != None:
729 self.port_status_mask_equal_master = port_status_mask_equal_master
730 else:
731 self.port_status_mask_equal_master = 0
732 if port_status_mask_slave != None:
733 self.port_status_mask_slave = port_status_mask_slave
734 else:
735 self.port_status_mask_slave = 0
736 if flow_removed_mask_equal_master != None:
737 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
738 else:
739 self.flow_removed_mask_equal_master = 0
740 if flow_removed_mask_slave != None:
741 self.flow_removed_mask_slave = flow_removed_mask_slave
742 else:
743 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800744 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700745
746 def pack(self):
747 packed = []
748 packed.append(struct.pack("!B", self.version))
749 packed.append(struct.pack("!B", self.type))
750 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
751 packed.append(struct.pack("!L", self.xid))
752 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
753 packed.append(struct.pack("!L", self.packet_in_mask_slave))
754 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
755 packed.append(struct.pack("!L", self.port_status_mask_slave))
756 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
757 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
758 length = sum([len(x) for x in packed])
759 packed[2] = struct.pack("!H", length)
760 return ''.join(packed)
761
762 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800763 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700764 obj = async_set()
Dan Talaycof6202252013-07-02 01:00:29 -0700765 _version = reader.read("!B")[0]
766 assert(_version == 4)
767 _type = reader.read("!B")[0]
768 assert(_type == 28)
769 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800770 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800771 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700772 obj.xid = reader.read("!L")[0]
773 obj.packet_in_mask_equal_master = reader.read("!L")[0]
774 obj.packet_in_mask_slave = reader.read("!L")[0]
775 obj.port_status_mask_equal_master = reader.read("!L")[0]
776 obj.port_status_mask_slave = reader.read("!L")[0]
777 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
778 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700779 return obj
780
781 def __eq__(self, other):
782 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700783 if self.xid != other.xid: return False
784 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
785 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
786 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
787 if self.port_status_mask_slave != other.port_status_mask_slave: return False
788 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
789 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
790 return True
791
Rich Lanec2ee4b82013-04-24 17:12:38 -0700792 def pretty_print(self, q):
793 q.text("async_set {")
794 with q.group():
795 with q.indent(2):
796 q.breakable()
797 q.text("xid = ");
798 if self.xid != None:
799 q.text("%#x" % self.xid)
800 else:
801 q.text('None')
802 q.text(","); q.breakable()
803 q.text("packet_in_mask_equal_master = ");
804 q.text("%#x" % self.packet_in_mask_equal_master)
805 q.text(","); q.breakable()
806 q.text("packet_in_mask_slave = ");
807 q.text("%#x" % self.packet_in_mask_slave)
808 q.text(","); q.breakable()
809 q.text("port_status_mask_equal_master = ");
810 q.text("%#x" % self.port_status_mask_equal_master)
811 q.text(","); q.breakable()
812 q.text("port_status_mask_slave = ");
813 q.text("%#x" % self.port_status_mask_slave)
814 q.text(","); q.breakable()
815 q.text("flow_removed_mask_equal_master = ");
816 q.text("%#x" % self.flow_removed_mask_equal_master)
817 q.text(","); q.breakable()
818 q.text("flow_removed_mask_slave = ");
819 q.text("%#x" % self.flow_removed_mask_slave)
820 q.breakable()
821 q.text('}')
822
Rich Lane7dcdf022013-12-11 14:45:27 -0800823message.subtypes[28] = async_set
824
825class error_msg(message):
826 subtypes = {}
827
Rich Lane95f7fc92014-01-27 17:08:16 -0800828 version = 4
829 type = 1
830
831 def __init__(self, xid=None, err_type=None):
832 if xid != None:
833 self.xid = xid
834 else:
835 self.xid = None
836 if err_type != None:
837 self.err_type = err_type
838 else:
839 self.err_type = 0
840 return
841
842 def pack(self):
843 packed = []
844 packed.append(struct.pack("!B", self.version))
845 packed.append(struct.pack("!B", self.type))
846 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
847 packed.append(struct.pack("!L", self.xid))
848 packed.append(struct.pack("!H", self.err_type))
849 length = sum([len(x) for x in packed])
850 packed[2] = struct.pack("!H", length)
851 return ''.join(packed)
852
Rich Lane7dcdf022013-12-11 14:45:27 -0800853 @staticmethod
854 def unpack(reader):
855 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800856 subclass = error_msg.subtypes.get(subtype)
857 if subclass:
858 return subclass.unpack(reader)
859
860 obj = error_msg()
861 _version = reader.read("!B")[0]
862 assert(_version == 4)
863 _type = reader.read("!B")[0]
864 assert(_type == 1)
865 _length = reader.read("!H")[0]
866 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800867 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800868 obj.xid = reader.read("!L")[0]
869 obj.err_type = reader.read("!H")[0]
870 return obj
871
872 def __eq__(self, other):
873 if type(self) != type(other): return False
874 if self.xid != other.xid: return False
875 if self.err_type != other.err_type: return False
876 return True
877
878 def pretty_print(self, q):
879 q.text("error_msg {")
880 with q.group():
881 with q.indent(2):
882 q.breakable()
883 q.text("xid = ");
884 if self.xid != None:
885 q.text("%#x" % self.xid)
886 else:
887 q.text('None')
888 q.breakable()
889 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800890
891message.subtypes[1] = error_msg
892
893class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700894 version = 4
895 type = 1
896 err_type = 2
897
898 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800899 if xid != None:
900 self.xid = xid
901 else:
902 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700903 if code != None:
904 self.code = code
905 else:
906 self.code = 0
907 if data != None:
908 self.data = data
909 else:
910 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800911 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700912
913 def pack(self):
914 packed = []
915 packed.append(struct.pack("!B", self.version))
916 packed.append(struct.pack("!B", self.type))
917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
918 packed.append(struct.pack("!L", self.xid))
919 packed.append(struct.pack("!H", self.err_type))
920 packed.append(struct.pack("!H", self.code))
921 packed.append(self.data)
922 length = sum([len(x) for x in packed])
923 packed[2] = struct.pack("!H", length)
924 return ''.join(packed)
925
926 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800927 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700928 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700929 _version = reader.read("!B")[0]
930 assert(_version == 4)
931 _type = reader.read("!B")[0]
932 assert(_type == 1)
933 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800934 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800935 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700936 obj.xid = reader.read("!L")[0]
937 _err_type = reader.read("!H")[0]
938 assert(_err_type == 2)
939 obj.code = reader.read("!H")[0]
940 obj.data = str(reader.read_all())
941 return obj
942
943 def __eq__(self, other):
944 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700945 if self.xid != other.xid: return False
946 if self.code != other.code: return False
947 if self.data != other.data: return False
948 return True
949
Rich Lane6f4978c2013-10-20 21:33:52 -0700950 def pretty_print(self, q):
951 q.text("bad_action_error_msg {")
952 with q.group():
953 with q.indent(2):
954 q.breakable()
955 q.text("xid = ");
956 if self.xid != None:
957 q.text("%#x" % self.xid)
958 else:
959 q.text('None')
960 q.text(","); q.breakable()
961 q.text("code = ");
962 q.text("%#x" % self.code)
963 q.text(","); q.breakable()
964 q.text("data = ");
965 q.pp(self.data)
966 q.breakable()
967 q.text('}')
968
Rich Lane7dcdf022013-12-11 14:45:27 -0800969error_msg.subtypes[2] = bad_action_error_msg
970
971class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700972 version = 4
973 type = 1
974 err_type = 3
975
976 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800977 if xid != None:
978 self.xid = xid
979 else:
980 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700981 if code != None:
982 self.code = code
983 else:
984 self.code = 0
985 if data != None:
986 self.data = data
987 else:
988 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800989 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700990
991 def pack(self):
992 packed = []
993 packed.append(struct.pack("!B", self.version))
994 packed.append(struct.pack("!B", self.type))
995 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
996 packed.append(struct.pack("!L", self.xid))
997 packed.append(struct.pack("!H", self.err_type))
998 packed.append(struct.pack("!H", self.code))
999 packed.append(self.data)
1000 length = sum([len(x) for x in packed])
1001 packed[2] = struct.pack("!H", length)
1002 return ''.join(packed)
1003
1004 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001005 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001006 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001007 _version = reader.read("!B")[0]
1008 assert(_version == 4)
1009 _type = reader.read("!B")[0]
1010 assert(_type == 1)
1011 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001012 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001013 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001014 obj.xid = reader.read("!L")[0]
1015 _err_type = reader.read("!H")[0]
1016 assert(_err_type == 3)
1017 obj.code = reader.read("!H")[0]
1018 obj.data = str(reader.read_all())
1019 return obj
1020
1021 def __eq__(self, other):
1022 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001023 if self.xid != other.xid: return False
1024 if self.code != other.code: return False
1025 if self.data != other.data: return False
1026 return True
1027
Rich Lane6f4978c2013-10-20 21:33:52 -07001028 def pretty_print(self, q):
1029 q.text("bad_instruction_error_msg {")
1030 with q.group():
1031 with q.indent(2):
1032 q.breakable()
1033 q.text("xid = ");
1034 if self.xid != None:
1035 q.text("%#x" % self.xid)
1036 else:
1037 q.text('None')
1038 q.text(","); q.breakable()
1039 q.text("code = ");
1040 q.text("%#x" % self.code)
1041 q.text(","); q.breakable()
1042 q.text("data = ");
1043 q.pp(self.data)
1044 q.breakable()
1045 q.text('}')
1046
Rich Lane7dcdf022013-12-11 14:45:27 -08001047error_msg.subtypes[3] = bad_instruction_error_msg
1048
1049class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001050 version = 4
1051 type = 1
1052 err_type = 4
1053
1054 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001055 if xid != None:
1056 self.xid = xid
1057 else:
1058 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001059 if code != None:
1060 self.code = code
1061 else:
1062 self.code = 0
1063 if data != None:
1064 self.data = data
1065 else:
1066 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001067 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001068
1069 def pack(self):
1070 packed = []
1071 packed.append(struct.pack("!B", self.version))
1072 packed.append(struct.pack("!B", self.type))
1073 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1074 packed.append(struct.pack("!L", self.xid))
1075 packed.append(struct.pack("!H", self.err_type))
1076 packed.append(struct.pack("!H", self.code))
1077 packed.append(self.data)
1078 length = sum([len(x) for x in packed])
1079 packed[2] = struct.pack("!H", length)
1080 return ''.join(packed)
1081
1082 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001083 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001084 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001085 _version = reader.read("!B")[0]
1086 assert(_version == 4)
1087 _type = reader.read("!B")[0]
1088 assert(_type == 1)
1089 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001090 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001091 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001092 obj.xid = reader.read("!L")[0]
1093 _err_type = reader.read("!H")[0]
1094 assert(_err_type == 4)
1095 obj.code = reader.read("!H")[0]
1096 obj.data = str(reader.read_all())
1097 return obj
1098
1099 def __eq__(self, other):
1100 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001101 if self.xid != other.xid: return False
1102 if self.code != other.code: return False
1103 if self.data != other.data: return False
1104 return True
1105
Rich Lane6f4978c2013-10-20 21:33:52 -07001106 def pretty_print(self, q):
1107 q.text("bad_match_error_msg {")
1108 with q.group():
1109 with q.indent(2):
1110 q.breakable()
1111 q.text("xid = ");
1112 if self.xid != None:
1113 q.text("%#x" % self.xid)
1114 else:
1115 q.text('None')
1116 q.text(","); q.breakable()
1117 q.text("code = ");
1118 q.text("%#x" % self.code)
1119 q.text(","); q.breakable()
1120 q.text("data = ");
1121 q.pp(self.data)
1122 q.breakable()
1123 q.text('}')
1124
Rich Lane7dcdf022013-12-11 14:45:27 -08001125error_msg.subtypes[4] = bad_match_error_msg
1126
1127class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001128 version = 4
1129 type = 1
1130 err_type = 1
1131
1132 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001133 if xid != None:
1134 self.xid = xid
1135 else:
1136 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001137 if code != None:
1138 self.code = code
1139 else:
1140 self.code = 0
1141 if data != None:
1142 self.data = data
1143 else:
1144 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001145 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001146
1147 def pack(self):
1148 packed = []
1149 packed.append(struct.pack("!B", self.version))
1150 packed.append(struct.pack("!B", self.type))
1151 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1152 packed.append(struct.pack("!L", self.xid))
1153 packed.append(struct.pack("!H", self.err_type))
1154 packed.append(struct.pack("!H", self.code))
1155 packed.append(self.data)
1156 length = sum([len(x) for x in packed])
1157 packed[2] = struct.pack("!H", length)
1158 return ''.join(packed)
1159
1160 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001161 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001162 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001163 _version = reader.read("!B")[0]
1164 assert(_version == 4)
1165 _type = reader.read("!B")[0]
1166 assert(_type == 1)
1167 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001168 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001169 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001170 obj.xid = reader.read("!L")[0]
1171 _err_type = reader.read("!H")[0]
1172 assert(_err_type == 1)
1173 obj.code = reader.read("!H")[0]
1174 obj.data = str(reader.read_all())
1175 return obj
1176
1177 def __eq__(self, other):
1178 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001179 if self.xid != other.xid: return False
1180 if self.code != other.code: return False
1181 if self.data != other.data: return False
1182 return True
1183
Rich Lane6f4978c2013-10-20 21:33:52 -07001184 def pretty_print(self, q):
1185 q.text("bad_request_error_msg {")
1186 with q.group():
1187 with q.indent(2):
1188 q.breakable()
1189 q.text("xid = ");
1190 if self.xid != None:
1191 q.text("%#x" % self.xid)
1192 else:
1193 q.text('None')
1194 q.text(","); q.breakable()
1195 q.text("code = ");
1196 q.text("%#x" % self.code)
1197 q.text(","); q.breakable()
1198 q.text("data = ");
1199 q.pp(self.data)
1200 q.breakable()
1201 q.text('}')
1202
Rich Lane7dcdf022013-12-11 14:45:27 -08001203error_msg.subtypes[1] = bad_request_error_msg
1204
1205class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001206 version = 4
1207 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001208
1209 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001210 if xid != None:
1211 self.xid = xid
1212 else:
1213 self.xid = None
1214 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001215
1216 def pack(self):
1217 packed = []
1218 packed.append(struct.pack("!B", self.version))
1219 packed.append(struct.pack("!B", self.type))
1220 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1221 packed.append(struct.pack("!L", self.xid))
1222 length = sum([len(x) for x in packed])
1223 packed[2] = struct.pack("!H", length)
1224 return ''.join(packed)
1225
1226 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001227 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001228 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001229 _version = reader.read("!B")[0]
1230 assert(_version == 4)
1231 _type = reader.read("!B")[0]
1232 assert(_type == 21)
1233 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001234 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001235 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001236 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001237 return obj
1238
1239 def __eq__(self, other):
1240 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001241 if self.xid != other.xid: return False
1242 return True
1243
Rich Lanec2ee4b82013-04-24 17:12:38 -07001244 def pretty_print(self, q):
1245 q.text("barrier_reply {")
1246 with q.group():
1247 with q.indent(2):
1248 q.breakable()
1249 q.text("xid = ");
1250 if self.xid != None:
1251 q.text("%#x" % self.xid)
1252 else:
1253 q.text('None')
1254 q.breakable()
1255 q.text('}')
1256
Rich Lane7dcdf022013-12-11 14:45:27 -08001257message.subtypes[21] = barrier_reply
1258
1259class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001260 version = 4
1261 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -07001262
1263 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001264 if xid != None:
1265 self.xid = xid
1266 else:
1267 self.xid = None
1268 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001269
1270 def pack(self):
1271 packed = []
1272 packed.append(struct.pack("!B", self.version))
1273 packed.append(struct.pack("!B", self.type))
1274 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1275 packed.append(struct.pack("!L", self.xid))
1276 length = sum([len(x) for x in packed])
1277 packed[2] = struct.pack("!H", length)
1278 return ''.join(packed)
1279
1280 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001281 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001282 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001283 _version = reader.read("!B")[0]
1284 assert(_version == 4)
1285 _type = reader.read("!B")[0]
1286 assert(_type == 20)
1287 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001288 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001289 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001290 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001291 return obj
1292
1293 def __eq__(self, other):
1294 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001295 if self.xid != other.xid: return False
1296 return True
1297
Rich Lanec2ee4b82013-04-24 17:12:38 -07001298 def pretty_print(self, q):
1299 q.text("barrier_request {")
1300 with q.group():
1301 with q.indent(2):
1302 q.breakable()
1303 q.text("xid = ");
1304 if self.xid != None:
1305 q.text("%#x" % self.xid)
1306 else:
1307 q.text('None')
1308 q.breakable()
1309 q.text('}')
1310
Rich Lane7dcdf022013-12-11 14:45:27 -08001311message.subtypes[20] = barrier_request
1312
1313class experimenter(message):
1314 subtypes = {}
1315
Rich Lane95f7fc92014-01-27 17:08:16 -08001316 version = 4
1317 type = 4
1318
1319 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1320 if xid != None:
1321 self.xid = xid
1322 else:
1323 self.xid = None
1324 if experimenter != None:
1325 self.experimenter = experimenter
1326 else:
1327 self.experimenter = 0
1328 if subtype != None:
1329 self.subtype = subtype
1330 else:
1331 self.subtype = 0
1332 if data != None:
1333 self.data = data
1334 else:
1335 self.data = ''
1336 return
1337
1338 def pack(self):
1339 packed = []
1340 packed.append(struct.pack("!B", self.version))
1341 packed.append(struct.pack("!B", self.type))
1342 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1343 packed.append(struct.pack("!L", self.xid))
1344 packed.append(struct.pack("!L", self.experimenter))
1345 packed.append(struct.pack("!L", self.subtype))
1346 packed.append(self.data)
1347 length = sum([len(x) for x in packed])
1348 packed[2] = struct.pack("!H", length)
1349 return ''.join(packed)
1350
Rich Lane7dcdf022013-12-11 14:45:27 -08001351 @staticmethod
1352 def unpack(reader):
1353 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001354 subclass = experimenter.subtypes.get(subtype)
1355 if subclass:
1356 return subclass.unpack(reader)
1357
1358 obj = experimenter()
1359 _version = reader.read("!B")[0]
1360 assert(_version == 4)
1361 _type = reader.read("!B")[0]
1362 assert(_type == 4)
1363 _length = reader.read("!H")[0]
1364 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001365 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001366 obj.xid = reader.read("!L")[0]
1367 obj.experimenter = reader.read("!L")[0]
1368 obj.subtype = reader.read("!L")[0]
1369 obj.data = str(reader.read_all())
1370 return obj
1371
1372 def __eq__(self, other):
1373 if type(self) != type(other): return False
1374 if self.xid != other.xid: return False
1375 if self.experimenter != other.experimenter: return False
1376 if self.subtype != other.subtype: return False
1377 if self.data != other.data: return False
1378 return True
1379
1380 def pretty_print(self, q):
1381 q.text("experimenter {")
1382 with q.group():
1383 with q.indent(2):
1384 q.breakable()
1385 q.text("xid = ");
1386 if self.xid != None:
1387 q.text("%#x" % self.xid)
1388 else:
1389 q.text('None')
1390 q.text(","); q.breakable()
1391 q.text("subtype = ");
1392 q.text("%#x" % self.subtype)
1393 q.text(","); q.breakable()
1394 q.text("data = ");
1395 q.pp(self.data)
1396 q.breakable()
1397 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001398
1399message.subtypes[4] = experimenter
1400
1401class bsn_header(experimenter):
1402 subtypes = {}
1403
Rich Lane95f7fc92014-01-27 17:08:16 -08001404 version = 4
1405 type = 4
1406 experimenter = 6035143
1407
1408 def __init__(self, xid=None, subtype=None):
1409 if xid != None:
1410 self.xid = xid
1411 else:
1412 self.xid = None
1413 if subtype != None:
1414 self.subtype = subtype
1415 else:
1416 self.subtype = 0
1417 return
1418
1419 def pack(self):
1420 packed = []
1421 packed.append(struct.pack("!B", self.version))
1422 packed.append(struct.pack("!B", self.type))
1423 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1424 packed.append(struct.pack("!L", self.xid))
1425 packed.append(struct.pack("!L", self.experimenter))
1426 packed.append(struct.pack("!L", self.subtype))
1427 length = sum([len(x) for x in packed])
1428 packed[2] = struct.pack("!H", length)
1429 return ''.join(packed)
1430
Rich Lane7dcdf022013-12-11 14:45:27 -08001431 @staticmethod
1432 def unpack(reader):
1433 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001434 subclass = bsn_header.subtypes.get(subtype)
1435 if subclass:
1436 return subclass.unpack(reader)
1437
1438 obj = bsn_header()
1439 _version = reader.read("!B")[0]
1440 assert(_version == 4)
1441 _type = reader.read("!B")[0]
1442 assert(_type == 4)
1443 _length = reader.read("!H")[0]
1444 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001445 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001446 obj.xid = reader.read("!L")[0]
1447 _experimenter = reader.read("!L")[0]
1448 assert(_experimenter == 6035143)
1449 obj.subtype = reader.read("!L")[0]
1450 return obj
1451
1452 def __eq__(self, other):
1453 if type(self) != type(other): return False
1454 if self.xid != other.xid: return False
1455 if self.subtype != other.subtype: return False
1456 return True
1457
1458 def pretty_print(self, q):
1459 q.text("bsn_header {")
1460 with q.group():
1461 with q.indent(2):
1462 q.breakable()
1463 q.text("xid = ");
1464 if self.xid != None:
1465 q.text("%#x" % self.xid)
1466 else:
1467 q.text('None')
1468 q.breakable()
1469 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001470
1471experimenter.subtypes[6035143] = bsn_header
1472
Rich Lanea61048f2014-01-30 16:14:00 -08001473class bsn_arp_idle(bsn_header):
1474 version = 4
1475 type = 4
1476 experimenter = 6035143
1477 subtype = 60
1478
1479 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1480 if xid != None:
1481 self.xid = xid
1482 else:
1483 self.xid = None
1484 if vlan_vid != None:
1485 self.vlan_vid = vlan_vid
1486 else:
1487 self.vlan_vid = 0
1488 if ipv4_addr != None:
1489 self.ipv4_addr = ipv4_addr
1490 else:
1491 self.ipv4_addr = 0
1492 return
1493
1494 def pack(self):
1495 packed = []
1496 packed.append(struct.pack("!B", self.version))
1497 packed.append(struct.pack("!B", self.type))
1498 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1499 packed.append(struct.pack("!L", self.xid))
1500 packed.append(struct.pack("!L", self.experimenter))
1501 packed.append(struct.pack("!L", self.subtype))
1502 packed.append(struct.pack("!H", self.vlan_vid))
1503 packed.append('\x00' * 2)
1504 packed.append(struct.pack("!L", self.ipv4_addr))
1505 length = sum([len(x) for x in packed])
1506 packed[2] = struct.pack("!H", length)
1507 return ''.join(packed)
1508
1509 @staticmethod
1510 def unpack(reader):
1511 obj = bsn_arp_idle()
1512 _version = reader.read("!B")[0]
1513 assert(_version == 4)
1514 _type = reader.read("!B")[0]
1515 assert(_type == 4)
1516 _length = reader.read("!H")[0]
1517 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001518 reader = orig_reader.slice(_length, 4)
Rich Lanea61048f2014-01-30 16:14:00 -08001519 obj.xid = reader.read("!L")[0]
1520 _experimenter = reader.read("!L")[0]
1521 assert(_experimenter == 6035143)
1522 _subtype = reader.read("!L")[0]
1523 assert(_subtype == 60)
1524 obj.vlan_vid = reader.read("!H")[0]
1525 reader.skip(2)
1526 obj.ipv4_addr = reader.read("!L")[0]
1527 return obj
1528
1529 def __eq__(self, other):
1530 if type(self) != type(other): return False
1531 if self.xid != other.xid: return False
1532 if self.vlan_vid != other.vlan_vid: return False
1533 if self.ipv4_addr != other.ipv4_addr: return False
1534 return True
1535
1536 def pretty_print(self, q):
1537 q.text("bsn_arp_idle {")
1538 with q.group():
1539 with q.indent(2):
1540 q.breakable()
1541 q.text("xid = ");
1542 if self.xid != None:
1543 q.text("%#x" % self.xid)
1544 else:
1545 q.text('None')
1546 q.text(","); q.breakable()
1547 q.text("vlan_vid = ");
1548 q.text("%#x" % self.vlan_vid)
1549 q.text(","); q.breakable()
1550 q.text("ipv4_addr = ");
1551 q.text(util.pretty_ipv4(self.ipv4_addr))
1552 q.breakable()
1553 q.text('}')
1554
1555bsn_header.subtypes[60] = bsn_arp_idle
1556
Rich Lane7dcdf022013-12-11 14:45:27 -08001557class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001558 version = 4
1559 type = 4
1560 experimenter = 6035143
1561 subtype = 22
1562
1563 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001564 if xid != None:
1565 self.xid = xid
1566 else:
1567 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001568 if status != None:
1569 self.status = status
1570 else:
1571 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001572 return
Dan Talaycof6202252013-07-02 01:00:29 -07001573
1574 def pack(self):
1575 packed = []
1576 packed.append(struct.pack("!B", self.version))
1577 packed.append(struct.pack("!B", self.type))
1578 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1579 packed.append(struct.pack("!L", self.xid))
1580 packed.append(struct.pack("!L", self.experimenter))
1581 packed.append(struct.pack("!L", self.subtype))
1582 packed.append(struct.pack("!L", self.status))
1583 length = sum([len(x) for x in packed])
1584 packed[2] = struct.pack("!H", length)
1585 return ''.join(packed)
1586
1587 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001588 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001589 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001590 _version = reader.read("!B")[0]
1591 assert(_version == 4)
1592 _type = reader.read("!B")[0]
1593 assert(_type == 4)
1594 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001595 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001596 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001597 obj.xid = reader.read("!L")[0]
1598 _experimenter = reader.read("!L")[0]
1599 assert(_experimenter == 6035143)
1600 _subtype = reader.read("!L")[0]
1601 assert(_subtype == 22)
1602 obj.status = reader.read("!L")[0]
1603 return obj
1604
1605 def __eq__(self, other):
1606 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001607 if self.xid != other.xid: return False
1608 if self.status != other.status: return False
1609 return True
1610
Dan Talaycof6202252013-07-02 01:00:29 -07001611 def pretty_print(self, q):
1612 q.text("bsn_bw_clear_data_reply {")
1613 with q.group():
1614 with q.indent(2):
1615 q.breakable()
1616 q.text("xid = ");
1617 if self.xid != None:
1618 q.text("%#x" % self.xid)
1619 else:
1620 q.text('None')
1621 q.text(","); q.breakable()
1622 q.text("status = ");
1623 q.text("%#x" % self.status)
1624 q.breakable()
1625 q.text('}')
1626
Rich Lane7dcdf022013-12-11 14:45:27 -08001627bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1628
1629class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001630 version = 4
1631 type = 4
1632 experimenter = 6035143
1633 subtype = 21
1634
1635 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001636 if xid != None:
1637 self.xid = xid
1638 else:
1639 self.xid = None
1640 return
Dan Talaycof6202252013-07-02 01:00:29 -07001641
1642 def pack(self):
1643 packed = []
1644 packed.append(struct.pack("!B", self.version))
1645 packed.append(struct.pack("!B", self.type))
1646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1647 packed.append(struct.pack("!L", self.xid))
1648 packed.append(struct.pack("!L", self.experimenter))
1649 packed.append(struct.pack("!L", self.subtype))
1650 length = sum([len(x) for x in packed])
1651 packed[2] = struct.pack("!H", length)
1652 return ''.join(packed)
1653
1654 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001655 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001656 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001657 _version = reader.read("!B")[0]
1658 assert(_version == 4)
1659 _type = reader.read("!B")[0]
1660 assert(_type == 4)
1661 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001662 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001663 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001664 obj.xid = reader.read("!L")[0]
1665 _experimenter = reader.read("!L")[0]
1666 assert(_experimenter == 6035143)
1667 _subtype = reader.read("!L")[0]
1668 assert(_subtype == 21)
1669 return obj
1670
1671 def __eq__(self, other):
1672 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001673 if self.xid != other.xid: return False
1674 return True
1675
Dan Talaycof6202252013-07-02 01:00:29 -07001676 def pretty_print(self, q):
1677 q.text("bsn_bw_clear_data_request {")
1678 with q.group():
1679 with q.indent(2):
1680 q.breakable()
1681 q.text("xid = ");
1682 if self.xid != None:
1683 q.text("%#x" % self.xid)
1684 else:
1685 q.text('None')
1686 q.breakable()
1687 q.text('}')
1688
Rich Lane7dcdf022013-12-11 14:45:27 -08001689bsn_header.subtypes[21] = bsn_bw_clear_data_request
1690
1691class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001692 version = 4
1693 type = 4
1694 experimenter = 6035143
1695 subtype = 20
1696
1697 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001698 if xid != None:
1699 self.xid = xid
1700 else:
1701 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001702 if enabled != None:
1703 self.enabled = enabled
1704 else:
1705 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001706 return
Dan Talaycof6202252013-07-02 01:00:29 -07001707
1708 def pack(self):
1709 packed = []
1710 packed.append(struct.pack("!B", self.version))
1711 packed.append(struct.pack("!B", self.type))
1712 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1713 packed.append(struct.pack("!L", self.xid))
1714 packed.append(struct.pack("!L", self.experimenter))
1715 packed.append(struct.pack("!L", self.subtype))
1716 packed.append(struct.pack("!L", self.enabled))
1717 length = sum([len(x) for x in packed])
1718 packed[2] = struct.pack("!H", length)
1719 return ''.join(packed)
1720
1721 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001722 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001723 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001724 _version = reader.read("!B")[0]
1725 assert(_version == 4)
1726 _type = reader.read("!B")[0]
1727 assert(_type == 4)
1728 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001729 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001730 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001731 obj.xid = reader.read("!L")[0]
1732 _experimenter = reader.read("!L")[0]
1733 assert(_experimenter == 6035143)
1734 _subtype = reader.read("!L")[0]
1735 assert(_subtype == 20)
1736 obj.enabled = reader.read("!L")[0]
1737 return obj
1738
1739 def __eq__(self, other):
1740 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001741 if self.xid != other.xid: return False
1742 if self.enabled != other.enabled: return False
1743 return True
1744
Dan Talaycof6202252013-07-02 01:00:29 -07001745 def pretty_print(self, q):
1746 q.text("bsn_bw_enable_get_reply {")
1747 with q.group():
1748 with q.indent(2):
1749 q.breakable()
1750 q.text("xid = ");
1751 if self.xid != None:
1752 q.text("%#x" % self.xid)
1753 else:
1754 q.text('None')
1755 q.text(","); q.breakable()
1756 q.text("enabled = ");
1757 q.text("%#x" % self.enabled)
1758 q.breakable()
1759 q.text('}')
1760
Rich Lane7dcdf022013-12-11 14:45:27 -08001761bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1762
1763class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001764 version = 4
1765 type = 4
1766 experimenter = 6035143
1767 subtype = 19
1768
1769 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001770 if xid != None:
1771 self.xid = xid
1772 else:
1773 self.xid = None
1774 return
Dan Talaycof6202252013-07-02 01:00:29 -07001775
1776 def pack(self):
1777 packed = []
1778 packed.append(struct.pack("!B", self.version))
1779 packed.append(struct.pack("!B", self.type))
1780 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1781 packed.append(struct.pack("!L", self.xid))
1782 packed.append(struct.pack("!L", self.experimenter))
1783 packed.append(struct.pack("!L", self.subtype))
1784 length = sum([len(x) for x in packed])
1785 packed[2] = struct.pack("!H", length)
1786 return ''.join(packed)
1787
1788 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001789 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001790 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001791 _version = reader.read("!B")[0]
1792 assert(_version == 4)
1793 _type = reader.read("!B")[0]
1794 assert(_type == 4)
1795 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001796 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001797 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001798 obj.xid = reader.read("!L")[0]
1799 _experimenter = reader.read("!L")[0]
1800 assert(_experimenter == 6035143)
1801 _subtype = reader.read("!L")[0]
1802 assert(_subtype == 19)
1803 return obj
1804
1805 def __eq__(self, other):
1806 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001807 if self.xid != other.xid: return False
1808 return True
1809
Dan Talaycof6202252013-07-02 01:00:29 -07001810 def pretty_print(self, q):
1811 q.text("bsn_bw_enable_get_request {")
1812 with q.group():
1813 with q.indent(2):
1814 q.breakable()
1815 q.text("xid = ");
1816 if self.xid != None:
1817 q.text("%#x" % self.xid)
1818 else:
1819 q.text('None')
1820 q.breakable()
1821 q.text('}')
1822
Rich Lane7dcdf022013-12-11 14:45:27 -08001823bsn_header.subtypes[19] = bsn_bw_enable_get_request
1824
1825class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001826 version = 4
1827 type = 4
1828 experimenter = 6035143
1829 subtype = 23
1830
1831 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001832 if xid != None:
1833 self.xid = xid
1834 else:
1835 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001836 if enable != None:
1837 self.enable = enable
1838 else:
1839 self.enable = 0
1840 if status != None:
1841 self.status = status
1842 else:
1843 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001844 return
Dan Talaycof6202252013-07-02 01:00:29 -07001845
1846 def pack(self):
1847 packed = []
1848 packed.append(struct.pack("!B", self.version))
1849 packed.append(struct.pack("!B", self.type))
1850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1851 packed.append(struct.pack("!L", self.xid))
1852 packed.append(struct.pack("!L", self.experimenter))
1853 packed.append(struct.pack("!L", self.subtype))
1854 packed.append(struct.pack("!L", self.enable))
1855 packed.append(struct.pack("!L", self.status))
1856 length = sum([len(x) for x in packed])
1857 packed[2] = struct.pack("!H", length)
1858 return ''.join(packed)
1859
1860 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001861 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001862 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001863 _version = reader.read("!B")[0]
1864 assert(_version == 4)
1865 _type = reader.read("!B")[0]
1866 assert(_type == 4)
1867 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001868 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001869 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001870 obj.xid = reader.read("!L")[0]
1871 _experimenter = reader.read("!L")[0]
1872 assert(_experimenter == 6035143)
1873 _subtype = reader.read("!L")[0]
1874 assert(_subtype == 23)
1875 obj.enable = reader.read("!L")[0]
1876 obj.status = reader.read("!L")[0]
1877 return obj
1878
1879 def __eq__(self, other):
1880 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001881 if self.xid != other.xid: return False
1882 if self.enable != other.enable: return False
1883 if self.status != other.status: return False
1884 return True
1885
Dan Talaycof6202252013-07-02 01:00:29 -07001886 def pretty_print(self, q):
1887 q.text("bsn_bw_enable_set_reply {")
1888 with q.group():
1889 with q.indent(2):
1890 q.breakable()
1891 q.text("xid = ");
1892 if self.xid != None:
1893 q.text("%#x" % self.xid)
1894 else:
1895 q.text('None')
1896 q.text(","); q.breakable()
1897 q.text("enable = ");
1898 q.text("%#x" % self.enable)
1899 q.text(","); q.breakable()
1900 q.text("status = ");
1901 q.text("%#x" % self.status)
1902 q.breakable()
1903 q.text('}')
1904
Rich Lane7dcdf022013-12-11 14:45:27 -08001905bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1906
1907class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001908 version = 4
1909 type = 4
1910 experimenter = 6035143
1911 subtype = 18
1912
1913 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001914 if xid != None:
1915 self.xid = xid
1916 else:
1917 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001918 if enable != None:
1919 self.enable = enable
1920 else:
1921 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001922 return
Dan Talaycof6202252013-07-02 01:00:29 -07001923
1924 def pack(self):
1925 packed = []
1926 packed.append(struct.pack("!B", self.version))
1927 packed.append(struct.pack("!B", self.type))
1928 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1929 packed.append(struct.pack("!L", self.xid))
1930 packed.append(struct.pack("!L", self.experimenter))
1931 packed.append(struct.pack("!L", self.subtype))
1932 packed.append(struct.pack("!L", self.enable))
1933 length = sum([len(x) for x in packed])
1934 packed[2] = struct.pack("!H", length)
1935 return ''.join(packed)
1936
1937 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001938 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001939 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001940 _version = reader.read("!B")[0]
1941 assert(_version == 4)
1942 _type = reader.read("!B")[0]
1943 assert(_type == 4)
1944 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001945 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001946 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001947 obj.xid = reader.read("!L")[0]
1948 _experimenter = reader.read("!L")[0]
1949 assert(_experimenter == 6035143)
1950 _subtype = reader.read("!L")[0]
1951 assert(_subtype == 18)
1952 obj.enable = reader.read("!L")[0]
1953 return obj
1954
1955 def __eq__(self, other):
1956 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001957 if self.xid != other.xid: return False
1958 if self.enable != other.enable: return False
1959 return True
1960
Dan Talaycof6202252013-07-02 01:00:29 -07001961 def pretty_print(self, q):
1962 q.text("bsn_bw_enable_set_request {")
1963 with q.group():
1964 with q.indent(2):
1965 q.breakable()
1966 q.text("xid = ");
1967 if self.xid != None:
1968 q.text("%#x" % self.xid)
1969 else:
1970 q.text('None')
1971 q.text(","); q.breakable()
1972 q.text("enable = ");
1973 q.text("%#x" % self.enable)
1974 q.breakable()
1975 q.text('}')
1976
Rich Lane7dcdf022013-12-11 14:45:27 -08001977bsn_header.subtypes[18] = bsn_bw_enable_set_request
1978
Rich Lane5454b682014-01-14 17:07:36 -08001979class bsn_controller_connections_reply(bsn_header):
1980 version = 4
1981 type = 4
1982 experimenter = 6035143
1983 subtype = 57
1984
1985 def __init__(self, xid=None, connections=None):
1986 if xid != None:
1987 self.xid = xid
1988 else:
1989 self.xid = None
1990 if connections != None:
1991 self.connections = connections
1992 else:
1993 self.connections = []
1994 return
1995
1996 def pack(self):
1997 packed = []
1998 packed.append(struct.pack("!B", self.version))
1999 packed.append(struct.pack("!B", self.type))
2000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2001 packed.append(struct.pack("!L", self.xid))
2002 packed.append(struct.pack("!L", self.experimenter))
2003 packed.append(struct.pack("!L", self.subtype))
2004 packed.append(loxi.generic_util.pack_list(self.connections))
2005 length = sum([len(x) for x in packed])
2006 packed[2] = struct.pack("!H", length)
2007 return ''.join(packed)
2008
2009 @staticmethod
2010 def unpack(reader):
2011 obj = bsn_controller_connections_reply()
2012 _version = reader.read("!B")[0]
2013 assert(_version == 4)
2014 _type = reader.read("!B")[0]
2015 assert(_type == 4)
2016 _length = reader.read("!H")[0]
2017 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002018 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002019 obj.xid = reader.read("!L")[0]
2020 _experimenter = reader.read("!L")[0]
2021 assert(_experimenter == 6035143)
2022 _subtype = reader.read("!L")[0]
2023 assert(_subtype == 57)
2024 obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack)
2025 return obj
2026
2027 def __eq__(self, other):
2028 if type(self) != type(other): return False
2029 if self.xid != other.xid: return False
2030 if self.connections != other.connections: return False
2031 return True
2032
2033 def pretty_print(self, q):
2034 q.text("bsn_controller_connections_reply {")
2035 with q.group():
2036 with q.indent(2):
2037 q.breakable()
2038 q.text("xid = ");
2039 if self.xid != None:
2040 q.text("%#x" % self.xid)
2041 else:
2042 q.text('None')
2043 q.text(","); q.breakable()
2044 q.text("connections = ");
2045 q.pp(self.connections)
2046 q.breakable()
2047 q.text('}')
2048
2049bsn_header.subtypes[57] = bsn_controller_connections_reply
2050
2051class bsn_controller_connections_request(bsn_header):
2052 version = 4
2053 type = 4
2054 experimenter = 6035143
2055 subtype = 56
2056
2057 def __init__(self, xid=None):
2058 if xid != None:
2059 self.xid = xid
2060 else:
2061 self.xid = None
2062 return
2063
2064 def pack(self):
2065 packed = []
2066 packed.append(struct.pack("!B", self.version))
2067 packed.append(struct.pack("!B", self.type))
2068 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2069 packed.append(struct.pack("!L", self.xid))
2070 packed.append(struct.pack("!L", self.experimenter))
2071 packed.append(struct.pack("!L", self.subtype))
2072 length = sum([len(x) for x in packed])
2073 packed[2] = struct.pack("!H", length)
2074 return ''.join(packed)
2075
2076 @staticmethod
2077 def unpack(reader):
2078 obj = bsn_controller_connections_request()
2079 _version = reader.read("!B")[0]
2080 assert(_version == 4)
2081 _type = reader.read("!B")[0]
2082 assert(_type == 4)
2083 _length = reader.read("!H")[0]
2084 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002085 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002086 obj.xid = reader.read("!L")[0]
2087 _experimenter = reader.read("!L")[0]
2088 assert(_experimenter == 6035143)
2089 _subtype = reader.read("!L")[0]
2090 assert(_subtype == 56)
2091 return obj
2092
2093 def __eq__(self, other):
2094 if type(self) != type(other): return False
2095 if self.xid != other.xid: return False
2096 return True
2097
2098 def pretty_print(self, q):
2099 q.text("bsn_controller_connections_request {")
2100 with q.group():
2101 with q.indent(2):
2102 q.breakable()
2103 q.text("xid = ");
2104 if self.xid != None:
2105 q.text("%#x" % self.xid)
2106 else:
2107 q.text('None')
2108 q.breakable()
2109 q.text('}')
2110
2111bsn_header.subtypes[56] = bsn_controller_connections_request
2112
Rich Lane9ec3fca2014-02-26 16:22:56 -08002113class experimenter_stats_reply(stats_reply):
2114 subtypes = {}
2115
2116 version = 4
2117 type = 19
2118 stats_type = 65535
2119
2120 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2121 if xid != None:
2122 self.xid = xid
2123 else:
2124 self.xid = None
2125 if flags != None:
2126 self.flags = flags
2127 else:
2128 self.flags = 0
2129 if experimenter != None:
2130 self.experimenter = experimenter
2131 else:
2132 self.experimenter = 0
2133 if subtype != None:
2134 self.subtype = subtype
2135 else:
2136 self.subtype = 0
2137 return
2138
2139 def pack(self):
2140 packed = []
2141 packed.append(struct.pack("!B", self.version))
2142 packed.append(struct.pack("!B", self.type))
2143 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2144 packed.append(struct.pack("!L", self.xid))
2145 packed.append(struct.pack("!H", self.stats_type))
2146 packed.append(struct.pack("!H", self.flags))
2147 packed.append('\x00' * 4)
2148 packed.append(struct.pack("!L", self.experimenter))
2149 packed.append(struct.pack("!L", self.subtype))
2150 length = sum([len(x) for x in packed])
2151 packed[2] = struct.pack("!H", length)
2152 return ''.join(packed)
2153
2154 @staticmethod
2155 def unpack(reader):
2156 subtype, = reader.peek('!L', 16)
2157 subclass = experimenter_stats_reply.subtypes.get(subtype)
2158 if subclass:
2159 return subclass.unpack(reader)
2160
2161 obj = experimenter_stats_reply()
2162 _version = reader.read("!B")[0]
2163 assert(_version == 4)
2164 _type = reader.read("!B")[0]
2165 assert(_type == 19)
2166 _length = reader.read("!H")[0]
2167 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002168 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002169 obj.xid = reader.read("!L")[0]
2170 _stats_type = reader.read("!H")[0]
2171 assert(_stats_type == 65535)
2172 obj.flags = reader.read("!H")[0]
2173 reader.skip(4)
2174 obj.experimenter = reader.read("!L")[0]
2175 obj.subtype = reader.read("!L")[0]
2176 return obj
2177
2178 def __eq__(self, other):
2179 if type(self) != type(other): return False
2180 if self.xid != other.xid: return False
2181 if self.flags != other.flags: return False
2182 if self.experimenter != other.experimenter: return False
2183 if self.subtype != other.subtype: return False
2184 return True
2185
2186 def pretty_print(self, q):
2187 q.text("experimenter_stats_reply {")
2188 with q.group():
2189 with q.indent(2):
2190 q.breakable()
2191 q.text("xid = ");
2192 if self.xid != None:
2193 q.text("%#x" % self.xid)
2194 else:
2195 q.text('None')
2196 q.text(","); q.breakable()
2197 q.text("flags = ");
2198 q.text("%#x" % self.flags)
2199 q.text(","); q.breakable()
2200 q.text("subtype = ");
2201 q.text("%#x" % self.subtype)
2202 q.breakable()
2203 q.text('}')
2204
2205stats_reply.subtypes[65535] = experimenter_stats_reply
2206
2207class bsn_stats_reply(experimenter_stats_reply):
2208 subtypes = {}
2209
2210 version = 4
2211 type = 19
2212 stats_type = 65535
2213 experimenter = 6035143
2214
2215 def __init__(self, xid=None, flags=None, subtype=None):
2216 if xid != None:
2217 self.xid = xid
2218 else:
2219 self.xid = None
2220 if flags != None:
2221 self.flags = flags
2222 else:
2223 self.flags = 0
2224 if subtype != None:
2225 self.subtype = subtype
2226 else:
2227 self.subtype = 0
2228 return
2229
2230 def pack(self):
2231 packed = []
2232 packed.append(struct.pack("!B", self.version))
2233 packed.append(struct.pack("!B", self.type))
2234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2235 packed.append(struct.pack("!L", self.xid))
2236 packed.append(struct.pack("!H", self.stats_type))
2237 packed.append(struct.pack("!H", self.flags))
2238 packed.append('\x00' * 4)
2239 packed.append(struct.pack("!L", self.experimenter))
2240 packed.append(struct.pack("!L", self.subtype))
2241 length = sum([len(x) for x in packed])
2242 packed[2] = struct.pack("!H", length)
2243 return ''.join(packed)
2244
2245 @staticmethod
2246 def unpack(reader):
2247 subtype, = reader.peek('!L', 20)
2248 subclass = bsn_stats_reply.subtypes.get(subtype)
2249 if subclass:
2250 return subclass.unpack(reader)
2251
2252 obj = bsn_stats_reply()
2253 _version = reader.read("!B")[0]
2254 assert(_version == 4)
2255 _type = reader.read("!B")[0]
2256 assert(_type == 19)
2257 _length = reader.read("!H")[0]
2258 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002259 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002260 obj.xid = reader.read("!L")[0]
2261 _stats_type = reader.read("!H")[0]
2262 assert(_stats_type == 65535)
2263 obj.flags = reader.read("!H")[0]
2264 reader.skip(4)
2265 _experimenter = reader.read("!L")[0]
2266 assert(_experimenter == 6035143)
2267 obj.subtype = reader.read("!L")[0]
2268 return obj
2269
2270 def __eq__(self, other):
2271 if type(self) != type(other): return False
2272 if self.xid != other.xid: return False
2273 if self.flags != other.flags: return False
2274 if self.subtype != other.subtype: return False
2275 return True
2276
2277 def pretty_print(self, q):
2278 q.text("bsn_stats_reply {")
2279 with q.group():
2280 with q.indent(2):
2281 q.breakable()
2282 q.text("xid = ");
2283 if self.xid != None:
2284 q.text("%#x" % self.xid)
2285 else:
2286 q.text('None')
2287 q.text(","); q.breakable()
2288 q.text("flags = ");
2289 q.text("%#x" % self.flags)
2290 q.breakable()
2291 q.text('}')
2292
2293experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2294
Rich Lane93b33132014-04-21 12:20:58 -07002295class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
Rich Lane9ec3fca2014-02-26 16:22:56 -08002296 version = 4
2297 type = 19
2298 stats_type = 65535
2299 experimenter = 6035143
Rich Lane93b33132014-04-21 12:20:58 -07002300 subtype = 13
Rich Lane9ec3fca2014-02-26 16:22:56 -08002301
2302 def __init__(self, xid=None, flags=None, entries=None):
2303 if xid != None:
2304 self.xid = xid
2305 else:
2306 self.xid = None
2307 if flags != None:
2308 self.flags = flags
2309 else:
2310 self.flags = 0
2311 if entries != None:
2312 self.entries = entries
2313 else:
2314 self.entries = []
2315 return
2316
2317 def pack(self):
2318 packed = []
2319 packed.append(struct.pack("!B", self.version))
2320 packed.append(struct.pack("!B", self.type))
2321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2322 packed.append(struct.pack("!L", self.xid))
2323 packed.append(struct.pack("!H", self.stats_type))
2324 packed.append(struct.pack("!H", self.flags))
2325 packed.append('\x00' * 4)
2326 packed.append(struct.pack("!L", self.experimenter))
2327 packed.append(struct.pack("!L", self.subtype))
2328 packed.append(loxi.generic_util.pack_list(self.entries))
2329 length = sum([len(x) for x in packed])
2330 packed[2] = struct.pack("!H", length)
2331 return ''.join(packed)
2332
2333 @staticmethod
2334 def unpack(reader):
Rich Lane93b33132014-04-21 12:20:58 -07002335 obj = bsn_debug_counter_desc_stats_reply()
Rich Lane9ec3fca2014-02-26 16:22:56 -08002336 _version = reader.read("!B")[0]
2337 assert(_version == 4)
2338 _type = reader.read("!B")[0]
2339 assert(_type == 19)
2340 _length = reader.read("!H")[0]
2341 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002342 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002343 obj.xid = reader.read("!L")[0]
2344 _stats_type = reader.read("!H")[0]
2345 assert(_stats_type == 65535)
2346 obj.flags = reader.read("!H")[0]
2347 reader.skip(4)
2348 _experimenter = reader.read("!L")[0]
2349 assert(_experimenter == 6035143)
2350 _subtype = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -07002351 assert(_subtype == 13)
2352 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_desc_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002353 return obj
2354
2355 def __eq__(self, other):
2356 if type(self) != type(other): return False
2357 if self.xid != other.xid: return False
2358 if self.flags != other.flags: return False
2359 if self.entries != other.entries: return False
2360 return True
2361
2362 def pretty_print(self, q):
Rich Lane93b33132014-04-21 12:20:58 -07002363 q.text("bsn_debug_counter_desc_stats_reply {")
Rich Lane9ec3fca2014-02-26 16:22:56 -08002364 with q.group():
2365 with q.indent(2):
2366 q.breakable()
2367 q.text("xid = ");
2368 if self.xid != None:
2369 q.text("%#x" % self.xid)
2370 else:
2371 q.text('None')
2372 q.text(","); q.breakable()
2373 q.text("flags = ");
2374 q.text("%#x" % self.flags)
2375 q.text(","); q.breakable()
2376 q.text("entries = ");
2377 q.pp(self.entries)
2378 q.breakable()
2379 q.text('}')
2380
Rich Lane93b33132014-04-21 12:20:58 -07002381bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
Rich Lane9ec3fca2014-02-26 16:22:56 -08002382
2383class experimenter_stats_request(stats_request):
2384 subtypes = {}
2385
2386 version = 4
2387 type = 18
2388 stats_type = 65535
2389
2390 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2391 if xid != None:
2392 self.xid = xid
2393 else:
2394 self.xid = None
2395 if flags != None:
2396 self.flags = flags
2397 else:
2398 self.flags = 0
2399 if experimenter != None:
2400 self.experimenter = experimenter
2401 else:
2402 self.experimenter = 0
2403 if subtype != None:
2404 self.subtype = subtype
2405 else:
2406 self.subtype = 0
2407 return
2408
2409 def pack(self):
2410 packed = []
2411 packed.append(struct.pack("!B", self.version))
2412 packed.append(struct.pack("!B", self.type))
2413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2414 packed.append(struct.pack("!L", self.xid))
2415 packed.append(struct.pack("!H", self.stats_type))
2416 packed.append(struct.pack("!H", self.flags))
2417 packed.append('\x00' * 4)
2418 packed.append(struct.pack("!L", self.experimenter))
2419 packed.append(struct.pack("!L", self.subtype))
2420 length = sum([len(x) for x in packed])
2421 packed[2] = struct.pack("!H", length)
2422 return ''.join(packed)
2423
2424 @staticmethod
2425 def unpack(reader):
2426 subtype, = reader.peek('!L', 16)
2427 subclass = experimenter_stats_request.subtypes.get(subtype)
2428 if subclass:
2429 return subclass.unpack(reader)
2430
2431 obj = experimenter_stats_request()
2432 _version = reader.read("!B")[0]
2433 assert(_version == 4)
2434 _type = reader.read("!B")[0]
2435 assert(_type == 18)
2436 _length = reader.read("!H")[0]
2437 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002438 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002439 obj.xid = reader.read("!L")[0]
2440 _stats_type = reader.read("!H")[0]
2441 assert(_stats_type == 65535)
2442 obj.flags = reader.read("!H")[0]
2443 reader.skip(4)
2444 obj.experimenter = reader.read("!L")[0]
2445 obj.subtype = reader.read("!L")[0]
2446 return obj
2447
2448 def __eq__(self, other):
2449 if type(self) != type(other): return False
2450 if self.xid != other.xid: return False
2451 if self.flags != other.flags: return False
2452 if self.experimenter != other.experimenter: return False
2453 if self.subtype != other.subtype: return False
2454 return True
2455
2456 def pretty_print(self, q):
2457 q.text("experimenter_stats_request {")
2458 with q.group():
2459 with q.indent(2):
2460 q.breakable()
2461 q.text("xid = ");
2462 if self.xid != None:
2463 q.text("%#x" % self.xid)
2464 else:
2465 q.text('None')
2466 q.text(","); q.breakable()
2467 q.text("flags = ");
2468 q.text("%#x" % self.flags)
2469 q.text(","); q.breakable()
2470 q.text("subtype = ");
2471 q.text("%#x" % self.subtype)
2472 q.breakable()
2473 q.text('}')
2474
2475stats_request.subtypes[65535] = experimenter_stats_request
2476
2477class bsn_stats_request(experimenter_stats_request):
2478 subtypes = {}
2479
2480 version = 4
2481 type = 18
2482 stats_type = 65535
2483 experimenter = 6035143
2484
2485 def __init__(self, xid=None, flags=None, subtype=None):
2486 if xid != None:
2487 self.xid = xid
2488 else:
2489 self.xid = None
2490 if flags != None:
2491 self.flags = flags
2492 else:
2493 self.flags = 0
2494 if subtype != None:
2495 self.subtype = subtype
2496 else:
2497 self.subtype = 0
2498 return
2499
2500 def pack(self):
2501 packed = []
2502 packed.append(struct.pack("!B", self.version))
2503 packed.append(struct.pack("!B", self.type))
2504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2505 packed.append(struct.pack("!L", self.xid))
2506 packed.append(struct.pack("!H", self.stats_type))
2507 packed.append(struct.pack("!H", self.flags))
2508 packed.append('\x00' * 4)
2509 packed.append(struct.pack("!L", self.experimenter))
2510 packed.append(struct.pack("!L", self.subtype))
2511 length = sum([len(x) for x in packed])
2512 packed[2] = struct.pack("!H", length)
2513 return ''.join(packed)
2514
2515 @staticmethod
2516 def unpack(reader):
2517 subtype, = reader.peek('!L', 20)
2518 subclass = bsn_stats_request.subtypes.get(subtype)
2519 if subclass:
2520 return subclass.unpack(reader)
2521
2522 obj = bsn_stats_request()
2523 _version = reader.read("!B")[0]
2524 assert(_version == 4)
2525 _type = reader.read("!B")[0]
2526 assert(_type == 18)
2527 _length = reader.read("!H")[0]
2528 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002529 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002530 obj.xid = reader.read("!L")[0]
2531 _stats_type = reader.read("!H")[0]
2532 assert(_stats_type == 65535)
2533 obj.flags = reader.read("!H")[0]
2534 reader.skip(4)
2535 _experimenter = reader.read("!L")[0]
2536 assert(_experimenter == 6035143)
2537 obj.subtype = reader.read("!L")[0]
2538 return obj
2539
2540 def __eq__(self, other):
2541 if type(self) != type(other): return False
2542 if self.xid != other.xid: return False
2543 if self.flags != other.flags: return False
2544 if self.subtype != other.subtype: return False
2545 return True
2546
2547 def pretty_print(self, q):
2548 q.text("bsn_stats_request {")
2549 with q.group():
2550 with q.indent(2):
2551 q.breakable()
2552 q.text("xid = ");
2553 if self.xid != None:
2554 q.text("%#x" % self.xid)
2555 else:
2556 q.text('None')
2557 q.text(","); q.breakable()
2558 q.text("flags = ");
2559 q.text("%#x" % self.flags)
2560 q.breakable()
2561 q.text('}')
2562
2563experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2564
Rich Lane93b33132014-04-21 12:20:58 -07002565class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2566 version = 4
2567 type = 18
2568 stats_type = 65535
2569 experimenter = 6035143
2570 subtype = 13
2571
2572 def __init__(self, xid=None, flags=None):
2573 if xid != None:
2574 self.xid = xid
2575 else:
2576 self.xid = None
2577 if flags != None:
2578 self.flags = flags
2579 else:
2580 self.flags = 0
2581 return
2582
2583 def pack(self):
2584 packed = []
2585 packed.append(struct.pack("!B", self.version))
2586 packed.append(struct.pack("!B", self.type))
2587 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2588 packed.append(struct.pack("!L", self.xid))
2589 packed.append(struct.pack("!H", self.stats_type))
2590 packed.append(struct.pack("!H", self.flags))
2591 packed.append('\x00' * 4)
2592 packed.append(struct.pack("!L", self.experimenter))
2593 packed.append(struct.pack("!L", self.subtype))
2594 length = sum([len(x) for x in packed])
2595 packed[2] = struct.pack("!H", length)
2596 return ''.join(packed)
2597
2598 @staticmethod
2599 def unpack(reader):
2600 obj = bsn_debug_counter_desc_stats_request()
2601 _version = reader.read("!B")[0]
2602 assert(_version == 4)
2603 _type = reader.read("!B")[0]
2604 assert(_type == 18)
2605 _length = reader.read("!H")[0]
2606 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002607 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002608 obj.xid = reader.read("!L")[0]
2609 _stats_type = reader.read("!H")[0]
2610 assert(_stats_type == 65535)
2611 obj.flags = reader.read("!H")[0]
2612 reader.skip(4)
2613 _experimenter = reader.read("!L")[0]
2614 assert(_experimenter == 6035143)
2615 _subtype = reader.read("!L")[0]
2616 assert(_subtype == 13)
2617 return obj
2618
2619 def __eq__(self, other):
2620 if type(self) != type(other): return False
2621 if self.xid != other.xid: return False
2622 if self.flags != other.flags: return False
2623 return True
2624
2625 def pretty_print(self, q):
2626 q.text("bsn_debug_counter_desc_stats_request {")
2627 with q.group():
2628 with q.indent(2):
2629 q.breakable()
2630 q.text("xid = ");
2631 if self.xid != None:
2632 q.text("%#x" % self.xid)
2633 else:
2634 q.text('None')
2635 q.text(","); q.breakable()
2636 q.text("flags = ");
2637 q.text("%#x" % self.flags)
2638 q.breakable()
2639 q.text('}')
2640
2641bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2642
2643class bsn_debug_counter_stats_reply(bsn_stats_reply):
2644 version = 4
2645 type = 19
2646 stats_type = 65535
2647 experimenter = 6035143
2648 subtype = 12
2649
2650 def __init__(self, xid=None, flags=None, entries=None):
2651 if xid != None:
2652 self.xid = xid
2653 else:
2654 self.xid = None
2655 if flags != None:
2656 self.flags = flags
2657 else:
2658 self.flags = 0
2659 if entries != None:
2660 self.entries = entries
2661 else:
2662 self.entries = []
2663 return
2664
2665 def pack(self):
2666 packed = []
2667 packed.append(struct.pack("!B", self.version))
2668 packed.append(struct.pack("!B", self.type))
2669 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2670 packed.append(struct.pack("!L", self.xid))
2671 packed.append(struct.pack("!H", self.stats_type))
2672 packed.append(struct.pack("!H", self.flags))
2673 packed.append('\x00' * 4)
2674 packed.append(struct.pack("!L", self.experimenter))
2675 packed.append(struct.pack("!L", self.subtype))
2676 packed.append(loxi.generic_util.pack_list(self.entries))
2677 length = sum([len(x) for x in packed])
2678 packed[2] = struct.pack("!H", length)
2679 return ''.join(packed)
2680
2681 @staticmethod
2682 def unpack(reader):
2683 obj = bsn_debug_counter_stats_reply()
2684 _version = reader.read("!B")[0]
2685 assert(_version == 4)
2686 _type = reader.read("!B")[0]
2687 assert(_type == 19)
2688 _length = reader.read("!H")[0]
2689 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002690 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002691 obj.xid = reader.read("!L")[0]
2692 _stats_type = reader.read("!H")[0]
2693 assert(_stats_type == 65535)
2694 obj.flags = reader.read("!H")[0]
2695 reader.skip(4)
2696 _experimenter = reader.read("!L")[0]
2697 assert(_experimenter == 6035143)
2698 _subtype = reader.read("!L")[0]
2699 assert(_subtype == 12)
2700 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_stats_entry.unpack)
2701 return obj
2702
2703 def __eq__(self, other):
2704 if type(self) != type(other): return False
2705 if self.xid != other.xid: return False
2706 if self.flags != other.flags: return False
2707 if self.entries != other.entries: return False
2708 return True
2709
2710 def pretty_print(self, q):
2711 q.text("bsn_debug_counter_stats_reply {")
2712 with q.group():
2713 with q.indent(2):
2714 q.breakable()
2715 q.text("xid = ");
2716 if self.xid != None:
2717 q.text("%#x" % self.xid)
2718 else:
2719 q.text('None')
2720 q.text(","); q.breakable()
2721 q.text("flags = ");
2722 q.text("%#x" % self.flags)
2723 q.text(","); q.breakable()
2724 q.text("entries = ");
2725 q.pp(self.entries)
2726 q.breakable()
2727 q.text('}')
2728
2729bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2730
2731class bsn_debug_counter_stats_request(bsn_stats_request):
2732 version = 4
2733 type = 18
2734 stats_type = 65535
2735 experimenter = 6035143
2736 subtype = 12
2737
2738 def __init__(self, xid=None, flags=None):
2739 if xid != None:
2740 self.xid = xid
2741 else:
2742 self.xid = None
2743 if flags != None:
2744 self.flags = flags
2745 else:
2746 self.flags = 0
2747 return
2748
2749 def pack(self):
2750 packed = []
2751 packed.append(struct.pack("!B", self.version))
2752 packed.append(struct.pack("!B", self.type))
2753 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2754 packed.append(struct.pack("!L", self.xid))
2755 packed.append(struct.pack("!H", self.stats_type))
2756 packed.append(struct.pack("!H", self.flags))
2757 packed.append('\x00' * 4)
2758 packed.append(struct.pack("!L", self.experimenter))
2759 packed.append(struct.pack("!L", self.subtype))
2760 length = sum([len(x) for x in packed])
2761 packed[2] = struct.pack("!H", length)
2762 return ''.join(packed)
2763
2764 @staticmethod
2765 def unpack(reader):
2766 obj = bsn_debug_counter_stats_request()
2767 _version = reader.read("!B")[0]
2768 assert(_version == 4)
2769 _type = reader.read("!B")[0]
2770 assert(_type == 18)
2771 _length = reader.read("!H")[0]
2772 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002773 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002774 obj.xid = reader.read("!L")[0]
2775 _stats_type = reader.read("!H")[0]
2776 assert(_stats_type == 65535)
2777 obj.flags = reader.read("!H")[0]
2778 reader.skip(4)
2779 _experimenter = reader.read("!L")[0]
2780 assert(_experimenter == 6035143)
2781 _subtype = reader.read("!L")[0]
2782 assert(_subtype == 12)
2783 return obj
2784
2785 def __eq__(self, other):
2786 if type(self) != type(other): return False
2787 if self.xid != other.xid: return False
2788 if self.flags != other.flags: return False
2789 return True
2790
2791 def pretty_print(self, q):
2792 q.text("bsn_debug_counter_stats_request {")
2793 with q.group():
2794 with q.indent(2):
2795 q.breakable()
2796 q.text("xid = ");
2797 if self.xid != None:
2798 q.text("%#x" % self.xid)
2799 else:
2800 q.text('None')
2801 q.text(","); q.breakable()
2802 q.text("flags = ");
2803 q.text("%#x" % self.flags)
2804 q.breakable()
2805 q.text('}')
2806
2807bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2808
2809class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2810 version = 4
2811 type = 19
2812 stats_type = 65535
2813 experimenter = 6035143
2814 subtype = 10
2815
2816 def __init__(self, xid=None, flags=None, entries=None):
2817 if xid != None:
2818 self.xid = xid
2819 else:
2820 self.xid = None
2821 if flags != None:
2822 self.flags = flags
2823 else:
2824 self.flags = 0
2825 if entries != None:
2826 self.entries = entries
2827 else:
2828 self.entries = []
2829 return
2830
2831 def pack(self):
2832 packed = []
2833 packed.append(struct.pack("!B", self.version))
2834 packed.append(struct.pack("!B", self.type))
2835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2836 packed.append(struct.pack("!L", self.xid))
2837 packed.append(struct.pack("!H", self.stats_type))
2838 packed.append(struct.pack("!H", self.flags))
2839 packed.append('\x00' * 4)
2840 packed.append(struct.pack("!L", self.experimenter))
2841 packed.append(struct.pack("!L", self.subtype))
2842 packed.append(loxi.generic_util.pack_list(self.entries))
2843 length = sum([len(x) for x in packed])
2844 packed[2] = struct.pack("!H", length)
2845 return ''.join(packed)
2846
2847 @staticmethod
2848 def unpack(reader):
2849 obj = bsn_flow_checksum_bucket_stats_reply()
2850 _version = reader.read("!B")[0]
2851 assert(_version == 4)
2852 _type = reader.read("!B")[0]
2853 assert(_type == 19)
2854 _length = reader.read("!H")[0]
2855 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002856 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002857 obj.xid = reader.read("!L")[0]
2858 _stats_type = reader.read("!H")[0]
2859 assert(_stats_type == 65535)
2860 obj.flags = reader.read("!H")[0]
2861 reader.skip(4)
2862 _experimenter = reader.read("!L")[0]
2863 assert(_experimenter == 6035143)
2864 _subtype = reader.read("!L")[0]
2865 assert(_subtype == 10)
2866 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack)
2867 return obj
2868
2869 def __eq__(self, other):
2870 if type(self) != type(other): return False
2871 if self.xid != other.xid: return False
2872 if self.flags != other.flags: return False
2873 if self.entries != other.entries: return False
2874 return True
2875
2876 def pretty_print(self, q):
2877 q.text("bsn_flow_checksum_bucket_stats_reply {")
2878 with q.group():
2879 with q.indent(2):
2880 q.breakable()
2881 q.text("xid = ");
2882 if self.xid != None:
2883 q.text("%#x" % self.xid)
2884 else:
2885 q.text('None')
2886 q.text(","); q.breakable()
2887 q.text("flags = ");
2888 q.text("%#x" % self.flags)
2889 q.text(","); q.breakable()
2890 q.text("entries = ");
2891 q.pp(self.entries)
2892 q.breakable()
2893 q.text('}')
2894
2895bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2896
Rich Lane9ec3fca2014-02-26 16:22:56 -08002897class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2898 version = 4
2899 type = 18
2900 stats_type = 65535
2901 experimenter = 6035143
2902 subtype = 10
2903
2904 def __init__(self, xid=None, flags=None, table_id=None):
2905 if xid != None:
2906 self.xid = xid
2907 else:
2908 self.xid = None
2909 if flags != None:
2910 self.flags = flags
2911 else:
2912 self.flags = 0
2913 if table_id != None:
2914 self.table_id = table_id
2915 else:
2916 self.table_id = 0
2917 return
2918
2919 def pack(self):
2920 packed = []
2921 packed.append(struct.pack("!B", self.version))
2922 packed.append(struct.pack("!B", self.type))
2923 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2924 packed.append(struct.pack("!L", self.xid))
2925 packed.append(struct.pack("!H", self.stats_type))
2926 packed.append(struct.pack("!H", self.flags))
2927 packed.append('\x00' * 4)
2928 packed.append(struct.pack("!L", self.experimenter))
2929 packed.append(struct.pack("!L", self.subtype))
2930 packed.append(struct.pack("!B", self.table_id))
2931 length = sum([len(x) for x in packed])
2932 packed[2] = struct.pack("!H", length)
2933 return ''.join(packed)
2934
2935 @staticmethod
2936 def unpack(reader):
2937 obj = bsn_flow_checksum_bucket_stats_request()
2938 _version = reader.read("!B")[0]
2939 assert(_version == 4)
2940 _type = reader.read("!B")[0]
2941 assert(_type == 18)
2942 _length = reader.read("!H")[0]
2943 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002944 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002945 obj.xid = reader.read("!L")[0]
2946 _stats_type = reader.read("!H")[0]
2947 assert(_stats_type == 65535)
2948 obj.flags = reader.read("!H")[0]
2949 reader.skip(4)
2950 _experimenter = reader.read("!L")[0]
2951 assert(_experimenter == 6035143)
2952 _subtype = reader.read("!L")[0]
2953 assert(_subtype == 10)
2954 obj.table_id = reader.read("!B")[0]
2955 return obj
2956
2957 def __eq__(self, other):
2958 if type(self) != type(other): return False
2959 if self.xid != other.xid: return False
2960 if self.flags != other.flags: return False
2961 if self.table_id != other.table_id: return False
2962 return True
2963
2964 def pretty_print(self, q):
2965 q.text("bsn_flow_checksum_bucket_stats_request {")
2966 with q.group():
2967 with q.indent(2):
2968 q.breakable()
2969 q.text("xid = ");
2970 if self.xid != None:
2971 q.text("%#x" % self.xid)
2972 else:
2973 q.text('None')
2974 q.text(","); q.breakable()
2975 q.text("flags = ");
2976 q.text("%#x" % self.flags)
2977 q.text(","); q.breakable()
2978 q.text("table_id = ");
2979 q.text("%#x" % self.table_id)
2980 q.breakable()
2981 q.text('}')
2982
2983bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2984
Rich Lane7dcdf022013-12-11 14:45:27 -08002985class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002986 version = 4
2987 type = 4
2988 experimenter = 6035143
2989 subtype = 40
2990
2991 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002992 if xid != None:
2993 self.xid = xid
2994 else:
2995 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002996 if cookie != None:
2997 self.cookie = cookie
2998 else:
2999 self.cookie = 0
3000 if priority != None:
3001 self.priority = priority
3002 else:
3003 self.priority = 0
3004 if table_id != None:
3005 self.table_id = table_id
3006 else:
3007 self.table_id = 0
3008 if match != None:
3009 self.match = match
3010 else:
3011 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08003012 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003013
3014 def pack(self):
3015 packed = []
3016 packed.append(struct.pack("!B", self.version))
3017 packed.append(struct.pack("!B", self.type))
3018 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3019 packed.append(struct.pack("!L", self.xid))
3020 packed.append(struct.pack("!L", self.experimenter))
3021 packed.append(struct.pack("!L", self.subtype))
3022 packed.append(struct.pack("!Q", self.cookie))
3023 packed.append(struct.pack("!H", self.priority))
3024 packed.append(struct.pack("!B", self.table_id))
3025 packed.append('\x00' * 5)
3026 packed.append(self.match.pack())
3027 length = sum([len(x) for x in packed])
3028 packed[2] = struct.pack("!H", length)
3029 return ''.join(packed)
3030
3031 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003032 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003033 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07003034 _version = reader.read("!B")[0]
3035 assert(_version == 4)
3036 _type = reader.read("!B")[0]
3037 assert(_type == 4)
3038 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003039 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003040 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003041 obj.xid = reader.read("!L")[0]
3042 _experimenter = reader.read("!L")[0]
3043 assert(_experimenter == 6035143)
3044 _subtype = reader.read("!L")[0]
3045 assert(_subtype == 40)
3046 obj.cookie = reader.read("!Q")[0]
3047 obj.priority = reader.read("!H")[0]
3048 obj.table_id = reader.read("!B")[0]
3049 reader.skip(5)
3050 obj.match = common.match.unpack(reader)
3051 return obj
3052
3053 def __eq__(self, other):
3054 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003055 if self.xid != other.xid: return False
3056 if self.cookie != other.cookie: return False
3057 if self.priority != other.priority: return False
3058 if self.table_id != other.table_id: return False
3059 if self.match != other.match: return False
3060 return True
3061
Rich Lane6f4978c2013-10-20 21:33:52 -07003062 def pretty_print(self, q):
3063 q.text("bsn_flow_idle {")
3064 with q.group():
3065 with q.indent(2):
3066 q.breakable()
3067 q.text("xid = ");
3068 if self.xid != None:
3069 q.text("%#x" % self.xid)
3070 else:
3071 q.text('None')
3072 q.text(","); q.breakable()
3073 q.text("cookie = ");
3074 q.text("%#x" % self.cookie)
3075 q.text(","); q.breakable()
3076 q.text("priority = ");
3077 q.text("%#x" % self.priority)
3078 q.text(","); q.breakable()
3079 q.text("table_id = ");
3080 q.text("%#x" % self.table_id)
3081 q.text(","); q.breakable()
3082 q.text("match = ");
3083 q.pp(self.match)
3084 q.breakable()
3085 q.text('}')
3086
Rich Lane7dcdf022013-12-11 14:45:27 -08003087bsn_header.subtypes[40] = bsn_flow_idle
3088
3089class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003090 version = 4
3091 type = 4
3092 experimenter = 6035143
3093 subtype = 39
3094
3095 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003096 if xid != None:
3097 self.xid = xid
3098 else:
3099 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003100 if enabled != None:
3101 self.enabled = enabled
3102 else:
3103 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003104 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003105
3106 def pack(self):
3107 packed = []
3108 packed.append(struct.pack("!B", self.version))
3109 packed.append(struct.pack("!B", self.type))
3110 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3111 packed.append(struct.pack("!L", self.xid))
3112 packed.append(struct.pack("!L", self.experimenter))
3113 packed.append(struct.pack("!L", self.subtype))
3114 packed.append(struct.pack("!L", self.enabled))
3115 length = sum([len(x) for x in packed])
3116 packed[2] = struct.pack("!H", length)
3117 return ''.join(packed)
3118
3119 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003120 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003121 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003122 _version = reader.read("!B")[0]
3123 assert(_version == 4)
3124 _type = reader.read("!B")[0]
3125 assert(_type == 4)
3126 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003127 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003128 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003129 obj.xid = reader.read("!L")[0]
3130 _experimenter = reader.read("!L")[0]
3131 assert(_experimenter == 6035143)
3132 _subtype = reader.read("!L")[0]
3133 assert(_subtype == 39)
3134 obj.enabled = reader.read("!L")[0]
3135 return obj
3136
3137 def __eq__(self, other):
3138 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003139 if self.xid != other.xid: return False
3140 if self.enabled != other.enabled: return False
3141 return True
3142
Rich Lane6f4978c2013-10-20 21:33:52 -07003143 def pretty_print(self, q):
3144 q.text("bsn_flow_idle_enable_get_reply {")
3145 with q.group():
3146 with q.indent(2):
3147 q.breakable()
3148 q.text("xid = ");
3149 if self.xid != None:
3150 q.text("%#x" % self.xid)
3151 else:
3152 q.text('None')
3153 q.text(","); q.breakable()
3154 q.text("enabled = ");
3155 q.text("%#x" % self.enabled)
3156 q.breakable()
3157 q.text('}')
3158
Rich Lane7dcdf022013-12-11 14:45:27 -08003159bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3160
3161class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003162 version = 4
3163 type = 4
3164 experimenter = 6035143
3165 subtype = 38
3166
3167 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003168 if xid != None:
3169 self.xid = xid
3170 else:
3171 self.xid = None
3172 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003173
3174 def pack(self):
3175 packed = []
3176 packed.append(struct.pack("!B", self.version))
3177 packed.append(struct.pack("!B", self.type))
3178 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3179 packed.append(struct.pack("!L", self.xid))
3180 packed.append(struct.pack("!L", self.experimenter))
3181 packed.append(struct.pack("!L", self.subtype))
3182 length = sum([len(x) for x in packed])
3183 packed[2] = struct.pack("!H", length)
3184 return ''.join(packed)
3185
3186 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003187 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003188 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003189 _version = reader.read("!B")[0]
3190 assert(_version == 4)
3191 _type = reader.read("!B")[0]
3192 assert(_type == 4)
3193 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003194 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003195 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003196 obj.xid = reader.read("!L")[0]
3197 _experimenter = reader.read("!L")[0]
3198 assert(_experimenter == 6035143)
3199 _subtype = reader.read("!L")[0]
3200 assert(_subtype == 38)
3201 return obj
3202
3203 def __eq__(self, other):
3204 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003205 if self.xid != other.xid: return False
3206 return True
3207
Rich Lane6f4978c2013-10-20 21:33:52 -07003208 def pretty_print(self, q):
3209 q.text("bsn_flow_idle_enable_get_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.breakable()
3219 q.text('}')
3220
Rich Lane7dcdf022013-12-11 14:45:27 -08003221bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3222
3223class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003224 version = 4
3225 type = 4
3226 experimenter = 6035143
3227 subtype = 37
3228
3229 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003230 if xid != None:
3231 self.xid = xid
3232 else:
3233 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003234 if enable != None:
3235 self.enable = enable
3236 else:
3237 self.enable = 0
3238 if status != None:
3239 self.status = status
3240 else:
3241 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003242 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003243
3244 def pack(self):
3245 packed = []
3246 packed.append(struct.pack("!B", self.version))
3247 packed.append(struct.pack("!B", self.type))
3248 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3249 packed.append(struct.pack("!L", self.xid))
3250 packed.append(struct.pack("!L", self.experimenter))
3251 packed.append(struct.pack("!L", self.subtype))
3252 packed.append(struct.pack("!L", self.enable))
3253 packed.append(struct.pack("!L", self.status))
3254 length = sum([len(x) for x in packed])
3255 packed[2] = struct.pack("!H", length)
3256 return ''.join(packed)
3257
3258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003259 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003260 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003261 _version = reader.read("!B")[0]
3262 assert(_version == 4)
3263 _type = reader.read("!B")[0]
3264 assert(_type == 4)
3265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003266 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003267 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003268 obj.xid = reader.read("!L")[0]
3269 _experimenter = reader.read("!L")[0]
3270 assert(_experimenter == 6035143)
3271 _subtype = reader.read("!L")[0]
3272 assert(_subtype == 37)
3273 obj.enable = reader.read("!L")[0]
3274 obj.status = reader.read("!L")[0]
3275 return obj
3276
3277 def __eq__(self, other):
3278 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003279 if self.xid != other.xid: return False
3280 if self.enable != other.enable: return False
3281 if self.status != other.status: return False
3282 return True
3283
Rich Lane6f4978c2013-10-20 21:33:52 -07003284 def pretty_print(self, q):
3285 q.text("bsn_flow_idle_enable_set_reply {")
3286 with q.group():
3287 with q.indent(2):
3288 q.breakable()
3289 q.text("xid = ");
3290 if self.xid != None:
3291 q.text("%#x" % self.xid)
3292 else:
3293 q.text('None')
3294 q.text(","); q.breakable()
3295 q.text("enable = ");
3296 q.text("%#x" % self.enable)
3297 q.text(","); q.breakable()
3298 q.text("status = ");
3299 q.text("%#x" % self.status)
3300 q.breakable()
3301 q.text('}')
3302
Rich Lane7dcdf022013-12-11 14:45:27 -08003303bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3304
3305class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003306 version = 4
3307 type = 4
3308 experimenter = 6035143
3309 subtype = 36
3310
3311 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003312 if xid != None:
3313 self.xid = xid
3314 else:
3315 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003316 if enable != None:
3317 self.enable = enable
3318 else:
3319 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003320 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003321
3322 def pack(self):
3323 packed = []
3324 packed.append(struct.pack("!B", self.version))
3325 packed.append(struct.pack("!B", self.type))
3326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3327 packed.append(struct.pack("!L", self.xid))
3328 packed.append(struct.pack("!L", self.experimenter))
3329 packed.append(struct.pack("!L", self.subtype))
3330 packed.append(struct.pack("!L", self.enable))
3331 length = sum([len(x) for x in packed])
3332 packed[2] = struct.pack("!H", length)
3333 return ''.join(packed)
3334
3335 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003336 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003337 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003338 _version = reader.read("!B")[0]
3339 assert(_version == 4)
3340 _type = reader.read("!B")[0]
3341 assert(_type == 4)
3342 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003343 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003344 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003345 obj.xid = reader.read("!L")[0]
3346 _experimenter = reader.read("!L")[0]
3347 assert(_experimenter == 6035143)
3348 _subtype = reader.read("!L")[0]
3349 assert(_subtype == 36)
3350 obj.enable = reader.read("!L")[0]
3351 return obj
3352
3353 def __eq__(self, other):
3354 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003355 if self.xid != other.xid: return False
3356 if self.enable != other.enable: return False
3357 return True
3358
Rich Lane6f4978c2013-10-20 21:33:52 -07003359 def pretty_print(self, q):
3360 q.text("bsn_flow_idle_enable_set_request {")
3361 with q.group():
3362 with q.indent(2):
3363 q.breakable()
3364 q.text("xid = ");
3365 if self.xid != None:
3366 q.text("%#x" % self.xid)
3367 else:
3368 q.text('None')
3369 q.text(","); q.breakable()
3370 q.text("enable = ");
3371 q.text("%#x" % self.enable)
3372 q.breakable()
3373 q.text('}')
3374
Rich Lane7dcdf022013-12-11 14:45:27 -08003375bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3376
Rich Lanecb18dbd2014-12-18 10:02:29 -08003377class bsn_generic_stats_reply(bsn_stats_reply):
3378 version = 4
3379 type = 19
3380 stats_type = 65535
3381 experimenter = 6035143
3382 subtype = 16
3383
3384 def __init__(self, xid=None, flags=None, entries=None):
3385 if xid != None:
3386 self.xid = xid
3387 else:
3388 self.xid = None
3389 if flags != None:
3390 self.flags = flags
3391 else:
3392 self.flags = 0
3393 if entries != None:
3394 self.entries = entries
3395 else:
3396 self.entries = []
3397 return
3398
3399 def pack(self):
3400 packed = []
3401 packed.append(struct.pack("!B", self.version))
3402 packed.append(struct.pack("!B", self.type))
3403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3404 packed.append(struct.pack("!L", self.xid))
3405 packed.append(struct.pack("!H", self.stats_type))
3406 packed.append(struct.pack("!H", self.flags))
3407 packed.append('\x00' * 4)
3408 packed.append(struct.pack("!L", self.experimenter))
3409 packed.append(struct.pack("!L", self.subtype))
3410 packed.append(loxi.generic_util.pack_list(self.entries))
3411 length = sum([len(x) for x in packed])
3412 packed[2] = struct.pack("!H", length)
3413 return ''.join(packed)
3414
3415 @staticmethod
3416 def unpack(reader):
3417 obj = bsn_generic_stats_reply()
3418 _version = reader.read("!B")[0]
3419 assert(_version == 4)
3420 _type = reader.read("!B")[0]
3421 assert(_type == 19)
3422 _length = reader.read("!H")[0]
3423 orig_reader = reader
3424 reader = orig_reader.slice(_length, 4)
3425 obj.xid = reader.read("!L")[0]
3426 _stats_type = reader.read("!H")[0]
3427 assert(_stats_type == 65535)
3428 obj.flags = reader.read("!H")[0]
3429 reader.skip(4)
3430 _experimenter = reader.read("!L")[0]
3431 assert(_experimenter == 6035143)
3432 _subtype = reader.read("!L")[0]
3433 assert(_subtype == 16)
3434 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_generic_stats_entry.unpack)
3435 return obj
3436
3437 def __eq__(self, other):
3438 if type(self) != type(other): return False
3439 if self.xid != other.xid: return False
3440 if self.flags != other.flags: return False
3441 if self.entries != other.entries: return False
3442 return True
3443
3444 def pretty_print(self, q):
3445 q.text("bsn_generic_stats_reply {")
3446 with q.group():
3447 with q.indent(2):
3448 q.breakable()
3449 q.text("xid = ");
3450 if self.xid != None:
3451 q.text("%#x" % self.xid)
3452 else:
3453 q.text('None')
3454 q.text(","); q.breakable()
3455 q.text("flags = ");
3456 q.text("%#x" % self.flags)
3457 q.text(","); q.breakable()
3458 q.text("entries = ");
3459 q.pp(self.entries)
3460 q.breakable()
3461 q.text('}')
3462
3463bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3464
3465class bsn_generic_stats_request(bsn_stats_request):
3466 version = 4
3467 type = 18
3468 stats_type = 65535
3469 experimenter = 6035143
3470 subtype = 16
3471
3472 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3473 if xid != None:
3474 self.xid = xid
3475 else:
3476 self.xid = None
3477 if flags != None:
3478 self.flags = flags
3479 else:
3480 self.flags = 0
3481 if name != None:
3482 self.name = name
3483 else:
3484 self.name = ""
3485 if tlvs != None:
3486 self.tlvs = tlvs
3487 else:
3488 self.tlvs = []
3489 return
3490
3491 def pack(self):
3492 packed = []
3493 packed.append(struct.pack("!B", self.version))
3494 packed.append(struct.pack("!B", self.type))
3495 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3496 packed.append(struct.pack("!L", self.xid))
3497 packed.append(struct.pack("!H", self.stats_type))
3498 packed.append(struct.pack("!H", self.flags))
3499 packed.append('\x00' * 4)
3500 packed.append(struct.pack("!L", self.experimenter))
3501 packed.append(struct.pack("!L", self.subtype))
3502 packed.append(struct.pack("!64s", self.name))
3503 packed.append(loxi.generic_util.pack_list(self.tlvs))
3504 length = sum([len(x) for x in packed])
3505 packed[2] = struct.pack("!H", length)
3506 return ''.join(packed)
3507
3508 @staticmethod
3509 def unpack(reader):
3510 obj = bsn_generic_stats_request()
3511 _version = reader.read("!B")[0]
3512 assert(_version == 4)
3513 _type = reader.read("!B")[0]
3514 assert(_type == 18)
3515 _length = reader.read("!H")[0]
3516 orig_reader = reader
3517 reader = orig_reader.slice(_length, 4)
3518 obj.xid = reader.read("!L")[0]
3519 _stats_type = reader.read("!H")[0]
3520 assert(_stats_type == 65535)
3521 obj.flags = reader.read("!H")[0]
3522 reader.skip(4)
3523 _experimenter = reader.read("!L")[0]
3524 assert(_experimenter == 6035143)
3525 _subtype = reader.read("!L")[0]
3526 assert(_subtype == 16)
3527 obj.name = reader.read("!64s")[0].rstrip("\x00")
3528 obj.tlvs = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3529 return obj
3530
3531 def __eq__(self, other):
3532 if type(self) != type(other): return False
3533 if self.xid != other.xid: return False
3534 if self.flags != other.flags: return False
3535 if self.name != other.name: return False
3536 if self.tlvs != other.tlvs: return False
3537 return True
3538
3539 def pretty_print(self, q):
3540 q.text("bsn_generic_stats_request {")
3541 with q.group():
3542 with q.indent(2):
3543 q.breakable()
3544 q.text("xid = ");
3545 if self.xid != None:
3546 q.text("%#x" % self.xid)
3547 else:
3548 q.text('None')
3549 q.text(","); q.breakable()
3550 q.text("flags = ");
3551 q.text("%#x" % self.flags)
3552 q.text(","); q.breakable()
3553 q.text("name = ");
3554 q.pp(self.name)
3555 q.text(","); q.breakable()
3556 q.text("tlvs = ");
3557 q.pp(self.tlvs)
3558 q.breakable()
3559 q.text('}')
3560
3561bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3562
Rich Lane5454b682014-01-14 17:07:36 -08003563class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3564 version = 4
3565 type = 19
3566 stats_type = 65535
3567 experimenter = 6035143
3568 subtype = 5
3569
3570 def __init__(self, xid=None, flags=None, entries=None):
3571 if xid != None:
3572 self.xid = xid
3573 else:
3574 self.xid = None
3575 if flags != None:
3576 self.flags = flags
3577 else:
3578 self.flags = 0
3579 if entries != None:
3580 self.entries = entries
3581 else:
3582 self.entries = []
3583 return
3584
3585 def pack(self):
3586 packed = []
3587 packed.append(struct.pack("!B", self.version))
3588 packed.append(struct.pack("!B", self.type))
3589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3590 packed.append(struct.pack("!L", self.xid))
3591 packed.append(struct.pack("!H", self.stats_type))
3592 packed.append(struct.pack("!H", self.flags))
3593 packed.append('\x00' * 4)
3594 packed.append(struct.pack("!L", self.experimenter))
3595 packed.append(struct.pack("!L", self.subtype))
3596 packed.append(loxi.generic_util.pack_list(self.entries))
3597 length = sum([len(x) for x in packed])
3598 packed[2] = struct.pack("!H", length)
3599 return ''.join(packed)
3600
3601 @staticmethod
3602 def unpack(reader):
3603 obj = bsn_gentable_bucket_stats_reply()
3604 _version = reader.read("!B")[0]
3605 assert(_version == 4)
3606 _type = reader.read("!B")[0]
3607 assert(_type == 19)
3608 _length = reader.read("!H")[0]
3609 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003610 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003611 obj.xid = reader.read("!L")[0]
3612 _stats_type = reader.read("!H")[0]
3613 assert(_stats_type == 65535)
3614 obj.flags = reader.read("!H")[0]
3615 reader.skip(4)
3616 _experimenter = reader.read("!L")[0]
3617 assert(_experimenter == 6035143)
3618 _subtype = reader.read("!L")[0]
3619 assert(_subtype == 5)
3620 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
3621 return obj
3622
3623 def __eq__(self, other):
3624 if type(self) != type(other): return False
3625 if self.xid != other.xid: return False
3626 if self.flags != other.flags: return False
3627 if self.entries != other.entries: return False
3628 return True
3629
3630 def pretty_print(self, q):
3631 q.text("bsn_gentable_bucket_stats_reply {")
3632 with q.group():
3633 with q.indent(2):
3634 q.breakable()
3635 q.text("xid = ");
3636 if self.xid != None:
3637 q.text("%#x" % self.xid)
3638 else:
3639 q.text('None')
3640 q.text(","); q.breakable()
3641 q.text("flags = ");
3642 q.text("%#x" % self.flags)
3643 q.text(","); q.breakable()
3644 q.text("entries = ");
3645 q.pp(self.entries)
3646 q.breakable()
3647 q.text('}')
3648
3649bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3650
Rich Lane5454b682014-01-14 17:07:36 -08003651class bsn_gentable_bucket_stats_request(bsn_stats_request):
3652 version = 4
3653 type = 18
3654 stats_type = 65535
3655 experimenter = 6035143
3656 subtype = 5
3657
3658 def __init__(self, xid=None, flags=None, table_id=None):
3659 if xid != None:
3660 self.xid = xid
3661 else:
3662 self.xid = None
3663 if flags != None:
3664 self.flags = flags
3665 else:
3666 self.flags = 0
3667 if table_id != None:
3668 self.table_id = table_id
3669 else:
3670 self.table_id = 0
3671 return
3672
3673 def pack(self):
3674 packed = []
3675 packed.append(struct.pack("!B", self.version))
3676 packed.append(struct.pack("!B", self.type))
3677 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3678 packed.append(struct.pack("!L", self.xid))
3679 packed.append(struct.pack("!H", self.stats_type))
3680 packed.append(struct.pack("!H", self.flags))
3681 packed.append('\x00' * 4)
3682 packed.append(struct.pack("!L", self.experimenter))
3683 packed.append(struct.pack("!L", self.subtype))
3684 packed.append(struct.pack("!H", self.table_id))
3685 length = sum([len(x) for x in packed])
3686 packed[2] = struct.pack("!H", length)
3687 return ''.join(packed)
3688
3689 @staticmethod
3690 def unpack(reader):
3691 obj = bsn_gentable_bucket_stats_request()
3692 _version = reader.read("!B")[0]
3693 assert(_version == 4)
3694 _type = reader.read("!B")[0]
3695 assert(_type == 18)
3696 _length = reader.read("!H")[0]
3697 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003698 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003699 obj.xid = reader.read("!L")[0]
3700 _stats_type = reader.read("!H")[0]
3701 assert(_stats_type == 65535)
3702 obj.flags = reader.read("!H")[0]
3703 reader.skip(4)
3704 _experimenter = reader.read("!L")[0]
3705 assert(_experimenter == 6035143)
3706 _subtype = reader.read("!L")[0]
3707 assert(_subtype == 5)
3708 obj.table_id = reader.read("!H")[0]
3709 return obj
3710
3711 def __eq__(self, other):
3712 if type(self) != type(other): return False
3713 if self.xid != other.xid: return False
3714 if self.flags != other.flags: return False
3715 if self.table_id != other.table_id: return False
3716 return True
3717
3718 def pretty_print(self, q):
3719 q.text("bsn_gentable_bucket_stats_request {")
3720 with q.group():
3721 with q.indent(2):
3722 q.breakable()
3723 q.text("xid = ");
3724 if self.xid != None:
3725 q.text("%#x" % self.xid)
3726 else:
3727 q.text('None')
3728 q.text(","); q.breakable()
3729 q.text("flags = ");
3730 q.text("%#x" % self.flags)
3731 q.text(","); q.breakable()
3732 q.text("table_id = ");
3733 q.text("%#x" % self.table_id)
3734 q.breakable()
3735 q.text('}')
3736
3737bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3738
3739class bsn_gentable_clear_reply(bsn_header):
3740 version = 4
3741 type = 4
3742 experimenter = 6035143
3743 subtype = 49
3744
3745 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3746 if xid != None:
3747 self.xid = xid
3748 else:
3749 self.xid = None
3750 if table_id != None:
3751 self.table_id = table_id
3752 else:
3753 self.table_id = 0
3754 if deleted_count != None:
3755 self.deleted_count = deleted_count
3756 else:
3757 self.deleted_count = 0
3758 if error_count != None:
3759 self.error_count = error_count
3760 else:
3761 self.error_count = 0
3762 return
3763
3764 def pack(self):
3765 packed = []
3766 packed.append(struct.pack("!B", self.version))
3767 packed.append(struct.pack("!B", self.type))
3768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3769 packed.append(struct.pack("!L", self.xid))
3770 packed.append(struct.pack("!L", self.experimenter))
3771 packed.append(struct.pack("!L", self.subtype))
3772 packed.append(struct.pack("!H", self.table_id))
3773 packed.append('\x00' * 2)
3774 packed.append(struct.pack("!L", self.deleted_count))
3775 packed.append(struct.pack("!L", self.error_count))
3776 length = sum([len(x) for x in packed])
3777 packed[2] = struct.pack("!H", length)
3778 return ''.join(packed)
3779
3780 @staticmethod
3781 def unpack(reader):
3782 obj = bsn_gentable_clear_reply()
3783 _version = reader.read("!B")[0]
3784 assert(_version == 4)
3785 _type = reader.read("!B")[0]
3786 assert(_type == 4)
3787 _length = reader.read("!H")[0]
3788 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003789 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003790 obj.xid = reader.read("!L")[0]
3791 _experimenter = reader.read("!L")[0]
3792 assert(_experimenter == 6035143)
3793 _subtype = reader.read("!L")[0]
3794 assert(_subtype == 49)
3795 obj.table_id = reader.read("!H")[0]
3796 reader.skip(2)
3797 obj.deleted_count = reader.read("!L")[0]
3798 obj.error_count = reader.read("!L")[0]
3799 return obj
3800
3801 def __eq__(self, other):
3802 if type(self) != type(other): return False
3803 if self.xid != other.xid: return False
3804 if self.table_id != other.table_id: return False
3805 if self.deleted_count != other.deleted_count: return False
3806 if self.error_count != other.error_count: return False
3807 return True
3808
3809 def pretty_print(self, q):
3810 q.text("bsn_gentable_clear_reply {")
3811 with q.group():
3812 with q.indent(2):
3813 q.breakable()
3814 q.text("xid = ");
3815 if self.xid != None:
3816 q.text("%#x" % self.xid)
3817 else:
3818 q.text('None')
3819 q.text(","); q.breakable()
3820 q.text("table_id = ");
3821 q.text("%#x" % self.table_id)
3822 q.text(","); q.breakable()
3823 q.text("deleted_count = ");
3824 q.text("%#x" % self.deleted_count)
3825 q.text(","); q.breakable()
3826 q.text("error_count = ");
3827 q.text("%#x" % self.error_count)
3828 q.breakable()
3829 q.text('}')
3830
3831bsn_header.subtypes[49] = bsn_gentable_clear_reply
3832
3833class bsn_gentable_clear_request(bsn_header):
3834 version = 4
3835 type = 4
3836 experimenter = 6035143
3837 subtype = 48
3838
3839 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3840 if xid != None:
3841 self.xid = xid
3842 else:
3843 self.xid = None
3844 if table_id != None:
3845 self.table_id = table_id
3846 else:
3847 self.table_id = 0
3848 if checksum != None:
3849 self.checksum = checksum
3850 else:
3851 self.checksum = 0
3852 if checksum_mask != None:
3853 self.checksum_mask = checksum_mask
3854 else:
3855 self.checksum_mask = 0
3856 return
3857
3858 def pack(self):
3859 packed = []
3860 packed.append(struct.pack("!B", self.version))
3861 packed.append(struct.pack("!B", self.type))
3862 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3863 packed.append(struct.pack("!L", self.xid))
3864 packed.append(struct.pack("!L", self.experimenter))
3865 packed.append(struct.pack("!L", self.subtype))
3866 packed.append(struct.pack("!H", self.table_id))
3867 packed.append('\x00' * 2)
3868 packed.append(util.pack_checksum_128(self.checksum))
3869 packed.append(util.pack_checksum_128(self.checksum_mask))
3870 length = sum([len(x) for x in packed])
3871 packed[2] = struct.pack("!H", length)
3872 return ''.join(packed)
3873
3874 @staticmethod
3875 def unpack(reader):
3876 obj = bsn_gentable_clear_request()
3877 _version = reader.read("!B")[0]
3878 assert(_version == 4)
3879 _type = reader.read("!B")[0]
3880 assert(_type == 4)
3881 _length = reader.read("!H")[0]
3882 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003883 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003884 obj.xid = reader.read("!L")[0]
3885 _experimenter = reader.read("!L")[0]
3886 assert(_experimenter == 6035143)
3887 _subtype = reader.read("!L")[0]
3888 assert(_subtype == 48)
3889 obj.table_id = reader.read("!H")[0]
3890 reader.skip(2)
3891 obj.checksum = util.unpack_checksum_128(reader)
3892 obj.checksum_mask = util.unpack_checksum_128(reader)
3893 return obj
3894
3895 def __eq__(self, other):
3896 if type(self) != type(other): return False
3897 if self.xid != other.xid: return False
3898 if self.table_id != other.table_id: return False
3899 if self.checksum != other.checksum: return False
3900 if self.checksum_mask != other.checksum_mask: return False
3901 return True
3902
3903 def pretty_print(self, q):
3904 q.text("bsn_gentable_clear_request {")
3905 with q.group():
3906 with q.indent(2):
3907 q.breakable()
3908 q.text("xid = ");
3909 if self.xid != None:
3910 q.text("%#x" % self.xid)
3911 else:
3912 q.text('None')
3913 q.text(","); q.breakable()
3914 q.text("table_id = ");
3915 q.text("%#x" % self.table_id)
3916 q.text(","); q.breakable()
3917 q.text("checksum = ");
3918 q.pp(self.checksum)
3919 q.text(","); q.breakable()
3920 q.text("checksum_mask = ");
3921 q.pp(self.checksum_mask)
3922 q.breakable()
3923 q.text('}')
3924
3925bsn_header.subtypes[48] = bsn_gentable_clear_request
3926
3927class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3928 version = 4
3929 type = 19
3930 stats_type = 65535
3931 experimenter = 6035143
3932 subtype = 4
3933
3934 def __init__(self, xid=None, flags=None, entries=None):
3935 if xid != None:
3936 self.xid = xid
3937 else:
3938 self.xid = None
3939 if flags != None:
3940 self.flags = flags
3941 else:
3942 self.flags = 0
3943 if entries != None:
3944 self.entries = entries
3945 else:
3946 self.entries = []
3947 return
3948
3949 def pack(self):
3950 packed = []
3951 packed.append(struct.pack("!B", self.version))
3952 packed.append(struct.pack("!B", self.type))
3953 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3954 packed.append(struct.pack("!L", self.xid))
3955 packed.append(struct.pack("!H", self.stats_type))
3956 packed.append(struct.pack("!H", self.flags))
3957 packed.append('\x00' * 4)
3958 packed.append(struct.pack("!L", self.experimenter))
3959 packed.append(struct.pack("!L", self.subtype))
3960 packed.append(loxi.generic_util.pack_list(self.entries))
3961 length = sum([len(x) for x in packed])
3962 packed[2] = struct.pack("!H", length)
3963 return ''.join(packed)
3964
3965 @staticmethod
3966 def unpack(reader):
3967 obj = bsn_gentable_desc_stats_reply()
3968 _version = reader.read("!B")[0]
3969 assert(_version == 4)
3970 _type = reader.read("!B")[0]
3971 assert(_type == 19)
3972 _length = reader.read("!H")[0]
3973 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003974 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003975 obj.xid = reader.read("!L")[0]
3976 _stats_type = reader.read("!H")[0]
3977 assert(_stats_type == 65535)
3978 obj.flags = reader.read("!H")[0]
3979 reader.skip(4)
3980 _experimenter = reader.read("!L")[0]
3981 assert(_experimenter == 6035143)
3982 _subtype = reader.read("!L")[0]
3983 assert(_subtype == 4)
3984 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3985 return obj
3986
3987 def __eq__(self, other):
3988 if type(self) != type(other): return False
3989 if self.xid != other.xid: return False
3990 if self.flags != other.flags: return False
3991 if self.entries != other.entries: return False
3992 return True
3993
3994 def pretty_print(self, q):
3995 q.text("bsn_gentable_desc_stats_reply {")
3996 with q.group():
3997 with q.indent(2):
3998 q.breakable()
3999 q.text("xid = ");
4000 if self.xid != None:
4001 q.text("%#x" % self.xid)
4002 else:
4003 q.text('None')
4004 q.text(","); q.breakable()
4005 q.text("flags = ");
4006 q.text("%#x" % self.flags)
4007 q.text(","); q.breakable()
4008 q.text("entries = ");
4009 q.pp(self.entries)
4010 q.breakable()
4011 q.text('}')
4012
4013bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4014
4015class bsn_gentable_desc_stats_request(bsn_stats_request):
4016 version = 4
4017 type = 18
4018 stats_type = 65535
4019 experimenter = 6035143
4020 subtype = 4
4021
4022 def __init__(self, xid=None, flags=None):
4023 if xid != None:
4024 self.xid = xid
4025 else:
4026 self.xid = None
4027 if flags != None:
4028 self.flags = flags
4029 else:
4030 self.flags = 0
4031 return
4032
4033 def pack(self):
4034 packed = []
4035 packed.append(struct.pack("!B", self.version))
4036 packed.append(struct.pack("!B", self.type))
4037 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4038 packed.append(struct.pack("!L", self.xid))
4039 packed.append(struct.pack("!H", self.stats_type))
4040 packed.append(struct.pack("!H", self.flags))
4041 packed.append('\x00' * 4)
4042 packed.append(struct.pack("!L", self.experimenter))
4043 packed.append(struct.pack("!L", self.subtype))
4044 length = sum([len(x) for x in packed])
4045 packed[2] = struct.pack("!H", length)
4046 return ''.join(packed)
4047
4048 @staticmethod
4049 def unpack(reader):
4050 obj = bsn_gentable_desc_stats_request()
4051 _version = reader.read("!B")[0]
4052 assert(_version == 4)
4053 _type = reader.read("!B")[0]
4054 assert(_type == 18)
4055 _length = reader.read("!H")[0]
4056 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004057 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004058 obj.xid = reader.read("!L")[0]
4059 _stats_type = reader.read("!H")[0]
4060 assert(_stats_type == 65535)
4061 obj.flags = reader.read("!H")[0]
4062 reader.skip(4)
4063 _experimenter = reader.read("!L")[0]
4064 assert(_experimenter == 6035143)
4065 _subtype = reader.read("!L")[0]
4066 assert(_subtype == 4)
4067 return obj
4068
4069 def __eq__(self, other):
4070 if type(self) != type(other): return False
4071 if self.xid != other.xid: return False
4072 if self.flags != other.flags: return False
4073 return True
4074
4075 def pretty_print(self, q):
4076 q.text("bsn_gentable_desc_stats_request {")
4077 with q.group():
4078 with q.indent(2):
4079 q.breakable()
4080 q.text("xid = ");
4081 if self.xid != None:
4082 q.text("%#x" % self.xid)
4083 else:
4084 q.text('None')
4085 q.text(","); q.breakable()
4086 q.text("flags = ");
4087 q.text("%#x" % self.flags)
4088 q.breakable()
4089 q.text('}')
4090
4091bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4092
4093class bsn_gentable_entry_add(bsn_header):
4094 version = 4
4095 type = 4
4096 experimenter = 6035143
4097 subtype = 46
4098
4099 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4100 if xid != None:
4101 self.xid = xid
4102 else:
4103 self.xid = None
4104 if table_id != None:
4105 self.table_id = table_id
4106 else:
4107 self.table_id = 0
4108 if checksum != None:
4109 self.checksum = checksum
4110 else:
4111 self.checksum = 0
4112 if key != None:
4113 self.key = key
4114 else:
4115 self.key = []
4116 if value != None:
4117 self.value = value
4118 else:
4119 self.value = []
4120 return
4121
4122 def pack(self):
4123 packed = []
4124 packed.append(struct.pack("!B", self.version))
4125 packed.append(struct.pack("!B", self.type))
4126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4127 packed.append(struct.pack("!L", self.xid))
4128 packed.append(struct.pack("!L", self.experimenter))
4129 packed.append(struct.pack("!L", self.subtype))
4130 packed.append(struct.pack("!H", self.table_id))
4131 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4132 packed.append(util.pack_checksum_128(self.checksum))
4133 packed.append(loxi.generic_util.pack_list(self.key))
4134 packed[7] = struct.pack("!H", len(packed[-1]))
4135 packed.append(loxi.generic_util.pack_list(self.value))
4136 length = sum([len(x) for x in packed])
4137 packed[2] = struct.pack("!H", length)
4138 return ''.join(packed)
4139
4140 @staticmethod
4141 def unpack(reader):
4142 obj = bsn_gentable_entry_add()
4143 _version = reader.read("!B")[0]
4144 assert(_version == 4)
4145 _type = reader.read("!B")[0]
4146 assert(_type == 4)
4147 _length = reader.read("!H")[0]
4148 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004149 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004150 obj.xid = reader.read("!L")[0]
4151 _experimenter = reader.read("!L")[0]
4152 assert(_experimenter == 6035143)
4153 _subtype = reader.read("!L")[0]
4154 assert(_subtype == 46)
4155 obj.table_id = reader.read("!H")[0]
4156 _key_length = reader.read("!H")[0]
4157 obj.checksum = util.unpack_checksum_128(reader)
4158 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
4159 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4160 return obj
4161
4162 def __eq__(self, other):
4163 if type(self) != type(other): return False
4164 if self.xid != other.xid: return False
4165 if self.table_id != other.table_id: return False
4166 if self.checksum != other.checksum: return False
4167 if self.key != other.key: return False
4168 if self.value != other.value: return False
4169 return True
4170
4171 def pretty_print(self, q):
4172 q.text("bsn_gentable_entry_add {")
4173 with q.group():
4174 with q.indent(2):
4175 q.breakable()
4176 q.text("xid = ");
4177 if self.xid != None:
4178 q.text("%#x" % self.xid)
4179 else:
4180 q.text('None')
4181 q.text(","); q.breakable()
4182 q.text("table_id = ");
4183 q.text("%#x" % self.table_id)
4184 q.text(","); q.breakable()
4185 q.text("checksum = ");
4186 q.pp(self.checksum)
4187 q.text(","); q.breakable()
4188 q.text("key = ");
4189 q.pp(self.key)
4190 q.text(","); q.breakable()
4191 q.text("value = ");
4192 q.pp(self.value)
4193 q.breakable()
4194 q.text('}')
4195
4196bsn_header.subtypes[46] = bsn_gentable_entry_add
4197
4198class bsn_gentable_entry_delete(bsn_header):
4199 version = 4
4200 type = 4
4201 experimenter = 6035143
4202 subtype = 47
4203
4204 def __init__(self, xid=None, table_id=None, key=None):
4205 if xid != None:
4206 self.xid = xid
4207 else:
4208 self.xid = None
4209 if table_id != None:
4210 self.table_id = table_id
4211 else:
4212 self.table_id = 0
4213 if key != None:
4214 self.key = key
4215 else:
4216 self.key = []
4217 return
4218
4219 def pack(self):
4220 packed = []
4221 packed.append(struct.pack("!B", self.version))
4222 packed.append(struct.pack("!B", self.type))
4223 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4224 packed.append(struct.pack("!L", self.xid))
4225 packed.append(struct.pack("!L", self.experimenter))
4226 packed.append(struct.pack("!L", self.subtype))
4227 packed.append(struct.pack("!H", self.table_id))
4228 packed.append(loxi.generic_util.pack_list(self.key))
4229 length = sum([len(x) for x in packed])
4230 packed[2] = struct.pack("!H", length)
4231 return ''.join(packed)
4232
4233 @staticmethod
4234 def unpack(reader):
4235 obj = bsn_gentable_entry_delete()
4236 _version = reader.read("!B")[0]
4237 assert(_version == 4)
4238 _type = reader.read("!B")[0]
4239 assert(_type == 4)
4240 _length = reader.read("!H")[0]
4241 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004242 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004243 obj.xid = reader.read("!L")[0]
4244 _experimenter = reader.read("!L")[0]
4245 assert(_experimenter == 6035143)
4246 _subtype = reader.read("!L")[0]
4247 assert(_subtype == 47)
4248 obj.table_id = reader.read("!H")[0]
4249 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4250 return obj
4251
4252 def __eq__(self, other):
4253 if type(self) != type(other): return False
4254 if self.xid != other.xid: return False
4255 if self.table_id != other.table_id: return False
4256 if self.key != other.key: return False
4257 return True
4258
4259 def pretty_print(self, q):
4260 q.text("bsn_gentable_entry_delete {")
4261 with q.group():
4262 with q.indent(2):
4263 q.breakable()
4264 q.text("xid = ");
4265 if self.xid != None:
4266 q.text("%#x" % self.xid)
4267 else:
4268 q.text('None')
4269 q.text(","); q.breakable()
4270 q.text("table_id = ");
4271 q.text("%#x" % self.table_id)
4272 q.text(","); q.breakable()
4273 q.text("key = ");
4274 q.pp(self.key)
4275 q.breakable()
4276 q.text('}')
4277
4278bsn_header.subtypes[47] = bsn_gentable_entry_delete
4279
4280class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4281 version = 4
4282 type = 19
4283 stats_type = 65535
4284 experimenter = 6035143
4285 subtype = 2
4286
4287 def __init__(self, xid=None, flags=None, entries=None):
4288 if xid != None:
4289 self.xid = xid
4290 else:
4291 self.xid = None
4292 if flags != None:
4293 self.flags = flags
4294 else:
4295 self.flags = 0
4296 if entries != None:
4297 self.entries = entries
4298 else:
4299 self.entries = []
4300 return
4301
4302 def pack(self):
4303 packed = []
4304 packed.append(struct.pack("!B", self.version))
4305 packed.append(struct.pack("!B", self.type))
4306 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4307 packed.append(struct.pack("!L", self.xid))
4308 packed.append(struct.pack("!H", self.stats_type))
4309 packed.append(struct.pack("!H", self.flags))
4310 packed.append('\x00' * 4)
4311 packed.append(struct.pack("!L", self.experimenter))
4312 packed.append(struct.pack("!L", self.subtype))
4313 packed.append(loxi.generic_util.pack_list(self.entries))
4314 length = sum([len(x) for x in packed])
4315 packed[2] = struct.pack("!H", length)
4316 return ''.join(packed)
4317
4318 @staticmethod
4319 def unpack(reader):
4320 obj = bsn_gentable_entry_desc_stats_reply()
4321 _version = reader.read("!B")[0]
4322 assert(_version == 4)
4323 _type = reader.read("!B")[0]
4324 assert(_type == 19)
4325 _length = reader.read("!H")[0]
4326 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004327 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004328 obj.xid = reader.read("!L")[0]
4329 _stats_type = reader.read("!H")[0]
4330 assert(_stats_type == 65535)
4331 obj.flags = reader.read("!H")[0]
4332 reader.skip(4)
4333 _experimenter = reader.read("!L")[0]
4334 assert(_experimenter == 6035143)
4335 _subtype = reader.read("!L")[0]
4336 assert(_subtype == 2)
4337 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
4338 return obj
4339
4340 def __eq__(self, other):
4341 if type(self) != type(other): return False
4342 if self.xid != other.xid: return False
4343 if self.flags != other.flags: return False
4344 if self.entries != other.entries: return False
4345 return True
4346
4347 def pretty_print(self, q):
4348 q.text("bsn_gentable_entry_desc_stats_reply {")
4349 with q.group():
4350 with q.indent(2):
4351 q.breakable()
4352 q.text("xid = ");
4353 if self.xid != None:
4354 q.text("%#x" % self.xid)
4355 else:
4356 q.text('None')
4357 q.text(","); q.breakable()
4358 q.text("flags = ");
4359 q.text("%#x" % self.flags)
4360 q.text(","); q.breakable()
4361 q.text("entries = ");
4362 q.pp(self.entries)
4363 q.breakable()
4364 q.text('}')
4365
4366bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4367
4368class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4369 version = 4
4370 type = 18
4371 stats_type = 65535
4372 experimenter = 6035143
4373 subtype = 2
4374
4375 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4376 if xid != None:
4377 self.xid = xid
4378 else:
4379 self.xid = None
4380 if flags != None:
4381 self.flags = flags
4382 else:
4383 self.flags = 0
4384 if table_id != None:
4385 self.table_id = table_id
4386 else:
4387 self.table_id = 0
4388 if checksum != None:
4389 self.checksum = checksum
4390 else:
4391 self.checksum = 0
4392 if checksum_mask != None:
4393 self.checksum_mask = checksum_mask
4394 else:
4395 self.checksum_mask = 0
4396 return
4397
4398 def pack(self):
4399 packed = []
4400 packed.append(struct.pack("!B", self.version))
4401 packed.append(struct.pack("!B", self.type))
4402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4403 packed.append(struct.pack("!L", self.xid))
4404 packed.append(struct.pack("!H", self.stats_type))
4405 packed.append(struct.pack("!H", self.flags))
4406 packed.append('\x00' * 4)
4407 packed.append(struct.pack("!L", self.experimenter))
4408 packed.append(struct.pack("!L", self.subtype))
4409 packed.append(struct.pack("!H", self.table_id))
4410 packed.append('\x00' * 2)
4411 packed.append(util.pack_checksum_128(self.checksum))
4412 packed.append(util.pack_checksum_128(self.checksum_mask))
4413 length = sum([len(x) for x in packed])
4414 packed[2] = struct.pack("!H", length)
4415 return ''.join(packed)
4416
4417 @staticmethod
4418 def unpack(reader):
4419 obj = bsn_gentable_entry_desc_stats_request()
4420 _version = reader.read("!B")[0]
4421 assert(_version == 4)
4422 _type = reader.read("!B")[0]
4423 assert(_type == 18)
4424 _length = reader.read("!H")[0]
4425 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004426 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004427 obj.xid = reader.read("!L")[0]
4428 _stats_type = reader.read("!H")[0]
4429 assert(_stats_type == 65535)
4430 obj.flags = reader.read("!H")[0]
4431 reader.skip(4)
4432 _experimenter = reader.read("!L")[0]
4433 assert(_experimenter == 6035143)
4434 _subtype = reader.read("!L")[0]
4435 assert(_subtype == 2)
4436 obj.table_id = reader.read("!H")[0]
4437 reader.skip(2)
4438 obj.checksum = util.unpack_checksum_128(reader)
4439 obj.checksum_mask = util.unpack_checksum_128(reader)
4440 return obj
4441
4442 def __eq__(self, other):
4443 if type(self) != type(other): return False
4444 if self.xid != other.xid: return False
4445 if self.flags != other.flags: return False
4446 if self.table_id != other.table_id: return False
4447 if self.checksum != other.checksum: return False
4448 if self.checksum_mask != other.checksum_mask: return False
4449 return True
4450
4451 def pretty_print(self, q):
4452 q.text("bsn_gentable_entry_desc_stats_request {")
4453 with q.group():
4454 with q.indent(2):
4455 q.breakable()
4456 q.text("xid = ");
4457 if self.xid != None:
4458 q.text("%#x" % self.xid)
4459 else:
4460 q.text('None')
4461 q.text(","); q.breakable()
4462 q.text("flags = ");
4463 q.text("%#x" % self.flags)
4464 q.text(","); q.breakable()
4465 q.text("table_id = ");
4466 q.text("%#x" % self.table_id)
4467 q.text(","); q.breakable()
4468 q.text("checksum = ");
4469 q.pp(self.checksum)
4470 q.text(","); q.breakable()
4471 q.text("checksum_mask = ");
4472 q.pp(self.checksum_mask)
4473 q.breakable()
4474 q.text('}')
4475
4476bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4477
4478class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4479 version = 4
4480 type = 19
4481 stats_type = 65535
4482 experimenter = 6035143
4483 subtype = 3
4484
4485 def __init__(self, xid=None, flags=None, entries=None):
4486 if xid != None:
4487 self.xid = xid
4488 else:
4489 self.xid = None
4490 if flags != None:
4491 self.flags = flags
4492 else:
4493 self.flags = 0
4494 if entries != None:
4495 self.entries = entries
4496 else:
4497 self.entries = []
4498 return
4499
4500 def pack(self):
4501 packed = []
4502 packed.append(struct.pack("!B", self.version))
4503 packed.append(struct.pack("!B", self.type))
4504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4505 packed.append(struct.pack("!L", self.xid))
4506 packed.append(struct.pack("!H", self.stats_type))
4507 packed.append(struct.pack("!H", self.flags))
4508 packed.append('\x00' * 4)
4509 packed.append(struct.pack("!L", self.experimenter))
4510 packed.append(struct.pack("!L", self.subtype))
4511 packed.append(loxi.generic_util.pack_list(self.entries))
4512 length = sum([len(x) for x in packed])
4513 packed[2] = struct.pack("!H", length)
4514 return ''.join(packed)
4515
4516 @staticmethod
4517 def unpack(reader):
4518 obj = bsn_gentable_entry_stats_reply()
4519 _version = reader.read("!B")[0]
4520 assert(_version == 4)
4521 _type = reader.read("!B")[0]
4522 assert(_type == 19)
4523 _length = reader.read("!H")[0]
4524 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004525 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004526 obj.xid = reader.read("!L")[0]
4527 _stats_type = reader.read("!H")[0]
4528 assert(_stats_type == 65535)
4529 obj.flags = reader.read("!H")[0]
4530 reader.skip(4)
4531 _experimenter = reader.read("!L")[0]
4532 assert(_experimenter == 6035143)
4533 _subtype = reader.read("!L")[0]
4534 assert(_subtype == 3)
4535 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
4536 return obj
4537
4538 def __eq__(self, other):
4539 if type(self) != type(other): return False
4540 if self.xid != other.xid: return False
4541 if self.flags != other.flags: return False
4542 if self.entries != other.entries: return False
4543 return True
4544
4545 def pretty_print(self, q):
4546 q.text("bsn_gentable_entry_stats_reply {")
4547 with q.group():
4548 with q.indent(2):
4549 q.breakable()
4550 q.text("xid = ");
4551 if self.xid != None:
4552 q.text("%#x" % self.xid)
4553 else:
4554 q.text('None')
4555 q.text(","); q.breakable()
4556 q.text("flags = ");
4557 q.text("%#x" % self.flags)
4558 q.text(","); q.breakable()
4559 q.text("entries = ");
4560 q.pp(self.entries)
4561 q.breakable()
4562 q.text('}')
4563
4564bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4565
4566class bsn_gentable_entry_stats_request(bsn_stats_request):
4567 version = 4
4568 type = 18
4569 stats_type = 65535
4570 experimenter = 6035143
4571 subtype = 3
4572
4573 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4574 if xid != None:
4575 self.xid = xid
4576 else:
4577 self.xid = None
4578 if flags != None:
4579 self.flags = flags
4580 else:
4581 self.flags = 0
4582 if table_id != None:
4583 self.table_id = table_id
4584 else:
4585 self.table_id = 0
4586 if checksum != None:
4587 self.checksum = checksum
4588 else:
4589 self.checksum = 0
4590 if checksum_mask != None:
4591 self.checksum_mask = checksum_mask
4592 else:
4593 self.checksum_mask = 0
4594 return
4595
4596 def pack(self):
4597 packed = []
4598 packed.append(struct.pack("!B", self.version))
4599 packed.append(struct.pack("!B", self.type))
4600 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4601 packed.append(struct.pack("!L", self.xid))
4602 packed.append(struct.pack("!H", self.stats_type))
4603 packed.append(struct.pack("!H", self.flags))
4604 packed.append('\x00' * 4)
4605 packed.append(struct.pack("!L", self.experimenter))
4606 packed.append(struct.pack("!L", self.subtype))
4607 packed.append(struct.pack("!H", self.table_id))
4608 packed.append('\x00' * 2)
4609 packed.append(util.pack_checksum_128(self.checksum))
4610 packed.append(util.pack_checksum_128(self.checksum_mask))
4611 length = sum([len(x) for x in packed])
4612 packed[2] = struct.pack("!H", length)
4613 return ''.join(packed)
4614
4615 @staticmethod
4616 def unpack(reader):
4617 obj = bsn_gentable_entry_stats_request()
4618 _version = reader.read("!B")[0]
4619 assert(_version == 4)
4620 _type = reader.read("!B")[0]
4621 assert(_type == 18)
4622 _length = reader.read("!H")[0]
4623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004624 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004625 obj.xid = reader.read("!L")[0]
4626 _stats_type = reader.read("!H")[0]
4627 assert(_stats_type == 65535)
4628 obj.flags = reader.read("!H")[0]
4629 reader.skip(4)
4630 _experimenter = reader.read("!L")[0]
4631 assert(_experimenter == 6035143)
4632 _subtype = reader.read("!L")[0]
4633 assert(_subtype == 3)
4634 obj.table_id = reader.read("!H")[0]
4635 reader.skip(2)
4636 obj.checksum = util.unpack_checksum_128(reader)
4637 obj.checksum_mask = util.unpack_checksum_128(reader)
4638 return obj
4639
4640 def __eq__(self, other):
4641 if type(self) != type(other): return False
4642 if self.xid != other.xid: return False
4643 if self.flags != other.flags: return False
4644 if self.table_id != other.table_id: return False
4645 if self.checksum != other.checksum: return False
4646 if self.checksum_mask != other.checksum_mask: return False
4647 return True
4648
4649 def pretty_print(self, q):
4650 q.text("bsn_gentable_entry_stats_request {")
4651 with q.group():
4652 with q.indent(2):
4653 q.breakable()
4654 q.text("xid = ");
4655 if self.xid != None:
4656 q.text("%#x" % self.xid)
4657 else:
4658 q.text('None')
4659 q.text(","); q.breakable()
4660 q.text("flags = ");
4661 q.text("%#x" % self.flags)
4662 q.text(","); q.breakable()
4663 q.text("table_id = ");
4664 q.text("%#x" % self.table_id)
4665 q.text(","); q.breakable()
4666 q.text("checksum = ");
4667 q.pp(self.checksum)
4668 q.text(","); q.breakable()
4669 q.text("checksum_mask = ");
4670 q.pp(self.checksum_mask)
4671 q.breakable()
4672 q.text('}')
4673
4674bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4675
4676class bsn_gentable_set_buckets_size(bsn_header):
4677 version = 4
4678 type = 4
4679 experimenter = 6035143
4680 subtype = 50
4681
4682 def __init__(self, xid=None, table_id=None, buckets_size=None):
4683 if xid != None:
4684 self.xid = xid
4685 else:
4686 self.xid = None
4687 if table_id != None:
4688 self.table_id = table_id
4689 else:
4690 self.table_id = 0
4691 if buckets_size != None:
4692 self.buckets_size = buckets_size
4693 else:
4694 self.buckets_size = 0
4695 return
4696
4697 def pack(self):
4698 packed = []
4699 packed.append(struct.pack("!B", self.version))
4700 packed.append(struct.pack("!B", self.type))
4701 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4702 packed.append(struct.pack("!L", self.xid))
4703 packed.append(struct.pack("!L", self.experimenter))
4704 packed.append(struct.pack("!L", self.subtype))
4705 packed.append(struct.pack("!H", self.table_id))
4706 packed.append('\x00' * 2)
4707 packed.append(struct.pack("!L", self.buckets_size))
4708 length = sum([len(x) for x in packed])
4709 packed[2] = struct.pack("!H", length)
4710 return ''.join(packed)
4711
4712 @staticmethod
4713 def unpack(reader):
4714 obj = bsn_gentable_set_buckets_size()
4715 _version = reader.read("!B")[0]
4716 assert(_version == 4)
4717 _type = reader.read("!B")[0]
4718 assert(_type == 4)
4719 _length = reader.read("!H")[0]
4720 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004721 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004722 obj.xid = reader.read("!L")[0]
4723 _experimenter = reader.read("!L")[0]
4724 assert(_experimenter == 6035143)
4725 _subtype = reader.read("!L")[0]
4726 assert(_subtype == 50)
4727 obj.table_id = reader.read("!H")[0]
4728 reader.skip(2)
4729 obj.buckets_size = reader.read("!L")[0]
4730 return obj
4731
4732 def __eq__(self, other):
4733 if type(self) != type(other): return False
4734 if self.xid != other.xid: return False
4735 if self.table_id != other.table_id: return False
4736 if self.buckets_size != other.buckets_size: return False
4737 return True
4738
4739 def pretty_print(self, q):
4740 q.text("bsn_gentable_set_buckets_size {")
4741 with q.group():
4742 with q.indent(2):
4743 q.breakable()
4744 q.text("xid = ");
4745 if self.xid != None:
4746 q.text("%#x" % self.xid)
4747 else:
4748 q.text('None')
4749 q.text(","); q.breakable()
4750 q.text("table_id = ");
4751 q.text("%#x" % self.table_id)
4752 q.text(","); q.breakable()
4753 q.text("buckets_size = ");
4754 q.text("%#x" % self.buckets_size)
4755 q.breakable()
4756 q.text('}')
4757
4758bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4759
4760class bsn_gentable_stats_reply(bsn_stats_reply):
4761 version = 4
4762 type = 19
4763 stats_type = 65535
4764 experimenter = 6035143
4765 subtype = 7
4766
4767 def __init__(self, xid=None, flags=None, entries=None):
4768 if xid != None:
4769 self.xid = xid
4770 else:
4771 self.xid = None
4772 if flags != None:
4773 self.flags = flags
4774 else:
4775 self.flags = 0
4776 if entries != None:
4777 self.entries = entries
4778 else:
4779 self.entries = []
4780 return
4781
4782 def pack(self):
4783 packed = []
4784 packed.append(struct.pack("!B", self.version))
4785 packed.append(struct.pack("!B", self.type))
4786 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4787 packed.append(struct.pack("!L", self.xid))
4788 packed.append(struct.pack("!H", self.stats_type))
4789 packed.append(struct.pack("!H", self.flags))
4790 packed.append('\x00' * 4)
4791 packed.append(struct.pack("!L", self.experimenter))
4792 packed.append(struct.pack("!L", self.subtype))
4793 packed.append(loxi.generic_util.pack_list(self.entries))
4794 length = sum([len(x) for x in packed])
4795 packed[2] = struct.pack("!H", length)
4796 return ''.join(packed)
4797
4798 @staticmethod
4799 def unpack(reader):
4800 obj = bsn_gentable_stats_reply()
4801 _version = reader.read("!B")[0]
4802 assert(_version == 4)
4803 _type = reader.read("!B")[0]
4804 assert(_type == 19)
4805 _length = reader.read("!H")[0]
4806 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004807 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004808 obj.xid = reader.read("!L")[0]
4809 _stats_type = reader.read("!H")[0]
4810 assert(_stats_type == 65535)
4811 obj.flags = reader.read("!H")[0]
4812 reader.skip(4)
4813 _experimenter = reader.read("!L")[0]
4814 assert(_experimenter == 6035143)
4815 _subtype = reader.read("!L")[0]
4816 assert(_subtype == 7)
4817 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4818 return obj
4819
4820 def __eq__(self, other):
4821 if type(self) != type(other): return False
4822 if self.xid != other.xid: return False
4823 if self.flags != other.flags: return False
4824 if self.entries != other.entries: return False
4825 return True
4826
4827 def pretty_print(self, q):
4828 q.text("bsn_gentable_stats_reply {")
4829 with q.group():
4830 with q.indent(2):
4831 q.breakable()
4832 q.text("xid = ");
4833 if self.xid != None:
4834 q.text("%#x" % self.xid)
4835 else:
4836 q.text('None')
4837 q.text(","); q.breakable()
4838 q.text("flags = ");
4839 q.text("%#x" % self.flags)
4840 q.text(","); q.breakable()
4841 q.text("entries = ");
4842 q.pp(self.entries)
4843 q.breakable()
4844 q.text('}')
4845
4846bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4847
4848class bsn_gentable_stats_request(bsn_stats_request):
4849 version = 4
4850 type = 18
4851 stats_type = 65535
4852 experimenter = 6035143
4853 subtype = 7
4854
4855 def __init__(self, xid=None, flags=None):
4856 if xid != None:
4857 self.xid = xid
4858 else:
4859 self.xid = None
4860 if flags != None:
4861 self.flags = flags
4862 else:
4863 self.flags = 0
4864 return
4865
4866 def pack(self):
4867 packed = []
4868 packed.append(struct.pack("!B", self.version))
4869 packed.append(struct.pack("!B", self.type))
4870 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4871 packed.append(struct.pack("!L", self.xid))
4872 packed.append(struct.pack("!H", self.stats_type))
4873 packed.append(struct.pack("!H", self.flags))
4874 packed.append('\x00' * 4)
4875 packed.append(struct.pack("!L", self.experimenter))
4876 packed.append(struct.pack("!L", self.subtype))
4877 length = sum([len(x) for x in packed])
4878 packed[2] = struct.pack("!H", length)
4879 return ''.join(packed)
4880
4881 @staticmethod
4882 def unpack(reader):
4883 obj = bsn_gentable_stats_request()
4884 _version = reader.read("!B")[0]
4885 assert(_version == 4)
4886 _type = reader.read("!B")[0]
4887 assert(_type == 18)
4888 _length = reader.read("!H")[0]
4889 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004890 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004891 obj.xid = reader.read("!L")[0]
4892 _stats_type = reader.read("!H")[0]
4893 assert(_stats_type == 65535)
4894 obj.flags = reader.read("!H")[0]
4895 reader.skip(4)
4896 _experimenter = reader.read("!L")[0]
4897 assert(_experimenter == 6035143)
4898 _subtype = reader.read("!L")[0]
4899 assert(_subtype == 7)
4900 return obj
4901
4902 def __eq__(self, other):
4903 if type(self) != type(other): return False
4904 if self.xid != other.xid: return False
4905 if self.flags != other.flags: return False
4906 return True
4907
4908 def pretty_print(self, q):
4909 q.text("bsn_gentable_stats_request {")
4910 with q.group():
4911 with q.indent(2):
4912 q.breakable()
4913 q.text("xid = ");
4914 if self.xid != None:
4915 q.text("%#x" % self.xid)
4916 else:
4917 q.text('None')
4918 q.text(","); q.breakable()
4919 q.text("flags = ");
4920 q.text("%#x" % self.flags)
4921 q.breakable()
4922 q.text('}')
4923
4924bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4925
Rich Lane7dcdf022013-12-11 14:45:27 -08004926class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004927 version = 4
4928 type = 4
4929 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004930 subtype = 10
4931
4932 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004933 if xid != None:
4934 self.xid = xid
4935 else:
4936 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004937 if interfaces != None:
4938 self.interfaces = interfaces
4939 else:
4940 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004941 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004942
4943 def pack(self):
4944 packed = []
4945 packed.append(struct.pack("!B", self.version))
4946 packed.append(struct.pack("!B", self.type))
4947 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4948 packed.append(struct.pack("!L", self.xid))
4949 packed.append(struct.pack("!L", self.experimenter))
4950 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004951 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004952 length = sum([len(x) for x in packed])
4953 packed[2] = struct.pack("!H", length)
4954 return ''.join(packed)
4955
4956 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004957 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004958 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004959 _version = reader.read("!B")[0]
4960 assert(_version == 4)
4961 _type = reader.read("!B")[0]
4962 assert(_type == 4)
4963 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004964 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004965 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004966 obj.xid = reader.read("!L")[0]
4967 _experimenter = reader.read("!L")[0]
4968 assert(_experimenter == 6035143)
4969 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004970 assert(_subtype == 10)
4971 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4972 return obj
4973
4974 def __eq__(self, other):
4975 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004976 if self.xid != other.xid: return False
4977 if self.interfaces != other.interfaces: return False
4978 return True
4979
Rich Lanec2ee4b82013-04-24 17:12:38 -07004980 def pretty_print(self, q):
4981 q.text("bsn_get_interfaces_reply {")
4982 with q.group():
4983 with q.indent(2):
4984 q.breakable()
4985 q.text("xid = ");
4986 if self.xid != None:
4987 q.text("%#x" % self.xid)
4988 else:
4989 q.text('None')
4990 q.text(","); q.breakable()
4991 q.text("interfaces = ");
4992 q.pp(self.interfaces)
4993 q.breakable()
4994 q.text('}')
4995
Rich Lane7dcdf022013-12-11 14:45:27 -08004996bsn_header.subtypes[10] = bsn_get_interfaces_reply
4997
4998class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004999 version = 4
5000 type = 4
5001 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005002 subtype = 9
5003
5004 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005005 if xid != None:
5006 self.xid = xid
5007 else:
5008 self.xid = None
5009 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005010
5011 def pack(self):
5012 packed = []
5013 packed.append(struct.pack("!B", self.version))
5014 packed.append(struct.pack("!B", self.type))
5015 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5016 packed.append(struct.pack("!L", self.xid))
5017 packed.append(struct.pack("!L", self.experimenter))
5018 packed.append(struct.pack("!L", self.subtype))
5019 length = sum([len(x) for x in packed])
5020 packed[2] = struct.pack("!H", length)
5021 return ''.join(packed)
5022
5023 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005024 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005025 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005026 _version = reader.read("!B")[0]
5027 assert(_version == 4)
5028 _type = reader.read("!B")[0]
5029 assert(_type == 4)
5030 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005031 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005032 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005033 obj.xid = reader.read("!L")[0]
5034 _experimenter = reader.read("!L")[0]
5035 assert(_experimenter == 6035143)
5036 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005037 assert(_subtype == 9)
5038 return obj
5039
5040 def __eq__(self, other):
5041 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005042 if self.xid != other.xid: return False
5043 return True
5044
Rich Lanec2ee4b82013-04-24 17:12:38 -07005045 def pretty_print(self, q):
5046 q.text("bsn_get_interfaces_request {")
5047 with q.group():
5048 with q.indent(2):
5049 q.breakable()
5050 q.text("xid = ");
5051 if self.xid != None:
5052 q.text("%#x" % self.xid)
5053 else:
5054 q.text('None')
5055 q.breakable()
5056 q.text('}')
5057
Rich Lane7dcdf022013-12-11 14:45:27 -08005058bsn_header.subtypes[9] = bsn_get_interfaces_request
5059
5060class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005061 version = 4
5062 type = 4
5063 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005064 subtype = 5
5065
5066 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005067 if xid != None:
5068 self.xid = xid
5069 else:
5070 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005071 if report_mirror_ports != None:
5072 self.report_mirror_ports = report_mirror_ports
5073 else:
5074 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005075 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005076
5077 def pack(self):
5078 packed = []
5079 packed.append(struct.pack("!B", self.version))
5080 packed.append(struct.pack("!B", self.type))
5081 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5082 packed.append(struct.pack("!L", self.xid))
5083 packed.append(struct.pack("!L", self.experimenter))
5084 packed.append(struct.pack("!L", self.subtype))
5085 packed.append(struct.pack("!B", self.report_mirror_ports))
5086 packed.append('\x00' * 3)
5087 length = sum([len(x) for x in packed])
5088 packed[2] = struct.pack("!H", length)
5089 return ''.join(packed)
5090
5091 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005092 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005093 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005094 _version = reader.read("!B")[0]
5095 assert(_version == 4)
5096 _type = reader.read("!B")[0]
5097 assert(_type == 4)
5098 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005099 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005100 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005101 obj.xid = reader.read("!L")[0]
5102 _experimenter = reader.read("!L")[0]
5103 assert(_experimenter == 6035143)
5104 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005105 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07005106 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005107 reader.skip(3)
5108 return obj
5109
5110 def __eq__(self, other):
5111 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005112 if self.xid != other.xid: return False
5113 if self.report_mirror_ports != other.report_mirror_ports: return False
5114 return True
5115
Rich Lanec2ee4b82013-04-24 17:12:38 -07005116 def pretty_print(self, q):
5117 q.text("bsn_get_mirroring_reply {")
5118 with q.group():
5119 with q.indent(2):
5120 q.breakable()
5121 q.text("xid = ");
5122 if self.xid != None:
5123 q.text("%#x" % self.xid)
5124 else:
5125 q.text('None')
5126 q.text(","); q.breakable()
5127 q.text("report_mirror_ports = ");
5128 q.text("%#x" % self.report_mirror_ports)
5129 q.breakable()
5130 q.text('}')
5131
Rich Lane7dcdf022013-12-11 14:45:27 -08005132bsn_header.subtypes[5] = bsn_get_mirroring_reply
5133
5134class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005135 version = 4
5136 type = 4
5137 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005138 subtype = 4
5139
5140 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005141 if xid != None:
5142 self.xid = xid
5143 else:
5144 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005145 if report_mirror_ports != None:
5146 self.report_mirror_ports = report_mirror_ports
5147 else:
5148 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005149 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005150
5151 def pack(self):
5152 packed = []
5153 packed.append(struct.pack("!B", self.version))
5154 packed.append(struct.pack("!B", self.type))
5155 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5156 packed.append(struct.pack("!L", self.xid))
5157 packed.append(struct.pack("!L", self.experimenter))
5158 packed.append(struct.pack("!L", self.subtype))
5159 packed.append(struct.pack("!B", self.report_mirror_ports))
5160 packed.append('\x00' * 3)
5161 length = sum([len(x) for x in packed])
5162 packed[2] = struct.pack("!H", length)
5163 return ''.join(packed)
5164
5165 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005166 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005167 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005168 _version = reader.read("!B")[0]
5169 assert(_version == 4)
5170 _type = reader.read("!B")[0]
5171 assert(_type == 4)
5172 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005173 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005174 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005175 obj.xid = reader.read("!L")[0]
5176 _experimenter = reader.read("!L")[0]
5177 assert(_experimenter == 6035143)
5178 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005179 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005180 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005181 reader.skip(3)
5182 return obj
5183
5184 def __eq__(self, other):
5185 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005186 if self.xid != other.xid: return False
5187 if self.report_mirror_ports != other.report_mirror_ports: return False
5188 return True
5189
Rich Lanec2ee4b82013-04-24 17:12:38 -07005190 def pretty_print(self, q):
5191 q.text("bsn_get_mirroring_request {")
5192 with q.group():
5193 with q.indent(2):
5194 q.breakable()
5195 q.text("xid = ");
5196 if self.xid != None:
5197 q.text("%#x" % self.xid)
5198 else:
5199 q.text('None')
5200 q.text(","); q.breakable()
5201 q.text("report_mirror_ports = ");
5202 q.text("%#x" % self.report_mirror_ports)
5203 q.breakable()
5204 q.text('}')
5205
Rich Lane7dcdf022013-12-11 14:45:27 -08005206bsn_header.subtypes[4] = bsn_get_mirroring_request
5207
5208class bsn_get_switch_pipeline_reply(bsn_header):
5209 version = 4
5210 type = 4
5211 experimenter = 6035143
5212 subtype = 52
5213
5214 def __init__(self, xid=None, pipeline=None):
5215 if xid != None:
5216 self.xid = xid
5217 else:
5218 self.xid = None
5219 if pipeline != None:
5220 self.pipeline = pipeline
5221 else:
5222 self.pipeline = ""
5223 return
5224
5225 def pack(self):
5226 packed = []
5227 packed.append(struct.pack("!B", self.version))
5228 packed.append(struct.pack("!B", self.type))
5229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5230 packed.append(struct.pack("!L", self.xid))
5231 packed.append(struct.pack("!L", self.experimenter))
5232 packed.append(struct.pack("!L", self.subtype))
5233 packed.append(struct.pack("!256s", self.pipeline))
5234 length = sum([len(x) for x in packed])
5235 packed[2] = struct.pack("!H", length)
5236 return ''.join(packed)
5237
5238 @staticmethod
5239 def unpack(reader):
5240 obj = bsn_get_switch_pipeline_reply()
5241 _version = reader.read("!B")[0]
5242 assert(_version == 4)
5243 _type = reader.read("!B")[0]
5244 assert(_type == 4)
5245 _length = reader.read("!H")[0]
5246 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005247 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005248 obj.xid = reader.read("!L")[0]
5249 _experimenter = reader.read("!L")[0]
5250 assert(_experimenter == 6035143)
5251 _subtype = reader.read("!L")[0]
5252 assert(_subtype == 52)
5253 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5254 return obj
5255
5256 def __eq__(self, other):
5257 if type(self) != type(other): return False
5258 if self.xid != other.xid: return False
5259 if self.pipeline != other.pipeline: return False
5260 return True
5261
5262 def pretty_print(self, q):
5263 q.text("bsn_get_switch_pipeline_reply {")
5264 with q.group():
5265 with q.indent(2):
5266 q.breakable()
5267 q.text("xid = ");
5268 if self.xid != None:
5269 q.text("%#x" % self.xid)
5270 else:
5271 q.text('None')
5272 q.text(","); q.breakable()
5273 q.text("pipeline = ");
5274 q.pp(self.pipeline)
5275 q.breakable()
5276 q.text('}')
5277
5278bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5279
5280class bsn_get_switch_pipeline_request(bsn_header):
5281 version = 4
5282 type = 4
5283 experimenter = 6035143
5284 subtype = 51
5285
5286 def __init__(self, xid=None):
5287 if xid != None:
5288 self.xid = xid
5289 else:
5290 self.xid = None
5291 return
5292
5293 def pack(self):
5294 packed = []
5295 packed.append(struct.pack("!B", self.version))
5296 packed.append(struct.pack("!B", self.type))
5297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5298 packed.append(struct.pack("!L", self.xid))
5299 packed.append(struct.pack("!L", self.experimenter))
5300 packed.append(struct.pack("!L", self.subtype))
5301 length = sum([len(x) for x in packed])
5302 packed[2] = struct.pack("!H", length)
5303 return ''.join(packed)
5304
5305 @staticmethod
5306 def unpack(reader):
5307 obj = bsn_get_switch_pipeline_request()
5308 _version = reader.read("!B")[0]
5309 assert(_version == 4)
5310 _type = reader.read("!B")[0]
5311 assert(_type == 4)
5312 _length = reader.read("!H")[0]
5313 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005314 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005315 obj.xid = reader.read("!L")[0]
5316 _experimenter = reader.read("!L")[0]
5317 assert(_experimenter == 6035143)
5318 _subtype = reader.read("!L")[0]
5319 assert(_subtype == 51)
5320 return obj
5321
5322 def __eq__(self, other):
5323 if type(self) != type(other): return False
5324 if self.xid != other.xid: return False
5325 return True
5326
5327 def pretty_print(self, q):
5328 q.text("bsn_get_switch_pipeline_request {")
5329 with q.group():
5330 with q.indent(2):
5331 q.breakable()
5332 q.text("xid = ");
5333 if self.xid != None:
5334 q.text("%#x" % self.xid)
5335 else:
5336 q.text('None')
5337 q.breakable()
5338 q.text('}')
5339
5340bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5341
Rich Lane93b33132014-04-21 12:20:58 -07005342class bsn_image_desc_stats_reply(bsn_stats_reply):
5343 version = 4
5344 type = 19
5345 stats_type = 65535
5346 experimenter = 6035143
5347 subtype = 14
5348
5349 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5350 if xid != None:
5351 self.xid = xid
5352 else:
5353 self.xid = None
5354 if flags != None:
5355 self.flags = flags
5356 else:
5357 self.flags = 0
5358 if image_checksum != None:
5359 self.image_checksum = image_checksum
5360 else:
5361 self.image_checksum = ""
5362 if startup_config_checksum != None:
5363 self.startup_config_checksum = startup_config_checksum
5364 else:
5365 self.startup_config_checksum = ""
5366 return
5367
5368 def pack(self):
5369 packed = []
5370 packed.append(struct.pack("!B", self.version))
5371 packed.append(struct.pack("!B", self.type))
5372 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5373 packed.append(struct.pack("!L", self.xid))
5374 packed.append(struct.pack("!H", self.stats_type))
5375 packed.append(struct.pack("!H", self.flags))
5376 packed.append('\x00' * 4)
5377 packed.append(struct.pack("!L", self.experimenter))
5378 packed.append(struct.pack("!L", self.subtype))
5379 packed.append(struct.pack("!256s", self.image_checksum))
5380 packed.append(struct.pack("!256s", self.startup_config_checksum))
5381 length = sum([len(x) for x in packed])
5382 packed[2] = struct.pack("!H", length)
5383 return ''.join(packed)
5384
5385 @staticmethod
5386 def unpack(reader):
5387 obj = bsn_image_desc_stats_reply()
5388 _version = reader.read("!B")[0]
5389 assert(_version == 4)
5390 _type = reader.read("!B")[0]
5391 assert(_type == 19)
5392 _length = reader.read("!H")[0]
5393 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005394 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005395 obj.xid = reader.read("!L")[0]
5396 _stats_type = reader.read("!H")[0]
5397 assert(_stats_type == 65535)
5398 obj.flags = reader.read("!H")[0]
5399 reader.skip(4)
5400 _experimenter = reader.read("!L")[0]
5401 assert(_experimenter == 6035143)
5402 _subtype = reader.read("!L")[0]
5403 assert(_subtype == 14)
5404 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5405 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5406 return obj
5407
5408 def __eq__(self, other):
5409 if type(self) != type(other): return False
5410 if self.xid != other.xid: return False
5411 if self.flags != other.flags: return False
5412 if self.image_checksum != other.image_checksum: return False
5413 if self.startup_config_checksum != other.startup_config_checksum: return False
5414 return True
5415
5416 def pretty_print(self, q):
5417 q.text("bsn_image_desc_stats_reply {")
5418 with q.group():
5419 with q.indent(2):
5420 q.breakable()
5421 q.text("xid = ");
5422 if self.xid != None:
5423 q.text("%#x" % self.xid)
5424 else:
5425 q.text('None')
5426 q.text(","); q.breakable()
5427 q.text("flags = ");
5428 q.text("%#x" % self.flags)
5429 q.text(","); q.breakable()
5430 q.text("image_checksum = ");
5431 q.pp(self.image_checksum)
5432 q.text(","); q.breakable()
5433 q.text("startup_config_checksum = ");
5434 q.pp(self.startup_config_checksum)
5435 q.breakable()
5436 q.text('}')
5437
5438bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5439
5440class bsn_image_desc_stats_request(bsn_stats_request):
5441 version = 4
5442 type = 18
5443 stats_type = 65535
5444 experimenter = 6035143
5445 subtype = 14
5446
5447 def __init__(self, xid=None, flags=None):
5448 if xid != None:
5449 self.xid = xid
5450 else:
5451 self.xid = None
5452 if flags != None:
5453 self.flags = flags
5454 else:
5455 self.flags = 0
5456 return
5457
5458 def pack(self):
5459 packed = []
5460 packed.append(struct.pack("!B", self.version))
5461 packed.append(struct.pack("!B", self.type))
5462 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5463 packed.append(struct.pack("!L", self.xid))
5464 packed.append(struct.pack("!H", self.stats_type))
5465 packed.append(struct.pack("!H", self.flags))
5466 packed.append('\x00' * 4)
5467 packed.append(struct.pack("!L", self.experimenter))
5468 packed.append(struct.pack("!L", self.subtype))
5469 length = sum([len(x) for x in packed])
5470 packed[2] = struct.pack("!H", length)
5471 return ''.join(packed)
5472
5473 @staticmethod
5474 def unpack(reader):
5475 obj = bsn_image_desc_stats_request()
5476 _version = reader.read("!B")[0]
5477 assert(_version == 4)
5478 _type = reader.read("!B")[0]
5479 assert(_type == 18)
5480 _length = reader.read("!H")[0]
5481 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005482 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005483 obj.xid = reader.read("!L")[0]
5484 _stats_type = reader.read("!H")[0]
5485 assert(_stats_type == 65535)
5486 obj.flags = reader.read("!H")[0]
5487 reader.skip(4)
5488 _experimenter = reader.read("!L")[0]
5489 assert(_experimenter == 6035143)
5490 _subtype = reader.read("!L")[0]
5491 assert(_subtype == 14)
5492 return obj
5493
5494 def __eq__(self, other):
5495 if type(self) != type(other): return False
5496 if self.xid != other.xid: return False
5497 if self.flags != other.flags: return False
5498 return True
5499
5500 def pretty_print(self, q):
5501 q.text("bsn_image_desc_stats_request {")
5502 with q.group():
5503 with q.indent(2):
5504 q.breakable()
5505 q.text("xid = ");
5506 if self.xid != None:
5507 q.text("%#x" % self.xid)
5508 else:
5509 q.text('None')
5510 q.text(","); q.breakable()
5511 q.text("flags = ");
5512 q.text("%#x" % self.flags)
5513 q.breakable()
5514 q.text('}')
5515
5516bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5517
Rich Lane7dcdf022013-12-11 14:45:27 -08005518class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005519 version = 4
5520 type = 4
5521 experimenter = 6035143
5522 subtype = 43
5523
5524 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 -08005525 if xid != None:
5526 self.xid = xid
5527 else:
5528 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005529 if convergence_status != None:
5530 self.convergence_status = convergence_status
5531 else:
5532 self.convergence_status = 0
5533 if port_no != None:
5534 self.port_no = port_no
5535 else:
5536 self.port_no = 0
5537 if actor_sys_priority != None:
5538 self.actor_sys_priority = actor_sys_priority
5539 else:
5540 self.actor_sys_priority = 0
5541 if actor_sys_mac != None:
5542 self.actor_sys_mac = actor_sys_mac
5543 else:
5544 self.actor_sys_mac = [0,0,0,0,0,0]
5545 if actor_port_priority != None:
5546 self.actor_port_priority = actor_port_priority
5547 else:
5548 self.actor_port_priority = 0
5549 if actor_port_num != None:
5550 self.actor_port_num = actor_port_num
5551 else:
5552 self.actor_port_num = 0
5553 if actor_key != None:
5554 self.actor_key = actor_key
5555 else:
5556 self.actor_key = 0
5557 if partner_sys_priority != None:
5558 self.partner_sys_priority = partner_sys_priority
5559 else:
5560 self.partner_sys_priority = 0
5561 if partner_sys_mac != None:
5562 self.partner_sys_mac = partner_sys_mac
5563 else:
5564 self.partner_sys_mac = [0,0,0,0,0,0]
5565 if partner_port_priority != None:
5566 self.partner_port_priority = partner_port_priority
5567 else:
5568 self.partner_port_priority = 0
5569 if partner_port_num != None:
5570 self.partner_port_num = partner_port_num
5571 else:
5572 self.partner_port_num = 0
5573 if partner_key != None:
5574 self.partner_key = partner_key
5575 else:
5576 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005577 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005578
5579 def pack(self):
5580 packed = []
5581 packed.append(struct.pack("!B", self.version))
5582 packed.append(struct.pack("!B", self.type))
5583 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5584 packed.append(struct.pack("!L", self.xid))
5585 packed.append(struct.pack("!L", self.experimenter))
5586 packed.append(struct.pack("!L", self.subtype))
5587 packed.append(struct.pack("!B", self.convergence_status))
5588 packed.append('\x00' * 3)
5589 packed.append(util.pack_port_no(self.port_no))
5590 packed.append(struct.pack("!H", self.actor_sys_priority))
5591 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5592 packed.append(struct.pack("!H", self.actor_port_priority))
5593 packed.append(struct.pack("!H", self.actor_port_num))
5594 packed.append(struct.pack("!H", self.actor_key))
5595 packed.append(struct.pack("!H", self.partner_sys_priority))
5596 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5597 packed.append(struct.pack("!H", self.partner_port_priority))
5598 packed.append(struct.pack("!H", self.partner_port_num))
5599 packed.append(struct.pack("!H", self.partner_key))
5600 length = sum([len(x) for x in packed])
5601 packed[2] = struct.pack("!H", length)
5602 return ''.join(packed)
5603
5604 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005605 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005606 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08005607 _version = reader.read("!B")[0]
5608 assert(_version == 4)
5609 _type = reader.read("!B")[0]
5610 assert(_type == 4)
5611 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005612 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005613 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005614 obj.xid = reader.read("!L")[0]
5615 _experimenter = reader.read("!L")[0]
5616 assert(_experimenter == 6035143)
5617 _subtype = reader.read("!L")[0]
5618 assert(_subtype == 43)
5619 obj.convergence_status = reader.read("!B")[0]
5620 reader.skip(3)
5621 obj.port_no = util.unpack_port_no(reader)
5622 obj.actor_sys_priority = reader.read("!H")[0]
5623 obj.actor_sys_mac = list(reader.read('!6B'))
5624 obj.actor_port_priority = reader.read("!H")[0]
5625 obj.actor_port_num = reader.read("!H")[0]
5626 obj.actor_key = reader.read("!H")[0]
5627 obj.partner_sys_priority = reader.read("!H")[0]
5628 obj.partner_sys_mac = list(reader.read('!6B'))
5629 obj.partner_port_priority = reader.read("!H")[0]
5630 obj.partner_port_num = reader.read("!H")[0]
5631 obj.partner_key = reader.read("!H")[0]
5632 return obj
5633
5634 def __eq__(self, other):
5635 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005636 if self.xid != other.xid: return False
5637 if self.convergence_status != other.convergence_status: return False
5638 if self.port_no != other.port_no: return False
5639 if self.actor_sys_priority != other.actor_sys_priority: return False
5640 if self.actor_sys_mac != other.actor_sys_mac: return False
5641 if self.actor_port_priority != other.actor_port_priority: return False
5642 if self.actor_port_num != other.actor_port_num: return False
5643 if self.actor_key != other.actor_key: return False
5644 if self.partner_sys_priority != other.partner_sys_priority: return False
5645 if self.partner_sys_mac != other.partner_sys_mac: return False
5646 if self.partner_port_priority != other.partner_port_priority: return False
5647 if self.partner_port_num != other.partner_port_num: return False
5648 if self.partner_key != other.partner_key: return False
5649 return True
5650
Rich Lane7b0f2012013-11-22 14:15:26 -08005651 def pretty_print(self, q):
5652 q.text("bsn_lacp_convergence_notif {")
5653 with q.group():
5654 with q.indent(2):
5655 q.breakable()
5656 q.text("xid = ");
5657 if self.xid != None:
5658 q.text("%#x" % self.xid)
5659 else:
5660 q.text('None')
5661 q.text(","); q.breakable()
5662 q.text("convergence_status = ");
5663 q.text("%#x" % self.convergence_status)
5664 q.text(","); q.breakable()
5665 q.text("port_no = ");
5666 q.text(util.pretty_port(self.port_no))
5667 q.text(","); q.breakable()
5668 q.text("actor_sys_priority = ");
5669 q.text("%#x" % self.actor_sys_priority)
5670 q.text(","); q.breakable()
5671 q.text("actor_sys_mac = ");
5672 q.text(util.pretty_mac(self.actor_sys_mac))
5673 q.text(","); q.breakable()
5674 q.text("actor_port_priority = ");
5675 q.text("%#x" % self.actor_port_priority)
5676 q.text(","); q.breakable()
5677 q.text("actor_port_num = ");
5678 q.text("%#x" % self.actor_port_num)
5679 q.text(","); q.breakable()
5680 q.text("actor_key = ");
5681 q.text("%#x" % self.actor_key)
5682 q.text(","); q.breakable()
5683 q.text("partner_sys_priority = ");
5684 q.text("%#x" % self.partner_sys_priority)
5685 q.text(","); q.breakable()
5686 q.text("partner_sys_mac = ");
5687 q.text(util.pretty_mac(self.partner_sys_mac))
5688 q.text(","); q.breakable()
5689 q.text("partner_port_priority = ");
5690 q.text("%#x" % self.partner_port_priority)
5691 q.text(","); q.breakable()
5692 q.text("partner_port_num = ");
5693 q.text("%#x" % self.partner_port_num)
5694 q.text(","); q.breakable()
5695 q.text("partner_key = ");
5696 q.text("%#x" % self.partner_key)
5697 q.breakable()
5698 q.text('}')
5699
Rich Lane7dcdf022013-12-11 14:45:27 -08005700bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5701
Rich Lane7dcdf022013-12-11 14:45:27 -08005702class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08005703 version = 4
5704 type = 19
5705 stats_type = 65535
5706 experimenter = 6035143
5707 subtype = 1
5708
5709 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005710 if xid != None:
5711 self.xid = xid
5712 else:
5713 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005714 if flags != None:
5715 self.flags = flags
5716 else:
5717 self.flags = 0
5718 if entries != None:
5719 self.entries = entries
5720 else:
5721 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005722 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005723
5724 def pack(self):
5725 packed = []
5726 packed.append(struct.pack("!B", self.version))
5727 packed.append(struct.pack("!B", self.type))
5728 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5729 packed.append(struct.pack("!L", self.xid))
5730 packed.append(struct.pack("!H", self.stats_type))
5731 packed.append(struct.pack("!H", self.flags))
5732 packed.append('\x00' * 4)
5733 packed.append(struct.pack("!L", self.experimenter))
5734 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08005735 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08005736 length = sum([len(x) for x in packed])
5737 packed[2] = struct.pack("!H", length)
5738 return ''.join(packed)
5739
5740 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005741 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005742 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005743 _version = reader.read("!B")[0]
5744 assert(_version == 4)
5745 _type = reader.read("!B")[0]
5746 assert(_type == 19)
5747 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005748 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005749 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005750 obj.xid = reader.read("!L")[0]
5751 _stats_type = reader.read("!H")[0]
5752 assert(_stats_type == 65535)
5753 obj.flags = reader.read("!H")[0]
5754 reader.skip(4)
5755 _experimenter = reader.read("!L")[0]
5756 assert(_experimenter == 6035143)
5757 _subtype = reader.read("!L")[0]
5758 assert(_subtype == 1)
5759 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
5760 return obj
5761
5762 def __eq__(self, other):
5763 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005764 if self.xid != other.xid: return False
5765 if self.flags != other.flags: return False
5766 if self.entries != other.entries: return False
5767 return True
5768
Rich Lane7b0f2012013-11-22 14:15:26 -08005769 def pretty_print(self, q):
5770 q.text("bsn_lacp_stats_reply {")
5771 with q.group():
5772 with q.indent(2):
5773 q.breakable()
5774 q.text("xid = ");
5775 if self.xid != None:
5776 q.text("%#x" % self.xid)
5777 else:
5778 q.text('None')
5779 q.text(","); q.breakable()
5780 q.text("flags = ");
5781 q.text("%#x" % self.flags)
5782 q.text(","); q.breakable()
5783 q.text("entries = ");
5784 q.pp(self.entries)
5785 q.breakable()
5786 q.text('}')
5787
Rich Lane7dcdf022013-12-11 14:45:27 -08005788bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5789
Rich Lane7dcdf022013-12-11 14:45:27 -08005790class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08005791 version = 4
5792 type = 18
5793 stats_type = 65535
5794 experimenter = 6035143
5795 subtype = 1
5796
5797 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005798 if xid != None:
5799 self.xid = xid
5800 else:
5801 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005802 if flags != None:
5803 self.flags = flags
5804 else:
5805 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005806 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005807
5808 def pack(self):
5809 packed = []
5810 packed.append(struct.pack("!B", self.version))
5811 packed.append(struct.pack("!B", self.type))
5812 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5813 packed.append(struct.pack("!L", self.xid))
5814 packed.append(struct.pack("!H", self.stats_type))
5815 packed.append(struct.pack("!H", self.flags))
5816 packed.append('\x00' * 4)
5817 packed.append(struct.pack("!L", self.experimenter))
5818 packed.append(struct.pack("!L", self.subtype))
5819 length = sum([len(x) for x in packed])
5820 packed[2] = struct.pack("!H", length)
5821 return ''.join(packed)
5822
5823 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005824 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005825 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005826 _version = reader.read("!B")[0]
5827 assert(_version == 4)
5828 _type = reader.read("!B")[0]
5829 assert(_type == 18)
5830 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005831 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005832 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005833 obj.xid = reader.read("!L")[0]
5834 _stats_type = reader.read("!H")[0]
5835 assert(_stats_type == 65535)
5836 obj.flags = reader.read("!H")[0]
5837 reader.skip(4)
5838 _experimenter = reader.read("!L")[0]
5839 assert(_experimenter == 6035143)
5840 _subtype = reader.read("!L")[0]
5841 assert(_subtype == 1)
5842 return obj
5843
5844 def __eq__(self, other):
5845 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005846 if self.xid != other.xid: return False
5847 if self.flags != other.flags: return False
5848 return True
5849
Rich Lane7b0f2012013-11-22 14:15:26 -08005850 def pretty_print(self, q):
5851 q.text("bsn_lacp_stats_request {")
5852 with q.group():
5853 with q.indent(2):
5854 q.breakable()
5855 q.text("xid = ");
5856 if self.xid != None:
5857 q.text("%#x" % self.xid)
5858 else:
5859 q.text('None')
5860 q.text(","); q.breakable()
5861 q.text("flags = ");
5862 q.text("%#x" % self.flags)
5863 q.breakable()
5864 q.text('}')
5865
Rich Lane7dcdf022013-12-11 14:45:27 -08005866bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5867
Rich Lane5587ab12014-06-30 11:19:09 -07005868class bsn_log(bsn_header):
5869 version = 4
5870 type = 4
5871 experimenter = 6035143
5872 subtype = 63
5873
5874 def __init__(self, xid=None, loglevel=None, data=None):
5875 if xid != None:
5876 self.xid = xid
5877 else:
5878 self.xid = None
5879 if loglevel != None:
5880 self.loglevel = loglevel
5881 else:
5882 self.loglevel = 0
5883 if data != None:
5884 self.data = data
5885 else:
5886 self.data = ''
5887 return
5888
5889 def pack(self):
5890 packed = []
5891 packed.append(struct.pack("!B", self.version))
5892 packed.append(struct.pack("!B", self.type))
5893 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5894 packed.append(struct.pack("!L", self.xid))
5895 packed.append(struct.pack("!L", self.experimenter))
5896 packed.append(struct.pack("!L", self.subtype))
5897 packed.append(struct.pack("!B", self.loglevel))
5898 packed.append(self.data)
5899 length = sum([len(x) for x in packed])
5900 packed[2] = struct.pack("!H", length)
5901 return ''.join(packed)
5902
5903 @staticmethod
5904 def unpack(reader):
5905 obj = bsn_log()
5906 _version = reader.read("!B")[0]
5907 assert(_version == 4)
5908 _type = reader.read("!B")[0]
5909 assert(_type == 4)
5910 _length = reader.read("!H")[0]
5911 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005912 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07005913 obj.xid = reader.read("!L")[0]
5914 _experimenter = reader.read("!L")[0]
5915 assert(_experimenter == 6035143)
5916 _subtype = reader.read("!L")[0]
5917 assert(_subtype == 63)
5918 obj.loglevel = reader.read("!B")[0]
5919 obj.data = str(reader.read_all())
5920 return obj
5921
5922 def __eq__(self, other):
5923 if type(self) != type(other): return False
5924 if self.xid != other.xid: return False
5925 if self.loglevel != other.loglevel: return False
5926 if self.data != other.data: return False
5927 return True
5928
5929 def pretty_print(self, q):
5930 q.text("bsn_log {")
5931 with q.group():
5932 with q.indent(2):
5933 q.breakable()
5934 q.text("xid = ");
5935 if self.xid != None:
5936 q.text("%#x" % self.xid)
5937 else:
5938 q.text('None')
5939 q.text(","); q.breakable()
5940 q.text("loglevel = ");
5941 q.text("%#x" % self.loglevel)
5942 q.text(","); q.breakable()
5943 q.text("data = ");
5944 q.pp(self.data)
5945 q.breakable()
5946 q.text('}')
5947
5948bsn_header.subtypes[63] = bsn_log
5949
Rich Lane474324f2015-01-14 15:22:56 -08005950class bsn_lua_command_reply(bsn_header):
5951 version = 4
5952 type = 4
5953 experimenter = 6035143
5954 subtype = 66
5955
5956 def __init__(self, xid=None, data=None):
5957 if xid != None:
5958 self.xid = xid
5959 else:
5960 self.xid = None
5961 if data != None:
5962 self.data = data
5963 else:
5964 self.data = ''
5965 return
5966
5967 def pack(self):
5968 packed = []
5969 packed.append(struct.pack("!B", self.version))
5970 packed.append(struct.pack("!B", self.type))
5971 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5972 packed.append(struct.pack("!L", self.xid))
5973 packed.append(struct.pack("!L", self.experimenter))
5974 packed.append(struct.pack("!L", self.subtype))
5975 packed.append(self.data)
5976 length = sum([len(x) for x in packed])
5977 packed[2] = struct.pack("!H", length)
5978 return ''.join(packed)
5979
5980 @staticmethod
5981 def unpack(reader):
5982 obj = bsn_lua_command_reply()
5983 _version = reader.read("!B")[0]
5984 assert(_version == 4)
5985 _type = reader.read("!B")[0]
5986 assert(_type == 4)
5987 _length = reader.read("!H")[0]
5988 orig_reader = reader
5989 reader = orig_reader.slice(_length, 4)
5990 obj.xid = reader.read("!L")[0]
5991 _experimenter = reader.read("!L")[0]
5992 assert(_experimenter == 6035143)
5993 _subtype = reader.read("!L")[0]
5994 assert(_subtype == 66)
5995 obj.data = str(reader.read_all())
5996 return obj
5997
5998 def __eq__(self, other):
5999 if type(self) != type(other): return False
6000 if self.xid != other.xid: return False
6001 if self.data != other.data: return False
6002 return True
6003
6004 def pretty_print(self, q):
6005 q.text("bsn_lua_command_reply {")
6006 with q.group():
6007 with q.indent(2):
6008 q.breakable()
6009 q.text("xid = ");
6010 if self.xid != None:
6011 q.text("%#x" % self.xid)
6012 else:
6013 q.text('None')
6014 q.text(","); q.breakable()
6015 q.text("data = ");
6016 q.pp(self.data)
6017 q.breakable()
6018 q.text('}')
6019
6020bsn_header.subtypes[66] = bsn_lua_command_reply
6021
6022class bsn_lua_command_request(bsn_header):
6023 version = 4
6024 type = 4
6025 experimenter = 6035143
6026 subtype = 65
6027
6028 def __init__(self, xid=None, data=None):
6029 if xid != None:
6030 self.xid = xid
6031 else:
6032 self.xid = None
6033 if data != None:
6034 self.data = data
6035 else:
6036 self.data = ''
6037 return
6038
6039 def pack(self):
6040 packed = []
6041 packed.append(struct.pack("!B", self.version))
6042 packed.append(struct.pack("!B", self.type))
6043 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6044 packed.append(struct.pack("!L", self.xid))
6045 packed.append(struct.pack("!L", self.experimenter))
6046 packed.append(struct.pack("!L", self.subtype))
6047 packed.append(self.data)
6048 length = sum([len(x) for x in packed])
6049 packed[2] = struct.pack("!H", length)
6050 return ''.join(packed)
6051
6052 @staticmethod
6053 def unpack(reader):
6054 obj = bsn_lua_command_request()
6055 _version = reader.read("!B")[0]
6056 assert(_version == 4)
6057 _type = reader.read("!B")[0]
6058 assert(_type == 4)
6059 _length = reader.read("!H")[0]
6060 orig_reader = reader
6061 reader = orig_reader.slice(_length, 4)
6062 obj.xid = reader.read("!L")[0]
6063 _experimenter = reader.read("!L")[0]
6064 assert(_experimenter == 6035143)
6065 _subtype = reader.read("!L")[0]
6066 assert(_subtype == 65)
6067 obj.data = str(reader.read_all())
6068 return obj
6069
6070 def __eq__(self, other):
6071 if type(self) != type(other): return False
6072 if self.xid != other.xid: return False
6073 if self.data != other.data: return False
6074 return True
6075
6076 def pretty_print(self, q):
6077 q.text("bsn_lua_command_request {")
6078 with q.group():
6079 with q.indent(2):
6080 q.breakable()
6081 q.text("xid = ");
6082 if self.xid != None:
6083 q.text("%#x" % self.xid)
6084 else:
6085 q.text('None')
6086 q.text(","); q.breakable()
6087 q.text("data = ");
6088 q.pp(self.data)
6089 q.breakable()
6090 q.text('}')
6091
6092bsn_header.subtypes[65] = bsn_lua_command_request
6093
6094class bsn_lua_notification(bsn_header):
6095 version = 4
6096 type = 4
6097 experimenter = 6035143
6098 subtype = 67
6099
6100 def __init__(self, xid=None, data=None):
6101 if xid != None:
6102 self.xid = xid
6103 else:
6104 self.xid = None
6105 if data != None:
6106 self.data = data
6107 else:
6108 self.data = ''
6109 return
6110
6111 def pack(self):
6112 packed = []
6113 packed.append(struct.pack("!B", self.version))
6114 packed.append(struct.pack("!B", self.type))
6115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6116 packed.append(struct.pack("!L", self.xid))
6117 packed.append(struct.pack("!L", self.experimenter))
6118 packed.append(struct.pack("!L", self.subtype))
6119 packed.append(self.data)
6120 length = sum([len(x) for x in packed])
6121 packed[2] = struct.pack("!H", length)
6122 return ''.join(packed)
6123
6124 @staticmethod
6125 def unpack(reader):
6126 obj = bsn_lua_notification()
6127 _version = reader.read("!B")[0]
6128 assert(_version == 4)
6129 _type = reader.read("!B")[0]
6130 assert(_type == 4)
6131 _length = reader.read("!H")[0]
6132 orig_reader = reader
6133 reader = orig_reader.slice(_length, 4)
6134 obj.xid = reader.read("!L")[0]
6135 _experimenter = reader.read("!L")[0]
6136 assert(_experimenter == 6035143)
6137 _subtype = reader.read("!L")[0]
6138 assert(_subtype == 67)
6139 obj.data = str(reader.read_all())
6140 return obj
6141
6142 def __eq__(self, other):
6143 if type(self) != type(other): return False
6144 if self.xid != other.xid: return False
6145 if self.data != other.data: return False
6146 return True
6147
6148 def pretty_print(self, q):
6149 q.text("bsn_lua_notification {")
6150 with q.group():
6151 with q.indent(2):
6152 q.breakable()
6153 q.text("xid = ");
6154 if self.xid != None:
6155 q.text("%#x" % self.xid)
6156 else:
6157 q.text('None')
6158 q.text(","); q.breakable()
6159 q.text("data = ");
6160 q.pp(self.data)
6161 q.breakable()
6162 q.text('}')
6163
6164bsn_header.subtypes[67] = bsn_lua_notification
6165
6166class bsn_lua_upload(bsn_header):
6167 version = 4
6168 type = 4
6169 experimenter = 6035143
6170 subtype = 64
6171
6172 def __init__(self, xid=None, flags=None, filename=None, data=None):
6173 if xid != None:
6174 self.xid = xid
6175 else:
6176 self.xid = None
6177 if flags != None:
6178 self.flags = flags
6179 else:
6180 self.flags = 0
6181 if filename != None:
6182 self.filename = filename
6183 else:
6184 self.filename = ""
6185 if data != None:
6186 self.data = data
6187 else:
6188 self.data = ''
6189 return
6190
6191 def pack(self):
6192 packed = []
6193 packed.append(struct.pack("!B", self.version))
6194 packed.append(struct.pack("!B", self.type))
6195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6196 packed.append(struct.pack("!L", self.xid))
6197 packed.append(struct.pack("!L", self.experimenter))
6198 packed.append(struct.pack("!L", self.subtype))
6199 packed.append(struct.pack("!H", self.flags))
6200 packed.append(struct.pack("!64s", self.filename))
6201 packed.append(self.data)
6202 length = sum([len(x) for x in packed])
6203 packed[2] = struct.pack("!H", length)
6204 return ''.join(packed)
6205
6206 @staticmethod
6207 def unpack(reader):
6208 obj = bsn_lua_upload()
6209 _version = reader.read("!B")[0]
6210 assert(_version == 4)
6211 _type = reader.read("!B")[0]
6212 assert(_type == 4)
6213 _length = reader.read("!H")[0]
6214 orig_reader = reader
6215 reader = orig_reader.slice(_length, 4)
6216 obj.xid = reader.read("!L")[0]
6217 _experimenter = reader.read("!L")[0]
6218 assert(_experimenter == 6035143)
6219 _subtype = reader.read("!L")[0]
6220 assert(_subtype == 64)
6221 obj.flags = reader.read("!H")[0]
6222 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6223 obj.data = str(reader.read_all())
6224 return obj
6225
6226 def __eq__(self, other):
6227 if type(self) != type(other): return False
6228 if self.xid != other.xid: return False
6229 if self.flags != other.flags: return False
6230 if self.filename != other.filename: return False
6231 if self.data != other.data: return False
6232 return True
6233
6234 def pretty_print(self, q):
6235 q.text("bsn_lua_upload {")
6236 with q.group():
6237 with q.indent(2):
6238 q.breakable()
6239 q.text("xid = ");
6240 if self.xid != None:
6241 q.text("%#x" % self.xid)
6242 else:
6243 q.text('None')
6244 q.text(","); q.breakable()
6245 q.text("flags = ");
6246 q.text("%#x" % self.flags)
6247 q.text(","); q.breakable()
6248 q.text("filename = ");
6249 q.pp(self.filename)
6250 q.text(","); q.breakable()
6251 q.text("data = ");
6252 q.pp(self.data)
6253 q.breakable()
6254 q.text('}')
6255
6256bsn_header.subtypes[64] = bsn_lua_upload
6257
Rich Lane7dcdf022013-12-11 14:45:27 -08006258class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006259 version = 4
6260 type = 4
6261 experimenter = 6035143
6262 subtype = 34
6263
Rich Lane7b0f2012013-11-22 14:15:26 -08006264 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006265 if xid != None:
6266 self.xid = xid
6267 else:
6268 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006269 if status != None:
6270 self.status = status
6271 else:
6272 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006273 if port_no != None:
6274 self.port_no = port_no
6275 else:
6276 self.port_no = 0
6277 if slot_num != None:
6278 self.slot_num = slot_num
6279 else:
6280 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006281 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006282
6283 def pack(self):
6284 packed = []
6285 packed.append(struct.pack("!B", self.version))
6286 packed.append(struct.pack("!B", self.type))
6287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6288 packed.append(struct.pack("!L", self.xid))
6289 packed.append(struct.pack("!L", self.experimenter))
6290 packed.append(struct.pack("!L", self.subtype))
6291 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006292 packed.append(util.pack_port_no(self.port_no))
6293 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006294 length = sum([len(x) for x in packed])
6295 packed[2] = struct.pack("!H", length)
6296 return ''.join(packed)
6297
6298 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006299 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006300 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006301 _version = reader.read("!B")[0]
6302 assert(_version == 4)
6303 _type = reader.read("!B")[0]
6304 assert(_type == 4)
6305 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006306 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006307 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006308 obj.xid = reader.read("!L")[0]
6309 _experimenter = reader.read("!L")[0]
6310 assert(_experimenter == 6035143)
6311 _subtype = reader.read("!L")[0]
6312 assert(_subtype == 34)
6313 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006314 obj.port_no = util.unpack_port_no(reader)
6315 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006316 return obj
6317
6318 def __eq__(self, other):
6319 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006320 if self.xid != other.xid: return False
6321 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006322 if self.port_no != other.port_no: return False
6323 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006324 return True
6325
Rich Lane6f4978c2013-10-20 21:33:52 -07006326 def pretty_print(self, q):
6327 q.text("bsn_pdu_rx_reply {")
6328 with q.group():
6329 with q.indent(2):
6330 q.breakable()
6331 q.text("xid = ");
6332 if self.xid != None:
6333 q.text("%#x" % self.xid)
6334 else:
6335 q.text('None')
6336 q.text(","); q.breakable()
6337 q.text("status = ");
6338 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006339 q.text(","); q.breakable()
6340 q.text("port_no = ");
6341 q.text(util.pretty_port(self.port_no))
6342 q.text(","); q.breakable()
6343 q.text("slot_num = ");
6344 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006345 q.breakable()
6346 q.text('}')
6347
Rich Lane7dcdf022013-12-11 14:45:27 -08006348bsn_header.subtypes[34] = bsn_pdu_rx_reply
6349
6350class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006351 version = 4
6352 type = 4
6353 experimenter = 6035143
6354 subtype = 33
6355
6356 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006357 if xid != None:
6358 self.xid = xid
6359 else:
6360 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006361 if timeout_ms != None:
6362 self.timeout_ms = timeout_ms
6363 else:
6364 self.timeout_ms = 0
6365 if port_no != None:
6366 self.port_no = port_no
6367 else:
6368 self.port_no = 0
6369 if slot_num != None:
6370 self.slot_num = slot_num
6371 else:
6372 self.slot_num = 0
6373 if data != None:
6374 self.data = data
6375 else:
6376 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006377 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006378
6379 def pack(self):
6380 packed = []
6381 packed.append(struct.pack("!B", self.version))
6382 packed.append(struct.pack("!B", self.type))
6383 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6384 packed.append(struct.pack("!L", self.xid))
6385 packed.append(struct.pack("!L", self.experimenter))
6386 packed.append(struct.pack("!L", self.subtype))
6387 packed.append(struct.pack("!L", self.timeout_ms))
6388 packed.append(util.pack_port_no(self.port_no))
6389 packed.append(struct.pack("!B", self.slot_num))
6390 packed.append('\x00' * 3)
6391 packed.append(self.data)
6392 length = sum([len(x) for x in packed])
6393 packed[2] = struct.pack("!H", length)
6394 return ''.join(packed)
6395
6396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006397 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006398 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006399 _version = reader.read("!B")[0]
6400 assert(_version == 4)
6401 _type = reader.read("!B")[0]
6402 assert(_type == 4)
6403 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006404 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006405 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006406 obj.xid = reader.read("!L")[0]
6407 _experimenter = reader.read("!L")[0]
6408 assert(_experimenter == 6035143)
6409 _subtype = reader.read("!L")[0]
6410 assert(_subtype == 33)
6411 obj.timeout_ms = reader.read("!L")[0]
6412 obj.port_no = util.unpack_port_no(reader)
6413 obj.slot_num = reader.read("!B")[0]
6414 reader.skip(3)
6415 obj.data = str(reader.read_all())
6416 return obj
6417
6418 def __eq__(self, other):
6419 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006420 if self.xid != other.xid: return False
6421 if self.timeout_ms != other.timeout_ms: return False
6422 if self.port_no != other.port_no: return False
6423 if self.slot_num != other.slot_num: return False
6424 if self.data != other.data: return False
6425 return True
6426
Rich Lane6f4978c2013-10-20 21:33:52 -07006427 def pretty_print(self, q):
6428 q.text("bsn_pdu_rx_request {")
6429 with q.group():
6430 with q.indent(2):
6431 q.breakable()
6432 q.text("xid = ");
6433 if self.xid != None:
6434 q.text("%#x" % self.xid)
6435 else:
6436 q.text('None')
6437 q.text(","); q.breakable()
6438 q.text("timeout_ms = ");
6439 q.text("%#x" % self.timeout_ms)
6440 q.text(","); q.breakable()
6441 q.text("port_no = ");
6442 q.text(util.pretty_port(self.port_no))
6443 q.text(","); q.breakable()
6444 q.text("slot_num = ");
6445 q.text("%#x" % self.slot_num)
6446 q.text(","); q.breakable()
6447 q.text("data = ");
6448 q.pp(self.data)
6449 q.breakable()
6450 q.text('}')
6451
Rich Lane7dcdf022013-12-11 14:45:27 -08006452bsn_header.subtypes[33] = bsn_pdu_rx_request
6453
6454class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006455 version = 4
6456 type = 4
6457 experimenter = 6035143
6458 subtype = 35
6459
6460 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006461 if xid != None:
6462 self.xid = xid
6463 else:
6464 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006465 if port_no != None:
6466 self.port_no = port_no
6467 else:
6468 self.port_no = 0
6469 if slot_num != None:
6470 self.slot_num = slot_num
6471 else:
6472 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006473 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006474
6475 def pack(self):
6476 packed = []
6477 packed.append(struct.pack("!B", self.version))
6478 packed.append(struct.pack("!B", self.type))
6479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6480 packed.append(struct.pack("!L", self.xid))
6481 packed.append(struct.pack("!L", self.experimenter))
6482 packed.append(struct.pack("!L", self.subtype))
6483 packed.append(util.pack_port_no(self.port_no))
6484 packed.append(struct.pack("!B", self.slot_num))
6485 length = sum([len(x) for x in packed])
6486 packed[2] = struct.pack("!H", length)
6487 return ''.join(packed)
6488
6489 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006490 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006491 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07006492 _version = reader.read("!B")[0]
6493 assert(_version == 4)
6494 _type = reader.read("!B")[0]
6495 assert(_type == 4)
6496 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006497 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006498 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006499 obj.xid = reader.read("!L")[0]
6500 _experimenter = reader.read("!L")[0]
6501 assert(_experimenter == 6035143)
6502 _subtype = reader.read("!L")[0]
6503 assert(_subtype == 35)
6504 obj.port_no = util.unpack_port_no(reader)
6505 obj.slot_num = reader.read("!B")[0]
6506 return obj
6507
6508 def __eq__(self, other):
6509 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006510 if self.xid != other.xid: return False
6511 if self.port_no != other.port_no: return False
6512 if self.slot_num != other.slot_num: return False
6513 return True
6514
Rich Lane6f4978c2013-10-20 21:33:52 -07006515 def pretty_print(self, q):
6516 q.text("bsn_pdu_rx_timeout {")
6517 with q.group():
6518 with q.indent(2):
6519 q.breakable()
6520 q.text("xid = ");
6521 if self.xid != None:
6522 q.text("%#x" % self.xid)
6523 else:
6524 q.text('None')
6525 q.text(","); q.breakable()
6526 q.text("port_no = ");
6527 q.text(util.pretty_port(self.port_no))
6528 q.text(","); q.breakable()
6529 q.text("slot_num = ");
6530 q.text("%#x" % self.slot_num)
6531 q.breakable()
6532 q.text('}')
6533
Rich Lane7dcdf022013-12-11 14:45:27 -08006534bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6535
6536class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006537 version = 4
6538 type = 4
6539 experimenter = 6035143
6540 subtype = 32
6541
Rich Lane7b0f2012013-11-22 14:15:26 -08006542 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006543 if xid != None:
6544 self.xid = xid
6545 else:
6546 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006547 if status != None:
6548 self.status = status
6549 else:
6550 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006551 if port_no != None:
6552 self.port_no = port_no
6553 else:
6554 self.port_no = 0
6555 if slot_num != None:
6556 self.slot_num = slot_num
6557 else:
6558 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006559 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006560
6561 def pack(self):
6562 packed = []
6563 packed.append(struct.pack("!B", self.version))
6564 packed.append(struct.pack("!B", self.type))
6565 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6566 packed.append(struct.pack("!L", self.xid))
6567 packed.append(struct.pack("!L", self.experimenter))
6568 packed.append(struct.pack("!L", self.subtype))
6569 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006570 packed.append(util.pack_port_no(self.port_no))
6571 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006572 length = sum([len(x) for x in packed])
6573 packed[2] = struct.pack("!H", length)
6574 return ''.join(packed)
6575
6576 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006577 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006578 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006579 _version = reader.read("!B")[0]
6580 assert(_version == 4)
6581 _type = reader.read("!B")[0]
6582 assert(_type == 4)
6583 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006584 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006585 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006586 obj.xid = reader.read("!L")[0]
6587 _experimenter = reader.read("!L")[0]
6588 assert(_experimenter == 6035143)
6589 _subtype = reader.read("!L")[0]
6590 assert(_subtype == 32)
6591 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006592 obj.port_no = util.unpack_port_no(reader)
6593 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006594 return obj
6595
6596 def __eq__(self, other):
6597 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006598 if self.xid != other.xid: return False
6599 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006600 if self.port_no != other.port_no: return False
6601 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006602 return True
6603
Rich Lane6f4978c2013-10-20 21:33:52 -07006604 def pretty_print(self, q):
6605 q.text("bsn_pdu_tx_reply {")
6606 with q.group():
6607 with q.indent(2):
6608 q.breakable()
6609 q.text("xid = ");
6610 if self.xid != None:
6611 q.text("%#x" % self.xid)
6612 else:
6613 q.text('None')
6614 q.text(","); q.breakable()
6615 q.text("status = ");
6616 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006617 q.text(","); q.breakable()
6618 q.text("port_no = ");
6619 q.text(util.pretty_port(self.port_no))
6620 q.text(","); q.breakable()
6621 q.text("slot_num = ");
6622 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006623 q.breakable()
6624 q.text('}')
6625
Rich Lane7dcdf022013-12-11 14:45:27 -08006626bsn_header.subtypes[32] = bsn_pdu_tx_reply
6627
6628class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006629 version = 4
6630 type = 4
6631 experimenter = 6035143
6632 subtype = 31
6633
6634 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006635 if xid != None:
6636 self.xid = xid
6637 else:
6638 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006639 if tx_interval_ms != None:
6640 self.tx_interval_ms = tx_interval_ms
6641 else:
6642 self.tx_interval_ms = 0
6643 if port_no != None:
6644 self.port_no = port_no
6645 else:
6646 self.port_no = 0
6647 if slot_num != None:
6648 self.slot_num = slot_num
6649 else:
6650 self.slot_num = 0
6651 if data != None:
6652 self.data = data
6653 else:
6654 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006655 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006656
6657 def pack(self):
6658 packed = []
6659 packed.append(struct.pack("!B", self.version))
6660 packed.append(struct.pack("!B", self.type))
6661 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6662 packed.append(struct.pack("!L", self.xid))
6663 packed.append(struct.pack("!L", self.experimenter))
6664 packed.append(struct.pack("!L", self.subtype))
6665 packed.append(struct.pack("!L", self.tx_interval_ms))
6666 packed.append(util.pack_port_no(self.port_no))
6667 packed.append(struct.pack("!B", self.slot_num))
6668 packed.append('\x00' * 3)
6669 packed.append(self.data)
6670 length = sum([len(x) for x in packed])
6671 packed[2] = struct.pack("!H", length)
6672 return ''.join(packed)
6673
6674 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006675 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006676 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006677 _version = reader.read("!B")[0]
6678 assert(_version == 4)
6679 _type = reader.read("!B")[0]
6680 assert(_type == 4)
6681 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006682 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006683 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006684 obj.xid = reader.read("!L")[0]
6685 _experimenter = reader.read("!L")[0]
6686 assert(_experimenter == 6035143)
6687 _subtype = reader.read("!L")[0]
6688 assert(_subtype == 31)
6689 obj.tx_interval_ms = reader.read("!L")[0]
6690 obj.port_no = util.unpack_port_no(reader)
6691 obj.slot_num = reader.read("!B")[0]
6692 reader.skip(3)
6693 obj.data = str(reader.read_all())
6694 return obj
6695
6696 def __eq__(self, other):
6697 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006698 if self.xid != other.xid: return False
6699 if self.tx_interval_ms != other.tx_interval_ms: return False
6700 if self.port_no != other.port_no: return False
6701 if self.slot_num != other.slot_num: return False
6702 if self.data != other.data: return False
6703 return True
6704
Rich Lane6f4978c2013-10-20 21:33:52 -07006705 def pretty_print(self, q):
6706 q.text("bsn_pdu_tx_request {")
6707 with q.group():
6708 with q.indent(2):
6709 q.breakable()
6710 q.text("xid = ");
6711 if self.xid != None:
6712 q.text("%#x" % self.xid)
6713 else:
6714 q.text('None')
6715 q.text(","); q.breakable()
6716 q.text("tx_interval_ms = ");
6717 q.text("%#x" % self.tx_interval_ms)
6718 q.text(","); q.breakable()
6719 q.text("port_no = ");
6720 q.text(util.pretty_port(self.port_no))
6721 q.text(","); q.breakable()
6722 q.text("slot_num = ");
6723 q.text("%#x" % self.slot_num)
6724 q.text(","); q.breakable()
6725 q.text("data = ");
6726 q.pp(self.data)
6727 q.breakable()
6728 q.text('}')
6729
Rich Lane7dcdf022013-12-11 14:45:27 -08006730bsn_header.subtypes[31] = bsn_pdu_tx_request
6731
6732class bsn_port_counter_stats_reply(bsn_stats_reply):
6733 version = 4
6734 type = 19
6735 stats_type = 65535
6736 experimenter = 6035143
6737 subtype = 8
6738
6739 def __init__(self, xid=None, flags=None, entries=None):
6740 if xid != None:
6741 self.xid = xid
6742 else:
6743 self.xid = None
6744 if flags != None:
6745 self.flags = flags
6746 else:
6747 self.flags = 0
6748 if entries != None:
6749 self.entries = entries
6750 else:
6751 self.entries = []
6752 return
6753
6754 def pack(self):
6755 packed = []
6756 packed.append(struct.pack("!B", self.version))
6757 packed.append(struct.pack("!B", self.type))
6758 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6759 packed.append(struct.pack("!L", self.xid))
6760 packed.append(struct.pack("!H", self.stats_type))
6761 packed.append(struct.pack("!H", self.flags))
6762 packed.append('\x00' * 4)
6763 packed.append(struct.pack("!L", self.experimenter))
6764 packed.append(struct.pack("!L", self.subtype))
6765 packed.append(loxi.generic_util.pack_list(self.entries))
6766 length = sum([len(x) for x in packed])
6767 packed[2] = struct.pack("!H", length)
6768 return ''.join(packed)
6769
6770 @staticmethod
6771 def unpack(reader):
6772 obj = bsn_port_counter_stats_reply()
6773 _version = reader.read("!B")[0]
6774 assert(_version == 4)
6775 _type = reader.read("!B")[0]
6776 assert(_type == 19)
6777 _length = reader.read("!H")[0]
6778 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006779 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006780 obj.xid = reader.read("!L")[0]
6781 _stats_type = reader.read("!H")[0]
6782 assert(_stats_type == 65535)
6783 obj.flags = reader.read("!H")[0]
6784 reader.skip(4)
6785 _experimenter = reader.read("!L")[0]
6786 assert(_experimenter == 6035143)
6787 _subtype = reader.read("!L")[0]
6788 assert(_subtype == 8)
6789 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6790 return obj
6791
6792 def __eq__(self, other):
6793 if type(self) != type(other): return False
6794 if self.xid != other.xid: return False
6795 if self.flags != other.flags: return False
6796 if self.entries != other.entries: return False
6797 return True
6798
6799 def pretty_print(self, q):
6800 q.text("bsn_port_counter_stats_reply {")
6801 with q.group():
6802 with q.indent(2):
6803 q.breakable()
6804 q.text("xid = ");
6805 if self.xid != None:
6806 q.text("%#x" % self.xid)
6807 else:
6808 q.text('None')
6809 q.text(","); q.breakable()
6810 q.text("flags = ");
6811 q.text("%#x" % self.flags)
6812 q.text(","); q.breakable()
6813 q.text("entries = ");
6814 q.pp(self.entries)
6815 q.breakable()
6816 q.text('}')
6817
6818bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6819
6820class bsn_port_counter_stats_request(bsn_stats_request):
6821 version = 4
6822 type = 18
6823 stats_type = 65535
6824 experimenter = 6035143
6825 subtype = 8
6826
6827 def __init__(self, xid=None, flags=None, port_no=None):
6828 if xid != None:
6829 self.xid = xid
6830 else:
6831 self.xid = None
6832 if flags != None:
6833 self.flags = flags
6834 else:
6835 self.flags = 0
6836 if port_no != None:
6837 self.port_no = port_no
6838 else:
6839 self.port_no = 0
6840 return
6841
6842 def pack(self):
6843 packed = []
6844 packed.append(struct.pack("!B", self.version))
6845 packed.append(struct.pack("!B", self.type))
6846 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6847 packed.append(struct.pack("!L", self.xid))
6848 packed.append(struct.pack("!H", self.stats_type))
6849 packed.append(struct.pack("!H", self.flags))
6850 packed.append('\x00' * 4)
6851 packed.append(struct.pack("!L", self.experimenter))
6852 packed.append(struct.pack("!L", self.subtype))
6853 packed.append(util.pack_port_no(self.port_no))
6854 length = sum([len(x) for x in packed])
6855 packed[2] = struct.pack("!H", length)
6856 return ''.join(packed)
6857
6858 @staticmethod
6859 def unpack(reader):
6860 obj = bsn_port_counter_stats_request()
6861 _version = reader.read("!B")[0]
6862 assert(_version == 4)
6863 _type = reader.read("!B")[0]
6864 assert(_type == 18)
6865 _length = reader.read("!H")[0]
6866 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006867 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006868 obj.xid = reader.read("!L")[0]
6869 _stats_type = reader.read("!H")[0]
6870 assert(_stats_type == 65535)
6871 obj.flags = reader.read("!H")[0]
6872 reader.skip(4)
6873 _experimenter = reader.read("!L")[0]
6874 assert(_experimenter == 6035143)
6875 _subtype = reader.read("!L")[0]
6876 assert(_subtype == 8)
6877 obj.port_no = util.unpack_port_no(reader)
6878 return obj
6879
6880 def __eq__(self, other):
6881 if type(self) != type(other): return False
6882 if self.xid != other.xid: return False
6883 if self.flags != other.flags: return False
6884 if self.port_no != other.port_no: return False
6885 return True
6886
6887 def pretty_print(self, q):
6888 q.text("bsn_port_counter_stats_request {")
6889 with q.group():
6890 with q.indent(2):
6891 q.breakable()
6892 q.text("xid = ");
6893 if self.xid != None:
6894 q.text("%#x" % self.xid)
6895 else:
6896 q.text('None')
6897 q.text(","); q.breakable()
6898 q.text("flags = ");
6899 q.text("%#x" % self.flags)
6900 q.text(","); q.breakable()
6901 q.text("port_no = ");
6902 q.text(util.pretty_port(self.port_no))
6903 q.breakable()
6904 q.text('}')
6905
6906bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6907
Rich Lane5454b682014-01-14 17:07:36 -08006908class bsn_role_status(bsn_header):
6909 version = 4
6910 type = 4
6911 experimenter = 6035143
6912 subtype = 55
6913
6914 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
6915 if xid != None:
6916 self.xid = xid
6917 else:
6918 self.xid = None
6919 if role != None:
6920 self.role = role
6921 else:
6922 self.role = 0
6923 if reason != None:
6924 self.reason = reason
6925 else:
6926 self.reason = 0
6927 if generation_id != None:
6928 self.generation_id = generation_id
6929 else:
6930 self.generation_id = 0
6931 return
6932
6933 def pack(self):
6934 packed = []
6935 packed.append(struct.pack("!B", self.version))
6936 packed.append(struct.pack("!B", self.type))
6937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6938 packed.append(struct.pack("!L", self.xid))
6939 packed.append(struct.pack("!L", self.experimenter))
6940 packed.append(struct.pack("!L", self.subtype))
6941 packed.append(struct.pack("!L", self.role))
6942 packed.append(struct.pack("!B", self.reason))
6943 packed.append('\x00' * 3)
6944 packed.append(struct.pack("!Q", self.generation_id))
6945 length = sum([len(x) for x in packed])
6946 packed[2] = struct.pack("!H", length)
6947 return ''.join(packed)
6948
6949 @staticmethod
6950 def unpack(reader):
6951 obj = bsn_role_status()
6952 _version = reader.read("!B")[0]
6953 assert(_version == 4)
6954 _type = reader.read("!B")[0]
6955 assert(_type == 4)
6956 _length = reader.read("!H")[0]
6957 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006958 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08006959 obj.xid = reader.read("!L")[0]
6960 _experimenter = reader.read("!L")[0]
6961 assert(_experimenter == 6035143)
6962 _subtype = reader.read("!L")[0]
6963 assert(_subtype == 55)
6964 obj.role = reader.read("!L")[0]
6965 obj.reason = reader.read("!B")[0]
6966 reader.skip(3)
6967 obj.generation_id = reader.read("!Q")[0]
6968 return obj
6969
6970 def __eq__(self, other):
6971 if type(self) != type(other): return False
6972 if self.xid != other.xid: return False
6973 if self.role != other.role: return False
6974 if self.reason != other.reason: return False
6975 if self.generation_id != other.generation_id: return False
6976 return True
6977
6978 def pretty_print(self, q):
6979 q.text("bsn_role_status {")
6980 with q.group():
6981 with q.indent(2):
6982 q.breakable()
6983 q.text("xid = ");
6984 if self.xid != None:
6985 q.text("%#x" % self.xid)
6986 else:
6987 q.text('None')
6988 q.text(","); q.breakable()
6989 q.text("role = ");
6990 q.text("%#x" % self.role)
6991 q.text(","); q.breakable()
6992 q.text("reason = ");
6993 q.text("%#x" % self.reason)
6994 q.text(","); q.breakable()
6995 q.text("generation_id = ");
6996 q.text("%#x" % self.generation_id)
6997 q.breakable()
6998 q.text('}')
6999
7000bsn_header.subtypes[55] = bsn_role_status
7001
Rich Lane95f7fc92014-01-27 17:08:16 -08007002class bsn_set_aux_cxns_reply(bsn_header):
7003 version = 4
7004 type = 4
7005 experimenter = 6035143
7006 subtype = 59
7007
7008 def __init__(self, xid=None, num_aux=None, status=None):
7009 if xid != None:
7010 self.xid = xid
7011 else:
7012 self.xid = None
7013 if num_aux != None:
7014 self.num_aux = num_aux
7015 else:
7016 self.num_aux = 0
7017 if status != None:
7018 self.status = status
7019 else:
7020 self.status = 0
7021 return
7022
7023 def pack(self):
7024 packed = []
7025 packed.append(struct.pack("!B", self.version))
7026 packed.append(struct.pack("!B", self.type))
7027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7028 packed.append(struct.pack("!L", self.xid))
7029 packed.append(struct.pack("!L", self.experimenter))
7030 packed.append(struct.pack("!L", self.subtype))
7031 packed.append(struct.pack("!L", self.num_aux))
7032 packed.append(struct.pack("!L", self.status))
7033 length = sum([len(x) for x in packed])
7034 packed[2] = struct.pack("!H", length)
7035 return ''.join(packed)
7036
7037 @staticmethod
7038 def unpack(reader):
7039 obj = bsn_set_aux_cxns_reply()
7040 _version = reader.read("!B")[0]
7041 assert(_version == 4)
7042 _type = reader.read("!B")[0]
7043 assert(_type == 4)
7044 _length = reader.read("!H")[0]
7045 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007046 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007047 obj.xid = reader.read("!L")[0]
7048 _experimenter = reader.read("!L")[0]
7049 assert(_experimenter == 6035143)
7050 _subtype = reader.read("!L")[0]
7051 assert(_subtype == 59)
7052 obj.num_aux = reader.read("!L")[0]
7053 obj.status = reader.read("!L")[0]
7054 return obj
7055
7056 def __eq__(self, other):
7057 if type(self) != type(other): return False
7058 if self.xid != other.xid: return False
7059 if self.num_aux != other.num_aux: return False
7060 if self.status != other.status: return False
7061 return True
7062
7063 def pretty_print(self, q):
7064 q.text("bsn_set_aux_cxns_reply {")
7065 with q.group():
7066 with q.indent(2):
7067 q.breakable()
7068 q.text("xid = ");
7069 if self.xid != None:
7070 q.text("%#x" % self.xid)
7071 else:
7072 q.text('None')
7073 q.text(","); q.breakable()
7074 q.text("num_aux = ");
7075 q.text("%#x" % self.num_aux)
7076 q.text(","); q.breakable()
7077 q.text("status = ");
7078 q.text("%#x" % self.status)
7079 q.breakable()
7080 q.text('}')
7081
7082bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7083
7084class bsn_set_aux_cxns_request(bsn_header):
7085 version = 4
7086 type = 4
7087 experimenter = 6035143
7088 subtype = 58
7089
7090 def __init__(self, xid=None, num_aux=None):
7091 if xid != None:
7092 self.xid = xid
7093 else:
7094 self.xid = None
7095 if num_aux != None:
7096 self.num_aux = num_aux
7097 else:
7098 self.num_aux = 0
7099 return
7100
7101 def pack(self):
7102 packed = []
7103 packed.append(struct.pack("!B", self.version))
7104 packed.append(struct.pack("!B", self.type))
7105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7106 packed.append(struct.pack("!L", self.xid))
7107 packed.append(struct.pack("!L", self.experimenter))
7108 packed.append(struct.pack("!L", self.subtype))
7109 packed.append(struct.pack("!L", self.num_aux))
7110 length = sum([len(x) for x in packed])
7111 packed[2] = struct.pack("!H", length)
7112 return ''.join(packed)
7113
7114 @staticmethod
7115 def unpack(reader):
7116 obj = bsn_set_aux_cxns_request()
7117 _version = reader.read("!B")[0]
7118 assert(_version == 4)
7119 _type = reader.read("!B")[0]
7120 assert(_type == 4)
7121 _length = reader.read("!H")[0]
7122 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007123 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007124 obj.xid = reader.read("!L")[0]
7125 _experimenter = reader.read("!L")[0]
7126 assert(_experimenter == 6035143)
7127 _subtype = reader.read("!L")[0]
7128 assert(_subtype == 58)
7129 obj.num_aux = reader.read("!L")[0]
7130 return obj
7131
7132 def __eq__(self, other):
7133 if type(self) != type(other): return False
7134 if self.xid != other.xid: return False
7135 if self.num_aux != other.num_aux: return False
7136 return True
7137
7138 def pretty_print(self, q):
7139 q.text("bsn_set_aux_cxns_request {")
7140 with q.group():
7141 with q.indent(2):
7142 q.breakable()
7143 q.text("xid = ");
7144 if self.xid != None:
7145 q.text("%#x" % self.xid)
7146 else:
7147 q.text('None')
7148 q.text(","); q.breakable()
7149 q.text("num_aux = ");
7150 q.text("%#x" % self.num_aux)
7151 q.breakable()
7152 q.text('}')
7153
7154bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7155
Rich Lane7dcdf022013-12-11 14:45:27 -08007156class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007157 version = 4
7158 type = 4
7159 experimenter = 6035143
7160 subtype = 42
7161
7162 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007163 if xid != None:
7164 self.xid = xid
7165 else:
7166 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007167 if status != None:
7168 self.status = status
7169 else:
7170 self.status = 0
7171 if port_no != None:
7172 self.port_no = port_no
7173 else:
7174 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007175 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007176
7177 def pack(self):
7178 packed = []
7179 packed.append(struct.pack("!B", self.version))
7180 packed.append(struct.pack("!B", self.type))
7181 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7182 packed.append(struct.pack("!L", self.xid))
7183 packed.append(struct.pack("!L", self.experimenter))
7184 packed.append(struct.pack("!L", self.subtype))
7185 packed.append(struct.pack("!L", self.status))
7186 packed.append(util.pack_port_no(self.port_no))
7187 length = sum([len(x) for x in packed])
7188 packed[2] = struct.pack("!H", length)
7189 return ''.join(packed)
7190
7191 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007192 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007193 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007194 _version = reader.read("!B")[0]
7195 assert(_version == 4)
7196 _type = reader.read("!B")[0]
7197 assert(_type == 4)
7198 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007199 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007200 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007201 obj.xid = reader.read("!L")[0]
7202 _experimenter = reader.read("!L")[0]
7203 assert(_experimenter == 6035143)
7204 _subtype = reader.read("!L")[0]
7205 assert(_subtype == 42)
7206 obj.status = reader.read("!L")[0]
7207 obj.port_no = util.unpack_port_no(reader)
7208 return obj
7209
7210 def __eq__(self, other):
7211 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007212 if self.xid != other.xid: return False
7213 if self.status != other.status: return False
7214 if self.port_no != other.port_no: return False
7215 return True
7216
Rich Lane7b0f2012013-11-22 14:15:26 -08007217 def pretty_print(self, q):
7218 q.text("bsn_set_lacp_reply {")
7219 with q.group():
7220 with q.indent(2):
7221 q.breakable()
7222 q.text("xid = ");
7223 if self.xid != None:
7224 q.text("%#x" % self.xid)
7225 else:
7226 q.text('None')
7227 q.text(","); q.breakable()
7228 q.text("status = ");
7229 q.text("%#x" % self.status)
7230 q.text(","); q.breakable()
7231 q.text("port_no = ");
7232 q.text(util.pretty_port(self.port_no))
7233 q.breakable()
7234 q.text('}')
7235
Rich Lane7dcdf022013-12-11 14:45:27 -08007236bsn_header.subtypes[42] = bsn_set_lacp_reply
7237
7238class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007239 version = 4
7240 type = 4
7241 experimenter = 6035143
7242 subtype = 41
7243
7244 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 -08007245 if xid != None:
7246 self.xid = xid
7247 else:
7248 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007249 if enabled != None:
7250 self.enabled = enabled
7251 else:
7252 self.enabled = 0
7253 if port_no != None:
7254 self.port_no = port_no
7255 else:
7256 self.port_no = 0
7257 if actor_sys_priority != None:
7258 self.actor_sys_priority = actor_sys_priority
7259 else:
7260 self.actor_sys_priority = 0
7261 if actor_sys_mac != None:
7262 self.actor_sys_mac = actor_sys_mac
7263 else:
7264 self.actor_sys_mac = [0,0,0,0,0,0]
7265 if actor_port_priority != None:
7266 self.actor_port_priority = actor_port_priority
7267 else:
7268 self.actor_port_priority = 0
7269 if actor_port_num != None:
7270 self.actor_port_num = actor_port_num
7271 else:
7272 self.actor_port_num = 0
7273 if actor_key != None:
7274 self.actor_key = actor_key
7275 else:
7276 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007277 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007278
7279 def pack(self):
7280 packed = []
7281 packed.append(struct.pack("!B", self.version))
7282 packed.append(struct.pack("!B", self.type))
7283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7284 packed.append(struct.pack("!L", self.xid))
7285 packed.append(struct.pack("!L", self.experimenter))
7286 packed.append(struct.pack("!L", self.subtype))
7287 packed.append(struct.pack("!B", self.enabled))
7288 packed.append('\x00' * 3)
7289 packed.append(util.pack_port_no(self.port_no))
7290 packed.append(struct.pack("!H", self.actor_sys_priority))
7291 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7292 packed.append(struct.pack("!H", self.actor_port_priority))
7293 packed.append(struct.pack("!H", self.actor_port_num))
7294 packed.append(struct.pack("!H", self.actor_key))
7295 length = sum([len(x) for x in packed])
7296 packed[2] = struct.pack("!H", length)
7297 return ''.join(packed)
7298
7299 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007300 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007301 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007302 _version = reader.read("!B")[0]
7303 assert(_version == 4)
7304 _type = reader.read("!B")[0]
7305 assert(_type == 4)
7306 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007307 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007308 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007309 obj.xid = reader.read("!L")[0]
7310 _experimenter = reader.read("!L")[0]
7311 assert(_experimenter == 6035143)
7312 _subtype = reader.read("!L")[0]
7313 assert(_subtype == 41)
7314 obj.enabled = reader.read("!B")[0]
7315 reader.skip(3)
7316 obj.port_no = util.unpack_port_no(reader)
7317 obj.actor_sys_priority = reader.read("!H")[0]
7318 obj.actor_sys_mac = list(reader.read('!6B'))
7319 obj.actor_port_priority = reader.read("!H")[0]
7320 obj.actor_port_num = reader.read("!H")[0]
7321 obj.actor_key = reader.read("!H")[0]
7322 return obj
7323
7324 def __eq__(self, other):
7325 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007326 if self.xid != other.xid: return False
7327 if self.enabled != other.enabled: return False
7328 if self.port_no != other.port_no: return False
7329 if self.actor_sys_priority != other.actor_sys_priority: return False
7330 if self.actor_sys_mac != other.actor_sys_mac: return False
7331 if self.actor_port_priority != other.actor_port_priority: return False
7332 if self.actor_port_num != other.actor_port_num: return False
7333 if self.actor_key != other.actor_key: return False
7334 return True
7335
Rich Lane7b0f2012013-11-22 14:15:26 -08007336 def pretty_print(self, q):
7337 q.text("bsn_set_lacp_request {")
7338 with q.group():
7339 with q.indent(2):
7340 q.breakable()
7341 q.text("xid = ");
7342 if self.xid != None:
7343 q.text("%#x" % self.xid)
7344 else:
7345 q.text('None')
7346 q.text(","); q.breakable()
7347 q.text("enabled = ");
7348 q.text("%#x" % self.enabled)
7349 q.text(","); q.breakable()
7350 q.text("port_no = ");
7351 q.text(util.pretty_port(self.port_no))
7352 q.text(","); q.breakable()
7353 q.text("actor_sys_priority = ");
7354 q.text("%#x" % self.actor_sys_priority)
7355 q.text(","); q.breakable()
7356 q.text("actor_sys_mac = ");
7357 q.text(util.pretty_mac(self.actor_sys_mac))
7358 q.text(","); q.breakable()
7359 q.text("actor_port_priority = ");
7360 q.text("%#x" % self.actor_port_priority)
7361 q.text(","); q.breakable()
7362 q.text("actor_port_num = ");
7363 q.text("%#x" % self.actor_port_num)
7364 q.text(","); q.breakable()
7365 q.text("actor_key = ");
7366 q.text("%#x" % self.actor_key)
7367 q.breakable()
7368 q.text('}')
7369
Rich Lane7dcdf022013-12-11 14:45:27 -08007370bsn_header.subtypes[41] = bsn_set_lacp_request
7371
7372class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007373 version = 4
7374 type = 4
7375 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007376 subtype = 3
7377
7378 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007379 if xid != None:
7380 self.xid = xid
7381 else:
7382 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007383 if report_mirror_ports != None:
7384 self.report_mirror_ports = report_mirror_ports
7385 else:
7386 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007387 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007388
7389 def pack(self):
7390 packed = []
7391 packed.append(struct.pack("!B", self.version))
7392 packed.append(struct.pack("!B", self.type))
7393 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7394 packed.append(struct.pack("!L", self.xid))
7395 packed.append(struct.pack("!L", self.experimenter))
7396 packed.append(struct.pack("!L", self.subtype))
7397 packed.append(struct.pack("!B", self.report_mirror_ports))
7398 packed.append('\x00' * 3)
7399 length = sum([len(x) for x in packed])
7400 packed[2] = struct.pack("!H", length)
7401 return ''.join(packed)
7402
7403 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007404 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007405 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07007406 _version = reader.read("!B")[0]
7407 assert(_version == 4)
7408 _type = reader.read("!B")[0]
7409 assert(_type == 4)
7410 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007411 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007412 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007413 obj.xid = reader.read("!L")[0]
7414 _experimenter = reader.read("!L")[0]
7415 assert(_experimenter == 6035143)
7416 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007417 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07007418 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007419 reader.skip(3)
7420 return obj
7421
7422 def __eq__(self, other):
7423 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007424 if self.xid != other.xid: return False
7425 if self.report_mirror_ports != other.report_mirror_ports: return False
7426 return True
7427
Rich Lanec2ee4b82013-04-24 17:12:38 -07007428 def pretty_print(self, q):
7429 q.text("bsn_set_mirroring {")
7430 with q.group():
7431 with q.indent(2):
7432 q.breakable()
7433 q.text("xid = ");
7434 if self.xid != None:
7435 q.text("%#x" % self.xid)
7436 else:
7437 q.text('None')
7438 q.text(","); q.breakable()
7439 q.text("report_mirror_ports = ");
7440 q.text("%#x" % self.report_mirror_ports)
7441 q.breakable()
7442 q.text('}')
7443
Rich Lane7dcdf022013-12-11 14:45:27 -08007444bsn_header.subtypes[3] = bsn_set_mirroring
7445
7446class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007447 version = 4
7448 type = 4
7449 experimenter = 6035143
7450 subtype = 25
7451
7452 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007453 if xid != None:
7454 self.xid = xid
7455 else:
7456 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007457 if status != None:
7458 self.status = status
7459 else:
7460 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007461 return
Dan Talaycof6202252013-07-02 01:00:29 -07007462
7463 def pack(self):
7464 packed = []
7465 packed.append(struct.pack("!B", self.version))
7466 packed.append(struct.pack("!B", self.type))
7467 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7468 packed.append(struct.pack("!L", self.xid))
7469 packed.append(struct.pack("!L", self.experimenter))
7470 packed.append(struct.pack("!L", self.subtype))
7471 packed.append(struct.pack("!L", self.status))
7472 length = sum([len(x) for x in packed])
7473 packed[2] = struct.pack("!H", length)
7474 return ''.join(packed)
7475
7476 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007477 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007478 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007479 _version = reader.read("!B")[0]
7480 assert(_version == 4)
7481 _type = reader.read("!B")[0]
7482 assert(_type == 4)
7483 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007484 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007485 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007486 obj.xid = reader.read("!L")[0]
7487 _experimenter = reader.read("!L")[0]
7488 assert(_experimenter == 6035143)
7489 _subtype = reader.read("!L")[0]
7490 assert(_subtype == 25)
7491 obj.status = reader.read("!L")[0]
7492 return obj
7493
7494 def __eq__(self, other):
7495 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007496 if self.xid != other.xid: return False
7497 if self.status != other.status: return False
7498 return True
7499
Dan Talaycof6202252013-07-02 01:00:29 -07007500 def pretty_print(self, q):
7501 q.text("bsn_set_pktin_suppression_reply {")
7502 with q.group():
7503 with q.indent(2):
7504 q.breakable()
7505 q.text("xid = ");
7506 if self.xid != None:
7507 q.text("%#x" % self.xid)
7508 else:
7509 q.text('None')
7510 q.text(","); q.breakable()
7511 q.text("status = ");
7512 q.text("%#x" % self.status)
7513 q.breakable()
7514 q.text('}')
7515
Rich Lane7dcdf022013-12-11 14:45:27 -08007516bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7517
7518class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007519 version = 4
7520 type = 4
7521 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007522 subtype = 11
7523
7524 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007525 if xid != None:
7526 self.xid = xid
7527 else:
7528 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007529 if enabled != None:
7530 self.enabled = enabled
7531 else:
7532 self.enabled = 0
7533 if idle_timeout != None:
7534 self.idle_timeout = idle_timeout
7535 else:
7536 self.idle_timeout = 0
7537 if hard_timeout != None:
7538 self.hard_timeout = hard_timeout
7539 else:
7540 self.hard_timeout = 0
7541 if priority != None:
7542 self.priority = priority
7543 else:
7544 self.priority = 0
7545 if cookie != None:
7546 self.cookie = cookie
7547 else:
7548 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007549 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007550
7551 def pack(self):
7552 packed = []
7553 packed.append(struct.pack("!B", self.version))
7554 packed.append(struct.pack("!B", self.type))
7555 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7556 packed.append(struct.pack("!L", self.xid))
7557 packed.append(struct.pack("!L", self.experimenter))
7558 packed.append(struct.pack("!L", self.subtype))
7559 packed.append(struct.pack("!B", self.enabled))
7560 packed.append('\x00' * 1)
7561 packed.append(struct.pack("!H", self.idle_timeout))
7562 packed.append(struct.pack("!H", self.hard_timeout))
7563 packed.append(struct.pack("!H", self.priority))
7564 packed.append(struct.pack("!Q", self.cookie))
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):
Dan Talaycof6202252013-07-02 01:00:29 -07007571 obj = bsn_set_pktin_suppression_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 == 4)
7576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007577 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007578 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007579 obj.xid = reader.read("!L")[0]
7580 _experimenter = reader.read("!L")[0]
7581 assert(_experimenter == 6035143)
7582 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007583 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07007584 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007585 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07007586 obj.idle_timeout = reader.read("!H")[0]
7587 obj.hard_timeout = reader.read("!H")[0]
7588 obj.priority = reader.read("!H")[0]
7589 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007590 return obj
7591
7592 def __eq__(self, other):
7593 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007594 if self.xid != other.xid: return False
7595 if self.enabled != other.enabled: return False
7596 if self.idle_timeout != other.idle_timeout: return False
7597 if self.hard_timeout != other.hard_timeout: return False
7598 if self.priority != other.priority: return False
7599 if self.cookie != other.cookie: return False
7600 return True
7601
Rich Lanec2ee4b82013-04-24 17:12:38 -07007602 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07007603 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007604 with q.group():
7605 with q.indent(2):
7606 q.breakable()
7607 q.text("xid = ");
7608 if self.xid != None:
7609 q.text("%#x" % self.xid)
7610 else:
7611 q.text('None')
7612 q.text(","); q.breakable()
7613 q.text("enabled = ");
7614 q.text("%#x" % self.enabled)
7615 q.text(","); q.breakable()
7616 q.text("idle_timeout = ");
7617 q.text("%#x" % self.idle_timeout)
7618 q.text(","); q.breakable()
7619 q.text("hard_timeout = ");
7620 q.text("%#x" % self.hard_timeout)
7621 q.text(","); q.breakable()
7622 q.text("priority = ");
7623 q.text("%#x" % self.priority)
7624 q.text(","); q.breakable()
7625 q.text("cookie = ");
7626 q.text("%#x" % self.cookie)
7627 q.breakable()
7628 q.text('}')
7629
Rich Lane7dcdf022013-12-11 14:45:27 -08007630bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7631
7632class bsn_set_switch_pipeline_reply(bsn_header):
7633 version = 4
7634 type = 4
7635 experimenter = 6035143
7636 subtype = 54
7637
7638 def __init__(self, xid=None, status=None):
7639 if xid != None:
7640 self.xid = xid
7641 else:
7642 self.xid = None
7643 if status != None:
7644 self.status = status
7645 else:
7646 self.status = 0
7647 return
7648
7649 def pack(self):
7650 packed = []
7651 packed.append(struct.pack("!B", self.version))
7652 packed.append(struct.pack("!B", self.type))
7653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7654 packed.append(struct.pack("!L", self.xid))
7655 packed.append(struct.pack("!L", self.experimenter))
7656 packed.append(struct.pack("!L", self.subtype))
7657 packed.append(struct.pack("!L", self.status))
7658 length = sum([len(x) for x in packed])
7659 packed[2] = struct.pack("!H", length)
7660 return ''.join(packed)
7661
7662 @staticmethod
7663 def unpack(reader):
7664 obj = bsn_set_switch_pipeline_reply()
7665 _version = reader.read("!B")[0]
7666 assert(_version == 4)
7667 _type = reader.read("!B")[0]
7668 assert(_type == 4)
7669 _length = reader.read("!H")[0]
7670 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007671 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007672 obj.xid = reader.read("!L")[0]
7673 _experimenter = reader.read("!L")[0]
7674 assert(_experimenter == 6035143)
7675 _subtype = reader.read("!L")[0]
7676 assert(_subtype == 54)
7677 obj.status = reader.read("!L")[0]
7678 return obj
7679
7680 def __eq__(self, other):
7681 if type(self) != type(other): return False
7682 if self.xid != other.xid: return False
7683 if self.status != other.status: return False
7684 return True
7685
7686 def pretty_print(self, q):
7687 q.text("bsn_set_switch_pipeline_reply {")
7688 with q.group():
7689 with q.indent(2):
7690 q.breakable()
7691 q.text("xid = ");
7692 if self.xid != None:
7693 q.text("%#x" % self.xid)
7694 else:
7695 q.text('None')
7696 q.text(","); q.breakable()
7697 q.text("status = ");
7698 q.text("%#x" % self.status)
7699 q.breakable()
7700 q.text('}')
7701
7702bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7703
7704class bsn_set_switch_pipeline_request(bsn_header):
7705 version = 4
7706 type = 4
7707 experimenter = 6035143
7708 subtype = 53
7709
7710 def __init__(self, xid=None, pipeline=None):
7711 if xid != None:
7712 self.xid = xid
7713 else:
7714 self.xid = None
7715 if pipeline != None:
7716 self.pipeline = pipeline
7717 else:
7718 self.pipeline = ""
7719 return
7720
7721 def pack(self):
7722 packed = []
7723 packed.append(struct.pack("!B", self.version))
7724 packed.append(struct.pack("!B", self.type))
7725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7726 packed.append(struct.pack("!L", self.xid))
7727 packed.append(struct.pack("!L", self.experimenter))
7728 packed.append(struct.pack("!L", self.subtype))
7729 packed.append(struct.pack("!256s", self.pipeline))
7730 length = sum([len(x) for x in packed])
7731 packed[2] = struct.pack("!H", length)
7732 return ''.join(packed)
7733
7734 @staticmethod
7735 def unpack(reader):
7736 obj = bsn_set_switch_pipeline_request()
7737 _version = reader.read("!B")[0]
7738 assert(_version == 4)
7739 _type = reader.read("!B")[0]
7740 assert(_type == 4)
7741 _length = reader.read("!H")[0]
7742 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007743 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007744 obj.xid = reader.read("!L")[0]
7745 _experimenter = reader.read("!L")[0]
7746 assert(_experimenter == 6035143)
7747 _subtype = reader.read("!L")[0]
7748 assert(_subtype == 53)
7749 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7750 return obj
7751
7752 def __eq__(self, other):
7753 if type(self) != type(other): return False
7754 if self.xid != other.xid: return False
7755 if self.pipeline != other.pipeline: return False
7756 return True
7757
7758 def pretty_print(self, q):
7759 q.text("bsn_set_switch_pipeline_request {")
7760 with q.group():
7761 with q.indent(2):
7762 q.breakable()
7763 q.text("xid = ");
7764 if self.xid != None:
7765 q.text("%#x" % self.xid)
7766 else:
7767 q.text('None')
7768 q.text(","); q.breakable()
7769 q.text("pipeline = ");
7770 q.pp(self.pipeline)
7771 q.breakable()
7772 q.text('}')
7773
7774bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7775
7776class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7777 version = 4
7778 type = 19
7779 stats_type = 65535
7780 experimenter = 6035143
7781 subtype = 6
7782
7783 def __init__(self, xid=None, flags=None, entries=None):
7784 if xid != None:
7785 self.xid = xid
7786 else:
7787 self.xid = None
7788 if flags != None:
7789 self.flags = flags
7790 else:
7791 self.flags = 0
7792 if entries != None:
7793 self.entries = entries
7794 else:
7795 self.entries = []
7796 return
7797
7798 def pack(self):
7799 packed = []
7800 packed.append(struct.pack("!B", self.version))
7801 packed.append(struct.pack("!B", self.type))
7802 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7803 packed.append(struct.pack("!L", self.xid))
7804 packed.append(struct.pack("!H", self.stats_type))
7805 packed.append(struct.pack("!H", self.flags))
7806 packed.append('\x00' * 4)
7807 packed.append(struct.pack("!L", self.experimenter))
7808 packed.append(struct.pack("!L", self.subtype))
7809 packed.append(loxi.generic_util.pack_list(self.entries))
7810 length = sum([len(x) for x in packed])
7811 packed[2] = struct.pack("!H", length)
7812 return ''.join(packed)
7813
7814 @staticmethod
7815 def unpack(reader):
7816 obj = bsn_switch_pipeline_stats_reply()
7817 _version = reader.read("!B")[0]
7818 assert(_version == 4)
7819 _type = reader.read("!B")[0]
7820 assert(_type == 19)
7821 _length = reader.read("!H")[0]
7822 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007823 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007824 obj.xid = reader.read("!L")[0]
7825 _stats_type = reader.read("!H")[0]
7826 assert(_stats_type == 65535)
7827 obj.flags = reader.read("!H")[0]
7828 reader.skip(4)
7829 _experimenter = reader.read("!L")[0]
7830 assert(_experimenter == 6035143)
7831 _subtype = reader.read("!L")[0]
7832 assert(_subtype == 6)
7833 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
7834 return obj
7835
7836 def __eq__(self, other):
7837 if type(self) != type(other): return False
7838 if self.xid != other.xid: return False
7839 if self.flags != other.flags: return False
7840 if self.entries != other.entries: return False
7841 return True
7842
7843 def pretty_print(self, q):
7844 q.text("bsn_switch_pipeline_stats_reply {")
7845 with q.group():
7846 with q.indent(2):
7847 q.breakable()
7848 q.text("xid = ");
7849 if self.xid != None:
7850 q.text("%#x" % self.xid)
7851 else:
7852 q.text('None')
7853 q.text(","); q.breakable()
7854 q.text("flags = ");
7855 q.text("%#x" % self.flags)
7856 q.text(","); q.breakable()
7857 q.text("entries = ");
7858 q.pp(self.entries)
7859 q.breakable()
7860 q.text('}')
7861
7862bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
7863
7864class bsn_switch_pipeline_stats_request(bsn_stats_request):
7865 version = 4
7866 type = 18
7867 stats_type = 65535
7868 experimenter = 6035143
7869 subtype = 6
7870
7871 def __init__(self, xid=None, flags=None):
7872 if xid != None:
7873 self.xid = xid
7874 else:
7875 self.xid = None
7876 if flags != None:
7877 self.flags = flags
7878 else:
7879 self.flags = 0
7880 return
7881
7882 def pack(self):
7883 packed = []
7884 packed.append(struct.pack("!B", self.version))
7885 packed.append(struct.pack("!B", self.type))
7886 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7887 packed.append(struct.pack("!L", self.xid))
7888 packed.append(struct.pack("!H", self.stats_type))
7889 packed.append(struct.pack("!H", self.flags))
7890 packed.append('\x00' * 4)
7891 packed.append(struct.pack("!L", self.experimenter))
7892 packed.append(struct.pack("!L", self.subtype))
7893 length = sum([len(x) for x in packed])
7894 packed[2] = struct.pack("!H", length)
7895 return ''.join(packed)
7896
7897 @staticmethod
7898 def unpack(reader):
7899 obj = bsn_switch_pipeline_stats_request()
7900 _version = reader.read("!B")[0]
7901 assert(_version == 4)
7902 _type = reader.read("!B")[0]
7903 assert(_type == 18)
7904 _length = reader.read("!H")[0]
7905 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007906 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007907 obj.xid = reader.read("!L")[0]
7908 _stats_type = reader.read("!H")[0]
7909 assert(_stats_type == 65535)
7910 obj.flags = reader.read("!H")[0]
7911 reader.skip(4)
7912 _experimenter = reader.read("!L")[0]
7913 assert(_experimenter == 6035143)
7914 _subtype = reader.read("!L")[0]
7915 assert(_subtype == 6)
7916 return obj
7917
7918 def __eq__(self, other):
7919 if type(self) != type(other): return False
7920 if self.xid != other.xid: return False
7921 if self.flags != other.flags: return False
7922 return True
7923
7924 def pretty_print(self, q):
7925 q.text("bsn_switch_pipeline_stats_request {")
7926 with q.group():
7927 with q.indent(2):
7928 q.breakable()
7929 q.text("xid = ");
7930 if self.xid != None:
7931 q.text("%#x" % self.xid)
7932 else:
7933 q.text('None')
7934 q.text(","); q.breakable()
7935 q.text("flags = ");
7936 q.text("%#x" % self.flags)
7937 q.breakable()
7938 q.text('}')
7939
7940bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7941
Rich Lane9ec3fca2014-02-26 16:22:56 -08007942class bsn_table_checksum_stats_reply(bsn_stats_reply):
7943 version = 4
7944 type = 19
7945 stats_type = 65535
7946 experimenter = 6035143
7947 subtype = 11
7948
7949 def __init__(self, xid=None, flags=None, entries=None):
7950 if xid != None:
7951 self.xid = xid
7952 else:
7953 self.xid = None
7954 if flags != None:
7955 self.flags = flags
7956 else:
7957 self.flags = 0
7958 if entries != None:
7959 self.entries = entries
7960 else:
7961 self.entries = []
7962 return
7963
7964 def pack(self):
7965 packed = []
7966 packed.append(struct.pack("!B", self.version))
7967 packed.append(struct.pack("!B", self.type))
7968 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7969 packed.append(struct.pack("!L", self.xid))
7970 packed.append(struct.pack("!H", self.stats_type))
7971 packed.append(struct.pack("!H", self.flags))
7972 packed.append('\x00' * 4)
7973 packed.append(struct.pack("!L", self.experimenter))
7974 packed.append(struct.pack("!L", self.subtype))
7975 packed.append(loxi.generic_util.pack_list(self.entries))
7976 length = sum([len(x) for x in packed])
7977 packed[2] = struct.pack("!H", length)
7978 return ''.join(packed)
7979
7980 @staticmethod
7981 def unpack(reader):
7982 obj = bsn_table_checksum_stats_reply()
7983 _version = reader.read("!B")[0]
7984 assert(_version == 4)
7985 _type = reader.read("!B")[0]
7986 assert(_type == 19)
7987 _length = reader.read("!H")[0]
7988 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007989 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007990 obj.xid = reader.read("!L")[0]
7991 _stats_type = reader.read("!H")[0]
7992 assert(_stats_type == 65535)
7993 obj.flags = reader.read("!H")[0]
7994 reader.skip(4)
7995 _experimenter = reader.read("!L")[0]
7996 assert(_experimenter == 6035143)
7997 _subtype = reader.read("!L")[0]
7998 assert(_subtype == 11)
7999 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
8000 return obj
8001
8002 def __eq__(self, other):
8003 if type(self) != type(other): return False
8004 if self.xid != other.xid: return False
8005 if self.flags != other.flags: return False
8006 if self.entries != other.entries: return False
8007 return True
8008
8009 def pretty_print(self, q):
8010 q.text("bsn_table_checksum_stats_reply {")
8011 with q.group():
8012 with q.indent(2):
8013 q.breakable()
8014 q.text("xid = ");
8015 if self.xid != None:
8016 q.text("%#x" % self.xid)
8017 else:
8018 q.text('None')
8019 q.text(","); q.breakable()
8020 q.text("flags = ");
8021 q.text("%#x" % self.flags)
8022 q.text(","); q.breakable()
8023 q.text("entries = ");
8024 q.pp(self.entries)
8025 q.breakable()
8026 q.text('}')
8027
8028bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8029
8030class bsn_table_checksum_stats_request(bsn_stats_request):
8031 version = 4
8032 type = 18
8033 stats_type = 65535
8034 experimenter = 6035143
8035 subtype = 11
8036
8037 def __init__(self, xid=None, flags=None):
8038 if xid != None:
8039 self.xid = xid
8040 else:
8041 self.xid = None
8042 if flags != None:
8043 self.flags = flags
8044 else:
8045 self.flags = 0
8046 return
8047
8048 def pack(self):
8049 packed = []
8050 packed.append(struct.pack("!B", self.version))
8051 packed.append(struct.pack("!B", self.type))
8052 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8053 packed.append(struct.pack("!L", self.xid))
8054 packed.append(struct.pack("!H", self.stats_type))
8055 packed.append(struct.pack("!H", self.flags))
8056 packed.append('\x00' * 4)
8057 packed.append(struct.pack("!L", self.experimenter))
8058 packed.append(struct.pack("!L", self.subtype))
8059 length = sum([len(x) for x in packed])
8060 packed[2] = struct.pack("!H", length)
8061 return ''.join(packed)
8062
8063 @staticmethod
8064 def unpack(reader):
8065 obj = bsn_table_checksum_stats_request()
8066 _version = reader.read("!B")[0]
8067 assert(_version == 4)
8068 _type = reader.read("!B")[0]
8069 assert(_type == 18)
8070 _length = reader.read("!H")[0]
8071 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008072 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008073 obj.xid = reader.read("!L")[0]
8074 _stats_type = reader.read("!H")[0]
8075 assert(_stats_type == 65535)
8076 obj.flags = reader.read("!H")[0]
8077 reader.skip(4)
8078 _experimenter = reader.read("!L")[0]
8079 assert(_experimenter == 6035143)
8080 _subtype = reader.read("!L")[0]
8081 assert(_subtype == 11)
8082 return obj
8083
8084 def __eq__(self, other):
8085 if type(self) != type(other): return False
8086 if self.xid != other.xid: return False
8087 if self.flags != other.flags: return False
8088 return True
8089
8090 def pretty_print(self, q):
8091 q.text("bsn_table_checksum_stats_request {")
8092 with q.group():
8093 with q.indent(2):
8094 q.breakable()
8095 q.text("xid = ");
8096 if self.xid != None:
8097 q.text("%#x" % self.xid)
8098 else:
8099 q.text('None')
8100 q.text(","); q.breakable()
8101 q.text("flags = ");
8102 q.text("%#x" % self.flags)
8103 q.breakable()
8104 q.text('}')
8105
8106bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8107
8108class bsn_table_set_buckets_size(bsn_header):
8109 version = 4
8110 type = 4
8111 experimenter = 6035143
8112 subtype = 61
8113
8114 def __init__(self, xid=None, table_id=None, buckets_size=None):
8115 if xid != None:
8116 self.xid = xid
8117 else:
8118 self.xid = None
8119 if table_id != None:
8120 self.table_id = table_id
8121 else:
8122 self.table_id = 0
8123 if buckets_size != None:
8124 self.buckets_size = buckets_size
8125 else:
8126 self.buckets_size = 0
8127 return
8128
8129 def pack(self):
8130 packed = []
8131 packed.append(struct.pack("!B", self.version))
8132 packed.append(struct.pack("!B", self.type))
8133 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8134 packed.append(struct.pack("!L", self.xid))
8135 packed.append(struct.pack("!L", self.experimenter))
8136 packed.append(struct.pack("!L", self.subtype))
Rich Lane5587ab12014-06-30 11:19:09 -07008137 packed.append('\x00' * 1)
8138 packed.append(struct.pack("!B", self.table_id))
Rich Lane9ec3fca2014-02-26 16:22:56 -08008139 packed.append('\x00' * 2)
8140 packed.append(struct.pack("!L", self.buckets_size))
8141 length = sum([len(x) for x in packed])
8142 packed[2] = struct.pack("!H", length)
8143 return ''.join(packed)
8144
8145 @staticmethod
8146 def unpack(reader):
8147 obj = bsn_table_set_buckets_size()
8148 _version = reader.read("!B")[0]
8149 assert(_version == 4)
8150 _type = reader.read("!B")[0]
8151 assert(_type == 4)
8152 _length = reader.read("!H")[0]
8153 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008154 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008155 obj.xid = reader.read("!L")[0]
8156 _experimenter = reader.read("!L")[0]
8157 assert(_experimenter == 6035143)
8158 _subtype = reader.read("!L")[0]
8159 assert(_subtype == 61)
Rich Lane5587ab12014-06-30 11:19:09 -07008160 reader.skip(1)
8161 obj.table_id = reader.read("!B")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08008162 reader.skip(2)
8163 obj.buckets_size = reader.read("!L")[0]
8164 return obj
8165
8166 def __eq__(self, other):
8167 if type(self) != type(other): return False
8168 if self.xid != other.xid: return False
8169 if self.table_id != other.table_id: return False
8170 if self.buckets_size != other.buckets_size: return False
8171 return True
8172
8173 def pretty_print(self, q):
8174 q.text("bsn_table_set_buckets_size {")
8175 with q.group():
8176 with q.indent(2):
8177 q.breakable()
8178 q.text("xid = ");
8179 if self.xid != None:
8180 q.text("%#x" % self.xid)
8181 else:
8182 q.text('None')
8183 q.text(","); q.breakable()
8184 q.text("table_id = ");
8185 q.text("%#x" % self.table_id)
8186 q.text(","); q.breakable()
8187 q.text("buckets_size = ");
8188 q.text("%#x" % self.buckets_size)
8189 q.breakable()
8190 q.text('}')
8191
8192bsn_header.subtypes[61] = bsn_table_set_buckets_size
8193
Rich Lane7dcdf022013-12-11 14:45:27 -08008194class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008195 version = 4
8196 type = 4
8197 experimenter = 6035143
8198 subtype = 45
8199
8200 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008201 if xid != None:
8202 self.xid = xid
8203 else:
8204 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08008205 if time_ms != None:
8206 self.time_ms = time_ms
8207 else:
8208 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008209 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008210
8211 def pack(self):
8212 packed = []
8213 packed.append(struct.pack("!B", self.version))
8214 packed.append(struct.pack("!B", self.type))
8215 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8216 packed.append(struct.pack("!L", self.xid))
8217 packed.append(struct.pack("!L", self.experimenter))
8218 packed.append(struct.pack("!L", self.subtype))
8219 packed.append(struct.pack("!Q", self.time_ms))
8220 length = sum([len(x) for x in packed])
8221 packed[2] = struct.pack("!H", length)
8222 return ''.join(packed)
8223
8224 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008225 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008226 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08008227 _version = reader.read("!B")[0]
8228 assert(_version == 4)
8229 _type = reader.read("!B")[0]
8230 assert(_type == 4)
8231 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008232 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008233 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008234 obj.xid = reader.read("!L")[0]
8235 _experimenter = reader.read("!L")[0]
8236 assert(_experimenter == 6035143)
8237 _subtype = reader.read("!L")[0]
8238 assert(_subtype == 45)
8239 obj.time_ms = reader.read("!Q")[0]
8240 return obj
8241
8242 def __eq__(self, other):
8243 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008244 if self.xid != other.xid: return False
8245 if self.time_ms != other.time_ms: return False
8246 return True
8247
Rich Lane7b0f2012013-11-22 14:15:26 -08008248 def pretty_print(self, q):
8249 q.text("bsn_time_reply {")
8250 with q.group():
8251 with q.indent(2):
8252 q.breakable()
8253 q.text("xid = ");
8254 if self.xid != None:
8255 q.text("%#x" % self.xid)
8256 else:
8257 q.text('None')
8258 q.text(","); q.breakable()
8259 q.text("time_ms = ");
8260 q.text("%#x" % self.time_ms)
8261 q.breakable()
8262 q.text('}')
8263
Rich Lane7dcdf022013-12-11 14:45:27 -08008264bsn_header.subtypes[45] = bsn_time_reply
8265
8266class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008267 version = 4
8268 type = 4
8269 experimenter = 6035143
8270 subtype = 44
8271
8272 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008273 if xid != None:
8274 self.xid = xid
8275 else:
8276 self.xid = None
8277 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008278
8279 def pack(self):
8280 packed = []
8281 packed.append(struct.pack("!B", self.version))
8282 packed.append(struct.pack("!B", self.type))
8283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8284 packed.append(struct.pack("!L", self.xid))
8285 packed.append(struct.pack("!L", self.experimenter))
8286 packed.append(struct.pack("!L", self.subtype))
8287 length = sum([len(x) for x in packed])
8288 packed[2] = struct.pack("!H", length)
8289 return ''.join(packed)
8290
8291 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008292 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008293 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08008294 _version = reader.read("!B")[0]
8295 assert(_version == 4)
8296 _type = reader.read("!B")[0]
8297 assert(_type == 4)
8298 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008299 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008300 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008301 obj.xid = reader.read("!L")[0]
8302 _experimenter = reader.read("!L")[0]
8303 assert(_experimenter == 6035143)
8304 _subtype = reader.read("!L")[0]
8305 assert(_subtype == 44)
8306 return obj
8307
8308 def __eq__(self, other):
8309 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008310 if self.xid != other.xid: return False
8311 return True
8312
Rich Lane7b0f2012013-11-22 14:15:26 -08008313 def pretty_print(self, q):
8314 q.text("bsn_time_request {")
8315 with q.group():
8316 with q.indent(2):
8317 q.breakable()
8318 q.text("xid = ");
8319 if self.xid != None:
8320 q.text("%#x" % self.xid)
8321 else:
8322 q.text('None')
8323 q.breakable()
8324 q.text('}')
8325
Rich Lane7dcdf022013-12-11 14:45:27 -08008326bsn_header.subtypes[44] = bsn_time_request
8327
8328class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008329 version = 4
8330 type = 4
8331 experimenter = 6035143
8332 subtype = 16
8333
8334 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008335 if xid != None:
8336 self.xid = xid
8337 else:
8338 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008339 if status != None:
8340 self.status = status
8341 else:
8342 self.status = 0
8343 if vport_no != None:
8344 self.vport_no = vport_no
8345 else:
8346 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008347 return
Dan Talaycof6202252013-07-02 01:00:29 -07008348
8349 def pack(self):
8350 packed = []
8351 packed.append(struct.pack("!B", self.version))
8352 packed.append(struct.pack("!B", self.type))
8353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8354 packed.append(struct.pack("!L", self.xid))
8355 packed.append(struct.pack("!L", self.experimenter))
8356 packed.append(struct.pack("!L", self.subtype))
8357 packed.append(struct.pack("!L", self.status))
8358 packed.append(struct.pack("!L", self.vport_no))
8359 length = sum([len(x) for x in packed])
8360 packed[2] = struct.pack("!H", length)
8361 return ''.join(packed)
8362
8363 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008364 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008365 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008366 _version = reader.read("!B")[0]
8367 assert(_version == 4)
8368 _type = reader.read("!B")[0]
8369 assert(_type == 4)
8370 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008371 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008372 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008373 obj.xid = reader.read("!L")[0]
8374 _experimenter = reader.read("!L")[0]
8375 assert(_experimenter == 6035143)
8376 _subtype = reader.read("!L")[0]
8377 assert(_subtype == 16)
8378 obj.status = reader.read("!L")[0]
8379 obj.vport_no = reader.read("!L")[0]
8380 return obj
8381
8382 def __eq__(self, other):
8383 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008384 if self.xid != other.xid: return False
8385 if self.status != other.status: return False
8386 if self.vport_no != other.vport_no: return False
8387 return True
8388
Dan Talaycof6202252013-07-02 01:00:29 -07008389 def pretty_print(self, q):
8390 q.text("bsn_virtual_port_create_reply {")
8391 with q.group():
8392 with q.indent(2):
8393 q.breakable()
8394 q.text("xid = ");
8395 if self.xid != None:
8396 q.text("%#x" % self.xid)
8397 else:
8398 q.text('None')
8399 q.text(","); q.breakable()
8400 q.text("status = ");
8401 q.text("%#x" % self.status)
8402 q.text(","); q.breakable()
8403 q.text("vport_no = ");
8404 q.text("%#x" % self.vport_no)
8405 q.breakable()
8406 q.text('}')
8407
Rich Lane7dcdf022013-12-11 14:45:27 -08008408bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8409
8410class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008411 version = 4
8412 type = 4
8413 experimenter = 6035143
8414 subtype = 15
8415
8416 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008417 if xid != None:
8418 self.xid = xid
8419 else:
8420 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008421 if vport != None:
8422 self.vport = vport
8423 else:
Rich Lane93b33132014-04-21 12:20:58 -07008424 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08008425 return
Dan Talaycof6202252013-07-02 01:00:29 -07008426
8427 def pack(self):
8428 packed = []
8429 packed.append(struct.pack("!B", self.version))
8430 packed.append(struct.pack("!B", self.type))
8431 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8432 packed.append(struct.pack("!L", self.xid))
8433 packed.append(struct.pack("!L", self.experimenter))
8434 packed.append(struct.pack("!L", self.subtype))
8435 packed.append(self.vport.pack())
8436 length = sum([len(x) for x in packed])
8437 packed[2] = struct.pack("!H", length)
8438 return ''.join(packed)
8439
8440 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008441 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008442 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008443 _version = reader.read("!B")[0]
8444 assert(_version == 4)
8445 _type = reader.read("!B")[0]
8446 assert(_type == 4)
8447 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008448 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008449 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008450 obj.xid = reader.read("!L")[0]
8451 _experimenter = reader.read("!L")[0]
8452 assert(_experimenter == 6035143)
8453 _subtype = reader.read("!L")[0]
8454 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07008455 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07008456 return obj
8457
8458 def __eq__(self, other):
8459 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008460 if self.xid != other.xid: return False
8461 if self.vport != other.vport: return False
8462 return True
8463
Dan Talaycof6202252013-07-02 01:00:29 -07008464 def pretty_print(self, q):
8465 q.text("bsn_virtual_port_create_request {")
8466 with q.group():
8467 with q.indent(2):
8468 q.breakable()
8469 q.text("xid = ");
8470 if self.xid != None:
8471 q.text("%#x" % self.xid)
8472 else:
8473 q.text('None')
8474 q.text(","); q.breakable()
8475 q.text("vport = ");
8476 q.pp(self.vport)
8477 q.breakable()
8478 q.text('}')
8479
Rich Lane7dcdf022013-12-11 14:45:27 -08008480bsn_header.subtypes[15] = bsn_virtual_port_create_request
8481
8482class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008483 version = 4
8484 type = 4
8485 experimenter = 6035143
8486 subtype = 26
8487
8488 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008489 if xid != None:
8490 self.xid = xid
8491 else:
8492 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008493 if status != None:
8494 self.status = status
8495 else:
8496 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008497 return
Dan Talaycof6202252013-07-02 01:00:29 -07008498
8499 def pack(self):
8500 packed = []
8501 packed.append(struct.pack("!B", self.version))
8502 packed.append(struct.pack("!B", self.type))
8503 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8504 packed.append(struct.pack("!L", self.xid))
8505 packed.append(struct.pack("!L", self.experimenter))
8506 packed.append(struct.pack("!L", self.subtype))
8507 packed.append(struct.pack("!L", self.status))
8508 length = sum([len(x) for x in packed])
8509 packed[2] = struct.pack("!H", length)
8510 return ''.join(packed)
8511
8512 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008513 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008514 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008515 _version = reader.read("!B")[0]
8516 assert(_version == 4)
8517 _type = reader.read("!B")[0]
8518 assert(_type == 4)
8519 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008520 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008521 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008522 obj.xid = reader.read("!L")[0]
8523 _experimenter = reader.read("!L")[0]
8524 assert(_experimenter == 6035143)
8525 _subtype = reader.read("!L")[0]
8526 assert(_subtype == 26)
8527 obj.status = reader.read("!L")[0]
8528 return obj
8529
8530 def __eq__(self, other):
8531 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008532 if self.xid != other.xid: return False
8533 if self.status != other.status: return False
8534 return True
8535
Dan Talaycof6202252013-07-02 01:00:29 -07008536 def pretty_print(self, q):
8537 q.text("bsn_virtual_port_remove_reply {")
8538 with q.group():
8539 with q.indent(2):
8540 q.breakable()
8541 q.text("xid = ");
8542 if self.xid != None:
8543 q.text("%#x" % self.xid)
8544 else:
8545 q.text('None')
8546 q.text(","); q.breakable()
8547 q.text("status = ");
8548 q.text("%#x" % self.status)
8549 q.breakable()
8550 q.text('}')
8551
Rich Lane7dcdf022013-12-11 14:45:27 -08008552bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8553
8554class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008555 version = 4
8556 type = 4
8557 experimenter = 6035143
8558 subtype = 17
8559
8560 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008561 if xid != None:
8562 self.xid = xid
8563 else:
8564 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008565 if vport_no != None:
8566 self.vport_no = vport_no
8567 else:
8568 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008569 return
Dan Talaycof6202252013-07-02 01:00:29 -07008570
8571 def pack(self):
8572 packed = []
8573 packed.append(struct.pack("!B", self.version))
8574 packed.append(struct.pack("!B", self.type))
8575 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8576 packed.append(struct.pack("!L", self.xid))
8577 packed.append(struct.pack("!L", self.experimenter))
8578 packed.append(struct.pack("!L", self.subtype))
8579 packed.append(struct.pack("!L", self.vport_no))
8580 length = sum([len(x) for x in packed])
8581 packed[2] = struct.pack("!H", length)
8582 return ''.join(packed)
8583
8584 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008585 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008586 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008587 _version = reader.read("!B")[0]
8588 assert(_version == 4)
8589 _type = reader.read("!B")[0]
8590 assert(_type == 4)
8591 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008592 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008593 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008594 obj.xid = reader.read("!L")[0]
8595 _experimenter = reader.read("!L")[0]
8596 assert(_experimenter == 6035143)
8597 _subtype = reader.read("!L")[0]
8598 assert(_subtype == 17)
8599 obj.vport_no = reader.read("!L")[0]
8600 return obj
8601
8602 def __eq__(self, other):
8603 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008604 if self.xid != other.xid: return False
8605 if self.vport_no != other.vport_no: return False
8606 return True
8607
Dan Talaycof6202252013-07-02 01:00:29 -07008608 def pretty_print(self, q):
8609 q.text("bsn_virtual_port_remove_request {")
8610 with q.group():
8611 with q.indent(2):
8612 q.breakable()
8613 q.text("xid = ");
8614 if self.xid != None:
8615 q.text("%#x" % self.xid)
8616 else:
8617 q.text('None')
8618 q.text(","); q.breakable()
8619 q.text("vport_no = ");
8620 q.text("%#x" % self.vport_no)
8621 q.breakable()
8622 q.text('}')
8623
Rich Lane7dcdf022013-12-11 14:45:27 -08008624bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8625
8626class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8627 version = 4
8628 type = 19
8629 stats_type = 65535
8630 experimenter = 6035143
8631 subtype = 9
8632
8633 def __init__(self, xid=None, flags=None, entries=None):
8634 if xid != None:
8635 self.xid = xid
8636 else:
8637 self.xid = None
8638 if flags != None:
8639 self.flags = flags
8640 else:
8641 self.flags = 0
8642 if entries != None:
8643 self.entries = entries
8644 else:
8645 self.entries = []
8646 return
8647
8648 def pack(self):
8649 packed = []
8650 packed.append(struct.pack("!B", self.version))
8651 packed.append(struct.pack("!B", self.type))
8652 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8653 packed.append(struct.pack("!L", self.xid))
8654 packed.append(struct.pack("!H", self.stats_type))
8655 packed.append(struct.pack("!H", self.flags))
8656 packed.append('\x00' * 4)
8657 packed.append(struct.pack("!L", self.experimenter))
8658 packed.append(struct.pack("!L", self.subtype))
8659 packed.append(loxi.generic_util.pack_list(self.entries))
8660 length = sum([len(x) for x in packed])
8661 packed[2] = struct.pack("!H", length)
8662 return ''.join(packed)
8663
8664 @staticmethod
8665 def unpack(reader):
8666 obj = bsn_vlan_counter_stats_reply()
8667 _version = reader.read("!B")[0]
8668 assert(_version == 4)
8669 _type = reader.read("!B")[0]
8670 assert(_type == 19)
8671 _length = reader.read("!H")[0]
8672 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008673 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008674 obj.xid = reader.read("!L")[0]
8675 _stats_type = reader.read("!H")[0]
8676 assert(_stats_type == 65535)
8677 obj.flags = reader.read("!H")[0]
8678 reader.skip(4)
8679 _experimenter = reader.read("!L")[0]
8680 assert(_experimenter == 6035143)
8681 _subtype = reader.read("!L")[0]
8682 assert(_subtype == 9)
8683 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8684 return obj
8685
8686 def __eq__(self, other):
8687 if type(self) != type(other): return False
8688 if self.xid != other.xid: return False
8689 if self.flags != other.flags: return False
8690 if self.entries != other.entries: return False
8691 return True
8692
8693 def pretty_print(self, q):
8694 q.text("bsn_vlan_counter_stats_reply {")
8695 with q.group():
8696 with q.indent(2):
8697 q.breakable()
8698 q.text("xid = ");
8699 if self.xid != None:
8700 q.text("%#x" % self.xid)
8701 else:
8702 q.text('None')
8703 q.text(","); q.breakable()
8704 q.text("flags = ");
8705 q.text("%#x" % self.flags)
8706 q.text(","); q.breakable()
8707 q.text("entries = ");
8708 q.pp(self.entries)
8709 q.breakable()
8710 q.text('}')
8711
8712bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8713
8714class bsn_vlan_counter_stats_request(bsn_stats_request):
8715 version = 4
8716 type = 18
8717 stats_type = 65535
8718 experimenter = 6035143
8719 subtype = 9
8720
8721 def __init__(self, xid=None, flags=None, vlan_vid=None):
8722 if xid != None:
8723 self.xid = xid
8724 else:
8725 self.xid = None
8726 if flags != None:
8727 self.flags = flags
8728 else:
8729 self.flags = 0
8730 if vlan_vid != None:
8731 self.vlan_vid = vlan_vid
8732 else:
8733 self.vlan_vid = 0
8734 return
8735
8736 def pack(self):
8737 packed = []
8738 packed.append(struct.pack("!B", self.version))
8739 packed.append(struct.pack("!B", self.type))
8740 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8741 packed.append(struct.pack("!L", self.xid))
8742 packed.append(struct.pack("!H", self.stats_type))
8743 packed.append(struct.pack("!H", self.flags))
8744 packed.append('\x00' * 4)
8745 packed.append(struct.pack("!L", self.experimenter))
8746 packed.append(struct.pack("!L", self.subtype))
8747 packed.append(struct.pack("!H", self.vlan_vid))
8748 length = sum([len(x) for x in packed])
8749 packed[2] = struct.pack("!H", length)
8750 return ''.join(packed)
8751
8752 @staticmethod
8753 def unpack(reader):
8754 obj = bsn_vlan_counter_stats_request()
8755 _version = reader.read("!B")[0]
8756 assert(_version == 4)
8757 _type = reader.read("!B")[0]
8758 assert(_type == 18)
8759 _length = reader.read("!H")[0]
8760 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008761 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008762 obj.xid = reader.read("!L")[0]
8763 _stats_type = reader.read("!H")[0]
8764 assert(_stats_type == 65535)
8765 obj.flags = reader.read("!H")[0]
8766 reader.skip(4)
8767 _experimenter = reader.read("!L")[0]
8768 assert(_experimenter == 6035143)
8769 _subtype = reader.read("!L")[0]
8770 assert(_subtype == 9)
8771 obj.vlan_vid = reader.read("!H")[0]
8772 return obj
8773
8774 def __eq__(self, other):
8775 if type(self) != type(other): return False
8776 if self.xid != other.xid: return False
8777 if self.flags != other.flags: return False
8778 if self.vlan_vid != other.vlan_vid: return False
8779 return True
8780
8781 def pretty_print(self, q):
8782 q.text("bsn_vlan_counter_stats_request {")
8783 with q.group():
8784 with q.indent(2):
8785 q.breakable()
8786 q.text("xid = ");
8787 if self.xid != None:
8788 q.text("%#x" % self.xid)
8789 else:
8790 q.text('None')
8791 q.text(","); q.breakable()
8792 q.text("flags = ");
8793 q.text("%#x" % self.flags)
8794 q.text(","); q.breakable()
8795 q.text("vlan_vid = ");
8796 q.text("%#x" % self.vlan_vid)
8797 q.breakable()
8798 q.text('}')
8799
8800bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8801
Rich Lane5587ab12014-06-30 11:19:09 -07008802class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8803 version = 4
8804 type = 19
8805 stats_type = 65535
8806 experimenter = 6035143
8807 subtype = 15
8808
8809 def __init__(self, xid=None, flags=None, entries=None):
8810 if xid != None:
8811 self.xid = xid
8812 else:
8813 self.xid = None
8814 if flags != None:
8815 self.flags = flags
8816 else:
8817 self.flags = 0
8818 if entries != None:
8819 self.entries = entries
8820 else:
8821 self.entries = []
8822 return
8823
8824 def pack(self):
8825 packed = []
8826 packed.append(struct.pack("!B", self.version))
8827 packed.append(struct.pack("!B", self.type))
8828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8829 packed.append(struct.pack("!L", self.xid))
8830 packed.append(struct.pack("!H", self.stats_type))
8831 packed.append(struct.pack("!H", self.flags))
8832 packed.append('\x00' * 4)
8833 packed.append(struct.pack("!L", self.experimenter))
8834 packed.append(struct.pack("!L", self.subtype))
8835 packed.append(loxi.generic_util.pack_list(self.entries))
8836 length = sum([len(x) for x in packed])
8837 packed[2] = struct.pack("!H", length)
8838 return ''.join(packed)
8839
8840 @staticmethod
8841 def unpack(reader):
8842 obj = bsn_vrf_counter_stats_reply()
8843 _version = reader.read("!B")[0]
8844 assert(_version == 4)
8845 _type = reader.read("!B")[0]
8846 assert(_type == 19)
8847 _length = reader.read("!H")[0]
8848 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008849 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008850 obj.xid = reader.read("!L")[0]
8851 _stats_type = reader.read("!H")[0]
8852 assert(_stats_type == 65535)
8853 obj.flags = reader.read("!H")[0]
8854 reader.skip(4)
8855 _experimenter = reader.read("!L")[0]
8856 assert(_experimenter == 6035143)
8857 _subtype = reader.read("!L")[0]
8858 assert(_subtype == 15)
8859 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8860 return obj
8861
8862 def __eq__(self, other):
8863 if type(self) != type(other): return False
8864 if self.xid != other.xid: return False
8865 if self.flags != other.flags: return False
8866 if self.entries != other.entries: return False
8867 return True
8868
8869 def pretty_print(self, q):
8870 q.text("bsn_vrf_counter_stats_reply {")
8871 with q.group():
8872 with q.indent(2):
8873 q.breakable()
8874 q.text("xid = ");
8875 if self.xid != None:
8876 q.text("%#x" % self.xid)
8877 else:
8878 q.text('None')
8879 q.text(","); q.breakable()
8880 q.text("flags = ");
8881 q.text("%#x" % self.flags)
8882 q.text(","); q.breakable()
8883 q.text("entries = ");
8884 q.pp(self.entries)
8885 q.breakable()
8886 q.text('}')
8887
8888bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8889
8890class bsn_vrf_counter_stats_request(bsn_stats_request):
8891 version = 4
8892 type = 18
8893 stats_type = 65535
8894 experimenter = 6035143
8895 subtype = 15
8896
8897 def __init__(self, xid=None, flags=None, vrf=None):
8898 if xid != None:
8899 self.xid = xid
8900 else:
8901 self.xid = None
8902 if flags != None:
8903 self.flags = flags
8904 else:
8905 self.flags = 0
8906 if vrf != None:
8907 self.vrf = vrf
8908 else:
8909 self.vrf = 0
8910 return
8911
8912 def pack(self):
8913 packed = []
8914 packed.append(struct.pack("!B", self.version))
8915 packed.append(struct.pack("!B", self.type))
8916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8917 packed.append(struct.pack("!L", self.xid))
8918 packed.append(struct.pack("!H", self.stats_type))
8919 packed.append(struct.pack("!H", self.flags))
8920 packed.append('\x00' * 4)
8921 packed.append(struct.pack("!L", self.experimenter))
8922 packed.append(struct.pack("!L", self.subtype))
8923 packed.append(struct.pack("!L", self.vrf))
8924 length = sum([len(x) for x in packed])
8925 packed[2] = struct.pack("!H", length)
8926 return ''.join(packed)
8927
8928 @staticmethod
8929 def unpack(reader):
8930 obj = bsn_vrf_counter_stats_request()
8931 _version = reader.read("!B")[0]
8932 assert(_version == 4)
8933 _type = reader.read("!B")[0]
8934 assert(_type == 18)
8935 _length = reader.read("!H")[0]
8936 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008937 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008938 obj.xid = reader.read("!L")[0]
8939 _stats_type = reader.read("!H")[0]
8940 assert(_stats_type == 65535)
8941 obj.flags = reader.read("!H")[0]
8942 reader.skip(4)
8943 _experimenter = reader.read("!L")[0]
8944 assert(_experimenter == 6035143)
8945 _subtype = reader.read("!L")[0]
8946 assert(_subtype == 15)
8947 obj.vrf = reader.read("!L")[0]
8948 return obj
8949
8950 def __eq__(self, other):
8951 if type(self) != type(other): return False
8952 if self.xid != other.xid: return False
8953 if self.flags != other.flags: return False
8954 if self.vrf != other.vrf: return False
8955 return True
8956
8957 def pretty_print(self, q):
8958 q.text("bsn_vrf_counter_stats_request {")
8959 with q.group():
8960 with q.indent(2):
8961 q.breakable()
8962 q.text("xid = ");
8963 if self.xid != None:
8964 q.text("%#x" % self.xid)
8965 else:
8966 q.text('None')
8967 q.text(","); q.breakable()
8968 q.text("flags = ");
8969 q.text("%#x" % self.flags)
8970 q.text(","); q.breakable()
8971 q.text("vrf = ");
8972 q.text("%#x" % self.vrf)
8973 q.breakable()
8974 q.text('}')
8975
8976bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8977
Rich Lane7dcdf022013-12-11 14:45:27 -08008978class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008979 version = 4
8980 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008981 stats_type = 0
8982
8983 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 -08008984 if xid != None:
8985 self.xid = xid
8986 else:
8987 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008988 if flags != None:
8989 self.flags = flags
8990 else:
8991 self.flags = 0
8992 if mfr_desc != None:
8993 self.mfr_desc = mfr_desc
8994 else:
8995 self.mfr_desc = ""
8996 if hw_desc != None:
8997 self.hw_desc = hw_desc
8998 else:
8999 self.hw_desc = ""
9000 if sw_desc != None:
9001 self.sw_desc = sw_desc
9002 else:
9003 self.sw_desc = ""
9004 if serial_num != None:
9005 self.serial_num = serial_num
9006 else:
9007 self.serial_num = ""
9008 if dp_desc != None:
9009 self.dp_desc = dp_desc
9010 else:
9011 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08009012 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009013
9014 def pack(self):
9015 packed = []
9016 packed.append(struct.pack("!B", self.version))
9017 packed.append(struct.pack("!B", self.type))
9018 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9019 packed.append(struct.pack("!L", self.xid))
9020 packed.append(struct.pack("!H", self.stats_type))
9021 packed.append(struct.pack("!H", self.flags))
9022 packed.append('\x00' * 4)
9023 packed.append(struct.pack("!256s", self.mfr_desc))
9024 packed.append(struct.pack("!256s", self.hw_desc))
9025 packed.append(struct.pack("!256s", self.sw_desc))
9026 packed.append(struct.pack("!32s", self.serial_num))
9027 packed.append(struct.pack("!256s", self.dp_desc))
9028 length = sum([len(x) for x in packed])
9029 packed[2] = struct.pack("!H", length)
9030 return ''.join(packed)
9031
9032 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009033 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009034 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009035 _version = reader.read("!B")[0]
9036 assert(_version == 4)
9037 _type = reader.read("!B")[0]
9038 assert(_type == 19)
9039 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009040 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009041 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009042 obj.xid = reader.read("!L")[0]
9043 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009044 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009045 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009046 reader.skip(4)
9047 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9048 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9049 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9050 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9051 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9052 return obj
9053
9054 def __eq__(self, other):
9055 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009056 if self.xid != other.xid: return False
9057 if self.flags != other.flags: return False
9058 if self.mfr_desc != other.mfr_desc: return False
9059 if self.hw_desc != other.hw_desc: return False
9060 if self.sw_desc != other.sw_desc: return False
9061 if self.serial_num != other.serial_num: return False
9062 if self.dp_desc != other.dp_desc: return False
9063 return True
9064
Rich Lanec2ee4b82013-04-24 17:12:38 -07009065 def pretty_print(self, q):
9066 q.text("desc_stats_reply {")
9067 with q.group():
9068 with q.indent(2):
9069 q.breakable()
9070 q.text("xid = ");
9071 if self.xid != None:
9072 q.text("%#x" % self.xid)
9073 else:
9074 q.text('None')
9075 q.text(","); q.breakable()
9076 q.text("flags = ");
9077 q.text("%#x" % self.flags)
9078 q.text(","); q.breakable()
9079 q.text("mfr_desc = ");
9080 q.pp(self.mfr_desc)
9081 q.text(","); q.breakable()
9082 q.text("hw_desc = ");
9083 q.pp(self.hw_desc)
9084 q.text(","); q.breakable()
9085 q.text("sw_desc = ");
9086 q.pp(self.sw_desc)
9087 q.text(","); q.breakable()
9088 q.text("serial_num = ");
9089 q.pp(self.serial_num)
9090 q.text(","); q.breakable()
9091 q.text("dp_desc = ");
9092 q.pp(self.dp_desc)
9093 q.breakable()
9094 q.text('}')
9095
Rich Lane7dcdf022013-12-11 14:45:27 -08009096stats_reply.subtypes[0] = desc_stats_reply
9097
9098class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009099 version = 4
9100 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009101 stats_type = 0
9102
9103 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009104 if xid != None:
9105 self.xid = xid
9106 else:
9107 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009108 if flags != None:
9109 self.flags = flags
9110 else:
9111 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009112 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009113
9114 def pack(self):
9115 packed = []
9116 packed.append(struct.pack("!B", self.version))
9117 packed.append(struct.pack("!B", self.type))
9118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9119 packed.append(struct.pack("!L", self.xid))
9120 packed.append(struct.pack("!H", self.stats_type))
9121 packed.append(struct.pack("!H", self.flags))
9122 packed.append('\x00' * 4)
9123 length = sum([len(x) for x in packed])
9124 packed[2] = struct.pack("!H", length)
9125 return ''.join(packed)
9126
9127 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009128 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009129 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009130 _version = reader.read("!B")[0]
9131 assert(_version == 4)
9132 _type = reader.read("!B")[0]
9133 assert(_type == 18)
9134 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009135 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009136 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009137 obj.xid = reader.read("!L")[0]
9138 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009139 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009140 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009141 reader.skip(4)
9142 return obj
9143
9144 def __eq__(self, other):
9145 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009146 if self.xid != other.xid: return False
9147 if self.flags != other.flags: return False
9148 return True
9149
Rich Lanec2ee4b82013-04-24 17:12:38 -07009150 def pretty_print(self, q):
9151 q.text("desc_stats_request {")
9152 with q.group():
9153 with q.indent(2):
9154 q.breakable()
9155 q.text("xid = ");
9156 if self.xid != None:
9157 q.text("%#x" % self.xid)
9158 else:
9159 q.text('None')
9160 q.text(","); q.breakable()
9161 q.text("flags = ");
9162 q.text("%#x" % self.flags)
9163 q.breakable()
9164 q.text('}')
9165
Rich Lane7dcdf022013-12-11 14:45:27 -08009166stats_request.subtypes[0] = desc_stats_request
9167
9168class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009169 version = 4
9170 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009171
9172 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009173 if xid != None:
9174 self.xid = xid
9175 else:
9176 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009177 if data != None:
9178 self.data = data
9179 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009180 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009181 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009182
9183 def pack(self):
9184 packed = []
9185 packed.append(struct.pack("!B", self.version))
9186 packed.append(struct.pack("!B", self.type))
9187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9188 packed.append(struct.pack("!L", self.xid))
9189 packed.append(self.data)
9190 length = sum([len(x) for x in packed])
9191 packed[2] = struct.pack("!H", length)
9192 return ''.join(packed)
9193
9194 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009195 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009196 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009197 _version = reader.read("!B")[0]
9198 assert(_version == 4)
9199 _type = reader.read("!B")[0]
9200 assert(_type == 3)
9201 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009202 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009203 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009204 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009205 obj.data = str(reader.read_all())
9206 return obj
9207
9208 def __eq__(self, other):
9209 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009210 if self.xid != other.xid: return False
9211 if self.data != other.data: return False
9212 return True
9213
Rich Lanec2ee4b82013-04-24 17:12:38 -07009214 def pretty_print(self, q):
9215 q.text("echo_reply {")
9216 with q.group():
9217 with q.indent(2):
9218 q.breakable()
9219 q.text("xid = ");
9220 if self.xid != None:
9221 q.text("%#x" % self.xid)
9222 else:
9223 q.text('None')
9224 q.text(","); q.breakable()
9225 q.text("data = ");
9226 q.pp(self.data)
9227 q.breakable()
9228 q.text('}')
9229
Rich Lane7dcdf022013-12-11 14:45:27 -08009230message.subtypes[3] = echo_reply
9231
9232class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009233 version = 4
9234 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07009235
9236 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009237 if xid != None:
9238 self.xid = xid
9239 else:
9240 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009241 if data != None:
9242 self.data = data
9243 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009244 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009245 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009246
9247 def pack(self):
9248 packed = []
9249 packed.append(struct.pack("!B", self.version))
9250 packed.append(struct.pack("!B", self.type))
9251 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9252 packed.append(struct.pack("!L", self.xid))
9253 packed.append(self.data)
9254 length = sum([len(x) for x in packed])
9255 packed[2] = struct.pack("!H", length)
9256 return ''.join(packed)
9257
9258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009259 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009260 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009261 _version = reader.read("!B")[0]
9262 assert(_version == 4)
9263 _type = reader.read("!B")[0]
9264 assert(_type == 2)
9265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009266 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009267 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009268 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009269 obj.data = str(reader.read_all())
9270 return obj
9271
9272 def __eq__(self, other):
9273 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009274 if self.xid != other.xid: return False
9275 if self.data != other.data: return False
9276 return True
9277
Rich Lanec2ee4b82013-04-24 17:12:38 -07009278 def pretty_print(self, q):
9279 q.text("echo_request {")
9280 with q.group():
9281 with q.indent(2):
9282 q.breakable()
9283 q.text("xid = ");
9284 if self.xid != None:
9285 q.text("%#x" % self.xid)
9286 else:
9287 q.text('None')
9288 q.text(","); q.breakable()
9289 q.text("data = ");
9290 q.pp(self.data)
9291 q.breakable()
9292 q.text('}')
9293
Rich Lane7dcdf022013-12-11 14:45:27 -08009294message.subtypes[2] = echo_request
9295
9296class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07009297 version = 4
9298 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07009299 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07009300
Rich Lane6f4978c2013-10-20 21:33:52 -07009301 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009302 if xid != None:
9303 self.xid = xid
9304 else:
9305 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009306 if subtype != None:
9307 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07009308 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009309 self.subtype = 0
9310 if experimenter != None:
9311 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07009312 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009313 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009314 if data != None:
9315 self.data = data
9316 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009317 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009318 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009319
9320 def pack(self):
9321 packed = []
9322 packed.append(struct.pack("!B", self.version))
9323 packed.append(struct.pack("!B", self.type))
9324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9325 packed.append(struct.pack("!L", self.xid))
9326 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07009327 packed.append(struct.pack("!H", self.subtype))
9328 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009329 packed.append(self.data)
9330 length = sum([len(x) for x in packed])
9331 packed[2] = struct.pack("!H", length)
9332 return ''.join(packed)
9333
9334 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009335 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009336 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07009337 _version = reader.read("!B")[0]
9338 assert(_version == 4)
9339 _type = reader.read("!B")[0]
9340 assert(_type == 1)
9341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009342 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009343 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009344 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07009345 _err_type = reader.read("!H")[0]
9346 assert(_err_type == 65535)
9347 obj.subtype = reader.read("!H")[0]
9348 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009349 obj.data = str(reader.read_all())
9350 return obj
9351
9352 def __eq__(self, other):
9353 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009354 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009355 if self.subtype != other.subtype: return False
9356 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009357 if self.data != other.data: return False
9358 return True
9359
Rich Lanec2ee4b82013-04-24 17:12:38 -07009360 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07009361 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07009362 with q.group():
9363 with q.indent(2):
9364 q.breakable()
9365 q.text("xid = ");
9366 if self.xid != None:
9367 q.text("%#x" % self.xid)
9368 else:
9369 q.text('None')
9370 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009371 q.text("subtype = ");
9372 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009373 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009374 q.text("experimenter = ");
9375 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009376 q.text(","); q.breakable()
9377 q.text("data = ");
9378 q.pp(self.data)
9379 q.breakable()
9380 q.text('}')
9381
Rich Lane7dcdf022013-12-11 14:45:27 -08009382error_msg.subtypes[65535] = experimenter_error_msg
9383
9384class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009385 version = 4
9386 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07009387
9388 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 -08009389 if xid != None:
9390 self.xid = xid
9391 else:
9392 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009393 if datapath_id != None:
9394 self.datapath_id = datapath_id
9395 else:
9396 self.datapath_id = 0
9397 if n_buffers != None:
9398 self.n_buffers = n_buffers
9399 else:
9400 self.n_buffers = 0
9401 if n_tables != None:
9402 self.n_tables = n_tables
9403 else:
9404 self.n_tables = 0
9405 if auxiliary_id != None:
9406 self.auxiliary_id = auxiliary_id
9407 else:
9408 self.auxiliary_id = 0
9409 if capabilities != None:
9410 self.capabilities = capabilities
9411 else:
9412 self.capabilities = 0
9413 if reserved != None:
9414 self.reserved = reserved
9415 else:
9416 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009417 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009418
9419 def pack(self):
9420 packed = []
9421 packed.append(struct.pack("!B", self.version))
9422 packed.append(struct.pack("!B", self.type))
9423 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9424 packed.append(struct.pack("!L", self.xid))
9425 packed.append(struct.pack("!Q", self.datapath_id))
9426 packed.append(struct.pack("!L", self.n_buffers))
9427 packed.append(struct.pack("!B", self.n_tables))
9428 packed.append(struct.pack("!B", self.auxiliary_id))
9429 packed.append('\x00' * 2)
9430 packed.append(struct.pack("!L", self.capabilities))
9431 packed.append(struct.pack("!L", self.reserved))
9432 length = sum([len(x) for x in packed])
9433 packed[2] = struct.pack("!H", length)
9434 return ''.join(packed)
9435
9436 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009437 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009438 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009439 _version = reader.read("!B")[0]
9440 assert(_version == 4)
9441 _type = reader.read("!B")[0]
9442 assert(_type == 6)
9443 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009444 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009445 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009446 obj.xid = reader.read("!L")[0]
9447 obj.datapath_id = reader.read("!Q")[0]
9448 obj.n_buffers = reader.read("!L")[0]
9449 obj.n_tables = reader.read("!B")[0]
9450 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009451 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07009452 obj.capabilities = reader.read("!L")[0]
9453 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009454 return obj
9455
9456 def __eq__(self, other):
9457 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009458 if self.xid != other.xid: return False
9459 if self.datapath_id != other.datapath_id: return False
9460 if self.n_buffers != other.n_buffers: return False
9461 if self.n_tables != other.n_tables: return False
9462 if self.auxiliary_id != other.auxiliary_id: return False
9463 if self.capabilities != other.capabilities: return False
9464 if self.reserved != other.reserved: return False
9465 return True
9466
Rich Lanec2ee4b82013-04-24 17:12:38 -07009467 def pretty_print(self, q):
9468 q.text("features_reply {")
9469 with q.group():
9470 with q.indent(2):
9471 q.breakable()
9472 q.text("xid = ");
9473 if self.xid != None:
9474 q.text("%#x" % self.xid)
9475 else:
9476 q.text('None')
9477 q.text(","); q.breakable()
9478 q.text("datapath_id = ");
9479 q.text("%#x" % self.datapath_id)
9480 q.text(","); q.breakable()
9481 q.text("n_buffers = ");
9482 q.text("%#x" % self.n_buffers)
9483 q.text(","); q.breakable()
9484 q.text("n_tables = ");
9485 q.text("%#x" % self.n_tables)
9486 q.text(","); q.breakable()
9487 q.text("auxiliary_id = ");
9488 q.text("%#x" % self.auxiliary_id)
9489 q.text(","); q.breakable()
9490 q.text("capabilities = ");
9491 q.text("%#x" % self.capabilities)
9492 q.text(","); q.breakable()
9493 q.text("reserved = ");
9494 q.text("%#x" % self.reserved)
9495 q.breakable()
9496 q.text('}')
9497
Rich Lane7dcdf022013-12-11 14:45:27 -08009498message.subtypes[6] = features_reply
9499
9500class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009501 version = 4
9502 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07009503
9504 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009505 if xid != None:
9506 self.xid = xid
9507 else:
9508 self.xid = None
9509 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009510
9511 def pack(self):
9512 packed = []
9513 packed.append(struct.pack("!B", self.version))
9514 packed.append(struct.pack("!B", self.type))
9515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9516 packed.append(struct.pack("!L", self.xid))
9517 length = sum([len(x) for x in packed])
9518 packed[2] = struct.pack("!H", length)
9519 return ''.join(packed)
9520
9521 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009522 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009523 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009524 _version = reader.read("!B")[0]
9525 assert(_version == 4)
9526 _type = reader.read("!B")[0]
9527 assert(_type == 5)
9528 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009529 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009530 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009531 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009532 return obj
9533
9534 def __eq__(self, other):
9535 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009536 if self.xid != other.xid: return False
9537 return True
9538
Rich Lanec2ee4b82013-04-24 17:12:38 -07009539 def pretty_print(self, q):
9540 q.text("features_request {")
9541 with q.group():
9542 with q.indent(2):
9543 q.breakable()
9544 q.text("xid = ");
9545 if self.xid != None:
9546 q.text("%#x" % self.xid)
9547 else:
9548 q.text('None')
9549 q.breakable()
9550 q.text('}')
9551
Rich Lane7dcdf022013-12-11 14:45:27 -08009552message.subtypes[5] = features_request
9553
9554class flow_mod(message):
9555 subtypes = {}
9556
Rich Lane95f7fc92014-01-27 17:08:16 -08009557 version = 4
9558 type = 14
9559
9560 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):
9561 if xid != None:
9562 self.xid = xid
9563 else:
9564 self.xid = None
9565 if cookie != None:
9566 self.cookie = cookie
9567 else:
9568 self.cookie = 0
9569 if cookie_mask != None:
9570 self.cookie_mask = cookie_mask
9571 else:
9572 self.cookie_mask = 0
9573 if table_id != None:
9574 self.table_id = table_id
9575 else:
9576 self.table_id = 0
9577 if _command != None:
9578 self._command = _command
9579 else:
9580 self._command = 0
9581 if idle_timeout != None:
9582 self.idle_timeout = idle_timeout
9583 else:
9584 self.idle_timeout = 0
9585 if hard_timeout != None:
9586 self.hard_timeout = hard_timeout
9587 else:
9588 self.hard_timeout = 0
9589 if priority != None:
9590 self.priority = priority
9591 else:
9592 self.priority = 0
9593 if buffer_id != None:
9594 self.buffer_id = buffer_id
9595 else:
9596 self.buffer_id = 0
9597 if out_port != None:
9598 self.out_port = out_port
9599 else:
9600 self.out_port = 0
9601 if out_group != None:
9602 self.out_group = out_group
9603 else:
9604 self.out_group = 0
9605 if flags != None:
9606 self.flags = flags
9607 else:
9608 self.flags = 0
9609 if match != None:
9610 self.match = match
9611 else:
9612 self.match = common.match()
9613 if instructions != None:
9614 self.instructions = instructions
9615 else:
9616 self.instructions = []
9617 return
9618
9619 def pack(self):
9620 packed = []
9621 packed.append(struct.pack("!B", self.version))
9622 packed.append(struct.pack("!B", self.type))
9623 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9624 packed.append(struct.pack("!L", self.xid))
9625 packed.append(struct.pack("!Q", self.cookie))
9626 packed.append(struct.pack("!Q", self.cookie_mask))
9627 packed.append(struct.pack("!B", self.table_id))
9628 packed.append(util.pack_fm_cmd(self._command))
9629 packed.append(struct.pack("!H", self.idle_timeout))
9630 packed.append(struct.pack("!H", self.hard_timeout))
9631 packed.append(struct.pack("!H", self.priority))
9632 packed.append(struct.pack("!L", self.buffer_id))
9633 packed.append(util.pack_port_no(self.out_port))
9634 packed.append(struct.pack("!L", self.out_group))
9635 packed.append(struct.pack("!H", self.flags))
9636 packed.append('\x00' * 2)
9637 packed.append(self.match.pack())
9638 packed.append(loxi.generic_util.pack_list(self.instructions))
9639 length = sum([len(x) for x in packed])
9640 packed[2] = struct.pack("!H", length)
9641 return ''.join(packed)
9642
Rich Lane7dcdf022013-12-11 14:45:27 -08009643 @staticmethod
9644 def unpack(reader):
9645 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08009646 subclass = flow_mod.subtypes.get(subtype)
9647 if subclass:
9648 return subclass.unpack(reader)
9649
9650 obj = flow_mod()
9651 _version = reader.read("!B")[0]
9652 assert(_version == 4)
9653 _type = reader.read("!B")[0]
9654 assert(_type == 14)
9655 _length = reader.read("!H")[0]
9656 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009657 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08009658 obj.xid = reader.read("!L")[0]
9659 obj.cookie = reader.read("!Q")[0]
9660 obj.cookie_mask = reader.read("!Q")[0]
9661 obj.table_id = reader.read("!B")[0]
9662 obj._command = util.unpack_fm_cmd(reader)
9663 obj.idle_timeout = reader.read("!H")[0]
9664 obj.hard_timeout = reader.read("!H")[0]
9665 obj.priority = reader.read("!H")[0]
9666 obj.buffer_id = reader.read("!L")[0]
9667 obj.out_port = util.unpack_port_no(reader)
9668 obj.out_group = reader.read("!L")[0]
9669 obj.flags = reader.read("!H")[0]
9670 reader.skip(2)
9671 obj.match = common.match.unpack(reader)
9672 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9673 return obj
9674
9675 def __eq__(self, other):
9676 if type(self) != type(other): return False
9677 if self.xid != other.xid: return False
9678 if self.cookie != other.cookie: return False
9679 if self.cookie_mask != other.cookie_mask: return False
9680 if self.table_id != other.table_id: return False
9681 if self._command != other._command: return False
9682 if self.idle_timeout != other.idle_timeout: return False
9683 if self.hard_timeout != other.hard_timeout: return False
9684 if self.priority != other.priority: return False
9685 if self.buffer_id != other.buffer_id: return False
9686 if self.out_port != other.out_port: return False
9687 if self.out_group != other.out_group: return False
9688 if self.flags != other.flags: return False
9689 if self.match != other.match: return False
9690 if self.instructions != other.instructions: return False
9691 return True
9692
9693 def pretty_print(self, q):
9694 q.text("flow_mod {")
9695 with q.group():
9696 with q.indent(2):
9697 q.breakable()
9698 q.text("xid = ");
9699 if self.xid != None:
9700 q.text("%#x" % self.xid)
9701 else:
9702 q.text('None')
9703 q.text(","); q.breakable()
9704 q.text("cookie = ");
9705 q.text("%#x" % self.cookie)
9706 q.text(","); q.breakable()
9707 q.text("cookie_mask = ");
9708 q.text("%#x" % self.cookie_mask)
9709 q.text(","); q.breakable()
9710 q.text("table_id = ");
9711 q.text("%#x" % self.table_id)
9712 q.text(","); q.breakable()
9713 q.text("idle_timeout = ");
9714 q.text("%#x" % self.idle_timeout)
9715 q.text(","); q.breakable()
9716 q.text("hard_timeout = ");
9717 q.text("%#x" % self.hard_timeout)
9718 q.text(","); q.breakable()
9719 q.text("priority = ");
9720 q.text("%#x" % self.priority)
9721 q.text(","); q.breakable()
9722 q.text("buffer_id = ");
9723 q.text("%#x" % self.buffer_id)
9724 q.text(","); q.breakable()
9725 q.text("out_port = ");
9726 q.text(util.pretty_port(self.out_port))
9727 q.text(","); q.breakable()
9728 q.text("out_group = ");
9729 q.text("%#x" % self.out_group)
9730 q.text(","); q.breakable()
9731 q.text("flags = ");
9732 q.text("%#x" % self.flags)
9733 q.text(","); q.breakable()
9734 q.text("match = ");
9735 q.pp(self.match)
9736 q.text(","); q.breakable()
9737 q.text("instructions = ");
9738 q.pp(self.instructions)
9739 q.breakable()
9740 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009741
9742message.subtypes[14] = flow_mod
9743
9744class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009745 version = 4
9746 type = 14
9747 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009748
9749 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 -08009750 if xid != None:
9751 self.xid = xid
9752 else:
9753 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009754 if cookie != None:
9755 self.cookie = cookie
9756 else:
9757 self.cookie = 0
9758 if cookie_mask != None:
9759 self.cookie_mask = cookie_mask
9760 else:
9761 self.cookie_mask = 0
9762 if table_id != None:
9763 self.table_id = table_id
9764 else:
9765 self.table_id = 0
9766 if idle_timeout != None:
9767 self.idle_timeout = idle_timeout
9768 else:
9769 self.idle_timeout = 0
9770 if hard_timeout != None:
9771 self.hard_timeout = hard_timeout
9772 else:
9773 self.hard_timeout = 0
9774 if priority != None:
9775 self.priority = priority
9776 else:
9777 self.priority = 0
9778 if buffer_id != None:
9779 self.buffer_id = buffer_id
9780 else:
9781 self.buffer_id = 0
9782 if out_port != None:
9783 self.out_port = out_port
9784 else:
9785 self.out_port = 0
9786 if out_group != None:
9787 self.out_group = out_group
9788 else:
9789 self.out_group = 0
9790 if flags != None:
9791 self.flags = flags
9792 else:
9793 self.flags = 0
9794 if match != None:
9795 self.match = match
9796 else:
9797 self.match = common.match()
9798 if instructions != None:
9799 self.instructions = instructions
9800 else:
9801 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009802 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009803
9804 def pack(self):
9805 packed = []
9806 packed.append(struct.pack("!B", self.version))
9807 packed.append(struct.pack("!B", self.type))
9808 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9809 packed.append(struct.pack("!L", self.xid))
9810 packed.append(struct.pack("!Q", self.cookie))
9811 packed.append(struct.pack("!Q", self.cookie_mask))
9812 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009813 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009814 packed.append(struct.pack("!H", self.idle_timeout))
9815 packed.append(struct.pack("!H", self.hard_timeout))
9816 packed.append(struct.pack("!H", self.priority))
9817 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009818 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009819 packed.append(struct.pack("!L", self.out_group))
9820 packed.append(struct.pack("!H", self.flags))
9821 packed.append('\x00' * 2)
9822 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009823 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009824 length = sum([len(x) for x in packed])
9825 packed[2] = struct.pack("!H", length)
9826 return ''.join(packed)
9827
9828 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009829 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009830 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07009831 _version = reader.read("!B")[0]
9832 assert(_version == 4)
9833 _type = reader.read("!B")[0]
9834 assert(_type == 14)
9835 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009836 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009837 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009838 obj.xid = reader.read("!L")[0]
9839 obj.cookie = reader.read("!Q")[0]
9840 obj.cookie_mask = reader.read("!Q")[0]
9841 obj.table_id = reader.read("!B")[0]
9842 __command = util.unpack_fm_cmd(reader)
9843 assert(__command == 0)
9844 obj.idle_timeout = reader.read("!H")[0]
9845 obj.hard_timeout = reader.read("!H")[0]
9846 obj.priority = reader.read("!H")[0]
9847 obj.buffer_id = reader.read("!L")[0]
9848 obj.out_port = util.unpack_port_no(reader)
9849 obj.out_group = reader.read("!L")[0]
9850 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009851 reader.skip(2)
9852 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009853 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009854 return obj
9855
9856 def __eq__(self, other):
9857 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009858 if self.xid != other.xid: return False
9859 if self.cookie != other.cookie: return False
9860 if self.cookie_mask != other.cookie_mask: return False
9861 if self.table_id != other.table_id: return False
9862 if self.idle_timeout != other.idle_timeout: return False
9863 if self.hard_timeout != other.hard_timeout: return False
9864 if self.priority != other.priority: return False
9865 if self.buffer_id != other.buffer_id: return False
9866 if self.out_port != other.out_port: return False
9867 if self.out_group != other.out_group: return False
9868 if self.flags != other.flags: return False
9869 if self.match != other.match: return False
9870 if self.instructions != other.instructions: return False
9871 return True
9872
Rich Lanec2ee4b82013-04-24 17:12:38 -07009873 def pretty_print(self, q):
9874 q.text("flow_add {")
9875 with q.group():
9876 with q.indent(2):
9877 q.breakable()
9878 q.text("xid = ");
9879 if self.xid != None:
9880 q.text("%#x" % self.xid)
9881 else:
9882 q.text('None')
9883 q.text(","); q.breakable()
9884 q.text("cookie = ");
9885 q.text("%#x" % self.cookie)
9886 q.text(","); q.breakable()
9887 q.text("cookie_mask = ");
9888 q.text("%#x" % self.cookie_mask)
9889 q.text(","); q.breakable()
9890 q.text("table_id = ");
9891 q.text("%#x" % self.table_id)
9892 q.text(","); q.breakable()
9893 q.text("idle_timeout = ");
9894 q.text("%#x" % self.idle_timeout)
9895 q.text(","); q.breakable()
9896 q.text("hard_timeout = ");
9897 q.text("%#x" % self.hard_timeout)
9898 q.text(","); q.breakable()
9899 q.text("priority = ");
9900 q.text("%#x" % self.priority)
9901 q.text(","); q.breakable()
9902 q.text("buffer_id = ");
9903 q.text("%#x" % self.buffer_id)
9904 q.text(","); q.breakable()
9905 q.text("out_port = ");
9906 q.text(util.pretty_port(self.out_port))
9907 q.text(","); q.breakable()
9908 q.text("out_group = ");
9909 q.text("%#x" % self.out_group)
9910 q.text(","); q.breakable()
9911 q.text("flags = ");
9912 q.text("%#x" % self.flags)
9913 q.text(","); q.breakable()
9914 q.text("match = ");
9915 q.pp(self.match)
9916 q.text(","); q.breakable()
9917 q.text("instructions = ");
9918 q.pp(self.instructions)
9919 q.breakable()
9920 q.text('}')
9921
Rich Lane7dcdf022013-12-11 14:45:27 -08009922flow_mod.subtypes[0] = flow_add
9923
9924class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009925 version = 4
9926 type = 14
9927 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009928
9929 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 -08009930 if xid != None:
9931 self.xid = xid
9932 else:
9933 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009934 if cookie != None:
9935 self.cookie = cookie
9936 else:
9937 self.cookie = 0
9938 if cookie_mask != None:
9939 self.cookie_mask = cookie_mask
9940 else:
9941 self.cookie_mask = 0
9942 if table_id != None:
9943 self.table_id = table_id
9944 else:
9945 self.table_id = 0
9946 if idle_timeout != None:
9947 self.idle_timeout = idle_timeout
9948 else:
9949 self.idle_timeout = 0
9950 if hard_timeout != None:
9951 self.hard_timeout = hard_timeout
9952 else:
9953 self.hard_timeout = 0
9954 if priority != None:
9955 self.priority = priority
9956 else:
9957 self.priority = 0
9958 if buffer_id != None:
9959 self.buffer_id = buffer_id
9960 else:
9961 self.buffer_id = 0
9962 if out_port != None:
9963 self.out_port = out_port
9964 else:
9965 self.out_port = 0
9966 if out_group != None:
9967 self.out_group = out_group
9968 else:
9969 self.out_group = 0
9970 if flags != None:
9971 self.flags = flags
9972 else:
9973 self.flags = 0
9974 if match != None:
9975 self.match = match
9976 else:
9977 self.match = common.match()
9978 if instructions != None:
9979 self.instructions = instructions
9980 else:
9981 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009982 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009983
9984 def pack(self):
9985 packed = []
9986 packed.append(struct.pack("!B", self.version))
9987 packed.append(struct.pack("!B", self.type))
9988 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9989 packed.append(struct.pack("!L", self.xid))
9990 packed.append(struct.pack("!Q", self.cookie))
9991 packed.append(struct.pack("!Q", self.cookie_mask))
9992 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009993 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009994 packed.append(struct.pack("!H", self.idle_timeout))
9995 packed.append(struct.pack("!H", self.hard_timeout))
9996 packed.append(struct.pack("!H", self.priority))
9997 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009998 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009999 packed.append(struct.pack("!L", self.out_group))
10000 packed.append(struct.pack("!H", self.flags))
10001 packed.append('\x00' * 2)
10002 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010003 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010004 length = sum([len(x) for x in packed])
10005 packed[2] = struct.pack("!H", length)
10006 return ''.join(packed)
10007
10008 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010009 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010010 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -070010011 _version = reader.read("!B")[0]
10012 assert(_version == 4)
10013 _type = reader.read("!B")[0]
10014 assert(_type == 14)
10015 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010016 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010017 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010018 obj.xid = reader.read("!L")[0]
10019 obj.cookie = reader.read("!Q")[0]
10020 obj.cookie_mask = reader.read("!Q")[0]
10021 obj.table_id = reader.read("!B")[0]
10022 __command = util.unpack_fm_cmd(reader)
10023 assert(__command == 3)
10024 obj.idle_timeout = reader.read("!H")[0]
10025 obj.hard_timeout = reader.read("!H")[0]
10026 obj.priority = reader.read("!H")[0]
10027 obj.buffer_id = reader.read("!L")[0]
10028 obj.out_port = util.unpack_port_no(reader)
10029 obj.out_group = reader.read("!L")[0]
10030 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010031 reader.skip(2)
10032 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010033 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010034 return obj
10035
10036 def __eq__(self, other):
10037 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010038 if self.xid != other.xid: return False
10039 if self.cookie != other.cookie: return False
10040 if self.cookie_mask != other.cookie_mask: return False
10041 if self.table_id != other.table_id: return False
10042 if self.idle_timeout != other.idle_timeout: return False
10043 if self.hard_timeout != other.hard_timeout: return False
10044 if self.priority != other.priority: return False
10045 if self.buffer_id != other.buffer_id: return False
10046 if self.out_port != other.out_port: return False
10047 if self.out_group != other.out_group: return False
10048 if self.flags != other.flags: return False
10049 if self.match != other.match: return False
10050 if self.instructions != other.instructions: return False
10051 return True
10052
Rich Lanec2ee4b82013-04-24 17:12:38 -070010053 def pretty_print(self, q):
10054 q.text("flow_delete {")
10055 with q.group():
10056 with q.indent(2):
10057 q.breakable()
10058 q.text("xid = ");
10059 if self.xid != None:
10060 q.text("%#x" % self.xid)
10061 else:
10062 q.text('None')
10063 q.text(","); q.breakable()
10064 q.text("cookie = ");
10065 q.text("%#x" % self.cookie)
10066 q.text(","); q.breakable()
10067 q.text("cookie_mask = ");
10068 q.text("%#x" % self.cookie_mask)
10069 q.text(","); q.breakable()
10070 q.text("table_id = ");
10071 q.text("%#x" % self.table_id)
10072 q.text(","); q.breakable()
10073 q.text("idle_timeout = ");
10074 q.text("%#x" % self.idle_timeout)
10075 q.text(","); q.breakable()
10076 q.text("hard_timeout = ");
10077 q.text("%#x" % self.hard_timeout)
10078 q.text(","); q.breakable()
10079 q.text("priority = ");
10080 q.text("%#x" % self.priority)
10081 q.text(","); q.breakable()
10082 q.text("buffer_id = ");
10083 q.text("%#x" % self.buffer_id)
10084 q.text(","); q.breakable()
10085 q.text("out_port = ");
10086 q.text(util.pretty_port(self.out_port))
10087 q.text(","); q.breakable()
10088 q.text("out_group = ");
10089 q.text("%#x" % self.out_group)
10090 q.text(","); q.breakable()
10091 q.text("flags = ");
10092 q.text("%#x" % self.flags)
10093 q.text(","); q.breakable()
10094 q.text("match = ");
10095 q.pp(self.match)
10096 q.text(","); q.breakable()
10097 q.text("instructions = ");
10098 q.pp(self.instructions)
10099 q.breakable()
10100 q.text('}')
10101
Rich Lane7dcdf022013-12-11 14:45:27 -080010102flow_mod.subtypes[3] = flow_delete
10103
10104class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010105 version = 4
10106 type = 14
10107 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -070010108
10109 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 -080010110 if xid != None:
10111 self.xid = xid
10112 else:
10113 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010114 if cookie != None:
10115 self.cookie = cookie
10116 else:
10117 self.cookie = 0
10118 if cookie_mask != None:
10119 self.cookie_mask = cookie_mask
10120 else:
10121 self.cookie_mask = 0
10122 if table_id != None:
10123 self.table_id = table_id
10124 else:
10125 self.table_id = 0
10126 if idle_timeout != None:
10127 self.idle_timeout = idle_timeout
10128 else:
10129 self.idle_timeout = 0
10130 if hard_timeout != None:
10131 self.hard_timeout = hard_timeout
10132 else:
10133 self.hard_timeout = 0
10134 if priority != None:
10135 self.priority = priority
10136 else:
10137 self.priority = 0
10138 if buffer_id != None:
10139 self.buffer_id = buffer_id
10140 else:
10141 self.buffer_id = 0
10142 if out_port != None:
10143 self.out_port = out_port
10144 else:
10145 self.out_port = 0
10146 if out_group != None:
10147 self.out_group = out_group
10148 else:
10149 self.out_group = 0
10150 if flags != None:
10151 self.flags = flags
10152 else:
10153 self.flags = 0
10154 if match != None:
10155 self.match = match
10156 else:
10157 self.match = common.match()
10158 if instructions != None:
10159 self.instructions = instructions
10160 else:
10161 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010162 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010163
10164 def pack(self):
10165 packed = []
10166 packed.append(struct.pack("!B", self.version))
10167 packed.append(struct.pack("!B", self.type))
10168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10169 packed.append(struct.pack("!L", self.xid))
10170 packed.append(struct.pack("!Q", self.cookie))
10171 packed.append(struct.pack("!Q", self.cookie_mask))
10172 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010173 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010174 packed.append(struct.pack("!H", self.idle_timeout))
10175 packed.append(struct.pack("!H", self.hard_timeout))
10176 packed.append(struct.pack("!H", self.priority))
10177 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010178 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010179 packed.append(struct.pack("!L", self.out_group))
10180 packed.append(struct.pack("!H", self.flags))
10181 packed.append('\x00' * 2)
10182 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010183 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010184 length = sum([len(x) for x in packed])
10185 packed[2] = struct.pack("!H", length)
10186 return ''.join(packed)
10187
10188 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010189 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010190 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010191 _version = reader.read("!B")[0]
10192 assert(_version == 4)
10193 _type = reader.read("!B")[0]
10194 assert(_type == 14)
10195 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010196 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010197 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010198 obj.xid = reader.read("!L")[0]
10199 obj.cookie = reader.read("!Q")[0]
10200 obj.cookie_mask = reader.read("!Q")[0]
10201 obj.table_id = reader.read("!B")[0]
10202 __command = util.unpack_fm_cmd(reader)
10203 assert(__command == 4)
10204 obj.idle_timeout = reader.read("!H")[0]
10205 obj.hard_timeout = reader.read("!H")[0]
10206 obj.priority = reader.read("!H")[0]
10207 obj.buffer_id = reader.read("!L")[0]
10208 obj.out_port = util.unpack_port_no(reader)
10209 obj.out_group = reader.read("!L")[0]
10210 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010211 reader.skip(2)
10212 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010213 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010214 return obj
10215
10216 def __eq__(self, other):
10217 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010218 if self.xid != other.xid: return False
10219 if self.cookie != other.cookie: return False
10220 if self.cookie_mask != other.cookie_mask: return False
10221 if self.table_id != other.table_id: return False
10222 if self.idle_timeout != other.idle_timeout: return False
10223 if self.hard_timeout != other.hard_timeout: return False
10224 if self.priority != other.priority: return False
10225 if self.buffer_id != other.buffer_id: return False
10226 if self.out_port != other.out_port: return False
10227 if self.out_group != other.out_group: return False
10228 if self.flags != other.flags: return False
10229 if self.match != other.match: return False
10230 if self.instructions != other.instructions: return False
10231 return True
10232
Rich Lanec2ee4b82013-04-24 17:12:38 -070010233 def pretty_print(self, q):
10234 q.text("flow_delete_strict {")
10235 with q.group():
10236 with q.indent(2):
10237 q.breakable()
10238 q.text("xid = ");
10239 if self.xid != None:
10240 q.text("%#x" % self.xid)
10241 else:
10242 q.text('None')
10243 q.text(","); q.breakable()
10244 q.text("cookie = ");
10245 q.text("%#x" % self.cookie)
10246 q.text(","); q.breakable()
10247 q.text("cookie_mask = ");
10248 q.text("%#x" % self.cookie_mask)
10249 q.text(","); q.breakable()
10250 q.text("table_id = ");
10251 q.text("%#x" % self.table_id)
10252 q.text(","); q.breakable()
10253 q.text("idle_timeout = ");
10254 q.text("%#x" % self.idle_timeout)
10255 q.text(","); q.breakable()
10256 q.text("hard_timeout = ");
10257 q.text("%#x" % self.hard_timeout)
10258 q.text(","); q.breakable()
10259 q.text("priority = ");
10260 q.text("%#x" % self.priority)
10261 q.text(","); q.breakable()
10262 q.text("buffer_id = ");
10263 q.text("%#x" % self.buffer_id)
10264 q.text(","); q.breakable()
10265 q.text("out_port = ");
10266 q.text(util.pretty_port(self.out_port))
10267 q.text(","); q.breakable()
10268 q.text("out_group = ");
10269 q.text("%#x" % self.out_group)
10270 q.text(","); q.breakable()
10271 q.text("flags = ");
10272 q.text("%#x" % self.flags)
10273 q.text(","); q.breakable()
10274 q.text("match = ");
10275 q.pp(self.match)
10276 q.text(","); q.breakable()
10277 q.text("instructions = ");
10278 q.pp(self.instructions)
10279 q.breakable()
10280 q.text('}')
10281
Rich Lane7dcdf022013-12-11 14:45:27 -080010282flow_mod.subtypes[4] = flow_delete_strict
10283
10284class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010285 version = 4
10286 type = 1
10287 err_type = 5
10288
10289 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010290 if xid != None:
10291 self.xid = xid
10292 else:
10293 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010294 if code != None:
10295 self.code = code
10296 else:
10297 self.code = 0
10298 if data != None:
10299 self.data = data
10300 else:
10301 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010302 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010303
10304 def pack(self):
10305 packed = []
10306 packed.append(struct.pack("!B", self.version))
10307 packed.append(struct.pack("!B", self.type))
10308 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10309 packed.append(struct.pack("!L", self.xid))
10310 packed.append(struct.pack("!H", self.err_type))
10311 packed.append(struct.pack("!H", self.code))
10312 packed.append(self.data)
10313 length = sum([len(x) for x in packed])
10314 packed[2] = struct.pack("!H", length)
10315 return ''.join(packed)
10316
10317 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010318 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010319 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010320 _version = reader.read("!B")[0]
10321 assert(_version == 4)
10322 _type = reader.read("!B")[0]
10323 assert(_type == 1)
10324 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010325 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010326 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070010327 obj.xid = reader.read("!L")[0]
10328 _err_type = reader.read("!H")[0]
10329 assert(_err_type == 5)
10330 obj.code = reader.read("!H")[0]
10331 obj.data = str(reader.read_all())
10332 return obj
10333
10334 def __eq__(self, other):
10335 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010336 if self.xid != other.xid: return False
10337 if self.code != other.code: return False
10338 if self.data != other.data: return False
10339 return True
10340
Rich Lane6f4978c2013-10-20 21:33:52 -070010341 def pretty_print(self, q):
10342 q.text("flow_mod_failed_error_msg {")
10343 with q.group():
10344 with q.indent(2):
10345 q.breakable()
10346 q.text("xid = ");
10347 if self.xid != None:
10348 q.text("%#x" % self.xid)
10349 else:
10350 q.text('None')
10351 q.text(","); q.breakable()
10352 q.text("code = ");
10353 q.text("%#x" % self.code)
10354 q.text(","); q.breakable()
10355 q.text("data = ");
10356 q.pp(self.data)
10357 q.breakable()
10358 q.text('}')
10359
Rich Lane7dcdf022013-12-11 14:45:27 -080010360error_msg.subtypes[5] = flow_mod_failed_error_msg
10361
10362class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010363 version = 4
10364 type = 14
10365 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -070010366
10367 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 -080010368 if xid != None:
10369 self.xid = xid
10370 else:
10371 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010372 if cookie != None:
10373 self.cookie = cookie
10374 else:
10375 self.cookie = 0
10376 if cookie_mask != None:
10377 self.cookie_mask = cookie_mask
10378 else:
10379 self.cookie_mask = 0
10380 if table_id != None:
10381 self.table_id = table_id
10382 else:
10383 self.table_id = 0
10384 if idle_timeout != None:
10385 self.idle_timeout = idle_timeout
10386 else:
10387 self.idle_timeout = 0
10388 if hard_timeout != None:
10389 self.hard_timeout = hard_timeout
10390 else:
10391 self.hard_timeout = 0
10392 if priority != None:
10393 self.priority = priority
10394 else:
10395 self.priority = 0
10396 if buffer_id != None:
10397 self.buffer_id = buffer_id
10398 else:
10399 self.buffer_id = 0
10400 if out_port != None:
10401 self.out_port = out_port
10402 else:
10403 self.out_port = 0
10404 if out_group != None:
10405 self.out_group = out_group
10406 else:
10407 self.out_group = 0
10408 if flags != None:
10409 self.flags = flags
10410 else:
10411 self.flags = 0
10412 if match != None:
10413 self.match = match
10414 else:
10415 self.match = common.match()
10416 if instructions != None:
10417 self.instructions = instructions
10418 else:
10419 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010420 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010421
10422 def pack(self):
10423 packed = []
10424 packed.append(struct.pack("!B", self.version))
10425 packed.append(struct.pack("!B", self.type))
10426 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10427 packed.append(struct.pack("!L", self.xid))
10428 packed.append(struct.pack("!Q", self.cookie))
10429 packed.append(struct.pack("!Q", self.cookie_mask))
10430 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010431 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010432 packed.append(struct.pack("!H", self.idle_timeout))
10433 packed.append(struct.pack("!H", self.hard_timeout))
10434 packed.append(struct.pack("!H", self.priority))
10435 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010436 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010437 packed.append(struct.pack("!L", self.out_group))
10438 packed.append(struct.pack("!H", self.flags))
10439 packed.append('\x00' * 2)
10440 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010441 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010442 length = sum([len(x) for x in packed])
10443 packed[2] = struct.pack("!H", length)
10444 return ''.join(packed)
10445
10446 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010447 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010448 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -070010449 _version = reader.read("!B")[0]
10450 assert(_version == 4)
10451 _type = reader.read("!B")[0]
10452 assert(_type == 14)
10453 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010454 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010455 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010456 obj.xid = reader.read("!L")[0]
10457 obj.cookie = reader.read("!Q")[0]
10458 obj.cookie_mask = reader.read("!Q")[0]
10459 obj.table_id = reader.read("!B")[0]
10460 __command = util.unpack_fm_cmd(reader)
10461 assert(__command == 1)
10462 obj.idle_timeout = reader.read("!H")[0]
10463 obj.hard_timeout = reader.read("!H")[0]
10464 obj.priority = reader.read("!H")[0]
10465 obj.buffer_id = reader.read("!L")[0]
10466 obj.out_port = util.unpack_port_no(reader)
10467 obj.out_group = reader.read("!L")[0]
10468 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010469 reader.skip(2)
10470 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010471 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010472 return obj
10473
10474 def __eq__(self, other):
10475 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010476 if self.xid != other.xid: return False
10477 if self.cookie != other.cookie: return False
10478 if self.cookie_mask != other.cookie_mask: return False
10479 if self.table_id != other.table_id: return False
10480 if self.idle_timeout != other.idle_timeout: return False
10481 if self.hard_timeout != other.hard_timeout: return False
10482 if self.priority != other.priority: return False
10483 if self.buffer_id != other.buffer_id: return False
10484 if self.out_port != other.out_port: return False
10485 if self.out_group != other.out_group: return False
10486 if self.flags != other.flags: return False
10487 if self.match != other.match: return False
10488 if self.instructions != other.instructions: return False
10489 return True
10490
Rich Lanec2ee4b82013-04-24 17:12:38 -070010491 def pretty_print(self, q):
10492 q.text("flow_modify {")
10493 with q.group():
10494 with q.indent(2):
10495 q.breakable()
10496 q.text("xid = ");
10497 if self.xid != None:
10498 q.text("%#x" % self.xid)
10499 else:
10500 q.text('None')
10501 q.text(","); q.breakable()
10502 q.text("cookie = ");
10503 q.text("%#x" % self.cookie)
10504 q.text(","); q.breakable()
10505 q.text("cookie_mask = ");
10506 q.text("%#x" % self.cookie_mask)
10507 q.text(","); q.breakable()
10508 q.text("table_id = ");
10509 q.text("%#x" % self.table_id)
10510 q.text(","); q.breakable()
10511 q.text("idle_timeout = ");
10512 q.text("%#x" % self.idle_timeout)
10513 q.text(","); q.breakable()
10514 q.text("hard_timeout = ");
10515 q.text("%#x" % self.hard_timeout)
10516 q.text(","); q.breakable()
10517 q.text("priority = ");
10518 q.text("%#x" % self.priority)
10519 q.text(","); q.breakable()
10520 q.text("buffer_id = ");
10521 q.text("%#x" % self.buffer_id)
10522 q.text(","); q.breakable()
10523 q.text("out_port = ");
10524 q.text(util.pretty_port(self.out_port))
10525 q.text(","); q.breakable()
10526 q.text("out_group = ");
10527 q.text("%#x" % self.out_group)
10528 q.text(","); q.breakable()
10529 q.text("flags = ");
10530 q.text("%#x" % self.flags)
10531 q.text(","); q.breakable()
10532 q.text("match = ");
10533 q.pp(self.match)
10534 q.text(","); q.breakable()
10535 q.text("instructions = ");
10536 q.pp(self.instructions)
10537 q.breakable()
10538 q.text('}')
10539
Rich Lane7dcdf022013-12-11 14:45:27 -080010540flow_mod.subtypes[1] = flow_modify
10541
10542class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010543 version = 4
10544 type = 14
10545 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -070010546
10547 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 -080010548 if xid != None:
10549 self.xid = xid
10550 else:
10551 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010552 if cookie != None:
10553 self.cookie = cookie
10554 else:
10555 self.cookie = 0
10556 if cookie_mask != None:
10557 self.cookie_mask = cookie_mask
10558 else:
10559 self.cookie_mask = 0
10560 if table_id != None:
10561 self.table_id = table_id
10562 else:
10563 self.table_id = 0
10564 if idle_timeout != None:
10565 self.idle_timeout = idle_timeout
10566 else:
10567 self.idle_timeout = 0
10568 if hard_timeout != None:
10569 self.hard_timeout = hard_timeout
10570 else:
10571 self.hard_timeout = 0
10572 if priority != None:
10573 self.priority = priority
10574 else:
10575 self.priority = 0
10576 if buffer_id != None:
10577 self.buffer_id = buffer_id
10578 else:
10579 self.buffer_id = 0
10580 if out_port != None:
10581 self.out_port = out_port
10582 else:
10583 self.out_port = 0
10584 if out_group != None:
10585 self.out_group = out_group
10586 else:
10587 self.out_group = 0
10588 if flags != None:
10589 self.flags = flags
10590 else:
10591 self.flags = 0
10592 if match != None:
10593 self.match = match
10594 else:
10595 self.match = common.match()
10596 if instructions != None:
10597 self.instructions = instructions
10598 else:
10599 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010600 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010601
10602 def pack(self):
10603 packed = []
10604 packed.append(struct.pack("!B", self.version))
10605 packed.append(struct.pack("!B", self.type))
10606 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10607 packed.append(struct.pack("!L", self.xid))
10608 packed.append(struct.pack("!Q", self.cookie))
10609 packed.append(struct.pack("!Q", self.cookie_mask))
10610 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010611 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010612 packed.append(struct.pack("!H", self.idle_timeout))
10613 packed.append(struct.pack("!H", self.hard_timeout))
10614 packed.append(struct.pack("!H", self.priority))
10615 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010616 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010617 packed.append(struct.pack("!L", self.out_group))
10618 packed.append(struct.pack("!H", self.flags))
10619 packed.append('\x00' * 2)
10620 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010621 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010622 length = sum([len(x) for x in packed])
10623 packed[2] = struct.pack("!H", length)
10624 return ''.join(packed)
10625
10626 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010627 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010628 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010629 _version = reader.read("!B")[0]
10630 assert(_version == 4)
10631 _type = reader.read("!B")[0]
10632 assert(_type == 14)
10633 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010634 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010635 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010636 obj.xid = reader.read("!L")[0]
10637 obj.cookie = reader.read("!Q")[0]
10638 obj.cookie_mask = reader.read("!Q")[0]
10639 obj.table_id = reader.read("!B")[0]
10640 __command = util.unpack_fm_cmd(reader)
10641 assert(__command == 2)
10642 obj.idle_timeout = reader.read("!H")[0]
10643 obj.hard_timeout = reader.read("!H")[0]
10644 obj.priority = reader.read("!H")[0]
10645 obj.buffer_id = reader.read("!L")[0]
10646 obj.out_port = util.unpack_port_no(reader)
10647 obj.out_group = reader.read("!L")[0]
10648 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010649 reader.skip(2)
10650 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010651 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010652 return obj
10653
10654 def __eq__(self, other):
10655 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010656 if self.xid != other.xid: return False
10657 if self.cookie != other.cookie: return False
10658 if self.cookie_mask != other.cookie_mask: return False
10659 if self.table_id != other.table_id: return False
10660 if self.idle_timeout != other.idle_timeout: return False
10661 if self.hard_timeout != other.hard_timeout: return False
10662 if self.priority != other.priority: return False
10663 if self.buffer_id != other.buffer_id: return False
10664 if self.out_port != other.out_port: return False
10665 if self.out_group != other.out_group: return False
10666 if self.flags != other.flags: return False
10667 if self.match != other.match: return False
10668 if self.instructions != other.instructions: return False
10669 return True
10670
Rich Lanec2ee4b82013-04-24 17:12:38 -070010671 def pretty_print(self, q):
10672 q.text("flow_modify_strict {")
10673 with q.group():
10674 with q.indent(2):
10675 q.breakable()
10676 q.text("xid = ");
10677 if self.xid != None:
10678 q.text("%#x" % self.xid)
10679 else:
10680 q.text('None')
10681 q.text(","); q.breakable()
10682 q.text("cookie = ");
10683 q.text("%#x" % self.cookie)
10684 q.text(","); q.breakable()
10685 q.text("cookie_mask = ");
10686 q.text("%#x" % self.cookie_mask)
10687 q.text(","); q.breakable()
10688 q.text("table_id = ");
10689 q.text("%#x" % self.table_id)
10690 q.text(","); q.breakable()
10691 q.text("idle_timeout = ");
10692 q.text("%#x" % self.idle_timeout)
10693 q.text(","); q.breakable()
10694 q.text("hard_timeout = ");
10695 q.text("%#x" % self.hard_timeout)
10696 q.text(","); q.breakable()
10697 q.text("priority = ");
10698 q.text("%#x" % self.priority)
10699 q.text(","); q.breakable()
10700 q.text("buffer_id = ");
10701 q.text("%#x" % self.buffer_id)
10702 q.text(","); q.breakable()
10703 q.text("out_port = ");
10704 q.text(util.pretty_port(self.out_port))
10705 q.text(","); q.breakable()
10706 q.text("out_group = ");
10707 q.text("%#x" % self.out_group)
10708 q.text(","); q.breakable()
10709 q.text("flags = ");
10710 q.text("%#x" % self.flags)
10711 q.text(","); q.breakable()
10712 q.text("match = ");
10713 q.pp(self.match)
10714 q.text(","); q.breakable()
10715 q.text("instructions = ");
10716 q.pp(self.instructions)
10717 q.breakable()
10718 q.text('}')
10719
Rich Lane7dcdf022013-12-11 14:45:27 -080010720flow_mod.subtypes[2] = flow_modify_strict
10721
10722class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010723 version = 4
10724 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -070010725
10726 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 -080010727 if xid != None:
10728 self.xid = xid
10729 else:
10730 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010731 if cookie != None:
10732 self.cookie = cookie
10733 else:
10734 self.cookie = 0
10735 if priority != None:
10736 self.priority = priority
10737 else:
10738 self.priority = 0
10739 if reason != None:
10740 self.reason = reason
10741 else:
10742 self.reason = 0
10743 if table_id != None:
10744 self.table_id = table_id
10745 else:
10746 self.table_id = 0
10747 if duration_sec != None:
10748 self.duration_sec = duration_sec
10749 else:
10750 self.duration_sec = 0
10751 if duration_nsec != None:
10752 self.duration_nsec = duration_nsec
10753 else:
10754 self.duration_nsec = 0
10755 if idle_timeout != None:
10756 self.idle_timeout = idle_timeout
10757 else:
10758 self.idle_timeout = 0
10759 if hard_timeout != None:
10760 self.hard_timeout = hard_timeout
10761 else:
10762 self.hard_timeout = 0
10763 if packet_count != None:
10764 self.packet_count = packet_count
10765 else:
10766 self.packet_count = 0
10767 if byte_count != None:
10768 self.byte_count = byte_count
10769 else:
10770 self.byte_count = 0
10771 if match != None:
10772 self.match = match
10773 else:
10774 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010775 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010776
10777 def pack(self):
10778 packed = []
10779 packed.append(struct.pack("!B", self.version))
10780 packed.append(struct.pack("!B", self.type))
10781 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10782 packed.append(struct.pack("!L", self.xid))
10783 packed.append(struct.pack("!Q", self.cookie))
10784 packed.append(struct.pack("!H", self.priority))
10785 packed.append(struct.pack("!B", self.reason))
10786 packed.append(struct.pack("!B", self.table_id))
10787 packed.append(struct.pack("!L", self.duration_sec))
10788 packed.append(struct.pack("!L", self.duration_nsec))
10789 packed.append(struct.pack("!H", self.idle_timeout))
10790 packed.append(struct.pack("!H", self.hard_timeout))
10791 packed.append(struct.pack("!Q", self.packet_count))
10792 packed.append(struct.pack("!Q", self.byte_count))
10793 packed.append(self.match.pack())
10794 length = sum([len(x) for x in packed])
10795 packed[2] = struct.pack("!H", length)
10796 return ''.join(packed)
10797
10798 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010799 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010800 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -070010801 _version = reader.read("!B")[0]
10802 assert(_version == 4)
10803 _type = reader.read("!B")[0]
10804 assert(_type == 11)
10805 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010806 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010807 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010808 obj.xid = reader.read("!L")[0]
10809 obj.cookie = reader.read("!Q")[0]
10810 obj.priority = reader.read("!H")[0]
10811 obj.reason = reader.read("!B")[0]
10812 obj.table_id = reader.read("!B")[0]
10813 obj.duration_sec = reader.read("!L")[0]
10814 obj.duration_nsec = reader.read("!L")[0]
10815 obj.idle_timeout = reader.read("!H")[0]
10816 obj.hard_timeout = reader.read("!H")[0]
10817 obj.packet_count = reader.read("!Q")[0]
10818 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010819 obj.match = common.match.unpack(reader)
10820 return obj
10821
10822 def __eq__(self, other):
10823 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010824 if self.xid != other.xid: return False
10825 if self.cookie != other.cookie: return False
10826 if self.priority != other.priority: return False
10827 if self.reason != other.reason: return False
10828 if self.table_id != other.table_id: return False
10829 if self.duration_sec != other.duration_sec: return False
10830 if self.duration_nsec != other.duration_nsec: return False
10831 if self.idle_timeout != other.idle_timeout: return False
10832 if self.hard_timeout != other.hard_timeout: return False
10833 if self.packet_count != other.packet_count: return False
10834 if self.byte_count != other.byte_count: return False
10835 if self.match != other.match: return False
10836 return True
10837
Rich Lanec2ee4b82013-04-24 17:12:38 -070010838 def pretty_print(self, q):
10839 q.text("flow_removed {")
10840 with q.group():
10841 with q.indent(2):
10842 q.breakable()
10843 q.text("xid = ");
10844 if self.xid != None:
10845 q.text("%#x" % self.xid)
10846 else:
10847 q.text('None')
10848 q.text(","); q.breakable()
10849 q.text("cookie = ");
10850 q.text("%#x" % self.cookie)
10851 q.text(","); q.breakable()
10852 q.text("priority = ");
10853 q.text("%#x" % self.priority)
10854 q.text(","); q.breakable()
10855 q.text("reason = ");
10856 q.text("%#x" % self.reason)
10857 q.text(","); q.breakable()
10858 q.text("table_id = ");
10859 q.text("%#x" % self.table_id)
10860 q.text(","); q.breakable()
10861 q.text("duration_sec = ");
10862 q.text("%#x" % self.duration_sec)
10863 q.text(","); q.breakable()
10864 q.text("duration_nsec = ");
10865 q.text("%#x" % self.duration_nsec)
10866 q.text(","); q.breakable()
10867 q.text("idle_timeout = ");
10868 q.text("%#x" % self.idle_timeout)
10869 q.text(","); q.breakable()
10870 q.text("hard_timeout = ");
10871 q.text("%#x" % self.hard_timeout)
10872 q.text(","); q.breakable()
10873 q.text("packet_count = ");
10874 q.text("%#x" % self.packet_count)
10875 q.text(","); q.breakable()
10876 q.text("byte_count = ");
10877 q.text("%#x" % self.byte_count)
10878 q.text(","); q.breakable()
10879 q.text("match = ");
10880 q.pp(self.match)
10881 q.breakable()
10882 q.text('}')
10883
Rich Lane7dcdf022013-12-11 14:45:27 -080010884message.subtypes[11] = flow_removed
10885
10886class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010887 version = 4
10888 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010889 stats_type = 1
10890
10891 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010892 if xid != None:
10893 self.xid = xid
10894 else:
10895 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010896 if flags != None:
10897 self.flags = flags
10898 else:
10899 self.flags = 0
10900 if entries != None:
10901 self.entries = entries
10902 else:
10903 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010904 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010905
10906 def pack(self):
10907 packed = []
10908 packed.append(struct.pack("!B", self.version))
10909 packed.append(struct.pack("!B", self.type))
10910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10911 packed.append(struct.pack("!L", self.xid))
10912 packed.append(struct.pack("!H", self.stats_type))
10913 packed.append(struct.pack("!H", self.flags))
10914 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010915 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010916 length = sum([len(x) for x in packed])
10917 packed[2] = struct.pack("!H", length)
10918 return ''.join(packed)
10919
10920 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010921 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010922 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010923 _version = reader.read("!B")[0]
10924 assert(_version == 4)
10925 _type = reader.read("!B")[0]
10926 assert(_type == 19)
10927 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010928 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010929 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010930 obj.xid = reader.read("!L")[0]
10931 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010932 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010933 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010934 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010935 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010936 return obj
10937
10938 def __eq__(self, other):
10939 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010940 if self.xid != other.xid: return False
10941 if self.flags != other.flags: return False
10942 if self.entries != other.entries: return False
10943 return True
10944
Rich Lanec2ee4b82013-04-24 17:12:38 -070010945 def pretty_print(self, q):
10946 q.text("flow_stats_reply {")
10947 with q.group():
10948 with q.indent(2):
10949 q.breakable()
10950 q.text("xid = ");
10951 if self.xid != None:
10952 q.text("%#x" % self.xid)
10953 else:
10954 q.text('None')
10955 q.text(","); q.breakable()
10956 q.text("flags = ");
10957 q.text("%#x" % self.flags)
10958 q.text(","); q.breakable()
10959 q.text("entries = ");
10960 q.pp(self.entries)
10961 q.breakable()
10962 q.text('}')
10963
Rich Lane7dcdf022013-12-11 14:45:27 -080010964stats_reply.subtypes[1] = flow_stats_reply
10965
10966class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010967 version = 4
10968 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010969 stats_type = 1
10970
10971 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 -080010972 if xid != None:
10973 self.xid = xid
10974 else:
10975 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010976 if flags != None:
10977 self.flags = flags
10978 else:
10979 self.flags = 0
10980 if table_id != None:
10981 self.table_id = table_id
10982 else:
10983 self.table_id = 0
10984 if out_port != None:
10985 self.out_port = out_port
10986 else:
10987 self.out_port = 0
10988 if out_group != None:
10989 self.out_group = out_group
10990 else:
10991 self.out_group = 0
10992 if cookie != None:
10993 self.cookie = cookie
10994 else:
10995 self.cookie = 0
10996 if cookie_mask != None:
10997 self.cookie_mask = cookie_mask
10998 else:
10999 self.cookie_mask = 0
11000 if match != None:
11001 self.match = match
11002 else:
11003 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080011004 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011005
11006 def pack(self):
11007 packed = []
11008 packed.append(struct.pack("!B", self.version))
11009 packed.append(struct.pack("!B", self.type))
11010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11011 packed.append(struct.pack("!L", self.xid))
11012 packed.append(struct.pack("!H", self.stats_type))
11013 packed.append(struct.pack("!H", self.flags))
11014 packed.append('\x00' * 4)
11015 packed.append(struct.pack("!B", self.table_id))
11016 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -070011017 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011018 packed.append(struct.pack("!L", self.out_group))
11019 packed.append('\x00' * 4)
11020 packed.append(struct.pack("!Q", self.cookie))
11021 packed.append(struct.pack("!Q", self.cookie_mask))
11022 packed.append(self.match.pack())
11023 length = sum([len(x) for x in packed])
11024 packed[2] = struct.pack("!H", length)
11025 return ''.join(packed)
11026
11027 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011028 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011029 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011030 _version = reader.read("!B")[0]
11031 assert(_version == 4)
11032 _type = reader.read("!B")[0]
11033 assert(_type == 18)
11034 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011035 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011036 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011037 obj.xid = reader.read("!L")[0]
11038 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011039 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070011040 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011041 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011042 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011043 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070011044 obj.out_port = util.unpack_port_no(reader)
11045 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011046 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011047 obj.cookie = reader.read("!Q")[0]
11048 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011049 obj.match = common.match.unpack(reader)
11050 return obj
11051
11052 def __eq__(self, other):
11053 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011054 if self.xid != other.xid: return False
11055 if self.flags != other.flags: return False
11056 if self.table_id != other.table_id: return False
11057 if self.out_port != other.out_port: return False
11058 if self.out_group != other.out_group: return False
11059 if self.cookie != other.cookie: return False
11060 if self.cookie_mask != other.cookie_mask: return False
11061 if self.match != other.match: return False
11062 return True
11063
Rich Lanec2ee4b82013-04-24 17:12:38 -070011064 def pretty_print(self, q):
11065 q.text("flow_stats_request {")
11066 with q.group():
11067 with q.indent(2):
11068 q.breakable()
11069 q.text("xid = ");
11070 if self.xid != None:
11071 q.text("%#x" % self.xid)
11072 else:
11073 q.text('None')
11074 q.text(","); q.breakable()
11075 q.text("flags = ");
11076 q.text("%#x" % self.flags)
11077 q.text(","); q.breakable()
11078 q.text("table_id = ");
11079 q.text("%#x" % self.table_id)
11080 q.text(","); q.breakable()
11081 q.text("out_port = ");
11082 q.text(util.pretty_port(self.out_port))
11083 q.text(","); q.breakable()
11084 q.text("out_group = ");
11085 q.text("%#x" % self.out_group)
11086 q.text(","); q.breakable()
11087 q.text("cookie = ");
11088 q.text("%#x" % self.cookie)
11089 q.text(","); q.breakable()
11090 q.text("cookie_mask = ");
11091 q.text("%#x" % self.cookie_mask)
11092 q.text(","); q.breakable()
11093 q.text("match = ");
11094 q.pp(self.match)
11095 q.breakable()
11096 q.text('}')
11097
Rich Lane7dcdf022013-12-11 14:45:27 -080011098stats_request.subtypes[1] = flow_stats_request
11099
11100class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011101 version = 4
11102 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -070011103
11104 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011105 if xid != None:
11106 self.xid = xid
11107 else:
11108 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011109 if flags != None:
11110 self.flags = flags
11111 else:
11112 self.flags = 0
11113 if miss_send_len != None:
11114 self.miss_send_len = miss_send_len
11115 else:
11116 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011117 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011118
11119 def pack(self):
11120 packed = []
11121 packed.append(struct.pack("!B", self.version))
11122 packed.append(struct.pack("!B", self.type))
11123 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11124 packed.append(struct.pack("!L", self.xid))
11125 packed.append(struct.pack("!H", self.flags))
11126 packed.append(struct.pack("!H", self.miss_send_len))
11127 length = sum([len(x) for x in packed])
11128 packed[2] = struct.pack("!H", length)
11129 return ''.join(packed)
11130
11131 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011132 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011133 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011134 _version = reader.read("!B")[0]
11135 assert(_version == 4)
11136 _type = reader.read("!B")[0]
11137 assert(_type == 8)
11138 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011139 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011140 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011141 obj.xid = reader.read("!L")[0]
11142 obj.flags = reader.read("!H")[0]
11143 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011144 return obj
11145
11146 def __eq__(self, other):
11147 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011148 if self.xid != other.xid: return False
11149 if self.flags != other.flags: return False
11150 if self.miss_send_len != other.miss_send_len: return False
11151 return True
11152
Rich Lanec2ee4b82013-04-24 17:12:38 -070011153 def pretty_print(self, q):
11154 q.text("get_config_reply {")
11155 with q.group():
11156 with q.indent(2):
11157 q.breakable()
11158 q.text("xid = ");
11159 if self.xid != None:
11160 q.text("%#x" % self.xid)
11161 else:
11162 q.text('None')
11163 q.text(","); q.breakable()
11164 q.text("flags = ");
11165 q.text("%#x" % self.flags)
11166 q.text(","); q.breakable()
11167 q.text("miss_send_len = ");
11168 q.text("%#x" % self.miss_send_len)
11169 q.breakable()
11170 q.text('}')
11171
Rich Lane7dcdf022013-12-11 14:45:27 -080011172message.subtypes[8] = get_config_reply
11173
11174class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011175 version = 4
11176 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -070011177
11178 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011179 if xid != None:
11180 self.xid = xid
11181 else:
11182 self.xid = None
11183 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 length = sum([len(x) for x in packed])
11192 packed[2] = struct.pack("!H", length)
11193 return ''.join(packed)
11194
11195 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011196 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011197 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011198 _version = reader.read("!B")[0]
11199 assert(_version == 4)
11200 _type = reader.read("!B")[0]
11201 assert(_type == 7)
11202 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011203 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011204 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011205 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011206 return obj
11207
11208 def __eq__(self, other):
11209 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011210 if self.xid != other.xid: return False
11211 return True
11212
Rich Lanec2ee4b82013-04-24 17:12:38 -070011213 def pretty_print(self, q):
11214 q.text("get_config_request {")
11215 with q.group():
11216 with q.indent(2):
11217 q.breakable()
11218 q.text("xid = ");
11219 if self.xid != None:
11220 q.text("%#x" % self.xid)
11221 else:
11222 q.text('None')
11223 q.breakable()
11224 q.text('}')
11225
Rich Lane7dcdf022013-12-11 14:45:27 -080011226message.subtypes[7] = get_config_request
11227
11228class group_mod(message):
11229 subtypes = {}
11230
Rich Lane95f7fc92014-01-27 17:08:16 -080011231 version = 4
11232 type = 15
11233
11234 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11235 if xid != None:
11236 self.xid = xid
11237 else:
11238 self.xid = None
11239 if command != None:
11240 self.command = command
11241 else:
11242 self.command = 0
11243 if group_type != None:
11244 self.group_type = group_type
11245 else:
11246 self.group_type = 0
11247 if group_id != None:
11248 self.group_id = group_id
11249 else:
11250 self.group_id = 0
11251 if buckets != None:
11252 self.buckets = buckets
11253 else:
11254 self.buckets = []
11255 return
11256
11257 def pack(self):
11258 packed = []
11259 packed.append(struct.pack("!B", self.version))
11260 packed.append(struct.pack("!B", self.type))
11261 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11262 packed.append(struct.pack("!L", self.xid))
11263 packed.append(struct.pack("!H", self.command))
11264 packed.append(struct.pack("!B", self.group_type))
11265 packed.append('\x00' * 1)
11266 packed.append(struct.pack("!L", self.group_id))
11267 packed.append(loxi.generic_util.pack_list(self.buckets))
11268 length = sum([len(x) for x in packed])
11269 packed[2] = struct.pack("!H", length)
11270 return ''.join(packed)
11271
Rich Lane7dcdf022013-12-11 14:45:27 -080011272 @staticmethod
11273 def unpack(reader):
11274 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080011275 subclass = group_mod.subtypes.get(subtype)
11276 if subclass:
11277 return subclass.unpack(reader)
11278
11279 obj = group_mod()
11280 _version = reader.read("!B")[0]
11281 assert(_version == 4)
11282 _type = reader.read("!B")[0]
11283 assert(_type == 15)
11284 _length = reader.read("!H")[0]
11285 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011286 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080011287 obj.xid = reader.read("!L")[0]
11288 obj.command = reader.read("!H")[0]
11289 obj.group_type = reader.read("!B")[0]
11290 reader.skip(1)
11291 obj.group_id = reader.read("!L")[0]
11292 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11293 return obj
11294
11295 def __eq__(self, other):
11296 if type(self) != type(other): return False
11297 if self.xid != other.xid: return False
11298 if self.command != other.command: return False
11299 if self.group_type != other.group_type: return False
11300 if self.group_id != other.group_id: return False
11301 if self.buckets != other.buckets: return False
11302 return True
11303
11304 def pretty_print(self, q):
11305 q.text("group_mod {")
11306 with q.group():
11307 with q.indent(2):
11308 q.breakable()
11309 q.text("xid = ");
11310 if self.xid != None:
11311 q.text("%#x" % self.xid)
11312 else:
11313 q.text('None')
11314 q.text(","); q.breakable()
11315 q.text("group_type = ");
11316 q.text("%#x" % self.group_type)
11317 q.text(","); q.breakable()
11318 q.text("group_id = ");
11319 q.text("%#x" % self.group_id)
11320 q.text(","); q.breakable()
11321 q.text("buckets = ");
11322 q.pp(self.buckets)
11323 q.breakable()
11324 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011325
11326message.subtypes[15] = group_mod
11327
11328class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011329 version = 4
11330 type = 15
11331 command = 0
11332
11333 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011334 if xid != None:
11335 self.xid = xid
11336 else:
11337 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011338 if group_type != None:
11339 self.group_type = group_type
11340 else:
11341 self.group_type = 0
11342 if group_id != None:
11343 self.group_id = group_id
11344 else:
11345 self.group_id = 0
11346 if buckets != None:
11347 self.buckets = buckets
11348 else:
11349 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011350 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011351
11352 def pack(self):
11353 packed = []
11354 packed.append(struct.pack("!B", self.version))
11355 packed.append(struct.pack("!B", self.type))
11356 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11357 packed.append(struct.pack("!L", self.xid))
11358 packed.append(struct.pack("!H", self.command))
11359 packed.append(struct.pack("!B", self.group_type))
11360 packed.append('\x00' * 1)
11361 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011362 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011363 length = sum([len(x) for x in packed])
11364 packed[2] = struct.pack("!H", length)
11365 return ''.join(packed)
11366
11367 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011368 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011369 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080011370 _version = reader.read("!B")[0]
11371 assert(_version == 4)
11372 _type = reader.read("!B")[0]
11373 assert(_type == 15)
11374 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011375 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011376 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011377 obj.xid = reader.read("!L")[0]
11378 _command = reader.read("!H")[0]
11379 assert(_command == 0)
11380 obj.group_type = reader.read("!B")[0]
11381 reader.skip(1)
11382 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011383 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011384 return obj
11385
11386 def __eq__(self, other):
11387 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011388 if self.xid != other.xid: return False
11389 if self.group_type != other.group_type: return False
11390 if self.group_id != other.group_id: return False
11391 if self.buckets != other.buckets: return False
11392 return True
11393
Rich Lane7b0f2012013-11-22 14:15:26 -080011394 def pretty_print(self, q):
11395 q.text("group_add {")
11396 with q.group():
11397 with q.indent(2):
11398 q.breakable()
11399 q.text("xid = ");
11400 if self.xid != None:
11401 q.text("%#x" % self.xid)
11402 else:
11403 q.text('None')
11404 q.text(","); q.breakable()
11405 q.text("group_type = ");
11406 q.text("%#x" % self.group_type)
11407 q.text(","); q.breakable()
11408 q.text("group_id = ");
11409 q.text("%#x" % self.group_id)
11410 q.text(","); q.breakable()
11411 q.text("buckets = ");
11412 q.pp(self.buckets)
11413 q.breakable()
11414 q.text('}')
11415
Rich Lane7dcdf022013-12-11 14:45:27 -080011416group_mod.subtypes[0] = group_add
11417
11418class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011419 version = 4
11420 type = 15
11421 command = 2
11422
11423 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011424 if xid != None:
11425 self.xid = xid
11426 else:
11427 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011428 if group_type != None:
11429 self.group_type = group_type
11430 else:
11431 self.group_type = 0
11432 if group_id != None:
11433 self.group_id = group_id
11434 else:
11435 self.group_id = 0
11436 if buckets != None:
11437 self.buckets = buckets
11438 else:
11439 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011440 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011441
11442 def pack(self):
11443 packed = []
11444 packed.append(struct.pack("!B", self.version))
11445 packed.append(struct.pack("!B", self.type))
11446 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11447 packed.append(struct.pack("!L", self.xid))
11448 packed.append(struct.pack("!H", self.command))
11449 packed.append(struct.pack("!B", self.group_type))
11450 packed.append('\x00' * 1)
11451 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011452 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011453 length = sum([len(x) for x in packed])
11454 packed[2] = struct.pack("!H", length)
11455 return ''.join(packed)
11456
11457 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011458 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011459 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080011460 _version = reader.read("!B")[0]
11461 assert(_version == 4)
11462 _type = reader.read("!B")[0]
11463 assert(_type == 15)
11464 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011465 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011466 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011467 obj.xid = reader.read("!L")[0]
11468 _command = reader.read("!H")[0]
11469 assert(_command == 2)
11470 obj.group_type = reader.read("!B")[0]
11471 reader.skip(1)
11472 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011473 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011474 return obj
11475
11476 def __eq__(self, other):
11477 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011478 if self.xid != other.xid: return False
11479 if self.group_type != other.group_type: return False
11480 if self.group_id != other.group_id: return False
11481 if self.buckets != other.buckets: return False
11482 return True
11483
Rich Lane7b0f2012013-11-22 14:15:26 -080011484 def pretty_print(self, q):
11485 q.text("group_delete {")
11486 with q.group():
11487 with q.indent(2):
11488 q.breakable()
11489 q.text("xid = ");
11490 if self.xid != None:
11491 q.text("%#x" % self.xid)
11492 else:
11493 q.text('None')
11494 q.text(","); q.breakable()
11495 q.text("group_type = ");
11496 q.text("%#x" % self.group_type)
11497 q.text(","); q.breakable()
11498 q.text("group_id = ");
11499 q.text("%#x" % self.group_id)
11500 q.text(","); q.breakable()
11501 q.text("buckets = ");
11502 q.pp(self.buckets)
11503 q.breakable()
11504 q.text('}')
11505
Rich Lane7dcdf022013-12-11 14:45:27 -080011506group_mod.subtypes[2] = group_delete
11507
11508class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011509 version = 4
11510 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011511 stats_type = 7
11512
11513 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011514 if xid != None:
11515 self.xid = xid
11516 else:
11517 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011518 if flags != None:
11519 self.flags = flags
11520 else:
11521 self.flags = 0
11522 if entries != None:
11523 self.entries = entries
11524 else:
11525 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011526 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011527
11528 def pack(self):
11529 packed = []
11530 packed.append(struct.pack("!B", self.version))
11531 packed.append(struct.pack("!B", self.type))
11532 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11533 packed.append(struct.pack("!L", self.xid))
11534 packed.append(struct.pack("!H", self.stats_type))
11535 packed.append(struct.pack("!H", self.flags))
11536 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011537 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011538 length = sum([len(x) for x in packed])
11539 packed[2] = struct.pack("!H", length)
11540 return ''.join(packed)
11541
11542 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011543 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011544 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011545 _version = reader.read("!B")[0]
11546 assert(_version == 4)
11547 _type = reader.read("!B")[0]
11548 assert(_type == 19)
11549 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011550 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011551 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011552 obj.xid = reader.read("!L")[0]
11553 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011554 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011555 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011556 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011557 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011558 return obj
11559
11560 def __eq__(self, other):
11561 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011562 if self.xid != other.xid: return False
11563 if self.flags != other.flags: return False
11564 if self.entries != other.entries: return False
11565 return True
11566
Rich Lanec2ee4b82013-04-24 17:12:38 -070011567 def pretty_print(self, q):
11568 q.text("group_desc_stats_reply {")
11569 with q.group():
11570 with q.indent(2):
11571 q.breakable()
11572 q.text("xid = ");
11573 if self.xid != None:
11574 q.text("%#x" % self.xid)
11575 else:
11576 q.text('None')
11577 q.text(","); q.breakable()
11578 q.text("flags = ");
11579 q.text("%#x" % self.flags)
11580 q.text(","); q.breakable()
11581 q.text("entries = ");
11582 q.pp(self.entries)
11583 q.breakable()
11584 q.text('}')
11585
Rich Lane7dcdf022013-12-11 14:45:27 -080011586stats_reply.subtypes[7] = group_desc_stats_reply
11587
11588class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011589 version = 4
11590 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011591 stats_type = 7
11592
11593 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011594 if xid != None:
11595 self.xid = xid
11596 else:
11597 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011598 if flags != None:
11599 self.flags = flags
11600 else:
11601 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011602 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011603
11604 def pack(self):
11605 packed = []
11606 packed.append(struct.pack("!B", self.version))
11607 packed.append(struct.pack("!B", self.type))
11608 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11609 packed.append(struct.pack("!L", self.xid))
11610 packed.append(struct.pack("!H", self.stats_type))
11611 packed.append(struct.pack("!H", self.flags))
11612 packed.append('\x00' * 4)
11613 length = sum([len(x) for x in packed])
11614 packed[2] = struct.pack("!H", length)
11615 return ''.join(packed)
11616
11617 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011618 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011619 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011620 _version = reader.read("!B")[0]
11621 assert(_version == 4)
11622 _type = reader.read("!B")[0]
11623 assert(_type == 18)
11624 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011625 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011626 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011627 obj.xid = reader.read("!L")[0]
11628 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011629 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011630 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011631 reader.skip(4)
11632 return obj
11633
11634 def __eq__(self, other):
11635 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011636 if self.xid != other.xid: return False
11637 if self.flags != other.flags: return False
11638 return True
11639
Rich Lanec2ee4b82013-04-24 17:12:38 -070011640 def pretty_print(self, q):
11641 q.text("group_desc_stats_request {")
11642 with q.group():
11643 with q.indent(2):
11644 q.breakable()
11645 q.text("xid = ");
11646 if self.xid != None:
11647 q.text("%#x" % self.xid)
11648 else:
11649 q.text('None')
11650 q.text(","); q.breakable()
11651 q.text("flags = ");
11652 q.text("%#x" % self.flags)
11653 q.breakable()
11654 q.text('}')
11655
Rich Lane7dcdf022013-12-11 14:45:27 -080011656stats_request.subtypes[7] = group_desc_stats_request
11657
11658class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011659 version = 4
11660 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011661 stats_type = 8
11662
11663 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 -080011664 if xid != None:
11665 self.xid = xid
11666 else:
11667 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011668 if flags != None:
11669 self.flags = flags
11670 else:
11671 self.flags = 0
11672 if types != None:
11673 self.types = types
11674 else:
11675 self.types = 0
11676 if capabilities != None:
11677 self.capabilities = capabilities
11678 else:
11679 self.capabilities = 0
11680 if max_groups_all != None:
11681 self.max_groups_all = max_groups_all
11682 else:
11683 self.max_groups_all = 0
11684 if max_groups_select != None:
11685 self.max_groups_select = max_groups_select
11686 else:
11687 self.max_groups_select = 0
11688 if max_groups_indirect != None:
11689 self.max_groups_indirect = max_groups_indirect
11690 else:
11691 self.max_groups_indirect = 0
11692 if max_groups_ff != None:
11693 self.max_groups_ff = max_groups_ff
11694 else:
11695 self.max_groups_ff = 0
11696 if actions_all != None:
11697 self.actions_all = actions_all
11698 else:
11699 self.actions_all = 0
11700 if actions_select != None:
11701 self.actions_select = actions_select
11702 else:
11703 self.actions_select = 0
11704 if actions_indirect != None:
11705 self.actions_indirect = actions_indirect
11706 else:
11707 self.actions_indirect = 0
11708 if actions_ff != None:
11709 self.actions_ff = actions_ff
11710 else:
11711 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011712 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011713
11714 def pack(self):
11715 packed = []
11716 packed.append(struct.pack("!B", self.version))
11717 packed.append(struct.pack("!B", self.type))
11718 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11719 packed.append(struct.pack("!L", self.xid))
11720 packed.append(struct.pack("!H", self.stats_type))
11721 packed.append(struct.pack("!H", self.flags))
11722 packed.append('\x00' * 4)
11723 packed.append(struct.pack("!L", self.types))
11724 packed.append(struct.pack("!L", self.capabilities))
11725 packed.append(struct.pack("!L", self.max_groups_all))
11726 packed.append(struct.pack("!L", self.max_groups_select))
11727 packed.append(struct.pack("!L", self.max_groups_indirect))
11728 packed.append(struct.pack("!L", self.max_groups_ff))
11729 packed.append(struct.pack("!L", self.actions_all))
11730 packed.append(struct.pack("!L", self.actions_select))
11731 packed.append(struct.pack("!L", self.actions_indirect))
11732 packed.append(struct.pack("!L", self.actions_ff))
11733 length = sum([len(x) for x in packed])
11734 packed[2] = struct.pack("!H", length)
11735 return ''.join(packed)
11736
11737 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011738 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011739 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011740 _version = reader.read("!B")[0]
11741 assert(_version == 4)
11742 _type = reader.read("!B")[0]
11743 assert(_type == 19)
11744 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011745 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011746 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011747 obj.xid = reader.read("!L")[0]
11748 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011749 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011750 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011751 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011752 obj.types = reader.read("!L")[0]
11753 obj.capabilities = reader.read("!L")[0]
11754 obj.max_groups_all = reader.read("!L")[0]
11755 obj.max_groups_select = reader.read("!L")[0]
11756 obj.max_groups_indirect = reader.read("!L")[0]
11757 obj.max_groups_ff = reader.read("!L")[0]
11758 obj.actions_all = reader.read("!L")[0]
11759 obj.actions_select = reader.read("!L")[0]
11760 obj.actions_indirect = reader.read("!L")[0]
11761 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011762 return obj
11763
11764 def __eq__(self, other):
11765 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011766 if self.xid != other.xid: return False
11767 if self.flags != other.flags: return False
11768 if self.types != other.types: return False
11769 if self.capabilities != other.capabilities: return False
11770 if self.max_groups_all != other.max_groups_all: return False
11771 if self.max_groups_select != other.max_groups_select: return False
11772 if self.max_groups_indirect != other.max_groups_indirect: return False
11773 if self.max_groups_ff != other.max_groups_ff: return False
11774 if self.actions_all != other.actions_all: return False
11775 if self.actions_select != other.actions_select: return False
11776 if self.actions_indirect != other.actions_indirect: return False
11777 if self.actions_ff != other.actions_ff: return False
11778 return True
11779
Rich Lanec2ee4b82013-04-24 17:12:38 -070011780 def pretty_print(self, q):
11781 q.text("group_features_stats_reply {")
11782 with q.group():
11783 with q.indent(2):
11784 q.breakable()
11785 q.text("xid = ");
11786 if self.xid != None:
11787 q.text("%#x" % self.xid)
11788 else:
11789 q.text('None')
11790 q.text(","); q.breakable()
11791 q.text("flags = ");
11792 q.text("%#x" % self.flags)
11793 q.text(","); q.breakable()
11794 q.text("types = ");
11795 q.text("%#x" % self.types)
11796 q.text(","); q.breakable()
11797 q.text("capabilities = ");
11798 q.text("%#x" % self.capabilities)
11799 q.text(","); q.breakable()
11800 q.text("max_groups_all = ");
11801 q.text("%#x" % self.max_groups_all)
11802 q.text(","); q.breakable()
11803 q.text("max_groups_select = ");
11804 q.text("%#x" % self.max_groups_select)
11805 q.text(","); q.breakable()
11806 q.text("max_groups_indirect = ");
11807 q.text("%#x" % self.max_groups_indirect)
11808 q.text(","); q.breakable()
11809 q.text("max_groups_ff = ");
11810 q.text("%#x" % self.max_groups_ff)
11811 q.text(","); q.breakable()
11812 q.text("actions_all = ");
11813 q.text("%#x" % self.actions_all)
11814 q.text(","); q.breakable()
11815 q.text("actions_select = ");
11816 q.text("%#x" % self.actions_select)
11817 q.text(","); q.breakable()
11818 q.text("actions_indirect = ");
11819 q.text("%#x" % self.actions_indirect)
11820 q.text(","); q.breakable()
11821 q.text("actions_ff = ");
11822 q.text("%#x" % self.actions_ff)
11823 q.breakable()
11824 q.text('}')
11825
Rich Lane7dcdf022013-12-11 14:45:27 -080011826stats_reply.subtypes[8] = group_features_stats_reply
11827
11828class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011829 version = 4
11830 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011831 stats_type = 8
11832
11833 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011834 if xid != None:
11835 self.xid = xid
11836 else:
11837 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011838 if flags != None:
11839 self.flags = flags
11840 else:
11841 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011842 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011843
11844 def pack(self):
11845 packed = []
11846 packed.append(struct.pack("!B", self.version))
11847 packed.append(struct.pack("!B", self.type))
11848 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11849 packed.append(struct.pack("!L", self.xid))
11850 packed.append(struct.pack("!H", self.stats_type))
11851 packed.append(struct.pack("!H", self.flags))
11852 packed.append('\x00' * 4)
11853 length = sum([len(x) for x in packed])
11854 packed[2] = struct.pack("!H", length)
11855 return ''.join(packed)
11856
11857 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011858 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011859 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011860 _version = reader.read("!B")[0]
11861 assert(_version == 4)
11862 _type = reader.read("!B")[0]
11863 assert(_type == 18)
11864 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011865 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011866 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011867 obj.xid = reader.read("!L")[0]
11868 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011869 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011870 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011871 reader.skip(4)
11872 return obj
11873
11874 def __eq__(self, other):
11875 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011876 if self.xid != other.xid: return False
11877 if self.flags != other.flags: return False
11878 return True
11879
Rich Lanec2ee4b82013-04-24 17:12:38 -070011880 def pretty_print(self, q):
11881 q.text("group_features_stats_request {")
11882 with q.group():
11883 with q.indent(2):
11884 q.breakable()
11885 q.text("xid = ");
11886 if self.xid != None:
11887 q.text("%#x" % self.xid)
11888 else:
11889 q.text('None')
11890 q.text(","); q.breakable()
11891 q.text("flags = ");
11892 q.text("%#x" % self.flags)
11893 q.breakable()
11894 q.text('}')
11895
Rich Lane7dcdf022013-12-11 14:45:27 -080011896stats_request.subtypes[8] = group_features_stats_request
11897
11898class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011899 version = 4
11900 type = 1
11901 err_type = 6
11902
11903 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011904 if xid != None:
11905 self.xid = xid
11906 else:
11907 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011908 if code != None:
11909 self.code = code
11910 else:
11911 self.code = 0
11912 if data != None:
11913 self.data = data
11914 else:
11915 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011916 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011917
11918 def pack(self):
11919 packed = []
11920 packed.append(struct.pack("!B", self.version))
11921 packed.append(struct.pack("!B", self.type))
11922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11923 packed.append(struct.pack("!L", self.xid))
11924 packed.append(struct.pack("!H", self.err_type))
11925 packed.append(struct.pack("!H", self.code))
11926 packed.append(self.data)
11927 length = sum([len(x) for x in packed])
11928 packed[2] = struct.pack("!H", length)
11929 return ''.join(packed)
11930
11931 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011932 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011933 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011934 _version = reader.read("!B")[0]
11935 assert(_version == 4)
11936 _type = reader.read("!B")[0]
11937 assert(_type == 1)
11938 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011939 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011940 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070011941 obj.xid = reader.read("!L")[0]
11942 _err_type = reader.read("!H")[0]
11943 assert(_err_type == 6)
11944 obj.code = reader.read("!H")[0]
11945 obj.data = str(reader.read_all())
11946 return obj
11947
11948 def __eq__(self, other):
11949 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011950 if self.xid != other.xid: return False
11951 if self.code != other.code: return False
11952 if self.data != other.data: return False
11953 return True
11954
Rich Lane6f4978c2013-10-20 21:33:52 -070011955 def pretty_print(self, q):
11956 q.text("group_mod_failed_error_msg {")
11957 with q.group():
11958 with q.indent(2):
11959 q.breakable()
11960 q.text("xid = ");
11961 if self.xid != None:
11962 q.text("%#x" % self.xid)
11963 else:
11964 q.text('None')
11965 q.text(","); q.breakable()
11966 q.text("code = ");
11967 q.text("%#x" % self.code)
11968 q.text(","); q.breakable()
11969 q.text("data = ");
11970 q.pp(self.data)
11971 q.breakable()
11972 q.text('}')
11973
Rich Lane7dcdf022013-12-11 14:45:27 -080011974error_msg.subtypes[6] = group_mod_failed_error_msg
11975
11976class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011977 version = 4
11978 type = 15
11979 command = 1
11980
11981 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011982 if xid != None:
11983 self.xid = xid
11984 else:
11985 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011986 if group_type != None:
11987 self.group_type = group_type
11988 else:
11989 self.group_type = 0
11990 if group_id != None:
11991 self.group_id = group_id
11992 else:
11993 self.group_id = 0
11994 if buckets != None:
11995 self.buckets = buckets
11996 else:
11997 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011998 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011999
12000 def pack(self):
12001 packed = []
12002 packed.append(struct.pack("!B", self.version))
12003 packed.append(struct.pack("!B", self.type))
12004 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12005 packed.append(struct.pack("!L", self.xid))
12006 packed.append(struct.pack("!H", self.command))
12007 packed.append(struct.pack("!B", self.group_type))
12008 packed.append('\x00' * 1)
12009 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012010 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080012011 length = sum([len(x) for x in packed])
12012 packed[2] = struct.pack("!H", length)
12013 return ''.join(packed)
12014
12015 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012016 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080012017 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080012018 _version = reader.read("!B")[0]
12019 assert(_version == 4)
12020 _type = reader.read("!B")[0]
12021 assert(_type == 15)
12022 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012023 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012024 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080012025 obj.xid = reader.read("!L")[0]
12026 _command = reader.read("!H")[0]
12027 assert(_command == 1)
12028 obj.group_type = reader.read("!B")[0]
12029 reader.skip(1)
12030 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012031 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080012032 return obj
12033
12034 def __eq__(self, other):
12035 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080012036 if self.xid != other.xid: return False
12037 if self.group_type != other.group_type: return False
12038 if self.group_id != other.group_id: return False
12039 if self.buckets != other.buckets: return False
12040 return True
12041
Rich Lane7b0f2012013-11-22 14:15:26 -080012042 def pretty_print(self, q):
12043 q.text("group_modify {")
12044 with q.group():
12045 with q.indent(2):
12046 q.breakable()
12047 q.text("xid = ");
12048 if self.xid != None:
12049 q.text("%#x" % self.xid)
12050 else:
12051 q.text('None')
12052 q.text(","); q.breakable()
12053 q.text("group_type = ");
12054 q.text("%#x" % self.group_type)
12055 q.text(","); q.breakable()
12056 q.text("group_id = ");
12057 q.text("%#x" % self.group_id)
12058 q.text(","); q.breakable()
12059 q.text("buckets = ");
12060 q.pp(self.buckets)
12061 q.breakable()
12062 q.text('}')
12063
Rich Lane7dcdf022013-12-11 14:45:27 -080012064group_mod.subtypes[1] = group_modify
12065
12066class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012067 version = 4
12068 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012069 stats_type = 6
12070
12071 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012072 if xid != None:
12073 self.xid = xid
12074 else:
12075 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012076 if flags != None:
12077 self.flags = flags
12078 else:
12079 self.flags = 0
12080 if entries != None:
12081 self.entries = entries
12082 else:
12083 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012084 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012085
12086 def pack(self):
12087 packed = []
12088 packed.append(struct.pack("!B", self.version))
12089 packed.append(struct.pack("!B", self.type))
12090 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12091 packed.append(struct.pack("!L", self.xid))
12092 packed.append(struct.pack("!H", self.stats_type))
12093 packed.append(struct.pack("!H", self.flags))
12094 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012095 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012096 length = sum([len(x) for x in packed])
12097 packed[2] = struct.pack("!H", length)
12098 return ''.join(packed)
12099
12100 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012101 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012102 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012103 _version = reader.read("!B")[0]
12104 assert(_version == 4)
12105 _type = reader.read("!B")[0]
12106 assert(_type == 19)
12107 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012108 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012109 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012110 obj.xid = reader.read("!L")[0]
12111 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012112 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012113 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012114 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012115 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012116 return obj
12117
12118 def __eq__(self, other):
12119 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012120 if self.xid != other.xid: return False
12121 if self.flags != other.flags: return False
12122 if self.entries != other.entries: return False
12123 return True
12124
Rich Lanec2ee4b82013-04-24 17:12:38 -070012125 def pretty_print(self, q):
12126 q.text("group_stats_reply {")
12127 with q.group():
12128 with q.indent(2):
12129 q.breakable()
12130 q.text("xid = ");
12131 if self.xid != None:
12132 q.text("%#x" % self.xid)
12133 else:
12134 q.text('None')
12135 q.text(","); q.breakable()
12136 q.text("flags = ");
12137 q.text("%#x" % self.flags)
12138 q.text(","); q.breakable()
12139 q.text("entries = ");
12140 q.pp(self.entries)
12141 q.breakable()
12142 q.text('}')
12143
Rich Lane7dcdf022013-12-11 14:45:27 -080012144stats_reply.subtypes[6] = group_stats_reply
12145
12146class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012147 version = 4
12148 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012149 stats_type = 6
12150
12151 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012152 if xid != None:
12153 self.xid = xid
12154 else:
12155 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012156 if flags != None:
12157 self.flags = flags
12158 else:
12159 self.flags = 0
12160 if group_id != None:
12161 self.group_id = group_id
12162 else:
12163 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012164 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012165
12166 def pack(self):
12167 packed = []
12168 packed.append(struct.pack("!B", self.version))
12169 packed.append(struct.pack("!B", self.type))
12170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12171 packed.append(struct.pack("!L", self.xid))
12172 packed.append(struct.pack("!H", self.stats_type))
12173 packed.append(struct.pack("!H", self.flags))
12174 packed.append('\x00' * 4)
12175 packed.append(struct.pack("!L", self.group_id))
12176 packed.append('\x00' * 4)
12177 length = sum([len(x) for x in packed])
12178 packed[2] = struct.pack("!H", length)
12179 return ''.join(packed)
12180
12181 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012182 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012183 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012184 _version = reader.read("!B")[0]
12185 assert(_version == 4)
12186 _type = reader.read("!B")[0]
12187 assert(_type == 18)
12188 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012189 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012190 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012191 obj.xid = reader.read("!L")[0]
12192 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012193 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012194 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012195 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012196 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012197 reader.skip(4)
12198 return obj
12199
12200 def __eq__(self, other):
12201 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012202 if self.xid != other.xid: return False
12203 if self.flags != other.flags: return False
12204 if self.group_id != other.group_id: return False
12205 return True
12206
Rich Lanec2ee4b82013-04-24 17:12:38 -070012207 def pretty_print(self, q):
12208 q.text("group_stats_request {")
12209 with q.group():
12210 with q.indent(2):
12211 q.breakable()
12212 q.text("xid = ");
12213 if self.xid != None:
12214 q.text("%#x" % self.xid)
12215 else:
12216 q.text('None')
12217 q.text(","); q.breakable()
12218 q.text("flags = ");
12219 q.text("%#x" % self.flags)
12220 q.text(","); q.breakable()
12221 q.text("group_id = ");
12222 q.text("%#x" % self.group_id)
12223 q.breakable()
12224 q.text('}')
12225
Rich Lane7dcdf022013-12-11 14:45:27 -080012226stats_request.subtypes[6] = group_stats_request
12227
12228class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012229 version = 4
12230 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070012231
12232 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012233 if xid != None:
12234 self.xid = xid
12235 else:
12236 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012237 if elements != None:
12238 self.elements = elements
12239 else:
12240 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012241 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012242
12243 def pack(self):
12244 packed = []
12245 packed.append(struct.pack("!B", self.version))
12246 packed.append(struct.pack("!B", self.type))
12247 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12248 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080012249 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012250 length = sum([len(x) for x in packed])
12251 packed[2] = struct.pack("!H", length)
12252 return ''.join(packed)
12253
12254 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012255 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012256 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070012257 _version = reader.read("!B")[0]
12258 assert(_version == 4)
12259 _type = reader.read("!B")[0]
12260 assert(_type == 0)
12261 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012262 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012263 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012264 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080012265 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012266 return obj
12267
12268 def __eq__(self, other):
12269 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012270 if self.xid != other.xid: return False
12271 if self.elements != other.elements: return False
12272 return True
12273
Rich Lanec2ee4b82013-04-24 17:12:38 -070012274 def pretty_print(self, q):
12275 q.text("hello {")
12276 with q.group():
12277 with q.indent(2):
12278 q.breakable()
12279 q.text("xid = ");
12280 if self.xid != None:
12281 q.text("%#x" % self.xid)
12282 else:
12283 q.text('None')
12284 q.text(","); q.breakable()
12285 q.text("elements = ");
12286 q.pp(self.elements)
12287 q.breakable()
12288 q.text('}')
12289
Rich Lane7dcdf022013-12-11 14:45:27 -080012290message.subtypes[0] = hello
12291
12292class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012293 version = 4
12294 type = 1
12295 err_type = 0
12296
12297 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012298 if xid != None:
12299 self.xid = xid
12300 else:
12301 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012302 if code != None:
12303 self.code = code
12304 else:
12305 self.code = 0
12306 if data != None:
12307 self.data = data
12308 else:
12309 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012310 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012311
12312 def pack(self):
12313 packed = []
12314 packed.append(struct.pack("!B", self.version))
12315 packed.append(struct.pack("!B", self.type))
12316 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12317 packed.append(struct.pack("!L", self.xid))
12318 packed.append(struct.pack("!H", self.err_type))
12319 packed.append(struct.pack("!H", self.code))
12320 packed.append(self.data)
12321 length = sum([len(x) for x in packed])
12322 packed[2] = struct.pack("!H", length)
12323 return ''.join(packed)
12324
12325 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012326 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012327 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012328 _version = reader.read("!B")[0]
12329 assert(_version == 4)
12330 _type = reader.read("!B")[0]
12331 assert(_type == 1)
12332 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012333 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012334 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012335 obj.xid = reader.read("!L")[0]
12336 _err_type = reader.read("!H")[0]
12337 assert(_err_type == 0)
12338 obj.code = reader.read("!H")[0]
12339 obj.data = str(reader.read_all())
12340 return obj
12341
12342 def __eq__(self, other):
12343 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012344 if self.xid != other.xid: return False
12345 if self.code != other.code: return False
12346 if self.data != other.data: return False
12347 return True
12348
Rich Lane6f4978c2013-10-20 21:33:52 -070012349 def pretty_print(self, q):
12350 q.text("hello_failed_error_msg {")
12351 with q.group():
12352 with q.indent(2):
12353 q.breakable()
12354 q.text("xid = ");
12355 if self.xid != None:
12356 q.text("%#x" % self.xid)
12357 else:
12358 q.text('None')
12359 q.text(","); q.breakable()
12360 q.text("code = ");
12361 q.text("%#x" % self.code)
12362 q.text(","); q.breakable()
12363 q.text("data = ");
12364 q.pp(self.data)
12365 q.breakable()
12366 q.text('}')
12367
Rich Lane7dcdf022013-12-11 14:45:27 -080012368error_msg.subtypes[0] = hello_failed_error_msg
12369
12370class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012371 version = 4
12372 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012373 stats_type = 10
12374
12375 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012376 if xid != None:
12377 self.xid = xid
12378 else:
12379 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012380 if flags != None:
12381 self.flags = flags
12382 else:
12383 self.flags = 0
12384 if entries != None:
12385 self.entries = entries
12386 else:
12387 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012388 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012389
12390 def pack(self):
12391 packed = []
12392 packed.append(struct.pack("!B", self.version))
12393 packed.append(struct.pack("!B", self.type))
12394 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12395 packed.append(struct.pack("!L", self.xid))
12396 packed.append(struct.pack("!H", self.stats_type))
12397 packed.append(struct.pack("!H", self.flags))
12398 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012399 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012400 length = sum([len(x) for x in packed])
12401 packed[2] = struct.pack("!H", length)
12402 return ''.join(packed)
12403
12404 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012405 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012406 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012407 _version = reader.read("!B")[0]
12408 assert(_version == 4)
12409 _type = reader.read("!B")[0]
12410 assert(_type == 19)
12411 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012412 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012413 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012414 obj.xid = reader.read("!L")[0]
12415 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012416 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012417 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012418 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012419 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012420 return obj
12421
12422 def __eq__(self, other):
12423 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012424 if self.xid != other.xid: return False
12425 if self.flags != other.flags: return False
12426 if self.entries != other.entries: return False
12427 return True
12428
Rich Lanec2ee4b82013-04-24 17:12:38 -070012429 def pretty_print(self, q):
12430 q.text("meter_config_stats_reply {")
12431 with q.group():
12432 with q.indent(2):
12433 q.breakable()
12434 q.text("xid = ");
12435 if self.xid != None:
12436 q.text("%#x" % self.xid)
12437 else:
12438 q.text('None')
12439 q.text(","); q.breakable()
12440 q.text("flags = ");
12441 q.text("%#x" % self.flags)
12442 q.text(","); q.breakable()
12443 q.text("entries = ");
12444 q.pp(self.entries)
12445 q.breakable()
12446 q.text('}')
12447
Rich Lane7dcdf022013-12-11 14:45:27 -080012448stats_reply.subtypes[10] = meter_config_stats_reply
12449
12450class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012451 version = 4
12452 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012453 stats_type = 10
12454
12455 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012456 if xid != None:
12457 self.xid = xid
12458 else:
12459 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012460 if flags != None:
12461 self.flags = flags
12462 else:
12463 self.flags = 0
12464 if meter_id != None:
12465 self.meter_id = meter_id
12466 else:
12467 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012468 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012469
12470 def pack(self):
12471 packed = []
12472 packed.append(struct.pack("!B", self.version))
12473 packed.append(struct.pack("!B", self.type))
12474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12475 packed.append(struct.pack("!L", self.xid))
12476 packed.append(struct.pack("!H", self.stats_type))
12477 packed.append(struct.pack("!H", self.flags))
12478 packed.append('\x00' * 4)
12479 packed.append(struct.pack("!L", self.meter_id))
12480 packed.append('\x00' * 4)
12481 length = sum([len(x) for x in packed])
12482 packed[2] = struct.pack("!H", length)
12483 return ''.join(packed)
12484
12485 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012486 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012487 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012488 _version = reader.read("!B")[0]
12489 assert(_version == 4)
12490 _type = reader.read("!B")[0]
12491 assert(_type == 18)
12492 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012493 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012494 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012495 obj.xid = reader.read("!L")[0]
12496 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012497 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012498 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012499 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012500 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012501 reader.skip(4)
12502 return obj
12503
12504 def __eq__(self, other):
12505 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012506 if self.xid != other.xid: return False
12507 if self.flags != other.flags: return False
12508 if self.meter_id != other.meter_id: return False
12509 return True
12510
Rich Lanec2ee4b82013-04-24 17:12:38 -070012511 def pretty_print(self, q):
12512 q.text("meter_config_stats_request {")
12513 with q.group():
12514 with q.indent(2):
12515 q.breakable()
12516 q.text("xid = ");
12517 if self.xid != None:
12518 q.text("%#x" % self.xid)
12519 else:
12520 q.text('None')
12521 q.text(","); q.breakable()
12522 q.text("flags = ");
12523 q.text("%#x" % self.flags)
12524 q.text(","); q.breakable()
12525 q.text("meter_id = ");
12526 q.text("%#x" % self.meter_id)
12527 q.breakable()
12528 q.text('}')
12529
Rich Lane7dcdf022013-12-11 14:45:27 -080012530stats_request.subtypes[10] = meter_config_stats_request
12531
12532class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012533 version = 4
12534 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012535 stats_type = 11
12536
12537 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012538 if xid != None:
12539 self.xid = xid
12540 else:
12541 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012542 if flags != None:
12543 self.flags = flags
12544 else:
12545 self.flags = 0
12546 if features != None:
12547 self.features = features
12548 else:
12549 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080012550 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012551
12552 def pack(self):
12553 packed = []
12554 packed.append(struct.pack("!B", self.version))
12555 packed.append(struct.pack("!B", self.type))
12556 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12557 packed.append(struct.pack("!L", self.xid))
12558 packed.append(struct.pack("!H", self.stats_type))
12559 packed.append(struct.pack("!H", self.flags))
12560 packed.append('\x00' * 4)
12561 packed.append(self.features.pack())
12562 length = sum([len(x) for x in packed])
12563 packed[2] = struct.pack("!H", length)
12564 return ''.join(packed)
12565
12566 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012567 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012568 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012569 _version = reader.read("!B")[0]
12570 assert(_version == 4)
12571 _type = reader.read("!B")[0]
12572 assert(_type == 19)
12573 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012574 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012575 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012576 obj.xid = reader.read("!L")[0]
12577 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012578 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012579 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012580 reader.skip(4)
12581 obj.features = common.meter_features.unpack(reader)
12582 return obj
12583
12584 def __eq__(self, other):
12585 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012586 if self.xid != other.xid: return False
12587 if self.flags != other.flags: return False
12588 if self.features != other.features: return False
12589 return True
12590
Rich Lanec2ee4b82013-04-24 17:12:38 -070012591 def pretty_print(self, q):
12592 q.text("meter_features_stats_reply {")
12593 with q.group():
12594 with q.indent(2):
12595 q.breakable()
12596 q.text("xid = ");
12597 if self.xid != None:
12598 q.text("%#x" % self.xid)
12599 else:
12600 q.text('None')
12601 q.text(","); q.breakable()
12602 q.text("flags = ");
12603 q.text("%#x" % self.flags)
12604 q.text(","); q.breakable()
12605 q.text("features = ");
12606 q.pp(self.features)
12607 q.breakable()
12608 q.text('}')
12609
Rich Lane7dcdf022013-12-11 14:45:27 -080012610stats_reply.subtypes[11] = meter_features_stats_reply
12611
12612class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012613 version = 4
12614 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012615 stats_type = 11
12616
12617 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012618 if xid != None:
12619 self.xid = xid
12620 else:
12621 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012622 if flags != None:
12623 self.flags = flags
12624 else:
12625 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012626 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012627
12628 def pack(self):
12629 packed = []
12630 packed.append(struct.pack("!B", self.version))
12631 packed.append(struct.pack("!B", self.type))
12632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12633 packed.append(struct.pack("!L", self.xid))
12634 packed.append(struct.pack("!H", self.stats_type))
12635 packed.append(struct.pack("!H", self.flags))
12636 packed.append('\x00' * 4)
12637 length = sum([len(x) for x in packed])
12638 packed[2] = struct.pack("!H", length)
12639 return ''.join(packed)
12640
12641 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012642 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012643 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012644 _version = reader.read("!B")[0]
12645 assert(_version == 4)
12646 _type = reader.read("!B")[0]
12647 assert(_type == 18)
12648 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012649 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012650 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012651 obj.xid = reader.read("!L")[0]
12652 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012653 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012654 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012655 reader.skip(4)
12656 return obj
12657
12658 def __eq__(self, other):
12659 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012660 if self.xid != other.xid: return False
12661 if self.flags != other.flags: return False
12662 return True
12663
Rich Lanec2ee4b82013-04-24 17:12:38 -070012664 def pretty_print(self, q):
12665 q.text("meter_features_stats_request {")
12666 with q.group():
12667 with q.indent(2):
12668 q.breakable()
12669 q.text("xid = ");
12670 if self.xid != None:
12671 q.text("%#x" % self.xid)
12672 else:
12673 q.text('None')
12674 q.text(","); q.breakable()
12675 q.text("flags = ");
12676 q.text("%#x" % self.flags)
12677 q.breakable()
12678 q.text('}')
12679
Rich Lane7dcdf022013-12-11 14:45:27 -080012680stats_request.subtypes[11] = meter_features_stats_request
12681
12682class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012683 version = 4
12684 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070012685
12686 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012687 if xid != None:
12688 self.xid = xid
12689 else:
12690 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012691 if command != None:
12692 self.command = command
12693 else:
12694 self.command = 0
12695 if flags != None:
12696 self.flags = flags
12697 else:
12698 self.flags = 0
12699 if meter_id != None:
12700 self.meter_id = meter_id
12701 else:
12702 self.meter_id = 0
12703 if meters != None:
12704 self.meters = meters
12705 else:
12706 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012707 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012708
12709 def pack(self):
12710 packed = []
12711 packed.append(struct.pack("!B", self.version))
12712 packed.append(struct.pack("!B", self.type))
12713 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12714 packed.append(struct.pack("!L", self.xid))
12715 packed.append(struct.pack("!H", self.command))
12716 packed.append(struct.pack("!H", self.flags))
12717 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012718 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012719 length = sum([len(x) for x in packed])
12720 packed[2] = struct.pack("!H", length)
12721 return ''.join(packed)
12722
12723 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012724 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012725 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012726 _version = reader.read("!B")[0]
12727 assert(_version == 4)
12728 _type = reader.read("!B")[0]
12729 assert(_type == 29)
12730 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012731 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012732 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012733 obj.xid = reader.read("!L")[0]
12734 obj.command = reader.read("!H")[0]
12735 obj.flags = reader.read("!H")[0]
12736 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012737 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012738 return obj
12739
12740 def __eq__(self, other):
12741 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012742 if self.xid != other.xid: return False
12743 if self.command != other.command: return False
12744 if self.flags != other.flags: return False
12745 if self.meter_id != other.meter_id: return False
12746 if self.meters != other.meters: return False
12747 return True
12748
Rich Lanec2ee4b82013-04-24 17:12:38 -070012749 def pretty_print(self, q):
12750 q.text("meter_mod {")
12751 with q.group():
12752 with q.indent(2):
12753 q.breakable()
12754 q.text("xid = ");
12755 if self.xid != None:
12756 q.text("%#x" % self.xid)
12757 else:
12758 q.text('None')
12759 q.text(","); q.breakable()
12760 q.text("command = ");
12761 q.text("%#x" % self.command)
12762 q.text(","); q.breakable()
12763 q.text("flags = ");
12764 q.text("%#x" % self.flags)
12765 q.text(","); q.breakable()
12766 q.text("meter_id = ");
12767 q.text("%#x" % self.meter_id)
12768 q.text(","); q.breakable()
12769 q.text("meters = ");
12770 q.pp(self.meters)
12771 q.breakable()
12772 q.text('}')
12773
Rich Lane7dcdf022013-12-11 14:45:27 -080012774message.subtypes[29] = meter_mod
12775
12776class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012777 version = 4
12778 type = 1
12779 err_type = 12
12780
12781 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012782 if xid != None:
12783 self.xid = xid
12784 else:
12785 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012786 if code != None:
12787 self.code = code
12788 else:
12789 self.code = 0
12790 if data != None:
12791 self.data = data
12792 else:
12793 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012794 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012795
12796 def pack(self):
12797 packed = []
12798 packed.append(struct.pack("!B", self.version))
12799 packed.append(struct.pack("!B", self.type))
12800 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12801 packed.append(struct.pack("!L", self.xid))
12802 packed.append(struct.pack("!H", self.err_type))
12803 packed.append(struct.pack("!H", self.code))
12804 packed.append(self.data)
12805 length = sum([len(x) for x in packed])
12806 packed[2] = struct.pack("!H", length)
12807 return ''.join(packed)
12808
12809 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012810 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012811 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012812 _version = reader.read("!B")[0]
12813 assert(_version == 4)
12814 _type = reader.read("!B")[0]
12815 assert(_type == 1)
12816 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012817 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012818 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012819 obj.xid = reader.read("!L")[0]
12820 _err_type = reader.read("!H")[0]
12821 assert(_err_type == 12)
12822 obj.code = reader.read("!H")[0]
12823 obj.data = str(reader.read_all())
12824 return obj
12825
12826 def __eq__(self, other):
12827 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012828 if self.xid != other.xid: return False
12829 if self.code != other.code: return False
12830 if self.data != other.data: return False
12831 return True
12832
Rich Lane6f4978c2013-10-20 21:33:52 -070012833 def pretty_print(self, q):
12834 q.text("meter_mod_failed_error_msg {")
12835 with q.group():
12836 with q.indent(2):
12837 q.breakable()
12838 q.text("xid = ");
12839 if self.xid != None:
12840 q.text("%#x" % self.xid)
12841 else:
12842 q.text('None')
12843 q.text(","); q.breakable()
12844 q.text("code = ");
12845 q.text("%#x" % self.code)
12846 q.text(","); q.breakable()
12847 q.text("data = ");
12848 q.pp(self.data)
12849 q.breakable()
12850 q.text('}')
12851
Rich Lane7dcdf022013-12-11 14:45:27 -080012852error_msg.subtypes[12] = meter_mod_failed_error_msg
12853
12854class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012855 version = 4
12856 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012857 stats_type = 9
12858
12859 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012860 if xid != None:
12861 self.xid = xid
12862 else:
12863 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012864 if flags != None:
12865 self.flags = flags
12866 else:
12867 self.flags = 0
12868 if entries != None:
12869 self.entries = entries
12870 else:
12871 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012872 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012873
12874 def pack(self):
12875 packed = []
12876 packed.append(struct.pack("!B", self.version))
12877 packed.append(struct.pack("!B", self.type))
12878 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12879 packed.append(struct.pack("!L", self.xid))
12880 packed.append(struct.pack("!H", self.stats_type))
12881 packed.append(struct.pack("!H", self.flags))
12882 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012883 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012884 length = sum([len(x) for x in packed])
12885 packed[2] = struct.pack("!H", length)
12886 return ''.join(packed)
12887
12888 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012889 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012890 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012891 _version = reader.read("!B")[0]
12892 assert(_version == 4)
12893 _type = reader.read("!B")[0]
12894 assert(_type == 19)
12895 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012896 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012897 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012898 obj.xid = reader.read("!L")[0]
12899 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012900 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012901 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012902 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012903 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012904 return obj
12905
12906 def __eq__(self, other):
12907 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012908 if self.xid != other.xid: return False
12909 if self.flags != other.flags: return False
12910 if self.entries != other.entries: return False
12911 return True
12912
Rich Lanec2ee4b82013-04-24 17:12:38 -070012913 def pretty_print(self, q):
12914 q.text("meter_stats_reply {")
12915 with q.group():
12916 with q.indent(2):
12917 q.breakable()
12918 q.text("xid = ");
12919 if self.xid != None:
12920 q.text("%#x" % self.xid)
12921 else:
12922 q.text('None')
12923 q.text(","); q.breakable()
12924 q.text("flags = ");
12925 q.text("%#x" % self.flags)
12926 q.text(","); q.breakable()
12927 q.text("entries = ");
12928 q.pp(self.entries)
12929 q.breakable()
12930 q.text('}')
12931
Rich Lane7dcdf022013-12-11 14:45:27 -080012932stats_reply.subtypes[9] = meter_stats_reply
12933
12934class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012935 version = 4
12936 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012937 stats_type = 9
12938
12939 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012940 if xid != None:
12941 self.xid = xid
12942 else:
12943 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012944 if flags != None:
12945 self.flags = flags
12946 else:
12947 self.flags = 0
12948 if meter_id != None:
12949 self.meter_id = meter_id
12950 else:
12951 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012952 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012953
12954 def pack(self):
12955 packed = []
12956 packed.append(struct.pack("!B", self.version))
12957 packed.append(struct.pack("!B", self.type))
12958 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12959 packed.append(struct.pack("!L", self.xid))
12960 packed.append(struct.pack("!H", self.stats_type))
12961 packed.append(struct.pack("!H", self.flags))
12962 packed.append('\x00' * 4)
12963 packed.append(struct.pack("!L", self.meter_id))
12964 packed.append('\x00' * 4)
12965 length = sum([len(x) for x in packed])
12966 packed[2] = struct.pack("!H", length)
12967 return ''.join(packed)
12968
12969 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012970 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012971 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012972 _version = reader.read("!B")[0]
12973 assert(_version == 4)
12974 _type = reader.read("!B")[0]
12975 assert(_type == 18)
12976 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012977 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012978 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012979 obj.xid = reader.read("!L")[0]
12980 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012981 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012982 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012983 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012984 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012985 reader.skip(4)
12986 return obj
12987
12988 def __eq__(self, other):
12989 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012990 if self.xid != other.xid: return False
12991 if self.flags != other.flags: return False
12992 if self.meter_id != other.meter_id: return False
12993 return True
12994
Rich Lanec2ee4b82013-04-24 17:12:38 -070012995 def pretty_print(self, q):
12996 q.text("meter_stats_request {")
12997 with q.group():
12998 with q.indent(2):
12999 q.breakable()
13000 q.text("xid = ");
13001 if self.xid != None:
13002 q.text("%#x" % self.xid)
13003 else:
13004 q.text('None')
13005 q.text(","); q.breakable()
13006 q.text("flags = ");
13007 q.text("%#x" % self.flags)
13008 q.text(","); q.breakable()
13009 q.text("meter_id = ");
13010 q.text("%#x" % self.meter_id)
13011 q.breakable()
13012 q.text('}')
13013
Rich Lane7dcdf022013-12-11 14:45:27 -080013014stats_request.subtypes[9] = meter_stats_request
13015
13016class nicira_header(experimenter):
13017 subtypes = {}
13018
Rich Lane95f7fc92014-01-27 17:08:16 -080013019 version = 4
13020 type = 4
13021 experimenter = 8992
13022
13023 def __init__(self, xid=None, subtype=None):
13024 if xid != None:
13025 self.xid = xid
13026 else:
13027 self.xid = None
13028 if subtype != None:
13029 self.subtype = subtype
13030 else:
13031 self.subtype = 0
13032 return
13033
13034 def pack(self):
13035 packed = []
13036 packed.append(struct.pack("!B", self.version))
13037 packed.append(struct.pack("!B", self.type))
13038 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13039 packed.append(struct.pack("!L", self.xid))
13040 packed.append(struct.pack("!L", self.experimenter))
13041 packed.append(struct.pack("!L", self.subtype))
13042 length = sum([len(x) for x in packed])
13043 packed[2] = struct.pack("!H", length)
13044 return ''.join(packed)
13045
Rich Lane7dcdf022013-12-11 14:45:27 -080013046 @staticmethod
13047 def unpack(reader):
13048 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080013049 subclass = nicira_header.subtypes.get(subtype)
13050 if subclass:
13051 return subclass.unpack(reader)
13052
13053 obj = nicira_header()
13054 _version = reader.read("!B")[0]
13055 assert(_version == 4)
13056 _type = reader.read("!B")[0]
13057 assert(_type == 4)
13058 _length = reader.read("!H")[0]
13059 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013060 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080013061 obj.xid = reader.read("!L")[0]
13062 _experimenter = reader.read("!L")[0]
13063 assert(_experimenter == 8992)
13064 obj.subtype = reader.read("!L")[0]
13065 return obj
13066
13067 def __eq__(self, other):
13068 if type(self) != type(other): return False
13069 if self.xid != other.xid: return False
13070 if self.subtype != other.subtype: return False
13071 return True
13072
13073 def pretty_print(self, q):
13074 q.text("nicira_header {")
13075 with q.group():
13076 with q.indent(2):
13077 q.breakable()
13078 q.text("xid = ");
13079 if self.xid != None:
13080 q.text("%#x" % self.xid)
13081 else:
13082 q.text('None')
13083 q.breakable()
13084 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080013085
13086experimenter.subtypes[8992] = nicira_header
13087
13088class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013089 version = 4
13090 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070013091
13092 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 -080013093 if xid != None:
13094 self.xid = xid
13095 else:
13096 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013097 if buffer_id != None:
13098 self.buffer_id = buffer_id
13099 else:
13100 self.buffer_id = 0
13101 if total_len != None:
13102 self.total_len = total_len
13103 else:
13104 self.total_len = 0
13105 if reason != None:
13106 self.reason = reason
13107 else:
13108 self.reason = 0
13109 if table_id != None:
13110 self.table_id = table_id
13111 else:
13112 self.table_id = 0
13113 if cookie != None:
13114 self.cookie = cookie
13115 else:
13116 self.cookie = 0
13117 if match != None:
13118 self.match = match
13119 else:
13120 self.match = common.match()
13121 if data != None:
13122 self.data = data
13123 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013124 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013125 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013126
13127 def pack(self):
13128 packed = []
13129 packed.append(struct.pack("!B", self.version))
13130 packed.append(struct.pack("!B", self.type))
13131 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13132 packed.append(struct.pack("!L", self.xid))
13133 packed.append(struct.pack("!L", self.buffer_id))
13134 packed.append(struct.pack("!H", self.total_len))
13135 packed.append(struct.pack("!B", self.reason))
13136 packed.append(struct.pack("!B", self.table_id))
13137 packed.append(struct.pack("!Q", self.cookie))
13138 packed.append(self.match.pack())
13139 packed.append('\x00' * 2)
13140 packed.append(self.data)
13141 length = sum([len(x) for x in packed])
13142 packed[2] = struct.pack("!H", length)
13143 return ''.join(packed)
13144
13145 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013146 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013147 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070013148 _version = reader.read("!B")[0]
13149 assert(_version == 4)
13150 _type = reader.read("!B")[0]
13151 assert(_type == 10)
13152 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013153 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013154 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013155 obj.xid = reader.read("!L")[0]
13156 obj.buffer_id = reader.read("!L")[0]
13157 obj.total_len = reader.read("!H")[0]
13158 obj.reason = reader.read("!B")[0]
13159 obj.table_id = reader.read("!B")[0]
13160 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013161 obj.match = common.match.unpack(reader)
13162 reader.skip(2)
13163 obj.data = str(reader.read_all())
13164 return obj
13165
13166 def __eq__(self, other):
13167 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013168 if self.xid != other.xid: return False
13169 if self.buffer_id != other.buffer_id: return False
13170 if self.total_len != other.total_len: return False
13171 if self.reason != other.reason: return False
13172 if self.table_id != other.table_id: return False
13173 if self.cookie != other.cookie: return False
13174 if self.match != other.match: return False
13175 if self.data != other.data: return False
13176 return True
13177
Rich Lanec2ee4b82013-04-24 17:12:38 -070013178 def pretty_print(self, q):
13179 q.text("packet_in {")
13180 with q.group():
13181 with q.indent(2):
13182 q.breakable()
13183 q.text("xid = ");
13184 if self.xid != None:
13185 q.text("%#x" % self.xid)
13186 else:
13187 q.text('None')
13188 q.text(","); q.breakable()
13189 q.text("buffer_id = ");
13190 q.text("%#x" % self.buffer_id)
13191 q.text(","); q.breakable()
13192 q.text("total_len = ");
13193 q.text("%#x" % self.total_len)
13194 q.text(","); q.breakable()
13195 q.text("reason = ");
13196 q.text("%#x" % self.reason)
13197 q.text(","); q.breakable()
13198 q.text("table_id = ");
13199 q.text("%#x" % self.table_id)
13200 q.text(","); q.breakable()
13201 q.text("cookie = ");
13202 q.text("%#x" % self.cookie)
13203 q.text(","); q.breakable()
13204 q.text("match = ");
13205 q.pp(self.match)
13206 q.text(","); q.breakable()
13207 q.text("data = ");
13208 q.pp(self.data)
13209 q.breakable()
13210 q.text('}')
13211
Rich Lane7dcdf022013-12-11 14:45:27 -080013212message.subtypes[10] = packet_in
13213
13214class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013215 version = 4
13216 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070013217
13218 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013219 if xid != None:
13220 self.xid = xid
13221 else:
13222 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013223 if buffer_id != None:
13224 self.buffer_id = buffer_id
13225 else:
13226 self.buffer_id = 0
13227 if in_port != None:
13228 self.in_port = in_port
13229 else:
13230 self.in_port = 0
13231 if actions != None:
13232 self.actions = actions
13233 else:
13234 self.actions = []
13235 if data != None:
13236 self.data = data
13237 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013238 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013239 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013240
13241 def pack(self):
13242 packed = []
13243 packed.append(struct.pack("!B", self.version))
13244 packed.append(struct.pack("!B", self.type))
13245 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13246 packed.append(struct.pack("!L", self.xid))
13247 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070013248 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013249 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13250 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080013251 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013252 packed[6] = struct.pack("!H", len(packed[-1]))
13253 packed.append(self.data)
13254 length = sum([len(x) for x in packed])
13255 packed[2] = struct.pack("!H", length)
13256 return ''.join(packed)
13257
13258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013259 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013260 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070013261 _version = reader.read("!B")[0]
13262 assert(_version == 4)
13263 _type = reader.read("!B")[0]
13264 assert(_type == 13)
13265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013266 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013267 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013268 obj.xid = reader.read("!L")[0]
13269 obj.buffer_id = reader.read("!L")[0]
13270 obj.in_port = util.unpack_port_no(reader)
13271 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013272 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080013273 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013274 obj.data = str(reader.read_all())
13275 return obj
13276
13277 def __eq__(self, other):
13278 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013279 if self.xid != other.xid: return False
13280 if self.buffer_id != other.buffer_id: return False
13281 if self.in_port != other.in_port: return False
13282 if self.actions != other.actions: return False
13283 if self.data != other.data: return False
13284 return True
13285
Rich Lanec2ee4b82013-04-24 17:12:38 -070013286 def pretty_print(self, q):
13287 q.text("packet_out {")
13288 with q.group():
13289 with q.indent(2):
13290 q.breakable()
13291 q.text("xid = ");
13292 if self.xid != None:
13293 q.text("%#x" % self.xid)
13294 else:
13295 q.text('None')
13296 q.text(","); q.breakable()
13297 q.text("buffer_id = ");
13298 q.text("%#x" % self.buffer_id)
13299 q.text(","); q.breakable()
13300 q.text("in_port = ");
13301 q.text(util.pretty_port(self.in_port))
13302 q.text(","); q.breakable()
13303 q.text("actions = ");
13304 q.pp(self.actions)
13305 q.text(","); q.breakable()
13306 q.text("data = ");
13307 q.pp(self.data)
13308 q.breakable()
13309 q.text('}')
13310
Rich Lane7dcdf022013-12-11 14:45:27 -080013311message.subtypes[13] = packet_out
13312
13313class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013314 version = 4
13315 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013316 stats_type = 13
13317
13318 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013319 if xid != None:
13320 self.xid = xid
13321 else:
13322 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013323 if flags != None:
13324 self.flags = flags
13325 else:
13326 self.flags = 0
13327 if entries != None:
13328 self.entries = entries
13329 else:
13330 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013331 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013332
13333 def pack(self):
13334 packed = []
13335 packed.append(struct.pack("!B", self.version))
13336 packed.append(struct.pack("!B", self.type))
13337 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13338 packed.append(struct.pack("!L", self.xid))
13339 packed.append(struct.pack("!H", self.stats_type))
13340 packed.append(struct.pack("!H", self.flags))
13341 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013342 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013343 length = sum([len(x) for x in packed])
13344 packed[2] = struct.pack("!H", length)
13345 return ''.join(packed)
13346
13347 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013348 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013349 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013350 _version = reader.read("!B")[0]
13351 assert(_version == 4)
13352 _type = reader.read("!B")[0]
13353 assert(_type == 19)
13354 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013355 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013356 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013357 obj.xid = reader.read("!L")[0]
13358 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013359 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013360 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013361 reader.skip(4)
13362 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
13363 return obj
13364
13365 def __eq__(self, other):
13366 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013367 if self.xid != other.xid: return False
13368 if self.flags != other.flags: return False
13369 if self.entries != other.entries: return False
13370 return True
13371
Rich Lanec2ee4b82013-04-24 17:12:38 -070013372 def pretty_print(self, q):
13373 q.text("port_desc_stats_reply {")
13374 with q.group():
13375 with q.indent(2):
13376 q.breakable()
13377 q.text("xid = ");
13378 if self.xid != None:
13379 q.text("%#x" % self.xid)
13380 else:
13381 q.text('None')
13382 q.text(","); q.breakable()
13383 q.text("flags = ");
13384 q.text("%#x" % self.flags)
13385 q.text(","); q.breakable()
13386 q.text("entries = ");
13387 q.pp(self.entries)
13388 q.breakable()
13389 q.text('}')
13390
Rich Lane7dcdf022013-12-11 14:45:27 -080013391stats_reply.subtypes[13] = port_desc_stats_reply
13392
13393class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013394 version = 4
13395 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013396 stats_type = 13
13397
13398 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013399 if xid != None:
13400 self.xid = xid
13401 else:
13402 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013403 if flags != None:
13404 self.flags = flags
13405 else:
13406 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013407 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013408
13409 def pack(self):
13410 packed = []
13411 packed.append(struct.pack("!B", self.version))
13412 packed.append(struct.pack("!B", self.type))
13413 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13414 packed.append(struct.pack("!L", self.xid))
13415 packed.append(struct.pack("!H", self.stats_type))
13416 packed.append(struct.pack("!H", self.flags))
13417 packed.append('\x00' * 4)
13418 length = sum([len(x) for x in packed])
13419 packed[2] = struct.pack("!H", length)
13420 return ''.join(packed)
13421
13422 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013423 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013424 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013425 _version = reader.read("!B")[0]
13426 assert(_version == 4)
13427 _type = reader.read("!B")[0]
13428 assert(_type == 18)
13429 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013430 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013431 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013432 obj.xid = reader.read("!L")[0]
13433 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013434 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013435 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013436 reader.skip(4)
13437 return obj
13438
13439 def __eq__(self, other):
13440 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013441 if self.xid != other.xid: return False
13442 if self.flags != other.flags: return False
13443 return True
13444
Rich Lanec2ee4b82013-04-24 17:12:38 -070013445 def pretty_print(self, q):
13446 q.text("port_desc_stats_request {")
13447 with q.group():
13448 with q.indent(2):
13449 q.breakable()
13450 q.text("xid = ");
13451 if self.xid != None:
13452 q.text("%#x" % self.xid)
13453 else:
13454 q.text('None')
13455 q.text(","); q.breakable()
13456 q.text("flags = ");
13457 q.text("%#x" % self.flags)
13458 q.breakable()
13459 q.text('}')
13460
Rich Lane7dcdf022013-12-11 14:45:27 -080013461stats_request.subtypes[13] = port_desc_stats_request
13462
13463class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013464 version = 4
13465 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070013466
13467 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013468 if xid != None:
13469 self.xid = xid
13470 else:
13471 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013472 if port_no != None:
13473 self.port_no = port_no
13474 else:
13475 self.port_no = 0
13476 if hw_addr != None:
13477 self.hw_addr = hw_addr
13478 else:
13479 self.hw_addr = [0,0,0,0,0,0]
13480 if config != None:
13481 self.config = config
13482 else:
13483 self.config = 0
13484 if mask != None:
13485 self.mask = mask
13486 else:
13487 self.mask = 0
13488 if advertise != None:
13489 self.advertise = advertise
13490 else:
13491 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013492 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013493
13494 def pack(self):
13495 packed = []
13496 packed.append(struct.pack("!B", self.version))
13497 packed.append(struct.pack("!B", self.type))
13498 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13499 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013500 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013501 packed.append('\x00' * 4)
13502 packed.append(struct.pack("!6B", *self.hw_addr))
13503 packed.append('\x00' * 2)
13504 packed.append(struct.pack("!L", self.config))
13505 packed.append(struct.pack("!L", self.mask))
13506 packed.append(struct.pack("!L", self.advertise))
13507 packed.append('\x00' * 4)
13508 length = sum([len(x) for x in packed])
13509 packed[2] = struct.pack("!H", length)
13510 return ''.join(packed)
13511
13512 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013513 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013514 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013515 _version = reader.read("!B")[0]
13516 assert(_version == 4)
13517 _type = reader.read("!B")[0]
13518 assert(_type == 16)
13519 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013520 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013521 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013522 obj.xid = reader.read("!L")[0]
13523 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013524 reader.skip(4)
13525 obj.hw_addr = list(reader.read('!6B'))
13526 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070013527 obj.config = reader.read("!L")[0]
13528 obj.mask = reader.read("!L")[0]
13529 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013530 reader.skip(4)
13531 return obj
13532
13533 def __eq__(self, other):
13534 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013535 if self.xid != other.xid: return False
13536 if self.port_no != other.port_no: return False
13537 if self.hw_addr != other.hw_addr: return False
13538 if self.config != other.config: return False
13539 if self.mask != other.mask: return False
13540 if self.advertise != other.advertise: return False
13541 return True
13542
Rich Lanec2ee4b82013-04-24 17:12:38 -070013543 def pretty_print(self, q):
13544 q.text("port_mod {")
13545 with q.group():
13546 with q.indent(2):
13547 q.breakable()
13548 q.text("xid = ");
13549 if self.xid != None:
13550 q.text("%#x" % self.xid)
13551 else:
13552 q.text('None')
13553 q.text(","); q.breakable()
13554 q.text("port_no = ");
13555 q.text(util.pretty_port(self.port_no))
13556 q.text(","); q.breakable()
13557 q.text("hw_addr = ");
13558 q.text(util.pretty_mac(self.hw_addr))
13559 q.text(","); q.breakable()
13560 q.text("config = ");
13561 q.text("%#x" % self.config)
13562 q.text(","); q.breakable()
13563 q.text("mask = ");
13564 q.text("%#x" % self.mask)
13565 q.text(","); q.breakable()
13566 q.text("advertise = ");
13567 q.text("%#x" % self.advertise)
13568 q.breakable()
13569 q.text('}')
13570
Rich Lane7dcdf022013-12-11 14:45:27 -080013571message.subtypes[16] = port_mod
13572
13573class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013574 version = 4
13575 type = 1
13576 err_type = 7
13577
13578 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013579 if xid != None:
13580 self.xid = xid
13581 else:
13582 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013583 if code != None:
13584 self.code = code
13585 else:
13586 self.code = 0
13587 if data != None:
13588 self.data = data
13589 else:
13590 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013591 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013592
13593 def pack(self):
13594 packed = []
13595 packed.append(struct.pack("!B", self.version))
13596 packed.append(struct.pack("!B", self.type))
13597 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13598 packed.append(struct.pack("!L", self.xid))
13599 packed.append(struct.pack("!H", self.err_type))
13600 packed.append(struct.pack("!H", self.code))
13601 packed.append(self.data)
13602 length = sum([len(x) for x in packed])
13603 packed[2] = struct.pack("!H", length)
13604 return ''.join(packed)
13605
13606 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013607 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013608 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013609 _version = reader.read("!B")[0]
13610 assert(_version == 4)
13611 _type = reader.read("!B")[0]
13612 assert(_type == 1)
13613 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013614 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013615 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070013616 obj.xid = reader.read("!L")[0]
13617 _err_type = reader.read("!H")[0]
13618 assert(_err_type == 7)
13619 obj.code = reader.read("!H")[0]
13620 obj.data = str(reader.read_all())
13621 return obj
13622
13623 def __eq__(self, other):
13624 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013625 if self.xid != other.xid: return False
13626 if self.code != other.code: return False
13627 if self.data != other.data: return False
13628 return True
13629
Rich Lane6f4978c2013-10-20 21:33:52 -070013630 def pretty_print(self, q):
13631 q.text("port_mod_failed_error_msg {")
13632 with q.group():
13633 with q.indent(2):
13634 q.breakable()
13635 q.text("xid = ");
13636 if self.xid != None:
13637 q.text("%#x" % self.xid)
13638 else:
13639 q.text('None')
13640 q.text(","); q.breakable()
13641 q.text("code = ");
13642 q.text("%#x" % self.code)
13643 q.text(","); q.breakable()
13644 q.text("data = ");
13645 q.pp(self.data)
13646 q.breakable()
13647 q.text('}')
13648
Rich Lane7dcdf022013-12-11 14:45:27 -080013649error_msg.subtypes[7] = port_mod_failed_error_msg
13650
13651class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013652 version = 4
13653 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013654 stats_type = 4
13655
13656 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013657 if xid != None:
13658 self.xid = xid
13659 else:
13660 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013661 if flags != None:
13662 self.flags = flags
13663 else:
13664 self.flags = 0
13665 if entries != None:
13666 self.entries = entries
13667 else:
13668 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013669 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013670
13671 def pack(self):
13672 packed = []
13673 packed.append(struct.pack("!B", self.version))
13674 packed.append(struct.pack("!B", self.type))
13675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13676 packed.append(struct.pack("!L", self.xid))
13677 packed.append(struct.pack("!H", self.stats_type))
13678 packed.append(struct.pack("!H", self.flags))
13679 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013680 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013681 length = sum([len(x) for x in packed])
13682 packed[2] = struct.pack("!H", length)
13683 return ''.join(packed)
13684
13685 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013686 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013687 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013688 _version = reader.read("!B")[0]
13689 assert(_version == 4)
13690 _type = reader.read("!B")[0]
13691 assert(_type == 19)
13692 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013693 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013694 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013695 obj.xid = reader.read("!L")[0]
13696 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013697 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013698 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013699 reader.skip(4)
13700 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13701 return obj
13702
13703 def __eq__(self, other):
13704 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013705 if self.xid != other.xid: return False
13706 if self.flags != other.flags: return False
13707 if self.entries != other.entries: return False
13708 return True
13709
Rich Lanec2ee4b82013-04-24 17:12:38 -070013710 def pretty_print(self, q):
13711 q.text("port_stats_reply {")
13712 with q.group():
13713 with q.indent(2):
13714 q.breakable()
13715 q.text("xid = ");
13716 if self.xid != None:
13717 q.text("%#x" % self.xid)
13718 else:
13719 q.text('None')
13720 q.text(","); q.breakable()
13721 q.text("flags = ");
13722 q.text("%#x" % self.flags)
13723 q.text(","); q.breakable()
13724 q.text("entries = ");
13725 q.pp(self.entries)
13726 q.breakable()
13727 q.text('}')
13728
Rich Lane7dcdf022013-12-11 14:45:27 -080013729stats_reply.subtypes[4] = port_stats_reply
13730
13731class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013732 version = 4
13733 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013734 stats_type = 4
13735
13736 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013737 if xid != None:
13738 self.xid = xid
13739 else:
13740 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013741 if flags != None:
13742 self.flags = flags
13743 else:
13744 self.flags = 0
13745 if port_no != None:
13746 self.port_no = port_no
13747 else:
13748 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013749 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013750
13751 def pack(self):
13752 packed = []
13753 packed.append(struct.pack("!B", self.version))
13754 packed.append(struct.pack("!B", self.type))
13755 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13756 packed.append(struct.pack("!L", self.xid))
13757 packed.append(struct.pack("!H", self.stats_type))
13758 packed.append(struct.pack("!H", self.flags))
13759 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013760 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013761 packed.append('\x00' * 4)
13762 length = sum([len(x) for x in packed])
13763 packed[2] = struct.pack("!H", length)
13764 return ''.join(packed)
13765
13766 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013767 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013768 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013769 _version = reader.read("!B")[0]
13770 assert(_version == 4)
13771 _type = reader.read("!B")[0]
13772 assert(_type == 18)
13773 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013774 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013775 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013776 obj.xid = reader.read("!L")[0]
13777 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013778 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013779 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013780 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013781 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013782 reader.skip(4)
13783 return obj
13784
13785 def __eq__(self, other):
13786 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013787 if self.xid != other.xid: return False
13788 if self.flags != other.flags: return False
13789 if self.port_no != other.port_no: return False
13790 return True
13791
Rich Lanec2ee4b82013-04-24 17:12:38 -070013792 def pretty_print(self, q):
13793 q.text("port_stats_request {")
13794 with q.group():
13795 with q.indent(2):
13796 q.breakable()
13797 q.text("xid = ");
13798 if self.xid != None:
13799 q.text("%#x" % self.xid)
13800 else:
13801 q.text('None')
13802 q.text(","); q.breakable()
13803 q.text("flags = ");
13804 q.text("%#x" % self.flags)
13805 q.text(","); q.breakable()
13806 q.text("port_no = ");
13807 q.text(util.pretty_port(self.port_no))
13808 q.breakable()
13809 q.text('}')
13810
Rich Lane7dcdf022013-12-11 14:45:27 -080013811stats_request.subtypes[4] = port_stats_request
13812
13813class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013814 version = 4
13815 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070013816
13817 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013818 if xid != None:
13819 self.xid = xid
13820 else:
13821 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013822 if reason != None:
13823 self.reason = reason
13824 else:
13825 self.reason = 0
13826 if desc != None:
13827 self.desc = desc
13828 else:
13829 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080013830 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013831
13832 def pack(self):
13833 packed = []
13834 packed.append(struct.pack("!B", self.version))
13835 packed.append(struct.pack("!B", self.type))
13836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13837 packed.append(struct.pack("!L", self.xid))
13838 packed.append(struct.pack("!B", self.reason))
13839 packed.append('\x00' * 7)
13840 packed.append(self.desc.pack())
13841 length = sum([len(x) for x in packed])
13842 packed[2] = struct.pack("!H", length)
13843 return ''.join(packed)
13844
13845 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013846 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013847 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070013848 _version = reader.read("!B")[0]
13849 assert(_version == 4)
13850 _type = reader.read("!B")[0]
13851 assert(_type == 12)
13852 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013853 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013854 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013855 obj.xid = reader.read("!L")[0]
13856 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013857 reader.skip(7)
13858 obj.desc = common.port_desc.unpack(reader)
13859 return obj
13860
13861 def __eq__(self, other):
13862 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013863 if self.xid != other.xid: return False
13864 if self.reason != other.reason: return False
13865 if self.desc != other.desc: return False
13866 return True
13867
Rich Lanec2ee4b82013-04-24 17:12:38 -070013868 def pretty_print(self, q):
13869 q.text("port_status {")
13870 with q.group():
13871 with q.indent(2):
13872 q.breakable()
13873 q.text("xid = ");
13874 if self.xid != None:
13875 q.text("%#x" % self.xid)
13876 else:
13877 q.text('None')
13878 q.text(","); q.breakable()
13879 q.text("reason = ");
13880 q.text("%#x" % self.reason)
13881 q.text(","); q.breakable()
13882 q.text("desc = ");
13883 q.pp(self.desc)
13884 q.breakable()
13885 q.text('}')
13886
Rich Lane7dcdf022013-12-11 14:45:27 -080013887message.subtypes[12] = port_status
13888
13889class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013890 version = 4
13891 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070013892
13893 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013894 if xid != None:
13895 self.xid = xid
13896 else:
13897 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013898 if port != None:
13899 self.port = port
13900 else:
13901 self.port = 0
13902 if queues != None:
13903 self.queues = queues
13904 else:
13905 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013906 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013907
13908 def pack(self):
13909 packed = []
13910 packed.append(struct.pack("!B", self.version))
13911 packed.append(struct.pack("!B", self.type))
13912 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13913 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013914 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013915 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013916 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013917 length = sum([len(x) for x in packed])
13918 packed[2] = struct.pack("!H", length)
13919 return ''.join(packed)
13920
13921 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013922 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013923 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013924 _version = reader.read("!B")[0]
13925 assert(_version == 4)
13926 _type = reader.read("!B")[0]
13927 assert(_type == 23)
13928 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013929 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013930 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013931 obj.xid = reader.read("!L")[0]
13932 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013933 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013934 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013935 return obj
13936
13937 def __eq__(self, other):
13938 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013939 if self.xid != other.xid: return False
13940 if self.port != other.port: return False
13941 if self.queues != other.queues: return False
13942 return True
13943
Rich Lanec2ee4b82013-04-24 17:12:38 -070013944 def pretty_print(self, q):
13945 q.text("queue_get_config_reply {")
13946 with q.group():
13947 with q.indent(2):
13948 q.breakable()
13949 q.text("xid = ");
13950 if self.xid != None:
13951 q.text("%#x" % self.xid)
13952 else:
13953 q.text('None')
13954 q.text(","); q.breakable()
13955 q.text("port = ");
13956 q.text(util.pretty_port(self.port))
13957 q.text(","); q.breakable()
13958 q.text("queues = ");
13959 q.pp(self.queues)
13960 q.breakable()
13961 q.text('}')
13962
Rich Lane7dcdf022013-12-11 14:45:27 -080013963message.subtypes[23] = queue_get_config_reply
13964
13965class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013966 version = 4
13967 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070013968
13969 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013970 if xid != None:
13971 self.xid = xid
13972 else:
13973 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013974 if port != None:
13975 self.port = port
13976 else:
13977 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013978 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013979
13980 def pack(self):
13981 packed = []
13982 packed.append(struct.pack("!B", self.version))
13983 packed.append(struct.pack("!B", self.type))
13984 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13985 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013986 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013987 packed.append('\x00' * 4)
13988 length = sum([len(x) for x in packed])
13989 packed[2] = struct.pack("!H", length)
13990 return ''.join(packed)
13991
13992 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013993 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013994 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013995 _version = reader.read("!B")[0]
13996 assert(_version == 4)
13997 _type = reader.read("!B")[0]
13998 assert(_type == 22)
13999 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014000 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014001 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014002 obj.xid = reader.read("!L")[0]
14003 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014004 reader.skip(4)
14005 return obj
14006
14007 def __eq__(self, other):
14008 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014009 if self.xid != other.xid: return False
14010 if self.port != other.port: return False
14011 return True
14012
Rich Lanec2ee4b82013-04-24 17:12:38 -070014013 def pretty_print(self, q):
14014 q.text("queue_get_config_request {")
14015 with q.group():
14016 with q.indent(2):
14017 q.breakable()
14018 q.text("xid = ");
14019 if self.xid != None:
14020 q.text("%#x" % self.xid)
14021 else:
14022 q.text('None')
14023 q.text(","); q.breakable()
14024 q.text("port = ");
14025 q.text(util.pretty_port(self.port))
14026 q.breakable()
14027 q.text('}')
14028
Rich Lane7dcdf022013-12-11 14:45:27 -080014029message.subtypes[22] = queue_get_config_request
14030
14031class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014032 version = 4
14033 type = 1
14034 err_type = 9
14035
14036 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014037 if xid != None:
14038 self.xid = xid
14039 else:
14040 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014041 if code != None:
14042 self.code = code
14043 else:
14044 self.code = 0
14045 if data != None:
14046 self.data = data
14047 else:
14048 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014049 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014050
14051 def pack(self):
14052 packed = []
14053 packed.append(struct.pack("!B", self.version))
14054 packed.append(struct.pack("!B", self.type))
14055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14056 packed.append(struct.pack("!L", self.xid))
14057 packed.append(struct.pack("!H", self.err_type))
14058 packed.append(struct.pack("!H", self.code))
14059 packed.append(self.data)
14060 length = sum([len(x) for x in packed])
14061 packed[2] = struct.pack("!H", length)
14062 return ''.join(packed)
14063
14064 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014065 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014066 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014067 _version = reader.read("!B")[0]
14068 assert(_version == 4)
14069 _type = reader.read("!B")[0]
14070 assert(_type == 1)
14071 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014072 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014073 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014074 obj.xid = reader.read("!L")[0]
14075 _err_type = reader.read("!H")[0]
14076 assert(_err_type == 9)
14077 obj.code = reader.read("!H")[0]
14078 obj.data = str(reader.read_all())
14079 return obj
14080
14081 def __eq__(self, other):
14082 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014083 if self.xid != other.xid: return False
14084 if self.code != other.code: return False
14085 if self.data != other.data: return False
14086 return True
14087
Rich Lane6f4978c2013-10-20 21:33:52 -070014088 def pretty_print(self, q):
14089 q.text("queue_op_failed_error_msg {")
14090 with q.group():
14091 with q.indent(2):
14092 q.breakable()
14093 q.text("xid = ");
14094 if self.xid != None:
14095 q.text("%#x" % self.xid)
14096 else:
14097 q.text('None')
14098 q.text(","); q.breakable()
14099 q.text("code = ");
14100 q.text("%#x" % self.code)
14101 q.text(","); q.breakable()
14102 q.text("data = ");
14103 q.pp(self.data)
14104 q.breakable()
14105 q.text('}')
14106
Rich Lane7dcdf022013-12-11 14:45:27 -080014107error_msg.subtypes[9] = queue_op_failed_error_msg
14108
14109class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014110 version = 4
14111 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014112 stats_type = 5
14113
14114 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014115 if xid != None:
14116 self.xid = xid
14117 else:
14118 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014119 if flags != None:
14120 self.flags = flags
14121 else:
14122 self.flags = 0
14123 if entries != None:
14124 self.entries = entries
14125 else:
14126 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014127 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014128
14129 def pack(self):
14130 packed = []
14131 packed.append(struct.pack("!B", self.version))
14132 packed.append(struct.pack("!B", self.type))
14133 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14134 packed.append(struct.pack("!L", self.xid))
14135 packed.append(struct.pack("!H", self.stats_type))
14136 packed.append(struct.pack("!H", self.flags))
14137 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014138 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014139 length = sum([len(x) for x in packed])
14140 packed[2] = struct.pack("!H", length)
14141 return ''.join(packed)
14142
14143 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014144 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014145 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014146 _version = reader.read("!B")[0]
14147 assert(_version == 4)
14148 _type = reader.read("!B")[0]
14149 assert(_type == 19)
14150 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014151 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014152 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014153 obj.xid = reader.read("!L")[0]
14154 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014155 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014156 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014157 reader.skip(4)
14158 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
14159 return obj
14160
14161 def __eq__(self, other):
14162 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014163 if self.xid != other.xid: return False
14164 if self.flags != other.flags: return False
14165 if self.entries != other.entries: return False
14166 return True
14167
Rich Lanec2ee4b82013-04-24 17:12:38 -070014168 def pretty_print(self, q):
14169 q.text("queue_stats_reply {")
14170 with q.group():
14171 with q.indent(2):
14172 q.breakable()
14173 q.text("xid = ");
14174 if self.xid != None:
14175 q.text("%#x" % self.xid)
14176 else:
14177 q.text('None')
14178 q.text(","); q.breakable()
14179 q.text("flags = ");
14180 q.text("%#x" % self.flags)
14181 q.text(","); q.breakable()
14182 q.text("entries = ");
14183 q.pp(self.entries)
14184 q.breakable()
14185 q.text('}')
14186
Rich Lane7dcdf022013-12-11 14:45:27 -080014187stats_reply.subtypes[5] = queue_stats_reply
14188
14189class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014190 version = 4
14191 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014192 stats_type = 5
14193
14194 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014195 if xid != None:
14196 self.xid = xid
14197 else:
14198 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014199 if flags != None:
14200 self.flags = flags
14201 else:
14202 self.flags = 0
14203 if port_no != None:
14204 self.port_no = port_no
14205 else:
14206 self.port_no = 0
14207 if queue_id != None:
14208 self.queue_id = queue_id
14209 else:
14210 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014211 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014212
14213 def pack(self):
14214 packed = []
14215 packed.append(struct.pack("!B", self.version))
14216 packed.append(struct.pack("!B", self.type))
14217 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14218 packed.append(struct.pack("!L", self.xid))
14219 packed.append(struct.pack("!H", self.stats_type))
14220 packed.append(struct.pack("!H", self.flags))
14221 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014222 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014223 packed.append(struct.pack("!L", self.queue_id))
14224 length = sum([len(x) for x in packed])
14225 packed[2] = struct.pack("!H", length)
14226 return ''.join(packed)
14227
14228 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014229 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014230 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014231 _version = reader.read("!B")[0]
14232 assert(_version == 4)
14233 _type = reader.read("!B")[0]
14234 assert(_type == 18)
14235 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014236 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014237 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014238 obj.xid = reader.read("!L")[0]
14239 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014240 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014241 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014242 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014243 obj.port_no = util.unpack_port_no(reader)
14244 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014245 return obj
14246
14247 def __eq__(self, other):
14248 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014249 if self.xid != other.xid: return False
14250 if self.flags != other.flags: return False
14251 if self.port_no != other.port_no: return False
14252 if self.queue_id != other.queue_id: return False
14253 return True
14254
Rich Lanec2ee4b82013-04-24 17:12:38 -070014255 def pretty_print(self, q):
14256 q.text("queue_stats_request {")
14257 with q.group():
14258 with q.indent(2):
14259 q.breakable()
14260 q.text("xid = ");
14261 if self.xid != None:
14262 q.text("%#x" % self.xid)
14263 else:
14264 q.text('None')
14265 q.text(","); q.breakable()
14266 q.text("flags = ");
14267 q.text("%#x" % self.flags)
14268 q.text(","); q.breakable()
14269 q.text("port_no = ");
14270 q.text(util.pretty_port(self.port_no))
14271 q.text(","); q.breakable()
14272 q.text("queue_id = ");
14273 q.text("%#x" % self.queue_id)
14274 q.breakable()
14275 q.text('}')
14276
Rich Lane7dcdf022013-12-11 14:45:27 -080014277stats_request.subtypes[5] = queue_stats_request
14278
14279class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014280 version = 4
14281 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070014282
Rich Laned9e3f7b2013-11-04 11:40:43 -080014283 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014284 if xid != None:
14285 self.xid = xid
14286 else:
14287 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080014288 if role != None:
14289 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070014290 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080014291 self.role = 0
14292 if generation_id != None:
14293 self.generation_id = generation_id
14294 else:
14295 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014296 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014297
14298 def pack(self):
14299 packed = []
14300 packed.append(struct.pack("!B", self.version))
14301 packed.append(struct.pack("!B", self.type))
14302 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14303 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080014304 packed.append(struct.pack("!L", self.role))
14305 packed.append('\x00' * 4)
14306 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014307 length = sum([len(x) for x in packed])
14308 packed[2] = struct.pack("!H", length)
14309 return ''.join(packed)
14310
14311 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014312 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014313 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014314 _version = reader.read("!B")[0]
14315 assert(_version == 4)
14316 _type = reader.read("!B")[0]
14317 assert(_type == 25)
14318 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014319 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014320 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014321 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080014322 obj.role = reader.read("!L")[0]
14323 reader.skip(4)
14324 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014325 return obj
14326
14327 def __eq__(self, other):
14328 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014329 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080014330 if self.role != other.role: return False
14331 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014332 return True
14333
Rich Lanec2ee4b82013-04-24 17:12:38 -070014334 def pretty_print(self, q):
14335 q.text("role_reply {")
14336 with q.group():
14337 with q.indent(2):
14338 q.breakable()
14339 q.text("xid = ");
14340 if self.xid != None:
14341 q.text("%#x" % self.xid)
14342 else:
14343 q.text('None')
14344 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080014345 q.text("role = ");
14346 q.text("%#x" % self.role)
14347 q.text(","); q.breakable()
14348 q.text("generation_id = ");
14349 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014350 q.breakable()
14351 q.text('}')
14352
Rich Lane7dcdf022013-12-11 14:45:27 -080014353message.subtypes[25] = role_reply
14354
14355class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014356 version = 4
14357 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070014358
14359 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014360 if xid != None:
14361 self.xid = xid
14362 else:
14363 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014364 if role != None:
14365 self.role = role
14366 else:
14367 self.role = 0
14368 if generation_id != None:
14369 self.generation_id = generation_id
14370 else:
14371 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014372 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014373
14374 def pack(self):
14375 packed = []
14376 packed.append(struct.pack("!B", self.version))
14377 packed.append(struct.pack("!B", self.type))
14378 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14379 packed.append(struct.pack("!L", self.xid))
14380 packed.append(struct.pack("!L", self.role))
14381 packed.append('\x00' * 4)
14382 packed.append(struct.pack("!Q", self.generation_id))
14383 length = sum([len(x) for x in packed])
14384 packed[2] = struct.pack("!H", length)
14385 return ''.join(packed)
14386
14387 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014388 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014389 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014390 _version = reader.read("!B")[0]
14391 assert(_version == 4)
14392 _type = reader.read("!B")[0]
14393 assert(_type == 24)
14394 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014395 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014396 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014397 obj.xid = reader.read("!L")[0]
14398 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014399 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014400 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014401 return obj
14402
14403 def __eq__(self, other):
14404 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014405 if self.xid != other.xid: return False
14406 if self.role != other.role: return False
14407 if self.generation_id != other.generation_id: return False
14408 return True
14409
Rich Lanec2ee4b82013-04-24 17:12:38 -070014410 def pretty_print(self, q):
14411 q.text("role_request {")
14412 with q.group():
14413 with q.indent(2):
14414 q.breakable()
14415 q.text("xid = ");
14416 if self.xid != None:
14417 q.text("%#x" % self.xid)
14418 else:
14419 q.text('None')
14420 q.text(","); q.breakable()
14421 q.text("role = ");
14422 q.text("%#x" % self.role)
14423 q.text(","); q.breakable()
14424 q.text("generation_id = ");
14425 q.text("%#x" % self.generation_id)
14426 q.breakable()
14427 q.text('}')
14428
Rich Lane7dcdf022013-12-11 14:45:27 -080014429message.subtypes[24] = role_request
14430
14431class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014432 version = 4
14433 type = 1
14434 err_type = 11
14435
14436 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014437 if xid != None:
14438 self.xid = xid
14439 else:
14440 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014441 if code != None:
14442 self.code = code
14443 else:
14444 self.code = 0
14445 if data != None:
14446 self.data = data
14447 else:
14448 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014449 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014450
14451 def pack(self):
14452 packed = []
14453 packed.append(struct.pack("!B", self.version))
14454 packed.append(struct.pack("!B", self.type))
14455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14456 packed.append(struct.pack("!L", self.xid))
14457 packed.append(struct.pack("!H", self.err_type))
14458 packed.append(struct.pack("!H", self.code))
14459 packed.append(self.data)
14460 length = sum([len(x) for x in packed])
14461 packed[2] = struct.pack("!H", length)
14462 return ''.join(packed)
14463
14464 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014465 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014466 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014467 _version = reader.read("!B")[0]
14468 assert(_version == 4)
14469 _type = reader.read("!B")[0]
14470 assert(_type == 1)
14471 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014472 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014473 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014474 obj.xid = reader.read("!L")[0]
14475 _err_type = reader.read("!H")[0]
14476 assert(_err_type == 11)
14477 obj.code = reader.read("!H")[0]
14478 obj.data = str(reader.read_all())
14479 return obj
14480
14481 def __eq__(self, other):
14482 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014483 if self.xid != other.xid: return False
14484 if self.code != other.code: return False
14485 if self.data != other.data: return False
14486 return True
14487
Rich Lane6f4978c2013-10-20 21:33:52 -070014488 def pretty_print(self, q):
14489 q.text("role_request_failed_error_msg {")
14490 with q.group():
14491 with q.indent(2):
14492 q.breakable()
14493 q.text("xid = ");
14494 if self.xid != None:
14495 q.text("%#x" % self.xid)
14496 else:
14497 q.text('None')
14498 q.text(","); q.breakable()
14499 q.text("code = ");
14500 q.text("%#x" % self.code)
14501 q.text(","); q.breakable()
14502 q.text("data = ");
14503 q.pp(self.data)
14504 q.breakable()
14505 q.text('}')
14506
Rich Lane7dcdf022013-12-11 14:45:27 -080014507error_msg.subtypes[11] = role_request_failed_error_msg
14508
14509class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014510 version = 4
14511 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070014512
14513 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014514 if xid != None:
14515 self.xid = xid
14516 else:
14517 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014518 if flags != None:
14519 self.flags = flags
14520 else:
14521 self.flags = 0
14522 if miss_send_len != None:
14523 self.miss_send_len = miss_send_len
14524 else:
14525 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014526 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014527
14528 def pack(self):
14529 packed = []
14530 packed.append(struct.pack("!B", self.version))
14531 packed.append(struct.pack("!B", self.type))
14532 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14533 packed.append(struct.pack("!L", self.xid))
14534 packed.append(struct.pack("!H", self.flags))
14535 packed.append(struct.pack("!H", self.miss_send_len))
14536 length = sum([len(x) for x in packed])
14537 packed[2] = struct.pack("!H", length)
14538 return ''.join(packed)
14539
14540 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014541 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014542 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070014543 _version = reader.read("!B")[0]
14544 assert(_version == 4)
14545 _type = reader.read("!B")[0]
14546 assert(_type == 9)
14547 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014548 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014549 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014550 obj.xid = reader.read("!L")[0]
14551 obj.flags = reader.read("!H")[0]
14552 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014553 return obj
14554
14555 def __eq__(self, other):
14556 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014557 if self.xid != other.xid: return False
14558 if self.flags != other.flags: return False
14559 if self.miss_send_len != other.miss_send_len: return False
14560 return True
14561
Rich Lanec2ee4b82013-04-24 17:12:38 -070014562 def pretty_print(self, q):
14563 q.text("set_config {")
14564 with q.group():
14565 with q.indent(2):
14566 q.breakable()
14567 q.text("xid = ");
14568 if self.xid != None:
14569 q.text("%#x" % self.xid)
14570 else:
14571 q.text('None')
14572 q.text(","); q.breakable()
14573 q.text("flags = ");
14574 q.text("%#x" % self.flags)
14575 q.text(","); q.breakable()
14576 q.text("miss_send_len = ");
14577 q.text("%#x" % self.miss_send_len)
14578 q.breakable()
14579 q.text('}')
14580
Rich Lane7dcdf022013-12-11 14:45:27 -080014581message.subtypes[9] = set_config
14582
14583class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014584 version = 4
14585 type = 1
14586 err_type = 10
14587
14588 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014589 if xid != None:
14590 self.xid = xid
14591 else:
14592 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014593 if code != None:
14594 self.code = code
14595 else:
14596 self.code = 0
14597 if data != None:
14598 self.data = data
14599 else:
14600 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014601 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014602
14603 def pack(self):
14604 packed = []
14605 packed.append(struct.pack("!B", self.version))
14606 packed.append(struct.pack("!B", self.type))
14607 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14608 packed.append(struct.pack("!L", self.xid))
14609 packed.append(struct.pack("!H", self.err_type))
14610 packed.append(struct.pack("!H", self.code))
14611 packed.append(self.data)
14612 length = sum([len(x) for x in packed])
14613 packed[2] = struct.pack("!H", length)
14614 return ''.join(packed)
14615
14616 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014617 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014618 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014619 _version = reader.read("!B")[0]
14620 assert(_version == 4)
14621 _type = reader.read("!B")[0]
14622 assert(_type == 1)
14623 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014624 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014625 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014626 obj.xid = reader.read("!L")[0]
14627 _err_type = reader.read("!H")[0]
14628 assert(_err_type == 10)
14629 obj.code = reader.read("!H")[0]
14630 obj.data = str(reader.read_all())
14631 return obj
14632
14633 def __eq__(self, other):
14634 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014635 if self.xid != other.xid: return False
14636 if self.code != other.code: return False
14637 if self.data != other.data: return False
14638 return True
14639
Rich Lane6f4978c2013-10-20 21:33:52 -070014640 def pretty_print(self, q):
14641 q.text("switch_config_failed_error_msg {")
14642 with q.group():
14643 with q.indent(2):
14644 q.breakable()
14645 q.text("xid = ");
14646 if self.xid != None:
14647 q.text("%#x" % self.xid)
14648 else:
14649 q.text('None')
14650 q.text(","); q.breakable()
14651 q.text("code = ");
14652 q.text("%#x" % self.code)
14653 q.text(","); q.breakable()
14654 q.text("data = ");
14655 q.pp(self.data)
14656 q.breakable()
14657 q.text('}')
14658
Rich Lane7dcdf022013-12-11 14:45:27 -080014659error_msg.subtypes[10] = switch_config_failed_error_msg
14660
14661class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014662 version = 4
14663 type = 1
14664 err_type = 13
14665
14666 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014667 if xid != None:
14668 self.xid = xid
14669 else:
14670 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014671 if code != None:
14672 self.code = code
14673 else:
14674 self.code = 0
14675 if data != None:
14676 self.data = data
14677 else:
14678 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014679 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014680
14681 def pack(self):
14682 packed = []
14683 packed.append(struct.pack("!B", self.version))
14684 packed.append(struct.pack("!B", self.type))
14685 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14686 packed.append(struct.pack("!L", self.xid))
14687 packed.append(struct.pack("!H", self.err_type))
14688 packed.append(struct.pack("!H", self.code))
14689 packed.append(self.data)
14690 length = sum([len(x) for x in packed])
14691 packed[2] = struct.pack("!H", length)
14692 return ''.join(packed)
14693
14694 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014695 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014696 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014697 _version = reader.read("!B")[0]
14698 assert(_version == 4)
14699 _type = reader.read("!B")[0]
14700 assert(_type == 1)
14701 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014702 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014703 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014704 obj.xid = reader.read("!L")[0]
14705 _err_type = reader.read("!H")[0]
14706 assert(_err_type == 13)
14707 obj.code = reader.read("!H")[0]
14708 obj.data = str(reader.read_all())
14709 return obj
14710
14711 def __eq__(self, other):
14712 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014713 if self.xid != other.xid: return False
14714 if self.code != other.code: return False
14715 if self.data != other.data: return False
14716 return True
14717
Rich Lane6f4978c2013-10-20 21:33:52 -070014718 def pretty_print(self, q):
14719 q.text("table_features_failed_error_msg {")
14720 with q.group():
14721 with q.indent(2):
14722 q.breakable()
14723 q.text("xid = ");
14724 if self.xid != None:
14725 q.text("%#x" % self.xid)
14726 else:
14727 q.text('None')
14728 q.text(","); q.breakable()
14729 q.text("code = ");
14730 q.text("%#x" % self.code)
14731 q.text(","); q.breakable()
14732 q.text("data = ");
14733 q.pp(self.data)
14734 q.breakable()
14735 q.text('}')
14736
Rich Lane7dcdf022013-12-11 14:45:27 -080014737error_msg.subtypes[13] = table_features_failed_error_msg
14738
14739class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014740 version = 4
14741 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014742 stats_type = 12
14743
14744 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014745 if xid != None:
14746 self.xid = xid
14747 else:
14748 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014749 if flags != None:
14750 self.flags = flags
14751 else:
14752 self.flags = 0
14753 if entries != None:
14754 self.entries = entries
14755 else:
14756 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014757 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014758
14759 def pack(self):
14760 packed = []
14761 packed.append(struct.pack("!B", self.version))
14762 packed.append(struct.pack("!B", self.type))
14763 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14764 packed.append(struct.pack("!L", self.xid))
14765 packed.append(struct.pack("!H", self.stats_type))
14766 packed.append(struct.pack("!H", self.flags))
14767 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014768 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014769 length = sum([len(x) for x in packed])
14770 packed[2] = struct.pack("!H", length)
14771 return ''.join(packed)
14772
14773 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014774 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014775 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014776 _version = reader.read("!B")[0]
14777 assert(_version == 4)
14778 _type = reader.read("!B")[0]
14779 assert(_type == 19)
14780 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014781 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014782 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014783 obj.xid = reader.read("!L")[0]
14784 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014785 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014786 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014787 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014788 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014789 return obj
14790
14791 def __eq__(self, other):
14792 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014793 if self.xid != other.xid: return False
14794 if self.flags != other.flags: return False
14795 if self.entries != other.entries: return False
14796 return True
14797
Rich Lanec2ee4b82013-04-24 17:12:38 -070014798 def pretty_print(self, q):
14799 q.text("table_features_stats_reply {")
14800 with q.group():
14801 with q.indent(2):
14802 q.breakable()
14803 q.text("xid = ");
14804 if self.xid != None:
14805 q.text("%#x" % self.xid)
14806 else:
14807 q.text('None')
14808 q.text(","); q.breakable()
14809 q.text("flags = ");
14810 q.text("%#x" % self.flags)
14811 q.text(","); q.breakable()
14812 q.text("entries = ");
14813 q.pp(self.entries)
14814 q.breakable()
14815 q.text('}')
14816
Rich Lane7dcdf022013-12-11 14:45:27 -080014817stats_reply.subtypes[12] = table_features_stats_reply
14818
14819class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014820 version = 4
14821 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014822 stats_type = 12
14823
14824 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014825 if xid != None:
14826 self.xid = xid
14827 else:
14828 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014829 if flags != None:
14830 self.flags = flags
14831 else:
14832 self.flags = 0
14833 if entries != None:
14834 self.entries = entries
14835 else:
14836 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014837 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014838
14839 def pack(self):
14840 packed = []
14841 packed.append(struct.pack("!B", self.version))
14842 packed.append(struct.pack("!B", self.type))
14843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14844 packed.append(struct.pack("!L", self.xid))
14845 packed.append(struct.pack("!H", self.stats_type))
14846 packed.append(struct.pack("!H", self.flags))
14847 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014848 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014849 length = sum([len(x) for x in packed])
14850 packed[2] = struct.pack("!H", length)
14851 return ''.join(packed)
14852
14853 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014854 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014855 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014856 _version = reader.read("!B")[0]
14857 assert(_version == 4)
14858 _type = reader.read("!B")[0]
14859 assert(_type == 18)
14860 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014861 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014862 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014863 obj.xid = reader.read("!L")[0]
14864 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014865 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014866 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014867 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014868 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014869 return obj
14870
14871 def __eq__(self, other):
14872 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014873 if self.xid != other.xid: return False
14874 if self.flags != other.flags: return False
14875 if self.entries != other.entries: return False
14876 return True
14877
Rich Lanec2ee4b82013-04-24 17:12:38 -070014878 def pretty_print(self, q):
14879 q.text("table_features_stats_request {")
14880 with q.group():
14881 with q.indent(2):
14882 q.breakable()
14883 q.text("xid = ");
14884 if self.xid != None:
14885 q.text("%#x" % self.xid)
14886 else:
14887 q.text('None')
14888 q.text(","); q.breakable()
14889 q.text("flags = ");
14890 q.text("%#x" % self.flags)
14891 q.text(","); q.breakable()
14892 q.text("entries = ");
14893 q.pp(self.entries)
14894 q.breakable()
14895 q.text('}')
14896
Rich Lane7dcdf022013-12-11 14:45:27 -080014897stats_request.subtypes[12] = table_features_stats_request
14898
14899class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014900 version = 4
14901 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070014902
14903 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014904 if xid != None:
14905 self.xid = xid
14906 else:
14907 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014908 if table_id != None:
14909 self.table_id = table_id
14910 else:
14911 self.table_id = 0
14912 if config != None:
14913 self.config = config
14914 else:
14915 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014916 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014917
14918 def pack(self):
14919 packed = []
14920 packed.append(struct.pack("!B", self.version))
14921 packed.append(struct.pack("!B", self.type))
14922 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14923 packed.append(struct.pack("!L", self.xid))
14924 packed.append(struct.pack("!B", self.table_id))
14925 packed.append('\x00' * 3)
14926 packed.append(struct.pack("!L", self.config))
14927 length = sum([len(x) for x in packed])
14928 packed[2] = struct.pack("!H", length)
14929 return ''.join(packed)
14930
14931 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014932 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014933 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070014934 _version = reader.read("!B")[0]
14935 assert(_version == 4)
14936 _type = reader.read("!B")[0]
14937 assert(_type == 17)
14938 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014939 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014940 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014941 obj.xid = reader.read("!L")[0]
14942 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014943 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070014944 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014945 return obj
14946
14947 def __eq__(self, other):
14948 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014949 if self.xid != other.xid: return False
14950 if self.table_id != other.table_id: return False
14951 if self.config != other.config: return False
14952 return True
14953
Rich Lanec2ee4b82013-04-24 17:12:38 -070014954 def pretty_print(self, q):
14955 q.text("table_mod {")
14956 with q.group():
14957 with q.indent(2):
14958 q.breakable()
14959 q.text("xid = ");
14960 if self.xid != None:
14961 q.text("%#x" % self.xid)
14962 else:
14963 q.text('None')
14964 q.text(","); q.breakable()
14965 q.text("table_id = ");
14966 q.text("%#x" % self.table_id)
14967 q.text(","); q.breakable()
14968 q.text("config = ");
14969 q.text("%#x" % self.config)
14970 q.breakable()
14971 q.text('}')
14972
Rich Lane7dcdf022013-12-11 14:45:27 -080014973message.subtypes[17] = table_mod
14974
14975class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014976 version = 4
14977 type = 1
14978 err_type = 8
14979
14980 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014981 if xid != None:
14982 self.xid = xid
14983 else:
14984 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014985 if code != None:
14986 self.code = code
14987 else:
14988 self.code = 0
14989 if data != None:
14990 self.data = data
14991 else:
14992 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014993 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014994
14995 def pack(self):
14996 packed = []
14997 packed.append(struct.pack("!B", self.version))
14998 packed.append(struct.pack("!B", self.type))
14999 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15000 packed.append(struct.pack("!L", self.xid))
15001 packed.append(struct.pack("!H", self.err_type))
15002 packed.append(struct.pack("!H", self.code))
15003 packed.append(self.data)
15004 length = sum([len(x) for x in packed])
15005 packed[2] = struct.pack("!H", length)
15006 return ''.join(packed)
15007
15008 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015009 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070015010 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070015011 _version = reader.read("!B")[0]
15012 assert(_version == 4)
15013 _type = reader.read("!B")[0]
15014 assert(_type == 1)
15015 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015016 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015017 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070015018 obj.xid = reader.read("!L")[0]
15019 _err_type = reader.read("!H")[0]
15020 assert(_err_type == 8)
15021 obj.code = reader.read("!H")[0]
15022 obj.data = str(reader.read_all())
15023 return obj
15024
15025 def __eq__(self, other):
15026 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070015027 if self.xid != other.xid: return False
15028 if self.code != other.code: return False
15029 if self.data != other.data: return False
15030 return True
15031
Rich Lane6f4978c2013-10-20 21:33:52 -070015032 def pretty_print(self, q):
15033 q.text("table_mod_failed_error_msg {")
15034 with q.group():
15035 with q.indent(2):
15036 q.breakable()
15037 q.text("xid = ");
15038 if self.xid != None:
15039 q.text("%#x" % self.xid)
15040 else:
15041 q.text('None')
15042 q.text(","); q.breakable()
15043 q.text("code = ");
15044 q.text("%#x" % self.code)
15045 q.text(","); q.breakable()
15046 q.text("data = ");
15047 q.pp(self.data)
15048 q.breakable()
15049 q.text('}')
15050
Rich Lane7dcdf022013-12-11 14:45:27 -080015051error_msg.subtypes[8] = table_mod_failed_error_msg
15052
15053class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070015054 version = 4
15055 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070015056 stats_type = 3
15057
15058 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015059 if xid != None:
15060 self.xid = xid
15061 else:
15062 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015063 if flags != None:
15064 self.flags = flags
15065 else:
15066 self.flags = 0
15067 if entries != None:
15068 self.entries = entries
15069 else:
15070 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080015071 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015072
15073 def pack(self):
15074 packed = []
15075 packed.append(struct.pack("!B", self.version))
15076 packed.append(struct.pack("!B", self.type))
15077 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15078 packed.append(struct.pack("!L", self.xid))
15079 packed.append(struct.pack("!H", self.stats_type))
15080 packed.append(struct.pack("!H", self.flags))
15081 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080015082 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015083 length = sum([len(x) for x in packed])
15084 packed[2] = struct.pack("!H", length)
15085 return ''.join(packed)
15086
15087 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015088 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015089 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070015090 _version = reader.read("!B")[0]
15091 assert(_version == 4)
15092 _type = reader.read("!B")[0]
15093 assert(_type == 19)
15094 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015095 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015096 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015097 obj.xid = reader.read("!L")[0]
15098 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015099 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015100 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015101 reader.skip(4)
15102 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
15103 return obj
15104
15105 def __eq__(self, other):
15106 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015107 if self.xid != other.xid: return False
15108 if self.flags != other.flags: return False
15109 if self.entries != other.entries: return False
15110 return True
15111
Rich Lanec2ee4b82013-04-24 17:12:38 -070015112 def pretty_print(self, q):
15113 q.text("table_stats_reply {")
15114 with q.group():
15115 with q.indent(2):
15116 q.breakable()
15117 q.text("xid = ");
15118 if self.xid != None:
15119 q.text("%#x" % self.xid)
15120 else:
15121 q.text('None')
15122 q.text(","); q.breakable()
15123 q.text("flags = ");
15124 q.text("%#x" % self.flags)
15125 q.text(","); q.breakable()
15126 q.text("entries = ");
15127 q.pp(self.entries)
15128 q.breakable()
15129 q.text('}')
15130
Rich Lane7dcdf022013-12-11 14:45:27 -080015131stats_reply.subtypes[3] = table_stats_reply
15132
15133class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070015134 version = 4
15135 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070015136 stats_type = 3
15137
15138 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015139 if xid != None:
15140 self.xid = xid
15141 else:
15142 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015143 if flags != None:
15144 self.flags = flags
15145 else:
15146 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080015147 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015148
15149 def pack(self):
15150 packed = []
15151 packed.append(struct.pack("!B", self.version))
15152 packed.append(struct.pack("!B", self.type))
15153 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15154 packed.append(struct.pack("!L", self.xid))
15155 packed.append(struct.pack("!H", self.stats_type))
15156 packed.append(struct.pack("!H", self.flags))
15157 packed.append('\x00' * 4)
15158 length = sum([len(x) for x in packed])
15159 packed[2] = struct.pack("!H", length)
15160 return ''.join(packed)
15161
15162 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015163 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015164 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070015165 _version = reader.read("!B")[0]
15166 assert(_version == 4)
15167 _type = reader.read("!B")[0]
15168 assert(_type == 18)
15169 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015170 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015171 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015172 obj.xid = reader.read("!L")[0]
15173 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015174 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015175 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015176 reader.skip(4)
15177 return obj
15178
15179 def __eq__(self, other):
15180 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015181 if self.xid != other.xid: return False
15182 if self.flags != other.flags: return False
15183 return True
15184
Rich Lanec2ee4b82013-04-24 17:12:38 -070015185 def pretty_print(self, q):
15186 q.text("table_stats_request {")
15187 with q.group():
15188 with q.indent(2):
15189 q.breakable()
15190 q.text("xid = ");
15191 if self.xid != None:
15192 q.text("%#x" % self.xid)
15193 else:
15194 q.text('None')
15195 q.text(","); q.breakable()
15196 q.text("flags = ");
15197 q.text("%#x" % self.flags)
15198 q.breakable()
15199 q.text('}')
15200
Rich Lane7dcdf022013-12-11 14:45:27 -080015201stats_request.subtypes[3] = table_stats_request
15202
Rich Lanec2ee4b82013-04-24 17:12:38 -070015203
15204def parse_header(buf):
15205 if len(buf) < 8:
15206 raise loxi.ProtocolError("too short to be an OpenFlow message")
15207 return struct.unpack_from("!BBHL", buf)
15208
15209def parse_message(buf):
15210 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070015211 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
15212 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015213 if len(buf) != msg_len:
15214 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080015215 return message.unpack(loxi.generic_util.OFReader(buf))